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

Message ID 20231011092805.693171-33-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/sfc/sfc_ethdev.c | 3 +++
 drivers/net/sfc/sfc_rx.c     | 3 +++
 2 files changed, 6 insertions(+)
  

Patch

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)",