[dpdk-dev] [PATCH 4/6] net/hns3: fix VLAN pvid when configuring device

Wei Hu (Xavier) huwei013 at chinasoftinc.com
Wed Apr 29 13:13:26 CEST 2020


From: "Min Hu (Connor)" <humin29 at huawei.com>

In current version, when upper level application calls the
rte_eth_dev_configure API function, if pvid config is not set of the
input parameter which struct type is rte_eth_conf, hns3 pmd driver also
sets the VLAN pvid related configuration to hardware, and this is not
reasonable. For example, As pvid is set to 100 by
rte_eth_dev_set_vlan_pvid, when pvid config is not set in rte_eth_conf,
rte_eth_dev_configure will tell driver to delete pvid 0, and that is
meaningless.

This patch fixes it to ensure that driver does not set VLAN pvid related
configuration to hardware when pvid config is not set in rte_eth_conf.

Fixes: 411d23b9eafb ("net/hns3: support VLAN")
Cc: stable at dpdk.org

Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
Signed-off-by: Chengchang Tang <tangchengchang at huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index ae87aa0dd..1fac4f366 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1059,6 +1059,13 @@ hns3_dev_configure_vlan(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	/*
+	 * If pvid config is not set in rte_eth_conf, driver needn't to set
+	 * VLAN pvid related configuration to hardware.
+	 */
+	if (txmode->pvid == 0 && txmode->hw_vlan_insert_pvid == 0)
+		return 0;
+
 	/* Apply pvid setting */
 	ret = hns3_vlan_pvid_set(dev, txmode->pvid,
 				 txmode->hw_vlan_insert_pvid);
-- 
2.23.0



More information about the dev mailing list