45 #ifndef included_vlib_node_funcs_h 46 #define included_vlib_node_funcs_h 124 void *runtime_data,
u32 n_runtime_data_bytes)
176 n->
state = new_state;
177 r->
state = new_state;
239 #define VLIB_FRAME_VECTOR_ALIGN (1 << 4) 282 ASSERT (next_index < n->n_next_nodes);
325 u32 alloc_new_frame);
327 #define vlib_get_next_frame_macro(vm,node,next_index,vectors,n_vectors_left,alloc_new_frame) \ 330 = vlib_get_next_frame_internal ((vm), (node), (next_index), \ 331 (alloc_new_frame)); \ 332 u32 _n = _f->n_vectors; \ 333 (vectors) = vlib_frame_vector_args (_f) + _n * sizeof ((vectors)[0]); \ 334 (n_vectors_left) = VLIB_FRAME_SIZE - _n; \ 350 #define vlib_get_next_frame(vm,node,next_index,vectors,n_vectors_left) \ 351 vlib_get_next_frame_macro (vm, node, next_index, \ 352 vectors, n_vectors_left, \ 355 #define vlib_get_new_next_frame(vm,node,next_index,vectors,n_vectors_left) \ 356 vlib_get_next_frame_macro (vm, node, next_index, \ 357 vectors, n_vectors_left, \ 370 u32 next_index,
u32 n_packets_left);
373 #define vlib_set_next_frame(vm,node,next_index,v) \ 376 vlib_get_next_frame ((vm), (node), (next_index), (v), _n_left); \ 377 ASSERT (_n_left > 0); \ 378 vlib_put_next_frame ((vm), (node), (next_index), _n_left - 1); \ 385 u32 next_index,
u32 buffer_index)
455 uword is_one_time_event)
459 if (is_one_time_event)
474 uword * return_event_type_opaque)
480 void *event_data_vector;
501 *return_event_type_opaque = et->
opaque;
505 return event_data_vector;
562 uword ** data_vector)
583 uword with_type_opaque)
626 uword ** data_vector,
627 uword with_type_index)
650 uword ** data_vector,
651 uword with_type_opaque)
721 et->
opaque = with_type_opaque;
727 uword with_type_opaque)
761 uword p_flags, add_to_pending, delete_from_wheel;
762 void *data_to_be_written_by_caller;
776 _vec_len (data_vec) = 0;
781 data_vec = _vec_resize (data_vec,
784 (l + n_data_elts) * n_data_elt_bytes,
788 data_to_be_written_by_caller = data_vec + l * n_data_elt_bytes;
800 delete_from_wheel = 0;
805 delete_from_wheel = 1;
821 if (delete_from_wheel)
825 return data_to_be_written_by_caller;
902 signal_timed_event_data_pool));
921 uword n_data_elt_bytes)
942 uword type_opaque,
void *data)
966 memset (p, ~0,
sizeof (p[0]));
1021 vi0 = d == 0 ? vi0 : 0;
1022 vi1 = d <= 1 ? vi1 : 0;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static void vlib_node_set_runtime_data(vlib_main_t *vm, u32 node_index, void *runtime_data, u32 n_runtime_data_bytes)
Set node runtime private data.
static void vlib_process_free_event_type(vlib_process_t *p, uword t, uword is_one_time_event)
#define hash_set(h, key, value)
static void vlib_signal_one_time_waiting_process_vector(vlib_main_t *vm, vlib_one_time_waiting_process_t **wps)
sll srl srl sll sra u16x4 i
static vlib_next_frame_t * vlib_node_get_next_frame(vlib_main_t *vm, u32 node_index, u32 next_index)
Get pointer to frame by (node_index, next_index).
static void vlib_signal_one_time_waiting_process(vlib_main_t *vm, vlib_one_time_waiting_process_t *p)
vlib_process_t ** processes
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
format_function_t format_vlib_node_name
static f64 vlib_node_vectors_per_main_loop_as_float(vlib_main_t *vm, u32 node_index)
vlib_node_runtime_t node_runtime
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
static void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
static uword vlib_current_process(vlib_main_t *vm)
#define VLIB_FRAME_IS_ALLOCATED
static void vlib_node_set_interrupt_pending(vlib_main_t *vm, u32 node_index)
static u32 vlib_timing_wheel_data_set_timed_event(u32 i)
static uword vlib_node_add_named_next(vlib_main_t *vm, uword node, char *name)
static f64 vlib_time_now(vlib_main_t *vm)
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
u32 main_loop_vector_stats[2]
void ** pending_event_data_by_type_index
u32 current_process_index
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static u64 clib_cpu_time_now(void)
#define vlib_set_next_frame(vm, node, next_index, v)
struct _vlib_node_registration vlib_node_registration_t
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define STRUCT_OFFSET_OF(t, f)
void clib_longjmp(clib_longjmp_t *save, uword return_value)
u8 * event_data_as_vector
format_function_t format_vlib_cpu_time
void timing_wheel_insert(timing_wheel_t *w, u64 insert_cpu_time, u32 user_data)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
uword clib_setjmp(clib_longjmp_t *save, uword return_value_not_taken)
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define VLIB_PROCESS_RESUME_PENDING
#define vec_pop(V)
Returns last element of a vector and decrements its length.
static uword vlib_process_suspend_time_is_zero(f64 dt)
Returns TRUE if a process suspend time is less than 1us.
static vlib_frame_t * vlib_get_frame_no_check(vlib_main_t *vm, uword frame_index)
static vlib_process_event_type_t * vlib_process_new_event_type(vlib_process_t *p, uword with_type_opaque)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
u32 * pending_interrupt_node_runtime_indices
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
u32 main_loop_count_last_dispatch
void vlib_node_rename(vlib_main_t *vm, u32 node_index, char *fmt,...)
void ** recycled_event_data_vectors
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
format_function_t format_vlib_node_and_next
static uword clib_bitmap_is_zero(uword *ai)
predicate function; is an entire bitmap empty?
static u32 counter_index(vlib_main_t *vm, vlib_error_t e)
#define VLIB_LOG2_MAIN_LOOPS_PER_STATS_UPDATE
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
format_function_t format_vlib_next_node_name
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
void vlib_frame_free(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_frame_t *f)
static void vlib_process_delete_one_time_event(vlib_main_t *vm, uword node_index, uword t)
vlib_node_runtime_t * nodes_by_type[VLIB_N_NODE_TYPE]
static vlib_next_frame_t * vlib_node_runtime_get_next_frame(vlib_main_t *vm, vlib_node_runtime_t *n, u32 next_index)
clib_error_t * vlib_node_main_init(vlib_main_t *vm)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void * vlib_process_signal_event_helper(vlib_node_main_t *nm, vlib_node_t *n, vlib_process_t *p, uword t, uword n_data_elts, uword n_data_elt_bytes)
u32 vlib_register_node(vlib_main_t *vm, vlib_node_registration_t *r)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
vlib_signal_timed_event_data_t * signal_timed_event_data_pool
static uword clib_bitmap_first_set(uword *ai)
Return the lowest numbered set bit in a bitmap.
vlib_error_main_t error_main
static u32 vlib_frame_index(vlib_main_t *vm, vlib_frame_t *f)
static void vlib_process_maybe_free_event_type(vlib_process_t *p, uword t)
u8 inline_event_data[64-3 *sizeof(u32)-2 *sizeof(u16)]
static void * vlib_process_signal_event_data(vlib_main_t *vm, uword node_index, uword type_opaque, uword n_data_elts, uword n_data_elt_bytes)
static void * vlib_node_get_runtime_data(vlib_main_t *vm, u32 node_index)
Get node runtime private data by node index.
static void vlib_process_signal_one_time_event(vlib_main_t *vm, uword node_index, uword type_index, uword data)
#define VLIB_PROCESS_RESUME_LONGJMP_SUSPEND
static u32 vlib_timing_wheel_data_set_suspended_process(u32 i)
static vlib_frame_t * vlib_get_frame(vlib_main_t *vm, uword frame_index)
#define VLIB_PROCESS_RETURN_LONGJMP_SUSPEND
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
timing_wheel_t timing_wheel
static uword vlib_process_get_events_with_type(vlib_main_t *vm, uword **data_vector, uword with_type_opaque)
static u32 vlib_frame_index_no_check(vlib_main_t *vm, vlib_frame_t *f)
#define VLIB_FRAME_VECTOR_ALIGN
static u32 vlib_node_runtime_update_main_loop_vector_stats(vlib_main_t *vm, vlib_node_runtime_t *node, uword n_vectors)
static void vlib_process_signal_event_pointer(vlib_main_t *vm, uword node_index, uword type_opaque, void *data)
static void * vlib_process_signal_event_at_time(vlib_main_t *vm, f64 dt, uword node_index, uword type_opaque, uword n_data_elts, uword n_data_elt_bytes)
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *next_name, uword slot)
static vlib_process_t * vlib_get_current_process(vlib_main_t *vm)
static uword vlib_process_wait_for_one_time_event(vlib_main_t *vm, uword **data_vector, uword with_type_index)
#define vec_free(V)
Free vector's memory (no header).
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
#define clib_memcpy(a, b, c)
void timing_wheel_delete(timing_wheel_t *w, u32 user_data)
static uword vlib_process_create_one_time_event(vlib_main_t *vm, uword node_index, uword with_type_opaque)
uword vlib_node_add_next_with_slot(vlib_main_t *vm, uword node, uword next_node, uword slot)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static u32 vlib_frame_vector_byte_offset(u32 scalar_size)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
static uword round_pow2(uword x, uword pow2)
uword * one_time_event_type_bitmap
static u32 vlib_node_vectors_per_main_loop_as_integer(vlib_main_t *vm, u32 node_index)
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT
void vlib_start_process(vlib_main_t *vm, uword process_index)
#define pool_put_index(p, i)
Free pool element with given index.
static uword vlib_process_get_events_helper(vlib_process_t *p, uword t, uword **data_vector)
#define VLIB_PROCESS_RESUME_LONGJMP_RESUME
static void * vlib_frame_args(vlib_frame_t *f)
Get pointer to frame scalar data.
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
vlib_frame_t * vlib_get_next_frame_internal(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 alloc_new_frame)
static uword is_pow2(uword x)
static void vlib_current_process_wait_for_one_time_event_vector(vlib_main_t *vm, vlib_one_time_waiting_process_t **wps)
#define vec_elt(v, i)
Get vector value at index i.
template key/value backing page structure
void vlib_node_sync_stats(vlib_main_t *vm, vlib_node_t *n)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_packets_left)
Release pointer to next frame vector data.
static vlib_node_t * vlib_get_next_node(vlib_main_t *vm, u32 node_index, u32 next_index)
Get vlib node by graph arc (next) index.
static void * vlib_process_get_event_data(vlib_main_t *vm, uword *return_event_type_opaque)
vlib_process_event_type_t * event_type_pool
u32 * data_from_advancing_timing_wheel
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 input_node_counts_by_state[VLIB_N_NODE_STATE]
vlib_node_main_t node_main
static uword vlib_process_wait_for_event_with_type(vlib_main_t *vm, uword **data_vector, uword with_type_opaque)
format_function_t format_vlib_time
vlib_next_frame_t * next_frames
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
vlib_main_t ** vlib_mains
uword * event_type_index_by_type_opaque
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK
unformat_function_t unformat_vlib_node
struct clib_bihash_value offset
template key/value backing page structure
static uword vlib_in_process_context(vlib_main_t *vm)
static vlib_process_t * vlib_get_process_from_node(vlib_main_t *vm, vlib_node_t *node)
static void vlib_process_put_event_data(vlib_main_t *vm, void *event_data)
void vlib_register_all_static_nodes(vlib_main_t *vm)
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.
clib_longjmp_t return_longjmp
clib_longjmp_t resume_longjmp
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
format_function_t format_vlib_node_graph
static void vlib_current_process_wait_for_one_time_event(vlib_main_t *vm, vlib_one_time_waiting_process_t *p)
uword * non_empty_event_type_bitmap
static void * vlib_process_signal_one_time_event_data(vlib_main_t *vm, uword node_index, uword type_index, uword n_data_elts, uword n_data_elt_bytes)