DPDK
25.11.0
Toggle main menu visibility
Loading...
Searching...
No Matches
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
13
#include <stdio.h>
14
15
#include <rte_compat.h>
16
#include <rte_config.h>
17
#include <
rte_per_lcore.h
>
18
#include <
rte_eal.h
>
19
#include <
rte_launch.h
>
20
#include <
rte_thread.h
>
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
#define LCORE_ID_ANY UINT32_MAX
27
28
RTE_DECLARE_PER_LCORE
(
unsigned
, _lcore_id);
29
33
enum
rte_lcore_role_t
{
34
ROLE_RTE,
35
ROLE_OFF,
36
ROLE_SERVICE,
37
ROLE_NON_EAL,
38
};
39
48
enum
rte_lcore_role_t
rte_eal_lcore_role
(
unsigned
int
lcore_id);
49
61
int
62
rte_lcore_has_role
(
unsigned
int
lcore_id,
enum
rte_lcore_role_t
role);
63
77
static
inline
unsigned
78
rte_lcore_id
(
void
)
79
{
80
return
RTE_PER_LCORE
(_lcore_id);
81
}
82
89
unsigned
int
rte_get_main_lcore
(
void
);
90
97
unsigned
int
rte_lcore_count
(
void
);
98
112
int
rte_lcore_index
(
int
lcore_id);
113
119
unsigned
int
rte_socket_id
(
void
);
120
131
unsigned
int
132
rte_socket_count
(
void
);
133
149
int
150
rte_socket_id_by_idx
(
unsigned
int
idx);
151
160
unsigned
int
161
rte_lcore_to_socket_id
(
unsigned
int
lcore_id);
162
171
int
rte_lcore_to_cpu_id
(
int
lcore_id);
172
173
#ifdef RTE_HAS_CPUSET
174
183
rte_cpuset_t
rte_lcore_cpuset
(
unsigned
int
lcore_id);
184
185
#endif
/* RTE_HAS_CPUSET */
186
196
int
rte_lcore_is_enabled
(
unsigned
int
lcore_id);
197
211
unsigned
int
rte_get_next_lcore
(
unsigned
int
i,
int
skip_main,
int
wrap);
212
216
#define RTE_LCORE_FOREACH(i) \
217
for (i = rte_get_next_lcore(-1, 0, 0); \
218
i < RTE_MAX_LCORE; \
219
i = rte_get_next_lcore(i, 0, 0))
220
224
#define RTE_LCORE_FOREACH_WORKER(i) \
225
for (i = rte_get_next_lcore(-1, 1, 0); \
226
i < RTE_MAX_LCORE; \
227
i = rte_get_next_lcore(i, 1, 0))
228
240
typedef
int (*
rte_lcore_init_cb
)(
unsigned
int
lcore_id,
void
*arg);
241
250
typedef
void (*
rte_lcore_uninit_cb
)(
unsigned
int
lcore_id,
void
*arg);
251
280
void
*
281
rte_lcore_callback_register
(
const
char
*name,
rte_lcore_init_cb
init,
282
rte_lcore_uninit_cb
uninit,
void
*arg);
283
294
void
295
rte_lcore_callback_unregister
(
void
*handle);
296
308
typedef
int (*
rte_lcore_iterate_cb
)(
unsigned
int
lcore_id,
void
*arg);
309
326
int
327
rte_lcore_iterate
(
rte_lcore_iterate_cb
cb,
void
*arg);
328
332
struct
rte_lcore_usage
{
337
uint64_t
total_cycles
;
342
uint64_t
busy_cycles
;
343
};
344
358
typedef
int (*
rte_lcore_usage_cb
)(
unsigned
int
lcore_id,
struct
rte_lcore_usage
*usage);
359
372
void
rte_lcore_register_usage_cb
(
rte_lcore_usage_cb
cb);
373
380
void
381
rte_lcore_dump
(FILE *f);
382
396
int
397
rte_thread_register
(
void
);
398
402
void
403
rte_thread_unregister
(
void
);
404
405
#ifdef __cplusplus
406
}
407
#endif
408
409
410
#endif
/* _RTE_LCORE_H_ */
rte_eal.h
rte_launch.h
rte_lcore_to_socket_id
unsigned int rte_lcore_to_socket_id(unsigned int lcore_id)
rte_lcore_callback_unregister
void rte_lcore_callback_unregister(void *handle)
rte_lcore_count
unsigned int rte_lcore_count(void)
rte_lcore_uninit_cb
void(* rte_lcore_uninit_cb)(unsigned int lcore_id, void *arg)
Definition
rte_lcore.h:250
rte_lcore_index
int rte_lcore_index(int lcore_id)
rte_lcore_usage_cb
int(* rte_lcore_usage_cb)(unsigned int lcore_id, struct rte_lcore_usage *usage)
Definition
rte_lcore.h:358
rte_lcore_role_t
rte_lcore_role_t
Definition
rte_lcore.h:33
rte_lcore_register_usage_cb
void rte_lcore_register_usage_cb(rte_lcore_usage_cb cb)
rte_lcore_has_role
int rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role)
rte_lcore_is_enabled
int rte_lcore_is_enabled(unsigned int lcore_id)
rte_get_main_lcore
unsigned int rte_get_main_lcore(void)
rte_socket_id_by_idx
int rte_socket_id_by_idx(unsigned int idx)
rte_lcore_dump
void rte_lcore_dump(FILE *f)
rte_thread_register
int rte_thread_register(void)
rte_socket_id
unsigned int rte_socket_id(void)
rte_lcore_cpuset
rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id)
rte_lcore_callback_register
void * rte_lcore_callback_register(const char *name, rte_lcore_init_cb init, rte_lcore_uninit_cb uninit, void *arg)
rte_eal_lcore_role
enum rte_lcore_role_t rte_eal_lcore_role(unsigned int lcore_id)
rte_lcore_iterate
int rte_lcore_iterate(rte_lcore_iterate_cb cb, void *arg)
rte_lcore_iterate_cb
int(* rte_lcore_iterate_cb)(unsigned int lcore_id, void *arg)
Definition
rte_lcore.h:308
rte_lcore_init_cb
int(* rte_lcore_init_cb)(unsigned int lcore_id, void *arg)
Definition
rte_lcore.h:240
rte_get_next_lcore
unsigned int rte_get_next_lcore(unsigned int i, int skip_main, int wrap)
rte_lcore_to_cpu_id
int rte_lcore_to_cpu_id(int lcore_id)
rte_thread_unregister
void rte_thread_unregister(void)
rte_socket_count
unsigned int rte_socket_count(void)
rte_lcore_id
static unsigned rte_lcore_id(void)
Definition
rte_lcore.h:78
rte_per_lcore.h
RTE_PER_LCORE
#define RTE_PER_LCORE(name)
Definition
rte_per_lcore.h:46
RTE_DECLARE_PER_LCORE
#define RTE_DECLARE_PER_LCORE(type, name)
Definition
rte_per_lcore.h:39
rte_thread.h
rte_lcore_usage
Definition
rte_lcore.h:332
rte_lcore_usage::busy_cycles
uint64_t busy_cycles
Definition
rte_lcore.h:342
rte_lcore_usage::total_cycles
uint64_t total_cycles
Definition
rte_lcore.h:337
lib
eal
include
rte_lcore.h
Generated by
1.17.0