patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Huisong Li <lihuisong@huawei.com>
To: <stable@dpdk.org>, <ktraynor@redhat.com>
Cc: <liudongdong3@huawei.com>, <huangdaode@huawei.com>,
	<liuyonglong@huawei.com>, <lihuisong@huawei.com>
Subject: [PATCH 21.11 11/17] net/hns3: use new RSS rule to configure hardware
Date: Tue, 21 Mar 2023 17:23:00 +0800	[thread overview]
Message-ID: <20230321092306.16918-12-lihuisong@huawei.com> (raw)
In-Reply-To: <20230321092306.16918-1-lihuisong@huawei.com>

[ upstream commit 218a119a08e01f203f92b46334b6b2f03ff9765d ]

Remove redundant assignment and directly use new RSS rule to configure
hardware. Additionally, considering that the new rule configuration may
need to be modified, the 'const' of input parameter about it is removed.

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

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 512ad6066d..f51e1439eb 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1435,6 +1435,7 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config)
 {
 	uint8_t rss_key[HNS3_RSS_KEY_SIZE_MAX] = {0};
 	bool use_default_key = false;
+	uint64_t flow_types;
 	uint8_t hash_algo;
 	int ret;
 
@@ -1454,10 +1455,18 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config)
 				    hw->rss_key_size);
 	if (ret)
 		return ret;
-
 	hw->rss_info.rte_flow_hash_algo = hash_algo;
 
-	ret = hns3_set_rss_tuple_by_rss_hf(hw, rss_config->types);
+	/* Filter the unsupported flow types */
+	flow_types = rss_config->types ?
+		     rss_config->types & HNS3_ETH_RSS_SUPPORT :
+		     hw->rss_info.rss_hf;
+	if (flow_types != rss_config->types)
+		hns3_warn(hw, "modified RSS types based on hardware support,"
+			  " requested:0x%" PRIx64 " configured:0x%" PRIx64,
+			  rss_config->types, flow_types);
+
+	ret = hns3_set_rss_tuple_by_rss_hf(hw, flow_types);
 	if (ret)
 		hns3_err(hw, "Update RSS tuples by rss hf failed %d", ret);
 
@@ -1503,48 +1512,27 @@ hns3_reset_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf)
 }
 
 static int
-hns3_config_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf)
+hns3_config_rss_filter(struct hns3_hw *hw, struct hns3_rss_conf *conf)
 {
-	uint64_t flow_types;
+	struct rte_flow_action_rss *rss_act;
 	uint16_t num;
 	int ret;
 
-	struct rte_flow_action_rss rss_flow_conf = {
-		.func = conf->conf.func,
-		.level = conf->conf.level,
-		.types = conf->conf.types,
-		.key_len = conf->conf.key_len,
-		.queue_num = conf->conf.queue_num,
-		.key = conf->conf.key_len ?
-		    (void *)(uintptr_t)conf->conf.key : NULL,
-		.queue = conf->conf.queue,
-	};
-
+	rss_act = &conf->conf;
 	/* Set rx queues to use */
-	num = RTE_MIN(hw->data->nb_rx_queues, rss_flow_conf.queue_num);
-	if (rss_flow_conf.queue_num > num)
+	num = RTE_MIN(hw->data->nb_rx_queues, rss_act->queue_num);
+	if (rss_act->queue_num > num)
 		hns3_warn(hw, "Config queue numbers %u are beyond the scope of truncated",
-			  rss_flow_conf.queue_num);
+			  rss_act->queue_num);
 	hns3_info(hw, "Max of contiguous %u PF queues are configured", num);
 	if (num) {
-		ret = hns3_update_indir_table(hw, &rss_flow_conf, num);
+		ret = hns3_update_indir_table(hw, rss_act, num);
 		if (ret)
 			return ret;
 	}
 
-	/* Filter the unsupported flow types */
-	flow_types = conf->conf.types ?
-		     rss_flow_conf.types & HNS3_ETH_RSS_SUPPORT :
-		     hw->rss_info.rss_hf;
-	if (flow_types != rss_flow_conf.types)
-		hns3_warn(hw, "modified RSS types based on hardware support,"
-			  " requested:0x%" PRIx64 " configured:0x%" PRIx64,
-			  rss_flow_conf.types, flow_types);
-	/* Update the useful flow types */
-	rss_flow_conf.types = flow_types;
-
 	/* Set hash algorithm and flow types by the user's config */
-	return hns3_hw_rss_hash_set(hw, &rss_flow_conf);
+	return hns3_hw_rss_hash_set(hw, rss_act);
 }
 
 static int
@@ -1634,7 +1622,7 @@ hns3_rss_action_is_dup(struct hns3_hw *hw,
 }
 
 static int
-hns3_flow_parse_rss(struct rte_eth_dev *dev, const struct hns3_rss_conf *conf)
+hns3_flow_parse_rss(struct rte_eth_dev *dev, struct hns3_rss_conf *conf)
 {
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_hw *hw = &hns->hw;
-- 
2.22.0


  parent reply	other threads:[~2023-03-21  9:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21  9:22 [PATCH 21.11 00/17] backport some patches for hns3 Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 01/17] net/hns3: separate Tx prepare from getting Tx function Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 02/17] net/hns3: make getting Tx function static Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 03/17] net/hns3: fix RSS key size compatibility Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 04/17] net/hns3: fix burst mode query with dummy function Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 05/17] net/hns3: extract common functions to set Rx/Tx Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 06/17] net/hns3: use hardware config to report hash key Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 07/17] net/hns3: use hardware config to report hash types Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 08/17] net/hns3: separate setting hash algorithm Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 09/17] net/hns3: separate setting hash key Huisong Li
2023-03-21  9:22 ` [PATCH 21.11 10/17] net/hns3: separate setting RSS types Huisong Li
2023-03-21  9:23 ` Huisong Li [this message]
2023-03-21  9:23 ` [PATCH 21.11 12/17] net/hns3: save hash algo to RSS filter list node Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 13/17] net/hns3: remove unused structures Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 14/17] net/hns3: allow adding queue buffer size hash rule Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 15/17] net/hns3: separate flow RSS config from RSS conf Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 16/17] net/hns3: reimplement hash flow function Huisong Li
2023-03-21  9:23 ` [PATCH 21.11 17/17] net/hns3: add verification of RSS types Huisong Li
2023-03-21 16:21 ` [PATCH 21.11 00/17] backport some patches for hns3 Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230321092306.16918-12-lihuisong@huawei.com \
    --to=lihuisong@huawei.com \
    --cc=huangdaode@huawei.com \
    --cc=ktraynor@redhat.com \
    --cc=liudongdong3@huawei.com \
    --cc=liuyonglong@huawei.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).