DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anurag Mandal <anurag.mandal@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, vladimir.medvedkin@intel.com,
	Anurag Mandal <anurag.mandal@intel.com>,
	stable@dpdk.org
Subject: [PATCH] net/iavf: fix VLAN offload when inner VLAN is not supported
Date: Wed, 15 Jul 2026 22:52:34 +0000	[thread overview]
Message-ID: <20260715225234.482186-1-anurag.mandal@intel.com> (raw)

In Double VLAN mode (DVM) i.e. when RTE_ETH_RX_OFFLOAD_VLAN_EXTEND
is enabled, the single VLAN offloads are programmed on the inner
VLAN (0x8100) engine by iavf_config_vlan_strip_v2() &
iavf_config_vlan_insert_v2().
When the PF/hardware does not advertise inner VLAN offloading
capabilities, these functions return -ENOTSUP.

On the enable path,these -ENOTSUP are trsnalated into -EIO,
which makes device configuration fail.
However, in DVM, with the default outer TPID set as 0x8100,
a single 0x8100 tagged VLAN frame is handled by the outer
VLAN engine, so the missing inner capability is harmless
and should not fail the configuration.

This patch fixes the same by returning success when DVM is
enabled and the outer TPID is 0x8100, so the outer VLAN
engine services the single VLAN.
Changed "qinq" flag from 'int' to 'bool' to address memory
wastage.

Fixes: 8599d7604e0a ("net/iavf: support QinQ strip")
Cc: stable@dpdk.org

Signed-off-by: Anurag Mandal <anurag.mandal@intel.com>
---
 drivers/net/intel/iavf/iavf_vchnl.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
index f8fffa7802..f346837bf1 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -920,7 +920,7 @@ iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable)
 	uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
 	struct iavf_cmd_info args;
 	uint32_t *ethertype;
-	int qinq = adapter->dev_data->dev_conf.rxmode.offloads &
+	bool qinq = adapter->dev_data->dev_conf.rxmode.offloads &
 		   RTE_ETH_RX_OFFLOAD_VLAN_EXTEND;
 	bool strip_qinq = adapter->dev_data->dev_conf.rxmode.offloads &
 			  RTE_ETH_RX_OFFLOAD_QINQ_STRIP;
@@ -943,7 +943,8 @@ iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable)
 		 (stripping_caps->inner & VIRTCHNL_VLAN_TOGGLE))
 		ethertype = &vlan_strip.inner_ethertype_setting;
 	else
-		return -ENOTSUP;
+		/* Return success for non-inner VLAN supported hardware */
+		return (qinq && adapter->tpid == RTE_ETHER_TYPE_VLAN) ? 0 : -ENOTSUP;
 
 	memset(&vlan_strip, 0, sizeof(vlan_strip));
 	vlan_strip.vport_id = vf->vsi_res->vsi_id;
@@ -1036,7 +1037,8 @@ iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable)
 		 (insertion_caps->inner & VIRTCHNL_VLAN_TOGGLE))
 		ethertype = &vlan_insert.inner_ethertype_setting;
 	else
-		return -ENOTSUP;
+		/* Return success for non-inner VLAN supported hardware */
+		return (qinq && adapter->tpid == RTE_ETHER_TYPE_VLAN) ? 0 : -ENOTSUP;
 
 	memset(&vlan_insert, 0, sizeof(vlan_insert));
 	vlan_insert.vport_id = vf->vsi_res->vsi_id;
@@ -1067,7 +1069,7 @@ iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
 	struct virtchnl_vlan *vlan_setting;
 	struct iavf_cmd_info args;
 	uint32_t filtering_caps;
-	int qinq = adapter->dev_data->dev_conf.rxmode.offloads &
+	bool qinq = adapter->dev_data->dev_conf.rxmode.offloads &
 		   RTE_ETH_RX_OFFLOAD_VLAN_EXTEND;
 	int err;
 
-- 
2.43.0


             reply	other threads:[~2026-07-15 23:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 22:52 Anurag Mandal [this message]
2026-07-17  3:33 ` [PATCH] net/iavf: fix VLAN offload when inner VLAN is not supported Mandal, Anurag

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=20260715225234.482186-1-anurag.mandal@intel.com \
    --to=anurag.mandal@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=vladimir.medvedkin@intel.com \
    /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