[PATCH v5 30/40] net/null: check RSS hash algorithms

Jie Hai haijie1 at huawei.com
Wed Oct 11 11:27:55 CEST 2023


A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.

Signed-off-by: Jie Hai <haijie1 at huawei.com>
---
 drivers/net/null/rte_eth_null.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 31081af79752..8427d7484178 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -186,6 +186,11 @@ eth_null_copy_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 static int
 eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
 {
+	if ((dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) &&
+	     dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+	     RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	return 0;
 }
 
@@ -444,6 +449,9 @@ eth_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf)
 
 	rte_spinlock_lock(&internal->rss_lock);
 
+	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	if ((rss_conf->rss_hf & internal->flow_type_rss_offloads) != 0)
 		dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf =
 				rss_conf->rss_hf & internal->flow_type_rss_offloads;
-- 
2.30.0



More information about the dev mailing list