[PATCH v5 33/40] net/tap: check RSS hash algorithms

Jie Hai haijie1 at huawei.com
Wed Oct 11 11:27:58 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/tap/rte_eth_tap.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index b25a52655fa2..5e4813637f0b 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1038,6 +1038,10 @@ tap_dev_configure(struct rte_eth_dev *dev)
 	TAP_LOG(INFO, "%s: %s: RX configured queues number: %u",
 		dev->device->name, pmd->name, dev->data->nb_rx_queues);
 
+	if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+	    RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	return 0;
 }
 
@@ -1894,6 +1898,10 @@ tap_rss_hash_update(struct rte_eth_dev *dev,
 		rte_errno = EINVAL;
 		return -rte_errno;
 	}
+	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT) {
+		rte_errno = EINVAL;
+		return -rte_errno;
+	}
 	if (rss_conf->rss_key && rss_conf->rss_key_len) {
 		/*
 		 * Currently TAP RSS key is hard coded
-- 
2.30.0



More information about the dev mailing list