DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/3] eal: increase scope of eal_thread_set_affinity
Date: Thu, 11 Sep 2014 15:23:06 +0100
Message-ID: <1410445387-4849-3-git-send-email-bruce.richardson@intel.com> (raw)
In-Reply-To: <1410445387-4849-1-git-send-email-bruce.richardson@intel.com>

This patch changes eal_thread_set_affinity to the EAL-local function
rte_eal_thread_set_affinity. This will allow us to use the function
anywhere else in the EAL, while not having it part of the official APIs

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_eal/bsdapp/eal/eal_thread.c      |  8 ++++----
 lib/librte_eal/common/include/eal_private.h | 10 ++++++++++
 lib/librte_eal/linuxapp/eal/eal_thread.c    |  8 ++++----
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c b/lib/librte_eal/bsdapp/eal/eal_thread.c
index 18df2a3..66191bb 100644
--- a/lib/librte_eal/bsdapp/eal/eal_thread.c
+++ b/lib/librte_eal/bsdapp/eal/eal_thread.c
@@ -95,8 +95,8 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id)
 }
 
 /* set affinity for current thread */
-static int
-eal_thread_set_affinity(unsigned lcore_id)
+int
+rte_eal_thread_set_affinity(unsigned lcore_id)
 {
 	int s;
 	pthread_t thread;
@@ -158,7 +158,7 @@ void eal_thread_init_master(unsigned lcore_id)
 	RTE_PER_LCORE(_lcore_id) = lcore_id;
 
 	/* set CPU affinity */
-	if (eal_thread_set_affinity(lcore_id) < 0)
+	if (rte_eal_thread_set_affinity(lcore_id) < 0)
 		rte_panic("cannot set affinity\n");
 }
 
@@ -192,7 +192,7 @@ eal_thread_loop(__attribute__((unused)) void *arg)
 	RTE_PER_LCORE(_lcore_id) = lcore_id;
 
 	/* set CPU affinity */
-	if (eal_thread_set_affinity(lcore_id) < 0)
+	if (rte_eal_thread_set_affinity(lcore_id) < 0)
 		rte_panic("cannot set affinity\n");
 
 	/* read on our pipe to get commands */
diff --git a/lib/librte_eal/common/include/eal_private.h b/lib/librte_eal/common/include/eal_private.h
index b440ffb..0f01f81 100644
--- a/lib/librte_eal/common/include/eal_private.h
+++ b/lib/librte_eal/common/include/eal_private.h
@@ -196,4 +196,14 @@ int rte_eal_intr_init(void);
  */
 int rte_eal_alarm_init(void);
 
+/**
+ * Set the affinity of the current thread to a given core
+ *
+ * This function is private to EAL.
+ *
+ * @return
+ *  0 on success, negative on error
+ */
+int rte_eal_thread_set_affinity(unsigned lcore_id);
+
 #endif /* _EAL_PRIVATE_H_ */
diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c
index 9dc3f98..cf5e75c 100644
--- a/lib/librte_eal/linuxapp/eal/eal_thread.c
+++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
@@ -95,8 +95,8 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id)
 }
 
 /* set affinity for current thread */
-static int
-eal_thread_set_affinity(unsigned lcore_id)
+int
+rte_eal_thread_set_affinity(unsigned lcore_id)
 {
 	int s;
 	pthread_t thread;
@@ -158,7 +158,7 @@ void eal_thread_init_master(unsigned lcore_id)
 	RTE_PER_LCORE(_lcore_id) = lcore_id;
 
 	/* set CPU affinity */
-	if (eal_thread_set_affinity(lcore_id) < 0)
+	if (rte_eal_thread_set_affinity(lcore_id) < 0)
 		rte_panic("cannot set affinity\n");
 }
 
@@ -192,7 +192,7 @@ eal_thread_loop(__attribute__((unused)) void *arg)
 	RTE_PER_LCORE(_lcore_id) = lcore_id;
 
 	/* set CPU affinity */
-	if (eal_thread_set_affinity(lcore_id) < 0)
+	if (rte_eal_thread_set_affinity(lcore_id) < 0)
 		rte_panic("cannot set affinity\n");
 
 	/* read on our pipe to get commands */
-- 
1.9.3

  parent reply	other threads:[~2014-09-11 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1410445387-4849-1-git-send-email-bruce.richardson@intel.com>
2014-09-11 14:23 ` [dpdk-dev] [PATCH 1/3] eal: add core id param to eal_thread_set_affinity Bruce Richardson
2014-09-11 14:23 ` Bruce Richardson [this message]
2014-09-11 14:23 ` [dpdk-dev] [PATCH 3/3] eal: affinitize low-priority threads to lcore 0 Bruce Richardson
2014-09-11 23:47 ` [dpdk-dev] [PATCH 0/3] eal affinitize low priority " Hiroshi Shimamoto
2014-09-12  1:24   ` Stephen Hemminger
2014-09-12  8:07   ` Richardson, Bruce

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=1410445387-4849-3-git-send-email-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git