public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>
To: <dev@dpdk.org>
Cc: <jgrajcia@cisco.com>, <ferruh.yigit@amd.com>, <stable@dpdk.org>,
	<mattias.ronnblom@ericsson.com>, <heng.wang@ericsson.com>,
	<ravi.kumar.chennaparapu@ericsson.com>,
	Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>
Subject: [PATCH] net/memif: fix descriptor flags corruption in multi-segment TX
Date: Tue, 3 Mar 2026 12:01:52 +0100	[thread overview]
Message-ID: <20260303110152.276344-1-sriram.yagnaraman@ericsson.com> (raw)

The memif TX path was using |= to set descriptor flags, which could
leave stale flag bits from previous ring iterations. This caused
descriptor corruption when the ring wrapped around, leading to
malformed packet chains and RX failures.

Initialize d0->flags to 0 before setting MEMIF_DESC_FLAG_NEXT to
ensure clean descriptor state on each transmission.

Fixes: 43b815d88188 ("net/memif: support zero-copy slave")
Cc: stable@dpdk.org

Signed-off-by: Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>
---
 drivers/net/memif/rte_eth_memif.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 8d7060cd7c..effcee3721 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -714,6 +714,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 
 next_in_chain1:
 			d0 = &ring->desc[slot & mask];
+			d0->flags = 0;
 			cp_len = rte_pktmbuf_data_len(mbuf);
 
 			rte_memcpy((uint8_t *)memif_get_buffer(proc_private, d0),
@@ -726,7 +727,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 
 			if (--nb_segs > 0) {
 				if (n_free) {
-					d0->flags |= MEMIF_DESC_FLAG_NEXT;
+					d0->flags = MEMIF_DESC_FLAG_NEXT;
 					mbuf = mbuf->next;
 					goto next_in_chain1;
 				} else {
@@ -747,6 +748,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 
 			saved_slot = slot;
 			d0 = &ring->desc[slot & mask];
+			d0->flags = 0;
 			dst_off = 0;
 			dst_len = (type == MEMIF_RING_C2S) ?
 				pmd->run.pkt_buffer_size : d0->length;
@@ -760,12 +762,12 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 					if (n_free) {
 						slot++;
 						n_free--;
-						d0->flags |= MEMIF_DESC_FLAG_NEXT;
+						d0->flags = MEMIF_DESC_FLAG_NEXT;
 						d0 = &ring->desc[slot & mask];
+						d0->flags = 0;
 						dst_off = 0;
 						dst_len = (type == MEMIF_RING_C2S) ?
 						    pmd->run.pkt_buffer_size : d0->length;
-						d0->flags = 0;
 					} else {
 						slot = saved_slot;
 						goto no_free_slots;
-- 
2.43.7


             reply	other threads:[~2026-03-03 11:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 11:01 Sriram Yagnaraman [this message]
2026-03-03 16:13 ` [PATCH] net/memif: fix descriptor flags corruption in multi-segment TX Stephen Hemminger
2026-03-16 16:08 ` Stephen Hemminger
2026-03-16 20:08   ` Sriram Yagnaraman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260303110152.276344-1-sriram.yagnaraman@ericsson.com \
    --to=sriram.yagnaraman@ericsson.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=heng.wang@ericsson.com \
    --cc=jgrajcia@cisco.com \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=ravi.kumar.chennaparapu@ericsson.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox