[dpdk-dev] [PATCH 5/5] net/hns3: fix key length when configuring RSS

Wei Hu (Xavier) xavier.huwei at huawei.com
Fri May 22 11:21:18 CEST 2020


From: Lijun Ou <oulijun at huawei.com>

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

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable at dpdk.org

Signed-off-by: Lijun Ou <oulijun at huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
---
 drivers/net/hns3/hns3_flow.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index aef301a..e3c2392 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -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(%lu)",
+			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)
-- 
2.7.4



More information about the dev mailing list