]> git.droids-corp.org - dpdk.git/commitdiff
net/iavf: fix flow API error logs
authorJeff Guo <jia.guo@intel.com>
Fri, 8 May 2020 20:58:30 +0000 (16:58 -0400)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 11 May 2020 20:27:39 +0000 (22:27 +0200)
When processing a rte flow, such as creating a parse engine, or
creating or destroying a RSS rule, if they are failed, they all
need to construct the flow error structure before return the error
message back to app. If not so, it will cause app crash when
app printing the message out of a flow error.

Fixes: 7be10c3004be ("net/iavf: add RSS configuration for VF")
Fixes: ff2d0c345c3b ("net/iavf: support generic flow API")
Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/iavf/iavf_generic_flow.c
drivers/net/iavf/iavf_hash.c

index 8c66ac8f2986f505f8aeb070299059889338c61e..c0c67d0c7876766a24d1cf676848d069dbc43eba 100644 (file)
@@ -866,14 +866,18 @@ iavf_flow_process_filter(struct rte_eth_dev *dev,
 
        *engine = iavf_parse_engine(ad, flow, &vf->rss_parser_list, pattern,
                                    actions, error);
-       if (*engine != NULL)
+       if (*engine)
                return 0;
 
        *engine = iavf_parse_engine(ad, flow, &vf->dist_parser_list, pattern,
                                    actions, error);
 
-       if (*engine == NULL)
-               return -EINVAL;
+       if (!*engine) {
+               rte_flow_error_set(error, EINVAL,
+                                  RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+                                  "Failed to create parser engine.");
+               return -rte_errno;
+       }
 
        return 0;
 }
index d66b196dbabc8d220971a699b5699a8e56f24c84..6359ead7642072c5b04a7888a36bddf9ba1dbce1 100644 (file)
@@ -1133,7 +1133,11 @@ iavf_hash_create(__rte_unused struct iavf_adapter *ad,
                flow->rule = rss_cfg;
        } else {
                PMD_DRV_LOG(ERR, "fail to add RSS configure");
+               rte_flow_error_set(error, -ret,
+                                  RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+                                  "Failed to add rss rule.");
                rte_free(rss_cfg);
+               return -rte_errno;
        }
 
        rte_free(meta);
@@ -1152,9 +1156,13 @@ iavf_hash_destroy(__rte_unused struct iavf_adapter *ad,
        rss_cfg = (struct virtchnl_rss_cfg *)flow->rule;
 
        ret = iavf_add_del_rss_cfg(ad, rss_cfg, false);
-       if (ret)
+       if (ret) {
                PMD_DRV_LOG(ERR, "fail to del RSS configure");
-
+               rte_flow_error_set(error, -ret,
+                                  RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+                                  "Failed to delete rss rule.");
+               return -rte_errno;
+       }
        return ret;
 }