FD.io VPP  v16.09
Vector Packet Processing
l2_bd.c File Reference
+ Include dependency graph for l2_bd.c:

Go to the source code of this file.

Macros

#define BD_REMOVE_ERROR_OK   0
 
#define BD_REMOVE_ERROR_NOT_FOUND   1
 

Functions

void bd_validate (l2_bridge_domain_t *bd_config)
 Init bridge domain if not done already. More...
 
u32 bd_find_or_add_bd_index (bd_main_t *bdm, u32 bd_id)
 Get or create a bridge domain. More...
 
int bd_delete_bd_index (bd_main_t *bdm, u32 bd_id)
 Delete a bridge domain. More...
 
void bd_add_member (l2_bridge_domain_t *bd_config, l2_flood_member_t *member)
 
u32 bd_remove_member (l2_bridge_domain_t *bd_config, u32 sw_if_index)
 
clib_error_tl2bd_init (vlib_main_t *vm)
 
u32 bd_set_flags (vlib_main_t *vm, u32 bd_index, u32 flags, u32 enable)
 Set the learn/forward/flood flags for the bridge domain. More...
 
static clib_error_tbd_learn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Set bridge-domain learn enable/disable. More...
 
static clib_error_tbd_fwd (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Set bridge-domain forward enable/disable. More...
 
static clib_error_tbd_flood (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Set bridge-domain flood enable/disable. More...
 
static clib_error_tbd_uu_flood (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Set bridge-domain unkown-unicast flood enable/disable. More...
 
static clib_error_tbd_arp_term (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Set bridge-domain arp term enable/disable. More...
 
u32 bd_add_del_ip_mac (u32 bd_index, u8 *ip_addr, u8 *mac_addr, u8 is_ip6, u8 is_add)
 Add/delete IP address to MAC address mapping. More...
 
static clib_error_tbd_arp_entry (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Set bridge-domain arp entry add/delete. More...
 
u8format_vtr (u8 *s, va_list *args)
 
static clib_error_tbd_show (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Show bridge-domain state. More...
 

Variables

bd_main_t bd_main
 
static vlib_cli_command_t bd_learn_cli
 (constructor) VLIB_CLI_COMMAND (bd_learn_cli) More...
 
static vlib_cli_command_t bd_fwd_cli
 (constructor) VLIB_CLI_COMMAND (bd_fwd_cli) More...
 
static vlib_cli_command_t bd_flood_cli
 (constructor) VLIB_CLI_COMMAND (bd_flood_cli) More...
 
static vlib_cli_command_t bd_uu_flood_cli
 (constructor) VLIB_CLI_COMMAND (bd_uu_flood_cli) More...
 
static vlib_cli_command_t bd_arp_term_cli
 (constructor) VLIB_CLI_COMMAND (bd_arp_term_cli) More...
 
static vlib_cli_command_t bd_arp_entry_cli
 (constructor) VLIB_CLI_COMMAND (bd_arp_entry_cli) More...
 
static vlib_cli_command_t bd_show_cli
 (constructor) VLIB_CLI_COMMAND (bd_show_cli) More...
 

Macro Definition Documentation

#define BD_REMOVE_ERROR_NOT_FOUND   1

Definition at line 134 of file l2_bd.c.

#define BD_REMOVE_ERROR_OK   0

Definition at line 133 of file l2_bd.c.

Function Documentation

u32 bd_add_del_ip_mac ( u32  bd_index,
u8 ip_addr,
u8 mac_addr,
u8  is_ip6,
u8  is_add 
)

Add/delete IP address to MAC address mapping.

The clib hash implementation stores uword entries in the hash table. The hash table mac_by_ip4 is keyed via IP4 address and store the 6-byte MAC address directly in the hash table entry uword.

Warning
This only works for 64-bit processor with 8-byte uword; which means this code WILL NOT WORK for a 32-bit prcessor with 4-byte uword.

Definition at line 508 of file l2_bd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void bd_add_member ( l2_bridge_domain_t bd_config,
l2_flood_member_t member 
)

Definition at line 108 of file l2_bd.c.

+ Here is the caller graph for this function:

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

Set bridge-domain arp entry add/delete.

The CLI format is: set bridge-domain arp entry <bd-id> <ip-addr> <mac-addr> [del]

Definition at line 559 of file l2_bd.c.

+ Here is the call graph for this function:

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

Set bridge-domain arp term enable/disable.

The CLI format is: set bridge-domain arp term <bridge-domain-id> [disable]

Definition at line 449 of file l2_bd.c.

+ Here is the call graph for this function:

int bd_delete_bd_index ( bd_main_t bdm,
u32  bd_id 
)

Delete a bridge domain.

Delete an existing bridge domain with the given bridge domain ID.

Parameters
bdmbd_main pointer.
bd_idThe bridge domain ID.
Returns
0 on success and -1 if the bridge domain does not exist.

Definition at line 86 of file l2_bd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 bd_find_or_add_bd_index ( bd_main_t bdm,
u32  bd_id 
)

Get or create a bridge domain.

Get or create a bridge domain with the given bridge domain ID.

Parameters
bdmbd_main pointer.
bd_idThe bridge domain ID or ~0 if an arbitrary unused bridge domain should be used.
Returns
The bridge domain index in l2input_main->l2_bridge_domain_t vector.

Definition at line 54 of file l2_bd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Set bridge-domain flood enable/disable.

The CLI format is: set bridge-domain flood <bd_index> [disable]

Definition at line 339 of file l2_bd.c.

+ Here is the call graph for this function:

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

Set bridge-domain forward enable/disable.

The CLI format is: set bridge-domain forward <bd_index> [disable]

Definition at line 285 of file l2_bd.c.

+ Here is the call graph for this function:

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

Set bridge-domain learn enable/disable.

The CLI format is: set bridge-domain learn <bd_id> [disable]

Definition at line 230 of file l2_bd.c.

+ Here is the call graph for this function:

u32 bd_remove_member ( l2_bridge_domain_t bd_config,
u32  sw_if_index 
)

Definition at line 137 of file l2_bd.c.

+ Here is the caller graph for this function:

u32 bd_set_flags ( vlib_main_t vm,
u32  bd_index,
u32  flags,
u32  enable 
)

Set the learn/forward/flood flags for the bridge domain.

Return 0 if ok, non-zero if for an error.

Definition at line 180 of file l2_bd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Show bridge-domain state.

The CLI format is: show bridge-domain [<bd_index>]

Definition at line 674 of file l2_bd.c.

+ Here is the call graph for this function:

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

Set bridge-domain unkown-unicast flood enable/disable.

The CLI format is: set bridge-domain uu-flood <bd_index> [disable]

Definition at line 394 of file l2_bd.c.

+ Here is the call graph for this function:

void bd_validate ( l2_bridge_domain_t bd_config)

Init bridge domain if not done already.

For feature bitmap, set all bits except ARP termination

Definition at line 42 of file l2_bd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_vtr ( u8 s,
va_list *  args 
)

Definition at line 634 of file l2_bd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* l2bd_init ( vlib_main_t vm)

Definition at line 156 of file l2_bd.c.

+ Here is the call graph for this function:

Variable Documentation

vlib_cli_command_t bd_arp_entry_cli
static
Initial value:
= {
.path = "set bridge-domain arp entry",
.short_help = "set bridge-domain arp entry <bd-id> <ip-addr> <mac-addr> [del]",
.function = bd_arp_entry,
}
static clib_error_t * bd_arp_entry(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set bridge-domain arp entry add/delete.
Definition: l2_bd.c:559

(constructor) VLIB_CLI_COMMAND (bd_arp_entry_cli)

Definition at line 626 of file l2_bd.c.

vlib_cli_command_t bd_arp_term_cli
static
Initial value:
= {
.path = "set bridge-domain arp term",
.short_help = "set bridge-domain arp term <bridge-domain-id> [disable]",
.function = bd_arp_term,
}
static clib_error_t * bd_arp_term(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set bridge-domain arp term enable/disable.
Definition: l2_bd.c:449

(constructor) VLIB_CLI_COMMAND (bd_arp_term_cli)

Definition at line 488 of file l2_bd.c.

vlib_cli_command_t bd_flood_cli
static
Initial value:
= {
.path = "set bridge-domain flood",
.short_help = "set bridge-domain flood <bridge-domain-id> [disable]",
.function = bd_flood,
}
static clib_error_t * bd_flood(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set bridge-domain flood enable/disable.
Definition: l2_bd.c:339

(constructor) VLIB_CLI_COMMAND (bd_flood_cli)

Definition at line 381 of file l2_bd.c.

vlib_cli_command_t bd_fwd_cli
static
Initial value:
= {
.path = "set bridge-domain forward",
.short_help = "set bridge-domain forward <bridge-domain-id> [disable]",
.function = bd_fwd,
}
static clib_error_t * bd_fwd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set bridge-domain forward enable/disable.
Definition: l2_bd.c:285

(constructor) VLIB_CLI_COMMAND (bd_fwd_cli)

Definition at line 326 of file l2_bd.c.

vlib_cli_command_t bd_learn_cli
static
Initial value:
= {
.path = "set bridge-domain learn",
.short_help = "set bridge-domain learn <bridge-domain-id> [disable]",
.function = bd_learn,
}
static clib_error_t * bd_learn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set bridge-domain learn enable/disable.
Definition: l2_bd.c:230

(constructor) VLIB_CLI_COMMAND (bd_learn_cli)

Definition at line 272 of file l2_bd.c.

bd_main_t bd_main

Definition at line 35 of file l2_bd.c.

vlib_cli_command_t bd_show_cli
static
Initial value:
= {
.path = "show bridge-domain",
.short_help = "show bridge-domain [bridge-domain-id [detail|int|arp]]",
.function = bd_show,
}
static clib_error_t * bd_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Show bridge-domain state.
Definition: l2_bd.c:674

(constructor) VLIB_CLI_COMMAND (bd_show_cli)

Definition at line 813 of file l2_bd.c.

vlib_cli_command_t bd_uu_flood_cli
static
Initial value:
= {
.path = "set bridge-domain uu-flood",
.short_help = "set bridge-domain uu-flood <bridge-domain-id> [disable]",
.function = bd_uu_flood,
}
static clib_error_t * bd_uu_flood(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set bridge-domain unkown-unicast flood enable/disable.
Definition: l2_bd.c:394

(constructor) VLIB_CLI_COMMAND (bd_uu_flood_cli)

Definition at line 436 of file l2_bd.c.