From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4901BA0A02 for ; Mon, 17 May 2021 18:11:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4306740041; Mon, 17 May 2021 18:11:58 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id 8B10B40041 for ; Mon, 17 May 2021 18:11:56 +0200 (CEST) Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=Keschdeichel.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lifqW-0007ed-Be; Mon, 17 May 2021 16:11:56 +0000 From: Christian Ehrhardt To: Kalesh AP Cc: Ajit Khaparde , Somnath Kotur , dpdk stable Date: Mon, 17 May 2021 18:07:41 +0200 Message-Id: <20210517161039.3132619-32-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> References: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bnxt: fix FW readiness check during recovery' has been queued to stable release 19.11.9 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/19/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/e17e1144c4b7e34ba2a3694d7ad819f1b0904f38 Thanks. Christian Ehrhardt --- >From e17e1144c4b7e34ba2a3694d7ad819f1b0904f38 Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Wed, 24 Feb 2021 21:25:52 +0530 Subject: [PATCH] net/bnxt: fix FW readiness check during recovery [ upstream commit 6a4f7139cbce7345e45d9e75d4e28ad1b1218486 ] Moved fw readiness check to a new routine bnxt_check_fw_ready(). During error recovery, driver needs to wait for fw readiness. For that, it uses bnxt_hwrm_ver_get() function now and that function does parsing of the VER_GET response as well. Added a new lightweight function bnxt_hwrm_poll_ver_get() for polling the firmware readiness which issues VER_GET and checks for success without processing the command response. Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW") Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt_ethdev.c | 27 ++++++++++++++++++--------- drivers/net/bnxt/bnxt_hwrm.c | 21 +++++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.h | 1 + 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 7b3532760a..3f7e6cf787 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -4052,27 +4052,36 @@ static int bnxt_restore_filters(struct bnxt *bp) return ret; } -static void bnxt_dev_recover(void *arg) +static int bnxt_check_fw_ready(struct bnxt *bp) { - struct bnxt *bp = arg; int timeout = bp->fw_reset_max_msecs; int rc = 0; - /* Clear Error flag so that device re-init should happen */ - bp->flags &= ~BNXT_FLAG_FATAL_ERROR; - do { - rc = bnxt_hwrm_ver_get(bp, SHORT_HWRM_CMD_TIMEOUT); + rc = bnxt_hwrm_poll_ver_get(bp); if (rc == 0) break; rte_delay_ms(BNXT_FW_READY_WAIT_INTERVAL); timeout -= BNXT_FW_READY_WAIT_INTERVAL; - } while (rc && timeout); + } while (rc && timeout > 0); - if (rc) { + if (rc) PMD_DRV_LOG(ERR, "FW is not Ready after reset\n"); + + return rc; +} + +static void bnxt_dev_recover(void *arg) +{ + struct bnxt *bp = arg; + int rc = 0; + + /* Clear Error flag so that device re-init should happen */ + bp->flags &= ~BNXT_FLAG_FATAL_ERROR; + + rc = bnxt_check_fw_ready(bp); + if (rc) goto err; - } rc = bnxt_init_resources(bp, true); if (rc) { diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index f35e4a7811..b1b6b43e65 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -5095,3 +5095,24 @@ int bnxt_hwrm_port_ts_query(struct bnxt *bp, uint8_t path, uint64_t *timestamp) return rc; } +int bnxt_hwrm_poll_ver_get(struct bnxt *bp) +{ + struct hwrm_ver_get_input req = {.req_type = 0 }; + struct hwrm_ver_get_output *resp = bp->hwrm_cmd_resp_addr; + int rc = 0; + + bp->max_req_len = HWRM_MAX_REQ_LEN; + bp->hwrm_cmd_timeout = SHORT_HWRM_CMD_TIMEOUT; + + HWRM_PREP(&req, HWRM_VER_GET, BNXT_USE_CHIMP_MB); + req.hwrm_intf_maj = HWRM_VERSION_MAJOR; + req.hwrm_intf_min = HWRM_VERSION_MINOR; + req.hwrm_intf_upd = HWRM_VERSION_UPDATE; + + rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB); + + HWRM_CHECK_RESULT_SILENT(); + HWRM_UNLOCK(); + + return rc; +} diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index 067d77e423..74340eb863 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -231,4 +231,5 @@ int bnxt_hwrm_port_ts_query(struct bnxt *bp, uint8_t path, uint64_t *timestamp); int bnxt_clear_one_vnic_filter(struct bnxt *bp, struct bnxt_filter_info *filter); +int bnxt_hwrm_poll_ver_get(struct bnxt *bp); #endif -- 2.31.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-17 17:40:30.818920095 +0200 +++ 0032-net-bnxt-fix-FW-readiness-check-during-recovery.patch 2021-05-17 17:40:29.155809350 +0200 @@ -1 +1 @@ -From 6a4f7139cbce7345e45d9e75d4e28ad1b1218486 Mon Sep 17 00:00:00 2001 +From e17e1144c4b7e34ba2a3694d7ad819f1b0904f38 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 6a4f7139cbce7345e45d9e75d4e28ad1b1218486 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -23,2 +24,2 @@ - drivers/net/bnxt/bnxt_ethdev.c | 33 +++++++++++++++++++++------------ - drivers/net/bnxt/bnxt_hwrm.c | 22 ++++++++++++++++++++++ + drivers/net/bnxt/bnxt_ethdev.c | 27 ++++++++++++++++++--------- + drivers/net/bnxt/bnxt_hwrm.c | 21 +++++++++++++++++++++ @@ -26 +27 @@ - 3 files changed, 44 insertions(+), 12 deletions(-) + 3 files changed, 40 insertions(+), 9 deletions(-) @@ -29 +30 @@ -index 67ff800da5..af146451a5 100644 +index 7b3532760a..3f7e6cf787 100644 @@ -32 +33 @@ -@@ -3859,10 +3859,28 @@ static int bnxt_restore_filters(struct bnxt *bp) +@@ -4052,27 +4052,36 @@ static int bnxt_restore_filters(struct bnxt *bp) @@ -35,0 +37 @@ +-static void bnxt_dev_recover(void *arg) @@ -37,5 +39,10 @@ -+{ -+ int timeout = bp->fw_reset_max_msecs; -+ int rc = 0; -+ -+ do { + { +- struct bnxt *bp = arg; + int timeout = bp->fw_reset_max_msecs; + int rc = 0; + +- /* Clear Error flag so that device re-init should happen */ +- bp->flags &= ~BNXT_FLAG_FATAL_ERROR; +- + do { +- rc = bnxt_hwrm_ver_get(bp, SHORT_HWRM_CMD_TIMEOUT); @@ -43,4 +50,5 @@ -+ if (rc == 0) -+ break; -+ rte_delay_ms(BNXT_FW_READY_WAIT_INTERVAL); -+ timeout -= BNXT_FW_READY_WAIT_INTERVAL; + if (rc == 0) + break; + rte_delay_ms(BNXT_FW_READY_WAIT_INTERVAL); + timeout -= BNXT_FW_READY_WAIT_INTERVAL; +- } while (rc && timeout); @@ -48 +56,2 @@ -+ + +- if (rc) { @@ -50 +59 @@ -+ PMD_DRV_LOG(ERR, "FW is not Ready after reset\n"); + PMD_DRV_LOG(ERR, "FW is not Ready after reset\n"); @@ -55,21 +64,8 @@ - static void bnxt_dev_recover(void *arg) - { - struct bnxt *bp = arg; -- int timeout = bp->fw_reset_max_msecs; - int rc = 0; - - pthread_mutex_lock(&bp->err_recovery_lock); -@@ -3876,18 +3894,9 @@ static void bnxt_dev_recover(void *arg) - /* Clear Error flag so that device re-init should happen */ - bp->flags &= ~BNXT_FLAG_FATAL_ERROR; - -- do { -- rc = bnxt_hwrm_ver_get(bp, SHORT_HWRM_CMD_TIMEOUT); -- if (rc == 0) -- break; -- rte_delay_ms(BNXT_FW_READY_WAIT_INTERVAL); -- timeout -= BNXT_FW_READY_WAIT_INTERVAL; -- } while (rc && timeout); -- -- if (rc) { -- PMD_DRV_LOG(ERR, "FW is not Ready after reset\n"); ++static void bnxt_dev_recover(void *arg) ++{ ++ struct bnxt *bp = arg; ++ int rc = 0; ++ ++ /* Clear Error flag so that device re-init should happen */ ++ bp->flags &= ~BNXT_FLAG_FATAL_ERROR; ++ @@ -84 +80 @@ -index 9142119954..0b5318e238 100644 +index f35e4a7811..b1b6b43e65 100644 @@ -87 +83 @@ -@@ -5913,3 +5913,25 @@ int bnxt_hwrm_fw_echo_reply(struct bnxt *bp, uint32_t echo_req_data1, +@@ -5095,3 +5095,24 @@ int bnxt_hwrm_port_ts_query(struct bnxt *bp, uint8_t path, uint64_t *timestamp) @@ -91 +86,0 @@ -+ @@ -114 +109 @@ -index c47c2498e9..785e321bfd 100644 +index 067d77e423..74340eb863 100644 @@ -117,4 +112,4 @@ -@@ -304,4 +304,5 @@ int bnxt_hwrm_cfa_pair_free(struct bnxt *bp, struct bnxt_representor *rep); - int bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(struct bnxt *bp); - int bnxt_hwrm_fw_echo_reply(struct bnxt *bp, uint32_t echo_req_data1, - uint32_t echo_req_data2); +@@ -231,4 +231,5 @@ int bnxt_hwrm_port_ts_query(struct bnxt *bp, uint8_t path, + uint64_t *timestamp); + int bnxt_clear_one_vnic_filter(struct bnxt *bp, + struct bnxt_filter_info *filter);