summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorVenkat Duvvuru <venkatkumar.duvvuru@broadcom.com>2019-10-02 16:25:55 -0700
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-08 12:14:31 +0200
commit91aee9711ee31828112eb941c0271924d2f1071a (patch)
treee2d355ec5269d36e6abbcc683df761572e7c2667 /drivers/net
parent9be7bc29b36c6f9b5ea9919f0f104605d3cbfbc3 (diff)
downloaddpdk-91aee9711ee31828112eb941c0271924d2f1071a.zip
dpdk-91aee9711ee31828112eb941c0271924d2f1071a.tar.gz
dpdk-91aee9711ee31828112eb941c0271924d2f1071a.tar.xz
net/bnxt: validate RSS hash key length
In bnxt_rss_hash_update_op, driver is proceeding with bnxt_hwrm_vnic_rss_cfg even though RSS hashkey length is invalid. This patch fixes the problem by returning -EINVAL when RSS hashkey length is invalid. Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com> Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com> Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bnxt/bnxt_ethdev.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 2c9eaaa..354fa4c 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1373,14 +1373,20 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
vnic->hash_type = bnxt_rte_to_hwrm_hash_types(rss_conf->rss_hf);
/*
- * Use the supplied key if the key length is
- * acceptable and the rss_key is not NULL
+ * If hashkey is not specified, use the previously configured
+ * hashkey
*/
- if (rss_conf->rss_key && rss_conf->rss_key_len <= HW_HASH_KEY_SIZE)
- memcpy(vnic->rss_hash_key,
- rss_conf->rss_key,
- rss_conf->rss_key_len);
+ if (!rss_conf->rss_key)
+ goto rss_config;
+ if (rss_conf->rss_key_len != HW_HASH_KEY_SIZE) {
+ PMD_DRV_LOG(ERR,
+ "Invalid hashkey length, should be 16 bytes\n");
+ return -EINVAL;
+ }
+ memcpy(vnic->rss_hash_key, rss_conf->rss_key, rss_conf->rss_key_len);
+
+rss_config:
bnxt_hwrm_vnic_rss_cfg(bp, vnic);
return 0;
}