Thread (7 messages) flat view 7 messages, 2 authors, 21d ago
COLD21d

[PATCH v2 2/4] net/af_packet: make Rx VLAN stripped flag handling explicit

From: William Bland <hidden>
Date: 2026-08-26 17:39:05
Subsystem: networking drivers, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help