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 10/17] net/hns3: separate setting RSS types
Date: Tue, 21 Mar 2023 17:22:59 +0800	[thread overview]
Message-ID: <20230321092306.16918-11-lihuisong@huawei.com> (raw)
In-Reply-To: <20230321092306.16918-1-lihuisong@huawei.com>

[ upstream commit 791e56935e488b8154a83daaf3952e1901ed7552 ]

The settings of RSS types comes from the ethdev ops (like, dev_configure
and rss_hash_update) and rte_flow API. For the ethdev ops, driver has to
save it so as to it can be restored when reset is triggered.
While rte_flow API no need to maintain this field, it can be restored by
the saved rule.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
 drivers/net/hns3/hns3_flow.c |  3 ++-
 drivers/net/hns3/hns3_rss.c  | 22 ++++++++++++++--------
 drivers/net/hns3/hns3_rss.h  |  1 +
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 2ead9b3a48..512ad6066d 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1386,6 +1386,7 @@ hns3_disable_rss(struct hns3_hw *hw)
 	ret = hns3_set_rss_tuple_by_rss_hf(hw, 0);
 	if (ret)
 		return ret;
+	hw->rss_info.rss_hf = 0;
 
 	return 0;
 }
@@ -1534,7 +1535,7 @@ hns3_config_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf)
 	/* Filter the unsupported flow types */
 	flow_types = conf->conf.types ?
 		     rss_flow_conf.types & HNS3_ETH_RSS_SUPPORT :
-		     hw->rss_info.conf.types;
+		     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,
diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index bc78bcbb94..f140a6a2ca 100644
--- a/drivers/net/hns3/hns3_rss.c
+++ b/drivers/net/hns3/hns3_rss.c
@@ -628,9 +628,6 @@ hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf)
 		return ret;
 	}
 
-	/* Update supported flow types when set tuple success */
-	hw->rss_info.conf.types = rss_hf;
-
 	return 0;
 }
 
@@ -648,7 +645,7 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
 			 struct rte_eth_rss_conf *rss_conf)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	uint64_t rss_hf_bk = hw->rss_info.conf.types;
+	uint64_t rss_hf_bk = hw->rss_info.rss_hf;
 	uint8_t key_len = rss_conf->rss_key_len;
 	uint64_t rss_hf = rss_conf->rss_hf;
 	uint8_t *key = rss_conf->rss_key;
@@ -673,6 +670,7 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
 		/* Update the shadow RSS key with user specified */
 		memcpy(hw->rss_info.key, key, hw->rss_key_size);
 	}
+	hw->rss_info.rss_hf = rss_hf;
 	rte_spinlock_unlock(&hw->lock);
 
 	return 0;
@@ -1030,6 +1028,7 @@ hns3_rss_set_default_args(struct hns3_hw *hw)
 	/* Default hash algorithm */
 	rss_cfg->hash_algo = HNS3_RSS_HASH_ALGO_TOEPLITZ;
 
+	hw->rss_info.rss_hf = 0;
 	memcpy(rss_cfg->key, hns3_hash_key,
 		RTE_MIN(sizeof(hns3_hash_key), hw->rss_key_size));
 
@@ -1067,15 +1066,22 @@ hns3_config_rss(struct hns3_adapter *hns)
 		return ret;
 
 	/*
-	 * When muli-queue RSS mode flag is not set or unsupported tuples are
+	 * When multi-queue RSS mode flag is not set or unsupported tuples are
 	 * set, disable all tuples.
 	 */
-	rss_hf = hw->rss_info.conf.types;
+	rss_hf = hw->rss_info.rss_hf;
 	if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) ||
 	    !(rss_hf & HNS3_ETH_RSS_SUPPORT))
 		rss_hf = 0;
 
-	return hns3_set_rss_tuple_by_rss_hf(hw, rss_hf);
+	ret = hns3_set_rss_tuple_by_rss_hf(hw, rss_hf);
+	if (ret != 0) {
+		hns3_err(hw, "set RSS tuples failed, ret = %d.", ret);
+		return ret;
+	}
+	hw->rss_info.rss_hf = rss_hf;
+
+	return 0;
 }
 
 /*
@@ -1093,5 +1099,5 @@ hns3_rss_uninit(struct hns3_adapter *hns)
 		return;
 
 	/* Disable RSS */
-	hw->rss_info.conf.types = 0;
+	hw->rss_info.rss_hf = 0;
 }
diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h
index 7f47cc243c..48c535ed3f 100644
--- a/drivers/net/hns3/hns3_rss.h
+++ b/drivers/net/hns3/hns3_rss.h
@@ -44,6 +44,7 @@ struct hns3_rss_tuple_cfg {
 struct hns3_rss_conf {
 	/* RSS parameters :algorithm, flow_types,  key, queue */
 	struct rte_flow_action_rss conf;
+	uint64_t rss_hf;
 	uint8_t hash_algo; /* hash function type defined by hardware */
 	uint8_t rte_flow_hash_algo;
 	uint8_t key[HNS3_RSS_KEY_SIZE_MAX];  /* Hash key */
-- 
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 ` Huisong Li [this message]
2023-03-21  9:23 ` [PATCH 21.11 11/17] net/hns3: use new RSS rule to configure hardware Huisong Li
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-11-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).