Skip to contentSkip to conversation

net/ice: fix assumption about tag placement order

PATCH Superseded Bruce Richardson 3 participants 7 messages Jul 16, 2025 – Aug 7, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ice: fix assumption about tag placement order

The specific placement of outer/inner VLAN tags in E810 and related NICs is configurable. Therefore, remove the assumption that if the L2Tag2 field is filled in, that the L2Tag1 must also be. Instead, check the existing mbuf VLAN flags, and move tags and set flags as appropriate. This fixes an issue where, with QinQ packets with different Tag ethtypes (0x88a8 vs 0x8100), we get an mbuf reporting two valid tags, but only having had one tag stripped.

Fixes e0dcf94a0d7f ("net/ice: support VLAN ops")
---
 drivers/net/intel/ice/ice_rxtx.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +7 -3
index da508592aa..f965aab6ee 100644
@@ -1835,9 +1835,13 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ci_rx_flex_desc *rxdp)
 #ifndef RTE_NET_INTEL_USE_16BYTE_DESC
 	if (rte_le_to_cpu_16(rxdp->wb.status_error1) &
 	    (1 << ICE_RX_FLEX_DESC_STATUS1_L2TAG2P_S)) {
-		mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED | RTE_MBUF_F_RX_QINQ |
-				RTE_MBUF_F_RX_VLAN_STRIPPED | RTE_MBUF_F_RX_VLAN;
-		mb->vlan_tci_outer = mb->vlan_tci;
+		if ((mb->ol_flags & RTE_MBUF_F_RX_VLAN_STRIPPED) == 0) {
+			mb->ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
+		} else {
+			/* if two tags, move Tag1 to outer tag field */
+			mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED | RTE_MBUF_F_RX_QINQ;
+			mb->vlan_tci_outer = mb->vlan_tci;
+		}
 		mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd);
 		PMD_RX_LOG(DEBUG, "Descriptor l2tag2_1: %u, l2tag2_2: %u",
 			   rte_le_to_cpu_16(rxdp->wb.l2tag2_1st),
Signature · 1 line
2.48.1
#1 lore raw
Quoted 9 lines · Bruce Richardson

The specific placement of outer/inner VLAN tags in E810 and related NICs is configurable. Therefore, remove the assumption that if the L2Tag2 field is filled in, that the L2Tag1 must also be. Instead, check the existing mbuf VLAN flags, and move tags and set flags as appropriate. This fixes an issue where, with QinQ packets with different Tag ethtypes (0x88a8 vs 0x8100), we get an mbuf reporting two valid tags, but only having had one tag stripped.

Quoted 4 lines
Fixes e0dcf94a0d7f ("net/ice: support VLAN ops")

The ice code seems copy/pasted from i40e.
So I guess i40e is affected as well.

Signature · 1 line
David Marchand
#2 lore raw
Quoted 11 lines · David Marchand
Quoted 9 lines · Bruce Richardson

The specific placement of outer/inner VLAN tags in E810 and related NICs is configurable. Therefore, remove the assumption that if the L2Tag2 field is filled in, that the L2Tag1 must also be. Instead, check the existing mbuf VLAN flags, and move tags and set flags as appropriate. This fixes an issue where, with QinQ packets with different Tag ethtypes (0x88a8 vs 0x8100), we get an mbuf reporting two valid tags, but only having had one tag stripped.

Quoted 8 lines
Quoted 4 lines
Fixes e0dcf94a0d7f ("net/ice: support VLAN ops")

The ice code seems copy/pasted from i40e.
So I guess i40e is affected as well.

I'll investigate more. These fixes I intend for 25.11 anyway, since I'd rather not risk them late in the 25.07 release cycle.

/Bruce

#3 lore raw
Quoted 16 lines · Bruce Richardson
Quoted 14 lines · David Marchand
Quoted 12 lines · Bruce Richardson

The specific placement of outer/inner VLAN tags in E810 and related NICs is configurable. Therefore, remove the assumption that if the L2Tag2 field is filled in, that the L2Tag1 must also be. Instead, check the existing mbuf VLAN flags, and move tags and set flags as appropriate. This fixes an issue where, with QinQ packets with different Tag ethtypes (0x88a8 vs 0x8100), we get an mbuf reporting two valid tags, but only having had one tag stripped.

Fixes e0dcf94a0d7f ("net/ice: support VLAN ops")
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

The ice code seems copy/pasted from i40e.
So I guess i40e is affected as well.

I'll investigate more. These fixes I intend for 25.11 anyway, since I'd

iavf has a similar helper.

Quoted 1 line

rather not risk them late in the 25.07 release cycle.

Yes, too late for the current release.

Signature · 1 line
David Marchand
#4 lore raw

PATCH v2 1/1 net/intel: fix assumption about tag placement order

In reply to Bruce Richardson

The specific placement of outer/inner VLAN tags in NIC descriptors is configurable. Therefore, remove the assumption that if the L2Tag2 field is filled in, that the L2Tag1 must also be. Instead, check the existing mbuf VLAN flags, and move tags and set flags as appropriate. This fixes an issue where, with QinQ packets with different Tag ethtypes (0x88a8 vs 0x8100), we get an mbuf reporting two valid tags, but only having had one tag stripped.

Fixes cc9d0456b870 ("i40e: support double vlan stripping and insertion")
Fixes 1e728b01120c ("net/iavf: rework Tx path")
Fixes e0dcf94a0d7f ("net/ice: support VLAN ops")
---
 drivers/net/intel/i40e/i40e_rxtx.c | 10 +++++++---
 drivers/net/intel/iavf/iavf_rxtx.c | 12 +++++++-----
 drivers/net/intel/ice/ice_rxtx.c   | 10 +++++++---
 3 files changed, 21 insertions(+), 11 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +7 -3
index aba3c11ee5..a1fc320d05 100644
@@ -128,9 +128,13 @@ i40e_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ci_rx_desc *rxdp)
 #ifndef RTE_NET_INTEL_USE_16BYTE_DESC
 	if (rte_le_to_cpu_16(rxdp->wb.qword2.ext_status) &
 		(1 << I40E_RX_DESC_EXT_STATUS_L2TAG2P_SHIFT)) {
-		mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED | RTE_MBUF_F_RX_QINQ |
-			RTE_MBUF_F_RX_VLAN_STRIPPED | RTE_MBUF_F_RX_VLAN;
-		mb->vlan_tci_outer = mb->vlan_tci;
+		if ((mb->ol_flags & RTE_MBUF_F_RX_VLAN_STRIPPED) == 0) {
+			mb->ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
+		} else {
+			/* if two tags, move Tag1 to outer tag field */
+			mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED | RTE_MBUF_F_RX_QINQ;
+			mb->vlan_tci_outer = mb->vlan_tci;
+		}
 		mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.qword2.l2tag2_2);
 		PMD_RX_LOG(DEBUG, "Descriptor l2tag2_1: %u, l2tag2_2: %u",
 			   rte_le_to_cpu_16(rxdp->wb.qword2.l2tag2_1),
drivers/net/intel/iavf/iavf_rxtx.c +7 -5
index 7033a74610..887dcd1b2f 100644
@@ -1169,11 +1169,13 @@ iavf_flex_rxd_to_vlan_tci(struct rte_mbuf *mb,
 
 	if (rte_le_to_cpu_16(rxdp->wb.status_error1) &
 	    (1 << IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S)) {
-		mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED |
-				RTE_MBUF_F_RX_QINQ |
-				RTE_MBUF_F_RX_VLAN_STRIPPED |
-				RTE_MBUF_F_RX_VLAN;
-		mb->vlan_tci_outer = mb->vlan_tci;
+		if ((mb->ol_flags & RTE_MBUF_F_RX_VLAN_STRIPPED) == 0) {
+			mb->ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
+		} else {
+			/* if two tags, move Tag1 to outer tag field */
+			mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED | RTE_MBUF_F_RX_QINQ;
+			mb->vlan_tci_outer = mb->vlan_tci;
+		}
 		mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd);
 		PMD_RX_LOG(DEBUG, "Descriptor l2tag2_1: %u, l2tag2_2: %u",
 			   rte_le_to_cpu_16(rxdp->wb.l2tag2_1st),
drivers/net/intel/ice/ice_rxtx.c +7 -3
index da508592aa..f965aab6ee 100644
@@ -1835,9 +1835,13 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ci_rx_flex_desc *rxdp)
 #ifndef RTE_NET_INTEL_USE_16BYTE_DESC
 	if (rte_le_to_cpu_16(rxdp->wb.status_error1) &
 	    (1 << ICE_RX_FLEX_DESC_STATUS1_L2TAG2P_S)) {
-		mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED | RTE_MBUF_F_RX_QINQ |
-				RTE_MBUF_F_RX_VLAN_STRIPPED | RTE_MBUF_F_RX_VLAN;
-		mb->vlan_tci_outer = mb->vlan_tci;
+		if ((mb->ol_flags & RTE_MBUF_F_RX_VLAN_STRIPPED) == 0) {
+			mb->ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
+		} else {
+			/* if two tags, move Tag1 to outer tag field */
+			mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED | RTE_MBUF_F_RX_QINQ;
+			mb->vlan_tci_outer = mb->vlan_tci;
+		}
 		mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd);
 		PMD_RX_LOG(DEBUG, "Descriptor l2tag2_1: %u, l2tag2_2: %u",
 			   rte_le_to_cpu_16(rxdp->wb.l2tag2_1st),
Signature · 1 line
2.48.1
Acked-by on v2 1/1
#5 lore raw

RE: [PATCH v2] net/intel: fix assumption about tag placement order

Quoted 102 lines

The specific placement of outer/inner VLAN tags in NIC descriptors is configurable. Therefore, remove the assumption that if the L2Tag2 field is filled in, that the L2Tag1 must also be. Instead, check the existing mbuf VLAN flags, and move tags and set flags as appropriate. This fixes an issue where, with QinQ packets with different Tag ethtypes (0x88a8 vs 0x8100), we get an mbuf reporting two valid tags, but only having had one tag stripped.

Fixes cc9d0456b870 ("i40e: support double vlan stripping and insertion")
Fixes 1e728b01120c ("net/iavf: rework Tx path")
Fixes e0dcf94a0d7f ("net/ice: support VLAN ops")
---
 drivers/net/intel/i40e/i40e_rxtx.c | 10 +++++++---
 drivers/net/intel/iavf/iavf_rxtx.c | 12 +++++++-----
 drivers/net/intel/ice/ice_rxtx.c   | 10 +++++++---
 3 files changed, 21 insertions(+), 11 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +0 -1
index aba3c11ee5..a1fc320d05 100644
@@ -128,9 +128,13 @@ i40e_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile
 union ci_rx_desc *rxdp)
 #ifndef RTE_NET_INTEL_USE_16BYTE_DESC
 	if (rte_le_to_cpu_16(rxdp->wb.qword2.ext_status) &
 		(1 << I40E_RX_DESC_EXT_STATUS_L2TAG2P_SHIFT)) {
-		mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED |

RTE_MBUF_F_RX_QINQ |

drivers/net/intel/i40e/i40e_rxtx.c +0 -1
-			RTE_MBUF_F_RX_VLAN_STRIPPED |

RTE_MBUF_F_RX_VLAN;

drivers/net/intel/i40e/i40e_rxtx.c +2 -1
-		mb->vlan_tci_outer = mb->vlan_tci;
+		if ((mb->ol_flags & RTE_MBUF_F_RX_VLAN_STRIPPED) == 0) {
+			mb->ol_flags |= RTE_MBUF_F_RX_VLAN |

RTE_MBUF_F_RX_VLAN_STRIPPED;

drivers/net/intel/i40e/i40e_rxtx.c +3 -0
+		} else {
+			/* if two tags, move Tag1 to outer tag field */
+			mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED |

RTE_MBUF_F_RX_QINQ;

drivers/net/intel/i40e/i40e_rxtx.c +2 -0
+			mb->vlan_tci_outer = mb->vlan_tci;
+		}
 		mb->vlan_tci = rte_le_to_cpu_16(rxdp-
Quoted 1 line

wb.qword2.l2tag2_2);

PMD_RX_LOG(DEBUG, "Descriptor l2tag2_1: %u, l2tag2_2:
%u",

drivers/net/intel/i40e/i40e_rxtx.c +0 -0
 			   rte_le_to_cpu_16(rxdp->wb.qword2.l2tag2_1),
drivers/net/intel/iavf/iavf_rxtx.c +7 -5
index 7033a74610..887dcd1b2f 100644
@@ -1169,11 +1169,13 @@ iavf_flex_rxd_to_vlan_tci(struct rte_mbuf *mb,
 
 	if (rte_le_to_cpu_16(rxdp->wb.status_error1) &
 	    (1 << IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S)) {
-		mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED |
-				RTE_MBUF_F_RX_QINQ |
-				RTE_MBUF_F_RX_VLAN_STRIPPED |
-				RTE_MBUF_F_RX_VLAN;
-		mb->vlan_tci_outer = mb->vlan_tci;
+		if ((mb->ol_flags & RTE_MBUF_F_RX_VLAN_STRIPPED) == 0) {
+			mb->ol_flags |= RTE_MBUF_F_RX_VLAN |
 RTE_MBUF_F_RX_VLAN_STRIPPED;
+		} else {
+			/* if two tags, move Tag1 to outer tag field */
+			mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED |
 RTE_MBUF_F_RX_QINQ;
+			mb->vlan_tci_outer = mb->vlan_tci;
+		}
 		mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd);

PMD_RX_LOG(DEBUG, "Descriptor l2tag2_1: %u, l2tag2_2:
%u",

drivers/net/intel/iavf/iavf_rxtx.c +0 -0
 			   rte_le_to_cpu_16(rxdp->wb.l2tag2_1st),
drivers/net/intel/ice/ice_rxtx.c +0 -1
index da508592aa..f965aab6ee 100644
@@ -1835,9 +1835,13 @@ ice_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile
 union ci_rx_flex_desc *rxdp)
 #ifndef RTE_NET_INTEL_USE_16BYTE_DESC
 	if (rte_le_to_cpu_16(rxdp->wb.status_error1) &
 	    (1 << ICE_RX_FLEX_DESC_STATUS1_L2TAG2P_S)) {
-		mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED |

RTE_MBUF_F_RX_QINQ |

drivers/net/intel/ice/ice_rxtx.c +0 -1
-				RTE_MBUF_F_RX_VLAN_STRIPPED |

RTE_MBUF_F_RX_VLAN;

drivers/net/intel/ice/ice_rxtx.c +2 -1
-		mb->vlan_tci_outer = mb->vlan_tci;
+		if ((mb->ol_flags & RTE_MBUF_F_RX_VLAN_STRIPPED) == 0) {
+			mb->ol_flags |= RTE_MBUF_F_RX_VLAN |

RTE_MBUF_F_RX_VLAN_STRIPPED;

drivers/net/intel/ice/ice_rxtx.c +3 -0
+		} else {
+			/* if two tags, move Tag1 to outer tag field */
+			mb->ol_flags |= RTE_MBUF_F_RX_QINQ_STRIPPED |

RTE_MBUF_F_RX_QINQ;

drivers/net/intel/ice/ice_rxtx.c +2 -0
+			mb->vlan_tci_outer = mb->vlan_tci;
+		}
 		mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd);
 		PMD_RX_LOG(DEBUG, "Descriptor l2tag2_1: %u, l2tag2_2:
Quoted 4 lines

%u",
rte_le_to_cpu_16(rxdp->wb.l2tag2_1st),
--
2.48.1

author Applied
#6 lore raw

Re: [PATCH v2] net/intel: fix assumption about tag placement order

Quoted 14 lines · Ciara
Quoted 14 lines

The specific placement of outer/inner VLAN tags in NIC descriptors is configurable. Therefore, remove the assumption that if the L2Tag2 field is filled in, that the L2Tag1 must also be. Instead, check the existing mbuf VLAN flags, and move tags and set flags as appropriate. This fixes an issue where, with QinQ packets with different Tag ethtypes (0x88a8 vs 0x8100), we get an mbuf reporting two valid tags, but only having had one tag stripped.

Fixes cc9d0456b870 ("i40e: support double vlan stripping and insertion")
Fixes 1e728b01120c ("net/iavf: rework Tx path")
Fixes e0dcf94a0d7f ("net/ice: support VLAN ops")
Quoted 9 lines
Quoted 6 lines
---
 drivers/net/intel/i40e/i40e_rxtx.c | 10 +++++++---
 drivers/net/intel/iavf/iavf_rxtx.c | 12 +++++++-----
 drivers/net/intel/ice/ice_rxtx.c   | 10 +++++++---
 3 files changed, 21 insertions(+), 11 deletions(-)

Applied to dpdk-next-net-intel.

/Bruce