DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/bnxt: fix a segmentation fault
@ 2025-12-04 22:13 Manish Kurup
  0 siblings, 0 replies; only message in thread
From: Manish Kurup @ 2025-12-04 22:13 UTC (permalink / raw)
  To: dev; +Cc: stable, Ajit Khaparde

Fix a segmentation fault root-caused to the following

1. bnxt testpmd queries the THOR2 capabilities using an HWRM.
2. Another HWRM is made that overwrites the capabilities context,
   which results in the MPC context not being created.
3. Initializing TruFlow (which depends on the MPC context),
   results in a SEGV.

The fix moves the 2nd HWRM after the capabilities have been
consumed.

Fixes: 80317ff6adfd ("net/bnxt/tf_core: support Thor2")

Signed-off-by: Manish Kurup <manish.kurup@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 4d693da1d5..0cef22b5ec 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1198,15 +1198,6 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	if (BNXT_PF(bp))
 		bp->pf->total_vnics = rte_le_to_cpu_16(resp->max_vnics);
 
-	if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED) {
-		if (BNXT_CHIP_P5(bp) || BNXT_PF(bp)) {
-			bp->flags |= BNXT_FLAG_PTP_SUPPORTED;
-			PMD_DRV_LOG_LINE(DEBUG, "PTP SUPPORTED");
-			HWRM_UNLOCK();
-			bnxt_hwrm_ptp_qcfg(bp);
-		}
-	}
-
 	if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_STATS_SUPPORTED)
 		bp->flags |= BNXT_FLAG_EXT_STATS_SUPPORTED;
 
@@ -1263,6 +1254,18 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	if (flags_ext3 & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT3_RX_RATE_PROFILE_SEL_SUPPORTED)
 		bp->fw_cap |= BNXT_FW_CAP_RX_RATE_PROFILE;
 
+	/* This block should be kept at the end of this function because it
+	 * sends another hwrm msg.
+	 */
+	if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED) {
+		if (BNXT_CHIP_P5(bp) || BNXT_PF(bp)) {
+			bp->flags |= BNXT_FLAG_PTP_SUPPORTED;
+			PMD_DRV_LOG_LINE(DEBUG, "PTP SUPPORTED");
+			HWRM_UNLOCK();
+			bnxt_hwrm_ptp_qcfg(bp);
+		}
+	}
+
 unlock:
 	HWRM_UNLOCK();
 
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-04 22:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-04 22:13 [PATCH] net/bnxt: fix a segmentation fault Manish Kurup

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).