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...) 165 return (
format(s,
"path:%d flags:%U",
180 level = va_arg (*args,
int);
202 s =
format (s,
" Extensions:\n");
205 s = format(s,
" %U\n", format_mfib_entry_path_ext, mpi);
207 s =
format (s,
" Interface-Forwarding:\n");
210 s = format(s,
" %U\n", format_mfib_itf, mfi);
215 s =
format(s,
"\n Interfaces:");
218 s = format(s,
"\n %U", format_mfib_itf, mfi);
221 s =
format(s,
"\n %U-chain\n %U",
231 s =
format(s,
"\nchildren:");
251 return (esrc1->
mfes_src - esrc2->mfes_src);
354 mfib_itf_delete(mfib_itf_get(mfii));
454 pool_get(mfib_path_ext_pool, path_ext);
460 path_ext - mfib_path_ext_pool);
474 pool_put(mfib_path_ext_pool, path_ext);
510 if (
NULL != path_ext &&
737 return (mfib_entry_index);
857 if (
NULL == path_ext)
872 if (~0 != rpath[0].frp_sw_if_index)
894 rpath[0].frp_sw_if_index,
953 if (~0 != rpath[0].frp_sw_if_index)
1001 return ((clib_net_to_host_u32(a1->
data_u32) >
1002 clib_net_to_host_u32(a2->
data_u32) ) ?
1013 int cmp = (clib_net_to_host_u16 (a1->
as_u16[i]) -
1014 clib_net_to_host_u16 (a2->
as_u16[i]));
1071 *mfib_entry_index2));
1094 pool_put(mfib_entry_pool, mfib_entry);
1168 "ip4-mfib-forward-rpf",
1173 "ip6-mfib-forward-rpf",
1236 return (&mfib_entry->
mfe_rep);
1319 .path =
"show mfib entry",
1321 .short_help =
"show mfib entry",
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 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)
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 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)
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
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)
#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)
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 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).
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)
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.
u16 fib_path_get_weight(fib_node_index_t path_index)
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)
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.
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)
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)
#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 (general version).
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)
void replicate_multipath_update(const dpo_id_t *dpo, load_balance_path_t *next_hops)
fib_node_list_t fn_children
The node's VFT.
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)
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.
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)
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.
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)
void mfib_entry_get_prefix(fib_node_index_t mfib_entry_index, mfib_prefix_t *pfx)
static void mfib_entry_stack(mfib_entry_t *mfib_entry, mfib_entry_src_t *msrc)
fib_path_list_walk_rc_t fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, void *ctx)
mfib_itf_flags_t mfpe_flags
const dpo_id_t * mfib_entry_contribute_ip_forwarding(fib_node_index_t mfib_entry_index)
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)
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)
#define MFIB_ENTRY_DBG(_e, _fmt, _args...)
Debug macro.
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
#define FIB_NODE_INDEX_INVALID
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.
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...
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.
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.
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
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.
struct mfib_path_ext_t_ mfib_path_ext_t
MFIB extensions to each path.
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.
#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)
#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,...)
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.
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.