Skip to contentSkip to conversation

VLAN and QinQ fixes for iavf

PATCH Superseded Bruce Richardson 3 participants 29 messages Aug 31 – Sep 4 Network drivers

lore
Share & tools
lore
#0 lore raw

cover VLAN and QinQ fixes for iavf

This patchset contains a number of small fixes for iavf VLAN tag handling. Most issues were discovered by AI code review rather than being found in testing.

Bruce Richardson (7):
net/iavf: disable broken QinQ strip on Rx net/iavf: fix VLAN tag placement logic
net/iavf: fix VLAN outer TPID setting on Tx net/intel: fix unclear enum names
net/intel: fix VLAN and QinQ tag position logic net/iavf: fix missing outer QinQ tag for tunnelled packets net/iavf: remove undocumented conditional macros

 drivers/net/intel/common/tx.h                 | 14 ++---
 drivers/net/intel/common/tx_scalar.h          | 16 ++++--
 drivers/net/intel/i40e/i40e_rxtx.c            |  6 +-
 drivers/net/intel/iavf/iavf_ethdev.c          | 12 ++--
 drivers/net/intel/iavf/iavf_rxtx.c            | 56 +++++++++----------
 drivers/net/intel/iavf/iavf_rxtx.h            |  4 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   | 12 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 12 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 18 ------
 drivers/net/intel/ice/ice_rxtx.c              |  6 +-
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  3 +-
 11 files changed, 74 insertions(+), 85 deletions(-)

--
2.53.0

#1 lore raw

PATCH 1/7 net/iavf: disable broken QinQ strip on Rx

When 2 VLANs are stripped from a packet, the iavf driver vector path fails to handle them properly as it 'or's the two values together on the assumption that only one is valid. Explicitly list the VLAN related features supported by the vector path, rather than using the "OFFLOAD_VLAN" group, thereby disabling advertising of QinQ stripping so that a scalar path is used.

Fixes 1e728b01120c ("net/iavf: rework Tx path")
---
 drivers/net/intel/iavf/iavf_rxtx.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/intel/iavf/iavf_rxtx.h +3 -1
index 6f53d5805a..3ff49b94b4 100644
@@ -105,7 +105,9 @@
 		IAVF_RX_VECTOR_OFFLOADS |		\
 		RTE_ETH_RX_OFFLOAD_CHECKSUM |		\
 		RTE_ETH_RX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_RX_OFFLOAD_VLAN |		\
+		RTE_ETH_RX_OFFLOAD_VLAN_STRIP |		\
+		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |	\
+		RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |	\
 		RTE_ETH_RX_OFFLOAD_RSS_HASH)
 /* vector offload paths that use the flex rx desc */
 #define IAVF_RX_VECTOR_OFFLOAD_FLEX_OFFLOADS (		\

--
2.53.0

Acked-by on v1 1/7
#2 lore raw

RE: [PATCH 1/7] net/iavf: disable broken QinQ strip on Rx

Quoted 9 lines

Subject: [PATCH 1/7] net/iavf: disable broken QinQ strip on Rx

When 2 VLANs are stripped from a packet, the iavf driver vector path fails to handle them properly as it 'or's the two values together on the assumption that only one is valid. Explicitly list the VLAN related features supported by the vector path, rather than using the "OFFLOAD_VLAN" group, thereby disabling advertising of QinQ stripping so that a scalar path is used.

Quoted 4 lines
Fixes 1e728b01120c ("net/iavf: rework Tx path")
Quoted 22 lines
---
 drivers/net/intel/iavf/iavf_rxtx.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/intel/iavf/iavf_rxtx.h +3 -2
index 6f53d5805a..3ff49b94b4 100644
@@ -105,7 +105,9 @@
 		IAVF_RX_VECTOR_OFFLOADS |		\
 		RTE_ETH_RX_OFFLOAD_CHECKSUM |		\
 		RTE_ETH_RX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_RX_OFFLOAD_VLAN |		\
+		RTE_ETH_RX_OFFLOAD_VLAN_STRIP |		\
+		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |	\
+		RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |	\
 		RTE_ETH_RX_OFFLOAD_RSS_HASH)
 /* vector offload paths that use the flex rx desc */
 #define IAVF_RX_VECTOR_OFFLOAD_FLEX_OFFLOADS (		\
--

2.53.0

#3 lore raw

PATCH 2/7 net/iavf: fix VLAN tag placement logic

In reply to Bruce Richardson

Depending on what is reported by the PF to the VF the VLAN tag or VLAN + QinQ tags can be in either the L2Tag1 or the L2Tag2 fields. This needs to be taken into account when reading the vlan tags from the flex descriptors, rather than assuming that the tag is always present in a fixed location.

Fixes 1e728b01120c ("net/iavf: rework Tx path")
---
 drivers/net/intel/iavf/iavf_rxtx.c | 49 +++++++++++++++---------------
 1 file changed, 24 insertions(+), 25 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +24 -25
index d65a518f8e..39bcbebf56 100644
@@ -1151,33 +1151,32 @@ iavf_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ci_rx_desc *rxdp)
 
 static inline void
 iavf_flex_rxd_to_vlan_tci(struct rte_mbuf *mb,
-			  volatile union ci_rx_flex_desc *rxdp)
+			  volatile union ci_rx_flex_desc *rxdp,
+			  uint8_t rx_flags)
 {
-	if (rte_le_to_cpu_64(rxdp->wb.status_error0) &
-		(1 << IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S)) {
-		mb->ol_flags |= RTE_MBUF_F_RX_VLAN |
-				RTE_MBUF_F_RX_VLAN_STRIPPED;
-		mb->vlan_tci =
-			rte_le_to_cpu_16(rxdp->wb.l2tag1);
-	} else {
-		mb->vlan_tci = 0;
-	}
-
-	if (rte_le_to_cpu_16(rxdp->wb.status_error1) &
-	    (1 << IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S)) {
-		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;
+	bool l2tag1_valid = rte_le_to_cpu_16(rxdp->wb.status_error0) &
+			(1 << IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S);
+	bool l2tag2_valid = rte_le_to_cpu_16(rxdp->wb.status_error1) &
+			(1 << IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S);
+	if (l2tag1_valid && l2tag2_valid) {
+		mb->ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED |
+				RTE_MBUF_F_RX_QINQ | RTE_MBUF_F_RX_QINQ_STRIPPED;
+		/* with both tags, the rx_flags say which is outer vs inner */
+		if (rx_flags & IAVF_RX_FLAGS_VLAN_TAG_LOC_L2TAG2_2) {
+			mb->vlan_tci_outer = rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd);
+			mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.l2tag1);
 		} 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_outer = rte_le_to_cpu_16(rxdp->wb.l2tag1);
+			mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd);
 		}
-		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),
-			   rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd));
+	} else if (l2tag1_valid || l2tag2_valid) {
+		mb->ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
+		mb->vlan_tci_outer = 0;
+		mb->vlan_tci = rte_le_to_cpu_16(
+				l2tag1_valid ? rxdp->wb.l2tag1 : rxdp->wb.l2tag2_2nd);
 	} else {
 		mb->vlan_tci_outer = 0;
+		mb->vlan_tci = 0;
 	}
 }
 
@@ -1564,7 +1563,7 @@ iavf_recv_pkts_flex_rxd(void *rx_queue,
 		rxm->ol_flags = 0;
 		rxm->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &
 			rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
-		iavf_flex_rxd_to_vlan_tci(rxm, &rxd);
+		iavf_flex_rxd_to_vlan_tci(rxm, &rxd, rxq->rx_flags);
 		iavf_flex_rxd_to_ipsec_crypto_status(rxm, &rxd,
 				&rxq->stats->ipsec_crypto);
 		rxd_to_pkt_fields_ops[rxq->rxdid](rxq, rxm, &rxd);
@@ -1731,7 +1730,7 @@ iavf_recv_scattered_pkts_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts,
 		first_seg->ol_flags = 0;
 		first_seg->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &
 			rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
-		iavf_flex_rxd_to_vlan_tci(first_seg, &rxd);
+		iavf_flex_rxd_to_vlan_tci(first_seg, &rxd, rxq->rx_flags);
 		iavf_flex_rxd_to_ipsec_crypto_status(first_seg, &rxd,
 				&rxq->stats->ipsec_crypto);
 		rxd_to_pkt_fields_ops[rxq->rxdid](rxq, first_seg, &rxd);
@@ -2013,7 +2012,7 @@ iavf_rx_scan_hw_ring_flex_rxd(struct ci_rx_queue *rxq,
 
 			mb->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &
 				rte_le_to_cpu_16(rxdp[j].wb.ptype_flex_flags0)];
-			iavf_flex_rxd_to_vlan_tci(mb, &rxdp[j]);
+			iavf_flex_rxd_to_vlan_tci(mb, &rxdp[j], rxq->rx_flags);
 			iavf_flex_rxd_to_ipsec_crypto_status(mb, &rxdp[j],
 				&rxq->stats->ipsec_crypto);
 			rxd_to_pkt_fields_ops[rxq->rxdid](rxq, mb, &rxdp[j]);

--
2.53.0

Acked-by on v1 2/7
#4 lore raw

RE: [PATCH 2/7] net/iavf: fix VLAN tag placement logic

Quoted 8 lines

Subject: [PATCH 2/7] net/iavf: fix VLAN tag placement logic

Depending on what is reported by the PF to the VF the VLAN tag or VLAN + QinQ tags can be in either the L2Tag1 or the L2Tag2 fields. This needs to be taken into account when reading the vlan tags from the flex descriptors, rather than assuming that the tag is always present in a fixed location.

Quoted 4 lines
Fixes 1e728b01120c ("net/iavf: rework Tx path")
Quoted 12 lines
---
 drivers/net/intel/iavf/iavf_rxtx.c | 49 +++++++++++++++---------------
 1 file changed, 24 insertions(+), 25 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +0 -0
index d65a518f8e..39bcbebf56 100644
@@ -1151,33 +1151,32 @@ iavf_rxd_to_vlan_tci(struct rte_mbuf *mb,
 volatile union ci_rx_desc *rxdp)
 
#5 lore raw

PATCH 3/7 net/iavf: fix VLAN outer TPID setting on Tx

In reply to Bruce Richardson

The outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.

Fixes 8599d7604e0a ("net/iavf: support QinQ strip")
Fixes 7ce1363b424f ("net/iavf: support QinQ insertion")
---
 drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +8 -4
index c4a6763f28..126be4c9a5 100644
@@ -1461,13 +1461,17 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type, uint16
 		return -ENOTSUP;
 	}
 
