|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
49 if (CLIB_DEBUG > 0 &&
index != ~0)
54 ASSERT (template->baseva < ch->
baseva || template->baseva >=
56 ASSERT (template->baseva + template->size < ch->
baseva ||
57 template->baseva + template->size >=
85 new_ch->
baseva =
template->baseva;
86 new_ch->
size =
template->size;
112 new_ch->
baseva =
template->baseva;
113 new_ch->
size =
template->size;
131 ASSERT (
template && template->baseva && template->size);
151 int os_out_of_memory_on_failure)
212 if (os_out_of_memory_on_failure)
231 uword return_size = 0;
246 return_size = ch->
size;
315 int verbose = va_arg (*va,
int);
322 s =
format (s,
"%d chunks, first index %d\n",
332 s =
format (s,
"[%d] base %llx size %llx (%lld) prev %d %s\n",
339 s =
format (s,
" BUG: baseva not in hash table!\n");
341 else if (p[0] !=
index)
343 s =
format (s,
" BUG: baseva in hash table %d not %d!\n",
static void clib_spinlock_init(clib_spinlock_t *p)
#define hash_set(h, key, value)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
__clib_export uword clib_valloc_alloc(clib_valloc_main_t *vam, uword size, int os_out_of_memory_on_failure)
Allocate virtual space.
void os_out_of_memory(void)
#define pool_put(P, E)
Free an object E in pool P.
__clib_export u8 * format_valloc(u8 *s, va_list *va)
format a virtual allocation arena (varargs)
uword baseva
base VA for this chunk
#define hash_unset(h, key)
uword size
size in bytes of this chunk
u32 prev
previous chunk pool index
__clib_export void clib_valloc_add_chunk(clib_valloc_main_t *vam, clib_valloc_chunk_t *template)
Add a chunk of memory to a virtual allocation arena.
u32 next
next chunk pool index
u32 first_index
pool index of first chunk in list
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Simple first-fit virtual space allocator.
__clib_export uword clib_valloc_free(clib_valloc_main_t *vam, uword baseva)
Free virtual space.
description fragment has unexpected format
uword flags
flags (free/busy)
static uword pool_elts(void *v)
Number of active elements in a pool.
#define CLIB_VALLOC_BUSY
chunk is in use
__clib_export void clib_valloc_init(clib_valloc_main_t *vam, clib_valloc_chunk_t *template, int need_lock)
Initialize a virtual memory allocation arena.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
clib_valloc_chunk_t * chunks
pool of virtual chunks
uword * chunk_index_by_baseva
chunk by baseva hash
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
clib_spinlock_t lock
spinlock
#define hash_create(elts, value_bytes)
#define CLIB_VALLOC_INITIALIZED
object has been initialized