From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: jianfeng.tan@intel.com
Subject: [dpdk-dev] [PATCH] eal: fix rte_errno values for IPC API
Date: Sat, 10 Feb 2018 13:15:15 +0000 [thread overview]
Message-ID: <46a01b34318bbc799a0911fbb166a592c34ffa66.1518267551.git.anatoly.burakov@intel.com> (raw)
rte_errno values should not be negative.
Fixes: bacaa2754017 ("eal: add channel for multi-process communication")
Fixes: 783b6e54971d ("eal: add synchronous multi-process communication")
Cc: jianfeng.tan@intel.com
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
Notes:
This is in DPDK coding style guide:
http://dpdk.org/doc/guides/contributing/coding_style.html
However, i should note that situation with this is a mess
in DPDK, and in a lot of cases, rte_errno is set to -errno.
lib/librte_eal/common/eal_common_proc.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index b974837..caa8774 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -131,16 +131,16 @@ validate_action_name(const char *name)
{
if (name == NULL) {
RTE_LOG(ERR, EAL, "Action name cannot be NULL\n");
- rte_errno = -EINVAL;
+ rte_errno = EINVAL;
return -1;
}
if (strnlen(name, RTE_MP_MAX_NAME_LEN) == 0) {
RTE_LOG(ERR, EAL, "Length of action name is zero\n");
- rte_errno = -EINVAL;
+ rte_errno = EINVAL;
return -1;
}
if (strnlen(name, RTE_MP_MAX_NAME_LEN) == RTE_MP_MAX_NAME_LEN) {
- rte_errno = -E2BIG;
+ rte_errno = E2BIG;
return -1;
}
return 0;
@@ -156,7 +156,7 @@ rte_mp_action_register(const char *name, rte_mp_t action)
entry = malloc(sizeof(struct action_entry));
if (entry == NULL) {
- rte_errno = -ENOMEM;
+ rte_errno = ENOMEM;
return -1;
}
strcpy(entry->action_name, name);
@@ -165,7 +165,7 @@ rte_mp_action_register(const char *name, rte_mp_t action)
pthread_mutex_lock(&mp_mutex_action);
if (find_action_entry_by_name(name) != NULL) {
pthread_mutex_unlock(&mp_mutex_action);
- rte_errno = -EEXIST;
+ rte_errno = EEXIST;
free(entry);
return -1;
}
@@ -505,7 +505,7 @@ check_input(const struct rte_mp_msg *msg)
{
if (msg == NULL) {
RTE_LOG(ERR, EAL, "Msg cannot be NULL\n");
- rte_errno = -EINVAL;
+ rte_errno = EINVAL;
return false;
}
@@ -514,14 +514,14 @@ check_input(const struct rte_mp_msg *msg)
if (msg->len_param > RTE_MP_MAX_PARAM_LEN) {
RTE_LOG(ERR, EAL, "Message data is too long\n");
- rte_errno = -E2BIG;
+ rte_errno = E2BIG;
return false;
}
if (msg->num_fds > RTE_MP_MAX_FD_NUM) {
RTE_LOG(ERR, EAL, "Cannot send more than %d FDs\n",
RTE_MP_MAX_FD_NUM);
- rte_errno = -E2BIG;
+ rte_errno = E2BIG;
return false;
}
@@ -560,7 +560,7 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
pthread_mutex_unlock(&sync_requests.lock);
if (exist) {
RTE_LOG(ERR, EAL, "A pending request %s:%s\n", dst, req->name);
- rte_errno = -EEXIST;
+ rte_errno = EEXIST;
return -1;
}
@@ -596,7 +596,7 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
if (sync_req.reply_received == 0) {
RTE_LOG(ERR, EAL, "Fail to recv reply for request %s:%s\n",
dst, req->name);
- rte_errno = -ETIMEDOUT;
+ rte_errno = ETIMEDOUT;
return -1;
}
@@ -604,7 +604,7 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
if (!tmp) {
RTE_LOG(ERR, EAL, "Fail to alloc reply for request %s:%s\n",
dst, req->name);
- rte_errno = -ENOMEM;
+ rte_errno = ENOMEM;
return -1;
}
memcpy(&tmp[reply->nb_received], &msg, sizeof(msg));
@@ -676,7 +676,7 @@ rte_mp_reply(struct rte_mp_msg *msg, const char *peer)
if (peer == NULL) {
RTE_LOG(ERR, EAL, "peer is not specified\n");
- rte_errno = -EINVAL;
+ rte_errno = EINVAL;
return -1;
}
--
2.7.4
next reply other threads:[~2018-02-10 13:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-10 13:15 Anatoly Burakov [this message]
2018-02-11 1:09 ` Tan, Jianfeng
2018-02-13 13:50 ` Thomas Monjalon
2018-02-13 14:16 ` Van Haaren, Harry
2018-02-13 14:25 ` Burakov, Anatoly
2018-02-13 15:39 ` Bruce Richardson
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=46a01b34318bbc799a0911fbb166a592c34ffa66.1518267551.git.anatoly.burakov@intel.com \
--to=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=jianfeng.tan@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).