-	/* This API only fills internal iavf_adapter structure
-	 * and does not send any signal to hardware.
-	 * Inner VLAN always 0x8100, so not set explicitly.
-	 */
+	/* Inner VLAN always 0x8100, so not set explicitly. */
 	if (qinq && vlan_type == RTE_ETH_VLAN_TYPE_OUTER)
 		adapter->tpid = tpid; /* Outer VLAN can be 0x88a8 or 0x8100 */
 
+	/* Re-push insertion, and stripping if already enabled, so the new
+	 * outer TPID reaches the PF instead of only being cached here.
+	 */
+	iavf_dev_vlan_insert_set(dev);
+	if (dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_QINQ_STRIP)
+		iavf_dev_vlan_offload_set(dev, RTE_ETH_QINQ_STRIP_MASK);
+
 	return 0;
 }
 
Signature · 1 line
2.53.0
#6 lore raw

RE: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx

Quoted 41 lines

Subject: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx

The outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.

Fixes 8599d7604e0a ("net/iavf: support QinQ strip")
Fixes 7ce1363b424f ("net/iavf: support QinQ insertion")
---
 drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +0 -0
index c4a6763f28..126be4c9a5 100644
@@ -1461,13 +1461,17 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev,

enum rte_vlan_type vlan_type, uint16

drivers/net/intel/iavf/iavf_ethdev.c +1 -4
 		return -ENOTSUP;
 	}
 
-	/* This API only fills internal iavf_adapter structure
-	 * and does not send any signal to hardware.
-	 * Inner VLAN always 0x8100, so not set explicitly.
-	 */
+	/* Inner VLAN always 0x8100, so not set explicitly. */
 	if (qinq && vlan_type == RTE_ETH_VLAN_TYPE_OUTER)
 		adapter->tpid = tpid; /* Outer VLAN can be 0x88a8 or 0x8100

*/

drivers/net/intel/iavf/iavf_ethdev.c +5 -0
+	/* Re-push insertion, and stripping if already enabled, so the new
+	 * outer TPID reaches the PF instead of only being cached here.
+	 */
+	iavf_dev_vlan_insert_set(dev);
+	if (dev_conf->rxmode.offloads &

RTE_ETH_RX_OFFLOAD_QINQ_STRIP)

drivers/net/intel/iavf/iavf_ethdev.c +1 -0
+		iavf_dev_vlan_offload_set(dev,
Quoted 1 line

RTE_ETH_QINQ_STRIP_MASK);

Should we check the return value of this call and fail if an error is reported?

Quoted 6 lines
drivers/net/intel/iavf/iavf_ethdev.c +1 -1
+
 	return 0;
 }
 
--

2.53.0

#7 lore raw

Re: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx

Quoted 34 lines · Ciara
Quoted 34 lines

Subject: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx

The outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.

Fixes 8599d7604e0a ("net/iavf: support QinQ strip")
Fixes 7ce1363b424f ("net/iavf: support QinQ insertion")
---
 drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +0 -0
index c4a6763f28..126be4c9a5 100644
@@ -1461,13 +1461,17 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev,

enum rte_vlan_type vlan_type, uint16

drivers/net/intel/iavf/iavf_ethdev.c +1 -4
 		return -ENOTSUP;
 	}
 
-	/* This API only fills internal iavf_adapter structure
-	 * and does not send any signal to hardware.
-	 * Inner VLAN always 0x8100, so not set explicitly.
-	 */
+	/* Inner VLAN always 0x8100, so not set explicitly. */
 	if (qinq && vlan_type == RTE_ETH_VLAN_TYPE_OUTER)
 		adapter->tpid = tpid; /* Outer VLAN can be 0x88a8 or 0x8100

*/

Quoted 11 lines
Quoted 8 lines
drivers/net/intel/iavf/iavf_ethdev.c +5 -0
+	/* Re-push insertion, and stripping if already enabled, so the new
+	 * outer TPID reaches the PF instead of only being cached here.
+	 */
+	iavf_dev_vlan_insert_set(dev);
+	if (dev_conf->rxmode.offloads &

RTE_ETH_RX_OFFLOAD_QINQ_STRIP)

drivers/net/intel/iavf/iavf_ethdev.c +1 -0
+		iavf_dev_vlan_offload_set(dev,

RTE_ETH_QINQ_STRIP_MASK);

Should we check the return value of this call and fail if an error is reported?

Probably yes, will do in next revision.

/Bruce

Acked-by
#8 lore raw

RE: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx

Quoted 48 lines

Subject: Re: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx

Quoted 34 lines · Ciara
Quoted 34 lines

Subject: [PATCH 3/7] net/iavf: fix VLAN outer TPID setting on Tx

The outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.

Fixes 8599d7604e0a ("net/iavf: support QinQ strip")
Fixes 7ce1363b424f ("net/iavf: support QinQ insertion")
---
 drivers/net/intel/iavf/iavf_ethdev.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +0 -0
index c4a6763f28..126be4c9a5 100644
@@ -1461,13 +1461,17 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev,

enum rte_vlan_type vlan_type, uint16

drivers/net/intel/iavf/iavf_ethdev.c +1 -4
 		return -ENOTSUP;
 	}
 
-	/* This API only fills internal iavf_adapter structure
-	 * and does not send any signal to hardware.
-	 * Inner VLAN always 0x8100, so not set explicitly.
-	 */
+	/* Inner VLAN always 0x8100, so not set explicitly. */
 	if (qinq && vlan_type == RTE_ETH_VLAN_TYPE_OUTER)
 		adapter->tpid = tpid; /* Outer VLAN can be 0x88a8 or 0x8100

*/

Quoted 11 lines
Quoted 8 lines
drivers/net/intel/iavf/iavf_ethdev.c +5 -0
+	/* Re-push insertion, and stripping if already enabled, so the new
+	 * outer TPID reaches the PF instead of only being cached here.
+	 */
+	iavf_dev_vlan_insert_set(dev);
+	if (dev_conf->rxmode.offloads &

RTE_ETH_RX_OFFLOAD_QINQ_STRIP)

drivers/net/intel/iavf/iavf_ethdev.c +1 -0
+		iavf_dev_vlan_offload_set(dev,

RTE_ETH_QINQ_STRIP_MASK);

Should we check the return value of this call and fail if an error is reported?

Quoted 1 line

Probably yes, will do in next revision.

For some reason this patch in the v2 series didn't land in my inbox. I reviewed it on patchwork and it looks good to me. Consider this my Ack for that patch:

Quoted 2 lines

/Bruce

#9 lore raw

PATCH 4/7 net/intel: fix unclear enum names

In reply to Bruce Richardson

The enum for VLAN tag placement was badly named, and it's purpose as described in the comments was unclear. Update the names to be clearer, and more general for future uses and remove the incorrect comments.

Fixes 6ea6d67bebfe ("net/intel: support configurable VLAN insertion on Tx")
---
 drivers/net/intel/common/tx.h             | 14 ++++++--------
 drivers/net/intel/common/tx_scalar.h      |  6 +++---
 drivers/net/intel/i40e/i40e_rxtx.c        |  2 +-
 drivers/net/intel/iavf/iavf_rxtx.c        |  2 +-
 drivers/net/intel/ice/ice_rxtx.c          |  5 +++--
 drivers/net/intel/idpf/idpf_common_rxtx.c |  2 +-
 6 files changed, 15 insertions(+), 16 deletions(-)
drivers/net/intel/common/tx.h +6 -8
index 55757d34d7..2d4a8b5d3c 100644
@@ -46,20 +46,18 @@
 #define CI_TX_CTX_DESC_IL2TAG2          0x04
 
 /**
- * L2TAG1 Field Source Selection
- * Specifies which mbuf VLAN field to use for the L2TAG1 field in data descriptors.
- * Context descriptor VLAN handling (L2TAG2) is managed by driver-specific callbacks.
+ * Enum to specify where a VLAN tag is to be placed for packet Tx.
  */
