patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com,
	Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,
	stable@dpdk.org, Somnath Kotur <somnath.kotur@broadcom.com>
Subject: [dpdk-stable] [PATCH v3 11/12] net/bnxt: fix FW readiness check during recovery
Date: Thu, 11 Mar 2021 21:58:18 -0800
Message-ID: <20210312055819.52789-12-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20210312055819.52789-1-ajit.khaparde@broadcom.com>

[-- Attachment #1: Type: text/plain, Size: 3759 bytes --]

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

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")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 33 +++++++++++++++++++++------------
 drivers/net/bnxt/bnxt_hwrm.c   | 22 ++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h   |  1 +
 3 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 67ff800da5..af146451a5 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3859,10 +3859,28 @@ static int bnxt_restore_filters(struct bnxt *bp)
 	return ret;
 }
 
+static int bnxt_check_fw_ready(struct bnxt *bp)
+{
+	int timeout = bp->fw_reset_max_msecs;
+	int rc = 0;
+
+	do {
+		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 > 0);
+
+	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 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");
+	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 9142119954..0b5318e238 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -5913,3 +5913,25 @@ int bnxt_hwrm_fw_echo_reply(struct bnxt *bp, uint32_t echo_req_data1,
 
 	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 c47c2498e9..785e321bfd 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -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);
+int bnxt_hwrm_poll_ver_get(struct bnxt *bp);
 #endif
-- 
2.21.1 (Apple Git-122.3)


  parent reply	other threads:[~2021-03-12  5:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CACZ4nhtnEg+YVCB0dtH24Q0XywynXeeQgFfVUzAFiPco4ZaKew@mail.gmail.com>
     [not found] ` <20210312055819.52789-1-ajit.khaparde@broadcom.com>
2021-03-12  5:58   ` [dpdk-stable] [PATCH v3 02/12] net/bnxt: remove unused macro Ajit Khaparde
2021-03-12  5:58   ` [dpdk-stable] [PATCH v3 03/12] net/bnxt: fix VNIC configuration Ajit Khaparde
2021-03-12  5:58   ` [dpdk-stable] [PATCH v3 05/12] net/bnxt: fix queues per VNIC Ajit Khaparde
2021-03-12  5:58   ` [dpdk-stable] [PATCH v3 10/12] net/bnxt: fix firmware fatal error handling Ajit Khaparde
2021-03-12  5:58   ` Ajit Khaparde [this message]
2021-03-12  5:58   ` [dpdk-stable] [PATCH v3 12/12] net/bnxt: fix PTP support for Thor Ajit Khaparde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210312055819.52789-12-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git