DPDK  19.11.14
rte_lcore.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
5 #ifndef _RTE_LCORE_H_
6 #define _RTE_LCORE_H_
7 
14 #include <rte_config.h>
15 #include <rte_per_lcore.h>
16 #include <rte_eal.h>
17 #include <rte_launch.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define LCORE_ID_ANY UINT32_MAX
25 RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);
26 RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset);
36 enum rte_lcore_role_t rte_eal_lcore_role(unsigned int lcore_id);
37 
50 static inline unsigned
52 {
53  return RTE_PER_LCORE(_lcore_id);
54 }
55 
62 unsigned int rte_get_master_lcore(void);
63 
70 unsigned int rte_lcore_count(void);
71 
86 int rte_lcore_index(int lcore_id);
87 
94 unsigned int rte_socket_id(void);
95 
106 unsigned int
107 rte_socket_count(void);
108 
123 int
124 rte_socket_id_by_idx(unsigned int idx);
125 
134 unsigned int
135 rte_lcore_to_socket_id(unsigned int lcore_id);
136 
148 __rte_experimental
149 int
150 rte_lcore_to_cpu_id(int lcore_id);
151 
162 __rte_experimental
163 rte_cpuset_t
164 rte_lcore_cpuset(unsigned int lcore_id);
165 
175 int rte_lcore_is_enabled(unsigned int lcore_id);
176 
190 unsigned int rte_get_next_lcore(unsigned int i, int skip_master, int wrap);
191 
195 #define RTE_LCORE_FOREACH(i) \
196  for (i = rte_get_next_lcore(-1, 0, 0); \
197  i<RTE_MAX_LCORE; \
198  i = rte_get_next_lcore(i, 0, 0))
199 
203 #define RTE_LCORE_FOREACH_SLAVE(i) \
204  for (i = rte_get_next_lcore(-1, 1, 0); \
205  i<RTE_MAX_LCORE; \
206  i = rte_get_next_lcore(i, 1, 0))
207 
217 int rte_thread_set_affinity(rte_cpuset_t *cpusetp);
218 
227 void rte_thread_get_affinity(rte_cpuset_t *cpusetp);
228 
241 int rte_thread_setname(pthread_t id, const char *name);
242 
265 int
266 rte_ctrl_thread_create(pthread_t *thread, const char *name,
267  const pthread_attr_t *attr,
268  void *(*start_routine)(void *), void *arg);
269 
281 int
282 rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role);
283 
284 #ifdef __cplusplus
285 }
286 #endif
287 
288 
289 #endif /* _RTE_LCORE_H_ */
void rte_thread_get_affinity(rte_cpuset_t *cpusetp)
int rte_thread_setname(pthread_t id, const char *name)
rte_lcore_role_t
Definition: rte_eal.h:37
unsigned int rte_lcore_count(void)
int rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role)
unsigned int rte_socket_count(void)
unsigned int rte_lcore_to_socket_id(unsigned int lcore_id)
unsigned int rte_socket_id(void)
__rte_experimental rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id)
static unsigned rte_lcore_id(void)
Definition: rte_lcore.h:51
int rte_socket_id_by_idx(unsigned int idx)
__rte_experimental int rte_lcore_to_cpu_id(int lcore_id)
int rte_lcore_index(int lcore_id)
int rte_ctrl_thread_create(pthread_t *thread, const char *name, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
int rte_lcore_is_enabled(unsigned int lcore_id)
#define RTE_PER_LCORE(name)
Definition: rte_per_lcore.h:44
unsigned int rte_get_master_lcore(void)
int rte_thread_set_affinity(rte_cpuset_t *cpusetp)
unsigned int rte_get_next_lcore(unsigned int i, int skip_master, int wrap)