net/iavf: fix VLAN offload when inner VLAN is not supported
PATCH 1/1 net/iavf: fix VLAN offload when inner VLAN is not supported
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.
--- drivers/net/intel/iavf/iavf_vchnl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/intel/iavf/iavf_vchnl.c +6 -4
@@ -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;
Signature · 1 line
2.43.0
Quoted 21 lines
-----Original Message-----
From: Mandal, Anurag <[email protected]>
Sent: 16 July 2026 04:23
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Medvedkin, Vladimir <[email protected]>; Mandal, Anurag <[email protected]>; [email protected]
Subject: [PATCH] net/iavf: fix VLAN offload when inner VLAN is not supportedIn Double VLAN mode (DVM) i.e. when
RTE_ETH_RX_OFFLOAD_VLAN_EXTENDis enabled, the single VLAN offloads are programmed on the inner VLAN (0x8100) engine byiavf_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
-ENOTSUPare trsnalated into-EIO, which makes device configuration fail.
However, in DVM, with the default outer TPID set as0x8100, a single0x8100tagged VLAN frame is handled by the outer VLAN engine, so the missing inner capability is harmless and should not fail the configuration.
Quoted 8 lines
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")Signed-off-by Anurag Mandal <[email protected]>
Quoted 53 lines
--- drivers/net/intel/iavf/iavf_vchnl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/net/intel/iavf/iavf_vchnl.c +1
-1@@ -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 &drivers/net/intel/iavf/iavf_vchnl.c +2
-1RTE_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;drivers/net/intel/iavf/iavf_vchnl.c +0
-0memset (&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)drivers/net/intel/iavf/iavf_vchnl.c +2
-1(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;drivers/net/intel/iavf/iavf_vchnl.c +0
-0memset (&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)drivers/net/intel/iavf/iavf_vchnl.c +1
-2struct 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
Bruce Richardson
AppliedQuoted 25 lines · Anurag
Quoted 25 lines
-----Original Message-----
From: Mandal, Anurag <[email protected]>
Sent: 16 July 2026 04:23
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Medvedkin, Vladimir <[email protected]>; Mandal, Anurag <[email protected]>; [email protected]
Subject: [PATCH] net/iavf: fix VLAN offload when inner VLAN is not supportedIn Double VLAN mode (DVM) i.e. when
RTE_ETH_RX_OFFLOAD_VLAN_EXTENDis enabled, the single VLAN offloads are programmed on the inner VLAN (0x8100) engine byiavf_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
-ENOTSUPare trsnalated into-EIO, which makes device configuration fail.
However, in DVM, with the default outer TPID set as0x8100, a single0x8100tagged 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.
Quoted 6 lines
Quoted 4 lines
Fixes 8599d7604e0a ("net/iavf: support QinQ strip")Signed-off-by Anurag Mandal <[email protected]>Tested-by Daxue Gao <[email protected]>
Applied to dpdk-next-net-intel.
Thanks,
/Bruce