[v2,11/14] net/bnxt: modify sending new HWRM commands to firmware

Message ID 20231210012455.20229-12-ajit.khaparde@broadcom.com (mailing list archive)
State Changes Requested
Delegated to: Ajit Khaparde
Headers
Series support new 5760X P7 devices |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Ajit Khaparde Dec. 10, 2023, 1:24 a.m. UTC
  If the firmware fails to respond a HWRM command in a certain time,
it may be because the firmware is in a bad state.
Do not send any new HWRM commands in such a scenario.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
---
 drivers/net/bnxt/bnxt.h      | 1 +
 drivers/net/bnxt/bnxt_hwrm.c | 5 +++++
 2 files changed, 6 insertions(+)
  

Patch

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 68c4778dc3..f7a60eb9a1 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -745,6 +745,7 @@  struct bnxt {
 #define BNXT_FLAG_DFLT_MAC_SET			BIT(26)
 #define BNXT_FLAG_GFID_ENABLE			BIT(27)
 #define BNXT_FLAG_CHIP_P7			BIT(30)
+#define BNXT_FLAG_FW_TIMEDOUT			BIT(31)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
 #define BNXT_NPAR(bp)		((bp)->flags & BNXT_FLAG_NPAR_PF)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index dda3d3a6ac..2835d48a0e 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -215,6 +215,10 @@  static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 	if (bp->flags & BNXT_FLAG_FATAL_ERROR)
 		return 0;
 
+	/* If previous HWRM command timed out, donot send new HWRM command */
+	if (bp->flags & BNXT_FLAG_FW_TIMEDOUT)
+		return 0;
+
 	timeout = bp->hwrm_cmd_timeout;
 
 	/* Update the message length for backing store config for new FW. */
@@ -315,6 +319,7 @@  static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 		PMD_DRV_LOG(ERR,
 			    "Error(timeout) sending msg 0x%04x, seq_id %d\n",
 			    req->req_type, req->seq_id);
+		bp->flags |= BNXT_FLAG_FW_TIMEDOUT;
 		return -ETIMEDOUT;
 	}
 	return 0;