-enum ci_tx_l2tag1_field {
-	/** For VLAN (not QinQ), use L2Tag1 field in data desc */
-	CI_VLAN_IN_L2TAG1,
+enum ci_l2tag_pos {
+	/** Insert via the data descriptor's L2Tag1 field. */
+	CI_TAG_IN_DATA_DESC,
 
-	/** For VLAN (not QinQ), use L2Tag2 field in ctx desc.
+	/** Insert via the context descriptor's L2Tag2 field.
 	 * NOTE: When set, drivers must set the VLAN tag in the context
 	 * descriptor callback function, rather than relying on the
 	 * common Tx code to insert it.
 	 */
-	CI_VLAN_IN_L2TAG2,
+	CI_TAG_IN_CTX_DESC,
 };
 
 /* Common TX Descriptor Length Field Shifts */
drivers/net/intel/common/tx_scalar.h +3 -3
index 11ab6c08fc..4df279e729 100644
@@ -372,7 +372,7 @@ static inline uint16_t
 ci_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts,
-	     enum ci_tx_l2tag1_field l2tag1_field,
+	     enum ci_l2tag_pos l2tag_pos,
 	     ci_get_ctx_desc_fn get_ctx_desc,
 	     const struct ci_ipsec_ops *ipsec_ops,
 	     const struct ci_timestamp_queue_fns *ts_fns)
@@ -480,10 +480,10 @@ ci_xmit_pkts(struct ci_tx_queue *txq,
 		}
 
 		/* Descriptor based VLAN/QinQ insertion */
-		/* for single vlan offload, only insert in data desc with VLAN_IN_L2TAG1 is set
+		/* for single vlan offload, only insert in data desc when CI_TAG_IN_DATA_DESC is set
 		 * for qinq offload, we always put inner tag in L2Tag1
 		 */
-		if (((ol_flags & RTE_MBUF_F_TX_VLAN) && l2tag1_field == CI_VLAN_IN_L2TAG1) ||
+		if (((ol_flags & RTE_MBUF_F_TX_VLAN) && l2tag_pos == CI_TAG_IN_DATA_DESC) ||
 				(ol_flags & RTE_MBUF_F_TX_QINQ)) {
 			td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
 			td_tag = tx_pkt->vlan_tci;
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
index e29fcff661..ef7041cebd 100644
@@ -1007,7 +1007,7 @@ uint16_t
 i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	/* i40e does not support IPsec or timestamp queues, so pass NULL for both */
-	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_VLAN_IN_L2TAG1,
+	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
 			get_context_desc, NULL, NULL);
 }
 
drivers/net/intel/iavf/iavf_rxtx.c +1 -1
index 39bcbebf56..1354e2d6d6 100644
@@ -2605,7 +2605,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	/* IAVF does not support timestamp queues, so pass NULL for ts_fns */
 	return ci_xmit_pkts(txq, tx_pkts, nb_pkts,
 			    (txq->vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1) ?
-				CI_VLAN_IN_L2TAG1 : CI_VLAN_IN_L2TAG2,
+				CI_TAG_IN_DATA_DESC : CI_TAG_IN_CTX_DESC,
 			    iavf_get_context_desc, &ipsec_ops, NULL);
 }
 
drivers/net/intel/ice/ice_rxtx.c +3 -2
index c4b5454c53..22d1d5d602 100644
@@ -3125,10 +3125,11 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
 
 	if (txq->tsq != NULL && txq->tsq->ts_flag > 0)
-		return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_VLAN_IN_L2TAG1,
+		return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
 				get_context_desc, NULL, &ts_fns);
 
-	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_VLAN_IN_L2TAG1, get_context_desc, NULL, NULL);
+	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
+			get_context_desc, NULL, NULL);
 }
 
 static int
drivers/net/intel/idpf/idpf_common_rxtx.c +1 -1
index 2c87e02c98..128ebb6a88 100644
@@ -1415,7 +1415,7 @@ uint16_t
 idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
-	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_VLAN_IN_L2TAG1,
+	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
 			idpf_get_context_desc, NULL, NULL);
 }
 

--
2.53.0

Acked-by on v1 4/7
#10 lore raw

RE: [PATCH 4/7] net/intel: fix unclear enum names

Quoted 10 lines

Subject: [PATCH 4/7] net/intel: fix unclear enum names

The enum for VLAN tag placement was badly named, and it's purpose as described in the comments was unclear. Update the names to be clearer, and more general for future uses and remove the incorrect comments.

Fixes 6ea6d67bebfe ("net/intel: support configurable VLAN insertion on Tx")
Quoted 9 lines
---
 drivers/net/intel/common/tx.h             | 14 ++++++--------
 drivers/net/intel/common/tx_scalar.h      |  6 +++---
 drivers/net/intel/i40e/i40e_rxtx.c        |  2 +-
 drivers/net/intel/iavf/iavf_rxtx.c        |  2 +-
 drivers/net/intel/ice/ice_rxtx.c          |  5 +++--
 drivers/net/intel/idpf/idpf_common_rxtx.c |  2 +-
 6 files changed, 15 insertions(+), 16 deletions(-)
#11 lore raw

PATCH 5/7 net/intel: fix VLAN and QinQ tag position logic

In reply to Bruce Richardson

The position of a single vlan tag on a Tx packet (data desc or ctx desc) is independent across drivers from that of where the outer QinQ tag gets put. Therefore, these should be passed as separate values to the common scalar Tx function. For i40e, ice and idpf, the single tag can be put in the data descriptor, and for QinQ, the context descriptor contains the outer tag. For iavf, the tag positions depend on the capabilities reported by the PF to the VF, but the position for the single vlan tag and the outer QinQ tags are the same.

Fixes 6ea6d67bebfe ("net/intel: support configurable VLAN insertion on Tx")
---
 drivers/net/intel/common/tx_scalar.h      | 16 +++++++++++-----
 drivers/net/intel/i40e/i40e_rxtx.c        |  6 ++++--
 drivers/net/intel/iavf/iavf_rxtx.c        |  7 ++++---
 drivers/net/intel/ice/ice_rxtx.c          |  5 +++--
 drivers/net/intel/idpf/idpf_common_rxtx.c |  3 ++-
 5 files changed, 24 insertions(+), 13 deletions(-)
drivers/net/intel/common/tx_scalar.h +11 -5
index 4df279e729..7368d3abc9 100644
@@ -372,7 +372,8 @@ static inline uint16_t
 ci_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts,
-	     enum ci_l2tag_pos l2tag_pos,
+	     enum ci_l2tag_pos single_vlan_pos,
+	     enum ci_l2tag_pos qinq_outer_pos,
 	     ci_get_ctx_desc_fn get_ctx_desc,
 	     const struct ci_ipsec_ops *ipsec_ops,
 	     const struct ci_timestamp_queue_fns *ts_fns)
@@ -480,13 +481,18 @@ ci_xmit_pkts(struct ci_tx_queue *txq,
 		}
 
 		/* Descriptor based VLAN/QinQ insertion */
-		/* for single vlan offload, only insert in data desc when CI_TAG_IN_DATA_DESC is set
-		 * for qinq offload, we always put inner tag in L2Tag1
+		/* for single vlan offload, only insert in data desc when single_vlan_pos is
+		 * CI_TAG_IN_DATA_DESC; for qinq offload, L2Tag1 always carries a tag, either
+		 * the outer (qinq_outer_pos == CI_TAG_IN_DATA_DESC) or otherwise the inner
 		 */
-		if (((ol_flags & RTE_MBUF_F_TX_VLAN) && l2tag_pos == CI_TAG_IN_DATA_DESC) ||
+		if (((ol_flags & RTE_MBUF_F_TX_VLAN) && single_vlan_pos == CI_TAG_IN_DATA_DESC) ||
 				(ol_flags & RTE_MBUF_F_TX_QINQ)) {
 			td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
-			td_tag = tx_pkt->vlan_tci;
+			if ((ol_flags & RTE_MBUF_F_TX_QINQ) &&
+					qinq_outer_pos == CI_TAG_IN_DATA_DESC)
+				td_tag = tx_pkt->vlan_tci_outer;
+			else
+				td_tag = tx_pkt->vlan_tci;
 		}
 
 		/* Enable checksum offloading */
drivers/net/intel/i40e/i40e_rxtx.c +4 -2
index ef7041cebd..e2fffdb70a 100644
@@ -1006,8 +1006,10 @@ get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,
 uint16_t
 i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
-	/* i40e does not support IPsec or timestamp queues, so pass NULL for both */
-	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
+	/* i40e does not support IPsec or timestamp queues, so pass NULL for both.
+	 * QinQ always places the outer tag in the ctx desc, inner in the data desc.
+	 */
+	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC, CI_TAG_IN_CTX_DESC,
 			get_context_desc, NULL, NULL);
 }
 
drivers/net/intel/iavf/iavf_rxtx.c +4 -3
index 1354e2d6d6..80c9912ccc 100644
@@ -2596,6 +2596,9 @@ uint16_t
 iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = tx_queue;
+	/* vlan_flag gives both the single-VLAN and the QinQ outer tag position */
+	enum ci_l2tag_pos vlan_pos = (txq->vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1) ?
+			CI_TAG_IN_DATA_DESC : CI_TAG_IN_CTX_DESC;
 
 	const struct ci_ipsec_ops ipsec_ops = {
 		.get_ipsec_desc = iavf_get_ipsec_desc,
@@ -2603,9 +2606,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	};
 
 	/* IAVF does not support timestamp queues, so pass NULL for ts_fns */
-	return ci_xmit_pkts(txq, tx_pkts, nb_pkts,
-			    (txq->vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1) ?
-				CI_TAG_IN_DATA_DESC : CI_TAG_IN_CTX_DESC,
+	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, vlan_pos, vlan_pos,
 			    iavf_get_context_desc, &ipsec_ops, NULL);
 }
 
