[v5,34/40] net/thunderx: check RSS hash algorithms

Message ID 20231011092805.693171-35-haijie1@huawei.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series support setting and querying RSS algorithms |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jie Hai Oct. 11, 2023, 9:27 a.m. UTC
  A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.

Signed-off-by: Jie Hai <haijie1@huawei.com>
---
 drivers/net/thunderx/nicvf_ethdev.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index ab1e714d9767..2fc54c521c88 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -621,6 +621,9 @@  nicvf_dev_rss_hash_update(struct rte_eth_dev *dev,
 	struct nicvf *nic = nicvf_pmd_priv(dev);
 	uint64_t nic_rss;
 
+	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	if (rss_conf->rss_key &&
 		rss_conf->rss_key_len != RSS_HASH_KEY_BYTE_SIZE) {
 		PMD_DRV_LOG(ERR, "Hash key size mismatch %u",
@@ -1984,8 +1987,13 @@  nicvf_dev_configure(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+	if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
+		if (conf->rx_adv_conf.rss_conf.algorithm !=
+		    RTE_ETH_HASH_FUNCTION_DEFAULT)
+			return -EINVAL;
+
 		rxmode->offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+	}
 
 	if (!rte_eal_has_hugepages()) {
 		PMD_INIT_LOG(INFO, "Huge page is not configured");