DPDK
24.11.4
Toggle main menu visibility
Loading...
Searching...
No Matches
rte_lcore_var.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-3-Clause
2
* Copyright(c) 2024 Ericsson AB
3
*/
4
5
#ifndef RTE_LCORE_VAR_H
6
#define RTE_LCORE_VAR_H
7
21
22
#include <stddef.h>
23
#include <stdalign.h>
24
25
#include <
rte_common.h
>
26
#include <rte_config.h>
27
#include <
rte_lcore.h
>
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
36
#define RTE_LCORE_VAR_HANDLE_TYPE(type) \
37
type *
38
51
#define RTE_LCORE_VAR_HANDLE(type, name) \
52
RTE_LCORE_VAR_HANDLE_TYPE(type) name
53
59
#define RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle, size, align) \
60
handle = rte_lcore_var_alloc(size, align)
61
68
#define RTE_LCORE_VAR_ALLOC_SIZE(handle, size) \
69
RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle, size, 0)
70
77
#define RTE_LCORE_VAR_ALLOC(handle) \
78
RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle, sizeof(*(handle)), \
79
alignof(typeof(*(handle))))
80
87
#define RTE_LCORE_VAR_INIT_SIZE_ALIGN(name, size, align) \
88
RTE_INIT(rte_lcore_var_init_ ## name) \
89
{ \
90
RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(name, size, align); \
91
}
92
99
#define RTE_LCORE_VAR_INIT_SIZE(name, size) \
100
RTE_LCORE_VAR_INIT_SIZE_ALIGN(name, size, 0)
101
107
#define RTE_LCORE_VAR_INIT(name) \
108
RTE_INIT(rte_lcore_var_init_ ## name) \
109
{ \
110
RTE_LCORE_VAR_ALLOC(name); \
111
}
112
124
/* access function 8< */
125
static
inline
void
*
126
rte_lcore_var_lcore
(
unsigned
int
lcore_id,
void
*handle)
127
{
128
return
RTE_PTR_ADD
(handle, lcore_id * RTE_MAX_LCORE_VAR);
129
}
130
/* >8 end of access function */
131
143
#define RTE_LCORE_VAR_LCORE(lcore_id, handle) \
144
((typeof(handle))rte_lcore_var_lcore(lcore_id, handle))
145
151
#define RTE_LCORE_VAR(handle) \
152
RTE_LCORE_VAR_LCORE(rte_lcore_id(), handle)
153
166
#define RTE_LCORE_VAR_FOREACH(lcore_id, value, handle) \
167
for ((lcore_id) = \
168
(((value) = RTE_LCORE_VAR_LCORE(0, handle)), 0); \
169
(lcore_id) < RTE_MAX_LCORE; \
170
(lcore_id)++, (value) = RTE_LCORE_VAR_LCORE(lcore_id, \
171
handle))
172
200
__rte_experimental
201
void
*
202
rte_lcore_var_alloc
(
size_t
size,
size_t
align)
203
__rte_alloc_size
(1)
__rte_alloc_align
(2);
204
205
#ifdef __cplusplus
206
}
207
#endif
208
209
#endif
/* RTE_LCORE_VAR_H */
rte_common.h
__rte_alloc_align
#define __rte_alloc_align(argno)
Definition
rte_common.h:241
__rte_alloc_size
#define __rte_alloc_size(...)
Definition
rte_common.h:228
RTE_PTR_ADD
#define RTE_PTR_ADD(ptr, x)
Definition
rte_common.h:469
rte_lcore.h
rte_lcore_var_alloc
__rte_experimental void * rte_lcore_var_alloc(size_t size, size_t align) __rte_alloc_size(1) __rte_alloc_align(2)
rte_lcore_var_lcore
static void * rte_lcore_var_lcore(unsigned int lcore_id, void *handle)
Definition
rte_lcore_var.h:126
lib
eal
include
rte_lcore_var.h
Generated by
1.17.0