|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
108 #define FIB_WALK_QUEUE_STATS_NUM ((fib_walk_queue_stats_t)(FIB_WALK_COMPLETED+1))
110 #define FIB_WALK_QUEUE_STATS { \
111 [FIB_WALK_SCHEDULED] = "scheduled", \
112 [FIB_WALK_COMPLETED] = "completed", \
115 #define FOR_EACH_FIB_WALK_QUEUE_STATS(_wqs) \
116 for ((_wqs) = FIB_WALK_SCHEDULED; \
117 (_wqs) < FIB_WALK_QUEUE_STATS_NUM; \
167 #define HISTOGRAM_VISITS_PER_WALK_MAX (1<<23)
168 #define HISTOGRAM_VISITS_PER_WALK_INCR (1<<10)
169 #define HISTOGRAM_VISITS_PER_WALK_N_BUCKETS \
170 (HISTOGRAM_VISITS_PER_WALK_MAX/HISTOGRAM_VISITS_PER_WALK_INCR)
176 #define HISTORY_N_WALKS 128
177 #define MAX_HISTORY_REASONS 16
191 #define FIB_WALK_DBG(_walk, _fmt, _args...) \
193 vlib_log_debug(fib_walk_logger, \
196 fib_walk_get_index(_walk), \
411 #define FIB_WALK_N_SLEEP (FIB_WALK_LONG_SLEEP+1)
440 #define N_TIME_BUCKETS 128
441 #define TIME_INCREMENTS (N_TIME_BUCKETS/2)
447 #define N_ELTS_BUCKETS 128
464 f64 start_time, consumed_time;
494 }
while ((consumed_time <
quota) &&
514 goto that_will_do_for_now;
523 that_will_do_for_now:
537 bucket = (bucket < 0 ? 0 : bucket);
564 uword event_type, *event_data = 0;
695 if (FIB_NODE_GRAPH_MAX_DEPTH < ++ctx->fnbw_depth)
753 if (FIB_NODE_GRAPH_MAX_DEPTH < ++ctx->fnbw_depth)
909 if (
last->fnbw_reason ==
ctx->fnbw_reason)
916 last->fnbw_depth = ((
last->fnbw_depth >=
ctx->fnbw_depth) ?
965 return (
format(s,
"[@%d] parent:{%s:%d} visits:%d flags:%d", fwi,
979 if ((1<<reason) & flag)
1093 s =
format(s,
"[@%d]: %s:%d visits:%d duration:%.2f completed:%.2f ",
1102 s =
format(s,
"async, ");
1104 s =
format(s,
"reason:");
1124 .path =
"show fib walk",
1125 .short_help =
"show fib walk",
1137 if (
unformat (input,
"%f", &new_quota))
1150 .path =
"set fib walk quota",
1151 .short_help =
"set fib walk quota",
1176 .path =
"set fib walk histogram elements size",
1177 .short_help =
"set fib walk histogram elements size",
1196 .path =
"clear fib walk",
1197 .short_help =
"clear fib walk",
1228 else if (
unformat (input,
"disable"))
1240 .path =
"test fib-walk-process",
1241 .short_help =
"test fib-walk-process [enable|disable]",
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static fib_node_back_walk_rc_t fib_walk_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Another back walk has reach this walk.
static void fib_walk_last_lock_gone(fib_node_t *node)
Walk objects are not parents, nor are they locked.
fib_node_ptr_t fwh_parent
#define FOR_EACH_FIB_WALK_PRIORITY(_prio)
@ FIB_WALK_ADVANCE_DONE
The walk is complete.
@ FIB_WALK_PROCESS_EVENT_DATA
struct fib_walk_history_t_ fib_walk_history_t
u8 * format_fib_node_bw_reason(u8 *s, va_list *args)
static fib_node_index_t fib_walk_queue_get_front(fib_walk_priority_t prio)
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
const char * fib_node_type_get_name(fib_node_type_t type)
fib_walk_flags_t fwh_flags
@ FIB_WALK_ADVANCE_MERGE
The walk merged with the one in front.
#define FIB_WALK_PRIORITIES
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
#define N_ELTS_BUCKETS
Histogram on the number of nodes visted in each quota.
fib_node_type_t fnp_type
node type
enum fib_walk_process_event_t_ fib_walk_process_event
Events sent to the FIB walk process.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static u8 * format_fib_walk_queue_stats(u8 *s, va_list *ap)
u32 fib_node_list_t
A list of FIB nodes.
u32 fw_n_visits
Number of nodes visited by this walk.
static fib_node_t * fib_walk_get_node(fib_node_index_t index)
static u8 * format_fib_walk(u8 *s, va_list *ap)
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
#define vec_end(v)
End (last data address) of vector.
vlib_main_t vlib_node_runtime_t * node
A FIB graph nodes virtual function table.
@ FIB_WALK_ADVANCE_MORE
the walk has more work
@ FIB_WALK_FLAG_SYNC
A synchronous walk.
#define clib_error_return(e, args...)
fib_walk_flags_t_
The flags on a walk.
#define HISTOGRAM_VISITS_PER_WALK_INCR
static clib_error_t * fib_walk_set_histogram_elements_size(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define FIB_NODE_INDEX_INVALID
static u32 history_last_walk_pos
u32 fib_walk_queue_get_size(fib_walk_priority_t prio)
struct fib_walk_queue_t_ fib_walk_queue_t
A representation of one queue of walk.
#define FIB_WALK_QUEUE_STATS_NUM
enum fib_node_bw_reason_flag_t_ fib_node_bw_reason_flag_t
Flags enum constructed from the reaons.
u64 fwq_stats[FIB_WALK_QUEUE_STATS_NUM]
Qeuee stats.
enum fib_walk_flags_t_ fib_walk_flags_t
The flags on a walk.
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static u64 fib_walk_work_nodes_visited[N_ELTS_BUCKETS]
enum fib_walk_sleep_type_t_ fib_walk_sleep_type_t
Enurmerate the times of sleep between walks.
#define HISTOGRAM_VISITS_PER_WALK_N_BUCKETS
f64 fib_walk_process_queues(vlib_main_t *vm, const f64 quota)
Service the queues This is not declared static so that it can be unit tested - i know i know....
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
struct fib_walk_queues_t_ fib_walk_queues_t
A set of priority queues for outstanding walks.
@ FIB_WALK_FLAG_EXECUTING
An indication that the walk is currently executing.
vlib_log_class_t fib_walk_logger
void fib_walk_async(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_walk_priority_t prio, fib_node_back_walk_ctx_t *ctx)
#define FIB_NODE_BW_REASONS
u32 fib_node_get_n_children(fib_node_type_t parent_type, fib_node_index_t parent_index)
fib_node_bw_reason_flag_t fnbw_reason
The reason/trigger for the backwalk.
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,...
#define STRUCT_OFFSET_OF(t, f)
static vlib_cli_command_t fib_walk_show_command
(constructor) VLIB_CLI_COMMAND (fib_walk_show_command)
#define FOR_EACH_FIB_NODE_BW_REASON(_item)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
enum fib_walk_priority_t_ fib_walk_priority_t
Walk priorities.
int fib_node_list_get_front(fib_node_list_t list, fib_node_ptr_t *ptr)
@ FIB_WALK_PROCESS_EVENT_DISABLE
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static f64 quota
The time quota for a walk.
static vlib_cli_command_t fib_walk_process_command
(constructor) VLIB_CLI_COMMAND (fib_walk_process_command)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
void fib_walk_process_enable(void)
static u64 fib_walk_hist_vists_per_walk[HISTOGRAM_VISITS_PER_WALK_N_BUCKETS]
static u32 fib_walk_work_nodes_visited_incr
static vlib_cli_command_t fib_walk_clear_command
(constructor) VLIB_CLI_COMMAND (fib_walk_clear_command)
u32 fib_node_index_t
A typedef of a node index.
#define vec_foreach_index(var, v)
Iterate over vector indices.
static heap_elt_t * last(heap_header_t *h)
static vlib_cli_command_t fib_walk_set_histogram_elements_size_command
(constructor) VLIB_CLI_COMMAND (fib_walk_set_histogram_elements_size_command)
void fib_walk_process_disable(void)
static const fib_node_vft_t fib_walk_vft
The FIB walk's graph node virtual function table.
A representation of a graph walk from a parent object to its children.
fib_walk_flags_t fw_flags
the walk's flags
fib_node_bw_reason_flag_t fwh_reason[MAX_HISTORY_REASONS]
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static const char *const fib_walk_priority_names[]
The names of the walk priorities.
enum fib_walk_queue_stats_t_ fib_walk_queue_stats_t
Statistics maintained per-walk queue.
#define VLIB_CLI_COMMAND(x,...)
struct fib_walk_t_ fib_walk_t
A representation of a graph walk from a parent object to its children.
static fib_walk_t * fib_walk_pool
The pool of all walk objects.
fib_walk_sleep_type_t_
Enurmerate the times of sleep between walks.
#define FIB_WALK_DBG(_walk, _fmt, _args...)
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
int fib_node_list_advance(u32 sibling)
Advance the sibling one step (toward the tail) in the list.
static vlib_cli_command_t fib_walk_set_quota_command
(constructor) VLIB_CLI_COMMAND (fib_walk_set_quota_command)
struct _vlib_node_registration vlib_node_registration_t
fib_walk_process_event_t_
Events sent to the FIB walk process.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
A representation of one pointer to another node.
#define N_TIME_BUCKETS
Histogram on the amount of work done (in msecs) in each walk.
static clib_error_t * fib_walk_process_enable_disable(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
f64 fw_start_time
Time the walk started.
@ FIB_NODE_TYPE_WALK
See the respective fib_*.h files for descriptions of these objects.
A representation of one queue of walk.
static fib_walk_t * fib_walk_get_from_node(fib_node_t *node)
@ FIB_NODE_BACK_WALK_MERGE
void fib_walk_sync(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_back_walk_ctx_t *ctx)
Back walk all the children of a FIB node.
static index_t fib_walk_get_index(fib_walk_t *fwalk)
fib_node_back_walk_rc_t fib_node_back_walk_one(fib_node_ptr_t *ptr, fib_node_back_walk_ctx_t *ctx)
fib_node_index_t fnp_index
node's index
#define vec_free(V)
Free vector's memory (no header).
@ FIB_WALK_FLAG_ASYNC
An asynchronous walk.
static clib_error_t * fib_walk_clear(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 fw_dep_sibling
Sibling index in the dependency list.
static fib_walk_t * fib_walk_alloc(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_walk_flags_t flags, fib_node_back_walk_ctx_t *ctx)
Allocate a new walk object.
fib_walk_advance_rc_t_
return code when advancing a walk
void fib_walk_module_init(void)
static fib_walk_history_t fib_walk_history[HISTORY_N_WALKS]
static fib_walk_queues_t fib_walk_queues
The global queues of outstanding walks.
fib_node_back_walk_ctx_t * fw_ctx
The reasons this walk is occuring.
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...
description fragment has unexpected format
@ FIB_WALK_PROCESS_EVENT_ENABLE
fib_node_ptr_t fw_parent
Pointer to the node whose dependants this walk is walking.
#define MAX_HISTORY_REASONS
void fib_node_list_elt_remove(u32 sibling)
fib_walk_queue_stats_t_
Statistics maintained per-walk queue.
static void fib_walk_destroy(index_t fwi)
u32 fib_node_list_get_size(fib_node_list_t list)
u32 fw_prio_sibling
Sibling index in the list of all walks.
#define HISTORY_N_WALKS
History of state for the last 128 walks.
static const char *const fib_node_bw_reason_names[]
The names of the walk reasons.
static f64 fib_walk_sleep_duration[]
Durations for the sleep types.
fib_node_t fw_node
FIB node linkage.
static clib_error_t * fib_walk_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
An node in the FIB graph.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void fib_node_init(fib_node_t *node, fib_node_type_t type)
enum fib_node_back_walk_reason_t_ fib_node_back_walk_reason_t
Reasons for backwalking the FIB object graph.
static index_t fib_walk_prio_queue_enquue(fib_walk_priority_t prio, fib_walk_t *fwalk)
Enqueue a walk onto the appropriate priority queue.
#define FIB_WALK_QUEUE_STATS
static vlib_main_t * vlib_get_main(void)
u32 fib_node_list_push_front(fib_node_list_t list, int owner_id, fib_node_type_t type, fib_node_index_t index)
Insert an element at the from of the list.
fib_node_list_t fib_node_list_create(void)
Create a new node list.
Context passed between object during a back walk.
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
fib_node_list_t fwq_queue
The node list which acts as the queue.
@ FIB_NODE_BW_FLAG_FORCE_SYNC
Force the walk to be synchronous.
static clib_error_t * fib_walk_set_quota(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
A set of priority queues for outstanding walks.
void fib_node_deinit(fib_node_t *node)
static f64 vlib_time_now(vlib_main_t *vm)
static const char *const fib_walk_queue_stats_names[]
The names of the walk stats.
static u64 fib_walk_sleep_lengths[2]
Histogram of the sleep lengths.
#define FOR_EACH_FIB_WALK_QUEUE_STATS(_wqs)
static fib_walk_t * fib_walk_get(index_t fwi)
int fib_node_list_elt_get_next(u32 sibling, fib_node_ptr_t *ptr)
enum fib_walk_advance_rc_t_ fib_walk_advance_rc_t
return code when advancing a walk
static vlib_node_registration_t fib_walk_process_node
(constructor) VLIB_REGISTER_NODE (fib_walk_process_node)
fib_walk_queue_t fwqs_queues[FIB_WALK_PRIORITY_NUM]
u32 fib_node_child_add(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_type_t type, fib_node_index_t index)
static u64 fib_walk_work_time_taken[N_TIME_BUCKETS]
static fib_walk_advance_rc_t fib_walk_advance(fib_node_index_t fwi)
Advance the walk one element in its work list.
u8 * format_fib_walk_priority(u8 *s, va_list *ap)
static uword fib_walk_process(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
The 'fib-walk' process's main loop.
#define VLIB_REGISTER_NODE(x,...)
vl_api_wireguard_peer_flags_t flags
#define FIB_WALK_PRIORITY_NUM