[dpdk-stable] patch 'net/hinic: fix setting promiscuous mode' has been queued to stable release 19.11.4

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 24 13:59:13 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 d4b56ad36f7a3a5d4d74e9ac1dcc9714feb2ec4b Mon Sep 17 00:00:00 2001
From: Xiaoyun Wang <cloud.wangxiaoyun at huawei.com>
Date: Sat, 27 Jun 2020 11:55:46 +0800
Subject: [PATCH] net/hinic: fix setting promiscuous mode

[ upstream commit 224cff4bbaa307c6b8e38478d9492af8463720dd ]

When setting promiscuous or allmulticast mode, increase
multi-thread resource protection, because the patch
"net/bonding: prefer allmulti to promiscuous for LACP"
adds trying to use allmulti when adding a slave, and
EVS bond driver also sets promisc with another thread,
which may lead to thread reentry and cause failure to
set promiscuous mode.

Fixes: cb7b6606ebff ("net/hinic: add RSS stats and promiscuous ops")

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun at huawei.com>
---
 drivers/net/hinic/hinic_pmd_ethdev.c | 34 ++++++++++++++++++++++++----
 drivers/net/hinic/hinic_pmd_ethdev.h |  1 +
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index b81ecd0b8..9aa3cf7aa 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -1269,14 +1269,25 @@ static void hinic_disable_interrupt(struct rte_eth_dev *dev)
 
 static int hinic_set_dev_promiscuous(struct hinic_nic_dev *nic_dev, bool enable)
 {
-	u32 rx_mode_ctrl = nic_dev->rx_mode_status;
+	u32 rx_mode_ctrl;
+	int err;
+
+	err = hinic_mutex_lock(&nic_dev->rx_mode_mutex);
+	if (err)
+		return err;
+
+	rx_mode_ctrl = nic_dev->rx_mode_status;
 
 	if (enable)
 		rx_mode_ctrl |= HINIC_RX_MODE_PROMISC;
 	else
 		rx_mode_ctrl &= (~HINIC_RX_MODE_PROMISC);
 
-	return hinic_config_rx_mode(nic_dev, rx_mode_ctrl);
+	err = hinic_config_rx_mode(nic_dev, rx_mode_ctrl);
+
+	(void)hinic_mutex_unlock(&nic_dev->rx_mode_mutex);
+
+	return err;
 }
 
 /**
@@ -1720,14 +1731,25 @@ static void hinic_remove_all_vlanid(struct rte_eth_dev *eth_dev)
 static int hinic_set_dev_allmulticast(struct hinic_nic_dev *nic_dev,
 				bool enable)
 {
-	u32 rx_mode_ctrl = nic_dev->rx_mode_status;
+	u32 rx_mode_ctrl;
+	int err;
+
+	err = hinic_mutex_lock(&nic_dev->rx_mode_mutex);
+	if (err)
+		return err;
+
+	rx_mode_ctrl = nic_dev->rx_mode_status;
 
 	if (enable)
 		rx_mode_ctrl |= HINIC_RX_MODE_MC_ALL;
 	else
 		rx_mode_ctrl &= (~HINIC_RX_MODE_MC_ALL);
 
-	return hinic_config_rx_mode(nic_dev, rx_mode_ctrl);
+	err = hinic_config_rx_mode(nic_dev, rx_mode_ctrl);
+
+	(void)hinic_mutex_unlock(&nic_dev->rx_mode_mutex);
+
+	return err;
 }
 
 /**
@@ -3034,6 +3056,8 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
 	}
 	hinic_set_bit(HINIC_DEV_INTR_EN, &nic_dev->dev_status);
 
+	hinic_mutex_init(&nic_dev->rx_mode_mutex, NULL);
+
 	/* initialize filter info */
 	filter_info = &nic_dev->filter;
 	memset(filter_info, 0, sizeof(struct hinic_filter_info));
