[dpdk-dev,2/3] eal: increase scope of eal_thread_set_affinity
Commit Message
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(-)
@@ -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 */
@@ -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_ */
@@ -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 */