From patchwork Sun Feb 20 09:05:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12752630 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 C90E1C433F5 for ; Sun, 20 Feb 2022 09:06:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243450AbiBTJGk (ORCPT ); Sun, 20 Feb 2022 04:06:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237656AbiBTJGi (ORCPT ); Sun, 20 Feb 2022 04:06:38 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A803E31919 for ; Sun, 20 Feb 2022 01:06:18 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id y11so6069676pfa.6 for ; Sun, 20 Feb 2022 01:06:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9BIS0/lV7oIPMD9kd8lU8f0AVthjwEwStyqqvXGPxIU=; b=WNb6ZdSeYPNePiU9rLlTS9aYDXnT6SIZxRFeZIOSuWA5ko9AFjRA/R1PGkchBlrTp0 5XyYrEV2hr8UV4YeB6HfYgUfbfzzMt28ZlFEfykKYWKo8oau8RNtNmmkUzyd82n2UcSf 7WpGndNmzQqK/6Eodr/rmhO6h1zagjnHiXJ8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9BIS0/lV7oIPMD9kd8lU8f0AVthjwEwStyqqvXGPxIU=; b=TZLHNJGsqtpiC+3dLdk4gt+0CHdY2fODDfDzkVoOwY4MGrx8wfcGZThpkQrw66FAw/ siLL8IgtJLqVALYSz28uVV8BSMmHHMFtKZAcX98W1FQAOW7G+oZy2Jvh7+C5h+pCREog 6U7YDwKzIrl5sPWRgHnkrDSTOwrqSWIaRJQXAPL0F53cuNZ9tE4OPTy1hUGKQd2H1+Gq wXzBKLFDenCZmCa52cu70WcWSIElE5peHNJ+BMAL26T82OIT9Un8RTNekcD5kay/UfvI JQzVe1H7y7XSE+FK8nl2Yb+1oR8sJPeok6ECDlMb9xSQ5kcCssffZ18jD3VDsl/p4bXO X+mg== X-Gm-Message-State: AOAM532Tc8HiIPDY3SOTXVCrZo9nE4245MYzMHz+Hl2BleXcqtKoJME5 E++6DBYy/Ql9bl1Dq1AaM7HGUQ== X-Google-Smtp-Source: ABdhPJyzDpnoTwU9SEwqbknq5yK0TYdayJuxCEj1V4cz12MxBEaBCtcW9oeA8iezn9Hl2tOAaESNdA== X-Received: by 2002:a05:6a00:218a:b0:4e1:9ed6:c399 with SMTP id h10-20020a056a00218a00b004e19ed6c399mr15131829pfi.8.1645347977845; Sun, 20 Feb 2022 01:06:17 -0800 (PST) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m5-20020a17090b068500b001b9bef22bf5sm4061865pjz.5.2022.02.20.01.06.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Feb 2022 01:06:17 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Somnath Kotur Subject: [PATCH net 1/7] bnxt_en: Fix active FEC reporting to ethtool Date: Sun, 20 Feb 2022 04:05:47 -0500 Message-Id: <1645347953-27003-2-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> References: <1645347953-27003-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: Somnath Kotur ethtool --show-fec does not show anything when the Active FEC setting in the chip is set to None. Fix it to properly return ETHTOOL_FEC_OFF in that case. Fixes: 8b2775890ad8 ("bnxt_en: Report FEC settings to ethtool.") Signed-off-by: Somnath Kotur Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 003330e8cd58..e195f4a669d8 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1969,6 +1969,9 @@ static int bnxt_get_fecparam(struct net_device *dev, case PORT_PHY_QCFG_RESP_ACTIVE_FEC_FEC_RS272_IEEE_ACTIVE: fec->active_fec |= ETHTOOL_FEC_LLRS; break; + case PORT_PHY_QCFG_RESP_ACTIVE_FEC_FEC_NONE_ACTIVE: + fec->active_fec |= ETHTOOL_FEC_OFF; + break; } return 0; } From patchwork Sun Feb 20 09:05:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12752631 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 AB583C433FE for ; Sun, 20 Feb 2022 09:06:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243471AbiBTJGn (ORCPT ); Sun, 20 Feb 2022 04:06:43 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237656AbiBTJGk (ORCPT ); Sun, 20 Feb 2022 04:06:40 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0030131919 for ; Sun, 20 Feb 2022 01:06:19 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id s16so11640687pgs.13 for ; Sun, 20 Feb 2022 01:06:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9MlticILXp8gGWaIshbvGf7eB3gqXylWOJL0P5eJzO4=; b=KGX8xhyvOpyw+JHtMxq+Z32Cms5AHwKOS9ZnG53Z90t+cN0DTr7COHbSkamCja46em zVkdCxQ7SNOQ9nwOv7yjvpUwARxMCp56TeRqezhrEt8QXyX1+0ocPCN1Cht2NiVRKOHK Euff4Sy5gyRLmemJ18rANz/fP6IZWxTo97t5M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9MlticILXp8gGWaIshbvGf7eB3gqXylWOJL0P5eJzO4=; b=MpsQY+ENlOGeWpDprZO0/I7qyzFt5RKNAg9tgfiSW0I/Ll7hxYPZGfFFtJyMkH7EjR boNMdOU95IdragC+hnDvLH9o1NHKdAmXvooHULlgPF5VX2ZHJ5lvsYQg5UAxmGPpBU/T Fsonk1pqtwGTEeVswnHcmH3iAFS16qzhqO7opbKgUgcgcClfTGZmksuN/5CTYrL23VZm 3v3FODJxBwPBaWz9CmovEDuXPWXNTRV9bRl1Ffa2azsqtlJ68eI4loI5wTVkUxu4KjQV 4W7XnCxqfbKwJk52LeeuxanT1w9EwVRTrJwNj+xbCr5bHloaF1AQOdkKHBrUOBadbuSc krUg== X-Gm-Message-State: AOAM531L5dP3R2P1cdrw1/LYCeFwPzvCEVKm4SP/CI6A+WeUBRWX9HLd vlkqdoNQjNNYChNFOSQaEQppjJjx3HebZA== X-Google-Smtp-Source: ABdhPJz8ffWY+fr7PprwutM7zKnw3W1DZ1C1l2Tu8pUXoMMtrbzhKz+2hgmbwhe/P9Rimqzlvh7t2Q== X-Received: by 2002:a05:6a00:244b:b0:4c9:319e:ecb7 with SMTP id d11-20020a056a00244b00b004c9319eecb7mr15276744pfj.58.1645347979025; Sun, 20 Feb 2022 01:06:19 -0800 (PST) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m5-20020a17090b068500b001b9bef22bf5sm4061865pjz.5.2022.02.20.01.06.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Feb 2022 01:06:18 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net 2/7] bnxt_en: Fix offline ethtool selftest with RDMA enabled Date: Sun, 20 Feb 2022 04:05:48 -0500 Message-Id: <1645347953-27003-3-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> References: <1645347953-27003-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 For offline (destructive) self tests, we need to stop the RDMA driver first. Otherwise, the RDMA driver will run into unrecoverable errors when destructive firmware tests are being performed. The irq_re_init parameter used in the half close and half open sequence when preparing the NIC for offline tests should be set to true because the RDMA driver will free all IRQs before the offline tests begin. Fixes: 55fd0cf320c3 ("bnxt_en: Add external loopback test to ethtool selftest.") Reviewed-by: Edwin Peer Reviewed-by: Ben Li Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 +++++----- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 4f94136a011a..23bbb1c5812d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -10330,12 +10330,12 @@ int bnxt_half_open_nic(struct bnxt *bp) goto half_open_err; } - rc = bnxt_alloc_mem(bp, false); + rc = bnxt_alloc_mem(bp, true); if (rc) { netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc); goto half_open_err; } - rc = bnxt_init_nic(bp, false); + rc = bnxt_init_nic(bp, true); if (rc) { netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc); goto half_open_err; @@ -10344,7 +10344,7 @@ int bnxt_half_open_nic(struct bnxt *bp) half_open_err: bnxt_free_skbs(bp); - bnxt_free_mem(bp, false); + bnxt_free_mem(bp, true); dev_close(bp->dev); return rc; } @@ -10354,9 +10354,9 @@ int bnxt_half_open_nic(struct bnxt *bp) */ void bnxt_half_close_nic(struct bnxt *bp) { - bnxt_hwrm_resource_free(bp, false, false); + bnxt_hwrm_resource_free(bp, false, true); bnxt_free_skbs(bp); - bnxt_free_mem(bp, false); + bnxt_free_mem(bp, true); } void bnxt_reenable_sriov(struct bnxt *bp) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index e195f4a669d8..a85b18858b32 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -25,6 +25,7 @@ #include "bnxt_hsi.h" #include "bnxt.h" #include "bnxt_hwrm.h" +#include "bnxt_ulp.h" #include "bnxt_xdp.h" #include "bnxt_ptp.h" #include "bnxt_ethtool.h" @@ -3551,9 +3552,12 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, if (!offline) { bnxt_run_fw_tests(bp, test_mask, &test_results); } else { - rc = bnxt_close_nic(bp, false, false); - if (rc) + bnxt_ulp_stop(bp); + rc = bnxt_close_nic(bp, true, false); + if (rc) { + bnxt_ulp_start(bp, rc); return; + } bnxt_run_fw_tests(bp, test_mask, &test_results); buf[BNXT_MACLPBK_TEST_IDX] = 1; @@ -3563,6 +3567,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, if (rc) { bnxt_hwrm_mac_loopback(bp, false); etest->flags |= ETH_TEST_FL_FAILED; + bnxt_ulp_start(bp, rc); return; } if (bnxt_run_loopback(bp)) @@ -3588,7 +3593,8 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, } bnxt_hwrm_phy_loopback(bp, false, false); bnxt_half_close_nic(bp); - rc = bnxt_open_nic(bp, false, true); + rc = bnxt_open_nic(bp, true, true); + bnxt_ulp_start(bp, rc); } if (rc || bnxt_test_irq(bp)) { buf[BNXT_IRQ_TEST_IDX] = 1; From patchwork Sun Feb 20 09:05:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12752632 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 928E1C433EF for ; Sun, 20 Feb 2022 09:06:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243470AbiBTJGo (ORCPT ); Sun, 20 Feb 2022 04:06:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235374AbiBTJGl (ORCPT ); Sun, 20 Feb 2022 04:06:41 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40E4531935 for ; Sun, 20 Feb 2022 01:06:21 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id q1so1973230plx.4 for ; Sun, 20 Feb 2022 01:06:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Lmt4m7GQTGDKp023enGcI6nCt6NdqCkC3JCKPF/CAJk=; b=THI7JHNTF7UedhGOWq8q9bih4M+8ReMUnMwJOwAqSiPqIstDeGwPBPG+fps8vN1fSZ Hd383hMI8sr6jR/U80OIOU82NYKS0+oRSiE+ztsWAvlUTJqnK9bPZ0bvu028ETr2437a pCKeZB5hYUVwm6EbP3d2swFb2TwyAcsGZLPL4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Lmt4m7GQTGDKp023enGcI6nCt6NdqCkC3JCKPF/CAJk=; b=DPv7QJZW3+GJa89q6TcxDdJrUXxgLnnCUdVyFYxbjCdgqkYmsPvVbVv1eGn4iFqE0e SJMa52p7BZznwcVHcfDTf2VXGpyJjyrw0y4ltqR37ZDJ7+0Z/Bzn7JtQDBtlMtPoWjHV Ez7oP/3t3BfhTQ2NymXPWP43c1iMPqhQeA+bnqcF6Mm3mB1mZHkaQgdOq5pn3jk18tS0 /W1+BMsGDSRNJX/JdjKoe+43/mbbmGmnJ6bz7L5W3MajF9Xo6Ixzu3TXXob1GyiyWK2k t1Gb2ZeWm0XZEkauWhZru2FyN+QcXnfO86JdEXQ7NXARZvu3xqzEPAOtFIeKXwK8mt6T a4IA== X-Gm-Message-State: AOAM530HiO/Y+qVYBeUDsvMMT1xPcmWJPzVmynGI2ukDtpghjTLA8Lmd UQU5o7zzr4ry9cw8eH1e3FvkaQ== X-Google-Smtp-Source: ABdhPJxTRR8E/GB2Y0NJVzsFC5tNrl8cwsqc66t6lOBM8T519lrNV27ZuMUqI2Vd34g+PwkhQ92vtw== X-Received: by 2002:a17:90b:3ca:b0:1b9:e1a5:c315 with SMTP id go10-20020a17090b03ca00b001b9e1a5c315mr16177839pjb.43.1645347980070; Sun, 20 Feb 2022 01:06:20 -0800 (PST) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m5-20020a17090b068500b001b9bef22bf5sm4061865pjz.5.2022.02.20.01.06.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Feb 2022 01:06:19 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net 3/7] bnxt_en: Fix occasional ethtool -t loopback test failures Date: Sun, 20 Feb 2022 04:05:49 -0500 Message-Id: <1645347953-27003-4-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> References: <1645347953-27003-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 In the current code, we setup the port to PHY or MAC loopback mode and then transmit a test broadcast packet for the loopback test. This scheme fails sometime if the port is shared with management firmware that can also send packets. The driver may receive the management firmware's packet and the test will fail when the contents don't match the test packet. Change the test packet to use it's own MAC address as the destination and setup the port to only receive it's own MAC address. This should filter out other packets sent by management firmware. Fixes: 91725d89b97a ("bnxt_en: Add PHY loopback to ethtool self-test.") Reviewed-by: Pavan Chebbi Reviewed-by: Edwin Peer Reviewed-by: Andy Gospodarek Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 7 +++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 23bbb1c5812d..785436f6dd24 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -8639,6 +8639,9 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) vnic->uc_filter_count = 1; vnic->rx_mask = 0; + if (test_bit(BNXT_STATE_HALF_OPEN, &bp->state)) + goto skip_rx_mask; + if (bp->dev->flags & IFF_BROADCAST) vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_BCAST; @@ -8659,6 +8662,7 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) if (rc) goto err_out; +skip_rx_mask: rc = bnxt_hwrm_set_coal(bp); if (rc) netdev_warn(bp->dev, "HWRM set coalescing failure rc: %x\n", @@ -10335,8 +10339,10 @@ int bnxt_half_open_nic(struct bnxt *bp) netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc); goto half_open_err; } + set_bit(BNXT_STATE_HALF_OPEN, &bp->state); rc = bnxt_init_nic(bp, true); if (rc) { + clear_bit(BNXT_STATE_HALF_OPEN, &bp->state); netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc); goto half_open_err; } @@ -10357,6 +10363,7 @@ void bnxt_half_close_nic(struct bnxt *bp) bnxt_hwrm_resource_free(bp, false, true); bnxt_free_skbs(bp); bnxt_free_mem(bp, true); + clear_bit(BNXT_STATE_HALF_OPEN, &bp->state); } void bnxt_reenable_sriov(struct bnxt *bp) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 440dfeb4948b..666fc1e7a7d2 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1921,6 +1921,7 @@ struct bnxt { #define BNXT_STATE_RECOVER 12 #define BNXT_STATE_FW_NON_FATAL_COND 13 #define BNXT_STATE_FW_ACTIVATE_RESET 14 +#define BNXT_STATE_HALF_OPEN 15 /* For offline ethtool tests */ #define BNXT_NO_FW_ACCESS(bp) \ (test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) || \ diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index a85b18858b32..8aaa2335f848 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -3458,7 +3458,7 @@ static int bnxt_run_loopback(struct bnxt *bp) if (!skb) return -ENOMEM; data = skb_put(skb, pkt_size); - eth_broadcast_addr(data); + ether_addr_copy(&data[i], bp->dev->dev_addr); i += ETH_ALEN; ether_addr_copy(&data[i], bp->dev->dev_addr); i += ETH_ALEN; From patchwork Sun Feb 20 09:05:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12752633 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 0E53FC4332F for ; Sun, 20 Feb 2022 09:06:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237656AbiBTJGp (ORCPT ); Sun, 20 Feb 2022 04:06:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243468AbiBTJGm (ORCPT ); Sun, 20 Feb 2022 04:06:42 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13EC631919 for ; Sun, 20 Feb 2022 01:06:22 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id 139so11683479pge.1 for ; Sun, 20 Feb 2022 01:06:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1OvWYX0z4JRtRR0V9MbS4YMsa6a9NCZJI4VjyxEp7/8=; b=IbBQtmsIzhRsB9fbfWRkhwhgkG5MpRPChxXpxHYnjqa3OfP2XJujz96XBFuEeAaGRK nfzzE9BWYGDqa/pBee1Vw3OFnrmXhqzfDdM37eZXwLlwe77WD6mng1mSrnkeplLB+Gop 60XG0wuEev/ZrMSD5H8BjIOs2VjlkLhpc/t/A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1OvWYX0z4JRtRR0V9MbS4YMsa6a9NCZJI4VjyxEp7/8=; b=MZQYXYV2jLvEodMc6uJUCG15Ris8ktL2QXHQQBB2XvlTIfpk3VdsNl1VOkEqD9sGWd zkJvXzHRIW+6y/01njxW3OEs1P3x8YTbKbSnRO2Wl1GFJptnNdAFmR3MIsclpYuNl93A 3uX3G1GG0ig9GYsQ96zYQEQsepkdN7Lh9Snk4kypCVtfHpa0mXklIDtgn8JBa4PonIRy WoB30GWubay/UVjPp3acu6jrMl9t+RaoSrrwD65r+HtvFjyiC4Hp3Ht/ORRrbiwJqsbv qtCfOGF0zMmiSMTJGwBnUnzhMs5UOCJ5sNd54Tf0Dcfrh85AcnwL32hcKbGfgq5UEVaS n8ow== X-Gm-Message-State: AOAM530ey7cf1zxUvZbBNd3L2yl3M8+ivKu33BPdtocvXeRI7zMcwtmJ 5mZwi9uFESSqW+YNwRA2iZgXtA== X-Google-Smtp-Source: ABdhPJwB+nKqWpbHaZVjyBF1gtSdvjMcVnqfesnvJeunacua+7j6SkuHOJInS7wK+EvkYxgZ3PmE0A== X-Received: by 2002:a05:6a00:1d8b:b0:4f1:bd8:811 with SMTP id z11-20020a056a001d8b00b004f10bd80811mr4703174pfw.25.1645347981219; Sun, 20 Feb 2022 01:06:21 -0800 (PST) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m5-20020a17090b068500b001b9bef22bf5sm4061865pjz.5.2022.02.20.01.06.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Feb 2022 01:06:20 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Pavan Chebbi Subject: [PATCH net 4/7] bnxt_en: Fix incorrect multicast rx mask setting when not requested Date: Sun, 20 Feb 2022 04:05:50 -0500 Message-Id: <1645347953-27003-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> References: <1645347953-27003-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: Pavan Chebbi We should setup multicast only when net_device flags explicitly has IFF_MULTICAST set. Otherwise we will incorrectly turn it on even when not asked. Fix it by only passing the multicast table to the firmware if IFF_MULTICAST is set. Fixes: 7d2837dd7a32 ("bnxt_en: Setup multicast properly after resetting device.") Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 785436f6dd24..fc5b1d816bdb 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -4747,8 +4747,10 @@ static int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, u16 vnic_id) return rc; req->vnic_id = cpu_to_le32(vnic->fw_vnic_id); - req->num_mc_entries = cpu_to_le32(vnic->mc_list_count); - req->mc_tbl_addr = cpu_to_le64(vnic->mc_list_mapping); + if (vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_MCAST) { + req->num_mc_entries = cpu_to_le32(vnic->mc_list_count); + req->mc_tbl_addr = cpu_to_le64(vnic->mc_list_mapping); + } req->mask = cpu_to_le32(vnic->rx_mask); return hwrm_req_send_silent(bp, req); } @@ -8651,7 +8653,7 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) if (bp->dev->flags & IFF_ALLMULTI) { vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST; vnic->mc_list_count = 0; - } else { + } else if (bp->dev->flags & IFF_MULTICAST) { u32 mask = 0; bnxt_mc_list_updated(bp, &mask); @@ -10779,7 +10781,7 @@ static void bnxt_set_rx_mode(struct net_device *dev) if (dev->flags & IFF_ALLMULTI) { mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST; vnic->mc_list_count = 0; - } else { + } else if (dev->flags & IFF_MULTICAST) { mc_update = bnxt_mc_list_updated(bp, &mask); } @@ -10856,9 +10858,10 @@ static int bnxt_cfg_rx_mode(struct bnxt *bp) !bnxt_promisc_ok(bp)) vnic->rx_mask &= ~CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS; rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0); - if (rc && vnic->mc_list_count) { + if (rc && (vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_MCAST)) { netdev_info(bp->dev, "Failed setting MC filters rc: %d, turning on ALL_MCAST mode\n", rc); + vnic->rx_mask &= ~CFA_L2_SET_RX_MASK_REQ_MASK_MCAST; vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST; vnic->mc_list_count = 0; rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0); From patchwork Sun Feb 20 09:05:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12752634 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 21E83C433FE for ; Sun, 20 Feb 2022 09:06:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243486AbiBTJGp (ORCPT ); Sun, 20 Feb 2022 04:06:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243479AbiBTJGn (ORCPT ); Sun, 20 Feb 2022 04:06:43 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F953366A2 for ; Sun, 20 Feb 2022 01:06:23 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id q11-20020a17090a304b00b001b94d25eaecso12503964pjl.4 for ; Sun, 20 Feb 2022 01:06:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZcoxsAYhpedU3kP0gZ1E9rs7GvC/JbZ1FmgOsnZQTyA=; b=FLUedk3/rFONwezyHn5QfujWh/sUMTJWB55Zqo7faXCzG9nSUQ2d75MbtKEG8qvoNm B4LZvVDssITAWX2+C6K3M7MyxTtdSM7YahqYMZNUAR7YU4pBnGhvNg9/hVEzsmTtbbg6 hNBppdcQCA4i3qPrKvgorqG9D3Fh4xYIa6jn8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZcoxsAYhpedU3kP0gZ1E9rs7GvC/JbZ1FmgOsnZQTyA=; b=LmQU/dDz13T4N95zChoRpw6q4By8gEiYJNhXhoYnSxikxLfi7NmN5sCZ0X1mmhDwj8 9j7+n9GAbg9gjudMMQJ0dq/4eoD8g8t8/7jCWpzWQQQ5J7suV6ujnbQg7CzbuNxb/MOi vfeYAdmigjQ8oXL9ooceFHGvONkMf3uM0ZL3BS7HohwluH3VkwWb7to3ahRX2KUbf9nG P0iEGAe9J5EwKStP4NYNmMMEfUO7lddHnO+DTvCoR+FPI+N+ugCwBssdoEXdwllO2Uar YRpbciCergyNZXuT9EMdsVcqamvP0fKRBR28DFaLUvNRCHbN/+FgiQB7R8TnYqxKuXZF Jr1A== X-Gm-Message-State: AOAM533bCXfhDEaakww2VOHR3Xzcmsmh6q9OgbUTjTRkOPxxxOmIcSIu pApeSWJ0YmEM3aUwpO+fRbJj7w== X-Google-Smtp-Source: ABdhPJy9q+G5Sili9GHLPoQRzM/tp6pBgGPMJNLeJUh0GuIiJq1q+ri3gBt2eI2q8z98Sd8UrZ+zZA== X-Received: by 2002:a17:903:40cd:b0:14e:dd7f:f3d5 with SMTP id t13-20020a17090340cd00b0014edd7ff3d5mr14532625pld.88.1645347982403; Sun, 20 Feb 2022 01:06:22 -0800 (PST) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m5-20020a17090b068500b001b9bef22bf5sm4061865pjz.5.2022.02.20.01.06.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Feb 2022 01:06:21 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Kalesh AP Subject: [PATCH net 5/7] bnxt_en: Restore the resets_reliable flag in bnxt_open() Date: Sun, 20 Feb 2022 04:05:51 -0500 Message-Id: <1645347953-27003-6-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> References: <1645347953-27003-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: Kalesh AP During ifdown, we call bnxt_inv_fw_health_reg() which will clear both the status_reliable and resets_reliable flags if these registers are mapped. This is correct because a FW reset during ifdown will clear these register mappings. If we detect that FW has gone through reset during the next ifup, we will remap these registers. But during normal ifup with no FW reset, we need to restore the resets_reliable flag otherwise we will not show the reset counter during devlink diagnose. Fixes: 8cc95ceb7087 ("bnxt_en: improve fw diagnose devlink health messages") Reviewed-by: Vikas Gupta Reviewed-by: Pavan Chebbi Reviewed-by: Somnath Kotur Signed-off-by: Kalesh AP Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index fc5b1d816bdb..b1c98d1408b8 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7789,6 +7789,19 @@ static int bnxt_map_fw_health_regs(struct bnxt *bp) return 0; } +static void bnxt_remap_fw_health_regs(struct bnxt *bp) +{ + if (!bp->fw_health) + return; + + if (bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) { + bp->fw_health->status_reliable = true; + bp->fw_health->resets_reliable = true; + } else { + bnxt_try_map_fw_health_reg(bp); + } +} + static int bnxt_hwrm_error_recovery_qcfg(struct bnxt *bp) { struct bnxt_fw_health *fw_health = bp->fw_health; @@ -9856,8 +9869,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) resc_reinit = true; if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE) fw_reset = true; - else if (bp->fw_health && !bp->fw_health->status_reliable) - bnxt_try_map_fw_health_reg(bp); + else + bnxt_remap_fw_health_regs(bp); if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) && !fw_reset) { netdev_err(bp->dev, "RESET_DONE not set during FW reset.\n"); From patchwork Sun Feb 20 09:05:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12752635 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 972D5C433EF for ; Sun, 20 Feb 2022 09:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243479AbiBTJGu (ORCPT ); Sun, 20 Feb 2022 04:06:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243482AbiBTJGo (ORCPT ); Sun, 20 Feb 2022 04:06:44 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2865631935 for ; Sun, 20 Feb 2022 01:06:24 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id a11-20020a17090a740b00b001b8b506c42fso16237075pjg.0 for ; Sun, 20 Feb 2022 01:06:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VIhQRHjajsSQXDo77s/MyTmBOFb2ebVTKmCwDrvspBo=; b=TxA/86dcRNbSsCLwJXdjaXT0ecWMybylwDFhq/dOFAA2eQbB+S0/uaQkkOHQzibztv s7rJbJZWwaSKkBCt2gimNXgejAP1xNH2mKsJxQMkI6ZUTeRuIoXdxYLB5Y/zTGrJq4ar lS8BKYnPhkGWOvQlDQEZfGV2ZmHJoXzc4zhxo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VIhQRHjajsSQXDo77s/MyTmBOFb2ebVTKmCwDrvspBo=; b=RLwS22v1eoVSf7BxIdH1vczvlTp4xjcvDUCOQEuDYi5WDS3qN9flFRhL8eMuL19sHg s7nZbS1HP5gODvIU3Fe66ihTh4fG+oFEFnkFf19htjn8cJDI+5cIDlmetgoKk1TZY1OM qpnfbLdslzQBye97dfj7LhMj3zwflQcFcWjg3w3W9ChiBWIpcULZw7VM5Qz4hEVaLDls /wGKqp43wAtoS2bSHFCGp0HZmPlU/kpnj6nDewNANFvMqYVEwYnJqMDZ5+Ucf5l5yEAo eQLv1nWLX536BzF/ejIUKBIK1dICifgEo/4vgOaZYtWFHtnZ1hjpot6qE94bw2QLpSVS ji9Q== X-Gm-Message-State: AOAM532S4BkhFvWfEK0EnheySpy3AF66q4qX8kSdwXzVH2lrv6uS5d4p RXIkk0uOqwPJD6ZF9PoFNBAMVA== X-Google-Smtp-Source: ABdhPJyX+fj8E8W9q+DbWyqRQsEvV+3UGPMNPls1G8X3YS5unPaivjMAnEOjHbA0jEx/J8xnmf3cZg== X-Received: by 2002:a17:902:7296:b0:14b:4bc6:e81 with SMTP id d22-20020a170902729600b0014b4bc60e81mr14494957pll.132.1645347983377; Sun, 20 Feb 2022 01:06:23 -0800 (PST) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m5-20020a17090b068500b001b9bef22bf5sm4061865pjz.5.2022.02.20.01.06.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Feb 2022 01:06:23 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net 6/7] bnxt_en: Increase firmware message response DMA wait time Date: Sun, 20 Feb 2022 04:05:52 -0500 Message-Id: <1645347953-27003-7-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> References: <1645347953-27003-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 When polling for the firmware message response, we first poll for the response message header. Once the valid length is detected in the header, we poll for the valid bit at the end of the message which signals DMA completion. Normally, this poll time for DMA completion is extremely short (0 to a few usec). But on some devices under some rare conditions, it can be up to about 20 msec. Increase this delay to 50 msec and use udelay() for the first 10 usec for the common case, and usleep_range() beyond that. Also, change the error message to include the above delay time when printing the timeout value. Fixes: 3c8c20db769c ("bnxt_en: move HWRM API implementation into separate file") Reviewed-by: Vladimir Olovyannikov Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c | 12 +++++++++--- drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c index 566c9487ef55..b01d42928a53 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c @@ -644,17 +644,23 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx) /* Last byte of resp contains valid bit */ valid = ((u8 *)ctx->resp) + len - 1; - for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; j++) { + for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; ) { /* make sure we read from updated DMA memory */ dma_rmb(); if (*valid) break; - usleep_range(1, 5); + if (j < 10) { + udelay(1); + j++; + } else { + usleep_range(20, 30); + j += 20; + } } if (j >= HWRM_VALID_BIT_DELAY_USEC) { hwrm_err(bp, ctx, "Error (timeout: %u) msg {0x%x 0x%x} len:%d v:%d\n", - hwrm_total_timeout(i), req_type, + hwrm_total_timeout(i) + j, req_type, le16_to_cpu(ctx->req->seq_id), len, *valid); goto exit; } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h index d52bd2d63aec..c98032e38188 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h @@ -90,7 +90,7 @@ static inline unsigned int hwrm_total_timeout(unsigned int n) } -#define HWRM_VALID_BIT_DELAY_USEC 150 +#define HWRM_VALID_BIT_DELAY_USEC 50000 static inline bool bnxt_cfa_hwrm_message(u16 req_type) { From patchwork Sun Feb 20 09:05:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12752636 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 390DFC433F5 for ; Sun, 20 Feb 2022 09:06:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243491AbiBTJGw (ORCPT ); Sun, 20 Feb 2022 04:06:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243488AbiBTJGp (ORCPT ); Sun, 20 Feb 2022 04:06:45 -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 758F831919 for ; Sun, 20 Feb 2022 01:06:25 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id j10-20020a17090a94ca00b001bc2a9596f6so689127pjw.5 for ; Sun, 20 Feb 2022 01:06:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HfOcs845FH3udlQwQ+9qKjD6VpJOWPeDp/jF0QyG82w=; b=dgxJ3hdHCzlk0i9gAnTHXGek6YG2FaFWyBrhsc6+2wa+FXm1Bq/AqxG5CM6nUWYlnY fngrIhygchPNs1I9X/646ydflaeYr9id9jQmv/py9ls4M8b3uPqkCXB1y26jLoYesLmw QRpClAY2a0f+aHSwbXQDEelRXFtXoOzxsxvKI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HfOcs845FH3udlQwQ+9qKjD6VpJOWPeDp/jF0QyG82w=; b=6sBYftwvVVsVTT+7+tbLAIPwPyEp7ffUL8/qVmGXO/rDlKd9i3aAdOc53JIHnZ/3OH ozpRpVWrw5HpSE/lmYG4icDjtB3wCSpkA0ZYcwN76M6naCeUmYcIEa9KnqjGVtJWA4kw gHwL+qGoC7JPRoXEhXiEJPpc0kdt1VthjzcXaJlKiyghjaKCzA7whNBBJVJVRQ/95m8I R/AF932IleMQToGWhWCbdhOO7jhcM5BTTXM1FJAM/wdxQvoGKLLNbNl2R2mMAutZdCV1 shfWh9Q/qamCeE9reJ7foKj6Dk1ETg4vi/Zk5PwL2xXj+Gn20SmPTKbdyjK56qfwfLZ0 6XGw== X-Gm-Message-State: AOAM532yx+xo570BosRgVZehIzp9UPgB1epYsezTA17Iz4wxGs0aQOet t6i/YoYeflkPBjWgxW/s4j90I2kUvcEwXQ== X-Google-Smtp-Source: ABdhPJx0bfEF40ECB+7NlhftrOebnuUmv61eCq0ltbvIAr4lq67WrAQZX2BjV8QN5KDyGwtQyCFjZw== X-Received: by 2002:a17:902:ec83:b0:14f:ba2b:990c with SMTP id x3-20020a170902ec8300b0014fba2b990cmr353756plg.119.1645347984611; Sun, 20 Feb 2022 01:06:24 -0800 (PST) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m5-20020a17090b068500b001b9bef22bf5sm4061865pjz.5.2022.02.20.01.06.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Feb 2022 01:06:24 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Kalesh AP Subject: [PATCH net 7/7] bnxt_en: Fix devlink fw_activate Date: Sun, 20 Feb 2022 04:05:53 -0500 Message-Id: <1645347953-27003-8-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> References: <1645347953-27003-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: Kalesh AP To install a livepatch, first flash the package to NVM, and then activate the patch through the "HWRM_FW_LIVEPATCH" fw command. To uninstall a patch from NVM, flash the removal package and then activate it through the "HWRM_FW_LIVEPATCH" fw command. The "HWRM_FW_LIVEPATCH" fw command has to consider following scenarios: 1. no patch in NVM and no patch active. Do nothing. 2. patch in NVM, but not active. Activate the patch currently in NVM. 3. patch is not in NVM, but active. Deactivate the patch. 4. patch in NVM and the patch active. Do nothing. Fix the code to handle these scenarios during devlink "fw_activate". To install and activate a live patch: devlink dev flash pci/0000:c1:00.0 file thor_patch.pkg devlink -f dev reload pci/0000:c1:00.0 action fw_activate limit no_reset To remove and deactivate a live patch: devlink dev flash pci/0000:c1:00.0 file thor_patch_rem.pkg devlink -f dev reload pci/0000:c1:00.0 action fw_activate limit no_reset Fixes: 3c4153394e2c ("bnxt_en: implement firmware live patching") Reviewed-by: Vikas Gupta Reviewed-by: Somnath Kotur Signed-off-by: Kalesh AP Signed-off-by: Michael Chan --- .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index 4da31b1b84f9..f6e21fac0e69 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -367,6 +367,16 @@ bnxt_dl_livepatch_report_err(struct bnxt *bp, struct netlink_ext_ack *extack, } } +/* Live patch status in NVM */ +#define BNXT_LIVEPATCH_NOT_INSTALLED 0 +#define BNXT_LIVEPATCH_INSTALLED FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL +#define BNXT_LIVEPATCH_REMOVED FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE +#define BNXT_LIVEPATCH_MASK (FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL | \ + FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE) +#define BNXT_LIVEPATCH_ACTIVATED BNXT_LIVEPATCH_MASK + +#define BNXT_LIVEPATCH_STATE(flags) ((flags) & BNXT_LIVEPATCH_MASK) + static int bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) { @@ -374,8 +384,9 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) struct hwrm_fw_livepatch_query_input *query_req; struct hwrm_fw_livepatch_output *patch_resp; struct hwrm_fw_livepatch_input *patch_req; + u16 flags, live_patch_state; + bool activated = false; u32 installed = 0; - u16 flags; u8 target; int rc; @@ -394,7 +405,6 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) hwrm_req_drop(bp, query_req); return rc; } - patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_ACTIVATE; patch_req->loadtype = FW_LIVEPATCH_REQ_LOADTYPE_NVM_INSTALL; patch_resp = hwrm_req_hold(bp, patch_req); @@ -407,12 +417,20 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) } flags = le16_to_cpu(query_resp->status_flags); - if (~flags & FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL) + live_patch_state = BNXT_LIVEPATCH_STATE(flags); + + if (live_patch_state == BNXT_LIVEPATCH_NOT_INSTALLED) continue; - if ((flags & FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE) && - !strncmp(query_resp->active_ver, query_resp->install_ver, - sizeof(query_resp->active_ver))) + + if (live_patch_state == BNXT_LIVEPATCH_ACTIVATED) { + activated = true; continue; + } + + if (live_patch_state == BNXT_LIVEPATCH_INSTALLED) + patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_ACTIVATE; + else if (live_patch_state == BNXT_LIVEPATCH_REMOVED) + patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_DEACTIVATE; patch_req->fw_target = target; rc = hwrm_req_send(bp, patch_req); @@ -424,8 +442,13 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) } if (!rc && !installed) { - NL_SET_ERR_MSG_MOD(extack, "No live patches found"); - rc = -ENOENT; + if (activated) { + NL_SET_ERR_MSG_MOD(extack, "Live patch already activated"); + rc = -EEXIST; + } else { + NL_SET_ERR_MSG_MOD(extack, "No live patches found"); + rc = -ENOENT; + } } hwrm_req_drop(bp, query_req); hwrm_req_drop(bp, patch_req);