64 for (ii = 0; ii <
ARRAY_LEN(ip4_specials); ii++)
69 clib_host_to_net_u32(prefix.
fp_src_addr.ip4.data_u32);
71 clib_host_to_net_u32(prefix.
fp_grp_addr.ip4.data_u32);
92 for (ii = 0; ii <
ARRAY_LEN(ip4_specials); ii++)
98 clib_host_to_net_u32(prefix.
fp_src_addr.ip4.data_u32);
100 clib_host_to_net_u32(prefix.
fp_grp_addr.ip4.data_u32);
144 #define IPV4_MFIB_GRP_LEN(_len)\ 145 (_len > 32 ? 32 : _len) 147 #define IP4_MFIB_MK_KEY(_grp, _src, _len, _key) \ 149 _key = ((u64)(_grp->data_u32 & \ 150 ip4_main.fib_masks[IPV4_MFIB_GRP_LEN(_len)])) << 32; \ 151 _key |= _src->data_u32; \ 153 #define IP4_MFIB_MK_GRP_KEY(_grp, _len, _key) \ 155 _key = ((u64)(_grp->data_u32 & \ 156 ip4_main.fib_masks[IPV4_MFIB_GRP_LEN(_len)])) << 32; \ 170 uword * hash, * result;
178 if (
NULL != result) {
195 uword * hash, * result;
208 if (
NULL != result) {
213 for (mask_len = (len == 64 ? 32 : len); mask_len >= 0; mask_len--)
220 if (
NULL != result) {
266 uword * hash, * result;
273 if (
NULL == result) {
281 hash =
hash_set(hash, key, fib_entry_index);
296 uword * hash, * result;
334 fn(p->
value[0], ctx);
350 ip4_mfib_t *mfib = &mfib_table->v4;
356 for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
358 uword * hash = mfib->fib_entry_by_dst_address[i];
362 mfib_size += hash_bytes(hash);
366 total_memory += mfib_size;
369 s =
format(s,
"%=30s %=6d %=8ld\n",
384 mfib_entry_indicies =
NULL;
434 int verbose, matching,
memory;
437 u64 total_hash_memory;
438 int i, table_id = -1, fib_index = ~0;
441 memory = matching = 0;
442 total_hash_memory = 0;
469 else if (
unformat (input,
"table %d", &table_id))
471 else if (
unformat (input,
"index %d", &fib_index))
479 ip4_mfib_t *mfib = &mfib_table->v4;
481 if (table_id >= 0 && table_id != (int)mfib->table_id)
483 if (fib_index != ~0 && fib_index != (int)mfib->index)
492 for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
494 uword * hash = mfib->fib_entry_by_dst_address[i];
497 hash_size += hash_bytes(hash);
501 vlib_cli_output (vm,
"%U hash:%d",
502 format_mfib_table_name, mfib->index,
505 total_hash_memory += hash_size;
517 for (i = 0; i <
ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
519 uword * hash = mfib->fib_entry_by_dst_address[
i];
586 .path =
"show ip mfib",
587 .short_help =
"show ip mfib [summary] [table <table-id>] [index <fib-id>] [<grp-addr>[/<mask>]] [<grp-addr>] [<src-addr> <grp-addr>]",
#define MFIB_ENTRY_FORMAT_DETAIL
static clib_error_t * ip4_show_mfib(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ip46_address_t fp_src_addr
#define hash_set(h, key, value)
fib_node_index_t mfib_table_lookup(u32 fib_index, const mfib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
vhost_user_memory_t memory
#define hash_unset(h, key)
u32 ip4_mfib_table_get_index_for_sw_if_index(u32 sw_if_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static void ip4_mfib_table_show_one(ip4_mfib_t *mfib, vlib_main_t *vm, ip4_address_t *src, ip4_address_t *grp, u32 mask_len)
u32 mft_total_route_counts
Total route counters.
fib_node_index_t mfib_table_entry_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags)
Add a new (with no replication) or lock an existing entry.
fib_node_index_t ip4_mfib_table_get_less_specific(const ip4_mfib_t *mfib, const ip4_address_t *src, const ip4_address_t *grp, u32 len)
#define MFIB_ENTRY_FORMAT_BRIEF
enum mfib_source_t_ mfib_source_t
Possible [control plane] sources of MFIB entries.
u32 * mfib_index_by_sw_if_index
Table index indexed by software interface.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
fib_node_index_t mft_index
Index into FIB vector.
void mfib_table_entry_delete_index(fib_node_index_t mfib_entry_index, mfib_source_t source)
Delete a FIB entry.
#define IP4_MFIB_MK_GRP_KEY(_grp, _len, _key)
static void hash_set_flags(void *v, uword flags)
struct mfib_table_t_ * mfibs
Vector of MFIBs.
void ip4_mfib_table_walk(ip4_mfib_t *mfib, mfib_table_walk_fn_t fn, void *ctx)
Walk the IP4 mfib table.
void ip4_mfib_table_entry_remove(ip4_mfib_t *mfib, const ip4_address_t *grp, const ip4_address_t *src, u32 len)
#define IP4_MFIB_MK_KEY(_grp, _src, _len, _key)
static u32 ip4_create_mfib_with_table_id(u32 table_id, mfib_source_t src)
#define pool_put(P, E)
Free an object E in pool P.
int mfib_entry_cmp_for_sort(void *i1, void *i2)
void mfib_table_lock(u32 fib_index, fib_protocol_t proto, mfib_source_t source)
Release a reference counting lock on the table.
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
fib_node_index_t ip4_mfib_table_lookup_exact_match(const ip4_mfib_t *mfib, const ip4_address_t *grp, const ip4_address_t *src, u32 len)
u8 * format_mfib_entry(u8 *s, va_list *args)
#define vec_free(V)
Free vector's memory (no header).
u32 fib_node_index_t
A typedef of a node index.
Aggregrate type for a prefix.
#define VLIB_CLI_COMMAND(x,...)
uword * fib_entry_by_dst_address[65]
#define hash_create(elts, value_bytes)
static uword hash_elts(void *v)
fib_node_index_t ip4_mfib_table_lookup(const ip4_mfib_t *mfib, const ip4_address_t *src, const ip4_address_t *grp, u32 len)
The IPv4 Multicast-FIB.
void ip4_mfib_table_entry_insert(ip4_mfib_t *mfib, const ip4_address_t *grp, const ip4_address_t *src, u32 len, fib_node_index_t fib_entry_index)
fib_protocol_t mft_proto
Which protocol this table serves.
u32 mft_table_id
Table ID (hash key) for this FIB.
static void ip4_mfib_table_show_all(ip4_mfib_t *mfib, vlib_main_t *vm)
#define FIB_NODE_INDEX_INVALID
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 ip4_mfib_table_find_or_create_and_lock(u32 table_id, mfib_source_t src)
Get or create an IPv4 fib.
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
int(* mfib_table_walk_fn_t)(fib_node_index_t fei, void *ctx)
Call back function when walking entries in a FIB table.
A protocol Independent IP multicast FIB table.
ip4_main_t ip4_main
Global ip4 main structure.
#define vec_foreach(var, vec)
Vector iterator.
uword * mfib_index_by_table_id
Hash table mapping table id to multicast fib index.
#define CLIB_CACHE_LINE_BYTES
static u32 ip4_mfib_index_from_table_id(u32 table_id)
#define HASH_FLAG_NO_AUTO_SHRINK
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
u8 * format_mfib_table_name(u8 *s, va_list *ap)
Format the description/name of the table.
void ip4_mfib_table_destroy(ip4_mfib_t *mfib)
ip46_address_t fp_grp_addr
The address type is not deriveable from the fp_addr member.
u8 * format_ip4_mfib_table_memory(u8 *s, va_list *args)
format (display) the memory usage for IP4 mfibs
static uword pool_elts(void *v)
Number of active elements in a pool.