[v2,07/13] net/bnxt: register for and handle RSS change event

Message ID 20241027171128.50221-8-ajit.khaparde@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series patchset for bnxt PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ajit Khaparde Oct. 27, 2024, 5:11 p.m. UTC
From: Manish Kurup <manish.kurup@broadcom.com>

1. Register for RSS change events. When an RSS change occurs
   (especially for custom parsed tunnels), we need to update
   the RSS flags in the VNIC QCAPS so that upstream drivers
   don't send down the now unsupported bits
   ("config port all rss all" command). This will cause the
   firmware to fail the HWRM command. This should be done by
   the driver registering for said events, and re-reading the
   VNIC QCAPS for that bp.
2. Add a call to update QCAPS upon async notifications
   for the same.
3. Fix bug in PMD QCAPS update code The PMD QCAPS function
   only "sets" the new QCAPS flags, but not clearing them,
   if they were cleared due to some events. Fixed this by
   clearing the flags first, so that we could correctly
   set the new ones (for that bp).

Signed-off-by: Manish Kurup <manish.kurup@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.c  | 6 ++++++
 drivers/net/bnxt/bnxt_hwrm.c | 5 ++++-
 drivers/net/bnxt/bnxt_hwrm.h | 2 ++
 3 files changed, 12 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 455240a09d..ac1d537bc9 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -294,6 +294,12 @@  void bnxt_handle_async_event(struct bnxt *bp,
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_FLR:
 		bnxt_process_vf_flr(bp, data1);
 		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RSS_CHANGE:
+		/* RSS change notification, re-read QCAPS */
+		PMD_DRV_LOG_LINE(INFO, "Async event: RSS change event [%#x, %#x]",
+				 data1, data2);
+		bnxt_hwrm_vnic_qcaps(bp);
+		break;
 	default:
 		PMD_DRV_LOG_LINE(DEBUG, "handle_async_event id = 0x%x", event_id);
 		break;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 1ac4b8cd58..80f7c1a6a1 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1307,6 +1307,8 @@  int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
 
 	HWRM_CHECK_RESULT();
 
+	bp->vnic_cap_flags = 0;
+
 	flags = rte_le_to_cpu_32(resp->flags);
 
 	if (flags & HWRM_VNIC_QCAPS_OUTPUT_FLAGS_COS_ASSIGNMENT_CAP) {
@@ -1444,7 +1446,8 @@  int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 
 	req.async_event_fwd[2] |=
 		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_ECHO_REQUEST |
-				 ASYNC_CMPL_EVENT_ID_ERROR_REPORT);
+				 ASYNC_CMPL_EVENT_ID_ERROR_REPORT |
+				 ASYNC_CMPL_EVENT_ID_RSS_CHANGE);
 
 	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 2346ae637d..ecb6335b3d 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -41,6 +41,8 @@  struct hwrm_func_qstats_output;
 	(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	ASYNC_CMPL_EVENT_ID_RSS_CHANGE	\
+	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RSS_CHANGE - 64))
 
 #define HWRM_QUEUE_SERVICE_PROFILE_LOSSY \
 	HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY