patch 'net/bnxt: roll back Tx descriptors for invalid packets' has been queued to stable release 24.11.7
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Thu Jun 11 15:21:05 CEST 2026
Hi,
FYI, your patch has been queued to stable release 24.11.7
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/13/26. 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/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/880d882db55543f93cef825912d4c969863c9090
Thanks.
Luca Boccassi
---
>From 880d882db55543f93cef825912d4c969863c9090 Mon Sep 17 00:00:00 2001
From: Zoe Cheimets <zoe.cheimets at broadcom.com>
Date: Wed, 3 Jun 2026 21:18:47 -0600
Subject: [PATCH] net/bnxt: roll back Tx descriptors for invalid packets
[ upstream commit 3bca8405f09fa8b9e63987fe0b070cbb5a5d82d2 ]
When bnxt_start_xmit() returned -EINVAL for a bad packet, the burst
loop broke immediately, dropping all subsequent valid packets. The
Tx ring was also left in a corrupt state because tx_raw_prod was not
rolled back after a partial descriptor write. Additionally, the
tx_mbuf_drop oerrors accumulation was gated behind a tx_started
check, silently omitting drops from the statistics.
Fix by rolling back tx_raw_prod and any partially-written ring slots
on the drop path, replacing the break with continue so the burst
loop keeps processing remaining packets, and moving the tx_mbuf_drop
read to before the tx_started guard in both stats paths. Return
value is corrected to RTE_MIN(nb_tx_pkts + dropped, nb_pkts) to
accurately report consumed packet count.
Fixes: 220de9869bc3 ("net/bnxt: optimize Tx batching")
Signed-off-by: Zoe Cheimets <zoe.cheimets at broadcom.com>
Signed-off-by: Mohammad Shuab Siddique <mohammad-shuab.siddique at broadcom.com>
---
drivers/net/bnxt/bnxt_txr.c | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index ad1bcc4511..9482dfeea7 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -235,15 +235,17 @@ static int bnxt_start_xmit(struct rte_mbuf *tx_pkt,
uint16_t *coal_pkts,
struct tx_bd_long **last_txbd)
{
+ struct tx_bd_long *last_txbd_save = *last_txbd;
struct bnxt_tx_ring_info *txr = txq->tx_ring;
struct bnxt_ring *ring = txr->tx_ring_struct;
+ uint16_t tx_raw_prod_save = txr->tx_raw_prod;
uint32_t outer_tpid_bd = 0;
struct tx_bd_long *txbd;
struct tx_bd_long_hi *txbd1 = NULL;
uint32_t vlan_tag_flags;
bool long_bd = false;
unsigned short nr_bds;
- uint16_t prod;
+ uint16_t prod, idx;
bool pkt_needs_ts = 0;
struct rte_mbuf *m_seg;
struct rte_mbuf **tx_buf;
@@ -505,6 +507,24 @@ static int bnxt_start_xmit(struct rte_mbuf *tx_pkt,
return 0;
drop:
+ /* Roll back any descriptors and tx_buf_ring slots that were written
+ * for this packet before the failure was detected. Walking from the
+ * saved producer index up to (but not including) the current one is
+ * safe because we hold the Tx lock and the HW has not been notified
+ * (the doorbell is only rung after bnxt_start_xmit() returns
+ * successfully).
+ */
+ idx = tx_raw_prod_save;
+
+ while (idx != txr->tx_raw_prod) {
+ uint16_t slot = RING_IDX(ring, idx);
+
+ txr->tx_buf_ring[slot] = NULL;
+ txr->tx_desc_ring[slot].address = 0;
+ idx = RING_NEXT(idx);
+ }
+ txr->tx_raw_prod = tx_raw_prod_save;
+ *last_txbd = last_txbd_save;
rte_pktmbuf_free(tx_pkt);
ret:
return rc;
@@ -834,22 +854,28 @@ uint16_t _bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
if (unlikely(rc)) {
if (rc == -EINVAL) {
+ coal_pkts--;
rte_atomic_fetch_add_explicit(&txq->tx_mbuf_drop, 1,
rte_memory_order_relaxed);
dropped++;
+ continue;
}
break;
}
}
- if (likely(nb_tx_pkts)) {
+ /* last_txbd is used to check for if any packets have been sent in
+ * the burst as bnxt_start_xmit will update it to the most recent
+ * non-dropped buffer descriptor in the burst.
+ */
+ if (likely(last_txbd != NULL)) {
/* Request a completion on the last packet */
last_txbd->flags_type &= ~TX_BD_LONG_FLAGS_NO_CMPL;
bnxt_db_write(&txq->tx_ring->tx_db, txq->tx_ring->tx_raw_prod);
}
- nb_tx_pkts += dropped;
- return nb_tx_pkts;
+ return RTE_MIN((uint16_t)(nb_tx_pkts + dropped), nb_pkts);
+
}
int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-06-11 14:20:05.896558809 +0100
+++ 0116-net-bnxt-roll-back-Tx-descriptors-for-invalid-packet.patch 2026-06-11 14:20:01.390750259 +0100
@@ -1 +1 @@
-From 3bca8405f09fa8b9e63987fe0b070cbb5a5d82d2 Mon Sep 17 00:00:00 2001
+From 880d882db55543f93cef825912d4c969863c9090 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 3bca8405f09fa8b9e63987fe0b070cbb5a5d82d2 ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org
@@ -30 +31 @@
-index a9469ca366..3fae0824d1 100644
+index ad1bcc4511..9482dfeea7 100644
@@ -33 +34 @@
-@@ -238,15 +238,17 @@ static int bnxt_start_xmit(struct rte_mbuf *tx_pkt,
+@@ -235,15 +235,17 @@ static int bnxt_start_xmit(struct rte_mbuf *tx_pkt,
@@ -52 +53 @@
-@@ -508,6 +510,24 @@ static int bnxt_start_xmit(struct rte_mbuf *tx_pkt,
+@@ -505,6 +507,24 @@ static int bnxt_start_xmit(struct rte_mbuf *tx_pkt,
@@ -77 +78 @@
-@@ -837,22 +857,28 @@ uint16_t _bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+@@ -834,22 +854,28 @@ uint16_t _bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
More information about the stable
mailing list