99 return (
format(s,
"path:%d flags:%U",
114 level = va_arg (*args,
int);
130 s =
format (s,
" src:%s locks:%d:",
142 s =
format (s,
" Extensions:\n");
145 s = format(s,
" %U\n", format_mfib_entry_path_ext, mpi);
147 s =
format (s,
" Interface-Forwarding:\n");
150 s = format(s,
" %U\n", format_mfib_itf, mfi);
155 s =
format(s,
"\n Interfaces:");
158 s = format(s,
"\n %U", format_mfib_itf, mfi);
164 s =
format(s,
"\n %U-chain\n %U",
174 s =
format(s,
"\nchildren:");
194 return (esrc1->
mfes_src - esrc2->mfes_src);
349 mfib_itf_delete(mfib_itf_get(mfii));
460 pool_get(mfib_path_ext_pool, path_ext);
466 path_ext - mfib_path_ext_pool);
480 pool_put(mfib_path_ext_pool, path_ext);
516 if (
NULL != path_ext &&
777 rpf_id, entry_flags);
808 return (mfib_entry_index);
963 if (
NULL == path_ext)
978 if (~0 != rpath[0].frp_sw_if_index)
982 if (old != itf_flags)
990 if (
NULL == mfib_itf)
993 rpath[0].frp_sw_if_index,
1056 if (~0 != rpath[0].frp_sw_if_index)
1120 return ((clib_net_to_host_u32(a1->
data_u32) >
1121 clib_net_to_host_u32(a2->
data_u32) ) ?
1132 int cmp = (clib_net_to_host_u16 (a1->
as_u16[i]) -
1133 clib_net_to_host_u16 (a2->
as_u16[i]));
1190 *mfib_entry_index2));
1213 pool_put(mfib_entry_pool, mfib_entry);
1301 "ip4-mfib-forward-rpf",
1306 "ip6-mfib-forward-rpf",
1383 return (&mfib_entry->
mfe_rep);
1533 .path =
"show mfib entry",
1535 .short_help =
"show mfib entry",
int mfib_itf_update(mfib_itf_t *mfib_itf, fib_node_index_t path_index, mfib_itf_flags_t mfi_flags)
update an interface from a path.
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
int fib_path_is_resolved(fib_node_index_t path_index)
dpo_lock_fn_t dv_lock
A reference counting lock function.
Contribute an object that is to be used to forward BIER packets.
#define MFIB_ENTRY_FORMAT_DETAIL
static const char *const mfib_entry_ip4_nodes[]
Contribute an object that is to be used to forward IP6 packets.
ip46_address_t fp_src_addr
Contribute an object that is to be used to forward IP6 packets.
#define hash_set(h, key, value)
static mfib_entry_src_t * mfib_entry_src_find_or_create(mfib_entry_t *mfib_entry, mfib_source_t source)
fib_node_index_t path_index
The index of the FIB path.
A virtual function table regisitered for a DPO type.
A representation of a fib path for fib_path_encode to convey the information to the caller...
fib_forward_chain_type_t fct
void fib_path_contribute_forwarding(fib_node_index_t path_index, fib_forward_chain_type_t fct, dpo_id_t *dpo)
static const char *const *const mfib_entry_nodes[DPO_PROTO_NUM]
u32 mfib_entry_pool_size(void)
void fib_path_list_child_remove(fib_node_index_t path_list_index, u32 si)
int mfib_entry_delete(fib_node_index_t mfib_entry_index, mfib_source_t source)
mfib_entry_delete
enum mfib_entry_flags_t_ mfib_entry_flags_t
#define hash_unset(h, key)
fib_node_index_t mfes_cover
A representation of a path as described by a route producer.
dpo_id_t path_dpo
ID of the Data-path object.
enum mfib_entry_fwd_flags_t_ mfib_entry_fwd_flags_t
Flags to control what is present in the replicate DPO returned when the entry contributes forwarding...
void fib_node_init(fib_node_t *node, fib_node_type_t type)
u32 frp_mitf_flags
MFIB interface flags.
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
void mfib_entry_unlock(fib_node_index_t mfib_entry_index)
struct mfib_entry_src_t_ * mfe_srcs
A vector of sources contributing forwarding.
u32 mfe_sibling
The sibling index on the path-list.
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
fib_node_index_t fib_path_list_create_special(dpo_proto_t nh_proto, fib_path_list_flags_t flags, const dpo_id_t *dpo)
vlib_log_class_t mfib_entry_logger
the logger
#define MFIB_SOURCE_NAMES
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
static void mfib_entry_dpo_unlock(dpo_id_t *dpo)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static fib_node_t * mfib_entry_get_node(fib_node_index_t index)
dpo_proto_t rep_proto
The protocol of packets that traverse this REP.
static void mfib_entry_itf_remove(mfib_entry_src_t *msrc, u32 sw_if_index)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static fib_node_index_t mfib_entry_get_index(const mfib_entry_t *mfe)
void fib_path_list_walk(fib_node_index_t path_list_index, fib_path_list_walk_fn_t func, void *ctx)
Contribute an object that is to be used to forward IP4 packets.
void fib_node_deinit(fib_node_t *node)
u32 mfib_entry_child_add(fib_node_index_t mfib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
static mfib_path_ext_t * mfib_entry_path_ext_find(mfib_path_ext_t *exts, fib_node_index_t path_index)
static replicate_t * replicate_get(index_t repi)
static const char *const mfib_entry_ip6_nodes[]
#define MFIB_ENTRY_FORMAT_BRIEF
mfib_itf_t * mfes_itfs
The hash table of all interfaces.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
fib_forward_chain_type_t mfib_forw_chain_type_from_dpo_proto(dpo_proto_t proto)
void mfib_entry_cover_changed(fib_node_index_t mfib_entry_index)
u32 fib_path_list_child_add(fib_node_index_t path_list_index, fib_node_type_t child_type, fib_node_index_t child_index)
#define pool_len(p)
Number of elements in pool vector.
fib_forward_chain_type_t mfib_entry_get_default_chain_type(const mfib_entry_t *mfib_entry)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static mfib_entry_t * mfib_entry_from_fib_node(fib_node_t *node)
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
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
u8 * format_mfib_entry_flags(u8 *s, va_list *args)
enum mfib_source_t_ mfib_source_t
Possible [control plane] sources of MFIB entries.
static mfib_entry_t * mfib_entry_alloc(u32 fib_index, const mfib_prefix_t *prefix, fib_node_index_t *mfib_entry_index)
static void mfib_entry_recalculate_forwarding(mfib_entry_t *mfib_entry, mfib_source_t old_best)
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
u32 frp_sw_if_index
The interface.
The source of an MFIB entry.
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.
mfib_source_t mfes_src
Which source this is.
#define hash_foreach(key_var, value_var, h, body)
load_balance_path_t * next_hops
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
index_t replicate_dup(replicate_flags_t flags, index_t repi)
static fib_protocol_t mfib_entry_get_proto(const mfib_entry_t *mfib_entry)
mfib_prefix_t mfe_prefix
The prefix of the route.
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.
void mfib_entry_module_init(void)
u32 mfib_entry_get_stats_index(fib_node_index_t fib_entry_index)
void mfib_entry_contribute_forwarding(fib_node_index_t mfib_entry_index, fib_forward_chain_type_t type, mfib_entry_fwd_flags_t flags, dpo_id_t *dpo)
struct mfib_entry_collect_forwarding_ctx_t_ mfib_entry_collect_forwarding_ctx_t
Contribute an object that is to be used to forward Ethernet packets.
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u16 fib_path_get_weight(fib_node_index_t path_index)
static mfib_entry_src_t * mfib_entry_src_update(mfib_entry_t *mfib_entry, mfib_source_t source, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags)
u32 mfib_entry_get_fib_index(fib_node_index_t mfib_entry_index)
void mfib_entry_src_deactivate(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
static mfib_source_t mfib_entry_get_best_source(const mfib_entry_t *mfib_entry)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Contribute an object that is to be used to forward end-of-stack MPLS packets.
fib_node_bw_reason_flag_t fnbw_reason
The reason/trigger for the backwalk.
int mfib_entry_update(fib_node_index_t mfib_entry_index, mfib_source_t source, mfib_entry_flags_t entry_flags, fib_rpf_id_t rpf_id, index_t repi)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
dpo_id_t mfe_rep
The DPO used for forwarding; replicate, drop, etc.
static fib_path_list_walk_rc_t mfib_entry_src_collect_forwarding(fib_node_index_t pl_index, fib_node_index_t path_index, void *arg)
u32 mfes_ref_count
The reference count on the entry.
int mfib_entry_is_host(fib_node_index_t mfib_entry_index)
static void mfib_entry_src_flush(mfib_entry_src_t *msrc)
void fib_node_lock(fib_node_t *node)
static int fib_ip6_address_compare(ip6_address_t *a1, ip6_address_t *a2)
static fib_node_index_t mfib_entry_src_path_add(mfib_entry_src_t *msrc, const fib_route_path_t *rpath)
int mfib_entry_is_sourced(fib_node_index_t mfib_entry_index, mfib_source_t source)
int mfib_entry_special_add(fib_node_index_t mfib_entry_index, mfib_source_t source, mfib_entry_flags_t entry_flags, fib_rpf_id_t rpf_id, index_t repi)
#define pool_put(P, E)
Free an object E in pool P.
fib_node_t mfe_node
Base class.
int mfib_entry_cmp_for_sort(void *i1, void *i2)
void mfib_entry_path_update(fib_node_index_t mfib_entry_index, mfib_source_t source, const fib_route_path_t *rpath, mfib_itf_flags_t itf_flags)
mfib_entry_t * mfib_entry_pool
#define vec_del1(v, i)
Delete the element at index I.
void fib_path_list_lock(fib_node_index_t path_list_index)
static mfib_path_ext_t * mfib_entry_path_ext_get(index_t mi)
fib_rpf_id_t mfes_rpf_id
RPF-ID.
fib_node_type_t fn_type
The node's type.
static void mfib_entry_dpo_lock(dpo_id_t *dpo)
An node in the FIB graph.
void fib_node_unlock(fib_node_t *node)
void mfib_entry_lock(fib_node_index_t mfib_entry_index)
u32 mfe_fib_index
The index of the FIB table this entry is in.
static mfib_entry_t * mfib_entry_get(fib_node_index_t index)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
static mfib_path_ext_t * mfib_path_ext_add(mfib_entry_src_t *msrc, fib_node_index_t path_index, mfib_itf_flags_t mfi_flags)
#define MFIB_ENTRY_DBG(_e, _fmt, _args...)
void replicate_multipath_update(const dpo_id_t *dpo, load_balance_path_t *next_hops)
fib_node_list_t fn_children
Vector of nodes that depend upon/use/share this node.
static u8 * format_mfib_entry_dpo(u8 *s, va_list *args)
Do not reutrn any local replications in the set.
static mfib_entry_src_t * mfib_entry_src_find(const mfib_entry_t *mfib_entry, mfib_source_t source, u32 *index)
Contribute an object that is to be used to forward NSH packets.
u8 * format_mfib_entry(u8 *s, va_list *args)
#define vec_free(V)
Free vector's memory (no header).
static mfib_itf_t * mfib_entry_itf_find(mfib_itf_t *itfs, u32 sw_if_index)
mfib_itf_flags_t mfi_flags
Forwarding Flags on the entry - checked in the data-path.
static mfib_entry_src_t * mfib_entry_src_update_and_lock(mfib_entry_t *mfib_entry, mfib_source_t source, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags)
u32 fib_path_list_get_n_paths(fib_node_index_t path_list_index)
fib_node_index_t mfes_pl
The path-list of forwarding interfaces.
mfib_itf_t * mfe_itfs
A hash table of interfaces.
u32 fib_node_index_t
A typedef of a node index.
mfib_entry_flags_t mfe_flags
Route flags.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
mfib_path_ext_t * mfes_exts
Hash table of path extensions.
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
void fib_path_list_unlock(fib_node_index_t path_list_index)
index_t replicate_create(u32 n_buckets, dpo_proto_t rep_proto)
static void mfib_entry_itf_add(mfib_entry_src_t *msrc, u32 sw_if_index, index_t mi)
Aggregrate type for a prefix.
enum mfib_src_res_t_ mfib_src_res_t
signals from the sources to the caller
Context passed between object during a back walk.
u32 fib_rpf_id_t
An RPF-ID is numerical value that is used RPF validate.
#define VLIB_CLI_COMMAND(x,...)
fib_node_index_t mfe_pl
The path-list of which this entry is a child.
static void mfib_path_ext_remove(mfib_entry_src_t *msrc, fib_node_index_t path_index)
MFIB extensions to each path.
static void mfib_entry_last_lock_gone(fib_node_t *node)
static void mfib_entry_update_i(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc, mfib_source_t current_best, index_t repi)
mfib_src_res_t mfib_entry_src_cover_update(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
void mfib_entry_cover_updated(fib_node_index_t mfib_entry_index)
static void mfib_entry_stack(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
mfib_itf_flags_t mfpe_flags
const dpo_id_t * mfib_entry_contribute_ip_forwarding(fib_node_index_t mfib_entry_index)
An interface associated with a particular MFIB entry.
static int mfib_entry_ok_for_delete(mfib_entry_t *mfib_entry)
static u8 * format_mfib_entry_path_ext(u8 *s, va_list *args)
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
u8 * format_fib_forw_chain_type(u8 *s, va_list *args)
static int mfib_entry_cmp(fib_node_index_t mfib_entry_index1, fib_node_index_t mfib_entry_index2)
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
fib_rpf_id_t mfe_rpf_id
RPF-ID used when the packets ingress not from an interface.
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
static clib_error_t * show_mfib_entry_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void mfib_entry_encode(fib_node_index_t mfib_entry_index, fib_route_path_encode_t **api_rpaths)
index_t mfib_itf_create(fib_node_index_t path_index, mfib_itf_flags_t mfi_flags)
fib_protocol_t fp_proto
protocol type
enum fib_path_list_walk_rc_t_ fib_path_list_walk_rc_t
return code to control pat-hlist walk
index_t dpoi_index
the index of objects of that type
#define FIB_NODE_INDEX_INVALID
mfib_src_res_t mfib_entry_src_cover_change(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
fib_node_index_t mfpe_path
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 path_weight
weight for the path.
fib_node_index_t mfib_entry_create(u32 fib_index, mfib_source_t source, const mfib_prefix_t *prefix, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags, index_t repi)
u32 fn_locks
Number of dependents on this node.
const mfib_prefix_t * mfib_entry_get_prefix(fib_node_index_t mfib_entry_index)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
static mfib_path_ext_t * mfib_path_ext_pool
Pool of path extensions.
u8 * fib_path_list_format(fib_node_index_t path_list_index, u8 *s)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
int mfib_prefix_is_host(const mfib_prefix_t *pfx)
Return true is the prefix is a host prefix.
static int fib_ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
u8 * format_mfib_itf_flags(u8 *s, va_list *args)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
One path from an [EU]CMP set that the client wants to add to a load-balance object.
enum mfib_itf_flags_t_ mfib_itf_flags_t
void mfib_entry_src_activate(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
fib_node_index_t fib_path_list_path_add(fib_node_index_t path_list_index, const fib_route_path_t *rpaths)
static int mfib_entry_src_ok_for_delete(const mfib_entry_src_t *msrc)
A FIB graph nodes virtual function table.
static fib_node_index_t mfib_entry_src_path_remove(mfib_entry_src_t *msrc, const fib_route_path_t *rpath)
static const char * mfib_source_names[]
String names for each source.
static void mfib_entry_src_init(mfib_entry_t *mfib_entry, mfib_source_t source)
mfib_entry_flags_t mfes_flags
Route flags.
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
static fib_node_back_walk_rc_t mfib_entry_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
int dpo_is_drop(const dpo_id_t *dpo)
The Drop DPO will drop all packets, no questions asked.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
void mfib_entry_cover_update_notify(mfib_entry_t *mfib_entry)
#define vec_foreach(var, vec)
Vector iterator.
void mfib_itf_delete(mfib_itf_t *mfi)
fib_path_list_walk_rc_t fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, const fib_path_ext_t *path_ext, void *ctx)
mfib_entry_src_t * mfib_entry_get_best_src(const mfib_entry_t *mfib_entry)
static void mfib_entry_show_memory(void)
void fib_path_list_walk_w_ext(fib_node_index_t path_list_index, const fib_path_ext_list_t *ext_list, fib_path_list_walk_w_ext_fn_t func, void *ctx)
Contribute an object that is to be used to forward non-end-of-stack MPLS packets. ...
replicate_flags_t rep_flags
Flags specifying the replicate properties/behaviour.
static void mfib_entry_src_remove(mfib_entry_t *mfib_entry, mfib_source_t source)
#define pool_foreach_index(i, v, body)
Iterate pool by index.
#define MFIB_ENTRY_FORMAT_DETAIL2
u16 fp_len
The mask length.
u8 * fib_node_children_format(fib_node_list_t list, u8 *s)
#define CLIB_CACHE_LINE_BYTES
void mfib_entry_child_remove(fib_node_index_t mfib_entry_index, u32 sibling_index)
static int mfib_entry_src_cmp_for_sort(void *v1, void *v2)
Contribute an object that is to be used to forward IP4 packets.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
u8 * format_mfib_prefix(u8 *s, va_list *args)
ip46_address_t fp_grp_addr
The address type is not deriveable from the fp_addr member.
fib_node_index_t fib_path_list_path_remove(fib_node_index_t path_list_index, const fib_route_path_t *rpaths)
int mfib_entry_path_remove(fib_node_index_t mfib_entry_index, mfib_source_t source, const fib_route_path_t *rpath)
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.
static uword pool_elts(void *v)
Number of active elements in a pool.