]> git.droids-corp.org - dpdk.git/commitdiff
net/i40e: fix flow RSS return error
authorWei Zhao <wei.zhao1@intel.com>
Fri, 26 Jan 2018 08:46:51 +0000 (16:46 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 31 Jan 2018 19:57:29 +0000 (20:57 +0100)
This patch fixes issues reported by Coverity check. Function
parse_rss_action and i40e_config_rss_filter might return at wrong
time which will cause error for RSS configuration and parser. Hash
function variable with 32 bits width might also cause error when
it needs more than 32 bits, so change this variable to 64 bits.

Coverity issue: 257020, 257024, 257037
Fixes: ecad87d22383 ("net/i40e: move RSS to flow API")
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_flow.c

index 33cdf0cd57e60884f3c0a4cdd739691608d936a5..7e3d1a84a7e434b0840ca575e15d19c3f4873efd 100644 (file)
@@ -11713,7 +11713,7 @@ i40e_config_rss_filter(struct i40e_pf *pf,
                                                        sizeof(uint32_t);
        }
 
-       return i40e_hw_rss_hash_set(pf, &rss_conf);
+       i40e_hw_rss_hash_set(pf, &rss_conf);
 
        rte_memcpy(rss_info,
                conf, sizeof(struct i40e_rte_flow_rss_conf));
index 34661c8a7068ca4e7f6fc5a277510c3627ec3f8f..8bf1304d45430670da5df2bc4ddef8a7ab340e2e 100644 (file)
@@ -4177,6 +4177,7 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev,
        struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info;
        uint16_t i, j, n, tmp;
        uint32_t index = 0;
+       uint64_t hf_bit = 1;
 
        NEXT_ITEM_OF_ACTION(act, actions, index);
        rss = act->conf;
@@ -4195,7 +4196,7 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev,
 
        if (action_flag) {
                for (n = 0; n < 64; n++) {
-                       if (rss->rss_conf->rss_hf & (1 << n)) {
+                       if (rss->rss_conf->rss_hf & (hf_bit << n)) {
                                conf_info->region[0].hw_flowtype[0] = n;
                                conf_info->region[0].flowtype_num = 1;
                                conf_info->queue_region_number = 1;
@@ -4289,9 +4290,11 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev,
                }
 
                rss_config->queue_region_conf = TRUE;
-               return 0;
        }
 
+       if (rss_config->queue_region_conf)
+               return 0;
+
        if (!rss || !rss->num) {
                rte_flow_error_set(error, EINVAL,
                                RTE_FLOW_ERROR_TYPE_ACTION,