FD.io VPP  v21.01.1
Vector Packet Processing
ip4_mfib.c File Reference
+ Include dependency graph for ip4_mfib.c:

Go to the source code of this file.

Macros

#define IPV4_MFIB_GRP_LEN(_len)   (_len > 32 ? 32 : _len)
 
#define IP4_MFIB_MK_KEY(_grp, _src, _len, _key)
 
#define IP4_MFIB_MK_GRP_KEY(_grp, _len, _key)
 

Functions

static u32 ip4_create_mfib_with_table_id (u32 table_id, mfib_source_t src)
 
void ip4_mfib_table_destroy (ip4_mfib_t *mfib)
 
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. More...
 
u32 ip4_mfib_table_find_or_create_and_lock (u32 table_id, mfib_source_t src)
 Get or create an IPv4 fib. More...
 
u32 ip4_mfib_table_get_index_for_sw_if_index (u32 sw_if_index)
 
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)
 
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. More...
 
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)
 
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)
 
void ip4_mfib_table_entry_remove (ip4_mfib_t *mfib, const ip4_address_t *grp, const ip4_address_t *src, u32 len)
 
void ip4_mfib_table_walk (ip4_mfib_t *mfib, mfib_table_walk_fn_t fn, void *ctx)
 Walk the IP4 mfib table. More...
 
u8format_ip4_mfib_table_memory (u8 *s, va_list *args)
 format (display) the memory usage for IP4 mfibs More...
 
static void ip4_mfib_table_show_all (ip4_mfib_t *mfib, vlib_main_t *vm)
 
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)
 
static clib_error_tip4_show_mfib (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

static const mfib_prefix_t all_zeros
 
static const mfib_prefix_t ip4_specials []
 
static vlib_cli_command_t ip4_show_mfib_command
 (constructor) VLIB_CLI_COMMAND (ip4_show_mfib_command) More...
 

Macro Definition Documentation

◆ IP4_MFIB_MK_GRP_KEY

#define IP4_MFIB_MK_GRP_KEY (   _grp,
  _len,
  _key 
)
Value:
{ \
_key = ((u64)(_grp->data_u32 & \
}
#define IPV4_MFIB_GRP_LEN(_len)
Definition: ip4_mfib.c:195
unsigned long u64
Definition: types.h:89
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1105
u32 fib_masks[33]
Definition: ip4.h:120

Definition at line 204 of file ip4_mfib.c.

◆ IP4_MFIB_MK_KEY

#define IP4_MFIB_MK_KEY (   _grp,
  _src,
  _len,
  _key 
)
Value:
{ \
_key = ((u64)(_grp->data_u32 & \
_key |= _src->data_u32; \
}
#define IPV4_MFIB_GRP_LEN(_len)
Definition: ip4_mfib.c:195
unsigned long u64
Definition: types.h:89
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1105
u32 fib_masks[33]
Definition: ip4.h:120

Definition at line 198 of file ip4_mfib.c.

◆ IPV4_MFIB_GRP_LEN

#define IPV4_MFIB_GRP_LEN (   _len)    (_len > 32 ? 32 : _len)

Definition at line 195 of file ip4_mfib.c.

Function Documentation

◆ format_ip4_mfib_table_memory()

u8* format_ip4_mfib_table_memory ( u8 s,
va_list *  args 
)

format (display) the memory usage for IP4 mfibs

Definition at line 392 of file ip4_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_create_mfib_with_table_id()

static u32 ip4_create_mfib_with_table_id ( u32  table_id,
mfib_source_t  src 
)
static

Definition at line 47 of file ip4_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_mfib_interface_enable_disable()

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.

Definition at line 132 of file ip4_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_mfib_table_destroy()

void ip4_mfib_table_destroy ( ip4_mfib_t mfib)

Definition at line 102 of file ip4_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_mfib_table_entry_insert()

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 
)

Definition at line 311 of file ip4_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_mfib_table_entry_remove()

void ip4_mfib_table_entry_remove ( ip4_mfib_t mfib,
const ip4_address_t grp,
const ip4_address_t src,
u32  len 
)

Definition at line 342 of file ip4_mfib.c.

+ Here is the caller graph for this function:

◆ ip4_mfib_table_find_or_create_and_lock()

u32 ip4_mfib_table_find_or_create_and_lock ( u32  table_id,
mfib_source_t  src 
)

Get or create an IPv4 fib.

Get or create an IPv4 fib with the provided table ID.

Parameters
table_idWhen set to ~0, an arbitrary and unused fib ID is picked and can be retrieved with ret->table_id. Otherwise, the fib ID to be used to retrieve or create the desired fib.
Returns
A pointer to the retrieved or created fib.

Definition at line 168 of file ip4_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_mfib_table_get_index_for_sw_if_index()

u32 ip4_mfib_table_get_index_for_sw_if_index ( u32  sw_if_index)

Definition at line 182 of file ip4_mfib.c.

+ Here is the caller graph for this function:

◆ ip4_mfib_table_get_less_specific()

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 
)

Definition at line 279 of file ip4_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_mfib_table_lookup()

fib_node_index_t ip4_mfib_table_lookup ( const ip4_mfib_t fib,
const ip4_address_t src,
const ip4_address_t grp,
u32  len 
)

The IPv4 Multicast-FIB.

FIXME

This IPv4 FIB is used by the protocol independent FIB. So directly using this APIs in client code is not encouraged. However, this IPv4 FIB can be used if all the client wants is an IPv4 prefix data-base

Definition at line 241 of file ip4_mfib.c.

+ Here is the caller graph for this function:

◆ ip4_mfib_table_lookup_exact_match()

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 
)

