FD.io VPP  v18.07-rc0-415-g6c78436
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 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, 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 180 of file l2_bd.c.

#define BD_REMOVE_ERROR_OK   0

Definition at line 179 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 1135 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>] [bd-tag <tag>] [del]

Definition at line 1210 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 731 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 138 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 806 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 594 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 464 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 399 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 334 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 632 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 183 of file l2_bd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 307 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 240 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 284 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 935 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 unknown-unicast flood enable/disable.

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

Definition at line 529 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 895 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 215 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 129 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:806

(constructor) VLIB_CLI_COMMAND (bd_arp_entry_cli)

Definition at line 887 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:594

(constructor) VLIB_CLI_COMMAND (bd_arp_term_cli)

Definition at line 711 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>] [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:1210

(constructor) VLIB_CLI_COMMAND (bd_create_cli)

Definition at line 1350 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:464

(constructor) VLIB_CLI_COMMAND (bd_flood_cli)

Definition at line 516 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:399

(constructor) VLIB_CLI_COMMAND (bd_fwd_cli)

Definition at line 451 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:334

(constructor) VLIB_CLI_COMMAND (bd_learn_cli)

Definition at line 386 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:632

(constructor) VLIB_CLI_COMMAND (bd_mac_age_cli)

Definition at line 693 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|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:935

(constructor) VLIB_CLI_COMMAND (bd_show_cli)

Definition at line 1127 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 unknown-unicast flood enable/disable.
Definition: l2_bd.c:529

(constructor) VLIB_CLI_COMMAND (bd_uu_flood_cli)

Definition at line 581 of file l2_bd.c.