DPDK 22.11.5
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 <stdio.h>
15
16#include <rte_compat.h>
17#include <rte_config.h>
18#include <rte_per_lcore.h>
19#include <rte_eal.h>
20#include <rte_launch.h>
21#include <rte_thread.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#define LCORE_ID_ANY UINT32_MAX
29RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);
35 ROLE_RTE,
36 ROLE_OFF,
37 ROLE_SERVICE,
38 ROLE_NON_EAL,
39};
40
49enum rte_lcore_role_t rte_eal_lcore_role(unsigned int lcore_id);
50
62int
63rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role);
64
78static inline unsigned
80{
81 return RTE_PER_LCORE(_lcore_id);
82}
83
90unsigned int rte_get_main_lcore(void);
91
98unsigned int rte_lcore_count(void);
99
114int rte_lcore_index(int lcore_id);
115
122unsigned int rte_socket_id(void);
123
134unsigned int
136
151int
152rte_socket_id_by_idx(unsigned int idx);
153
162unsigned int
163rte_lcore_to_socket_id(unsigned int lcore_id);
164
173int rte_lcore_to_cpu_id(int lcore_id);
174
175#ifdef RTE_HAS_CPUSET
176
185rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id);
186
187#endif /* RTE_HAS_CPUSET */
188
198int rte_lcore_is_enabled(unsigned int lcore_id);
199
213unsigned int rte_get_next_lcore(unsigned int i, int skip_main, int wrap);
214
218#define RTE_LCORE_FOREACH(i) \
219 for (i = rte_get_next_lcore(-1, 0, 0); \
220 i < RTE_MAX_LCORE; \
221 i = rte_get_next_lcore(i, 0, 0))
222
226#define RTE_LCORE_FOREACH_WORKER(i) \
227 for (i = rte_get_next_lcore(-1, 1, 0); \
228 i < RTE_MAX_LCORE; \
229 i = rte_get_next_lcore(i, 1, 0))
230
242typedef int (*rte_lcore_init_cb)(unsigned int lcore_id, void *arg);
243
252typedef void (*rte_lcore_uninit_cb)(unsigned int lcore_id, void *arg);
253
282void *
284 rte_lcore_uninit_cb uninit, void *arg);
285
296void
298
310typedef int (*rte_lcore_iterate_cb)(unsigned int lcore_id, void *arg);
311
328int
330
337void
339
352int rte_thread_setname(pthread_t id, const char *name);
353
368__rte_experimental
369int rte_thread_getname(pthread_t id, char *name, size_t len);
370
384int
386
390void
392
416int
417rte_ctrl_thread_create(pthread_t *thread, const char *name,
418 const pthread_attr_t *attr,
419 void *(*start_routine)(void *), void *arg);
420
421#ifdef __cplusplus
422}
423#endif
424
425
426#endif /* _RTE_LCORE_H_ */
unsigned int rte_lcore_to_socket_id(unsigned int lcore_id)
void rte_lcore_callback_unregister(void *handle)
RTE_DECLARE_PER_LCORE(unsigned, _lcore_id)
unsigned int rte_lcore_count(void)
void(* rte_lcore_uninit_cb)(unsigned int lcore_id, void *arg)
Definition: rte_lcore.h:252
int rte_lcore_index(int lcore_id)
rte_lcore_role_t
Definition: rte_lcore.h:34
int rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role)
int rte_lcore_is_enabled(unsigned int lcore_id)
unsigned int rte_get_main_lcore(void)
int rte_socket_id_by_idx(unsigned int idx)
void rte_lcore_dump(FILE *f)
int rte_thread_register(void)
unsigned int rte_socket_id(void)
rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id)
void * rte_lcore_callback_register(const char *name, rte_lcore_init_cb init, rte_lcore_uninit_cb uninit, void *arg)
enum rte_lcore_role_t rte_eal_lcore_role(unsigned 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_iterate(rte_lcore_iterate_cb cb, void *arg)
int(* rte_lcore_iterate_cb)(unsigned int lcore_id, void *arg)
Definition: rte_lcore.h:310
__rte_experimental int rte_thread_getname(pthread_t id, char *name, size_t len)
int(* rte_lcore_init_cb)(unsigned int lcore_id, void *arg)
Definition: rte_lcore.h:242
unsigned int rte_get_next_lcore(unsigned int i, int skip_main, int wrap)
int rte_lcore_to_cpu_id(int lcore_id)
void rte_thread_unregister(void)
int rte_thread_setname(pthread_t id, const char *name)
unsigned int rte_socket_count(void)
static unsigned rte_lcore_id(void)
Definition: rte_lcore.h:79
#define RTE_PER_LCORE(name)
Definition: rte_per_lcore.h:44