[dpdk-dev,v8,14/19] eal: set _lcore_id and _socket_id to (-1) by default
Commit Message
For those none EAL thread, *_lcore_id* shall always be LCORE_ID_ANY.
The libraries using *_lcore_id* as index need to take care.
*_socket_id* always be SOCKET_ID_ANY unitl the thread changes the affinity
by rte_thread_set_affinity()
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
---
v5 changes:
define LCORE_ID_ANY as UINT32_MAX
lib/librte_eal/bsdapp/eal/eal_thread.c | 4 ++--
lib/librte_eal/common/include/rte_lcore.h | 4 ++--
lib/librte_eal/linuxapp/eal/eal_thread.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
@@ -56,8 +56,8 @@
#include "eal_private.h"
#include "eal_thread.h"
-RTE_DEFINE_PER_LCORE(unsigned, _lcore_id);
-RTE_DEFINE_PER_LCORE(unsigned, _socket_id);
+RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
+RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
/*
@@ -48,7 +48,7 @@
extern "C" {
#endif
-#define LCORE_ID_ANY -1 /**< Any lcore. */
+#define LCORE_ID_ANY UINT32_MAX /**< Any lcore. */
#if defined(__linux__)
typedef cpu_set_t rte_cpuset_t;
@@ -87,7 +87,7 @@ RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
/**
* Return the ID of the execution unit we are running on.
* @return
- * Logical core ID
+ * Logical core ID(in EAL thread) or LCORE_ID_ANY(in non-EAL thread)
*/
static inline unsigned
rte_lcore_id(void)
@@ -56,8 +56,8 @@
#include "eal_private.h"
#include "eal_thread.h"
-RTE_DEFINE_PER_LCORE(unsigned, _lcore_id);
-RTE_DEFINE_PER_LCORE(unsigned, _socket_id);
+RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
+RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
/*