patch 'net/bnxt: fix epoch bit calculation' has been queued to stable release 24.11.2

Kevin Traynor ktraynor at redhat.com
Mon Mar 24 17:16:09 CET 2025


Hi,

FYI, your patch has been queued to stable release 24.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/28/25. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/4bbe513ff7134586ed9170c8ad1310db1b4218ff

Thanks.

Kevin

---
>From 4bbe513ff7134586ed9170c8ad1310db1b4218ff Mon Sep 17 00:00:00 2001
From: Ajit Khaparde <ajit.khaparde at broadcom.com>
Date: Wed, 26 Feb 2025 14:01:24 -0800
Subject: [PATCH] net/bnxt: fix epoch bit calculation

[ upstream commit 12f77a5f69ee35cf8dae5801c1ed8d4ef2423f97 ]

The epoch bit is a binary value which needs to be toggled with
every pass of the ring in the hardware.
The code was doing this prematurely in vector path.
Improve the ring wrap identification and fix epoch bit calculation
in the vector path.

Fixes: 30656a1cace8 ("net/bnxt: refactor epoch setting")

Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
Reviewed-by: Damodharam Ammepalli <damodharam.ammepalli at broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur at broadcom.com>
---
 drivers/net/bnxt/bnxt_ring.h            | 19 +++++++++++++++++++
 drivers/net/bnxt/bnxt_rxq.c             |  1 +
 drivers/net/bnxt/bnxt_rxq.h             |  1 +
 drivers/net/bnxt/bnxt_rxr.c             |  4 ++++
 drivers/net/bnxt/bnxt_rxtx_vec_common.h | 11 +++++------
 5 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h
index a7470a0e73..3e2bd634a8 100644
--- a/drivers/net/bnxt/bnxt_ring.h
+++ b/drivers/net/bnxt/bnxt_ring.h
@@ -109,4 +109,23 @@ static inline void bnxt_db_write(struct bnxt_db_info *db, uint32_t idx)
 }
 
+static inline void bnxt_db_epoch_write(struct bnxt_db_info *db, uint32_t idx, uint32_t epoch)
+{
+	uint32_t db_idx = DB_RING_IDX(db, idx);
+	void *doorbell = db->doorbell;
+
+	if (db->db_64) {
+		uint64_t key_idx = db->db_key64 | db_idx;
+
+		key_idx |= epoch << DBR_EPOCH_SFT;
+
+		rte_compiler_barrier();
+		rte_write64_relaxed(key_idx, doorbell);
+	} else {
+		uint32_t key_idx = db->db_key32 | db_idx;
+
+		rte_write32(key_idx, doorbell);
+	}
+}
+
 static inline void bnxt_db_mpc_write(struct bnxt_db_info *db, uint32_t idx, uint32_t epoch)
 {
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index a1c3777f33..91b3555df6 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -426,4 +426,5 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	}
 	rxq->rx_mbuf_alloc_fail = 0;
+	rxq->epoch = 0;
 
 	/* rxq 0 must not be stopped when used as async CPR */
diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h
index 0b411a941a..2e4dd20a1a 100644
--- a/drivers/net/bnxt/bnxt_rxq.h
+++ b/drivers/net/bnxt/bnxt_rxq.h
@@ -30,4 +30,5 @@ struct bnxt_rx_queue {
 	uint16_t		rxrearm_start; /* next desc index to reinit. */
 #endif
+	uint32_t		epoch;
 	uint16_t		port_id; /* Device port identifier */
 	uint8_t			crc_len; /* 0 if CRC stripped, 4 otherwise */
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index b53d9a917a..c94abefa01 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -1367,4 +1367,8 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			rxq->rxrearm_start++;
 			rxq->rxrearm_nb--;
+			if (rxq->rxrearm_start >= rxq->nb_rx_desc) {
+				rxq->rxrearm_start = 0;
+				rxq->epoch = rxq->epoch == 0 ? 1 : 0;
+			}
 		} else {
 			/* Retry allocation on next call. */
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_common.h b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
index f608b5152e..e185005293 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_common.h
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
@@ -51,4 +51,5 @@ bnxt_rxq_vec_setup_common(struct bnxt_rx_queue *rxq)
 	rxq->rxrearm_nb = 0;
 	rxq->rxrearm_start = 0;
+	rxq->epoch = 1;
 	return 0;
 }
@@ -89,11 +90,9 @@ bnxt_rxq_rearm(struct bnxt_rx_queue *rxq, struct bnxt_rx_ring_info *rxr)
 
 	rxq->rxrearm_start += nb;
-	/*
-	 * We can pass rxq->rxrearm_star - 1 as well, but then the epoch
-	 * bit calculation is messed up.
-	 */
-	bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
-	if (rxq->rxrearm_start >= rxq->nb_rx_desc)
+	bnxt_db_epoch_write(&rxr->rx_db, rxq->rxrearm_start - 1, rxq->epoch);
+	if (rxq->rxrearm_start >= rxq->nb_rx_desc) {
 		rxq->rxrearm_start = 0;
+		rxq->epoch = rxq->epoch == 0 ? 1 : 0;
+	}
 
 	rxq->rxrearm_nb -= nb;
-- 
2.48.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2025-03-24 16:15:14.917836671 +0000
+++ 0002-net-bnxt-fix-epoch-bit-calculation.patch	2025-03-24 16:15:14.690735255 +0000
@@ -1 +1 @@
-From 12f77a5f69ee35cf8dae5801c1ed8d4ef2423f97 Mon Sep 17 00:00:00 2001
+From 4bbe513ff7134586ed9170c8ad1310db1b4218ff Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 12f77a5f69ee35cf8dae5801c1ed8d4ef2423f97 ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -65 +66 @@
-index cd49faf4cf..3385496e70 100644
+index 0b411a941a..2e4dd20a1a 100644
@@ -68 +69 @@
-@@ -31,4 +31,5 @@ struct bnxt_rx_queue {
+@@ -30,4 +30,5 @@ struct bnxt_rx_queue {



More information about the stable mailing list