FD.io VPP  v17.07-30-g839fa73
Vector Packet Processing
l2_bd.c File Reference

Ethernet Bridge Domain. More...

+ 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_index (bd_main_t *bdm, u32 bd_id)
 Get a bridge domain. More...
 
u32 bd_add_bd_index (bd_main_t *bdm, u32 bd_id)
 Create a bridge domain. More...
 
static int bd_delete (bd_main_t *bdm, u32 bd_index)
 
static void update_flood_count (l2_bridge_domain_t *bd_config)
 
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...
 
void bd_set_mac_age (vlib_main_t *vm, u32 bd_index, u8 age)
 Set the mac age 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...
 
static clib_error_tbd_mac_age (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
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...
 
int bd_add_del (l2_bridge_domain_add_del_args_t *a)
 
static clib_error_tbd_add_del_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 Create or delete bridge-domain. 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_mac_age_cli
 (constructor) VLIB_CLI_COMMAND (bd_mac_age_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...
 
static vlib_cli_command_t bd_create_cli
 (constructor) VLIB_CLI_COMMAND (bd_create_cli) More...
 

Detailed Description

Ethernet Bridge Domain.

Code in this file manages Layer 2 bridge domains.

Definition in file l2_bd.c.

Macro Definition Documentation

#define BD_REMOVE_ERROR_NOT_FOUND   1

Definition at line 169 of file l2_bd.c.

#define BD_REMOVE_ERROR_OK   0

Definition at line 168 of file l2_bd.c.

Function Documentation

u32 bd_add_bd_index ( bd_main_t bdm,
u32  bd_id 
)

Create a bridge domain.

Create a bridge domain with the given bridge domain ID

Parameters
bdmbd_main pointer.
Returns
The bridge domain index in l2input_main->l2_bridge_domain_t vector.

Definition at line 76 of file l2_bd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int bd_add_del ( l2_bridge_domain_add_del_args_t a)

Definition at line 1114 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_add_del_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Create or delete bridge-domain.

The CLI format: create bridge-domain <bd_index> [learn <0|1>] [forward <0|1>] [uu-flood <0|1>] [flood <0|1>] [arp-term <0|1>] [mac-age <nn>] [del]

Definition at line 1185 of file l2_bd.c.

+ Here is the call graph for this function:

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 719 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 133 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_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 <bridge-domain-id> <ip-addr> <mac-addr> [del]

Definition at line 794 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 577 of file l2_bd.c.

+ Here is the call graph for this function:

static int bd_delete ( bd_main_t bdm,
u32  bd_index 
)
static

Definition at line 93 of file l2_bd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 bd_find_index ( bd_main_t bdm,
u32  bd_id 
)

Get a bridge domain.

Get a bridge domain with the given bridge domain ID.

Parameters
bdmbd_main pointer.
bd_idThe bridge domain ID
Returns
The bridge domain index in l2input_main->l2_bridge_domain_t vector.

Definition at line 67 of file l2_bd.c.

+ 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 437 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 367 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 297 of file l2_bd.c.

+ Here is the call graph for this function:

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

Definition at line 620 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 172 of file l2_bd.c.

+ Here is the call graph for this function:

+ 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 229 of file l2_bd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void bd_set_mac_age ( vlib_main_t vm,
u32  bd_index,
u8  age 
)

Set the mac age for the bridge domain.

Definition at line 273 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 923 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 507 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 51 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 883 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 204 of file l2_bd.c.

+ Here is the call graph for this function:

static void update_flood_count ( l2_bridge_domain_t bd_config)
static

Definition at line 126 of file l2_bd.c.

+ Here is the caller 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 <bridge-domain-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:794

(constructor) VLIB_CLI_COMMAND (bd_arp_entry_cli)

Definition at line 875 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:577

(constructor) VLIB_CLI_COMMAND (bd_arp_term_cli)

Definition at line 699 of file l2_bd.c.

vlib_cli_command_t bd_create_cli
static
Initial value:
= {
.path = "create bridge-domain",
.short_help = "create bridge-domain <bridge-domain-id>"
" [learn <0|1>] [forward <0|1>] [uu-flood <0|1>] [flood <0|1>] [arp-term <0|1>]"
" [mac-age <nn>] [del]",
.function = bd_add_del_command_fn,
}
static clib_error_t * bd_add_del_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Create or delete bridge-domain.
Definition: l2_bd.c:1185

(constructor) VLIB_CLI_COMMAND (bd_create_cli)

Definition at line 1315 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:437

(constructor) VLIB_CLI_COMMAND (bd_flood_cli)

Definition at line 494 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:367

(constructor) VLIB_CLI_COMMAND (bd_fwd_cli)

Definition at line 424 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:297

(constructor) VLIB_CLI_COMMAND (bd_learn_cli)

Definition at line 354 of file l2_bd.c.

vlib_cli_command_t bd_mac_age_cli
static
Initial value:
= {
.path = "set bridge-domain mac-age",
.short_help = "set bridge-domain mac-age <bridge-domain-id> <mins>",
.function = bd_mac_age,
}
static clib_error_t * bd_mac_age(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: l2_bd.c:620

(constructor) VLIB_CLI_COMMAND (bd_mac_age_cli)

Definition at line 681 of file l2_bd.c.

bd_main_t bd_main

Definition at line 44 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:923

(constructor) VLIB_CLI_COMMAND (bd_show_cli)

Definition at line 1106 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:507

(constructor) VLIB_CLI_COMMAND (bd_uu_flood_cli)

Definition at line 564 of file l2_bd.c.