drivers/net/intel/ice/ice_rxtx.c +3 -2
index 22d1d5d602..3569ffcf82 100644
@@ -3125,10 +3125,11 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
 
 	if (txq->tsq != NULL && txq->tsq->ts_flag > 0)
-		return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
+		return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC, CI_TAG_IN_CTX_DESC,
 				get_context_desc, NULL, &ts_fns);
 
-	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
+	/* QinQ always places the outer tag in the ctx desc, inner in the data desc. */
+	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC, CI_TAG_IN_CTX_DESC,
 			get_context_desc, NULL, NULL);
 }
 
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -1
index 128ebb6a88..649b5d1f99 100644
@@ -1415,7 +1415,8 @@ uint16_t
 idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
-	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
+	/* QinQ always places the outer tag in the ctx desc, inner in the data desc. */
+	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC, CI_TAG_IN_CTX_DESC,
 			idpf_get_context_desc, NULL, NULL);
 }
 

--
2.53.0

Acked-by on v1 5/7
#12 lore raw

RE: [PATCH 5/7] net/intel: fix VLAN and QinQ tag position logic

Quoted 11 lines

Subject: [PATCH 5/7] net/intel: fix VLAN and QinQ tag position logic

The position of a single vlan tag on a Tx packet (data desc or ctx desc) is independent across drivers from that of where the outer QinQ tag gets put. Therefore, these should be passed as separate values to the common scalar Tx function. For i40e, ice and idpf, the single tag can be put in the data descriptor, and for QinQ, the context descriptor contains the outer tag. For iavf, the tag positions depend on the capabilities reported by the PF to the VF, but the position for the single vlan tag and the outer QinQ tags are the same.

Quoted 4 lines
Fixes 6ea6d67bebfe ("net/intel: support configurable VLAN insertion on Tx")
Quoted 8 lines
---
 drivers/net/intel/common/tx_scalar.h      | 16 +++++++++++-----
 drivers/net/intel/i40e/i40e_rxtx.c        |  6 ++++--
 drivers/net/intel/iavf/iavf_rxtx.c        |  7 ++++---
 drivers/net/intel/ice/ice_rxtx.c          |  5 +++--
 drivers/net/intel/idpf/idpf_common_rxtx.c |  3 ++-
 5 files changed, 24 insertions(+), 13 deletions(-)
#13 lore raw

PATCH 6/7 net/iavf: fix missing outer QinQ tag for tunnelled packets

In reply to Bruce Richardson

When the QinQ feature was enabled along with tunnelling support, the tunnel options were written directly to the context descriptor quad-word rather than being merged in. This leads to any QinQ tag in the context descriptor getting overwritten.

Change order of operations so that the tunnel options go first and the QinQ tags are merged into that.

Fixes 4f8259df563a ("net/iavf: enable Tx outer checksum offload on AVX512")
Fixes 70baceadabf2 ("net/iavf: fix AVX512 Tx")
---
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   | 6 ++++--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +4 -2
index 715805c65a..d05e6101ad 100644
@@ -1969,6 +1969,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 
 #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
+			/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */
+			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw1, pkt[1]);
 			if (pkt[1]->ol_flags & RTE_MBUF_F_TX_QINQ) {
 				uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 					(uint64_t)pkt[1]->vlan_tci_outer :
@@ -1990,6 +1992,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 
 #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
+			/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */
+			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw0, pkt[0]);
 			if (pkt[0]->ol_flags & RTE_MBUF_F_TX_QINQ) {
 				uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 					(uint64_t)pkt[0]->vlan_tci_outer :
@@ -2012,8 +2016,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 		if (offload) {
 			iavf_txd_enable_offload(pkt[1], &hi_data_qw1, vlan_flag);
 			iavf_txd_enable_offload(pkt[0], &hi_data_qw0, vlan_flag);
-			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw1, pkt[1]);
-			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw0, pkt[0]);
 		}
 
 		__m256i desc2_3 =
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +4 -2
index dfbbea80f7..bae9b2af9c 100644
@@ -2111,6 +2111,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 
 #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
+			/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */
+			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw1, pkt[1]);
 			if (pkt[1]->ol_flags & RTE_MBUF_F_TX_QINQ) {
 				uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 					(uint64_t)pkt[1]->vlan_tci_outer :
@@ -2131,6 +2133,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 
 #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
+			/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */
+			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw0, pkt[0]);
 			if (pkt[0]->ol_flags & RTE_MBUF_F_TX_QINQ) {
 				uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 					(uint64_t)pkt[0]->vlan_tci_outer :
@@ -2151,8 +2155,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 		if (offload) {
 			iavf_txd_enable_offload(pkt[1], &hi_data_qw1, vlan_flag);
 			iavf_txd_enable_offload(pkt[0], &hi_data_qw0, vlan_flag);
-			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw1, pkt[1]);
-			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw0, pkt[0]);
 		}
 
 		__m512i desc0_3 =

--
2.53.0

Acked-by on v1 6/7
#14 lore raw

RE: [PATCH 6/7] net/iavf: fix missing outer QinQ tag for tunnelled packets

Quoted 10 lines

Subject: [PATCH 6/7] net/iavf: fix missing outer QinQ tag for tunnelled packets

When the QinQ feature was enabled along with tunnelling support, the tunnel options were written directly to the context descriptor quad-word rather than being merged in. This leads to any QinQ tag in the context descriptor getting overwritten.

Change order of operations so that the tunnel options go first and the QinQ tags are merged into that.

Quoted 6 lines
Fixes 4f8259df563a ("net/iavf: enable Tx outer checksum offload on

AVX512")

Fixes 70baceadabf2 ("net/iavf: fix AVX512 Tx")
Quoted 5 lines
---
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   | 6 ++++--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
#15 lore raw

PATCH 7/7 net/iavf: remove undocumented conditional macros

In reply to Bruce Richardson

The iavf driver included two #defines which enabled the QinQ and checksum offload in the code. The intent as documented in code comments was that any user not taking advantage of these features could remove the #defines to cut out some code. However, this was never actually publicly documented, and the use of these defines was never tested in any builds, making them fragile - if not already broken. Therefore, just remove these build time macros.

---
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  6 ------
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c |  6 ------
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 18 ------------------
 3 files changed, 30 deletions(-)
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +0 -6
index d05e6101ad..7217f32cef 100644
@@ -1910,7 +1910,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,
 
 	if (offload) {
 		iavf_fill_ctx_desc_tunneling_avx2(&low_ctx_qw, pkt);
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (pkt->ol_flags & RTE_MBUF_F_TX_QINQ) {
 			uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 				(uint64_t)pkt->vlan_tci_outer :
@@ -1922,7 +1921,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,
 			high_ctx_qw |= IAVF_TX_CTX_DESC_IL2TAG2 << IAVF_TXD_CTX_QW1_CMD_SHIFT;
 			low_ctx_qw |= (uint64_t)pkt->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 		}
-#endif
 	}
 	if (IAVF_CHECK_TX_LLDP(pkt, ptype_lldp_enabled))
 		high_ctx_qw |= IAVF_TX_CTX_DESC_SWTCH_UPLINK << IAVF_TXD_CTX_QW1_CMD_SHIFT;
@@ -1967,7 +1965,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 				((uint64_t)pkt[0]->data_len <<
 					IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
 
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
 			/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */
 			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw1, pkt[1]);
@@ -1986,11 +1983,9 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 					(uint64_t)pkt[1]->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 			}
 		}
-#endif
 		if (IAVF_CHECK_TX_LLDP(pkt[1], ptype_lldp_enabled))
 			hi_ctx_qw1 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK << IAVF_TXD_CTX_QW1_CMD_SHIFT;
 
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
 			/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */
 			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw0, pkt[0]);
@@ -2009,7 +2004,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 					(uint64_t)pkt[0]->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 			}
 		}
-#endif
 		if (IAVF_CHECK_TX_LLDP(pkt[0], ptype_lldp_enabled))
 			hi_ctx_qw0 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK << IAVF_TXD_CTX_QW1_CMD_SHIFT;
 
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -6
index bae9b2af9c..bf0245e8f4 100644
@@ -2054,7 +2054,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,
 
 	if (offload) {
 		iavf_fill_ctx_desc_tunneling_avx512(&low_ctx_qw, pkt);
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (pkt->ol_flags & RTE_MBUF_F_TX_QINQ) {
 			uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 				(uint64_t)pkt->vlan_tci_outer :
@@ -2066,7 +2065,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,
 			high_ctx_qw |= IAVF_TX_CTX_DESC_IL2TAG2 << IAVF_TXD_CTX_QW1_CMD_SHIFT;
 			low_ctx_qw |= (uint64_t)pkt->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 		}
-#endif
 	}
 	if (IAVF_CHECK_TX_LLDP(pkt, lldp_enabled))
 		high_ctx_qw |= IAVF_TX_CTX_DESC_SWTCH_UPLINK
@@ -2109,7 +2107,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 		hi_data_qw0 = hi_data_qw_tmpl |
 				((uint64_t)pkt[0]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
 			/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */
 			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw1, pkt[1]);
@@ -2126,12 +2123,10 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 					(uint64_t)pkt[1]->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 			}
 		}
