28 #DEFIne MFIB_ENTRY_DBG(_e, _fmt, _args...) \ 31 __tmp = format(__tmp, "e:[%d:%U", \ 32 mfib_entry_get_index(_e), \ 33 format_ip46_address, \ 34 &_e->mfe_prefix.fp_grp_addr, \ 36 __tmp = format(__tmp, "/%d,", \ 37 _e->mfe_prefix.fp_len); \ 38 __tmp = format(__tmp, "%U]", \ 39 mfib_entry_get_index(_e), \ 40 format_ip46_address, \ 41 &_e->mfe_prefix.fp_src_addr, \ 43 __tmp = format(__tmp, _fmt, ##_args); \ 44 clib_warning("%s", __tmp); \ 48 #define MFIB_ENTRY_DBG(_e, _fmt, _args...) 136 level = va_arg (*args,
int);
158 s = format(s,
" %U\n", format_mfib_itf, mfi);
163 s =
format(s,
"\n Interfaces:");
166 s = format(s,
"\n %U", format_mfib_itf, mfi);
169 s =
format(s,
"\n %U-chain\n %U",
179 s =
format(s,
"\nchildren:");
201 return (esrc1->
mfes_src - esrc2->mfes_src);
293 mfib_itf_delete(mfib_itf_get(mfii));
345 pool_put(mfib_entry_pool, mfib_entry);
408 pool_get(mfib_entry_pool, mfib_entry);
672 return (mfib_entry_index);
785 if (
NULL == mfib_itf)
799 rpath[0].frp_sw_if_index,
808 if (!was_forwarding && is_forwarding)
812 else if (was_forwarding && !is_forwarding)
858 if (
NULL == mfib_itf)
922 return ((clib_net_to_host_u32(a1->
data_u32) >
923 clib_net_to_host_u32(a2->
data_u32) ) ?
934 int cmp = (clib_net_to_host_u16 (a1->
as_u16[i]) -
935 clib_net_to_host_u16 (a2->
as_u16[i]));
992 *mfib_entry_index2));
1033 "ip4-mfib-forward-rpf",
1038 "ip6-mfib-forward-rpf",
1171 .path =
"show mfib entry",
1173 .short_help =
"show mfib entry",
int mfib_entry_update(fib_node_index_t mfib_entry_index, mfib_source_t source, mfib_entry_flags_t entry_flags, index_t repi)
int fib_path_is_resolved(fib_node_index_t path_index)
static int mfib_entry_src_n_itfs(const mfib_entry_src_t *msrc)
dpo_lock_fn_t dv_lock
A reference counting lock function.
#define MFIB_ENTRY_FORMAT_DETAIL
static void mfib_entry_recalculate_forwarding(mfib_entry_t *mfib_entry)
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)
sll srl srl sll sra u16x4 i
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)
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
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)
A representation of a path as described by a route producer.
dpo_id_t path_dpo
ID of the Data-path object.
void fib_node_init(fib_node_t *node, fib_node_type_t type)
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
index of this entry in the parent's child list.
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
static int mfib_entry_forwarding_path_remove(mfib_entry_src_t *msrc, const fib_route_path_t *rpath)
#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)
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)
fib_node_index_t mfib_entry_create(u32 fib_index, mfib_source_t source, const mfib_prefix_t *prefix, mfib_entry_flags_t entry_flags)
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 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).
#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)
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.
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.
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)
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.
index_t mfib_itf_create(u32 sw_if_index, mfib_itf_flags_t mfi_flags)
u32 mfib_entry_get_fib_index(fib_node_index_t mfib_entry_index)
fib_node_index_t fib_path_list_copy_and_path_add(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
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_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
dpo_id_t mfe_rep
The Replicate DPO used for forwarding.
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)
#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)
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)
fib_node_index_t fib_path_list_copy_and_path_remove(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
void replicate_multipath_update(const dpo_id_t *dpo, load_balance_path_t *next_hops)
static void mfib_entry_forwarding_path_add(mfib_entry_src_t *msrc, const fib_route_path_t *rpath)
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)
static mfib_entry_src_t * mfib_entry_src_find(const mfib_entry_t *mfib_entry, mfib_source_t source, u32 *index)
static void mfib_entry_stack(mfib_entry_t *mfib_entry)
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
Falags on the entry.
static int mfib_entry_src_collect_forwarding(fib_node_index_t pl_index, fib_node_index_t path_index, void *arg)
int fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, void *ctx)
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.
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)
void mfib_entry_contribute_forwarding(fib_node_index_t mfib_entry_index, fib_forward_chain_type_t type, dpo_id_t *dpo)
Aggregrate type for a prefix.
Context passed between object during a back walk.
#define VLIB_CLI_COMMAND(x,...)
static void mfib_entry_last_lock_gone(fib_node_t *node)
void mfib_entry_get_prefix(fib_node_index_t mfib_entry_index, mfib_prefix_t *pfx)
static uword hash_elts(void *v)
fib_node_index_t mfe_parent
the path-list for which this entry is a child.
struct mfib_entry_src_t_ mfib_entry_src_t
The source of an MFIB entry.
An interface associated with a particular MFIB entry.
static int mfib_entry_ok_for_delete(mfib_entry_t *mfib_entry)
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)
int fib_path_get_weight(fib_node_index_t path_index)
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)
#define MFIB_ENTRY_DBG(_e, _fmt, _args...)
Debug macro.
fib_protocol_t fp_proto
protocol type
#define FIB_NODE_INDEX_INVALID
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 path_weight
weight for the path.
u32 fn_locks
Number of dependents on this node.
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
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.
static int fib_ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
#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.
static mfib_entry_src_t * mfib_entry_get_best_src(const mfib_entry_t *mfib_entry)
enum mfib_itf_flags_t_ mfib_itf_flags_t
static int mfib_entry_src_ok_for_delete(const mfib_entry_src_t *msrc)
A FIB graph nodes virtual function table.
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.
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.
#define vec_foreach(var, vec)
Vector iterator.
void mfib_itf_delete(mfib_itf_t *mfi)
static void mfib_entry_show_memory(void)
Contribute an object that is to be used to forward non-end-of-stack MPLS packets. ...
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)
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,...)
fib_forward_chain_type_t fib_forw_chain_type_from_dpo_proto(dpo_proto_t proto)
Convert from a payload-protocol to a chain type.
fib_node_index_t fib_path_list_create_special(fib_protocol_t nh_proto, fib_path_list_flags_t flags, const dpo_id_t *dpo)
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.
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.