[v5,06/40] net/bnxt: check RSS hash algorithms
Checks
Commit Message
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/bnxt/bnxt_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
@@ -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);