40 #ifndef included_vlib_node_funcs_h 41 #define included_vlib_node_funcs_h 85 u32 n_runtime_data_bytes)
129 n->
state = new_state;
130 r->
state = new_state;
192 #define VLIB_FRAME_VECTOR_ALIGN (1 << 4) 220 ASSERT (next_index < n->n_next_nodes);
253 u32 alloc_new_frame);
255 #define vlib_get_next_frame_macro(vm,node,next_index,vectors,n_vectors_left,alloc_new_frame) \ 258 = vlib_get_next_frame_internal ((vm), (node), (next_index), \ 259 (alloc_new_frame)); \ 260 u32 _n = _f->n_vectors; \ 261 (vectors) = vlib_frame_vector_args (_f) + _n * sizeof ((vectors)[0]); \ 262 (n_vectors_left) = VLIB_FRAME_SIZE - _n; \ 265 #define vlib_get_next_frame(vm,node,next_index,vectors,n_vectors_left) \ 266 vlib_get_next_frame_macro (vm, node, next_index, \ 267 vectors, n_vectors_left, \ 270 #define vlib_get_new_next_frame(vm,node,next_index,vectors,n_vectors_left) \ 271 vlib_get_next_frame_macro (vm, node, next_index, \ 272 vectors, n_vectors_left, \ 282 #define vlib_set_next_frame(vm,node,next_index,v) \ 285 vlib_get_next_frame ((vm), (node), (next_index), (v), _n_left); \ 286 ASSERT (_n_left > 0); \ 287 vlib_put_next_frame ((vm), (node), (next_index), _n_left - 1); \ 323 {
return dt < 1e-6; }
352 if (is_one_time_event)
372 void * event_data_vector;
392 *return_event_type_opaque = et->
opaque;
396 return event_data_vector;
463 uword with_type_opaque)
504 uword ** data_vector,
505 uword with_type_index)
526 uword ** data_vector,
527 uword with_type_opaque)
588 et->
opaque = with_type_opaque;
624 uword n_data_elt_bytes)
626 uword p_flags, add_to_pending, delete_from_wheel;
627 void * data_to_be_written_by_caller;
641 _vec_len (data_vec) = 0;
646 data_vec = _vec_resize (data_vec,
648 (l + n_data_elts) * n_data_elt_bytes,
652 data_to_be_written_by_caller = data_vec + l * n_data_elt_bytes;
663 delete_from_wheel = 0;
668 delete_from_wheel = 1;
684 if (delete_from_wheel)
688 return data_to_be_written_by_caller;
696 uword n_data_elt_bytes)
722 uword n_data_elt_bytes)
780 uword n_data_elt_bytes)
825 memset (p, ~0,
sizeof (p[0]));
875 vi0 = d == 0 ? vi0 : 0;
876 vi1 = d <= 1 ? vi1 : 0;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
always_inline u32 vlib_frame_index_no_check(vlib_main_t *vm, vlib_frame_t *f)
always_inline uword round_pow2(uword x, uword pow2)
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
always_inline uword vlib_process_create_one_time_event(vlib_main_t *vm, uword node_index, uword with_type_opaque)
vlib_process_t ** processes
always_inline uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
format_function_t format_vlib_node_name
vlib_node_runtime_t node_runtime
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
always_inline vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
always_inline vlib_next_frame_t * vlib_node_runtime_get_next_frame(vlib_main_t *vm, vlib_node_runtime_t *n, u32 next_index)
#define VLIB_FRAME_IS_ALLOCATED
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
u32 main_loop_vector_stats[2]
always_inline void vlib_process_signal_event_pointer(vlib_main_t *vm, uword node_index, uword type_opaque, void *data)
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).
always_inline uword vlib_process_suspend_time_is_zero(f64 dt)
#define vlib_set_next_frame(vm, node, next_index, v)
always_inline void vlib_node_set_interrupt_pending(vlib_main_t *vm, u32 node_index)
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.
always_inline void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
always_inline uword vlib_process_get_events_with_type(vlib_main_t *vm, uword **data_vector, uword with_type_opaque)
always_inline 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)
void clib_longjmp(clib_longjmp_t *save, uword return_value)
u8 * event_data_as_vector
format_function_t format_vlib_cpu_time
always_inline uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
void timing_wheel_insert(timing_wheel_t *w, u64 insert_cpu_time, u32 user_data)
uword clib_setjmp(clib_longjmp_t *save, uword return_value_not_taken)
always_inline void vlib_signal_one_time_waiting_process_vector(vlib_main_t *vm, vlib_one_time_waiting_process_t **wps)
always_inline u32 vlib_timing_wheel_data_set_timed_event(u32 i)
always_inline vlib_frame_t * vlib_get_frame(vlib_main_t *vm, uword frame_index)
#define VLIB_PROCESS_RESUME_PENDING
#define vec_pop(V)
Returns last element of a vector and decrements its length.
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
u32 * pending_interrupt_node_runtime_indices
u32 main_loop_count_last_dispatch
void vlib_node_rename(vlib_main_t *vm, u32 node_index, char *fmt,...)
void ** recycled_event_data_vectors
format_function_t format_vlib_node_and_next
#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.
always_inline uword clib_bitmap_first_set(uword *ai)
always_inline void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
always_inline void vlib_signal_one_time_waiting_process(vlib_main_t *vm, vlib_one_time_waiting_process_t *p)
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)
vlib_node_runtime_t * nodes_by_type[VLIB_N_NODE_TYPE]
always_inline uword vlib_process_get_events_helper(vlib_process_t *p, uword t, uword **data_vector)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
clib_error_t * vlib_node_main_init(vlib_main_t *vm)
always_inline void vlib_process_maybe_free_event_type(vlib_process_t *p, uword t)
#define pool_elt_at_index(p, i)
u32 vlib_register_node(vlib_main_t *vm, vlib_node_registration_t *r)
vlib_signal_timed_event_data_t * signal_timed_event_data_pool
vlib_error_main_t error_main
always_inline uword * vlib_process_wait_for_event(vlib_main_t *vm)
always_inline u32 vlib_node_vectors_per_main_loop_as_integer(vlib_main_t *vm, u32 node_index)
always_inline void vlib_process_signal_one_time_event(vlib_main_t *vm, uword node_index, uword type_index, uword data)
u8 inline_event_data[64-3 *sizeof(u32)-2 *sizeof(u16)]
always_inline void vlib_process_free_event_type(vlib_process_t *p, uword t, uword is_one_time_event)
always_inline f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
always_inline uword vlib_process_wait_for_one_time_event(vlib_main_t *vm, uword **data_vector, uword with_type_index)
#define VLIB_PROCESS_RESUME_LONGJMP_SUSPEND
always_inline u32 vlib_frame_vector_byte_offset(u32 scalar_size)
always_inline void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
always_inline vlib_frame_t * vlib_get_frame_no_check(vlib_main_t *vm, uword frame_index)
always_inline u32 vlib_node_runtime_update_main_loop_vector_stats(vlib_main_t *vm, vlib_node_runtime_t *node, uword n_vectors)
always_inline void * vlib_frame_args(vlib_frame_t *f)
always_inline vlib_node_t * vlib_get_next_node(vlib_main_t *vm, u32 node_index, u32 next_index)
#define VLIB_PROCESS_RETURN_LONGJMP_SUSPEND
always_inline uword vlib_node_add_named_next(vlib_main_t *vm, uword node, char *name)
always_inline vlib_next_frame_t * vlib_node_get_next_frame(vlib_main_t *vm, u32 node_index, u32 next_index)
#define pool_get_aligned(P, E, A)
timing_wheel_t timing_wheel
#define VLIB_FRAME_VECTOR_ALIGN
always_inline uword clib_bitmap_get(uword *ai, uword i)
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *next_name, uword slot)
#define vec_free(V)
Free vector's memory (no header).
#define clib_memcpy(a, b, c)
void timing_wheel_delete(timing_wheel_t *w, u32 user_data)
always_inline uword vlib_process_wait_for_event_with_type(vlib_main_t *vm, uword **data_vector, uword with_type_opaque)
uword vlib_node_add_next_with_slot(vlib_main_t *vm, uword node, uword next_node, uword slot)
always_inline void vlib_process_put_event_data(vlib_main_t *vm, void *event_data)
always_inline 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)
#define pool_is_free_index(P, I)
always_inline u32 vlib_frame_index(vlib_main_t *vm, vlib_frame_t *f)
always_inline u32 vlib_timing_wheel_data_set_suspended_process(u32 i)
uword * one_time_event_type_bitmap
always_inline uword is_pow2(uword x)
#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)
always_inline vlib_process_t * vlib_get_process_from_node(vlib_main_t *vm, vlib_node_t *node)
always_inline void vlib_process_delete_one_time_event(vlib_main_t *vm, uword node_index, uword t)
always_inline f64 vlib_node_vectors_per_main_loop_as_float(vlib_main_t *vm, u32 node_index)
always_inline vlib_process_event_type_t * vlib_process_new_event_type(vlib_process_t *p, uword with_type_opaque)
#define VLIB_PROCESS_RESUME_LONGJMP_RESUME
vlib_frame_t * vlib_get_next_frame_internal(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 alloc_new_frame)
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
always_inline uword clib_bitmap_is_zero(uword *ai)
#define vec_elt(v, i)
Get vector value at index i.
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)
always_inline void * vlib_node_get_runtime_data(vlib_main_t *vm, u32 node_index)
vlib_process_event_type_t * event_type_pool
always_inline void vlib_current_process_wait_for_one_time_event_vector(vlib_main_t *vm, vlib_one_time_waiting_process_t **wps)
u32 * data_from_advancing_timing_wheel
always_inline void * vlib_process_get_event_data(vlib_main_t *vm, uword *return_event_type_opaque)
#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
format_function_t format_vlib_time
vlib_next_frame_t * next_frames
always_inline void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
always_inline void vlib_node_set_runtime_data(vlib_main_t *vm, u32 node_index, void *runtime_data, u32 n_runtime_data_bytes)
uword * event_type_index_by_type_opaque
#define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK
unformat_function_t unformat_vlib_node
always_inline uword vlib_in_process_context(vlib_main_t *vm)
always_inline uword vlib_current_process(vlib_main_t *vm)
always_inline vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
void vlib_register_all_static_nodes(vlib_main_t *vm)
always_inline vlib_process_t * vlib_get_current_process(vlib_main_t *vm)
#define vec_foreach(var, vec)
Vector iterator.
always_inline 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)
clib_longjmp_t return_longjmp
always_inline f64 vlib_time_now(vlib_main_t *vm)
always_inline 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)
clib_longjmp_t resume_longjmp
always_inline u64 clib_cpu_time_now(void)
uword runtime_data[(128-1 *sizeof(vlib_node_function_t *)-1 *sizeof(vlib_error_t *)-11 *sizeof(u32)-5 *sizeof(u16))/sizeof(uword)]
always_inline void vlib_current_process_wait_for_one_time_event(vlib_main_t *vm, vlib_one_time_waiting_process_t *p)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
always_inline u32 counter_index(vlib_main_t *vm, vlib_error_t e)
format_function_t format_vlib_node_graph
vlib_main_t ** vlib_mains
uword * non_empty_event_type_bitmap