-#endif
 		if (IAVF_CHECK_TX_LLDP(pkt[1], lldp_enabled))
 			hi_ctx_qw1 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK
 				<< CI_TXD_QW1_CMD_S;
 
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
 			/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */
 			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw0, pkt[0]);
@@ -2148,7 +2143,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 					(uint64_t)pkt[0]->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 			}
 		}
-#endif
 		if (IAVF_CHECK_TX_LLDP(pkt[0], lldp_enabled))
 			hi_ctx_qw0 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK << CI_TXD_QW1_CMD_S;
 
drivers/net/intel/iavf/iavf_rxtx_vec_common.h +0 -18
index 1538a44892..1e9ce924ee 100644
@@ -119,31 +119,16 @@ iavf_tx_vec_dev_check_default(struct rte_eth_dev *dev)
 	return ret;
 }
 
-/******************************************************************************
- * If user knows a specific offload is not enabled by APP,
- * the macro can be commented to save the effort of fast path.
- * Currently below 2 features are supported in TX path,
- * 1, checksum offload
- * 2, VLAN/QINQ insertion
- ******************************************************************************/
-#define IAVF_TX_CSUM_OFFLOAD
-#define IAVF_TX_VLAN_QINQ_OFFLOAD
-
 static __rte_always_inline void
 iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
 			uint64_t *txd_hi, uint8_t vlan_flag)
 {
-#if defined(IAVF_TX_CSUM_OFFLOAD) || defined(IAVF_TX_VLAN_QINQ_OFFLOAD)
 	uint64_t ol_flags = tx_pkt->ol_flags;
-#endif
 	uint32_t td_cmd = 0;
-#ifdef IAVF_TX_CSUM_OFFLOAD
 	uint32_t td_offset = 0;
-#endif
 
 	RTE_SET_USED(vlan_flag);
 
-#ifdef IAVF_TX_CSUM_OFFLOAD
 	/* Set MACLEN */
 	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
 		td_offset |= (tx_pkt->outer_l2_len >> 1)
@@ -191,9 +176,7 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
 	}
 
 	*txd_hi |= ((uint64_t)td_offset) << CI_TXD_QW1_OFFSET_S;
-#endif
 
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 	if (ol_flags & RTE_MBUF_F_TX_QINQ) {
 		td_cmd |= IAVF_TX_DESC_CMD_IL2TAG1;
 		/* vlan_flag specifies outer tag location for QinQ. */
@@ -205,7 +188,6 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
 		td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
 		*txd_hi |= ((uint64_t)tx_pkt->vlan_tci << CI_TXD_QW1_L2TAG1_S);
 	}
-#endif
 
 	*txd_hi |= ((uint64_t)td_cmd) << CI_TXD_QW1_CMD_S;
 }

--
2.53.0

#16 lore raw

Re: [PATCH 7/7] net/iavf: remove undocumented conditional macros

Quoted 10 lines · Bruce Richardson

The iavf driver included two #defines which enabled the QinQ and checksum offload in the code. The intent as documented in code comments was that any user not taking advantage of these features could remove the #defines to cut out some code. However, this was never actually publicly documented, and the use of these defines was never tested in any builds, making them fragile - if not already broken. Therefore, just remove these build time macros.

Though unrelated to current series, were the AVX512 knobs tested?

#define IAVF_RX_CSUM_OFFLOAD
#define IAVF_RX_VLAN_OFFLOAD
#define IAVF_RX_RSS_OFFLOAD
#define IAVF_RX_PTYPE_OFFLOAD
#define IAVF_RX_FDIR_OFFLOAD
#define IAVF_RX_TS_OFFLOAD

Signature · 1 line
David Marchand
#17 lore raw

Re: [PATCH 7/7] net/iavf: remove undocumented conditional macros

Quoted 13 lines · David Marchand
Quoted 10 lines · Bruce Richardson

The iavf driver included two #defines which enabled the QinQ and checksum offload in the code. The intent as documented in code comments was that any user not taking advantage of these features could remove the #defines to cut out some code. However, this was never actually publicly documented, and the use of these defines was never tested in any builds, making them fragile - if not already broken. Therefore, just remove these build time macros.

Quoted 9 lines

Though unrelated to current series, were the AVX512 knobs tested?

#define IAVF_RX_CSUM_OFFLOAD
#define IAVF_RX_VLAN_OFFLOAD
#define IAVF_RX_RSS_OFFLOAD
#define IAVF_RX_PTYPE_OFFLOAD
#define IAVF_RX_FDIR_OFFLOAD
#define IAVF_RX_TS_OFFLOAD

I don't know, I didn't look at those. I came across the other two when looking at the Tx side (mainly AVX2)

/Bruce

Acked-by on v1 7/7
#18 lore raw

RE: [PATCH 7/7] net/iavf: remove undocumented conditional macros

In reply to Bruce Richardson
Quoted 11 lines

Subject: [PATCH 7/7] net/iavf: remove undocumented conditional macros

The iavf driver included two #defines which enabled the QinQ and checksum offload in the code. The intent as documented in code comments was that any user not taking advantage of these features could remove the #defines to cut out some code. However, this was never actually publicly documented, and the use of these defines was never tested in any builds, making them fragile - if not already broken. Therefore, just remove these build time macros.

Quoted 6 lines
---
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  6 ------
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c |  6 ------
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 18 ------------------
 3 files changed, 30 deletions(-)
#19 lore raw

v2 cover VLAN and QinQ fixes for iavf

In reply to Bruce Richardson

This patchset contains a number of small fixes for iavf VLAN tag handling. Most issues were discovered by AI code review rather than being found in testing.

v2:
* add error checking to patch 3

Bruce Richardson (7):
net/iavf: disable broken QinQ strip on Rx net/iavf: fix VLAN tag placement logic
net/iavf: fix VLAN outer TPID setting on Tx net/intel: fix unclear enum names
net/intel: fix VLAN and QinQ tag position logic net/iavf: fix missing outer QinQ tag for tunnelled packets net/iavf: remove undocumented conditional macros

 drivers/net/intel/common/tx.h                 | 14 ++---
 drivers/net/intel/common/tx_scalar.h          | 16 ++++--
 drivers/net/intel/i40e/i40e_rxtx.c            |  6 +-
 drivers/net/intel/iavf/iavf_ethdev.c          | 15 +++--
 drivers/net/intel/iavf/iavf_rxtx.c            | 56 +++++++++----------
 drivers/net/intel/iavf/iavf_rxtx.h            |  4 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   | 12 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 12 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 18 ------
 drivers/net/intel/ice/ice_rxtx.c              |  6 +-
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  3 +-
 11 files changed, 77 insertions(+), 85 deletions(-)
Signature · 1 line
2.53.0
#20 lore raw

PATCH v2 1/7 net/iavf: disable broken QinQ strip on Rx

When 2 VLANs are stripped from a packet, the iavf driver vector path fails to handle them properly as it 'or's the two values together on the assumption that only one is valid. Explicitly list the VLAN related features supported by the vector path, rather than using the "OFFLOAD_VLAN" group, thereby disabling advertising of QinQ stripping so that a scalar path is used.

Fixes 1e728b01120c ("net/iavf: rework Tx path")
---
 drivers/net/intel/iavf/iavf_rxtx.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/intel/iavf/iavf_rxtx.h +3 -1
index 6f53d5805a..3ff49b94b4 100644
@@ -105,7 +105,9 @@
 		IAVF_RX_VECTOR_OFFLOADS |		\
 		RTE_ETH_RX_OFFLOAD_CHECKSUM |		\
 		RTE_ETH_RX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_RX_OFFLOAD_VLAN |		\
+		RTE_ETH_RX_OFFLOAD_VLAN_STRIP |		\
+		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |	\
+		RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |	\
 		RTE_ETH_RX_OFFLOAD_RSS_HASH)
 /* vector offload paths that use the flex rx desc */
 #define IAVF_RX_VECTOR_OFFLOAD_FLEX_OFFLOADS (		\
Signature · 1 line
2.53.0
#21 lore raw

PATCH v2 2/7 net/iavf: fix VLAN tag placement logic

In reply to Bruce Richardson

Depending on what is reported by the PF to the VF the VLAN tag or VLAN + QinQ tags can be in either the L2Tag1 or the L2Tag2 fields. This needs to be taken into account when reading the vlan tags from the flex descriptors, rather than assuming that the tag is always present in a fixed location.

Fixes 1e728b01120c ("net/iavf: rework Tx path")
---
 drivers/net/intel/iavf/iavf_rxtx.c | 49 +++++++++++++++---------------
 1 file changed, 24 insertions(+), 25 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +24 -25
