* [PATCH] net/iavf: fix VLAN offload strip flag
@ 2025-06-20 18:33 Amiya Ranjan Mohakud
0 siblings, 0 replies; only message in thread
From: Amiya Ranjan Mohakud @ 2025-06-20 18:33 UTC (permalink / raw)
To: dev; +Cc: amiyaranjan.mohakud
For i40e kernel drivers which support either vlan(v1) or vlan(v2)
VIRTCHNL OP,it will set strip on when setting filter on. But dpdk
side will not change strip flag. To be consistent with dpdk side,
explicitly disable strip again.
Bugzilla ID:1725
Signed-off-by: Amiya Ranjan Mohakud <amiyaranjan.mohakud@gmail.com>
---
drivers/net/iavf/iavf_ethdev.c | 48 ++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 19 deletions(-)
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 656a4c6176..62e75f3626 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1344,13 +1344,38 @@ iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
vf->mac_num--;
}
+static int
+iavf_disable_vlan_strip_ex(struct rte_eth_dev *dev, int on)
+{
+ /* For i40e kernel drivers which supports both vlan(v1 & v2) VIRTCHNL OP,
+ * it will set strip on when setting filter on but dpdk side will not
+ * change strip flag. To be consistent with dpdk side, explicitly disable
+ * strip again.
+ *
+ */
+ struct iavf_adapter *adapter =
+ IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+ struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
+ int err;
+
+ if (adapter->hw.mac.type == IAVF_MAC_XL710 ||
+ adapter->hw.mac.type == IAVF_MAC_VF ||
+ adapter->hw.mac.type == IAVF_MAC_X722_VF) {
+ if (on && !(dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP)) {
+ err = iavf_disable_vlan_strip(adapter);
+ if (err)
+ return -EIO;
+ }
+ }
+ return 0;
+}
+
static int
iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
{
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
- struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
int err;
if (adapter->closed)
@@ -1360,7 +1385,8 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
err = iavf_add_del_vlan_v2(adapter, vlan_id, on);
if (err)
return -EIO;
- return 0;
+
+ return iavf_disable_vlan_strip_ex(dev, on);
}
if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
@@ -1370,23 +1396,7 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
if (err)
return -EIO;
- /* For i40e kernel driver which only supports vlan(v1) VIRTCHNL OP,
- * it will set strip on when setting filter on but dpdk side will not
- * change strip flag. To be consistent with dpdk side, disable strip
- * again.
- *
- * For i40e kernel driver which supports vlan v2, dpdk will invoke vlan v2
- * related function, so it won't go through here.
- */
- if (adapter->hw.mac.type == IAVF_MAC_XL710 ||
- adapter->hw.mac.type == IAVF_MAC_X722_VF) {
- if (on && !(dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP)) {
- err = iavf_disable_vlan_strip(adapter);
- if (err)
- return -EIO;
- }
- }
- return 0;
+ return iavf_disable_vlan_strip_ex(dev, on);
}
static void
--
2.39.5 (Apple Git-154)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-06-20 18:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-20 18:33 [PATCH] net/iavf: fix VLAN offload strip flag Amiya Ranjan Mohakud
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).