DPDK
25.11.0
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_debug.h
>
28
#include <
rte_lcore.h
>
29
30
#ifdef __cplusplus
31
extern
"C"
{
32
#endif
33
37
#define RTE_LCORE_VAR_HANDLE_TYPE(type) \
38
type *
39
52
#define RTE_LCORE_VAR_HANDLE(type, name) \
53
RTE_LCORE_VAR_HANDLE_TYPE(type) name
54
60
#define RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle, size, align) \
61
handle = rte_lcore_var_alloc(size, align)
62
69
#define RTE_LCORE_VAR_ALLOC_SIZE(handle, size) \
70
RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle, size, 0)
71
78
#define RTE_LCORE_VAR_ALLOC(handle) \
79
RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle, sizeof(*(handle)), \
80
alignof(typeof(*(handle))))
81
88
#define RTE_LCORE_VAR_INIT_SIZE_ALIGN(name, size, align) \
89
RTE_INIT(rte_lcore_var_init_ ## name) \
90
{ \
91
RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(name, size, align); \
92
}
93
100
#define RTE_LCORE_VAR_INIT_SIZE(name, size) \
101
RTE_LCORE_VAR_INIT_SIZE_ALIGN(name, size, 0)
102
108
#define RTE_LCORE_VAR_INIT(name) \
109
RTE_INIT(rte_lcore_var_init_ ## name) \
110
{ \
111
RTE_LCORE_VAR_ALLOC(name); \
112
}
113
125
/* access function 8< */
126
static
inline
void
*
127
rte_lcore_var_lcore
(
unsigned
int
lcore_id,
void
*handle)
128
{
129
RTE_ASSERT(handle != NULL);
130
return
RTE_PTR_ADD
(handle, lcore_id * RTE_MAX_LCORE_VAR);
131
}
132
/* >8 end of access function */
133
145
#define RTE_LCORE_VAR_LCORE(lcore_id, handle) \
146
((typeof(handle))rte_lcore_var_lcore(lcore_id, handle))
147
153
#define RTE_LCORE_VAR(handle) \
154
RTE_LCORE_VAR_LCORE(rte_lcore_id(), handle)
155
168
#define RTE_LCORE_VAR_FOREACH(lcore_id, value, handle) \
169
for ((lcore_id) = \
170
(((value) = RTE_LCORE_VAR_LCORE(0, handle)), 0); \
171
(lcore_id) < RTE_MAX_LCORE; \
172
(lcore_id)++, (value) = RTE_LCORE_VAR_LCORE(lcore_id, \
173
handle))
174
202
__rte_experimental
203
void
*
204
rte_lcore_var_alloc
(
size_t
size,
size_t
align)
205
__rte_alloc_size
(1)
__rte_alloc_align
(2);
206
207
#ifdef __cplusplus
208
}
209
#endif
210
211
#endif
/* RTE_LCORE_VAR_H */
rte_common.h
__rte_alloc_align
#define __rte_alloc_align(argno)
Definition
rte_common.h:318
__rte_alloc_size
#define __rte_alloc_size(...)
Definition
rte_common.h:305
RTE_PTR_ADD
#define RTE_PTR_ADD(ptr, x)
Definition
rte_common.h:554
rte_debug.h
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:127
lib
eal
include
rte_lcore_var.h
Generated by
1.17.0