[PATCH v5 32/40] net/sfc: check RSS hash algorithms

Jie Hai haijie1 at huawei.com
Wed Oct 11 11:27:57 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/sfc/sfc_ethdev.c | 3 +++
 drivers/net/sfc/sfc_rx.c     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 1efe64a36a7f..19d7761e2664 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1728,6 +1728,9 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev,
 			goto fail_scale_mode_set;
 	}
 
+	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	if (rss_conf->rss_key != NULL) {
 		if (sa->state == SFC_ETHDEV_STARTED) {
 			for (key_i = 0; key_i < n_contexts; key_i++) {
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 1dde2c111001..71c151a07162 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -1519,6 +1519,9 @@ sfc_rx_process_adv_conf_rss(struct sfc_adapter *sa,
 			return rc;
 	}
 
+	if (conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	if (conf->rss_key != NULL) {
 		if (conf->rss_key_len != sizeof(rss->key)) {
 			sfc_err(sa, "RSS key size is wrong (should be %zu)",
-- 
2.30.0



More information about the dev mailing list