|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
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;
96 typedef struct _vlib_node_registration
117 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_global_main_t *vgm = vlib_get_global_main (); \
176 x.next_registration = vgm->node_registrations; \
177 vgm->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_global_main_t *vgm = vlib_get_global_main (); \
184 VLIB_REMOVE_FROM_LINKED_LIST (vgm->node_registrations, &x, \
185 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 CLIB_MARCH_SFX ( \
205 node##_fn_registration) = { \
206 .function = &CLIB_MARCH_SFX (node##_fn), \
209 static void __clib_constructor CLIB_MARCH_SFX (node##_multiarch_register) ( \
212 extern vlib_node_registration_t node; \
213 vlib_node_fn_registration_t *r; \
214 r = &CLIB_MARCH_SFX (node##_fn_registration); \
215 r->march_variant = CLIB_MARCH_SFX (CLIB_MARCH_VARIANT_TYPE); \
216 r->next_registration = node.node_fn_registrations; \
217 node.node_fn_registrations = r; \
219 uword CLIB_MARCH_SFX (node##_fn)
231 #define foreach_vlib_node_state \
242 #define _(f) VLIB_NODE_STATE_##f,
283 #define VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH (1 << 0)
286 #define VLIB_NODE_FLAG_IS_OUTPUT (1 << 1)
287 #define VLIB_NODE_FLAG_IS_DROP (1 << 2)
288 #define VLIB_NODE_FLAG_IS_PUNT (1 << 3)
289 #define VLIB_NODE_FLAG_IS_HANDOFF (1 << 4)
292 #define VLIB_NODE_FLAG_TRACE (1 << 5)
294 #define VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE (1 << 6)
295 #define VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE (1 << 7)
296 #define VLIB_NODE_FLAG_TRACE_SUPPORTED (1 << 8)
297 #define VLIB_NODE_FLAG_ADAPTIVE_MODE (1 << 9)
366 #define VLIB_INVALID_NODE_INDEX ((u32) ~0)
369 #define VLIB_FRAME_SIZE 256
370 #define VLIB_FRAME_ALIGN CLIB_CACHE_LINE_BYTES
400 u32 node_runtime_index;
406 #define VLIB_FRAME_NO_FREE_AFTER_DISPATCH \
407 VLIB_NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH
410 #define VLIB_FRAME_NO_APPEND (1 << 14)
414 #define VLIB_FRAME_OWNER (1 << 15)
417 #define VLIB_FRAME_IS_ALLOCATED VLIB_NODE_FLAG_IS_OUTPUT
420 #define VLIB_FRAME_PENDING VLIB_NODE_FLAG_IS_DROP
423 #define VLIB_FRAME_FREE_AFTER_DISPATCH VLIB_NODE_FLAG_IS_PUNT
426 #define VLIB_FRAME_TRACE VLIB_NODE_FLAG_TRACE
429 u32 vectors_since_last_overflow;
446 u32 node_runtime_index;
449 u32 next_frame_index;
452 #define VLIB_PENDING_FRAME_NO_NEXT_FRAME ((u32) ~0)
517 #define VLIB_NODE_RUNTIME_DATA_SIZE (sizeof (vlib_node_runtime_t) - STRUCT_OFFSET_OF (vlib_node_runtime_t, runtime_data))
543 #define VLIB_PROCESS_RETURN_LONGJMP_RETURN ((uword) ~0 - 0)
544 #define VLIB_PROCESS_RETURN_LONGJMP_SUSPEND ((uword) ~0 - 1)
548 #define VLIB_PROCESS_RESUME_LONGJMP_SUSPEND 0
549 #define VLIB_PROCESS_RESUME_LONGJMP_RESUME 1
552 #define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK (1 << 0)
553 #define VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT (1 << 1)
555 #define VLIB_PROCESS_RESUME_PENDING (1 << 2)
558 #define VLIB_PROCESS_IS_RUNNING (1 << 3)
561 u16 log2_n_stack_bytes;
563 u32 suspended_process_frame_index;
569 void **pending_event_data_by_type_index;
572 uword *non_empty_event_type_bitmap;
575 uword *one_time_event_type_bitmap;
579 uword *event_type_index_by_type_opaque;
588 u64 resume_clock_interval;
591 u32 stop_timer_handle;
596 uword output_function_arg;
599 #define VLIB_PROCESS_STACK_MAGIC (0xdead7ead)
614 u16 n_data_elt_bytes;
620 u32 process_node_index;
622 u32 event_type_index;
626 u8 inline_event_data[64 - 3 *
sizeof (
u32) - 2 *
sizeof (
u16)];
629 u8 *event_data_as_vector;
675 #define VLIB_NODE_MAIN_RUNTIME_STARTED (1 << 0)
683 volatile u32 *pending_interrupts;
688 u32 polling_threshold_vector_length;
689 u32 interrupt_threshold_vector_length;
703 u32 *data_from_advancing_timing_wheel;
706 f64 time_next_process_ready;
713 u32 current_process_index;
719 void **recycled_event_data_vectors;
725 uword *frame_size_hash;
731 f64 time_last_runtime_stats_clear;
740 u32 node_fn_default_march_variant;
743 uword *node_fn_march_variant_by_suffix;
751 return nm->node_by_error[e];
763 #define FRAME_QUEUE_MAX_NELTS 64
u32 clocks_since_last_overflow
Number of clock cycles.
struct _vlib_node_fn_registration vlib_node_fn_registration_t
u16 flags
Copy of main node flags.
CLIB_CACHE_LINE_ALIGN_MARK(cacheline0)
cacheline mark
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static uword vlib_timing_wheel_data_is_timed_event(u32 d)
static u32 vlib_error_get_node(vlib_node_main_t *nm, vlib_error_t e)
@ VLIB_NODE_TYPE_PRE_INPUT
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
format_function_t * format_trace
u32 max_clock_n
Number of vectors in the recorded max_clock.
@ VLIB_NODE_PROTO_HINT_ETHERNET
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
struct vlib_node_runtime_t vlib_node_runtime_t
u32 max_clock
Maximum clock cycle for an invocation.
@ VLIB_NODE_PROTO_HINT_NONE
vlib_node_fn_registration_t * node_fn_registrations
@ VLIB_NODE_PROTO_HINT_IP4
u32 next_frame_index
Start of next frames for this node.
static u32 vlib_error_get_code(vlib_node_main_t *nm, vlib_error_t e)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u32 calls_since_last_overflow
Number of calls.
vl_api_dhcp_client_state_t state
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_N_PROTO_HINTS
uword * next_slot_by_node
uword() vlib_node_function_t(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, struct vlib_frame_t *frame)
unformat_function_t * unformat_buffer
u32 vectors_since_last_overflow
Number of vector elements processed by this node.
u32 main_loop_vector_stats[2]
u16 thread_index
thread this node runs on
vlib_error_t * errors
Vector of errors for this node.
format_function_t * format_buffer
u32 main_loop_count_last_dispatch
Saved main loop counter of last dispatch of this node.
static u32 vlib_timing_wheel_data_set_timed_event(u32 i)
u16 state
Input node state.
static u32 vlib_timing_wheel_data_set_suspended_process(u32 i)
struct vlib_node_t vlib_node_t
void() vlib_cli_output_function_t(uword arg, u8 *buffer, uword buffer_bytes)
static uword vlib_timing_wheel_data_get_index(u32 d)
struct _vlib_node_registration vlib_node_registration_t
@ VLIB_NODE_PROTO_HINT_IP6
vlib_error_desc_t * error_counters
@ VLIB_NODE_PROTO_HINT_UDP
#define FRAME_QUEUE_MAX_NELTS
u32 node_index
Node index.
@ VLIB_NODE_PROTO_HINT_TCP
clib_march_variant_type_t
vlib_node_stats_t stats_total
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_node_stats_t stats_last_clear
u64 * n_vectors_by_next_node
#define foreach_vlib_node_state
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static void vlib_next_frame_init(vlib_next_frame_t *nf)
u8 runtime_data[0]
Function dependent node-runtime data.
struct vlib_frame_t vlib_frame_t
vl_api_fib_path_type_t type
unformat_function_t unformat_vlib_node_variant
vl_api_wireguard_peer_flags_t flags