DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: dev@dpdk.org
Cc: ajit.khaparde@broadcom.com
Subject: [dpdk-dev] [PATCH 4/4] net/bnxt: add handler for pause storm event
Date: Mon, 12 Jul 2021 13:34:35 +0530	[thread overview]
Message-ID: <20210712080435.9149-5-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20210712080435.9149-1-kalesh-anakkur.purayil@broadcom.com>

From: Somnath Kotur <somnath.kotur@broadcom.com>

FW has been modified to send a new async event when it detects
a pause storm. Register for this new event and log it upon receipt.

Signed-off-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_cpr.c  | 19 +++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.c |  3 ++-
 drivers/net/bnxt/bnxt_hwrm.h |  2 ++
 4 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 702ecac..494a1ef 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -157,6 +157,11 @@
 #define	BNXT_DEFAULT_VNIC_CHANGE_VF_ID_SFT		\
 	HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_SFT
 
+#define BNXT_EVENT_ERROR_REPORT_TYPE(data1)				\
+	(((data1) &							\
+	  HWRM_ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_MASK)  >>\
+	 HWRM_ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_SFT)
+
 #define BNXT_HWRM_CMD_TO_FORWARD(cmd)	\
 		(bp->pf->vf_req_fwd[(cmd) / 32] |= (1 << ((cmd) % 32)))
 
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 500146b..3afa2b8 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -91,6 +91,22 @@ bnxt_process_default_vnic_change(struct bnxt *bp,
 	bnxt_rep_dev_start_op(eth_dev);
 }
 
+static void bnxt_handle_event_error_report(struct bnxt *bp,
+					   uint32_t data1,
+					   uint32_t data2)
+{
+	switch (BNXT_EVENT_ERROR_REPORT_TYPE(data1)) {
+	case HWRM_ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_PAUSE_STORM:
+		PMD_DRV_LOG(WARNING, "Port:%d Pause Storm detected!\n",
+			    bp->eth_dev->data->port_id);
+		break;
+	default:
+		PMD_DRV_LOG(INFO, "FW reported unknown error type data1 %d"
+			    " data2: %d\n", data1, data2);
+		break;
+	}
+}
+
 /*
  * Async event handling
  */
@@ -213,6 +229,9 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		if (bp->recovery_info)
 			bnxt_hwrm_fw_echo_reply(bp, data1, data2);
 		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_ERROR_REPORT:
+		bnxt_handle_event_error_report(bp, data1, data2);
+		break;
 	default:
 		PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
 		break;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index d583839..e6c46d4 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1085,7 +1085,8 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE);
 
 	req.async_event_fwd[2] |=
-		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_ECHO_REQUEST);
+		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_ECHO_REQUEST |
+				 ASYNC_CMPL_EVENT_ID_ERROR_REPORT);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index 80e3128..b311ff5 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -37,6 +37,8 @@ struct hwrm_func_qstats_output;
 	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE - 32))
 #define	ASYNC_CMPL_EVENT_ID_ECHO_REQUEST	\
 	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_ECHO_REQUEST - 64))
+#define	ASYNC_CMPL_EVENT_ID_ERROR_REPORT	\
+	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_ERROR_REPORT - 64))
 
 #define HWRM_QUEUE_SERVICE_PROFILE_LOSSY \
 	HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY
-- 
2.10.1


  parent reply	other threads:[~2021-07-12  7:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12  8:04 [dpdk-dev] [PATCH 0/4] bnxt PMD patches Kalesh A P
2021-07-12  8:04 ` [dpdk-dev] [PATCH 1/4] net/bnxt: update HSI structure Kalesh A P
2021-07-12  8:04 ` [dpdk-dev] [PATCH 2/4] net/bnxt: inform firmware about host MTU Kalesh A P
2021-07-12  8:04 ` [dpdk-dev] [PATCH 3/4] net/bnxt: minor refactoring of async handling code Kalesh A P
2021-07-12  8:04 ` Kalesh A P [this message]
2021-07-15  0:29 ` [dpdk-dev] [PATCH 0/4] bnxt PMD patches 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=20210712080435.9149-5-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@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).