From patchwork Thu Jan 12 20:29:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 42795 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4100822wrt; Thu, 12 Jan 2023 12:56:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXuegX+7E5wjcfkv4eorJfppapkKX+g0g42I6VtLcXYrQwAg3dnLUObBndJMUH3A96LFA1t1 X-Received: by 2002:a17:907:7f12:b0:7c1:9eb:845b with SMTP id qf18-20020a1709077f1200b007c109eb845bmr1061346ejc.16.1673557011182; Thu, 12 Jan 2023 12:56:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673557011; cv=none; d=google.com; s=arc-20160816; b=CG7cmJ+5/cBX5vBm8xbDZKXEIJN7w70RXX5Mpt1RtzJUy12pJDKCGcODDIMDE1h7um tbvPorIOsd6RC2vpvcNqY6GHGhPvj2dv72abwCfh+fWIi4N13K/LCDYgP8rktXHFrzLm 8yG3iBQpMeScfKMtEd+GmwEwd4xgs3n4iDM3u+Vc97SiClySV8OPlf34wcBN27sxSHSh 5yyAewVpd+PpMWVilDI4Qv+Qgk0k0y54Gd2w5TOApM+884960GnnvBhqyCDMR6Yfptnn NeSjKRAimANV148zqHFYh6e2hfiFyAhBJjcR/6hqKQe3kBlFJziFBt8etGDMrJ9syoAz BFXA== 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=h8C9WYRMHCIjP1yf/vn+urDTFS1WheXyJHwMT65cGWg=; b=YU7+CFO7G/l5lRHCt0ZonUi5wa1/6KUeGqZa/LiOynwBdXTzCTxwd4nVoQOfwjDZpg HZCuPTSsrcy33FpODCkOOcWMDgXdpWIF8L//Ooh8xwL9Pai6wTc0+dgiQQhVqdQzgI4o 9lsmebDI+Y6XaF9TkJxfKKguHk2AUz1kqba/qPlHE6YWZVW9ui45cJ02Vbe8iY27c68w aVmcsYLmtJn18uB/6Qt+1ND5NLYQ6ZTTnZWGckoCpFU8efZXSOTNeLNCfinqeqRiffM5 GqzE9Z4x9NC7lJmVUo9KbPNOFQHFeeQ1X7Q9PV0OPZXMqeYscaBF8o1pkjpSBr0Thn+a SAXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=FrRFg8l4; 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 dd20-20020a1709069b9400b0085b4d436b51si8016697ejc.996.2023.01.12.12.56.26; Thu, 12 Jan 2023 12:56:50 -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=FrRFg8l4; 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 S240602AbjALUzJ (ORCPT + 99 others); Thu, 12 Jan 2023 15:55:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240337AbjALUxX (ORCPT ); Thu, 12 Jan 2023 15:53:23 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ADFA1DDD5 for ; Thu, 12 Jan 2023 12:29:58 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id q64so20304717pjq.4 for ; Thu, 12 Jan 2023 12:29:58 -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=h8C9WYRMHCIjP1yf/vn+urDTFS1WheXyJHwMT65cGWg=; b=FrRFg8l4TYYessIIIX43rpVQiTlYnBkY9h92du5LekhF3j4DswuhL4/1YWBFeUUXO6 GWvoMgOu2v4fV4TJZzB3j/gpqCzw7Xcyf2ZjDr7oNogSSHXWdUrpJpdqvRD5SYb55g8b z00L7yyD8ZBxL3HBJnVTHGED2YDueU8iJPlkg= 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=h8C9WYRMHCIjP1yf/vn+urDTFS1WheXyJHwMT65cGWg=; b=aeKc3iLgk5DHgXkjIw0+3VXNPZscB1+aJysJWm/PRxD1xhSnrP1+BgMf73TNsrj6xo 95YEn6xK7KFBRwnGppAUNn5NmHgXidnWa3prlcWEaVUmV5PlC6ebAr9LDW/TtMOTS95m nv4nCtqwnv9Q1tI9pH4xMqF5+KRGbYR7h/H0e/yDbgnxoP8K8Dkq/8eo05o17wxECG2m UaBPSzforA/zGVn7M8liIwmPrzZ5VGIFE6rvB7krE+YBNadYg6tVz2tYJAvT4UQqvqc9 O/IrgoLwPbhMdv3KhQVktBiyKThnnFN98fxD4q6efsMCUWHlRaaWjYPXHzUxDpgK7/Je /zJg== X-Gm-Message-State: AFqh2koNhII/6iKO/h17ub/K3tqSzHtTu8NAxcgoehSTuG8L9tc3SwUw UdGjjB9RdndNk6p0E/uze9IBVg== X-Received: by 2002:a05:6a20:ba9d:b0:b6:1413:fff0 with SMTP id fb29-20020a056a20ba9d00b000b61413fff0mr12890962pzb.50.1673555397731; Thu, 12 Jan 2023 12:29:57 -0800 (PST) Received: from C02GC2QQMD6T.wifi.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 129-20020a630887000000b004777c56747csm10283855pgi.11.2023.01.12.12.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 12:29:57 -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 net-next v7 7/8] RDMA/bnxt_re: Remove the sriov config callback Date: Thu, 12 Jan 2023 12:29:38 -0800 Message-Id: <20230112202939.19562-8-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230112202939.19562-1-ajit.khaparde@broadcom.com> References: <20230112202939.19562-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?1754851716724568775?= X-GMAIL-MSGID: =?utf-8?q?1754851716724568775?= 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 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 8bc78d5525ad..2164b4419263 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 ce939df24574..0e15b35c36dd 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 *); };