DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ciara Loftus <ciara.loftus@intel.com>
To: dev@dpdk.org
Cc: Ciara Loftus <ciara.loftus@intel.com>
Subject: [PATCH 3/3] net/iavf: fix Tx path selection for VLAN offload
Date: Thu,  4 Sep 2025 10:44:40 +0000	[thread overview]
Message-ID: <20250904104440.2167205-4-ciara.loftus@intel.com> (raw)
In-Reply-To: <20250904104440.2167205-1-ciara.loftus@intel.com>

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@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


  parent reply	other threads:[~2025-09-04 10:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 10:44 [PATCH 0/3] Fixes for iavf Tx path selection Ciara Loftus
2025-09-04 10:44 ` [PATCH 1/3] net/iavf: fix Tx vector path selection logic again Ciara Loftus
2025-09-04 16:59   ` Bruce Richardson
2025-09-04 10:44 ` [PATCH 2/3] net/iavf: fix a log during Tx path selection Ciara Loftus
2025-09-04 17:00   ` Bruce Richardson
2025-09-04 10:44 ` Ciara Loftus [this message]
2025-09-04 17:10   ` [PATCH 3/3] net/iavf: fix Tx path selection for VLAN offload Bruce Richardson
2025-09-04 17:18 ` [PATCH 0/3] Fixes for iavf Tx path selection Bruce Richardson

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=20250904104440.2167205-4-ciara.loftus@intel.com \
    --to=ciara.loftus@intel.com \
    --cc=dev@dpdk.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;
as well as URLs for NNTP newsgroup(s).