patch 'net/hns3: fix config struct used for conversion' has been queued to stable release 20.11.8

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Feb 23 10:36:50 CET 2023


Hi,

FYI, your patch has been queued to stable release 20.11.8

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

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/9c4a8738cdbb4117b9f680815fc613f6850cedaa

Thanks.

Luca Boccassi

---
>From 9c4a8738cdbb4117b9f680815fc613f6850cedaa Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong at huawei.com>
Date: Tue, 31 Jan 2023 21:02:59 +0800
Subject: [PATCH] net/hns3: fix config struct used for conversion

[ upstream commit 815c7db53167f7ee1573dca18fa7f889e44764d4 ]

When the type in 'struct rte_flow_action' is RTE_FLOW_ACTION_TYPE_RSS,
the 'conf' pointer references the 'struct rte_flow_action_rss' instead
of the 'struct hns3_rss_conf' in driver. But driver uses 'struct
hns3_rss_conf' to convert this 'conf' pointer to get RSS action
configuration.

In addition, RSS filter configuration is directly cloned to RSS filter
node instead of coping it after successfully setting to hardware.

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

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 0b4add5e80..a0d292db00 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -94,8 +94,8 @@ static const struct rte_flow_action *
 hns3_find_rss_general_action(const struct rte_flow_item pattern[],
 			     const struct rte_flow_action actions[])
 {
+	const struct rte_flow_action_rss *rss_act;
 	const struct rte_flow_action *act = NULL;
-	const struct hns3_rss_conf *rss;
 	bool have_eth = false;
 
 	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
@@ -114,8 +114,8 @@ hns3_find_rss_general_action(const struct rte_flow_item pattern[],
 		}
 	}
 
-	rss = act->conf;
-	if (have_eth && rss->conf.queue_num) {
+	rss_act = act->conf;
+	if (have_eth && rss_act->queue_num) {
 		/*
 		 * Pattern have ETH and action's queue_num > 0, indicate this is
 		 * queue region configuration.
@@ -1275,30 +1275,6 @@ hns3_action_rss_same(const struct rte_flow_action_rss *comp,
 			sizeof(*with->queue) * with->queue_num));
 }
 
-static int
-hns3_rss_conf_copy(struct hns3_rss_conf *out,
-		   const struct rte_flow_action_rss *in)
-{
-	if (in->key_len > RTE_DIM(out->key) ||
-	    in->queue_num > RTE_DIM(out->queue))
-		return -EINVAL;
-	if (in->key == NULL && in->key_len)
-		return -EINVAL;
-	out->conf = (struct rte_flow_action_rss) {
-		.func = in->func,
-		.level = in->level,
-		.types = in->types,
-		.key_len = in->key_len,
-		.queue_num = in->queue_num,
-	};
-	out->conf.queue = memcpy(out->queue, in->queue,
-				sizeof(*in->queue) * in->queue_num);
-	if (in->key)
-		out->conf.key = memcpy(out->key, in->key, in->key_len);
-
-	return 0;
-}
-
 /*
  * This function is used to parse rss action validation.
  */
@@ -1702,9 +1678,10 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev,
 			  struct rte_flow *flow)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	const struct rte_flow_action_rss *rss_act;
 	struct hns3_rss_conf_ele *rss_filter_ptr;
 	struct hns3_rss_conf_ele *filter_ptr;
-	const struct hns3_rss_conf *rss_conf;
+	struct hns3_rss_conf *new_conf;
 	int ret;
 
 	rss_filter_ptr = rte_zmalloc("hns3 rss filter",
@@ -1714,19 +1691,27 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
-	/*
-	 * After all the preceding tasks are successfully configured, configure
-	 * rules to the hardware to simplify the rollback of rules in the
-	 * hardware.
-	 */
-	rss_conf = (const struct hns3_rss_conf *)act->conf;
-	ret = hns3_flow_parse_rss(dev, rss_conf, true);
+	rss_act = (const struct rte_flow_action_rss *)act->conf;
+	new_conf = &rss_filter_ptr->filter_info;
+	memcpy(&new_conf->conf, rss_act, sizeof(*rss_act));
+	if (rss_act->queue_num > 0) {
+		memcpy(new_conf->queue, rss_act->queue,
+		       rss_act->queue_num * sizeof(new_conf->queue[0]));
+		new_conf->conf.queue = new_conf->queue;
+	}
+	if (rss_act->key_len > 0) {
+		if (rss_act->key != NULL) {
+			memcpy(new_conf->key, rss_act->key,
+			       rss_act->key_len * sizeof(new_conf->key[0]));
+			new_conf->conf.key = new_conf->key;
+		}
+	}
+
+	ret = hns3_flow_parse_rss(dev, new_conf, true);
 	if (ret != 0) {
 		rte_free(rss_filter_ptr);
 		return ret;
 	}
-
-	hns3_rss_conf_copy(&rss_filter_ptr->filter_info, &rss_conf->conf);
 	rss_filter_ptr->filter_info.valid = true;
 
 	/*
-- 
2.39.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-02-23 09:36:30.067838505 +0000
+++ 0046-net-hns3-fix-config-struct-used-for-conversion.patch	2023-02-23 09:36:28.278170898 +0000
@@ -1 +1 @@
-From 815c7db53167f7ee1573dca18fa7f889e44764d4 Mon Sep 17 00:00:00 2001
+From 9c4a8738cdbb4117b9f680815fc613f6850cedaa Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 815c7db53167f7ee1573dca18fa7f889e44764d4 ]
+
@@ -16 +17,0 @@
-Cc: stable at dpdk.org
@@ -25 +26 @@
-index 632247b846..dd762c02cb 100644
+index 0b4add5e80..a0d292db00 100644
@@ -28 +29 @@
-@@ -95,8 +95,8 @@ static const struct rte_flow_action *
+@@ -94,8 +94,8 @@ static const struct rte_flow_action *
@@ -38 +39 @@
-@@ -115,8 +115,8 @@ hns3_find_rss_general_action(const struct rte_flow_item pattern[],
+@@ -114,8 +114,8 @@ hns3_find_rss_general_action(const struct rte_flow_item pattern[],
@@ -49 +50 @@
-@@ -1296,30 +1296,6 @@ hns3_action_rss_same(const struct rte_flow_action_rss *comp,
+@@ -1275,30 +1275,6 @@ hns3_action_rss_same(const struct rte_flow_action_rss *comp,
@@ -77,4 +78,4 @@
- static bool
- hns3_rss_input_tuple_supported(struct hns3_hw *hw,
- 			       const struct rte_flow_action_rss *rss)
-@@ -1733,9 +1709,10 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev,
+ /*
+  * This function is used to parse rss action validation.
+  */
+@@ -1702,9 +1678,10 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev,
@@ -92 +93 @@
-@@ -1745,19 +1722,27 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev,
+@@ -1714,19 +1691,27 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev,


More information about the stable mailing list