eal: add lcore iterators
[dpdk.git] / lib / librte_eal / common / eal_thread.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #ifndef EAL_THREAD_H
6 #define EAL_THREAD_H
7
8 #include <rte_lcore.h>
9
10 /**
11  * basic loop of thread, called for each thread by eal_init().
12  *
13  * @param arg
14  *   opaque pointer
15  */
16 __rte_noreturn void *eal_thread_loop(void *arg);
17
18 /**
19  * Get the NUMA socket id from cpu id.
20  * This function is private to EAL.
21  *
22  * @param cpu_id
23  *   The logical process id.
24  * @return
25  *   socket_id or SOCKET_ID_ANY
26  */
27 unsigned eal_cpu_socket_id(unsigned cpu_id);
28
29 /**
30  * Default buffer size to use with eal_thread_dump_affinity()
31  */
32 #define RTE_CPU_AFFINITY_STR_LEN            256
33
34 /**
35  * Dump the cpuset as a human readable string.
36  * This function is private to EAL.
37  *
38  * Note:
39  *   If the dump size is greater than the size of given buffer,
40  *   the string will be truncated and with '\0' at the end.
41  *
42  * @param cpuset
43  *   The CPU affinity object to dump.
44  * @param str
45  *   The string buffer the cpuset will dump to.
46  * @param size
47  *   The string buffer size.
48  * @return
49  *   0 for success, -1 if truncation happens.
50  */
51 int
52 eal_thread_dump_affinity(rte_cpuset_t *cpuset, char *str, unsigned int size);
53
54 /**
55  * Dump the current thread cpuset.
56  * This is a wrapper on eal_thread_dump_affinity().
57  */
58 int
59 eal_thread_dump_current_affinity(char *str, unsigned int size);
60
61 #endif /* EAL_THREAD_H */