FD.io VPP  v19.04.4-rc0-5-ge88582fac
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 void bd_free_ip_mac_tables (l2_bridge_domain_t *bd)
 
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, bd_flags_t 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 void bd_set_bd_tag (vlib_main_t *vm, u32 bd_index, u8 *bd_tag)
 Set the tag 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 unknown-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, ip46_type_t type, const ip46_address_t *ip, const mac_address_t *mac, u8 is_add)
 Add/delete IP address to MAC address mapping. More...
 
void bd_flush_ip_mac (u32 bd_index)
 Flush IP address to MAC address mapping tables in a BD. 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...
 
static u8format_vtr (u8 *s, va_list *args)
 
static u8format_uu_cfg (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

◆ BD_REMOVE_ERROR_NOT_FOUND

#define BD_REMOVE_ERROR_NOT_FOUND   1

Definition at line 189 of file l2_bd.c.

◆ BD_REMOVE_ERROR_OK

#define BD_REMOVE_ERROR_OK   0

Definition at line 188 of file l2_bd.c.

Function Documentation

◆ bd_add_bd_index()

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

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

◆ bd_add_del()

int bd_add_del ( l2_bridge_domain_add_del_args_t a)

Definition at line 1188 of file l2_bd.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this 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 
)
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>] [bd-tag <tag>] [del]

Definition at line 1263 of file l2_bd.c.

+ Here is the call graph for this function:

◆ bd_add_del_ip_mac()

u32 bd_add_del_ip_mac ( u32  bd_index,
ip46_type_t  type,
const ip46_address_t *  ip,
const mac_address_t mac,
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 processor with 4-byte uword.

Definition at line 742 of file l2_bd.c.

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

◆ bd_add_member()

void bd_add_member ( l2_bridge_domain_t bd_config,
l2_flood_member_t member 
)

Definition at line 147 of file l2_bd.c.

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

◆ bd_arp_entry()

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

+ Here is the call graph for this function:

◆ bd_arp_term()

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

+ Here is the call graph for this function:

◆ bd_delete()

static int bd_delete ( bd_main_t bdm,
u32  bd_index 
)
static

Definition at line 111 of file l2_bd.c.

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

◆ bd_find_index()

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

+ Here is the caller graph for this function:

◆ bd_flood()

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

+ Here is the call graph for this function:

◆ bd_flush_ip_mac()

void bd_flush_ip_mac ( u32  bd_index)

Flush IP address to MAC address mapping tables in a BD.

Definition at line 819 of file l2_bd.c.

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

◆ bd_free_ip_mac_tables()

static void bd_free_ip_mac_tables ( l2_bridge_domain_t bd)
inlinestatic

Definition at line 95 of file l2_bd.c.

+ Here is the caller graph for this function:

◆ bd_fwd()

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

+ Here is the call graph for this function:

◆ bd_learn()

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

+ Here is the call graph for this function:

◆ bd_mac_age()

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

Definition at line 643 of file l2_bd.c.

+ Here is the call graph for this function:

◆ bd_remove_member()

u32 bd_remove_member ( l2_bridge_domain_t bd_config,
u32  sw_if_index 
)

Definition at line 192 of file l2_bd.c.

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

◆ bd_set_bd_tag()

static void bd_set_bd_tag ( vlib_main_t vm,
u32  bd_index,
u8 bd_tag 
)
static

Set the tag for the bridge domain.

Definition at line 318 of file l2_bd.c.

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

◆ bd_set_flags()

u32 bd_set_flags ( vlib_main_t vm,
u32  bd_index,
bd_flags_t  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 251 of file l2_bd.c.

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

◆ bd_set_mac_age()

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

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

◆ bd_show()

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

+ Here is the call graph for this function:

◆ bd_uu_flood()

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

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

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

Definition at line 540 of file l2_bd.c.

+ Here is the call graph for this function:

◆ bd_validate()

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:

◆ format_uu_cfg()

static u8* format_uu_cfg ( u8 s,
va_list *  args 
)
static

Definition at line 963 of file l2_bd.c.

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

◆ format_vtr()

static u8* format_vtr ( u8 s,
va_list *  args 
)
static

Definition at line 928 of file l2_bd.c.

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

◆ l2bd_init()

clib_error_t* l2bd_init ( vlib_main_t vm)

Definition at line 226 of file l2_bd.c.

+ Here is the call graph for this function:

◆ update_flood_count()

static void update_flood_count ( l2_bridge_domain_t bd_config)
static

Definition at line 138 of file l2_bd.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ bd_arp_entry_cli

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] | del-all]",
.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:835

(constructor) VLIB_CLI_COMMAND (bd_arp_entry_cli)

Definition at line 920 of file l2_bd.c.

◆ bd_arp_term_cli

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:605

(constructor) VLIB_CLI_COMMAND (bd_arp_term_cli)

Definition at line 722 of file l2_bd.c.

◆ bd_create_cli

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>] [bd-tag <tag>] [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:1263

(constructor) VLIB_CLI_COMMAND (bd_create_cli)

Definition at line 1403 of file l2_bd.c.

◆ bd_flood_cli

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:475

(constructor) VLIB_CLI_COMMAND (bd_flood_cli)

Definition at line 527 of file l2_bd.c.

◆ bd_fwd_cli

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:410

(constructor) VLIB_CLI_COMMAND (bd_fwd_cli)

Definition at line 462 of file l2_bd.c.

◆ bd_learn_cli

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:345

(constructor) VLIB_CLI_COMMAND (bd_learn_cli)

Definition at line 397 of file l2_bd.c.

◆ bd_mac_age_cli

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:643

(constructor) VLIB_CLI_COMMAND (bd_mac_age_cli)

Definition at line 704 of file l2_bd.c.

◆ bd_main

bd_main_t bd_main

Definition at line 44 of file l2_bd.c.

◆ bd_show_cli

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|bd-tag]]",
.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:982

(constructor) VLIB_CLI_COMMAND (bd_show_cli)

Definition at line 1180 of file l2_bd.c.

◆ bd_uu_flood_cli

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 unknown-unicast flood enable/disable.
Definition: l2_bd.c:540

(constructor) VLIB_CLI_COMMAND (bd_uu_flood_cli)

Definition at line 592 of file l2_bd.c.