DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jeff Guo <jia.guo@intel.com>
To: beilei.xing@intel.com, xiaolong.ye@intel.com,
	qiming.yang@intel.com, jingjing.wu@intel.com
Cc: qi.z.zhang@intel.com, dev@dpdk.org, wenzhuo.lu@intel.com,
	jia.guo@intel.com
Subject: [dpdk-dev] [PATCH] net/iavf: fix rte flow error log issue
Date: Fri,  8 May 2020 16:58:30 -0400	[thread overview]
Message-ID: <20200508205830.52437-1-jia.guo@intel.com> (raw)

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>
---
 drivers/net/iavf/iavf_generic_flow.c | 10 +++++++---
 drivers/net/iavf/iavf_hash.c         | 12 ++++++++++--
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/net/iavf/iavf_generic_flow.c b/drivers/net/iavf/iavf_generic_flow.c
index bca1ffeb3..64695f246 100644
--- a/drivers/net/iavf/iavf_generic_flow.c
+++ b/drivers/net/iavf/iavf_generic_flow.c
@@ -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;
 }
diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 97370aa19..8263a663b 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -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;
 }
 
-- 
2.20.1


             reply	other threads:[~2020-05-08  8:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 20:58 Jeff Guo [this message]
2020-05-09  6:21 ` Zhang, Qi Z
2020-05-11  2:53   ` Ye Xiaolong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200508205830.52437-1-jia.guo@intel.com \
    --to=jia.guo@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=wenzhuo.lu@intel.com \
    --cc=xiaolong.ye@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).