31 .ip4.data_u32 = 0x010000e0,
39 .ip4.data_u32 = 0x020000e0,
82 .frp_sw_if_index = ~0,
90 for (ii = 0; ii <
ARRAY_LEN(ip4_specials); ii++)
114 for (ii = 0; ii <
ARRAY_LEN(ip4_specials); ii++)
148 for (ii = 0; ii <
ARRAY_LEN(ip4_specials); ii++)
195 #define IPV4_MFIB_GRP_LEN(_len)\ 196 (_len > 32 ? 32 : _len) 198 #define IP4_MFIB_MK_KEY(_grp, _src, _len, _key) \ 200 _key = ((u64)(_grp->data_u32 & \ 201 ip4_main.fib_masks[IPV4_MFIB_GRP_LEN(_len)])) << 32; \ 202 _key |= _src->data_u32; \ 204 #define IP4_MFIB_MK_GRP_KEY(_grp, _len, _key) \ 206 _key = ((u64)(_grp->data_u32 & \ 207 ip4_main.fib_masks[IPV4_MFIB_GRP_LEN(_len)])) << 32; \ 221 uword * hash, * result;
229 if (NULL != result) {
246 uword * hash, * result;
259 if (NULL != result) {
264 for (mask_len = (len == 64 ? 32 : len); mask_len >= 0; mask_len--)
271 if (NULL != result) {
317 uword * hash, * result;
324 if (NULL == result) {
332 hash =
hash_set(hash, key, fib_entry_index);
347 uword * hash, * result;
385 fn(p->
value[0], ctx);
401 ip4_mfib_t *mfib = &mfib_table->v4;
407 for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
409 uword * hash = mfib->fib_entry_by_dst_address[i];
413 mfib_size += hash_bytes(hash);
417 total_memory += mfib_size;
420 s =
format(s,
"%=30s %=6d %=12ld\n",
435 mfib_entry_indicies = NULL;
485 int verbose, matching,
memory;
488 u64 total_hash_memory;
492 memory = matching = 0;
493 total_hash_memory = 0;
520 else if (
unformat (input,
"table %d", &table_id))
522 else if (
unformat (input,
"index %d", &fib_index))
530 ip4_mfib_t *mfib = &mfib_table->v4;
532 if (table_id >= 0 && table_id != (int)mfib->table_id)
534 if (fib_index != ~0 && fib_index != (int)mfib->index)
543 for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
545 uword * hash = mfib->fib_entry_by_dst_address[i];
548 hash_size += hash_bytes(hash);
552 vlib_cli_output (vm,
"%U hash:%d",
553 format_mfib_table_name, mfib->index,
556 total_hash_memory += hash_size;
569 for (i = 0; i <
ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
571 uword * hash = mfib->fib_entry_by_dst_address[
i];
638 .path =
"show ip mfib",
639 .short_help =
"show ip mfib [summary] [table <table-id>] [index <fib-id>] [<grp-addr>[/<mask>]] [<grp-addr>] [<src-addr> <grp-addr>]",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
void mfib_table_entry_delete(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source)
Delete a FIB entry.
#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)
#define hash_set(h, key, value)
vhost_user_memory_t memory
#define hash_unset(h, key)
A representation of a path as described by a route producer.
void ip4_mfib_interface_enable_disable(u32 sw_if_index, int is_enable)
Add/remove the interface from the accepting list of the special MFIB entries.
fib_node_index_t mfib_table_entry_path_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath)
Add n paths to an entry (aka route) in the FIB.
u32 ip4_mfib_table_get_index_for_sw_if_index(u32 sw_if_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
u8 * format_mfib_table_flags(u8 *s, va_list *args)
#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.
#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)
sll srl srl sll sra u16x4 i
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.
Aggregate 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)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
walk_rc_t(* mfib_table_walk_fn_t)(fib_node_index_t fei, void *ctx)
Call back function when walking entries in a FIB table.
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.
fib_protocol_t fp_proto
protocol type
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.
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.
void mfib_table_entry_path_remove(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath)
Remove n paths to an entry (aka route) in the FIB.
#define CLIB_CACHE_LINE_BYTES
static u32 ip4_mfib_index_from_table_id(u32 table_id)
#define HASH_FLAG_NO_AUTO_SHRINK
u8 * format_mfib_table_name(u8 *s, va_list *ap)
Format the description/name of the table.
mfib_table_flags_t mft_flags
table falgs
const ip46_address_t zero_addr
void ip4_mfib_table_destroy(ip4_mfib_t *mfib)
vl_api_interface_index_t sw_if_index
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.