41 if (
NULL != fn_vfts[type].fnv_format)
103 parent = fn_vfts[parent_type].
fnv_get(parent_index);
127 parent = fn_vfts[parent_type].
fnv_get(parent_index);
145 parent = fn_vfts[parent_type].
fnv_get(parent_index);
193 node->
fn_vft = &fn_vfts[type];
228 in_use_elts, allocd_elts,
229 in_use_elts*size_elt, allocd_elts*size_elt);
241 "Name",
"Size",
"in-use",
"allocated");
273 .path =
"show fib memory",
275 .short_help =
"show fib memory",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static fib_node_type_t last_new_type
The last registered new type.
const fib_node_vft_t * fn_vft
The node's VFT.
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
void fib_node_init(fib_node_t *node, fib_node_type_t type)
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
void fib_node_list_memory_show(void)
void fib_node_deinit(fib_node_t *node)
static fib_node_vft_t * fn_vfts
void fib_node_list_walk(fib_node_list_t list, fib_node_list_walk_cb_t fn, void *args)
Walk the list of node.
fib_node_type_t fib_node_register_new_type(const fib_node_vft_t *vft)
Create a new FIB node type and Register the function table for it.
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)
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
fib_node_index_t fnp_index
node's index
void fib_node_list_remove(fib_node_list_t list, u32 sibling)
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_last_lock_gone_t fnv_last_lock
void fib_show_memory_usage(const char *name, u32 in_use_elts, u32 allocd_elts, size_t size_elt)
Show the memory usage for a type.
A representation of one pointer to another node.
fib_node_type_t fnp_type
node type
void fib_node_lock(fib_node_t *node)
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_type_t fn_type
The node's type.
static const char * fn_type_names[]
An node in the FIB graph.
void fib_node_unlock(fib_node_t *node)
fib_node_list_t fn_children
Vector of nodes that depend upon/use/share this node.
fib_node_back_walk_t fnv_back_walk
u32 fib_node_index_t
A typedef of a node index.
u32 fib_node_get_n_children(fib_node_type_t parent_type, fib_node_index_t parent_index)
Context passed between object during a back walk.
#define VLIB_CLI_COMMAND(x,...)
u32 fib_node_list_get_size(fib_node_list_t list)
static clib_error_t * fib_memory_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
fib_node_list_t fib_node_list_create(void)
Create a new node list.
static int fib_node_ptr_format_one_child(fib_node_ptr_t *ptr, void *arg)
void fib_node_list_destroy(fib_node_list_t *list)
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
static vlib_main_t * vlib_get_main(void)
#define FIB_NODE_INDEX_INVALID
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 fn_locks
Number of dependents on this node.
A FIB graph nodes virtual function table.
static u8 * fib_node_format(fib_node_ptr_t *fnp, u8 *s)
u32 fib_node_list_t
A list of FIB nodes.
#define vec_foreach(var, vec)
Vector iterator.
u8 * fib_node_children_format(fib_node_list_t list, u8 *s)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
const char * fib_node_type_get_name(fib_node_type_t type)
fib_node_memory_show_t fnv_mem_show