[PATCH v2] net/iavf: fix vlan offload strip flag inconsistency

Wenjing Qiao wenjing.qiao at intel.com
Wed Jul 12 09:48:32 CEST 2023


For i40e in-tree kernel driver, it will set strip on when setting
filter on. To be consistent with dpdk, disable strip again.

Fixes: cb25d4323fbf ("net/avf: enable MAC VLAN and promisc ops")
Cc: stable at dpdk.org

Signed-off-by: Wenjing Qiao <wenjing.qiao at intel.com>
---
Depends-on: patch-129488 ("common/iavf: fix hw mac type for 710 NIC")
---
 drivers/net/iavf/iavf_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 00b963128b..d5dfa019f7 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1361,6 +1361,7 @@ 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)
@@ -1379,6 +1380,17 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	err = iavf_add_del_vlan(adapter, vlan_id, on);
 	if (err)
 		return -EIO;
+	/* for i40e in-tree kernel driver, it will set strip on when setting
+	 * filter on. To be consistent with dpdk, disable strip again.
+	 */
+	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;
 }
 
-- 
2.34.1



More information about the stable mailing list