[PATCH 3/3] net/iavf: fix Tx path selection for VLAN offload

Ciara Loftus ciara.loftus at intel.com
Thu Sep 4 12:44:40 CEST 2025


For the vlan insert offload a different tx vector offload path is
required depending on where the tag must be placed in the descriptor
which can vary from one VF to another. Some VFs use the L2TAG2 field
which requires the use of a context descriptor. Adjust the logic for
selecting the tx path so that the correct path is used for each vlan tag
location. Before this fix, if the tag was to be put in the L2TAG1 field,
the scalar path was always used which was incorrect, because the AVX-512
vector path also supports this offload.

Fixes: abca31f780e1 ("net/iavf: support VLAN insertion for the AVX-512 path")

Signed-off-by: Ciara Loftus <ciara.loftus at intel.com>
---
 drivers/net/intel/iavf/iavf_rxtx.h            |  1 -
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 23 +++++++++++--------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf_rxtx.h b/drivers/net/intel/iavf/iavf_rxtx.h
index 723c30d05b..a499141049 100644
--- a/drivers/net/intel/iavf/iavf_rxtx.h
+++ b/drivers/net/intel/iavf/iavf_rxtx.h
@@ -53,7 +53,6 @@
 #define IAVF_TX_VECTOR_OFFLOAD_CTX (			\
 		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
 		RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_VLAN_INSERT |	\
 		RTE_ETH_TX_OFFLOAD_QINQ_INSERT)
 
 #define IAVF_RX_NO_OFFLOADS 0
diff --git a/drivers/net/intel/iavf/iavf_rxtx_vec_common.h b/drivers/net/intel/iavf/iavf_rxtx_vec_common.h
index a3688baf4b..f513777663 100644
--- a/drivers/net/intel/iavf/iavf_rxtx_vec_common.h
+++ b/drivers/net/intel/iavf/iavf_rxtx_vec_common.h
@@ -73,6 +73,8 @@ iavf_rx_vec_queue_default(struct ci_rx_queue *rxq)
 static inline int
 iavf_tx_vec_queue_default(struct ci_tx_queue *txq)
 {
+	bool vlan_offload = false, vlan_needs_ctx = false;
+
 	if (!txq)
 		return -1;
 
@@ -88,20 +90,21 @@ iavf_tx_vec_queue_default(struct ci_tx_queue *txq)
 		return IAVF_VECTOR_CTX_PATH;
 	}
 
+	/* Vlan tci needs to be inserted via ctx desc, if the vlan_flag is L2TAG2. */
+	if (txq->offloads & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) {
+		vlan_offload = true;
+		if (txq->vlan_flag == IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2)
+			vlan_needs_ctx = true;
+	}
+
 	/**
-	 * Vlan tci needs to be inserted via ctx desc, if the vlan_flag is L2TAG2.
 	 * Tunneling parameters and other fields need be configured in ctx desc
 	 * if the outer checksum offload is enabled.
 	 */
-	if (txq->offloads & (IAVF_TX_VECTOR_OFFLOAD | IAVF_TX_VECTOR_OFFLOAD_CTX)) {
-		if (txq->offloads & IAVF_TX_VECTOR_OFFLOAD_CTX) {
-			if (txq->vlan_flag == IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ||
-					txq->offloads & RTE_ETH_TX_OFFLOAD_QINQ_INSERT) {
-				txq->use_ctx = 1;
-				return IAVF_VECTOR_CTX_OFFLOAD_PATH;
-			} else {
-				return -1;
-			}
+	if (txq->offloads & (IAVF_TX_VECTOR_OFFLOAD | IAVF_TX_VECTOR_OFFLOAD_CTX) || vlan_offload) {
+		if (txq->offloads & IAVF_TX_VECTOR_OFFLOAD_CTX || vlan_needs_ctx) {
+			txq->use_ctx = 1;
+			return IAVF_VECTOR_CTX_OFFLOAD_PATH;
 		} else {
 			return IAVF_VECTOR_OFFLOAD_PATH;
 		}
-- 
2.34.1



More information about the dev mailing list