[dpdk-stable] patch 'net/hns3: fix VLAN strip configuration when setting PVID' has been queued to stable release 19.11.4

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 24 13:57:37 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/26/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From c9e3e5fd3661202efe9859ad75498c55d35868e4 Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang at huawei.com>
Date: Wed, 3 Jun 2020 17:31:59 +0800
Subject: [PATCH] net/hns3: fix VLAN strip configuration when setting PVID

[ upstream commit 4c623ca40013c58d73aec67717583e3ee1cb45e3 ]

Currently, based on hns3 PF device, hardware will strip 2 vlan tags when
ULP calls rte_eth_dev_set_vlan_pvid API function to set a PVID whether
vlan strip related offload is turned on by calling rte_eth_dev_configure
or rte_eth_dev_set_vlan_offload API function.

When receiving a QinQ packet with the pvid tag, if ULP does not
configure the vlan strip by the method mentioned above, a layer of vlan
tag will be lost to ULP, which is not the expected result.

It is supposed to configure the vlan strip according to the upper level
process's configuration.

Fixes: 411d23b9eafb ("net/hns3: support VLAN")

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

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index f2b0fd704..e7eeb7875 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -823,25 +823,28 @@ hns3_update_vlan_filter_entries(struct hns3_adapter *hns,
 }
 
 static int
-hns3_en_rx_strip_all(struct hns3_adapter *hns, int on)
+hns3_en_pvid_strip(struct hns3_adapter *hns, int on)
 {
+	struct hns3_rx_vtag_cfg *old_cfg = &hns->pf.vtag_config.rx_vcfg;
 	struct hns3_rx_vtag_cfg rx_vlan_cfg;
-	struct hns3_hw *hw = &hns->hw;
 	bool rx_strip_en;
 	int ret;
 
-	rx_strip_en = on ? true : false;
-	rx_vlan_cfg.strip_tag1_en = rx_strip_en;
-	rx_vlan_cfg.strip_tag2_en = rx_strip_en;
+	rx_strip_en = old_cfg->rx_vlan_offload_en ? true : false;
+	if (on) {
+		rx_vlan_cfg.strip_tag1_en = rx_strip_en;
+		rx_vlan_cfg.strip_tag2_en = true;
+	} else {
+		rx_vlan_cfg.strip_tag1_en = false;
+		rx_vlan_cfg.strip_tag2_en = rx_strip_en;
+	}
 	rx_vlan_cfg.vlan1_vlan_prionly = false;
 	rx_vlan_cfg.vlan2_vlan_prionly = false;
-	rx_vlan_cfg.rx_vlan_offload_en = rx_strip_en;
+	rx_vlan_cfg.rx_vlan_offload_en = old_cfg->rx_vlan_offload_en;
 
 	ret = hns3_set_vlan_rx_offload_cfg(hns, &rx_vlan_cfg);
-	if (ret) {
-		hns3_err(hw, "enable strip rx failed, ret =%d", ret);
+	if (ret)
 		return ret;
-	}
 
 	hns3_update_rx_offload_cfg(hns, &rx_vlan_cfg);
 	return ret;
@@ -868,13 +871,15 @@ hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on)
 				    HNS3_PORT_BASE_VLAN_DISABLE;
 	ret = hns3_vlan_txvlan_cfg(hns, port_base_vlan_state, pvid);
 	if (ret) {
-		hns3_err(hw, "Failed to config tx vlan, ret =%d", ret);
+		hns3_err(hw, "failed to config tx vlan for pvid, ret = %d",
+			 ret);
 		return ret;
 	}
 
-	ret = hns3_en_rx_strip_all(hns, on);
+	ret = hns3_en_pvid_strip(hns, on);
 	if (ret) {
-		hns3_err(hw, "Failed to config rx vlan strip, ret =%d", ret);
+		hns3_err(hw, "failed to config rx vlan strip for pvid, "
+			 "ret = %d", ret);
 		return ret;
 	}
 
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-07-24 12:53:49.352013441 +0100
+++ 0019-net-hns3-fix-VLAN-strip-configuration-when-setting-P.patch	2020-07-24 12:53:48.199004820 +0100
@@ -1,8 +1,10 @@
-From 4c623ca40013c58d73aec67717583e3ee1cb45e3 Mon Sep 17 00:00:00 2001
+From c9e3e5fd3661202efe9859ad75498c55d35868e4 Mon Sep 17 00:00:00 2001
 From: Chengchang Tang <tangchengchang at huawei.com>
 Date: Wed, 3 Jun 2020 17:31:59 +0800
 Subject: [PATCH] net/hns3: fix VLAN strip configuration when setting PVID
 
+[ upstream commit 4c623ca40013c58d73aec67717583e3ee1cb45e3 ]
+
 Currently, based on hns3 PF device, hardware will strip 2 vlan tags when
 ULP calls rte_eth_dev_set_vlan_pvid API function to set a PVID whether
 vlan strip related offload is turned on by calling rte_eth_dev_configure
@@ -16,7 +18,6 @@
 process's configuration.
 
 Fixes: 411d23b9eafb ("net/hns3: support VLAN")
-Cc: stable at dpdk.org
 
 Signed-off-by: Chengchang Tang <tangchengchang at huawei.com>
 Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
@@ -25,10 +26,10 @@
  1 file changed, 17 insertions(+), 12 deletions(-)
 
 diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
-index 4030bd32a..244a3b827 100644
+index f2b0fd704..e7eeb7875 100644
 --- a/drivers/net/hns3/hns3_ethdev.c
 +++ b/drivers/net/hns3/hns3_ethdev.c
-@@ -832,25 +832,28 @@ hns3_update_vlan_filter_entries(struct hns3_adapter *hns,
+@@ -823,25 +823,28 @@ hns3_update_vlan_filter_entries(struct hns3_adapter *hns,
  }
  
  static int
@@ -66,7 +67,7 @@
  
  	hns3_update_rx_offload_cfg(hns, &rx_vlan_cfg);
  	return ret;
-@@ -877,13 +880,15 @@ hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on)
+@@ -868,13 +871,15 @@ hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on)
  				    HNS3_PORT_BASE_VLAN_DISABLE;
  	ret = hns3_vlan_txvlan_cfg(hns, port_base_vlan_state, pvid);
  	if (ret) {


More information about the stable mailing list