FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
l2_bd.h File Reference
+ Include dependency graph for l2_bd.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bd_main_t
 
struct  l2_flood_member_t
 
struct  l2_bridge_domain_t
 
struct  l2_bridge_domain_add_del_args_t
 

Macros

#define L2_FLOOD_MEMBER_NORMAL   0
 
#define L2_FLOOD_MEMBER_BVI   1
 
#define L2_BD_ID_MAX   ((1<<24)-1)
 

Typedefs

typedef enum l2_bd_port_type_t_ l2_bd_port_type_t
 
typedef enum bd_flags_t_ bd_flags_t
 
typedef walk_rc_t(* bd_input_walk_fn_t) (u32 bd_index, u32 sw_if_index)
 Walk all the input interfaces in the BD. More...
 

Enumerations

enum  l2_bd_port_type_t_ { L2_BD_PORT_TYPE_NORMAL = 0, L2_BD_PORT_TYPE_BVI = 1, L2_BD_PORT_TYPE_UU_FWD = 2 }
 
enum  bd_flags_t_ {
  L2_NONE = 0, L2_LEARN = (1 << 0), L2_FWD = (1 << 1), L2_FLOOD = (1 << 2),
  L2_UU_FLOOD = (1 << 3), L2_ARP_TERM = (1 << 4), L2_ARP_UFWD = (1 << 5)
}
 

Functions

static u32 bd_is_valid (l2_bridge_domain_t *bd_config)
 
void bd_validate (l2_bridge_domain_t *bd_config)
 Init bridge domain if not done already. 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)
 
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...
 
void bd_set_learn_limit (vlib_main_t *vm, u32 bd_index, u32 learn_limit)
 Set learn limit for the bridge domain. More...
 
int bd_add_del (l2_bridge_domain_add_del_args_t *args)
 
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 u32 bd_find_or_add_bd_index (bd_main_t *bdm, u32 bd_id)
 Get or create a bridge domain. More...
 
u32 bd_input_walk (u32 bd_index, bd_input_walk_fn_t fn, void *data)
 
l2_bridge_domain_tbd_get (u32 bd_index)
 
l2_bridge_domain_tbd_get_by_table_id (u32 table_id)
 
u32 bd_add_del_ip_mac (u32 bd_index, ip46_type_t type, const ip46_address_t *ip_addr, 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...
 

Variables

bd_main_t bd_main
 

Macro Definition Documentation

◆ L2_BD_ID_MAX

#define L2_BD_ID_MAX   ((1<<24)-1)

Definition at line 122 of file l2_bd.h.

◆ L2_FLOOD_MEMBER_BVI

#define L2_FLOOD_MEMBER_BVI   1

Definition at line 51 of file l2_bd.h.

◆ L2_FLOOD_MEMBER_NORMAL

#define L2_FLOOD_MEMBER_NORMAL   0

Definition at line 50 of file l2_bd.h.

Typedef Documentation

◆ bd_flags_t

typedef enum bd_flags_t_ bd_flags_t

◆ bd_input_walk_fn_t

typedef walk_rc_t(* bd_input_walk_fn_t) (u32 bd_index, u32 sw_if_index)

Walk all the input interfaces in the BD.

Definition at line 213 of file l2_bd.h.

◆ l2_bd_port_type_t

Enumeration Type Documentation

◆ bd_flags_t_

Enumerator
L2_NONE 
L2_LEARN 
L2_FWD 
L2_FLOOD 
L2_UU_FLOOD 
L2_ARP_TERM 
L2_ARP_UFWD 

Definition at line 153 of file l2_bd.h.

◆ l2_bd_port_type_t_

Enumerator
L2_BD_PORT_TYPE_NORMAL 
L2_BD_PORT_TYPE_BVI 
L2_BD_PORT_TYPE_UU_FWD 

Definition at line 26 of file l2_bd.h.

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 79 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 args)

Definition at line 1361 of file l2_bd.c.

+ Here is the call graph for this function:
+ Here is the caller 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 945 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 153 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 70 of file l2_bd.c.

+ Here is the caller graph for this function:

◆ bd_find_or_add_bd_index()

static u32 bd_find_or_add_bd_index ( bd_main_t bdm,
u32  bd_id 
)
inlinestatic

Get or create a bridge domain.

Get a bridge domain with the given bridge domain ID, if one exists, otherwise create one with the given ID, or the first unused ID if the given ID is ~0..

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 202 of file l2_bd.h.

+ Here is the call graph for this function:
+ Here is the caller 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 1022 of file l2_bd.c.

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

◆ bd_get()

l2_bridge_domain_t* bd_get ( u32  bd_index)

Definition at line 252 of file l2_bd.c.

+ Here is the caller graph for this function:

◆ bd_get_by_table_id()

l2_bridge_domain_t* bd_get_by_table_id ( u32  table_id)

◆ bd_input_walk()

u32 bd_input_walk ( u32  bd_index,
bd_input_walk_fn_t  fn,
void *  data 
)

Definition at line 260 of file l2_bd.c.

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

◆ bd_is_valid()

static u32 bd_is_valid ( l2_bridge_domain_t bd_config)
inlinestatic

Definition at line 140 of file l2_bd.h.

+ Here is the caller graph for this function:

◆ bd_remove_member()

u32 bd_remove_member ( l2_bridge_domain_t bd_config,
u32  sw_if_index 
)

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

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

◆ bd_set_learn_limit()

void bd_set_learn_limit ( vlib_main_t vm,
u32  bd_index,
u32  learn_limit 
)

Set learn limit for the bridge domain.

Definition at line 367 of file l2_bd.c.

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

+ Here is the call graph for this function:
+ Here is the caller 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:

Variable Documentation

◆ bd_main

bd_main_t bd_main

Definition at line 44 of file l2_bd.c.