[dpdk-stable] patch 'net/hns3: fix promiscuous mode for PF' has been queued to stable release 19.11.3

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue May 19 14:53:46 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/21/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 7aa0060a2a52ef63e01070d599e4ef5601aa85bf Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang at huawei.com>
Date: Mon, 9 Mar 2020 17:32:43 +0800
Subject: [PATCH] net/hns3: fix promiscuous mode for PF

[ upstream commit eb4f9b6a55002a4abc1a4e9eca2a89174fd6ce2b ]

Currently, when promiscuous mode is enabled, it is just allowed to
accept all the unicast and broadcast packets in hns3 PF PMD driver. It
should also be able to receive multicast packets.

Fixes: 19a3ca4c99cf ("net/hns3: add start/stop and configure operations")

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 | 41 ++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 7e601b8bf8..9dc96fff5a 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -3524,7 +3524,7 @@ hns3_cmd_set_promisc_mode(struct hns3_hw *hw, struct hns3_promisc_param *param)
 
 	ret = hns3_cmd_send(hw, &desc, 1);
 	if (ret)
-		PMD_INIT_LOG(ERR, "Set promisc mode fail, status is %d", ret);
+		PMD_INIT_LOG(ERR, "Set promisc mode fail, ret = %d", ret);
 
 	return ret;
 }
@@ -3577,14 +3577,14 @@ hns3_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_hw *hw = &hns->hw;
-	bool en_mc_pmc = (dev->data->all_multicast == 1) ? true : false;
 	int ret = 0;
 
 	rte_spinlock_lock(&hw->lock);
-	ret = hns3_set_promisc_mode(hw, true, en_mc_pmc);
+	ret = hns3_set_promisc_mode(hw, true, true);
 	rte_spinlock_unlock(&hw->lock);
 	if (ret)
-		hns3_err(hw, "Failed to enable promiscuous mode: %d", ret);
+		hns3_err(hw, "Failed to enable promiscuous mode, ret = %d",
+			 ret);
 
 	return ret;
 }
@@ -3592,17 +3592,18 @@ hns3_dev_promiscuous_enable(struct rte_eth_dev *dev)
 static int
 hns3_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
+	bool allmulti = dev->data->all_multicast ? true : false;
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_hw *hw = &hns->hw;
-	bool en_mc_pmc = (dev->data->all_multicast == 1) ? true : false;
 	int ret = 0;
 
 	/* If now in all_multicast mode, must remain in all_multicast mode. */
 	rte_spinlock_lock(&hw->lock);
-	ret = hns3_set_promisc_mode(hw, false, en_mc_pmc);
+	ret = hns3_set_promisc_mode(hw, false, allmulti);
 	rte_spinlock_unlock(&hw->lock);
 	if (ret)
-		hns3_err(hw, "Failed to disable promiscuous mode: %d", ret);
+		hns3_err(hw, "Failed to disable promiscuous mode, ret = %d",
+			 ret);
 
 	return ret;
 }
@@ -3612,14 +3613,17 @@ hns3_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_hw *hw = &hns->hw;
-	bool en_uc_pmc = (dev->data->promiscuous == 1) ? true : false;
 	int ret = 0;
 
+	if (dev->data->promiscuous)
+		return 0;
+
 	rte_spinlock_lock(&hw->lock);
-	ret = hns3_set_promisc_mode(hw, en_uc_pmc, true);
+	ret = hns3_set_promisc_mode(hw, false, true);
 	rte_spinlock_unlock(&hw->lock);
 	if (ret)
-		hns3_err(hw, "Failed to enable allmulticast mode: %d", ret);
+		hns3_err(hw, "Failed to enable allmulticast mode, ret = %d",
+			 ret);
 
 	return ret;
 }
@@ -3629,18 +3633,18 @@ hns3_dev_allmulticast_disable(struct rte_eth_dev *dev)
 {
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_hw *hw = &hns->hw;
-	bool en_uc_pmc = (dev->data->promiscuous == 1) ? true : false;
 	int ret = 0;
 
 	/* If now in promiscuous mode, must remain in all_multicast mode. */
-	if (dev->data->promiscuous == 1)
+	if (dev->data->promiscuous)
 		return 0;
 
 	rte_spinlock_lock(&hw->lock);
-	ret = hns3_set_promisc_mode(hw, en_uc_pmc, false);
+	ret = hns3_set_promisc_mode(hw, false, false);
 	rte_spinlock_unlock(&hw->lock);
 	if (ret)
-		hns3_err(hw, "Failed to disable allmulticast mode: %d", ret);
+		hns3_err(hw, "Failed to disable allmulticast mode, ret =  %d",
+			 ret);
 
 	return ret;
 }
