Skip to contentSkip to conversation

net/iavf: fix rte flow error log issue

PATCH Applied Jeff Guo 3 participants 3 messages May 8, 2020 – May 11, 2020 Network drivers

lore
Share & tools
lore

Jeff Guo

author
#0 lore raw

PATCH 1/1 net/iavf: fix rte flow error log issue

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")
---
 drivers/net/iavf/iavf_generic_flow.c | 10 +++++++---
 drivers/net/iavf/iavf_hash.c         | 12 ++++++++++--
 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/net/iavf/iavf_generic_flow.c +7 -3
index bca1ffeb3..64695f246 100644
@@ -868,14 +868,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;
 }
drivers/net/iavf/iavf_hash.c +10 -2
index 97370aa19..8263a663b 100644
@@ -1111,7 +1111,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);
@@ -1130,9 +1134,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;
 }
 
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines

-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Saturday, May 9, 2020 4:59 AM
To: Xing, Beilei <[email protected]>; Ye, Xiaolong <[email protected]>; Yang, Qiming <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Lu, Wenzhuo <[email protected]>; Guo, Jia <[email protected]>
Subject: [PATCH] net/iavf: fix rte flow error log issue

Quoted 8 lines

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")
Applied
#2 lore raw
Quoted 17 lines · Qi Z
Quoted 17 lines

-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Saturday, May 9, 2020 4:59 AM
To: Xing, Beilei <[email protected]>; Ye, Xiaolong <[email protected]>; Yang, Qiming <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Lu, Wenzhuo <[email protected]>; Guo, Jia <[email protected]>
Subject: [PATCH] net/iavf: fix rte flow error log issue

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.

Quoted 6 lines
Quoted 3 lines
Fixes 7be10c3004be ("net/iavf: add RSS configuration for VF")
Fixes ff2d0c345c3b ("net/iavf: support generic flow API")

Applied to dpdk-next-net-intel, Thanks.