|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
16 #ifndef included_ring_h
17 #define included_ring_h
41 v = _vec_resize ((
void *) 0,
53 #define clib_ring_new_aligned(ring, size, align) \
54 { clib_ring_new_inline ((void **)&(ring), sizeof(ring[0]), size, align); }
56 #define clib_ring_new(ring, size) \
57 { clib_ring_new_inline ((void **)&(ring), sizeof(ring[0]), size, 0);}
59 #define clib_ring_free(f) vec_free_h((f), sizeof(clib_ring_header_t))
76 if (
h->n_enq == _vec_len (v))
81 if (
h->next == _vec_len (v))
88 slot =
h->next == 0 ? _vec_len (v) - 1 :
h->next - 1;
91 return (
void *) ((
u8 *) v + elt_bytes *
slot);
94 #define clib_ring_enq(ring) \
95 clib_ring_get_last_inline (ring, sizeof(ring[0]), 1)
97 #define clib_ring_get_last(ring) \
98 clib_ring_get_last_inline (ring, sizeof(ring[0]), 0)
109 if (
h->n_enq >
h->next)
110 slot = _vec_len (v) +
h->next -
h->n_enq;
112 slot =
h->next -
h->n_enq;
117 return (
void *) ((
u8 *) v + elt_bytes *
slot);
120 #define clib_ring_deq(ring) \
121 clib_ring_get_first_inline (ring, sizeof(ring[0]), 1)
123 #define clib_ring_get_first(ring) \
124 clib_ring_get_first_inline (ring, sizeof(ring[0]), 0)
static u32 clib_ring_n_enq(void *v)
static void * vec_aligned_header(void *v, uword header_bytes, uword align)
static clib_ring_header_t * clib_ring_header(void *v)
static void clib_ring_new_inline(void **p, u32 elt_bytes, u32 size, u32 align)
static void * clib_ring_get_last_inline(void *v, u32 elt_bytes, int enqueue)
static void * clib_ring_get_first_inline(void *v, u32 elt_bytes, int dequeue)