index d65a518f8e..39bcbebf56 100644
@@ -1151,33 +1151,32 @@ iavf_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union ci_rx_desc *rxdp)
 
 static inline void
 iavf_flex_rxd_to_vlan_tci(struct rte_mbuf *mb,
-			  volatile union ci_rx_flex_desc *rxdp)
+			  volatile union ci_rx_flex_desc *rxdp,
+			  uint8_t rx_flags)
 {
-	if (rte_le_to_cpu_64(rxdp->wb.status_error0) &
-		(1 << IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S)) {
-		mb->ol_flags |= RTE_MBUF_F_RX_VLAN |
-				RTE_MBUF_F_RX_VLAN_STRIPPED;
-		mb->vlan_tci =
-			rte_le_to_cpu_16(rxdp->wb.l2tag1);
-	} else {
-		mb->vlan_tci = 0;
-	}
-
-	if (rte_le_to_cpu_16(rxdp->wb.status_error1) &
-	    (1 << IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S)) {
-		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;
+	bool l2tag1_valid = rte_le_to_cpu_16(rxdp->wb.status_error0) &
+			(1 << IAVF_RX_FLEX_DESC_STATUS0_L2TAG1P_S);
+	bool l2tag2_valid = rte_le_to_cpu_16(rxdp->wb.status_error1) &
+			(1 << IAVF_RX_FLEX_DESC_STATUS1_L2TAG2P_S);
+	if (l2tag1_valid && l2tag2_valid) {
+		mb->ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED |
+				RTE_MBUF_F_RX_QINQ | RTE_MBUF_F_RX_QINQ_STRIPPED;
+		/* with both tags, the rx_flags say which is outer vs inner */
+		if (rx_flags & IAVF_RX_FLAGS_VLAN_TAG_LOC_L2TAG2_2) {
+			mb->vlan_tci_outer = rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd);
+			mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.l2tag1);
 		} 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_outer = rte_le_to_cpu_16(rxdp->wb.l2tag1);
+			mb->vlan_tci = rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd);
 		}
-		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),
-			   rte_le_to_cpu_16(rxdp->wb.l2tag2_2nd));
+	} else if (l2tag1_valid || l2tag2_valid) {
+		mb->ol_flags |= RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED;
+		mb->vlan_tci_outer = 0;
+		mb->vlan_tci = rte_le_to_cpu_16(
+				l2tag1_valid ? rxdp->wb.l2tag1 : rxdp->wb.l2tag2_2nd);
 	} else {
 		mb->vlan_tci_outer = 0;
+		mb->vlan_tci = 0;
 	}
 }
 
@@ -1564,7 +1563,7 @@ iavf_recv_pkts_flex_rxd(void *rx_queue,
 		rxm->ol_flags = 0;
 		rxm->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &
 			rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
-		iavf_flex_rxd_to_vlan_tci(rxm, &rxd);
+		iavf_flex_rxd_to_vlan_tci(rxm, &rxd, rxq->rx_flags);
 		iavf_flex_rxd_to_ipsec_crypto_status(rxm, &rxd,
 				&rxq->stats->ipsec_crypto);
 		rxd_to_pkt_fields_ops[rxq->rxdid](rxq, rxm, &rxd);
@@ -1731,7 +1730,7 @@ iavf_recv_scattered_pkts_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts,
 		first_seg->ol_flags = 0;
 		first_seg->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &
 			rte_le_to_cpu_16(rxd.wb.ptype_flex_flags0)];
-		iavf_flex_rxd_to_vlan_tci(first_seg, &rxd);
+		iavf_flex_rxd_to_vlan_tci(first_seg, &rxd, rxq->rx_flags);
 		iavf_flex_rxd_to_ipsec_crypto_status(first_seg, &rxd,
 				&rxq->stats->ipsec_crypto);
 		rxd_to_pkt_fields_ops[rxq->rxdid](rxq, first_seg, &rxd);
@@ -2013,7 +2012,7 @@ iavf_rx_scan_hw_ring_flex_rxd(struct ci_rx_queue *rxq,
 
 			mb->packet_type = ptype_tbl[IAVF_RX_FLEX_DESC_PTYPE_M &
 				rte_le_to_cpu_16(rxdp[j].wb.ptype_flex_flags0)];
-			iavf_flex_rxd_to_vlan_tci(mb, &rxdp[j]);
+			iavf_flex_rxd_to_vlan_tci(mb, &rxdp[j], rxq->rx_flags);
 			iavf_flex_rxd_to_ipsec_crypto_status(mb, &rxdp[j],
 				&rxq->stats->ipsec_crypto);
 			rxd_to_pkt_fields_ops[rxq->rxdid](rxq, mb, &rxdp[j]);
Signature · 1 line
2.53.0
#22 lore raw

PATCH v2 3/7 net/iavf: fix VLAN outer TPID setting on Tx

In reply to Bruce Richardson

The outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.

Fixes 8599d7604e0a ("net/iavf: support QinQ strip")
Fixes 7ce1363b424f ("net/iavf: support QinQ insertion")
---
 drivers/net/intel/iavf/iavf_ethdev.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +11 -4
index c4a6763f28..2ac4dbdac4 100644
@@ -1461,13 +1461,20 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type, uint16
 		return -ENOTSUP;
 	}
 
-	/* This API only fills internal iavf_adapter structure
-	 * and does not send any signal to hardware.
-	 * Inner VLAN always 0x8100, so not set explicitly.
-	 */
+	/* Inner VLAN always 0x8100, so not set explicitly. */
 	if (qinq && vlan_type == RTE_ETH_VLAN_TYPE_OUTER)
 		adapter->tpid = tpid; /* Outer VLAN can be 0x88a8 or 0x8100 */
 
+	/* Re-push insertion, and stripping if already enabled, so the new
+	 * outer TPID reaches the PF instead of only being cached here.
+	 */
+	iavf_dev_vlan_insert_set(dev);
+	if (dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_QINQ_STRIP) {
+		int ret = iavf_dev_vlan_offload_set(dev, RTE_ETH_QINQ_STRIP_MASK);
+		if (ret != 0)
+			return ret;
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.53.0
author Acked-by Ciara Loftus on v2 3/7
#23 lore raw

Re: [PATCH v2 3/7] net/iavf: fix VLAN outer TPID setting on Tx

Quoted 4 lines · Bruce Richardson

The outer VLAN TPID setting for Tx was cached in the driver but was not properly pushed to hardware (via PF) when changed. Add the necessary push call to the update function.

Quoted 9 lines
Fixes 8599d7604e0a ("net/iavf: support QinQ strip")
Fixes 7ce1363b424f ("net/iavf: support QinQ insertion")
---
 drivers/net/intel/iavf/iavf_ethdev.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Adding ack from v1:

Quoted 32 lines
drivers/net/intel/iavf/iavf_ethdev.c +11 -4
index c4a6763f28..2ac4dbdac4 100644
@@ -1461,13 +1461,20 @@ iavf_vlan_tpid_set(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type, uint16
 		return -ENOTSUP;
 	}
 
-	/* This API only fills internal iavf_adapter structure
-	 * and does not send any signal to hardware.
-	 * Inner VLAN always 0x8100, so not set explicitly.
-	 */
+	/* Inner VLAN always 0x8100, so not set explicitly. */
 	if (qinq && vlan_type == RTE_ETH_VLAN_TYPE_OUTER)
 		adapter->tpid = tpid; /* Outer VLAN can be 0x88a8 or 0x8100 */
 
+	/* Re-push insertion, and stripping if already enabled, so the new
+	 * outer TPID reaches the PF instead of only being cached here.
+	 */
+	iavf_dev_vlan_insert_set(dev);
+	if (dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_QINQ_STRIP) {
+		int ret = iavf_dev_vlan_offload_set(dev, RTE_ETH_QINQ_STRIP_MASK);
+		if (ret != 0)
+			return ret;
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.53.0
#24 lore raw

PATCH v2 4/7 net/intel: fix unclear enum names

In reply to Bruce Richardson

The enum for VLAN tag placement was badly named, and it's purpose as described in the comments was unclear. Update the names to be clearer, and more general for future uses and remove the incorrect comments.

Fixes 6ea6d67bebfe ("net/intel: support configurable VLAN insertion on Tx")
---
 drivers/net/intel/common/tx.h             | 14 ++++++--------
 drivers/net/intel/common/tx_scalar.h      |  6 +++---
 drivers/net/intel/i40e/i40e_rxtx.c        |  2 +-
 drivers/net/intel/iavf/iavf_rxtx.c        |  2 +-
 drivers/net/intel/ice/ice_rxtx.c          |  5 +++--
 drivers/net/intel/idpf/idpf_common_rxtx.c |  2 +-
 6 files changed, 15 insertions(+), 16 deletions(-)
drivers/net/intel/common/tx.h +6 -8
index 55757d34d7..2d4a8b5d3c 100644
@@ -46,20 +46,18 @@
 #define CI_TX_CTX_DESC_IL2TAG2          0x04
 
 /**
- * L2TAG1 Field Source Selection
- * Specifies which mbuf VLAN field to use for the L2TAG1 field in data descriptors.
- * Context descriptor VLAN handling (L2TAG2) is managed by driver-specific callbacks.
+ * Enum to specify where a VLAN tag is to be placed for packet Tx.
  */
-enum ci_tx_l2tag1_field {
-	/** For VLAN (not QinQ), use L2Tag1 field in data desc */
-	CI_VLAN_IN_L2TAG1,
+enum ci_l2tag_pos {
+	/** Insert via the data descriptor's L2Tag1 field. */
+	CI_TAG_IN_DATA_DESC,
 
-	/** For VLAN (not QinQ), use L2Tag2 field in ctx desc.
+	/** Insert via the context descriptor's L2Tag2 field.
 	 * NOTE: When set, drivers must set the VLAN tag in the context
 	 * descriptor callback function, rather than relying on the
 	 * common Tx code to insert it.
 	 */
-	CI_VLAN_IN_L2TAG2,
+	CI_TAG_IN_CTX_DESC,
 };
 
 /* Common TX Descriptor Length Field Shifts */
drivers/net/intel/common/tx_scalar.h +3 -3
index 11ab6c08fc..4df279e729 100644
@@ -372,7 +372,7 @@ static inline uint16_t
 ci_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts,
-	     enum ci_tx_l2tag1_field l2tag1_field,
+	     enum ci_l2tag_pos l2tag_pos,
 	     ci_get_ctx_desc_fn get_ctx_desc,
 	     const struct ci_ipsec_ops *ipsec_ops,
 	     const struct ci_timestamp_queue_fns *ts_fns)
@@ -480,10 +480,10 @@ ci_xmit_pkts(struct ci_tx_queue *txq,
 		}
 
 		/* Descriptor based VLAN/QinQ insertion */
-		/* for single vlan offload, only insert in data desc with VLAN_IN_L2TAG1 is set
+		/* for single vlan offload, only insert in data desc when CI_TAG_IN_DATA_DESC is set
 		 * for qinq offload, we always put inner tag in L2Tag1
 		 */
-		if (((ol_flags & RTE_MBUF_F_TX_VLAN) && l2tag1_field == CI_VLAN_IN_L2TAG1) ||
+		if (((ol_flags & RTE_MBUF_F_TX_VLAN) && l2tag_pos == CI_TAG_IN_DATA_DESC) ||
 				(ol_flags & RTE_MBUF_F_TX_QINQ)) {
 			td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
 			td_tag = tx_pkt->vlan_tci;
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
index e29fcff661..ef7041cebd 100644
@@ -1007,7 +1007,7 @@ uint16_t
 i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	/* i40e does not support IPsec or timestamp queues, so pass NULL for both */
-	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_VLAN_IN_L2TAG1,
+	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
 			get_context_desc, NULL, NULL);
 }
 
drivers/net/intel/iavf/iavf_rxtx.c +1 -1
index 39bcbebf56..1354e2d6d6 100644
@@ -2605,7 +2605,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	/* IAVF does not support timestamp queues, so pass NULL for ts_fns */
 	return ci_xmit_pkts(txq, tx_pkts, nb_pkts,
 			    (txq->vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1) ?
-				CI_VLAN_IN_L2TAG1 : CI_VLAN_IN_L2TAG2,
+				CI_TAG_IN_DATA_DESC : CI_TAG_IN_CTX_DESC,
 			    iavf_get_context_desc, &ipsec_ops, NULL);
 }
 
drivers/net/intel/ice/ice_rxtx.c +3 -2
index c4b5454c53..22d1d5d602 100644
@@ -3125,10 +3125,11 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
 
 	if (txq->tsq != NULL && txq->tsq->ts_flag > 0)
-		return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_VLAN_IN_L2TAG1,
+		return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
 				get_context_desc, NULL, &ts_fns);
 
