DPDK patches and discussions
 help / color / mirror / Atom feed
From: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
To: pbhagavatula@caviumnetworks.com, harry.van.haaren@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/1] eal: return true or false from lcore role check function
Date: Wed,  3 Jan 2018 12:43:35 -0600	[thread overview]
Message-ID: <1515005015-31990-2-git-send-email-erik.g.carrillo@intel.com> (raw)
In-Reply-To: <1515005015-31990-1-git-send-email-erik.g.carrillo@intel.com>

Update rte_lcore_has_role() so that it returns true/false instead of
success/failure.

Fixes: 78666372fa2b ("eal: add function to check lcore role")

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
---
 lib/librte_eal/common/eal_common_thread.c | 5 +----
 lib/librte_eal/common/include/rte_lcore.h | 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c
index 55e9696..28ee6d0 100644
--- a/lib/librte_eal/common/eal_common_thread.c
+++ b/lib/librte_eal/common/eal_common_thread.c
@@ -59,12 +59,9 @@ rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role)
 	struct rte_config *cfg = rte_eal_get_configuration();
 
 	if (lcore_id >= RTE_MAX_LCORE)
-		return -EINVAL;
-
-	if (cfg->lcore_role[lcore_id] == role)
 		return 0;
 
-	return -EINVAL;
+	return cfg->lcore_role[lcore_id] == role;
 }
 
 int eal_cpuset_socket_id(rte_cpuset_t *cpusetp)
diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
index c89e6ba..fba04f1 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -271,7 +271,7 @@ int rte_thread_setname(pthread_t id, const char *name);
  * @param role
  *   The role to be checked against.
  * @return
- *   On success, return 0; otherwise return a negative value.
+ *   True if the given core has the specified role; false otherwise.
  */
 int
 rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role);
-- 
2.6.4

  reply	other threads:[~2018-01-03 18:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 18:43 [dpdk-dev] [PATCH 0/1] " Erik Gabriel Carrillo
2018-01-03 18:43 ` Erik Gabriel Carrillo [this message]
2018-01-04  8:47   ` [dpdk-dev] [PATCH 1/1] " Pavan Nikhilesh
2018-01-09 16:44   ` Aaron Conole
2018-01-11 23:09     ` Carrillo, Erik G
2018-01-11 23:17       ` Thomas Monjalon
2018-01-12 18:01         ` Carrillo, Erik G
2018-01-12 18:04           ` Thomas Monjalon

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=1515005015-31990-2-git-send-email-erik.g.carrillo@intel.com \
    --to=erik.g.carrillo@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=pbhagavatula@caviumnetworks.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).