DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>
Subject: [PATCH v3 12/14] net/bnxt: retry HWRM ver get if the command fails
Date: Mon, 11 Dec 2023 09:11:07 -0800	[thread overview]
Message-ID: <20231211171109.89716-13-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20231211171109.89716-1-ajit.khaparde@broadcom.com>

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

Retry HWRM ver get if the command timesout because of PCI FLR.
When the PCI driver issues an FLR during device initialization,
the firmware may have to block the PXP target traffic till the FLR
is complete.

HWRM_VER_GET command issued during that window may time out.
So retry the command again in such a scenario.

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

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index f7a60eb9a1..7aed4c3da3 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -879,6 +879,7 @@ struct bnxt {
 
 	 /* default command timeout value of 500ms */
 #define DFLT_HWRM_CMD_TIMEOUT		500000
+#define PCI_FUNC_RESET_WAIT_TIMEOUT	1500000
 	 /* short command timeout value of 50ms */
 #define SHORT_HWRM_CMD_TIMEOUT		50000
 	/* default HWRM request timeout value */
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 81a30eb983..75e968394f 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -5441,6 +5441,7 @@ static int bnxt_map_hcomm_fw_status_reg(struct bnxt *bp)
 static int bnxt_get_config(struct bnxt *bp)
 {
 	uint16_t mtu;
+	int timeout;
 	int rc = 0;
 
 	bp->fw_cap = 0;
@@ -5449,8 +5450,17 @@ static int bnxt_get_config(struct bnxt *bp)
 	if (rc)
 		return rc;
 
-	rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT);
+	timeout = BNXT_CHIP_P7(bp) ?
+		  PCI_FUNC_RESET_WAIT_TIMEOUT :
+		  DFLT_HWRM_CMD_TIMEOUT;
+try_again:
+	rc = bnxt_hwrm_ver_get(bp, timeout);
 	if (rc) {
+		if (rc == -ETIMEDOUT && timeout == PCI_FUNC_RESET_WAIT_TIMEOUT) {
+			bp->flags &= ~BNXT_FLAG_FW_TIMEDOUT;
+			timeout = DFLT_HWRM_CMD_TIMEOUT;
+			goto try_again;
+		}
 		bnxt_check_fw_status(bp);
 		return rc;
 	}
-- 
2.39.2 (Apple Git-143)


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

  parent reply	other threads:[~2023-12-11 17:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 17:10 [PATCH v3 00/14] support new 5760X P7 devices Ajit Khaparde
2023-12-11 17:10 ` [PATCH v3 01/14] net/bnxt: refactor epoch setting Ajit Khaparde
2023-12-11 17:10 ` [PATCH v3 02/14] net/bnxt: update HWRM API Ajit Khaparde
2023-12-11 17:10 ` [PATCH v3 03/14] net/bnxt: log a message when multicast promisc mode changes Ajit Khaparde
2023-12-11 17:10 ` [PATCH v3 04/14] net/bnxt: use the correct COS queue for Tx Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 05/14] net/bnxt: refactor mem zone allocation Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 06/14] net/bnxt: add support for p7 device family Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 07/14] net/bnxt: refactor code to support P7 devices Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 08/14] net/bnxt: fix array overflow Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 09/14] net/bnxt: add support for backing store v2 Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 10/14] net/bnxt: refactor the ulp initialization Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 11/14] net/bnxt: modify sending new HWRM commands to firmware Ajit Khaparde
2023-12-11 17:11 ` Ajit Khaparde [this message]
2023-12-11 17:11 ` [PATCH v3 13/14] net/bnxt: cap ring resources for P7 devices Ajit Khaparde
2023-12-11 17:11 ` [PATCH v3 14/14] net/bnxt: add support for v3 Rx completion 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=20231211171109.89716-13-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=somnath.kotur@broadcom.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).