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; } From patchwork Thu Nov 3 23:33:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13031125 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 DD418C433FE for ; Thu, 3 Nov 2022 23:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229445AbiKCXdu (ORCPT ); Thu, 3 Nov 2022 19:33:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230526AbiKCXdn (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 664841F601 for ; Thu, 3 Nov 2022 16:33:42 -0700 (PDT) Received: by mail-qv1-xf2c.google.com with SMTP id lf15so1769589qvb.9 for ; Thu, 03 Nov 2022 16:33:42 -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=fjpoGPWitZo5THASj897Q3piy9HFxpQJkTh6mAPsQ8E=; b=IEOFM46cLahn3Q3PnysJDAdKm6QLVV/vZk3eaZsfHJDTLF5AqcNzs7g9+j6lcyIs6F sRlkHAxx41fVZWmpFN8vicqXcropp7Nc8Ihg7k8u9rbU7tO+JxMoGywI6cuQgb7GsQ/V v+xYcXvnpOS29V6pZankcwOJdT3Mv+9OduwME= 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=fjpoGPWitZo5THASj897Q3piy9HFxpQJkTh6mAPsQ8E=; b=6QrIf4fHmtj2ucQtV8SQITlS/UzXimCWLLcVWxN2gpX3TSixWZOXPOBrvR+ia5mkId QH9GH0BOQCTV/AdHgEbSDwzQTn2W3zwV0PoB9/Bj+vC66nwaTnT1gMl46uYLOFHnKbnt 2DzPgnqb7eooNrmQW0CuJ33w+zYF7/uqbkWhvwNsRf6aTd1+kQMKMSG2MhB9nZuenmYG eihVxzFLez7S1S9JBmohfwYsiiqDNmLDGK3CIYE9gHg40B15ROtNQTHBVqW7f83kFhhC UsjoEC6Jl2AmtA/iHNEQQ7CZudOx3TA7yoAXOSmbnAv0pbEVqbL/vt+zmb7ETrVC7imN WwWw== X-Gm-Message-State: ACrzQf24mVGOPC68uN7iA4J7ttSMCmGLgPPaJZwl8XIMhJBstzS0fzSy ks1it709CX2sBS9kxURifOZJCw== X-Google-Smtp-Source: AMsMyM6df//BgDApaZsfTMEI6Xfx3iXqmhgrEMcL17Dzcu0ULClVuPbNybfdzw4fqsHBMSJ6dRzyXQ== X-Received: by 2002:a0c:ac49:0:b0:4b1:ccd5:6bd6 with SMTP id m9-20020a0cac49000000b004b1ccd56bd6mr29798024qvb.130.1667518421386; Thu, 03 Nov 2022 16:33:41 -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.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Nov 2022 16:33:40 -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 2/4] bnxt_en: fix the handling of PCIE-AER Date: Thu, 3 Nov 2022 19:33:25 -0400 Message-Id: <1667518407-15761-3-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 Fix the sequence required for PCIE-AER. While slot reset occurs, firmware might not be ready and the driver needs to check for its recovery. We also need to remap the health registers for some chips and clear the resource reservations. The resources will be allocated again during bnxt_io_resume(). Fixes: fb1e6e562b37 ("bnxt_en: Fix AER recovery.") Signed-off-by: Vikas Gupta Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 29 ++++++++++++++++++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + .../net/ethernet/broadcom/bnxt/bnxt_hwrm.c | 3 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 3743d9755eb4..f44f9367b7fd 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -13922,7 +13922,9 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT; struct net_device *netdev = pci_get_drvdata(pdev); struct bnxt *bp = netdev_priv(netdev); - int err = 0, off; + int retry = 0; + int err = 0; + int off; netdev_info(bp->dev, "PCI Slot Reset\n"); @@ -13950,11 +13952,36 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) pci_restore_state(pdev); pci_save_state(pdev); + bnxt_inv_fw_health_reg(bp); + bnxt_try_map_fw_health_reg(bp); + + /* In some PCIe AER scenarios, firmware may take up to + * 10 seconds to become ready in the worst case. + */ + do { + err = bnxt_try_recover_fw(bp); + if (!err) + break; + retry++; + } while (retry < BNXT_FW_SLOT_RESET_RETRY); + + if (err) { + dev_err(&pdev->dev, "Firmware not ready\n"); + goto reset_exit; + } + err = bnxt_hwrm_func_reset(bp); if (!err) result = PCI_ERS_RESULT_RECOVERED; + + bnxt_ulp_irq_stop(bp); + bnxt_clear_int_mode(bp); + err = bnxt_init_int_mode(bp); + bnxt_ulp_irq_restart(bp, err); } +reset_exit: + bnxt_clear_reservations(bp, true); rtnl_unlock(); return result; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index b1b17f911300..d5fa43cfe524 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1621,6 +1621,7 @@ struct bnxt_fw_health { #define BNXT_FW_RETRY 5 #define BNXT_FW_IF_RETRY 10 +#define BNXT_FW_SLOT_RESET_RETRY 4 enum board_idx { BCM57301, diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c index b01d42928a53..132442f16fe6 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c @@ -476,7 +476,8 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx) memset(ctx->resp, 0, PAGE_SIZE); req_type = le16_to_cpu(ctx->req->req_type); - if (BNXT_NO_FW_ACCESS(bp) && req_type != HWRM_FUNC_RESET) { + if (BNXT_NO_FW_ACCESS(bp) && + (req_type != HWRM_FUNC_RESET && req_type != HWRM_VER_GET)) { netdev_dbg(bp->dev, "hwrm req_type 0x%x skipped, FW channel down\n", req_type); goto exit; From patchwork Thu Nov 3 23:33:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13031127 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 1333BC433FE for ; Thu, 3 Nov 2022 23:34:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229487AbiKCXd7 (ORCPT ); Thu, 3 Nov 2022 19:33:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231180AbiKCXdo (ORCPT ); Thu, 3 Nov 2022 19:33:44 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 173D013D1E for ; Thu, 3 Nov 2022 16:33:44 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id o8so2207054qvw.5 for ; Thu, 03 Nov 2022 16:33:44 -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=MsubwvLrRKKdjq6ok8GCqHP+4Iuv6fA4iG9Wred+0yM=; b=Fj96E5IQwHSnHbt/tSeMVN2iGQcySdG0qTLURq9n3jP+ZHl0Zgz2Bk2FKX6N9rxRbb uZhWfGrFUTlITbjC6z8ErTmiWNIYcIUGBDkURXq7VB3sNQm13x4TqgjJEFAQ6S8bXJcw /K5BzuhNotPMNxQpkcPrAoCanpJ8guFVXlMcI= 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=MsubwvLrRKKdjq6ok8GCqHP+4Iuv6fA4iG9Wred+0yM=; b=1sH0OlbDkk9y7FwIt6x++RnbCbQwr4JKoi5YwkRIA4CHOJNTrY7txjfpy8bPgCH8ju OkBMU0k+7jFtEvgDbo/hDJmUKH6PuQYr3fDDoYRfnUo/5lvSVw0HWOz1gs8lXfSMWV1e 78DcHxU0gHQvuCBAdKEI5Y501olTkGynTUMBVsf/7JT7oDiwqxtKvhb4mq5PhukG5YhE g+ghCEjm/5CaOuA5tecIwM4Rw7eku2IE4cjVwTNBNxPPK9F6/Du4WSD32Gbedo0naT11 OtbrJHyxS45w2PYk1dOpt1pZSUy6wHWsvtls4kZRhLR9Fbq9RLLEJyQAi+lZcRoRmJBG GWSA== X-Gm-Message-State: ANoB5pnVo3Bf95oKd+D5CpBjABXr/0SRI12Dhw03wh9P8inJH5eG2grB c0WiHBjUCbFM2Uea9u8FEGxq1w== X-Google-Smtp-Source: AA0mqf5P+fGOBrwyvHlIAPASgAx9Uf363XreH6VySKkpI34YrYQ0tBq2kuA4Vel/WdXl9XUWrAAdCg== X-Received: by 2002:a05:6214:d61:b0:4c1:d4e5:bdd6 with SMTP id 1-20020a0562140d6100b004c1d4e5bdd6mr183461qvs.66.1667518422890; Thu, 03 Nov 2022 16:33:42 -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.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Nov 2022 16:33:42 -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 Subject: [PATCH net 3/4] bnxt_en: Fix possible crash in bnxt_hwrm_set_coal() Date: Thu, 3 Nov 2022 19:33:26 -0400 Message-Id: <1667518407-15761-4-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 During the error recovery sequence, the rtnl_lock is not held for the entire duration and some datastructures may be freed during the sequence. Check for the BNXT_STATE_OPEN flag instead of netif_running() to ensure that the device is fully operational before proceeding to reconfigure the coalescing settings. This will fix a possible crash like this: BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 PGD 0 P4D 0 Oops: 0000 [#1] SMP NOPTI CPU: 10 PID: 181276 Comm: ethtool Kdump: loaded Tainted: G IOE --------- - - 4.18.0-348.el8.x86_64 #1 Hardware name: Dell Inc. PowerEdge R740/0F9N89, BIOS 2.3.10 08/15/2019 RIP: 0010:bnxt_hwrm_set_coal+0x1fb/0x2a0 [bnxt_en] Code: c2 66 83 4e 22 08 66 89 46 1c e8 10 cb 00 00 41 83 c6 01 44 39 b3 68 01 00 00 0f 8e a3 00 00 00 48 8b 93 c8 00 00 00 49 63 c6 <48> 8b 2c c2 48 8b 85 b8 02 00 00 48 85 c0 74 2e 48 8b 74 24 08 f6 RSP: 0018:ffffb11c8dcaba50 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff8d168a8b0ac0 RCX: 00000000000000c5 RDX: 0000000000000000 RSI: ffff8d162f72c000 RDI: ffff8d168a8b0b28 RBP: 0000000000000000 R08: b6e1f68a12e9a7eb R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000037 R12: ffff8d168a8b109c R13: ffff8d168a8b10aa R14: 0000000000000000 R15: ffffffffc01ac4e0 FS: 00007f3852e4c740(0000) GS:ffff8d24c0080000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000041b3ee003 CR4: 00000000007706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: ethnl_set_coalesce+0x3ce/0x4c0 genl_family_rcv_msg_doit.isra.15+0x10f/0x150 genl_family_rcv_msg+0xb3/0x160 ? coalesce_fill_reply+0x480/0x480 genl_rcv_msg+0x47/0x90 ? genl_family_rcv_msg+0x160/0x160 netlink_rcv_skb+0x4c/0x120 genl_rcv+0x24/0x40 netlink_unicast+0x196/0x230 netlink_sendmsg+0x204/0x3d0 sock_sendmsg+0x4c/0x50 __sys_sendto+0xee/0x160 ? syscall_trace_enter+0x1d3/0x2c0 ? __audit_syscall_exit+0x249/0x2a0 __x64_sys_sendto+0x24/0x30 do_syscall_64+0x5b/0x1a0 entry_SYSCALL_64_after_hwframe+0x65/0xca RIP: 0033:0x7f38524163bb Fixes: 2151fe0830fd ("bnxt_en: Handle RESET_NOTIFY async event from firmware.") Reviewed-by: Somnath Kotur Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index f57e524c7e30..8cad15c458b3 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -162,7 +162,7 @@ static int bnxt_set_coalesce(struct net_device *dev, } reset_coalesce: - if (netif_running(dev)) { + if (test_bit(BNXT_STATE_OPEN, &bp->state)) { if (update_stats) { rc = bnxt_close_nic(bp, true, false); if (!rc) From patchwork Thu Nov 3 23:33:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13031126 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 25693C4332F for ; Thu, 3 Nov 2022 23:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230300AbiKCXd6 (ORCPT ); Thu, 3 Nov 2022 19:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbiKCXdq (ORCPT ); Thu, 3 Nov 2022 19:33:46 -0400 Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81C78193C9 for ; Thu, 3 Nov 2022 16:33:45 -0700 (PDT) Received: by mail-qv1-xf36.google.com with SMTP id x13so2205911qvn.6 for ; Thu, 03 Nov 2022 16:33:45 -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=s98qI5MR5QUmr1VmzLzImiHCmq7rt1lktOiepsDNiLQ=; b=ArupKVOG30uoNOlq24MKsH/g0A+SEiLtD+39BII6t6LZVD8fn/J4p+ayN9dpIyXpBy bVaPaoN+lhKa58NzrzFvpC6d5JNgjcQiHMZqOVREd7+1PNY9sjIr0jliJytACG2ChkKA 812oVWMc+72NOzkaiFRtaY078OW6pad8Rp3dY= 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=s98qI5MR5QUmr1VmzLzImiHCmq7rt1lktOiepsDNiLQ=; b=e4jlljMRh0H/vM+HPEXT+8JrglErEsRQuYbNNW514pIryKkF7k1PmgNKqMYX577jYu l3cxAyDljZak8WPlzHbdumb2mNSRWDzSeIkwocVUf8PZhsalMQypwkvqMdd4NQp9v74E WDOMRxEuAwj320n29c7ePaN8eQS10vE8hXlcRYIjAz+7dPKZKAVh6jJfUCVfCpDyQy4f /PJCHRVPRHMe/NC1yoKsi5KWvBYmZ6rE+HDyBOKwXfhrgEunU+mHCLA5fq3tKe/xufxS ZWFuwLBFIs/SQFgCUX+79ai286slklpPVVvHDSlcfEHg0yK/mhJ4hukviW8+2TnqDXEK fVSg== X-Gm-Message-State: ACrzQf2biTMD4XMl1ar6Bb0HHE2dcWZqt/KHCad5sjUxp+vaW/eh9QFD WadH0k6+8ZWAvYIcQW5Cd5kRMtVKIHTXsQ== X-Google-Smtp-Source: AMsMyM6gmyAuF3mR4OsGq7u09kiIEA+mEFmv9y7IZO/Jbo72RG7ckxKZE+BEQLUvlcLBP8vKXW0gQw== X-Received: by 2002:a05:6214:20ed:b0:4bb:6d76:58a4 with SMTP id 13-20020a05621420ed00b004bb6d7658a4mr28657663qvk.117.1667518424471; Thu, 03 Nov 2022 16:33:44 -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.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Nov 2022 16:33:44 -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, Alex Barba Subject: [PATCH net 4/4] bnxt_en: fix potentially incorrect return value for ndo_rx_flow_steer Date: Thu, 3 Nov 2022 19:33:27 -0400 Message-Id: <1667518407-15761-5-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: Alex Barba In the bnxt_en driver ndo_rx_flow_steer returns '0' whenever an entry that we are attempting to steer is already found. This is not the correct behavior. The return code should be the value/index that corresponds to the entry. Returning zero all the time causes the RFS records to be incorrect unless entry '0' is the correct one. As flows migrate to different cores this can create entries that are not correct. Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") Reported-by: Akshay Navgire Signed-off-by: Alex Barba Signed-off-by: Andy Gospodarek Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index f44f9367b7fd..c78b6e9dea2c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -12903,8 +12903,8 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, rcu_read_lock(); hlist_for_each_entry_rcu(fltr, head, hash) { if (bnxt_fltr_match(fltr, new_fltr)) { + rc = fltr->sw_id; rcu_read_unlock(); - rc = 0; goto err_free; } }