40 #ifndef included_vlib_node_h 41 #define included_vlib_node_h 89 typedef struct _vlib_node_fn_registration
93 struct _vlib_node_fn_registration *next_registration;
97 typedef struct _vlib_node_registration
115 vlib_node_type_t
type;
118 char **error_strings;
137 u16 process_log2_n_stack_bytes;
140 u8 runtime_data_bytes;
161 struct _vlib_node_registration *next_registration;
168 #ifndef CLIB_MARCH_VARIANT 169 #define VLIB_REGISTER_NODE(x,...) \ 170 __VA_ARGS__ vlib_node_registration_t x; \ 171 static void __vlib_add_node_registration_##x (void) \ 172 __attribute__((__constructor__)) ; \ 173 static void __vlib_add_node_registration_##x (void) \ 175 vlib_main_t * vm = vlib_get_main(); \ 176 x.next_registration = vm->node_main.node_registrations; \ 177 vm->node_main.node_registrations = &x; \ 179 static void __vlib_rm_node_registration_##x (void) \ 180 __attribute__((__destructor__)) ; \ 181 static void __vlib_rm_node_registration_##x (void) \ 183 vlib_main_t * vm = vlib_get_main(); \ 184 VLIB_REMOVE_FROM_LINKED_LIST (vm->node_main.node_registrations, \ 185 &x, next_registration); \ 187 __VA_ARGS__ vlib_node_registration_t x 189 #define VLIB_REGISTER_NODE(x,...) \ 190 STATIC_ASSERT (sizeof(# __VA_ARGS__) != 7,"node " #x " must not be declared as static"); \ 191 static __clib_unused vlib_node_registration_t __clib_unused_##x 194 #ifndef CLIB_MARCH_VARIANT 195 #define CLIB_MARCH_VARIANT_STR "default" 197 #define _CLIB_MARCH_VARIANT_STR(s) __CLIB_MARCH_VARIANT_STR(s) 198 #define __CLIB_MARCH_VARIANT_STR(s) #s 199 #define CLIB_MARCH_VARIANT_STR _CLIB_MARCH_VARIANT_STR(CLIB_MARCH_VARIANT) 202 #define VLIB_NODE_FN(node) \ 203 uword CLIB_MARCH_SFX (node##_fn)(); \ 204 static vlib_node_fn_registration_t \ 205 CLIB_MARCH_SFX(node##_fn_registration) = \ 206 { .function = &CLIB_MARCH_SFX (node##_fn), }; \ 208 static void __clib_constructor \ 209 CLIB_MARCH_SFX (node##_multiarch_register) (void) \ 211 extern vlib_node_registration_t node; \ 212 vlib_node_fn_registration_t *r; \ 213 r = & CLIB_MARCH_SFX (node##_fn_registration); \ 214 r->priority = CLIB_MARCH_FN_PRIORITY(); \ 215 r->name = CLIB_MARCH_VARIANT_STR; \ 216 r->next_registration = node.node_fn_registrations; \ 217 node.node_fn_registrations = r; \ 219 uword CLIB_CPU_OPTIMIZED CLIB_MARCH_SFX (node##_fn) 228 c->n_next_nodes * sizeof (c->next_nodes[0]));
240 #define foreach_vlib_node_state \ 251 #define _(f) VLIB_NODE_STATE_##f, 292 #define VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH (1 << 0) 295 #define VLIB_NODE_FLAG_IS_OUTPUT (1 << 1) 296 #define VLIB_NODE_FLAG_IS_DROP (1 << 2) 297 #define VLIB_NODE_FLAG_IS_PUNT (1 << 3) 298 #define VLIB_NODE_FLAG_IS_HANDOFF (1 << 4) 301 #define VLIB_NODE_FLAG_TRACE (1 << 5) 303 #define VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE (1 << 6) 304 #define VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE (1 << 7) 305 #define VLIB_NODE_FLAG_TRACE_SUPPORTED (1 << 8) 374 #define VLIB_INVALID_NODE_INDEX ((u32) ~0) 377 #define VLIB_FRAME_SIZE 256 378 #define VLIB_FRAME_ALIGN CLIB_CACHE_LINE_BYTES 414 #define VLIB_FRAME_NO_FREE_AFTER_DISPATCH \ 415 VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH 418 #define VLIB_FRAME_NO_APPEND (1 << 14) 422 #define VLIB_FRAME_OWNER (1 << 15) 425 #define VLIB_FRAME_IS_ALLOCATED VLIB_NODE_FLAG_IS_OUTPUT 428 #define VLIB_FRAME_PENDING VLIB_NODE_FLAG_IS_DROP 431 #define VLIB_FRAME_FREE_AFTER_DISPATCH VLIB_NODE_FLAG_IS_PUNT 434 #define VLIB_FRAME_TRACE VLIB_NODE_FLAG_TRACE 460 #define VLIB_PENDING_FRAME_NO_NEXT_FRAME ((u32) ~0) 498 u32 main_loop_vector_stats[2];
529 #define VLIB_NODE_RUNTIME_DATA_SIZE (sizeof (vlib_node_runtime_t) - STRUCT_OFFSET_OF (vlib_node_runtime_t, runtime_data)) 555 #define VLIB_PROCESS_RETURN_LONGJMP_RETURN ((uword) ~0 - 0) 556 #define VLIB_PROCESS_RETURN_LONGJMP_SUSPEND ((uword) ~0 - 1) 560 #define VLIB_PROCESS_RESUME_LONGJMP_SUSPEND 0 561 #define VLIB_PROCESS_RESUME_LONGJMP_RESUME 1 564 #define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK (1 << 0) 565 #define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT (1 << 1) 567 #define VLIB_PROCESS_RESUME_PENDING (1 << 2) 570 #define VLIB_PROCESS_IS_RUNNING (1 << 3) 611 #define VLIB_PROCESS_STACK_MAGIC (0xdead7ead) 638 u8 inline_event_data[64 - 3 *
sizeof (
u32) - 2 *
sizeof (
u16)];
685 #define VLIB_NODE_MAIN_RUNTIME_STARTED (1 << 0) 769 #define FRAME_QUEUE_MAX_NELTS 64
uword output_function_arg
volatile u32 * pending_remote_interrupts_notify
u32 max_clock
Maximum clock cycle for an invocation.
u32 next_frame_index
Start of next frames for this node.
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
u32 interrupt_threshold_vector_length
vlib_process_t ** processes
vl_api_wireguard_peer_flags_t flags
vlib_node_runtime_t node_runtime
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
format_function_t * format_trace
void ** pending_event_data_by_type_index
u32 current_process_index
u32 clocks_since_last_overflow
Number of clock cycles.
u8 * event_data_as_vector
clib_spinlock_t pending_interrupt_lock
vlib_error_t * errors
Vector of errors for this node.
struct vlib_frame_t vlib_frame_t
static vlib_node_registration_t * vlib_node_next_registered(vlib_node_registration_t *c)
u16 thread_index
thread this node runs on
u32 input_main_loops_per_call
For input nodes: decremented on each main loop interation until it reaches zero and function is calle...
vlib_node_stats_t stats_last_clear
u32 main_loop_count_last_dispatch
Saved main loop counter of last dispatch of this node.
void ** recycled_event_data_vectors
u32 vectors_since_last_overflow
Number of vector elements processed by this node.
static uword vlib_timing_wheel_data_is_timed_event(u32 d)
struct _vlib_node_fn_registration vlib_node_fn_registration_t
vlib_node_interrupt_t * pending_remote_interrupts
unformat_function_t unformat_vlib_node_variant
vl_api_fib_path_type_t type
u32 calls_since_last_overflow
Number of calls.
vlib_node_stats_t stats_total
u16 state
Input node state.
vlib_signal_timed_event_data_t * signal_timed_event_data_pool
static void vlib_next_frame_init(vlib_next_frame_t *nf)
f64 time_last_runtime_stats_clear
vlib_node_registration_t * node_registrations
static uword vlib_timing_wheel_data_get_index(u32 d)
u32 polling_threshold_vector_length
u64 * n_vectors_by_next_node
format_function_t * format_buffer
u32 node_index
Node index.
static u32 vlib_error_get_code(vlib_node_main_t *nm, vlib_error_t e)
vlib_pending_frame_t * pending_frames
sll srl srl sll sra u16x4 i
unformat_function_t * unformat_buffer
vlib_frame_t ** free_frames
vlib_node_fn_registration_t * node_fn_registrations
vlib_main_t vlib_node_runtime_t * node
uword * one_time_event_type_bitmap
vlib_node_interrupt_t * pending_local_interrupts
#define clib_elf_section_data_next(a, extra)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
struct vlib_node_runtime_t vlib_node_runtime_t
uword() vlib_node_function_t(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, struct vlib_frame_t *frame)
uword * next_slot_by_node
#define foreach_vlib_node_state
static u32 vlib_error_get_node(vlib_node_main_t *nm, vlib_error_t e)
struct _vlib_node_registration vlib_node_registration_t
vlib_process_event_type_t * event_type_pool
u32 * data_from_advancing_timing_wheel
vlib_pending_frame_t * suspended_process_frames
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
vlib_next_frame_t * next_frames
static u32 vlib_timing_wheel_data_set_timed_event(u32 i)
u32 interrupt_data
Data passed together with interrupt.
uword * event_type_index_by_type_opaque
vlib_frame_size_t * frame_sizes
u64 resume_clock_interval
u32 suspended_process_frame_index
vl_api_dhcp_client_state_t state
clib_longjmp_t return_longjmp
u16 flags
Copy of main node flags.
void() vlib_cli_output_function_t(uword arg, u8 *buffer, uword buffer_bytes)
vlib_cli_output_function_t * output_function
clib_longjmp_t resume_longjmp
static u32 vlib_timing_wheel_data_set_suspended_process(u32 i)
#define FRAME_QUEUE_MAX_NELTS
f64 time_next_process_ready
struct vlib_node_t vlib_node_t
u32 vectors_since_last_overflow
u32 max_clock_n
Number of vectors in the recorded max_clock.
uword * non_empty_event_type_bitmap