From: Gagandeep Singh <g.singh@nxp.com>
To: dev@dpdk.org, Sean Morrissey <sean.morrissey@intel.com>
Cc: stable@dpdk.org
Subject: [v2 2/3] examples/l3fwd: fix return value on rules add
Date: Tue, 6 Aug 2024 09:11:19 +0530 [thread overview]
Message-ID: <20240806034120.3165295-3-g.singh@nxp.com> (raw)
In-Reply-To: <20240806034120.3165295-1-g.singh@nxp.com>
fix return value on adding the EM or LPM rules.
Fixes: e7e6dd643092 ("examples/l3fwd: support config file for EM")
Fixes: 52def963fc1c ("examples/l3fwd: support config file for LPM/FIB")
Cc: sean.morrissey@intel.com
Cc: stable@dpdk.org
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
examples/l3fwd/em_route_parse.c | 11 ++++++-----
examples/l3fwd/lpm_route_parse.c | 11 ++++++-----
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/examples/l3fwd/em_route_parse.c b/examples/l3fwd/em_route_parse.c
index da23356dd6..8b534de5f1 100644
--- a/examples/l3fwd/em_route_parse.c
+++ b/examples/l3fwd/em_route_parse.c
@@ -119,7 +119,7 @@ em_add_rules(const char *rule_path,
char buff[LINE_MAX];
FILE *fh;
unsigned int i = 0, rule_size = sizeof(*next);
- int val;
+ int val, rc;
*proute_base = NULL;
fh = fopen(rule_path, "rb");
@@ -172,13 +172,14 @@ em_add_rules(const char *rule_path,
return -EINVAL;
}
- if (parser(buff + 1, next) != 0) {
+ rc = parser(buff + 1, next);
+ if (rc != 0) {
RTE_LOG(ERR, L3FWD,
- "%s Line %u: parse rules error\n",
- rule_path, i);
+ "%s Line %u: parse rules error code = %d\n",
+ rule_path, i, rc);
fclose(fh);
free(route_rules);
- return -EINVAL;
+ return rc;
}
route_cnt++;
diff --git a/examples/l3fwd/lpm_route_parse.c b/examples/l3fwd/lpm_route_parse.c
index f7d44aa2cd..f27b66e838 100644
--- a/examples/l3fwd/lpm_route_parse.c
+++ b/examples/l3fwd/lpm_route_parse.c
@@ -184,7 +184,7 @@ lpm_add_rules(const char *rule_path,
char buff[LINE_MAX];
FILE *fh;
unsigned int i = 0, rule_size = sizeof(*next);
- int val;
+ int val, rc;
*proute_base = NULL;
fh = fopen(rule_path, "rb");
@@ -237,13 +237,14 @@ lpm_add_rules(const char *rule_path,
return -EINVAL;
}
- if (parser(buff + 1, next) != 0) {
+ rc = parser(buff + 1, next);
+ if (rc != 0) {
RTE_LOG(ERR, L3FWD,
- "%s Line %u: parse rules error\n",
- rule_path, i);
+ "%s Line %u: parse rules error code = %d\n",
+ rule_path, i, rc);
fclose(fh);
free(route_rules);
- return -EINVAL;
+ return rc;
}
route_cnt++;
--
2.25.1
next prev parent reply other threads:[~2024-08-06 3:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 10:14 [PATCH 1/3] examples/l3fwd: support single route file Gagandeep Singh
2024-07-15 10:14 ` [PATCH 2/3] examples/l3fwd: fix return value on rules add Gagandeep Singh
2024-07-16 6:55 ` Hemant Agrawal
2024-07-15 10:14 ` [PATCH 3/3] examples/l3fwd: fix maximum acceptable port ID in routes Gagandeep Singh
2024-07-17 10:17 ` Konstantin Ananyev
2024-07-18 6:30 ` Gagandeep Singh
2024-07-18 10:01 ` Konstantin Ananyev
2024-07-22 3:28 ` Gagandeep Singh
2024-07-22 4:27 ` Gagandeep Singh
2024-07-23 16:22 ` Konstantin Ananyev
2024-07-24 8:02 ` Konstantin Ananyev
2024-08-02 10:13 ` Gagandeep Singh
2024-08-06 3:41 ` [v2 0/3] L3fwd changes Gagandeep Singh
2024-08-06 3:41 ` [v2 1/3] examples/l3fwd: support single route file Gagandeep Singh
2024-08-06 3:41 ` Gagandeep Singh [this message]
2024-08-06 3:41 ` [v2 3/3] examples/l3fwd: enhance valid ports checking Gagandeep Singh
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=20240806034120.3165295-3-g.singh@nxp.com \
--to=g.singh@nxp.com \
--cc=dev@dpdk.org \
--cc=sean.morrissey@intel.com \
--cc=stable@dpdk.org \
/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).