51 key =
format (0,
"%s", key);
141 for (j = 0; j < n_insert; j++)
161 if (pf->next_frame_index != ~0 && pf->next_frame_index >= i)
162 pf->next_frame_index += n_insert;
232 if ((old_next_index = node->
next_nodes[slot]) != ~0u)
250 uword sib_node_index, sib_slot;
254 sib_node = vec_elt (nm->nodes, sib_node_index);
255 if (sib_node != node)
257 sib_slot = vlib_node_add_next_with_slot (vm, sib_node_index, next_node_index, slot);
258 ASSERT (sib_slot == slot);
315 #define STACK_ALIGN (clib_mem_get_page_size()) 317 #define STACK_ALIGN CLIB_CACHE_LINE_BYTES 335 if (r->node_fn_registrations)
342 ASSERT (r->function == 0);
346 if (fnr->priority > priority)
348 priority = fnr->priority;
349 r->function = fnr->function;
351 fnr = fnr->next_registration;
355 ASSERT (r->function != 0);
389 if (r->sibling_of && r->n_next_nodes > 0)
390 clib_error (
"sibling node should not have any next nodes `%v'", n->
name);
393 ASSERT (r->vector_size > 0);
395 #define _(f) n->f = r->f 411 _(runtime_data_bytes);
412 if (r->runtime_data_bytes > 0)
420 for (i = 0; i < r->n_next_nodes; i++)
436 uword log2_n_stack_bytes;
438 log2_n_stack_bytes =
clib_max (r->process_log2_n_stack_bytes, 15);
446 if ((page_size > (4 << 10)) && log2_n_stack_bytes < 19)
448 if ((1 << log2_n_stack_bytes) <= page_size)
449 log2_n_stack_bytes =
min_log2 (page_size) + 1;
451 log2_n_stack_bytes++;
456 (
sizeof (p[0]) + (1 << log2_n_stack_bytes),
460 clib_panic (
"failed to allocate process stack (%d bytes)",
461 1 << log2_n_stack_bytes);
484 if (mprotect (p->stack, page_size, PROT_READ) < 0)
552 static char *null_node_error_strings[] = {
553 "blackholed packets",
558 .vector_size =
sizeof (
u32),
561 .error_strings = null_node_error_strings,
572 r = r->next_registration;
588 u32 threads_to_serialize;
611 for (j = 0; j < threads_to_serialize; j++)
613 stat_vm = stat_vms[j];
625 nodes = node_dups[j];
628 node_dups[j] = nodes;
634 *node_dupsp = node_dups;
635 *stat_vmsp = stat_vms;
647 #ifdef VLIB_SUPPORTS_ARBITRARY_SCALAR_SIZES 674 vlib_node_t * m = vec_elt (nm->nodes, si);
677 m->sibling_bitmap = clib_bitmap_ori (m->sibling_bitmap, n->index);
680 n->sibling_bitmap = clib_bitmap_ori (n->sibling_bitmap, si);
709 (
"node `%v' refers to unknown node `%s'", n->
name, a);
775 memset (&r, 0,
sizeof (r));
777 r.name = (
char *)
format (0,
"%s", name, 0);
779 r.process_log2_n_stack_bytes = log2_n_stack_bytes;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
void vlib_node_get_nodes(vlib_main_t *vm, u32 max_threads, int include_stats, int barrier_sync, vlib_node_t ****node_dupsp, vlib_main_t ***stat_vmsp)
Get list of nodes.
u32 next_frame_index
Start of next frames for this node.
#define hash_set(h, key, value)
vlib_process_t ** processes
static void * clib_mem_alloc_aligned_at_offset(uword size, uword align, uword align_offset, int os_out_of_memory_on_failure)
#define hash_unset(h, key)
vlib_node_runtime_t node_runtime
#define VLIB_PENDING_FRAME_NO_NEXT_FRAME
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
u8 runtime_data[0]
Function dependent node-runtime data.
#define clib_error(format, args...)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define vec_add2_aligned(V, P, N, A)
Add N elements to end of vector V, return pointer to new elements in P.
void vlib_register_all_static_nodes(vlib_main_t *vm)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define STRUCT_OFFSET_OF(t, f)
char * format
Format string.
vlib_error_t * errors
Vector of errors for this node.
vlib_main_t ** vlib_mains
static uword min_log2(uword x)
vlib_node_function_t * function
#define vlib_worker_thread_barrier_sync(X)
#define clib_memcpy(d, s, n)
void vlib_register_errors(vlib_main_t *vm, u32 node_index, u32 n_errors, char *error_strings[])
#define VLIB_NODE_RUNTIME_DATA_SIZE
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
void vlib_worker_thread_node_runtime_update(void)
vlib_node_function_t * function
Node function to call.
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
uword vlib_node_add_next_with_slot(vlib_main_t *vm, uword node_index, uword next_node_index, uword slot)
struct _vlib_node_fn_registration vlib_node_fn_registration_t
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
#define clib_error_create(args...)
vlib_node_runtime_t * nodes_by_type[VLIB_N_NODE_TYPE]
vl_api_fib_path_type_t type
static void vlib_node_runtime_update(vlib_main_t *vm, u32 node_index, u32 next_index)
vlib_worker_thread_t * vlib_worker_threads
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
#define vec_insert(V, N, M)
Insert N vector elements starting at element M, initialize new elements to zero (no header...
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
u16 state
Input node state.
static void register_node(vlib_main_t *vm, vlib_node_registration_t *r)
static void node_elog_init(vlib_main_t *vm, uword ni)
static void vlib_next_frame_init(vlib_next_frame_t *nf)
#define VLIB_FRAME_NO_FREE_AFTER_DISPATCH
u32 vlib_process_create(vlib_main_t *vm, char *name, vlib_node_function_t *f, u32 log2_n_stack_bytes)
Create a vlib process.
static uword null_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
uword clib_mem_get_page_size(void)
vlib_node_registration_t * node_registrations
u32 vlib_register_node(vlib_main_t *vm, vlib_node_registration_t *r)
elog_event_type_t * node_return_elog_event_types
#define vec_dup(V)
Return copy of vector (no header, no alignment)
void vlib_frame_free(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_frame_t *f)
u64 * n_vectors_by_next_node
u32 node_index
Node index.
#define VLIB_PROCESS_STACK_MAGIC
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *name, uword slot)
#define clib_mem_alloc_no_fail(size)
static_always_inline uword vlib_get_thread_index(void)
vlib_pending_frame_t * pending_frames
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
#define VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
vlib_node_fn_registration_t * node_fn_registrations
vlib_main_t vlib_node_runtime_t * node
volatile u32 * wait_at_barrier
#define hash_create(elts, value_bytes)
clib_error_t * vlib_node_main_init(vlib_main_t *vm)
static void vlib_worker_thread_node_rename(u32 node_index)
uword() vlib_node_function_t(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, struct vlib_frame_t *frame)
uword vlib_node_get_next(vlib_main_t *vm, uword node_index, uword next_node_index)
uword * next_slot_by_node
static uword clib_mem_is_heap_object(void *p)
static void node_set_elog_name(vlib_main_t *vm, uword node_index)
void vlib_node_sync_stats(vlib_main_t *vm, vlib_node_t *n)
#define vec_elt(v, i)
Get vector value at index i.
struct _vlib_node_registration vlib_node_registration_t
#define hash_create_vec(elts, key_bytes, value_bytes)
u32 elog_string(elog_main_t *em, char *fmt,...)
add a string to the event-log string table
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 input_node_counts_by_state[VLIB_N_NODE_STATE]
vlib_pending_frame_t * suspended_process_frames
vlib_node_main_t node_main
vlib_next_frame_t * next_frames
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define clib_unix_warning(format, args...)
vlib_frame_size_t * frame_sizes
elog_event_type_t * node_call_elog_event_types
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
#define VLIB_NODE_MAIN_RUNTIME_STARTED
vl_api_dhcp_client_state_t state
static void * vec_header(void *v, uword header_bytes)
Find a user vector header.
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
#define vec_foreach(var, vec)
Vector iterator.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
u16 flags
Copy of main node flags.
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
#define CLIB_CACHE_LINE_BYTES
void vlib_start_process(vlib_main_t *vm, uword process_index)
#define STATIC_ASSERT_SIZEOF(d, s)
void vlib_node_rename(vlib_main_t *vm, u32 node_index, char *fmt,...)
#define clib_panic(format, args...)