From patchwork Tue Jan 31 05:25:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 50611 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2570297wrn; Mon, 30 Jan 2023 21:29:37 -0800 (PST) X-Google-Smtp-Source: AK7set/MN03Xs/SM4RsLh8/L4wQQK+c6tppZEYwok7jC0cHjePuSzj/HR6rU4brhFz8jY7MulHE6 X-Received: by 2002:a17:906:6db:b0:87b:d597:1fd5 with SMTP id v27-20020a17090606db00b0087bd5971fd5mr17329009ejb.75.1675142977275; Mon, 30 Jan 2023 21:29:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675142977; cv=none; d=google.com; s=arc-20160816; b=wWGs19AiiqVpJcGiK0wxsb3EDqmYc+JgDwRhq9LeRnrM+zmVir9goSsrIQ4P1ARuTx wODXQxjeExMUgzGU1vvioyUWCivdZiwUELEKdh2jMO9qJnF0mNLoSLIUKwvPSv1vDF8C JYnjGH4jRkefgyqR3yYr5cP8JXtWXisUTQwmp+EuCkyUQagHJAi9sI0Xw/NtIKww3B9O sBe8iPboTwAEpwcIadQf4NChILE8XhTjoqBCV46ACbDT0v5+LZpHZm9JhnuI5a3WWyzS VAtSIbFXJnOtLE+qBqHCbSTN/b6IryM1BhRP/ivuY2FFpnGqQMyGHenyitFTdfA6u4S4 Kqvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+O8KWCroo2161P9B9g6JCettFGAqWNsTAzgVxWSxUro=; b=OnIfdS7iKmhIFEnZxT1crzzaO7e5BROgTSijJ8ptNp+G5ojTTMCbdAv7vWADrqmqMx BXjHgKMoJUjsCDzL1MqM8KEcT28hWZcQLn3yxHn+Kft4J2gq5Gu0u0y2kv1iNmTCbx8y bNWvDt5VLF+VaG4YvNjOTpbBE4tmYyNFyzTAJ4OVt3/t8qVLL59CO8QRwV//sc6xoqNQ tkMSM8TvHlsb7xBbyncvMwsCoLK9K0FtvzMXD9yPf+29/PHEorrRdAR2tyOGmYkCaTWL OHFBo7UyUFXGYStdcuMUAQXlDb84K7lGK9fvVWdz4OenOsOh5emV1bBxVm5kIx3ZAPkV EjOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="QxhlS/jn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et16-20020a170907295000b008888f4120c1si5309412ejc.695.2023.01.30.21.29.12; Mon, 30 Jan 2023 21:29:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="QxhlS/jn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbjAaF1U (ORCPT + 99 others); Tue, 31 Jan 2023 00:27:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230428AbjAaF0Z (ORCPT ); Tue, 31 Jan 2023 00:26:25 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464DD3B0DE for ; Mon, 30 Jan 2023 21:26:18 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id e8-20020a17090a9a8800b0022c387f0f93so12824806pjp.3 for ; Mon, 30 Jan 2023 21:26:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=+O8KWCroo2161P9B9g6JCettFGAqWNsTAzgVxWSxUro=; b=QxhlS/jni1MnzIXLFI0rW2DoqXXXGXF/ckq4P5B1hBCgUrG050yp1GIUI7pTJqe75H 6DbXgGP5kTXpqOAbYAn5ewt+bU2GGJv0dsj84tBR8FX6UMypE1F6iPTDPkOHdiPzx1I3 1aY6+U4Z+CJ4BT+yeaih61EuvYRaGlFMAfm20= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+O8KWCroo2161P9B9g6JCettFGAqWNsTAzgVxWSxUro=; b=ot/bN8haBaQdxLs8wxvWdSoh8BgjjhR8LVkcX5Macx+OV//VFphPe+30LtCXI/DU5Z GO7ifqYbi+XcMnW0qPsbqekqoJZLv6EdoNYwKILVEJRbEvO29xMXQTJC47vidi6vxf26 XrpTuHttJXipXzb823YxZtumnBRBPeKuUgboNVTrxu37rJwsgrs9T24YDjAlay4tdyJf 6U6shiWd8Ws9iUVGHsWshuFTRjRDOveYNP22efOQwcpWbfY8HLqjbrp7oUAQXdo2REg5 mRM82zFJS3g/cG+djoNAzT7nyYCsM4e+ODMWy23akQd0B7hhaUXmBE4klTmrmddBlolY NyZw== X-Gm-Message-State: AFqh2koIZJKG0Q9ta8EPgWLtleykW2ohd0mrKVamhlEHcvK6zPPBMrmq Mmk7q+N4SxnxXH4Rfzk940LEUg== X-Received: by 2002:a17:903:124d:b0:195:e92e:c4d3 with SMTP id u13-20020a170903124d00b00195e92ec4d3mr43880033plh.46.1675142777861; Mon, 30 Jan 2023 21:26:17 -0800 (PST) Received: from localhost.localdomain ([2605:a601:a780:1400:a879:b64b:d9bd:3c1]) by smtp.gmail.com with ESMTPSA id jk15-20020a170903330f00b001960cccc318sm2310106plb.121.2023.01.30.21.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 21:26:17 -0800 (PST) From: Ajit Khaparde To: ajit.khaparde@broadcom.com Cc: andrew.gospodarek@broadcom.com, davem@davemloft.net, edumazet@google.com, jgg@ziepe.ca, kuba@kernel.org, leon@kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, michael.chan@broadcom.com, netdev@vger.kernel.org, pabeni@redhat.com, selvin.xavier@broadcom.com, gregkh@linuxfoundation.org, Leon Romanovsky Subject: [PATCH net-next v9 7/8] RDMA/bnxt_re: Remove the sriov config callback Date: Mon, 30 Jan 2023 21:25:56 -0800 Message-Id: <20230131052557.99119-8-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230131052557.99119-1-ajit.khaparde@broadcom.com> References: <20230131052557.99119-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756514722585885854?= X-GMAIL-MSGID: =?utf-8?q?1756514722585885854?= Remove the SRIOV config callback which the bnxt_en was calling to reconfigure the chip resources for a PF device when VFs are created. The code is now modified to provision the VF resources based on the total VF count instead of the actual VF count. This allows the SRIOV config callback to be removed from the list of ulp_ops. Suggested-by: Leon Romanovsky Signed-off-by: Ajit Khaparde Reviewed-by: Leon Romanovsky --- drivers/infiniband/hw/bnxt_re/main.c | 11 ++++--- .../net/ethernet/broadcom/bnxt/bnxt_sriov.c | 7 +---- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 29 ------------------- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 1 - 4 files changed, 8 insertions(+), 40 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index ed7ac6acaaff..60df6809bc60 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -221,13 +221,12 @@ static void bnxt_re_set_resource_limits(struct bnxt_re_dev *rdev) bnxt_re_limit_vf_res(&rdev->qplib_ctx, num_vfs); } -static void bnxt_re_sriov_config(void *p, int num_vfs) +static void bnxt_re_vf_res_config(struct bnxt_re_dev *rdev) { - struct bnxt_re_dev *rdev = p; if (test_bit(BNXT_RE_FLAG_ERR_DEVICE_DETACHED, &rdev->flags)) return; - rdev->num_vfs = num_vfs; + rdev->num_vfs = pci_sriov_get_totalvfs(rdev->en_dev->pdev); if (!bnxt_qplib_is_chip_gen_p5(rdev->chip_ctx)) { bnxt_re_set_resource_limits(rdev); bnxt_qplib_set_func_resources(&rdev->qplib_res, &rdev->rcfw, @@ -297,7 +296,6 @@ static void bnxt_re_start_irq(void *handle, struct bnxt_msix_entry *ent) } static struct bnxt_ulp_ops bnxt_re_ulp_ops = { - .ulp_sriov_config = bnxt_re_sriov_config, .ulp_irq_stop = bnxt_re_stop_irq, .ulp_irq_restart = bnxt_re_start_irq }; @@ -1369,6 +1367,11 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 wqe_mode) INIT_DELAYED_WORK(&rdev->worker, bnxt_re_worker); set_bit(BNXT_RE_FLAG_QOS_WORK_REG, &rdev->flags); schedule_delayed_work(&rdev->worker, msecs_to_jiffies(30000)); + /* + * Use the total VF count since the actual VF count may not be + * available at this point. + */ + bnxt_re_vf_res_config(rdev); } return 0; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c index a4cba7cb2783..3ed3a2b3b3a9 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c @@ -749,7 +749,6 @@ int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset) *num_vfs = rc; } - bnxt_ulp_sriov_cfg(bp, *num_vfs); return 0; } @@ -823,10 +822,8 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) goto err_out2; rc = pci_enable_sriov(bp->pdev, *num_vfs); - if (rc) { - bnxt_ulp_sriov_cfg(bp, 0); + if (rc) goto err_out2; - } return 0; @@ -872,8 +869,6 @@ void bnxt_sriov_disable(struct bnxt *bp) rtnl_lock(); bnxt_restore_pf_fw_resources(bp); rtnl_unlock(); - - bnxt_ulp_sriov_cfg(bp, 0); } int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index fc5ded5d0d09..30d4a227fbf9 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -259,16 +259,6 @@ int bnxt_send_msg(struct bnxt_en_dev *edev, } EXPORT_SYMBOL(bnxt_send_msg); -static void bnxt_ulp_get(struct bnxt_ulp *ulp) -{ - atomic_inc(&ulp->ref_count); -} - -static void bnxt_ulp_put(struct bnxt_ulp *ulp) -{ - atomic_dec(&ulp->ref_count); -} - void bnxt_ulp_stop(struct bnxt *bp) { struct bnxt_aux_priv *aux_priv = bp->aux_priv; @@ -321,25 +311,6 @@ void bnxt_ulp_start(struct bnxt *bp, int err) } -void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs) -{ - struct bnxt_en_dev *edev = bp->edev; - struct bnxt_ulp_ops *ops; - struct bnxt_ulp *ulp; - - if (!edev) - return; - ulp = edev->ulp_tbl; - - ops = rcu_dereference(ulp->ulp_ops); - if (!ops || !ops->ulp_sriov_config) - return; - - bnxt_ulp_get(ulp); - ops->ulp_sriov_config(ulp->handle, num_vfs); - bnxt_ulp_put(ulp); -} - void bnxt_ulp_irq_stop(struct bnxt *bp) { struct bnxt_en_dev *edev = bp->edev; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h index c62986e4cc82..ed2832975912 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h @@ -26,7 +26,6 @@ struct bnxt_msix_entry { }; struct bnxt_ulp_ops { - void (*ulp_sriov_config)(void *, int); void (*ulp_irq_stop)(void *); void (*ulp_irq_restart)(void *, struct bnxt_msix_entry *); };