[dpdk-dev] [PATCH v2 05/13] net/bnxt: handle fatal event from FW under error conditions

Ajit Khaparde ajit.khaparde at broadcom.com
Fri Aug 30 18:35:29 CEST 2019


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

When firmware hit some unrecoverable error conditions, firmware initiate
the recovery by sending an async event EVENT_CMPL_EVENT_ID_RESET_NOTIFY
with data1 set to RESET_NOTIFY_EVENT_DATA1_REASON_CODE_FW_EXCEPTION_FATAL
to all host drivers and will reset the chip.

The recovery procedure is same sequence as the one for hot FW upgrade.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur at broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.c    | 13 +++++++++++--
 drivers/net/bnxt/bnxt_cpr.h    |  5 +++++
 drivers/net/bnxt/bnxt_ethdev.c |  3 +++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 62a16d2ed..0b2eeef8f 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -21,6 +21,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	struct hwrm_async_event_cmpl *async_cmp =
 				(struct hwrm_async_event_cmpl *)cmp;
 	uint16_t event_id = rte_le_to_cpu_16(async_cmp->event_id);
+	uint32_t event_data;
 
 	/* TODO: HWRM async events are not defined yet */
 	/* Needs to handle: link events, error events, etc. */
@@ -42,6 +43,7 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		PMD_DRV_LOG(INFO, "Port conn async event\n");
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY:
+		event_data = rte_le_to_cpu_32(async_cmp->event_data1);
 		/* timestamp_lo/hi values are in units of 100ms */
 		bp->fw_reset_max_msecs = async_cmp->timestamp_hi ?
 			rte_le_to_cpu_16(async_cmp->timestamp_hi) * 100 :
@@ -49,8 +51,15 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		bp->fw_reset_min_msecs = async_cmp->timestamp_lo ?
 			async_cmp->timestamp_lo * 100 :
 			BNXT_MIN_FW_READY_TIMEOUT;
-		PMD_DRV_LOG(INFO,
-			    "Firmware non-fatal reset event received\n");
+		if ((event_data & EVENT_DATA1_REASON_CODE_MASK) ==
+		    EVENT_DATA1_REASON_CODE_FW_EXCEPTION_FATAL) {
+			PMD_DRV_LOG(INFO,
+				    "Firmware fatal reset event received\n");
+			bp->flags |= BNXT_FLAG_FATAL_ERROR;
+		} else {
+			PMD_DRV_LOG(INFO,
+				    "Firmware non-fatal reset event received\n");
+		}
 
 		bp->flags |= BNXT_FLAG_FW_RESET;
 		rte_eal_alarm_set(US_PER_MS, bnxt_dev_reset_and_resume,
diff --git a/drivers/net/bnxt/bnxt_cpr.h b/drivers/net/bnxt/bnxt_cpr.h
index f48293b96..b61bafa0e 100644
--- a/drivers/net/bnxt/bnxt_cpr.h
+++ b/drivers/net/bnxt/bnxt_cpr.h
@@ -108,4 +108,9 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmp);
 int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp);
 void bnxt_dev_reset_and_resume(void *arg);
 
+#define EVENT_DATA1_REASON_CODE_FW_EXCEPTION_FATAL     \
+	HWRM_ASYNC_EVENT_CMPL_RESET_NOTIFY_EVENT_DATA1_REASON_CODE_FW_EXCEPTION_FATAL
+#define EVENT_DATA1_REASON_CODE_MASK                   \
+	HWRM_ASYNC_EVENT_CMPL_RESET_NOTIFY_EVENT_DATA1_REASON_CODE_MASK
+
 #endif
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 385492db5..a917e0440 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3512,6 +3512,9 @@ static void bnxt_dev_recover(void *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);
 		if (rc == 0)
-- 
2.20.1 (Apple Git-117)



More information about the dev mailing list