-	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_VLAN_IN_L2TAG1, get_context_desc, NULL, NULL);
+	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
+			get_context_desc, NULL, NULL);
 }
 
 static int
drivers/net/intel/idpf/idpf_common_rxtx.c +1 -1
index 2c87e02c98..128ebb6a88 100644
@@ -1415,7 +1415,7 @@ uint16_t
 idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
-	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_VLAN_IN_L2TAG1,
+	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
 			idpf_get_context_desc, NULL, NULL);
 }
 
Signature · 1 line
2.53.0
#25 lore raw

PATCH v2 5/7 net/intel: fix VLAN and QinQ tag position logic

In reply to Bruce Richardson

The position of a single vlan tag on a Tx packet (data desc or ctx desc) is independent across drivers from that of where the outer QinQ tag gets put. Therefore, these should be passed as separate values to the common scalar Tx function. For i40e, ice and idpf, the single tag can be put in the data descriptor, and for QinQ, the context descriptor contains the outer tag. For iavf, the tag positions depend on the capabilities reported by the PF to the VF, but the position for the single vlan tag and the outer QinQ tags are the same.

Fixes 6ea6d67bebfe ("net/intel: support configurable VLAN insertion on Tx")
---
 drivers/net/intel/common/tx_scalar.h      | 16 +++++++++++-----
 drivers/net/intel/i40e/i40e_rxtx.c        |  6 ++++--
 drivers/net/intel/iavf/iavf_rxtx.c        |  7 ++++---
 drivers/net/intel/ice/ice_rxtx.c          |  5 +++--
 drivers/net/intel/idpf/idpf_common_rxtx.c |  3 ++-
 5 files changed, 24 insertions(+), 13 deletions(-)
drivers/net/intel/common/tx_scalar.h +11 -5
index 4df279e729..7368d3abc9 100644
@@ -372,7 +372,8 @@ static inline uint16_t
 ci_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts,
-	     enum ci_l2tag_pos l2tag_pos,
+	     enum ci_l2tag_pos single_vlan_pos,
+	     enum ci_l2tag_pos qinq_outer_pos,
 	     ci_get_ctx_desc_fn get_ctx_desc,
 	     const struct ci_ipsec_ops *ipsec_ops,
 	     const struct ci_timestamp_queue_fns *ts_fns)
@@ -480,13 +481,18 @@ ci_xmit_pkts(struct ci_tx_queue *txq,
 		}
 
 		/* Descriptor based VLAN/QinQ insertion */
-		/* for single vlan offload, only insert in data desc when CI_TAG_IN_DATA_DESC is set
-		 * for qinq offload, we always put inner tag in L2Tag1
+		/* for single vlan offload, only insert in data desc when single_vlan_pos is
+		 * CI_TAG_IN_DATA_DESC; for qinq offload, L2Tag1 always carries a tag, either
+		 * the outer (qinq_outer_pos == CI_TAG_IN_DATA_DESC) or otherwise the inner
 		 */
-		if (((ol_flags & RTE_MBUF_F_TX_VLAN) && l2tag_pos == CI_TAG_IN_DATA_DESC) ||
+		if (((ol_flags & RTE_MBUF_F_TX_VLAN) && single_vlan_pos == CI_TAG_IN_DATA_DESC) ||
 				(ol_flags & RTE_MBUF_F_TX_QINQ)) {
 			td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
-			td_tag = tx_pkt->vlan_tci;
+			if ((ol_flags & RTE_MBUF_F_TX_QINQ) &&
+					qinq_outer_pos == CI_TAG_IN_DATA_DESC)
+				td_tag = tx_pkt->vlan_tci_outer;
+			else
+				td_tag = tx_pkt->vlan_tci;
 		}
 
 		/* Enable checksum offloading */
drivers/net/intel/i40e/i40e_rxtx.c +4 -2
index ef7041cebd..e2fffdb70a 100644
@@ -1006,8 +1006,10 @@ get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,
 uint16_t
 i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
-	/* i40e does not support IPsec or timestamp queues, so pass NULL for both */
-	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
+	/* i40e does not support IPsec or timestamp queues, so pass NULL for both.
+	 * QinQ always places the outer tag in the ctx desc, inner in the data desc.
+	 */
+	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC, CI_TAG_IN_CTX_DESC,
 			get_context_desc, NULL, NULL);
 }
 
drivers/net/intel/iavf/iavf_rxtx.c +4 -3
index 1354e2d6d6..80c9912ccc 100644
@@ -2596,6 +2596,9 @@ uint16_t
 iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = tx_queue;
+	/* vlan_flag gives both the single-VLAN and the QinQ outer tag position */
+	enum ci_l2tag_pos vlan_pos = (txq->vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1) ?
+			CI_TAG_IN_DATA_DESC : CI_TAG_IN_CTX_DESC;
 
 	const struct ci_ipsec_ops ipsec_ops = {
 		.get_ipsec_desc = iavf_get_ipsec_desc,
@@ -2603,9 +2606,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	};
 
 	/* IAVF does not support timestamp queues, so pass NULL for ts_fns */
-	return ci_xmit_pkts(txq, tx_pkts, nb_pkts,
-			    (txq->vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1) ?
-				CI_TAG_IN_DATA_DESC : CI_TAG_IN_CTX_DESC,
+	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, vlan_pos, vlan_pos,
 			    iavf_get_context_desc, &ipsec_ops, NULL);
 }
 
drivers/net/intel/ice/ice_rxtx.c +3 -2
index 22d1d5d602..3569ffcf82 100644
@@ -3125,10 +3125,11 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
 
 	if (txq->tsq != NULL && txq->tsq->ts_flag > 0)
-		return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
+		return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC, CI_TAG_IN_CTX_DESC,
 				get_context_desc, NULL, &ts_fns);
 
-	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
+	/* QinQ always places the outer tag in the ctx desc, inner in the data desc. */
+	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC, CI_TAG_IN_CTX_DESC,
 			get_context_desc, NULL, NULL);
 }
 
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -1
index 128ebb6a88..649b5d1f99 100644
@@ -1415,7 +1415,8 @@ uint16_t
 idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
-	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC,
+	/* QinQ always places the outer tag in the ctx desc, inner in the data desc. */
+	return ci_xmit_pkts(tx_queue, tx_pkts, nb_pkts, CI_TAG_IN_DATA_DESC, CI_TAG_IN_CTX_DESC,
 			idpf_get_context_desc, NULL, NULL);
 }
 
Signature · 1 line
2.53.0
#26 lore raw

PATCH v2 6/7 net/iavf: fix missing outer QinQ tag for tunnelled packets

In reply to Bruce Richardson

When the QinQ feature was enabled along with tunnelling support, the tunnel options were written directly to the context descriptor quad-word rather than being merged in. This leads to any QinQ tag in the context descriptor getting overwritten.

Change order of operations so that the tunnel options go first and the QinQ tags are merged into that.

