From patchwork Thu Nov 3 23:33:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13031124 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EBBDC4332F for ; Thu, 3 Nov 2022 23:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230258AbiKCXdt (ORCPT ); Thu, 3 Nov 2022 19:33:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231334AbiKCXdn (ORCPT ); Thu, 3 Nov 2022 19:33:43 -0400 Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAC6A60DA for ; Thu, 3 Nov 2022 16:33:40 -0700 (PDT) Received: by mail-qv1-xf2c.google.com with SMTP id c8so2195095qvn.10 for ; Thu, 03 Nov 2022 16:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=GwjVrTLjk/2DTuEYqgj33B9QwHOr4MHvVJMI7ODUMBI=; b=FG/INWbBsp6JfLjz+7gcGjvZgwQi1U7Wmb+YXga0qmk0JAMkrQMKiSD+nSXtaLezn8 yAQSLM32W42Li3JhiF+BE95p/Xe0Sz7IQwkudUAh6xPpowhUHZnC88QI1VfaczGifbPG 7jrXrn1xOkCdlolWW4cyPdTSvSlNFA4t6C0q0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=GwjVrTLjk/2DTuEYqgj33B9QwHOr4MHvVJMI7ODUMBI=; b=YZpxHRUthg/sIIvc2NNIS2iBIsejhuX1eITrOOlSDdDsTQYCLMJZlbsWqwIwTdPPAU GAfqcmPgGDIk3z8bf6GphJ0nTl6z7c1+SEIsDqeUXW9boj06oGoBhx1EBkIZeGKVU4mi 7BzSMzUq5IBmqcz6StvbgQg/gq9vQLFu6eu09AHqxlSYZq2sxubv8CrlzrCYxCRARZrX 3A5I7tMKkCX+UQkMKPMizDn5KH9p9C+Nf/s7xPjldPGCqngiw8qa1SqEWVB0hIhfpct5 A5QSMRHgGaCx2l2PofLX09lrV4T9UGJaeSl182/p1qWOGzgmKB6w9omqeOqAN41E2W+O ImOQ== X-Gm-Message-State: ACrzQf2B9xRU5P3V757QiKl4aTUnN00J2ueB0eqNWr7FxIV0Rz1vw/kG JC7bkgSBXb2K6lTyghVr/UTxPA== X-Google-Smtp-Source: AMsMyM5CUNjE0I9m64mXkx5VegxJfxhTgAMxA+R4YJyzuOevZgGa5/xPcUFIgRiTj+9gJlcQfhrVjg== X-Received: by 2002:a05:6214:519a:b0:4bc:11e5:9927 with SMTP id kl26-20020a056214519a00b004bc11e59927mr15458828qvb.53.1667518419711; Thu, 03 Nov 2022 16:33:39 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id u5-20020a37ab05000000b006f8665f483fsm1662020qke.85.2022.11.03.16.33.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Nov 2022 16:33:39 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, gospo@broadcom.com, Vikas Gupta Subject: [PATCH net 1/4] bnxt_en: refactor bnxt_cancel_reservations() Date: Thu, 3 Nov 2022 19:33:24 -0400 Message-Id: <1667518407-15761-2-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1667518407-15761-1-git-send-email-michael.chan@broadcom.com> References: <1667518407-15761-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Vikas Gupta Introduce bnxt_clear_reservations() to clear the reserved attributes only. This will be used in the next patch to fix PCI AER handling. Signed-off-by: Vikas Gupta Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 04cf7684f1b0..3743d9755eb4 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -9983,17 +9983,12 @@ static int bnxt_try_recover_fw(struct bnxt *bp) return -ENODEV; } -int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset) +static void bnxt_clear_reservations(struct bnxt *bp, bool fw_reset) { struct bnxt_hw_resc *hw_resc = &bp->hw_resc; - int rc; if (!BNXT_NEW_RM(bp)) - return 0; /* no resource reservations required */ - - rc = bnxt_hwrm_func_resc_qcaps(bp, true); - if (rc) - netdev_err(bp->dev, "resc_qcaps failed\n"); + return; /* no resource reservations required */ hw_resc->resv_cp_rings = 0; hw_resc->resv_stat_ctxs = 0; @@ -10006,6 +10001,20 @@ int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset) bp->tx_nr_rings = 0; bp->rx_nr_rings = 0; } +} + +int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset) +{ + int rc; + + if (!BNXT_NEW_RM(bp)) + return 0; /* no resource reservations required */ + + rc = bnxt_hwrm_func_resc_qcaps(bp, true); + if (rc) + netdev_err(bp->dev, "resc_qcaps failed\n"); + + bnxt_clear_reservations(bp, fw_reset); return rc; }