Definition at line 216 of file ip4_mfib.c.

+ Here is the caller graph for this function:

◆ ip4_mfib_table_show_all()

static void ip4_mfib_table_show_all ( ip4_mfib_t mfib,
vlib_main_t vm 
)
static

Definition at line 428 of file ip4_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_mfib_table_show_one()

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 
)
static

Definition at line 466 of file ip4_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_mfib_table_walk()

void ip4_mfib_table_walk ( ip4_mfib_t mfib,
mfib_table_walk_fn_t  fn,
void *  ctx 
)

Walk the IP4 mfib table.

Parameters
mfibthe table to walk
fnThe function to invoke on each entry visited
ctxA context passed in the visit function

Definition at line 369 of file ip4_mfib.c.

+ Here is the caller graph for this function:

◆ ip4_show_mfib()

static clib_error_t* ip4_show_mfib ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 479 of file ip4_mfib.c.

+ Here is the call graph for this function:

Variable Documentation

◆ all_zeros

const mfib_prefix_t all_zeros
static
Initial value:

Definition at line 21 of file ip4_mfib.c.

◆ ip4_show_mfib_command

vlib_cli_command_t ip4_show_mfib_command
static
Initial value:
= {
.path = "show ip mfib",
.short_help = "show ip mfib [summary] [table <table-id>] [index <fib-id>] [<grp-addr>[/<mask>]] [<grp-addr>] [<src-addr> <grp-addr>]",
.function = ip4_show_mfib,
}
static clib_error_t * ip4_show_mfib(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ip4_mfib.c:479

(constructor) VLIB_CLI_COMMAND (ip4_show_mfib_command)

Definition at line 637 of file ip4_mfib.c.

◆ ip4_specials

const mfib_prefix_t ip4_specials[]
static
Initial value:
=
{
{
.fp_grp_addr = {
.ip4.data_u32 = 0x010000e0,
},
.fp_len = 32,
.fp_proto = FIB_PROTOCOL_IP4,
},
{
.fp_grp_addr = {
.ip4.data_u32 = 0x020000e0,
},
.fp_len = 32,
.fp_proto = FIB_PROTOCOL_IP4,
},
}

Definition at line 25 of file ip4_mfib.c.