164 #define BD_REMOVE_ERROR_OK 0 165 #define BD_REMOVE_ERROR_NOT_FOUND 1 228 u32 feature_bitmap = 0;
237 feature_bitmap |= L2INPUT_FEAT_LEARN;
241 feature_bitmap |= L2INPUT_FEAT_FWD;
245 feature_bitmap |= L2INPUT_FEAT_FLOOD;
249 feature_bitmap |= L2INPUT_FEAT_UU_FLOOD;
253 feature_bitmap |= L2INPUT_FEAT_ARP_TERM;
306 if (!
unformat (input,
"%d", &bd_id))
351 .path =
"set bridge-domain learn",
352 .short_help =
"set bridge-domain learn <bridge-domain-id> [disable]",
371 if (!
unformat (input,
"%d", &bd_id))
417 .path =
"set bridge-domain forward",
418 .short_help =
"set bridge-domain forward <bridge-domain-id> [disable]",
438 if (!
unformat (input,
"%d", &bd_id))
483 .path =
"set bridge-domain flood",
484 .short_help =
"set bridge-domain flood <bridge-domain-id> [disable]",
504 if (!
unformat (input,
"%d", &bd_id))
549 .path =
"set bridge-domain uu-flood",
550 .short_help =
"set bridge-domain uu-flood <bridge-domain-id> [disable]",
570 if (!
unformat (input,
"%d", &bd_id))
609 if (!
unformat (input,
"%d", &bd_id))
658 .path =
"set bridge-domain mac-age",
659 .short_help =
"set bridge-domain mac-age <bridge-domain-id> <mins>",
676 .path =
"set bridge-domain arp term",
677 .short_help =
"set bridge-domain arp term <bridge-domain-id> [disable]",
696 u8 * ip_addr,
u8 * mac_addr,
u8 is_ip6,
u8 is_add)
700 u64 new_mac = *(
u64 *) mac_addr;
702 u16 *mac16 = (
u16 *) & new_mac;
719 else if (*old_mac == new_mac)
732 if (old_mac && (*old_mac == new_mac))
749 if (old_mac && (*old_mac == new_mac))
755 if (old_mac && (*old_mac == new_mac))
782 if (!
unformat (input,
"%d", &bd_id))
827 is_add ?
"add" :
"del",
848 .path =
"set bridge-domain arp entry",
849 .short_help =
"set bridge-domain arp entry <bridge-domain-id> <ip-addr> <mac-addr> [del]",
857 u32 vtr_op = va_arg (*args,
u32);
858 u32 dot1q = va_arg (*args,
u32);
859 u32 tag1 = va_arg (*args,
u32);
860 u32 tag2 = va_arg (*args,
u32);
864 return format (s,
"none");
866 return format (s,
"push-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
868 return format (s,
"push-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad", tag1,
871 return format (s,
"pop-1");
873 return format (s,
"pop-2");
875 return format (s,
"trans-1-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
877 return format (s,
"trans-1-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad",
880 return format (s,
"trans-2-1 %s %d", dot1q ?
"dot1q" :
"dot1ad", tag1);
882 return format (s,
"trans-2-2 %s %d %d", dot1q ?
"dot1q" :
"dot1ad",
885 return format (s,
"none");
946 for (bd_index = start; bd_index < end; bd_index++)
955 "%=5s %=7s %=10s %=10s %=10s %=10s %=10s %=14s",
956 "ID",
"Index",
"Learning",
"U-Forwrd",
957 "UU-Flood",
"Flooding",
"ARP-Term",
962 "%=5d %=7d %=10s %=10s %=10s %=10s %=10s %=14U",
963 bd_config->
bd_id, bd_index,
984 u32 vtr_opr, dot1q, tag1, tag2;
988 "Interface",
"Index",
"SHG",
"BVI",
989 "TxFlood",
"VLAN-Tag-Rewrite");
998 "-", i < bd_config->flood_count ?
"*" :
"-",
1003 if ((detail || arp) &&
1010 "\n IP4/IP6 to MAC table for ARP Termination");
1015 vlib_cli_output (vm,
"%=40U => %=20U",
1016 format_ip4_address, &ip4_addr,
1017 format_ethernet_address, &mac_addr);
1022 vlib_cli_output (vm,
"%=40U => %=20U",
1023 format_ip6_address, ip6_addr,
1024 format_ethernet_address, &mac_addr);
1067 .path =
"show bridge-domain",
1068 .short_help =
"show bridge-domain [bridge-domain-id [detail|int|arp]]",
void bd_validate(l2_bridge_domain_t *bd_config)
Init bridge domain if not done already.
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
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.
#define vec_foreach_index(var, v)
Iterate over vector indices.
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
u8 * format_vnet_sw_if_index_name_with_NA(u8 *s, va_list *args)
Format sw_if_index.
#define hash_unset(h, key)
static void update_flood_count(l2_bridge_domain_t *bd_config)
l2_flood_member_t * members
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
#define hash_set_mem(h, key, value)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
u32 bd_remove_member(l2_bridge_domain_t *bd_config, u32 sw_if_index)
#define L2_FLOOD_MEMBER_BVI
format_function_t format_vnet_sw_if_index_name
vnet_main_t * vnet_get_main(void)
vnet_flood_class_t flood_class
int bd_delete_bd_index(bd_main_t *bdm, u32 bd_id)
Delete a bridge domain.
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VLIB_INIT_FUNCTION(x)
void bd_add_member(l2_bridge_domain_t *bd_config, l2_flood_member_t *member)
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.
#define hash_foreach(key_var, value_var, h, body)
clib_error_t * l2bd_init(vlib_main_t *vm)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define hash_get_pair(h, key)
uword * bd_index_by_bd_id
#define BD_REMOVE_ERROR_OK
#define hash_create_mem(elts, key_bytes, value_bytes)
#define hash_unset_mem(h, key)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
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.
#define vec_del1(v, i)
Delete the element at index I.
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.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define hash_foreach_mem(key_var, value_var, h, body)
static u32 bd_is_valid(l2_bridge_domain_t *bd_config)
#define BD_REMOVE_ERROR_NOT_FOUND
void bd_set_mac_age(vlib_main_t *vm, u32 bd_index, u8 age)
Set the mac age for the bridge domain.
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.
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.
#define clib_memcpy(a, b, c)
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * bd_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Show bridge-domain state.
#define hash_create(elts, value_bytes)
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
#define vec_insert_elts(V, E, N, M)
Insert N vector elements starting at element M, insert given elements (no header, unspecified alignme...
static void clib_mem_free(void *p)
static void * clib_mem_alloc(uword size)
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.
static clib_error_t * bd_mac_age(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 bd_find_or_add_bd_index(bd_main_t *bdm, u32 bd_id)
Get or create a bridge domain.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
l2_bridge_domain_t * bd_configs
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.
u8 * format_vtr(u8 *s, va_list *args)
#define hash_get_mem(h, key)
u32 l2vtr_get(vlib_main_t *vlib_main, vnet_main_t *vnet_main, u32 sw_if_index, u32 *vtr_op, u32 *push_dot1q, u32 *vtr_tag1, u32 *vtr_tag2)
Get vtag tag rewrite on the given interface.
#define vec_foreach(var, vec)
Vector iterator.
#define clib_error_return(e, args...)
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
vlib_node_registration_t l2fib_mac_age_scanner_process_node
(constructor) VLIB_REGISTER_NODE (l2fib_mac_age_scanner_process_node)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".