net/hns3: fix key length when configuring RSS

When users set the length of RSS hash key greater than the supported
length by hardware, the driver should intercept and can not configure
the wrong key into the hardware.

Fixes: c37ca66f2b ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
This commit is contained in:
Lijun Ou 2020-05-22 17:21:18 +08:00 committed by Ferruh Yigit
parent fdae939696
commit 40783b1280

View File

@ -1475,6 +1475,14 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
return -EINVAL;
}
if (rss_flow_conf.key_len &&
rss_flow_conf.key_len > RTE_DIM(rss_info->key)) {
hns3_err(hw,
"input hash key(%u) greater than supported len(%zu)",
rss_flow_conf.key_len, RTE_DIM(rss_info->key));
return -EINVAL;
}
/* Filter the unsupported flow types */
flow_types = rss_flow_conf.types & HNS3_ETH_RSS_SUPPORT;
if (flow_types != rss_flow_conf.types)