[v5,17/40] net/i40e: check RSS hash algorithms

Message ID 20231011092805.693171-18-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/i40e/i40e_ethdev.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 50ba9aac9498..fcd6d4eb0495 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -7749,6 +7749,9 @@  i40e_dev_rss_hash_update(struct rte_eth_dev *dev,
 	if (rss_hf == 0) /* Disable RSS */
 		return -EINVAL;
 
+	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	return i40e_hw_rss_hash_set(pf, rss_conf);
 }
 
@@ -8986,6 +8989,10 @@  i40e_pf_config_rss(struct i40e_pf *pf)
 	    !(mq_mode & RTE_ETH_MQ_RX_RSS_FLAG))
 		return 0;
 
+	if (pf->dev_data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+	    RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	hw = I40E_PF_TO_HW(pf);
 	hena = i40e_config_hena(pf->adapter, rss_hf);
 	i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (uint32_t)hena);