26 uword aligned_header_bytes, new_data_bytes;
33 data_bytes = (
vec_len (adjs) + n) *
sizeof (*adjs);
37 new_data_bytes = data_bytes + aligned_header_bytes;
54 int need_barrier_sync = 0;
64 need_barrier_sync = 1;
71 if (need_barrier_sync)
80 adj_block = &adjs[index];
87 need_barrier_sync = 1;
93 if (need_barrier_sync)
97 memset (adj_block, 0, n * (
sizeof(*adj_block)));
125 memset (adj_block, 0, n *
sizeof(*adj_block));
127 memset (ah, 0,
sizeof (*ah));
131 for (i = 0 ; i <
vec_len (adjs); i++)
133 adj_block->
n_adj = 1;
147 int verbose = va_arg (*args,
int);
149 u32 inuse = 0, freed = 0;
169 on_freelist += adj->
n_adj;
173 s =
format (s,
"adjs: %d total, %d in use, %d free, %d on freelists\n",
174 vec_len(adjs), inuse, freed, on_freelist);
185 s =
format (s,
"[%d] ", i);
187 for (j = 0; j < adj->
n_adj; j++)
238 .path =
"show adjacency alloc",
239 .short_help =
"show adjacency alloc",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
sll srl srl sll sra u16x4 i
ip_adjacency_t * adjacency_heap
Adjacency heap.
u16 n_adj
Number of adjecencies in block.
ip_adjacency_t * aa_bootstrap(ip_adjacency_t *adjs, u32 n)
ip_adjacency_t * aa_alloc(ip_adjacency_t *adjs, ip_adjacency_t **blockp, u32 n)
void aa_free(ip_adjacency_t *adjs, ip_adjacency_t *adj)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
ip_lookup_main_t lookup_main
vnet_main_t * vnet_get_main(void)
static uword vec_header_bytes(uword header_bytes)
static int will_reallocate(ip_adjacency_t *adjs, u32 n)
static clib_error_t * show_adjacency_alloc_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_add2_ha(V, P, N, H, A)
Add N elements to end of vector V, return pointer to new elements in P.
uword os_get_cpu_number(void)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static uword clib_mem_size(void *p)
vlib_main_t vlib_global_main
void vlib_worker_thread_barrier_sync(vlib_main_t *vm)
#define aa_aligned_header_bytes
ip_lookup_main_t lookup_main
static uword clib_mem_is_heap_object(void *p)
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 heap_handle
Handle for this adjacency in adjacency heap.
u8 * format_adjacency_alloc(u8 *s, va_list *args)
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
ip4_main_t ip4_main
Global ip4 main structure.
#define clib_error_return(e, args...)
#define CLIB_CACHE_LINE_BYTES
static aa_header_t * aa_header(void *v)