[PATCH v5 06/40] net/bnxt: check RSS hash algorithms

Jie Hai haijie1 at huawei.com
Wed Oct 11 11:27:31 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/bnxt/bnxt_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index ee1552452a11..92ce05b26dc7 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1166,6 +1166,9 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 		rx_offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
 	eth_dev->data->dev_conf.rxmode.offloads = rx_offloads;
 
+	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	/* application provides the hash key to program */
 	if (rss_conf->rss_key != NULL) {
 		if (rss_conf->rss_key_len != HW_HASH_KEY_SIZE)
@@ -2168,6 +2171,9 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 			return -EINVAL;
 	}
 
+	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	/* Update the default RSS VNIC(s) */
 	vnic = bnxt_get_default_vnic(bp);
 	vnic->hash_type = bnxt_rte_to_hwrm_hash_types(rss_conf->rss_hf);
-- 
2.30.0



More information about the dev mailing list