[v5,18/40] net/iavf: check RSS hash algorithms

Message ID 20231011092805.693171-19-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/iavf/iavf_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Patch

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index f2fc5a56216d..9d6950d462a6 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -523,6 +523,9 @@  iavf_init_rss(struct iavf_adapter *adapter)
 		return -ENOTSUP;
 	}
 
+	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	/* configure RSS key */
 	if (!rss_conf->rss_key) {
 		/* Calculate the default hash key */
@@ -1588,6 +1591,9 @@  iavf_dev_rss_hash_update(struct rte_eth_dev *dev,
 	if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF))
 		return -ENOTSUP;
 
+	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	/* Set hash key. */
 	ret = iavf_set_rss_key(adapter, rss_conf->rss_key,
 			       rss_conf->rss_key_len);