@@ -3649,13 +3653,12 @@ static int
 hns3_dev_promisc_restore(struct hns3_adapter *hns)
 {
 	struct hns3_hw *hw = &hns->hw;
-	bool en_mc_pmc;
-	bool en_uc_pmc;
+	bool allmulti = hw->data->all_multicast ? true : false;
 
-	en_uc_pmc = (hw->data->promiscuous == 1) ? true : false;
-	en_mc_pmc = (hw->data->all_multicast == 1) ? true : false;
+	if (hw->data->promiscuous)
+		return hns3_set_promisc_mode(hw, true, true);
 
-	return hns3_set_promisc_mode(hw, en_uc_pmc, en_mc_pmc);
+	return hns3_set_promisc_mode(hw, false, allmulti);
 }
 
 static int
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-19 13:56:20.305768957 +0100
+++ 0036-net-hns3-fix-promiscuous-mode-for-PF.patch	2020-05-19 13:56:18.231502035 +0100
@@ -1,14 +1,15 @@
-From eb4f9b6a55002a4abc1a4e9eca2a89174fd6ce2b Mon Sep 17 00:00:00 2001
+From 7aa0060a2a52ef63e01070d599e4ef5601aa85bf Mon Sep 17 00:00:00 2001
 From: Chengchang Tang <tangchengchang at huawei.com>
 Date: Mon, 9 Mar 2020 17:32:43 +0800
 Subject: [PATCH] net/hns3: fix promiscuous mode for PF
 
+[ upstream commit eb4f9b6a55002a4abc1a4e9eca2a89174fd6ce2b ]
+
 Currently, when promiscuous mode is enabled, it is just allowed to
 accept all the unicast and broadcast packets in hns3 PF PMD driver. It
 should also be able to receive multicast packets.
 
 Fixes: 19a3ca4c99cf ("net/hns3: add start/stop and configure operations")
-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>
@@ -17,10 +18,10 @@
  1 file changed, 22 insertions(+), 19 deletions(-)
 
 diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
-index 909f4b0c50..26366013fb 100644
+index 7e601b8bf8..9dc96fff5a 100644
 --- a/drivers/net/hns3/hns3_ethdev.c
 +++ b/drivers/net/hns3/hns3_ethdev.c
-@@ -3649,7 +3649,7 @@ hns3_cmd_set_promisc_mode(struct hns3_hw *hw, struct hns3_promisc_param *param)
+@@ -3524,7 +3524,7 @@ hns3_cmd_set_promisc_mode(struct hns3_hw *hw, struct hns3_promisc_param *param)
  
  	ret = hns3_cmd_send(hw, &desc, 1);
  	if (ret)
@@ -29,12 +30,12 @@
  
  	return ret;
  }
-@@ -3702,14 +3702,14 @@ hns3_dev_promiscuous_enable(struct rte_eth_dev *dev)
+@@ -3577,14 +3577,14 @@ hns3_dev_promiscuous_enable(struct rte_eth_dev *dev)
  {
  	struct hns3_adapter *hns = dev->data->dev_private;
  	struct hns3_hw *hw = &hns->hw;
 -	bool en_mc_pmc = (dev->data->all_multicast == 1) ? true : false;
- 	int ret;
+ 	int ret = 0;
  
  	rte_spinlock_lock(&hw->lock);
 -	ret = hns3_set_promisc_mode(hw, true, en_mc_pmc);
@@ -47,7 +48,7 @@
  
  	return ret;
  }
-@@ -3717,17 +3717,18 @@ hns3_dev_promiscuous_enable(struct rte_eth_dev *dev)
+@@ -3592,17 +3592,18 @@ hns3_dev_promiscuous_enable(struct rte_eth_dev *dev)
  static int
  hns3_dev_promiscuous_disable(struct rte_eth_dev *dev)
  {
@@ -55,7 +56,7 @@
  	struct hns3_adapter *hns = dev->data->dev_private;
  	struct hns3_hw *hw = &hns->hw;
 -	bool en_mc_pmc = (dev->data->all_multicast == 1) ? true : false;
- 	int ret;
+ 	int ret = 0;
  
  	/* If now in all_multicast mode, must remain in all_multicast mode. */
  	rte_spinlock_lock(&hw->lock);
@@ -69,12 +70,12 @@
  
  	return ret;
  }
-@@ -3737,14 +3738,17 @@ hns3_dev_allmulticast_enable(struct rte_eth_dev *dev)
+@@ -3612,14 +3613,17 @@ hns3_dev_allmulticast_enable(struct rte_eth_dev *dev)
  {
  	struct hns3_adapter *hns = dev->data->dev_private;
  	struct hns3_hw *hw = &hns->hw;
 -	bool en_uc_pmc = (dev->data->promiscuous == 1) ? true : false;
- 	int ret;
+ 	int ret = 0;
  
 +	if (dev->data->promiscuous)
 +		return 0;
@@ -90,12 +91,12 @@
  
  	return ret;
  }
-@@ -3754,18 +3758,18 @@ hns3_dev_allmulticast_disable(struct rte_eth_dev *dev)
+@@ -3629,18 +3633,18 @@ hns3_dev_allmulticast_disable(struct rte_eth_dev *dev)
  {
  	struct hns3_adapter *hns = dev->data->dev_private;
  	struct hns3_hw *hw = &hns->hw;
 -	bool en_uc_pmc = (dev->data->promiscuous == 1) ? true : false;
- 	int ret;
+ 	int ret = 0;
  
  	/* If now in promiscuous mode, must remain in all_multicast mode. */
 -	if (dev->data->promiscuous == 1)
@@ -113,7 +114,7 @@
  
  	return ret;
  }
-@@ -3774,13 +3778,12 @@ static int
+@@ -3649,13 +3653,12 @@ static int
  hns3_dev_promisc_restore(struct hns3_adapter *hns)
  {
  	struct hns3_hw *hw = &hns->hw;


More information about the stable mailing list