30 uword aligned_header_bytes, new_data_bytes;
37 data_bytes = (
vec_len (adjs) + n) *
sizeof (*adjs);
41 new_data_bytes = data_bytes + aligned_header_bytes;
58 int need_barrier_sync = 0;
69 need_barrier_sync = 1;
76 if (need_barrier_sync)
85 adj_block = &adj_heap[index];
92 need_barrier_sync = 1;
98 if (need_barrier_sync)
102 memset (adj_block, 0, n * (
sizeof(*adj_block)));
104 adj_block->
n_adj = n;
135 memset (adj_block, 0, n *
sizeof(*adj_block));
137 memset (ah, 0,
sizeof (*ah));
141 for (i = 0 ; i <
vec_len (adj_heap); i++)
143 adj_block->
n_adj = 1;
156 int verbose = va_arg (*args,
int);
158 u32 inuse = 0, freed = 0;
178 on_freelist += adj->
n_adj;
182 s =
format (s,
"adj_heap: %d total, %d in use, %d free, %d on freelists\n",
183 vec_len(adj_heap), inuse, freed, on_freelist);
194 s =
format (s,
"[%d] ", i);
196 for (j = 0; j < adj->
n_adj; j++)
233 .path =
"show adjacency alloc",
234 .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 * aa_alloc(void)
ip_adjacency_t * adjacency_heap
ip_adjacency_t * adj_heap
The global adjacnecy heap.
#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 aa_free(ip_adjacency_t *adj)
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)
u16 n_adj
Number of adjecencies in block.
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)
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)