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>,
	stable@dpdk.org, Lance Richardson <lance.richardson@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>
Subject: [dpdk-dev] [PATCH v2 04/10] net/bnxt: fix HWRM command failure during FW reset
Date: Tue, 21 Apr 2020 13:07:14 -0700	[thread overview]
Message-ID: <20200421200720.81151-5-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20200421200720.81151-1-ajit.khaparde@broadcom.com>

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

FW returns HWRM_ERR_CODE_HOT_RESET_PROGRESS(0xa) when it is
unable to process a specific cmd while hot reset is in progress.
Host driver is expected to keep retrying the cmd for 2s with
a gap of 50ms between each retrial.

Also, fixed to fail port start if the HWRM_FUNC_DRV_IF_CHANGE
still returns error after 2 seconds.

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  5 +++++
 drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++++++++++--------
 drivers/net/bnxt/bnxt_hwrm.c   |  4 ++++
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index a7a9e4113..d55a57039 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -480,6 +480,11 @@ struct bnxt_error_recovery_info {
 	uint32_t        last_reset_counter;
 };
 
+/* Frequency for the FUNC_DRV_IF_CHANGE retry in milliseconds */
+#define BNXT_IF_CHANGE_RETRY_INTERVAL	50
+/* Maximum retry count for FUNC_DRV_IF_CHANGE */
+#define BNXT_IF_CHANGE_RETRY_COUNT	40
+
 struct bnxt_mark_info {
 	uint32_t	mark_id;
 	bool		valid;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3397c0535..b6c713256 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1051,7 +1051,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	struct bnxt *bp = eth_dev->data->dev_private;
 	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
 	int vlan_mask = 0;
-	int rc;
+	int rc, retry_cnt = BNXT_IF_CHANGE_RETRY_COUNT;
 
 	if (!eth_dev->data->nb_tx_queues || !eth_dev->data->nb_rx_queues) {
 		PMD_DRV_LOG(ERR, "Queues are not configured yet!\n");
@@ -1064,14 +1064,23 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 			bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 	}
 
-	rc = bnxt_hwrm_if_change(bp, 1);
-	if (!rc) {
-		if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
-			rc = bnxt_handle_if_change_status(bp);
-			if (rc)
-				return rc;
-		}
+	do {
+		rc = bnxt_hwrm_if_change(bp, 1);
+		if (rc == 0 || rc != -EAGAIN)
+			break;
+
+		rte_delay_ms(BNXT_IF_CHANGE_RETRY_INTERVAL);
+	} while (retry_cnt--);
+
+	if (rc)
+		return rc;
+
+	if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
+		rc = bnxt_handle_if_change_status(bp);
+		if (rc)
+			return rc;
 	}
+
 	bnxt_enable_int(bp);
 
 	rc = bnxt_init_chip(bp);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 4c0fac6be..dc0b40560 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -221,6 +221,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 			rc = -EINVAL; \
 		else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
 			rc = -ENOTSUP; \
+		else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \
+			rc = -EAGAIN; \
 		else if (rc > 0) \
 			rc = -EIO; \
 		return rc; \
@@ -249,6 +251,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 			rc = -EINVAL; \
 		else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
 			rc = -ENOTSUP; \
+		else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \
+			rc = -EAGAIN; \
 		else if (rc > 0) \
 			rc = -EIO; \
 		return rc; \
-- 
2.21.1 (Apple Git-122.3)


  parent reply	other threads:[~2020-04-21 20:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 1/9] net/bnxt: use macro for PCI log format Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 2/9] net/bnxt: return speed capabilities in device info get Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 3/9] net/bnxt: fix to resend FUNC_DRV_IF_CHANGE when FW reset is in progress Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 4/9] net/bnxt: fix to use true/false for bool types Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 5/9] net/bnxt: fix to handle port start failure Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 6/9] net/bnxt: fix vlan add when port is stopped Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 7/9] net/bnxt: define FW_STATUS location structure for ChiMP devices Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 8/9] net/bnxt: log firmware status on early init failure Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 9/9] net/bnxt: fix to not issue HWRM_PORT_MAC_QCFG on a VF Kalesh A P
2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 01/10] net/bnxt: fix compilation on BSD Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 02/10] net/bnxt: use macro for PCI log format Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 03/10] net/bnxt: return speed capabilities in device get info Ajit Khaparde
2020-04-21 20:07   ` Ajit Khaparde [this message]
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 05/10] net/bnxt: fix to use true/false for bool types Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 06/10] net/bnxt: fix to handle port start failure Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 07/10] net/bnxt: fix vlan add when port is stopped Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 08/10] net/bnxt: add FW status location structure Ajit Khaparde
2020-04-21 21:05     ` Ferruh Yigit
2020-04-21 21:21       ` Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 09/10] net/bnxt: log firmware status on early init failure Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 10/10] net/bnxt: fix to not issue port MAC query on a VF Ajit Khaparde
2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 1/9] net/bnxt: fix compilation on BSD Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 2/9] net/bnxt: use macro for PCI log format Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 3/9] net/bnxt: return speed capabilities in device get info Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 4/9] net/bnxt: fix HWRM command failure during FW reset Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 5/9] net/bnxt: fix to use true/false for bool types Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 6/9] net/bnxt: fix to handle port start failure Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 7/9] net/bnxt: fix vlan add when port is stopped Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 8/9] net/bnxt: log firmware status on early init failure Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 9/9] net/bnxt: fix to not issue port MAC query on a VF Ajit Khaparde
2020-04-22 11:44   ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ferruh Yigit

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=20200421200720.81151-5-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=lance.richardson@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
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).