16 #ifndef __FIB_NODE_H__ 17 #define __FIB_NODE_H__ 52 #define FIB_NODE_TYPE_MAX (FIB_NODE_TYPE_LAST + 1) 54 #define FIB_NODE_TYPES { \ 55 [FIB_NODE_TYPE_ENTRY] = "entry", \ 56 [FIB_NODE_TYPE_MFIB_ENTRY] = "mfib-entry", \ 57 [FIB_NODE_TYPE_WALK] = "walk", \ 58 [FIB_NODE_TYPE_PATH_LIST] = "path-list", \ 59 [FIB_NODE_TYPE_PATH] = "path", \ 60 [FIB_NODE_TYPE_MPLS_ENTRY] = "mpls-entry", \ 61 [FIB_NODE_TYPE_MPLS_TUNNEL] = "mpls-tunnel", \ 62 [FIB_NODE_TYPE_ADJ] = "adj", \ 63 [FIB_NODE_TYPE_LISP_GPE_FWD_ENTRY] = "lisp-gpe-fwd-entry", \ 64 [FIB_NODE_TYPE_LISP_ADJ] = "lisp-adj", \ 65 [FIB_NODE_TYPE_GRE_TUNNEL] = "gre-tunnel", \ 66 [FIB_NODE_TYPE_VXLAN_TUNNEL] = "vxlan-tunnel", \ 67 [FIB_NODE_TYPE_MAP_E] = "map-e", \ 116 #define FIB_NODE_BW_REASONS { \ 117 [FIB_NODE_BW_REASON_RESOLVE] = "resolve", \ 118 [FIB_NODE_BW_REASON_EVALUATE] = "evaluate", \ 119 [FIB_NODE_BW_REASON_INTERFACE_UP] = "if-up", \ 120 [FIB_NODE_BW_REASON_INTERFACE_DOWN] = "if-down", \ 121 [FIB_NODE_BW_REASON_INTERFACE_DELETE] = "if-delete", \ 122 [FIB_NODE_BW_REASON_ADJ_UPDATE] = "adj-update", \ 123 [FIB_NODE_BW_REASON_ADJ_DOWN] = "adj-down", \ 126 #define FOR_EACH_FIB_NODE_BW_REASON(_item) \ 127 for (_item = FIB_NODE_BW_REASON_FIRST; \ 128 _item <= FIB_NODE_BW_REASON_LAST; \ 146 "BW Reason enum < 2 byte. Consequences for cover_upd_res_t");
216 #define FIB_NODE_GRAPH_MAX_DEPTH ((u32)32) 354 fib_node_type_t child_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.
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
Walk to update children to inform them the adjacency is now down.
const char * fib_node_type_get_name(fib_node_type_t type)
void fib_node_lock(fib_node_t *node)
Walk to re-collapse the multipath adjs when the rewrite of a unipath adjacency changes.
fib_node_back_walk_reason_t_
Reasons for backwalking the FIB object graph.
Walk to re-resolve the child.
fib_node_index_t fnp_index
node's index
fib_node_bw_reason_flag_t_
Flags enum constructed from the reaons.
fib_node_last_lock_gone_t fnv_last_lock
fib_node_back_walk_rc_t(* fib_node_back_walk_t)(struct fib_node_t_ *node, fib_node_back_walk_ctx_t *ctx)
Function definition to backwalk a FIB node.
fib_node_ptr_t fib_node_ptr_list_t
A list of dependent nodes.
A representation of one pointer to another node.
A resolving interface has gone down.
u32 fib_node_get_n_children(fib_node_type_t parent_type, fib_node_index_t parent_index)
struct fib_node_back_walk_ctx_t_ fib_node_back_walk_ctx_t
Context passed between object during a back walk.
void(* fib_node_last_lock_gone_t)(struct fib_node_t_ *node)
Function definition to inform the FIB node that its last lock has gone.
fib_node_bw_reason_flag_t fnbw_reason
The reason/trigger for the backwalk.
struct fib_node_t_ *(* fib_node_get_t)(fib_node_index_t index)
Function definition to get a FIB node from its index.
struct fib_node_ptr_t_ fib_node_ptr_t
A representation of one pointer to another node.
fib_node_type_t fnp_type
node type
u32 fnbw_depth
the number of levels the walk has already traversed.
int(* fib_node_ptr_walk_t)(fib_node_ptr_t *depend, void *ctx)
A callback function for walking a node dependency list.
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.
fib_node_bw_flags_t fnbw_flags
additional flags for the walk
void fib_node_register_type(fib_node_type_t ft, const fib_node_vft_t *vft)
Register the function table for a given type.
STATIC_ASSERT(sizeof(fib_node_bw_reason_flag_t)< 2,"BW Reason enum < 2 byte. Consequences for cover_upd_res_t")
fib_node_type_t fn_type
The node's type.
An node in the FIB graph.
format_function_t * fnv_format
enum fib_node_bw_reason_flag_t_ fib_node_bw_reason_flag_t
Flags enum constructed from the reaons.
fib_node_back_walk_rc_t fib_node_back_walk_one(fib_node_ptr_t *ptr, fib_node_back_walk_ctx_t *ctx)
enum fib_node_bw_flags_t_ fib_node_bw_flags_t
Flags on the walk.
fib_node_list_t fn_children
Vector of nodes that depend upon/use/share this node.
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.
Force the walk to be synchronous.
fib_node_back_walk_t fnv_back_walk
u32 fib_node_index_t
A typedef of a node index.
A resolving interface has been deleted.
Context passed between object during a back walk.
u8 * fib_node_children_format(fib_node_list_t list, u8 *s)
fib_node_type_t_
The types of nodes in a FIB graph.
void fib_node_init(fib_node_t *node, fib_node_type_t ft)
enum fib_node_back_walk_reason_t_ fib_node_back_walk_reason_t
Reasons for backwalking the FIB object graph.
u32 fib_node_child_add(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_type_t child_type, fib_node_index_t child_index)
void(* fib_node_memory_show_t)(void)
Function definition to display the amount of memory used by a type.
#define FIB_NODE_INDEX_INVALID
u32 fn_locks
Number of dependents on this node.
Walk to re-evaluate the forwarding contributed by the parent.
A resolving interface has come up.
struct fib_node_vft_t_ fib_node_vft_t
A FIB graph nodes virtual function table.
fib_node_bw_flags_t_
Flags on the walk.
See the respective fib_*.h files for descriptions of these objects.
static int fib_node_index_is_valid(fib_node_index_t ni)
A FIB graph nodes virtual function table.
u32 fib_node_list_t
A list of FIB nodes.
fib_node_back_walk_rc_t_
Return code from a back walk function.
void fib_node_unlock(fib_node_t *node)
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
struct fib_node_t_ fib_node_t
An node in the FIB graph.
void fib_node_deinit(fib_node_t *node)
fib_node_memory_show_t fnv_mem_show