DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: William Bland <blandwwa@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, William Bland <blandwwa@gmail.com>
Subject: [PATCH v2 2/4] net/af_packet: make Rx VLAN stripped flag handling explicit
Date: Wed, 26 Aug 2026 13:38:39 -0400	[thread overview]
Message-ID: <20260826173842.1298754-2-blandwwa@gmail.com> (raw)
In-Reply-To: <20260826173842.1298754-1-blandwwa@gmail.com>

Rx VLAN handling set RTE_MBUF_F_RX_VLAN_STRIPPED unconditionally,
relying on rte_vlan_insert() to clear it again. This produced correct
flags, but in a way that was not readily apparent from the driver.

Make the flag handling explicit in the driver itself: only set
RTE_MBUF_F_RX_VLAN_STRIPPED when vlan_strip is requested, or when
reinsertion fails. No behavioral change.

Signed-off-by: William Bland <blandwwa@gmail.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index b0ff22ea55..d95d045a37 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -223,10 +223,14 @@ eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		/* check for vlan info */
 		if (ppd->tp_status & TP_STATUS_VLAN_VALID) {
 			mbuf->vlan_tci = ppd->tp_vlan_tci;
-			mbuf->ol_flags |= (RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED);
+			mbuf->ol_flags |= RTE_MBUF_F_RX_VLAN;
 
-			if (!pkt_q->vlan_strip && rte_vlan_insert(&mbuf))
+			if (pkt_q->vlan_strip) {
+				mbuf->ol_flags |= RTE_MBUF_F_RX_VLAN_STRIPPED;
+			} else if (rte_vlan_insert(&mbuf) != 0) {
 				PMD_LOG(ERR, "Failed to reinsert VLAN tag");
+				mbuf->ol_flags |= RTE_MBUF_F_RX_VLAN_STRIPPED;
+			}
 		}
 
 		/* add kernel provided timestamp when offloading is enabled */
-- 
2.43.0


  reply	other threads:[~2026-08-26 17:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 17:38 [PATCH v2 1/4] net: fix VLAN insert doc comment for shared-mbuf error code William Bland
2026-08-26 17:38 ` William Bland [this message]
2026-08-26 20:26   ` [PATCH v2 2/4] net/af_packet: make Rx VLAN stripped flag handling explicit Stephen Hemminger
2026-08-26 17:38 ` [PATCH v2 3/4] net: add VLAN insert function with a TPID argument William Bland
2026-08-26 20:27   ` Stephen Hemminger
2026-08-26 17:38 ` [PATCH v2 4/4] net/af_packet: fix QinQ outer TPID on VLAN reinsertion William Bland
2026-08-26 20:26 ` [PATCH v2 1/4] net: fix VLAN insert doc comment for shared-mbuf error code Stephen Hemminger

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=20260826173842.1298754-2-blandwwa@gmail.com \
    --to=blandwwa@gmail.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.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