New upstream version 18.02
[deb_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 __attribute__((noreturn)) void *eal_thread_loop(void *arg);
17
18 /**
19  * Init per-lcore info for master thread
20  *
21  * @param lcore_id
22  *   identifier of master lcore
23  */
24 void eal_thread_init_master(unsigned lcore_id);
25
26 /**
27  * Get the NUMA socket id from cpu id.
28  * This function is private to EAL.
29  *
30  * @param cpu_id
31  *   The logical process id.
32  * @return
33  *   socket_id or SOCKET_ID_ANY
34  */
35 unsigned eal_cpu_socket_id(unsigned cpu_id);
36
37 /**
38  * Get the NUMA socket id from cpuset.
39  * This function is private to EAL.
40  *
41  * @param cpusetp
42  *   The point to a valid cpu set.
43  * @return
44  *   socket_id or SOCKET_ID_ANY
45  */
46 int eal_cpuset_socket_id(rte_cpuset_t *cpusetp);
47
48 /**
49  * Default buffer size to use with eal_thread_dump_affinity()
50  */
51 #define RTE_CPU_AFFINITY_STR_LEN            256
52
53 /**
54  * Dump the current pthread cpuset.
55  * This function is private to EAL.
56  *
57  * Note:
58  *   If the dump size is greater than the size of given buffer,
59  *   the string will be truncated and with '\0' at the end.
60  *
61  * @param str
62  *   The string buffer the cpuset will dump to.
63  * @param size
64  *   The string buffer size.
65  * @return
66  *   0 for success, -1 if truncation happens.
67  */
68 int
69 eal_thread_dump_affinity(char *str, unsigned size);
70
71 #endif /* EAL_THREAD_H */