@@ -3105,6 +3129,8 @@ static int hinic_dev_uninit(struct rte_eth_dev *dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	hinic_mutex_destroy(&nic_dev->rx_mode_mutex);
+
 	hinic_dev_close(dev);
 
 	dev->dev_ops = NULL;
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h
index 3e3f3b360..b7dc9640f 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.h
+++ b/drivers/net/hinic/hinic_pmd_ethdev.h
@@ -171,6 +171,7 @@ struct hinic_nic_dev {
 	unsigned int flags;
 	struct nic_service_cap nic_cap;
 	u32 rx_mode_status;	/* promisc or allmulticast */
+	pthread_mutex_t rx_mode_mutex;
 	unsigned long dev_status;
 
 	char proc_dev_name[HINIC_DEV_NAME_LEN];
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-07-24 12:53:52.975119716 +0100
+++ 0115-net-hinic-fix-setting-promiscuous-mode.patch	2020-07-24 12:53:48.383008248 +0100
@@ -1,8 +1,10 @@
-From 224cff4bbaa307c6b8e38478d9492af8463720dd Mon Sep 17 00:00:00 2001
+From d4b56ad36f7a3a5d4d74e9ac1dcc9714feb2ec4b Mon Sep 17 00:00:00 2001
 From: Xiaoyun Wang <cloud.wangxiaoyun at huawei.com>
 Date: Sat, 27 Jun 2020 11:55:46 +0800
 Subject: [PATCH] net/hinic: fix setting promiscuous mode
 
+[ upstream commit 224cff4bbaa307c6b8e38478d9492af8463720dd ]
+
 When setting promiscuous or allmulticast mode, increase
 multi-thread resource protection, because the patch
 "net/bonding: prefer allmulti to promiscuous for LACP"
@@ -12,7 +14,6 @@
 set promiscuous mode.
 
 Fixes: cb7b6606ebff ("net/hinic: add RSS stats and promiscuous ops")
-Cc: stable at dpdk.org
 
 Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun at huawei.com>
 ---
@@ -21,10 +22,10 @@
  2 files changed, 31 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
-index 8f81e2230..0d3d62bd0 100644
+index b81ecd0b8..9aa3cf7aa 100644
 --- a/drivers/net/hinic/hinic_pmd_ethdev.c
 +++ b/drivers/net/hinic/hinic_pmd_ethdev.c
-@@ -1268,14 +1268,25 @@ static void hinic_disable_interrupt(struct rte_eth_dev *dev)
+@@ -1269,14 +1269,25 @@ static void hinic_disable_interrupt(struct rte_eth_dev *dev)
  
  static int hinic_set_dev_promiscuous(struct hinic_nic_dev *nic_dev, bool enable)
  {
@@ -52,7 +53,7 @@
  }
  
  /**
-@@ -1728,14 +1739,25 @@ static void hinic_remove_all_vlanid(struct rte_eth_dev *eth_dev)
+@@ -1720,14 +1731,25 @@ static void hinic_remove_all_vlanid(struct rte_eth_dev *eth_dev)
  static int hinic_set_dev_allmulticast(struct hinic_nic_dev *nic_dev,
  				bool enable)
  {
@@ -80,16 +81,16 @@
  }
  
  /**
-@@ -3127,6 +3149,8 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
+@@ -3034,6 +3056,8 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
  	}
- 	rte_bit_relaxed_set32(HINIC_DEV_INTR_EN, &nic_dev->dev_status);
+ 	hinic_set_bit(HINIC_DEV_INTR_EN, &nic_dev->dev_status);
  
 +	hinic_mutex_init(&nic_dev->rx_mode_mutex, NULL);
 +
  	/* initialize filter info */
  	filter_info = &nic_dev->filter;
- 	tcam_info = &nic_dev->tcam;
-@@ -3201,6 +3225,8 @@ static int hinic_dev_uninit(struct rte_eth_dev *dev)
+ 	memset(filter_info, 0, sizeof(struct hinic_filter_info));
+@@ -3105,6 +3129,8 @@ static int hinic_dev_uninit(struct rte_eth_dev *dev)
  	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
  		return 0;
  
@@ -99,15 +100,15 @@
  
  	dev->dev_ops = NULL;
 diff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h
-index 77b4b9109..3f2d51d75 100644
+index 3e3f3b360..b7dc9640f 100644
 --- a/drivers/net/hinic/hinic_pmd_ethdev.h
 +++ b/drivers/net/hinic/hinic_pmd_ethdev.h
-@@ -329,6 +329,7 @@ struct hinic_nic_dev {
+@@ -171,6 +171,7 @@ struct hinic_nic_dev {
  	unsigned int flags;
  	struct nic_service_cap nic_cap;
  	u32 rx_mode_status;	/* promisc or allmulticast */
 +	pthread_mutex_t rx_mode_mutex;
- 	u32 dev_status;
+ 	unsigned long dev_status;
  
  	char proc_dev_name[HINIC_DEV_NAME_LEN];
 -- 


More information about the stable mailing list