26#define RTE_TAILQ_STACK_NAME "RTE_STACK"
27#define RTE_STACK_MZ_PREFIX "STK_"
29#define RTE_STACK_NAMESIZE (RTE_MEMZONE_NAMESIZE - \
30 sizeof(RTE_STACK_MZ_PREFIX) + 1)
33 "Pile bulk size must be divisible by CPU cache line size");
35 "Pile bulk size must be power of 2");
38struct rte_stack_lf_elem {
40 struct rte_stack_lf_elem *next;
48struct rte_stack_pile_bulk_elem {
50 struct rte_stack_lf_elem elem;
52 alignas(RTE_CACHE_LINE_SIZE)
53 void *objs[RTE_STACK_PILE_BULK_SIZE];
56static_assert(
offsetof(
struct rte_stack_pile_bulk_elem, elem) == 0,
57 "Inherited type mismatch");
60 struct rte_stack_lf_elem *top;
64struct rte_stack_lf_list {
66 struct rte_stack_lf_head head;
68 RTE_ATOMIC(uint64_t) len;
76 alignas(RTE_CACHE_LINE_SIZE)
struct rte_stack_lf_list used;
79 alignas(RTE_CACHE_LINE_SIZE)
struct rte_stack_lf_list free;
82 alignas(RTE_CACHE_LINE_SIZE)
struct rte_stack_lf_elem elems[];
90struct rte_stack_pile {
92 alignas(RTE_CACHE_LINE_SIZE)
struct rte_stack_lf_list bulk;
95 alignas(RTE_CACHE_LINE_SIZE)
struct rte_stack_lf_list solo;
98 alignas(RTE_CACHE_LINE_SIZE)
struct rte_stack_lf_list free_bulk;
101 alignas(RTE_CACHE_LINE_SIZE)
struct rte_stack_lf_list free_solo;
104 alignas(RTE_CACHE_LINE_SIZE)
void *elems[];
110struct rte_stack_std {
127 struct rte_stack_lf stack_lf;
128 struct rte_stack_pile stack_pile;
129 struct rte_stack_std stack_std;
137#define RTE_STACK_F_LF 0x0001
148#define RTE_STACK_F_PILE 0x0002
150#include "rte_stack_std.h"
151#include "rte_stack_lf.h"
152#include "rte_stack_pile.h"
173 RTE_ASSERT(s != NULL);
174 RTE_ASSERT(obj_table != NULL);
177 return __rte_stack_lf_push(s, obj_table, n);
179 return __rte_stack_pile_push(s, obj_table, n);
181 return __rte_stack_std_push(s, obj_table, n);
199 RTE_ASSERT(s != NULL);
200 RTE_ASSERT(obj_table != NULL);
203 return __rte_stack_lf_pop(s, obj_table, n);
205 return __rte_stack_pile_pop(s, obj_table, n);
207 return __rte_stack_std_pop(s, obj_table, n);
221 RTE_ASSERT(s != NULL);
224 return __rte_stack_lf_count(s);
226 return __rte_stack_pile_count(s);
228 return __rte_stack_std_count(s);
242 RTE_ASSERT(s != NULL);
#define RTE_IS_POWER_OF_2(n)
#define offsetof(TYPE, MEMBER)
#define RTE_CACHE_LINE_MASK
#define __rte_cache_aligned
#define __rte_always_inline
struct rte_stack * rte_stack_create(const char *name, unsigned int count, int socket_id, uint32_t flags)
#define RTE_STACK_NAMESIZE
void rte_stack_free(struct rte_stack *s)
static __rte_always_inline unsigned int rte_stack_count(struct rte_stack *s)
static __rte_always_inline unsigned int rte_stack_push(struct rte_stack *s, void *const *obj_table, unsigned int n)
static __rte_always_inline unsigned int rte_stack_free_count(struct rte_stack *s)
static __rte_always_inline unsigned int rte_stack_pop(struct rte_stack *s, void **obj_table, unsigned int n)
struct __rte_aligned(16) rte_stack_lf_head
struct rte_stack * rte_stack_lookup(const char *name)