Fixes 4f8259df563a ("net/iavf: enable Tx outer checksum offload on AVX512")
Fixes 70baceadabf2 ("net/iavf: fix AVX512 Tx")
---
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   | 6 ++++--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +4 -2
index 715805c65a..d05e6101ad 100644
@@ -1969,6 +1969,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 
 #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
+			/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */
+			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw1, pkt[1]);
 			if (pkt[1]->ol_flags & RTE_MBUF_F_TX_QINQ) {
 				uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 					(uint64_t)pkt[1]->vlan_tci_outer :
@@ -1990,6 +1992,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 
 #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
+			/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */
+			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw0, pkt[0]);
 			if (pkt[0]->ol_flags & RTE_MBUF_F_TX_QINQ) {
 				uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 					(uint64_t)pkt[0]->vlan_tci_outer :
@@ -2012,8 +2016,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 		if (offload) {
 			iavf_txd_enable_offload(pkt[1], &hi_data_qw1, vlan_flag);
 			iavf_txd_enable_offload(pkt[0], &hi_data_qw0, vlan_flag);
-			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw1, pkt[1]);
-			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw0, pkt[0]);
 		}
 
 		__m256i desc2_3 =
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +4 -2
index dfbbea80f7..bae9b2af9c 100644
@@ -2111,6 +2111,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 
 #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
+			/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */
+			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw1, pkt[1]);
 			if (pkt[1]->ol_flags & RTE_MBUF_F_TX_QINQ) {
 				uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 					(uint64_t)pkt[1]->vlan_tci_outer :
@@ -2131,6 +2133,8 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 
 #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
+			/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */
+			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw0, pkt[0]);
 			if (pkt[0]->ol_flags & RTE_MBUF_F_TX_QINQ) {
 				uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 					(uint64_t)pkt[0]->vlan_tci_outer :
@@ -2151,8 +2155,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 		if (offload) {
 			iavf_txd_enable_offload(pkt[1], &hi_data_qw1, vlan_flag);
 			iavf_txd_enable_offload(pkt[0], &hi_data_qw0, vlan_flag);
-			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw1, pkt[1]);
-			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw0, pkt[0]);
 		}
 
 		__m512i desc0_3 =
Signature · 1 line
2.53.0
#27 lore raw

PATCH v2 7/7 net/iavf: remove undocumented conditional macros

In reply to Bruce Richardson

The iavf driver included two #defines which enabled the QinQ and checksum offload in the code. The intent as documented in code comments was that any user not taking advantage of these features could remove the #defines to cut out some code. However, this was never actually publicly documented, and the use of these defines was never tested in any builds, making them fragile - if not already broken. Therefore, just remove these build time macros.

---
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  6 ------
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c |  6 ------
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 18 ------------------
 3 files changed, 30 deletions(-)
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +0 -6
index d05e6101ad..7217f32cef 100644
@@ -1910,7 +1910,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,
 
 	if (offload) {
 		iavf_fill_ctx_desc_tunneling_avx2(&low_ctx_qw, pkt);
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (pkt->ol_flags & RTE_MBUF_F_TX_QINQ) {
 			uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 				(uint64_t)pkt->vlan_tci_outer :
@@ -1922,7 +1921,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,
 			high_ctx_qw |= IAVF_TX_CTX_DESC_IL2TAG2 << IAVF_TXD_CTX_QW1_CMD_SHIFT;
 			low_ctx_qw |= (uint64_t)pkt->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 		}
-#endif
 	}
 	if (IAVF_CHECK_TX_LLDP(pkt, ptype_lldp_enabled))
 		high_ctx_qw |= IAVF_TX_CTX_DESC_SWTCH_UPLINK << IAVF_TXD_CTX_QW1_CMD_SHIFT;
@@ -1967,7 +1965,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 				((uint64_t)pkt[0]->data_len <<
 					IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
 
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
 			/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */
 			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw1, pkt[1]);
@@ -1986,11 +1983,9 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 					(uint64_t)pkt[1]->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 			}
 		}
-#endif
 		if (IAVF_CHECK_TX_LLDP(pkt[1], ptype_lldp_enabled))
 			hi_ctx_qw1 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK << IAVF_TXD_CTX_QW1_CMD_SHIFT;
 
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
 			/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */
 			iavf_fill_ctx_desc_tunneling_field(&low_ctx_qw0, pkt[0]);
@@ -2009,7 +2004,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 					(uint64_t)pkt[0]->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 			}
 		}
-#endif
 		if (IAVF_CHECK_TX_LLDP(pkt[0], ptype_lldp_enabled))
 			hi_ctx_qw0 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK << IAVF_TXD_CTX_QW1_CMD_SHIFT;
 
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -6
index bae9b2af9c..bf0245e8f4 100644
@@ -2054,7 +2054,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,
 
 	if (offload) {
 		iavf_fill_ctx_desc_tunneling_avx512(&low_ctx_qw, pkt);
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (pkt->ol_flags & RTE_MBUF_F_TX_QINQ) {
 			uint64_t qinq_tag = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?
 				(uint64_t)pkt->vlan_tci_outer :
@@ -2066,7 +2065,6 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,
 			high_ctx_qw |= IAVF_TX_CTX_DESC_IL2TAG2 << IAVF_TXD_CTX_QW1_CMD_SHIFT;
 			low_ctx_qw |= (uint64_t)pkt->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 		}
-#endif
 	}
 	if (IAVF_CHECK_TX_LLDP(pkt, lldp_enabled))
 		high_ctx_qw |= IAVF_TX_CTX_DESC_SWTCH_UPLINK
@@ -2109,7 +2107,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 		hi_data_qw0 = hi_data_qw_tmpl |
 				((uint64_t)pkt[0]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
 			/* tunnel fill assigns low_ctx_qw1; must run before QinQ/VLAN OR below */
 			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw1, pkt[1]);
@@ -2126,12 +2123,10 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 					(uint64_t)pkt[1]->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 			}
 		}
-#endif
 		if (IAVF_CHECK_TX_LLDP(pkt[1], lldp_enabled))
 			hi_ctx_qw1 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK
 				<< CI_TXD_QW1_CMD_S;
 
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
 			/* tunnel fill assigns low_ctx_qw0; must run before QinQ/VLAN OR below */
 			iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw0, pkt[0]);
@@ -2148,7 +2143,6 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 					(uint64_t)pkt[0]->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
 			}
 		}
-#endif
 		if (IAVF_CHECK_TX_LLDP(pkt[0], lldp_enabled))
 			hi_ctx_qw0 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK << CI_TXD_QW1_CMD_S;
 
drivers/net/intel/iavf/iavf_rxtx_vec_common.h +0 -18
index 1538a44892..1e9ce924ee 100644
@@ -119,31 +119,16 @@ iavf_tx_vec_dev_check_default(struct rte_eth_dev *dev)
 	return ret;
 }
 
-/******************************************************************************
- * If user knows a specific offload is not enabled by APP,
- * the macro can be commented to save the effort of fast path.
- * Currently below 2 features are supported in TX path,
- * 1, checksum offload
- * 2, VLAN/QINQ insertion
- ******************************************************************************/
-#define IAVF_TX_CSUM_OFFLOAD
-#define IAVF_TX_VLAN_QINQ_OFFLOAD
-
 static __rte_always_inline void
 iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
 			uint64_t *txd_hi, uint8_t vlan_flag)
 {
-#if defined(IAVF_TX_CSUM_OFFLOAD) || defined(IAVF_TX_VLAN_QINQ_OFFLOAD)
 	uint64_t ol_flags = tx_pkt->ol_flags;
-#endif
 	uint32_t td_cmd = 0;
-#ifdef IAVF_TX_CSUM_OFFLOAD
 	uint32_t td_offset = 0;
-#endif
 
 	RTE_SET_USED(vlan_flag);
 
-#ifdef IAVF_TX_CSUM_OFFLOAD
 	/* Set MACLEN */
 	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
 		td_offset |= (tx_pkt->outer_l2_len >> 1)
@@ -191,9 +176,7 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
 	}
 
 	*txd_hi |= ((uint64_t)td_offset) << CI_TXD_QW1_OFFSET_S;
-#endif
 
-#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 	if (ol_flags & RTE_MBUF_F_TX_QINQ) {
 		td_cmd |= IAVF_TX_DESC_CMD_IL2TAG1;
 		/* vlan_flag specifies outer tag location for QinQ. */
@@ -205,7 +188,6 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
 		td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
 		*txd_hi |= ((uint64_t)tx_pkt->vlan_tci << CI_TXD_QW1_L2TAG1_S);
 	}
-#endif
 
 	*txd_hi |= ((uint64_t)td_cmd) << CI_TXD_QW1_CMD_S;
 }
Signature · 1 line
2.53.0
#28 lore raw
In reply to Bruce Richardson
Quoted 7 lines · Bruce Richardson

This patchset contains a number of small fixes for iavf VLAN tag handling. Most issues were discovered by AI code review rather than being found in testing.

v2:
* add error checking to patch 3

Quoted 9 lines

Bruce Richardson (7):
net/iavf: disable broken QinQ strip on Rx net/iavf: fix VLAN tag placement logic
net/iavf: fix VLAN outer TPID setting on Tx net/intel: fix unclear enum names
net/intel: fix VLAN and QinQ tag position logic net/iavf: fix missing outer QinQ tag for tunnelled packets net/iavf: remove undocumented conditional macros

Series applied to dpdk-next-net-intel

/Bruce