patch 'net/hns3: fix lock protection of RSS flow rule' has been queued to stable release 20.11.7

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Nov 3 10:27:36 CET 2022


Hi,

FYI, your patch has been queued to stable release 20.11.7

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/05/22. 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.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/3b9e0dd592b126d3939ef636ae7277e0d5f7f352

Thanks.

Luca Boccassi

---
>From 3b9e0dd592b126d3939ef636ae7277e0d5f7f352 Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong at huawei.com>
Date: Fri, 30 Sep 2022 15:22:04 +0800
Subject: [PATCH] net/hns3: fix lock protection of RSS flow rule

[ upstream commit a35799625e6849151f7d7bae312e300f8d5c2675 ]

RSS flow rules are saved in RSS filter linked list. The linked
list is modified by rte_flow API and is used to restore RSS rules
during reset process. So this patch uses 'hw->flows_lock' to protect
the configuration and recovery of RSS rule.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")

Signed-off-by: Huisong Li <lihuisong at huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3 at huawei.com>
---
 drivers/net/hns3/hns3_flow.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index d1486175cc..6cb935cf0b 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1565,24 +1565,20 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
 		hns3_warn(hw, "Config queue numbers %u are beyond the scope of truncated",
 			  rss_flow_conf.queue_num);
 	hns3_info(hw, "Max of contiguous %u PF queues are configured", num);
-
-	rte_spinlock_lock(&hw->lock);
 	if (num) {
 		ret = hns3_update_indir_table(dev, &rss_flow_conf, num);
 		if (ret)
-			goto rss_config_err;
+			return ret;
 	}
 
 	/* Set hash algorithm and flow types by the user's config */
 	ret = hns3_hw_rss_hash_set(hw, &rss_flow_conf);
 	if (ret)
-		goto rss_config_err;
+		return ret;
 
 	ret = hns3_rss_conf_copy(rss_info, &rss_flow_conf);
-	if (ret) {
+	if (ret)
 		hns3_err(hw, "RSS config init fail(%d)", ret);
-		goto rss_config_err;
-	}
 
 	/*
 	 * When create a new RSS rule, the old rule will be overlaid and set
@@ -1591,9 +1587,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
 	TAILQ_FOREACH(rss_filter_ptr, &hw->flow_rss_list, entries)
 		rss_filter_ptr->filter_info.valid = false;
 
-rss_config_err:
-	rte_spinlock_unlock(&hw->lock);
-
 	return ret;
 }
 
@@ -1638,6 +1631,7 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev)
 	struct hns3_hw *hw = &hns->hw;
 	int ret = 0;
 
+	pthread_mutex_lock(&hw->flows_lock);
 	TAILQ_FOREACH(filter, &hw->flow_rss_list, entries) {
 		if (!filter->filter_info.valid)
 			continue;
@@ -1650,6 +1644,8 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev)
 	}
 
 out:
+	pthread_mutex_unlock(&hw->flows_lock);
+
 	return ret;
 }
 
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-11-03 09:27:30.070406727 +0000
+++ 0078-net-hns3-fix-lock-protection-of-RSS-flow-rule.patch	2022-11-03 09:27:25.517425228 +0000
@@ -1 +1 @@
-From a35799625e6849151f7d7bae312e300f8d5c2675 Mon Sep 17 00:00:00 2001
+From 3b9e0dd592b126d3939ef636ae7277e0d5f7f352 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit a35799625e6849151f7d7bae312e300f8d5c2675 ]
+
@@ -12 +13,0 @@
-Cc: stable at dpdk.org
@@ -21 +22 @@
-index 2fb83f756a..162a48e590 100644
+index d1486175cc..6cb935cf0b 100644
@@ -24 +25 @@
-@@ -1596,27 +1596,20 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
+@@ -1565,24 +1565,20 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
@@ -49 +50,7 @@
--
+ 
+ 	/*
+ 	 * When create a new RSS rule, the old rule will be overlaid and set
+@@ -1591,9 +1587,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
+ 	TAILQ_FOREACH(rss_filter_ptr, &hw->flow_rss_list, entries)
+ 		rss_filter_ptr->filter_info.valid = false;
+ 
@@ -52 +59 @@
- 
+-
@@ -55 +62,2 @@
-@@ -1661,6 +1654,7 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev)
+ 
+@@ -1638,6 +1631,7 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev)
@@ -63 +71 @@
-@@ -1673,6 +1667,8 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev)
+@@ -1650,6 +1644,8 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev)


More information about the stable mailing list