Go to the source code of this file.
|
#define | pool_aligned_header_bytes vec_aligned_header_bytes (sizeof (pool_header_t), sizeof (void *)) |
|
#define | pool_validate_index(v, i) |
|
#define | pool_len(p) vec_len(p) |
|
#define | pool_bytes(P) (vec_bytes (P) + pool_header_bytes (P)) |
|
#define | pool_get_aligned(P, E, A) |
|
#define | pool_get(P, E) pool_get_aligned(P,E,0) |
|
#define | pool_is_free(P, E) |
|
#define | pool_is_free_index(P, I) pool_is_free((P),(P)+(I)) |
|
#define | pool_put(P, E) |
|
#define | pool_put_index(p, i) |
|
#define | pool_alloc_aligned(P, N, A) |
|
#define | pool_alloc(P, N) pool_alloc_aligned(P,N,0) |
|
#define | pool_free(p) (p) = _pool_free(p) |
|
#define | pool_foreach_region(LO, HI, POOL, BODY) |
|
#define | pool_foreach(VAR, POOL, BODY) |
|
#define | pool_elt_at_index(p, i) |
|
#define | pool_next_index(P, I) |
|
#define | pool_foreach_index(i, v, body) |
|
#define pool_alloc_aligned |
( |
|
P, |
|
|
|
N, |
|
|
|
A |
|
) |
| |
Value:do { \
pool_header_t * _p; \
(P) = _vec_resize ((P), 0, (
vec_len (P) + (N)) *
sizeof (P[0]), \
(A)); \
_vec_len (_p->free_indices) -= (N); \
} while (0)
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
#define pool_aligned_header_bytes
always_inline pool_header_t * pool_header(void *v)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition at line 221 of file pool.h.
#define pool_elt_at_index |
( |
|
p, |
|
|
|
i |
|
) |
| |
Value:({ \
typeof (p) _e = (p) + (
i); \
_e; \
})
sll srl srl sll sra u16x4 i
#define pool_is_free(P, E)
Definition at line 346 of file pool.h.
#define pool_foreach |
( |
|
VAR, |
|
|
|
POOL, |
|
|
|
BODY |
|
) |
| |
Value: uword _pool_foreach_lo, _pool_foreach_hi;
\ ({ \
for ((VAR) = (POOL) + _pool_foreach_lo; \
(VAR) < (POOL) + _pool_foreach_hi; \
(VAR)++) \
do { BODY; } while (0); \
})); \
} while (0)
#define pool_foreach_region(LO, HI, POOL, BODY)
Definition at line 328 of file pool.h.
#define pool_foreach_index |
( |
|
i, |
|
|
|
v, |
|
|
|
body |
|
) |
| |
Value: { \
do { body; } while (0); \
}
sll srl srl sll sra u16x4 i
#define pool_is_free_index(P, I)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition at line 366 of file pool.h.
#define pool_foreach_region |
( |
|
LO, |
|
|
|
HI, |
|
|
|
POOL, |
|
|
|
BODY |
|
) |
| |
Value: uword _pool_var (
i), _pool_var (
lo), _pool_var (
hi), _pool_var (len);
\ uword _pool_var (bl), * _pool_var (b); \
pool_header_t * _pool_var (p); \
\
_pool_var (b) = (POOL) ? _pool_var (p)->free_bitmap : 0; \
_pool_var (bl) =
vec_len (_pool_var (b)); \
_pool_var (len) =
vec_len (POOL); \
\
for (_pool_var (
i) = 0; \
_pool_var (
i) <= _pool_var (bl); \
uword _pool_var (m), _pool_var (f); \
_pool_var (m) = (_pool_var (
i) < _pool_var (bl) \
? _pool_var (b) [_pool_var (
i)] \
: 1); \
while (_pool_var (m) != 0) \
{ \
_pool_var (
hi) = (_pool_var (
i) *
BITS (_pool_var (b)[0]) \
_pool_var (
hi) = (_pool_var (
i) < _pool_var (bl) \
? _pool_var (
hi) : _pool_var (len)); \
_pool_var (m) ^= _pool_var (f); \
if (_pool_var (
hi) > _pool_var (
lo)) \
{ \
do { BODY; } while (0); \
} \
_pool_var (
lo) = _pool_var (
hi) + 1; \
} \
} \
} while (0)
sll srl srl sll sra u16x4 i
always_inline uword first_set(uword x)
always_inline pool_header_t * pool_header(void *v)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
always_inline uword min_log2(uword x)
Definition at line 260 of file pool.h.
#define pool_free |
( |
|
p | ) |
(p) = _pool_free(p) |
#define pool_get_aligned |
( |
|
P, |
|
|
|
E, |
|
|
|
A |
|
) |
| |
Value:do { \
\
_pool_var (l) = 0; \
if (P) \
_pool_var (l) =
vec_len (_pool_var (p)->free_indices); \
\
if (_pool_var (l) > 0) \
{ \
uword _pool_var (
i) = _pool_var (p)->free_indices[_pool_var (l) - 1]; \
(E) = (P) + _pool_var (
i); \
_pool_var (p)->free_bitmap = \
clib_bitmap_andnoti (_pool_var (p)->free_bitmap, _pool_var (
i)); \
_vec_len (_pool_var (p)->free_indices) = _pool_var (l) - 1; \
} \
else \
{ \
\
P = _vec_resize (P, \
1, \
(
vec_len (P) + 1) *
sizeof (P[0]), \
(A)); \
} \
} while (0)
sll srl srl sll sra u16x4 i
#define vec_end(v)
End (last data address) of vector.
#define pool_aligned_header_bytes
always_inline pool_header_t * pool_header(void *v)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition at line 155 of file pool.h.
#define pool_is_free |
( |
|
P, |
|
|
|
E |
|
) |
| |
Value:({ \
uword _pool_var (
i) = (E) - (P); \
})
sll srl srl sll sra u16x4 i
always_inline uword clib_bitmap_get(uword *ai, uword i)
always_inline pool_header_t * pool_header(void *v)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition at line 189 of file pool.h.
#define pool_next_index |
( |
|
P, |
|
|
|
I |
|
) |
| |
Value:({ \
uword _pool_var (rv) = (
I) + 1; \
\
_pool_var(rv) = \
: ~0); \
_pool_var(rv); \
})
always_inline uword clib_bitmap_next_clear(uword *ai, uword i)
always_inline pool_header_t * pool_header(void *v)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition at line 354 of file pool.h.
#define pool_put |
( |
|
P, |
|
|
|
E |
|
) |
| |
Value:do { \
uword _pool_var (l) = (E) - (P);
\ \
\
_pool_var (p)->free_bitmap = \
clib_bitmap_ori (_pool_var (p)->free_bitmap, _pool_var (l));
\ vec_add1 (_pool_var (p)->free_indices, _pool_var (l)); \
} while (0)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define pool_is_free(P, E)
#define vec_is_member(v, e)
True if given pointer is within given vector.
always_inline pool_header_t * pool_header(void *v)
Definition at line 200 of file pool.h.
#define pool_put_index |
( |
|
p, |
|
|
|
i |
|
) |
| |
Value:do { \
typeof (p) _e = (p) + (
i); \
} while (0)
sll srl srl sll sra u16x4 i
Definition at line 214 of file pool.h.
#define pool_validate_index |
( |
|
v, |
|
|
|
i |
|
) |
| |
Value: uword __pool_validate_index = (
i);
\ } while (0)
sll srl srl sll sra u16x4 i
#define pool_aligned_header_bytes
#define vec_validate_ha(V, I, H, A)
Make sure vector is long enough for given index (general version).
always_inline void pool_header_validate_index(void *v, uword index)
Definition at line 88 of file pool.h.