From patchwork Sun Jan 8 03:02:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 40480 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1545934wrt; Sat, 7 Jan 2023 19:16:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXsLm8gxLbzeXjkfLOwPfnAGLe2hPpEKI2DH1l+qCMrzV4sc4wGnb0zCwtlu+Y+9idzL1a9x X-Received: by 2002:a05:6402:cb4:b0:483:6d73:ad02 with SMTP id cn20-20020a0564020cb400b004836d73ad02mr50534604edb.35.1673147778385; Sat, 07 Jan 2023 19:16:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673147778; cv=none; d=google.com; s=arc-20160816; b=Fh0i8zRZyldhPzLiT8xWQe//C0lW2lyYyoXxIDb///36TMRng89NUxx2hDSdHiUh+E IXGC4+jFr6sgBYNY1Nx8dCqYZhfpGv4Ub5hZltltsoSIKcGVQXbZHRKMfOXA7LGviWrJ 0ZYZcd+BcwP+rLyK4OM/IY8aezZfOzbD2zwCKA6W9wFsZBdvQ16tS3bRjMnad1a+d19C 58e5IcVLKTGRdYY/S640tAA/a653ZfRzqh9Znfn8P4owS2S3hcG9+3vbBdsIONQ+zZ5d SpZEoXbgn/qLfRt03lNyCfg+mSeGav10MFYZqcWVztux+BvMIYZe3IVVyXPGxCnro2Yq ApQA== 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=wFF3kyw6Xt7zTuOyrmiEHOoFbNHi+LW5wTkpbKKSdJ0=; b=pRRUrrvDMcjPdlMPqHfd+e/oMsOy1cP+Se+35EZ14Y81eSHgXxbGX9wdrVdyJNpdsG ZCNd9gEfe5nnNN3eKG/ujSbtSXM6FI3Qu6rLYH3+uV8S2SCJDlhnjD/bbh+3ujZ5QW95 G9WT8fMYHNp21Wy3isJ6ItSfuYt1JavSAjYvJRiul7QjI7vcPVO5fYvhNIxb6YXeraCH uMkJlFcfwJ7A582ss1TJJ6W8+eritJ3RdjKwLiP77ptoYCkGLGvwTY6bgKN3oNmpcLmJ XSSDp4Gdp9pbz7Odx8moq3nntx8jVg33UJVUpBia5Jac3qB9Z7I/QxtsMiQ8gHFjsKuY gm5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=IrwnRhtU; 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 q36-20020a05640224a400b004608c0b9a8asi5839280eda.201.2023.01.07.19.15.54; Sat, 07 Jan 2023 19:16:17 -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=IrwnRhtU; 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 S235384AbjAHDDm (ORCPT + 99 others); Sat, 7 Jan 2023 22:03:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232110AbjAHDCm (ORCPT ); Sat, 7 Jan 2023 22:02:42 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3A82392F9 for ; Sat, 7 Jan 2023 19:02:30 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id q9so3725269pgq.5 for ; Sat, 07 Jan 2023 19:02:30 -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=wFF3kyw6Xt7zTuOyrmiEHOoFbNHi+LW5wTkpbKKSdJ0=; b=IrwnRhtUDBVD3xek1g82sMfwGAjM3IMAI+aHPqxJIauCE1CJmo/qnvJQ0DskoWcU5N uAtWC4b6bKQeoaJBoOGOlAbBAKSDRJnJeWxBUN5AJG8IOZyf6MdR3QPQL1PxekLDX958 2P46tjqlZQO/CRBEW63Df1sVslijnoUoOsQxk= 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=wFF3kyw6Xt7zTuOyrmiEHOoFbNHi+LW5wTkpbKKSdJ0=; b=mst8A9gSBy1DjOyrZggKqrNIUl5hDIjHVh5KO8+Kraw034YMGtEMcr7kLnz5+HiiMx 25FrUGU9y37x3uP75jDjGa5SVb9Fto2hMm8ZK3bawVQbUaF8ctvr2P79gMB3sle6bGf/ pcnkMDe23DNC3Ls4Z+ii46URjgL96cvDJTsDXwEd11VpFyyBgHiusLktg5Pn1/Cjskqv HrJHvzdRJkcQ2If40AxbpM0K281DLRB/cMzEqzd855Sl8x4AGf66cL5SAQs8Msr/OtXo /1vxamiMKC5h3VHtsxUcGZv36i625St3LHnISyIUBDtcSAduKbG0cVFYluAZRfrk5vHJ E7+Q== X-Gm-Message-State: AFqh2kqkynY1ewUQVFgrRQU7Pi01OQBMn8UhUGB2PdkQlMgibbYDaqfN OFDjF+QmoUAoZBHAb6uiFJ+uPg== X-Received: by 2002:aa7:8710:0:b0:586:5889:c7b2 with SMTP id b16-20020aa78710000000b005865889c7b2mr4121384pfo.28.1673146949897; Sat, 07 Jan 2023 19:02:29 -0800 (PST) Received: from localhost.localdomain ([2605:a601:a780:1400:1caf:227a:5e9d:33c3]) by smtp.gmail.com with ESMTPSA id 69-20020a621748000000b005810a54fdefsm3452148pfx.114.2023.01.07.19.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 19:02:29 -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, Leon Romanovsky Subject: [PATCH 7/8] RDMA/bnxt_re: Remove the sriov config callback Date: Sat, 7 Jan 2023 19:02:07 -0800 Message-Id: <20230108030208.26390-8-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230108030208.26390-1-ajit.khaparde@broadcom.com> References: <20230108030208.26390-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?1754422604703193280?= X-GMAIL-MSGID: =?utf-8?q?1754422604703193280?= 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 --- 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 3251078e9fe3..b287c3ba9352 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 8e098876c75e..57efa4ebc93a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -260,16 +260,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_dev *bnxt_aux = bp->aux_dev; @@ -322,25 +312,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 dc7cb946f112..1e7e32a4ab19 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h @@ -27,7 +27,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 *); };