patch 'raw/ntb: fix Rx of incomplete packets' has been queued to stable release 24.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Nov 16 23:52:24 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/18/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/8dd6ba43e47d62928c9de0c2d52270430de03dc8

Thanks.

Luca Boccassi

---
>From 8dd6ba43e47d62928c9de0c2d52270430de03dc8 Mon Sep 17 00:00:00 2001
From: Raghavendra Ningoji <raghavendra.ningoji at amd.com>
Date: Wed, 11 Nov 2026 12:36:42 +0530
Subject: [PATCH] raw/ntb: fix Rx of incomplete packets

[ upstream commit e79842a253e1aabb8af2788c429e09c6a2f9b883 ]

When a packet had no EOP descriptor among the ones walked, or when a
refill mbuf could not be allocated in the middle of a packet, the Rx
burst stopped with the packet partially consumed: the ring indexes had
moved, but the mbuf chain was neither returned nor freed, and the
refilled descriptors were not published to the peer if no packet had
been completed before.

The EOP guard also bounded the walk on the ring size rather than on
the descriptors actually published by the peer.

Only take a packet once all of its descriptors have been published,
and allocate its refill mbufs before consuming it, so that the ring
indexes are only advanced for complete packets.

Fixes: 11b5c7daf019 ("raw/ntb: add enqueue and dequeue functions")
Fixes: 5ce50c234ad1 ("raw/ntb: generalize framework for multiple vendors")

Signed-off-by: Raghavendra Ningoji <raghavendra.ningoji at amd.com>
---
 drivers/raw/ntb/ntb.c | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index 4cf330024c..7d38bbca95 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -786,13 +786,14 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
 	struct ntb_rx_queue *rxq = hw->rx_queues[(size_t)context];
 	struct ntb_rx_entry *sw_ring = rxq->sw_ring;
 	struct ntb_desc rx_desc[NTB_MAX_DESC_SIZE];
-	struct rte_mbuf *first, *rxm_t;
+	struct rte_mbuf *new_mbufs[NTB_MAX_DESC_SIZE];
+	struct rte_mbuf *first = NULL, *rxm_t;
 	struct rte_mbuf *prev = NULL;
 	volatile struct ntb_used *rx_item;
 	uint16_t nb_mbufs = 0;
 	uint16_t nb_rx = 0;
 	uint64_t bytes = 0;
-	uint16_t off, last_avail, used_cnt, used_nb;
+	uint16_t off, last_avail, used_cnt, used_nb, nb_segs;
 	int i;
 
 	if (unlikely(dev->started == 0 || hw->peer_dev_up == 0)) {
@@ -809,8 +810,24 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
 	used_nb = (used_cnt - rxq->last_used) & (rxq->nb_rx_desc - 1);
 	count = RTE_MIN(count, used_nb);
 	for (nb_rx = 0; nb_rx < count; nb_rx++) {
-		i = 0;
-		while (true) {
+		/* Only take a packet once the peer has published all of it. */
+		for (nb_segs = 1; ; nb_segs++) {
+			if (nb_segs > used_nb)
+				goto end_of_rx;
+			rx_item = rxq->rx_used_ring + ((rxq->last_used + nb_segs - 1) &
+						       (rxq->nb_rx_desc - 1));
+			if (rx_item->flags & NTB_FLAG_EOP)
+				break;
+		}
+
+		/* Get the refill mbufs first so a packet is never partially consumed. */
+		if (unlikely(rte_pktmbuf_alloc_bulk(rxq->mpool, new_mbufs, nb_segs))) {
+			NTB_LOG(ERR, "recv alloc mbuf failed.");
+			goto end_of_rx;
+		}
+		used_nb -= nb_segs;
+
+		for (i = 0; i < nb_segs; i++) {
 			rx_item = rxq->rx_used_ring + rxq->last_used;
 			rxm_t = sw_ring[rxq->last_used].mbuf;
 			rxm_t->data_len = rx_item->len;
@@ -832,15 +849,9 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
 			rxq->last_used = (rxq->last_used + 1) &
 					 (rxq->nb_rx_desc - 1);
 
-			/* alloc new mbuf */
-			rxm_t = rte_mbuf_raw_alloc(rxq->mpool);
-			if (unlikely(rxm_t == NULL)) {
-				NTB_LOG(ERR, "recv alloc mbuf failed.");
-				goto end_of_rx;
-			}
+			rxm_t = new_mbufs[i];
 			rxm_t->port = rxq->port_id;
 			sw_ring[rxq->last_avail].mbuf = rxm_t;
-			i++;
 
 			/* fill new desc */
 			rx_desc[nb_mbufs].addr =
@@ -849,9 +860,6 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
 						  RTE_PKTMBUF_HEADROOM;
 			rxq->last_avail = (rxq->last_avail + 1) &
 					  (rxq->nb_rx_desc - 1);
-
-			if (rx_item->flags & NTB_FLAG_EOP)
-				break;
 		}
 		/* update stats */
 		bytes += first->pkt_len;
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-11-16 22:52:19.273857260 +0000
+++ 0070-raw-ntb-fix-Rx-of-incomplete-packets.patch	2026-11-16 22:52:16.536234756 +0000
@@ -1 +1 @@
-From e79842a253e1aabb8af2788c429e09c6a2f9b883 Mon Sep 17 00:00:00 2001
+From 8dd6ba43e47d62928c9de0c2d52270430de03dc8 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit e79842a253e1aabb8af2788c429e09c6a2f9b883 ]
+
@@ -22 +23,0 @@
-Cc: stable at dpdk.org
@@ -26,2 +27,2 @@
- drivers/raw/ntb/ntb.c | 39 +++++++++++++++++++++------------------
- 1 file changed, 21 insertions(+), 18 deletions(-)
+ drivers/raw/ntb/ntb.c | 36 ++++++++++++++++++++++--------------
+ 1 file changed, 22 insertions(+), 14 deletions(-)
@@ -30 +31 @@
-index ac312592dd..11303bb2bb 100644
+index 4cf330024c..7d38bbca95 100644
@@ -33 +34 @@
-@@ -650,13 +650,14 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
+@@ -786,13 +786,14 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
@@ -50 +51 @@
-@@ -673,13 +674,24 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
+@@ -809,8 +810,24 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
@@ -56,3 +56,0 @@
--			if (unlikely(nb_mbufs >= rxq->nb_rx_desc)) {
--				NTB_LOG(ERR, "Malformed rx stream (no EOP); "
--					"aborting to avoid desc overflow.");
@@ -62,2 +60 @@
- 				goto end_of_rx;
--			}
++				goto end_of_rx;
@@ -71 +68 @@
-+		if (unlikely(rte_mbuf_raw_alloc_bulk(rxq->mpool, new_mbufs, nb_segs))) {
++		if (unlikely(rte_pktmbuf_alloc_bulk(rxq->mpool, new_mbufs, nb_segs))) {
@@ -81 +78 @@
-@@ -701,15 +713,9 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
+@@ -832,15 +849,9 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
@@ -98 +95 @@
-@@ -718,9 +724,6 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
+@@ -849,9 +860,6 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,


More information about the stable mailing list