|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
56 ~(L2INPUT_FEAT_ARP_TERM | L2INPUT_FEAT_UU_FWD | L2INPUT_FEAT_ARP_UFWD);
102 ip6_address_t *ip6_addr_key;
108 clib_mem_free (ip6_addr_key);
194 #define BD_REMOVE_ERROR_OK 0
195 #define BD_REMOVE_ERROR_NOT_FOUND 1
299 u32 feature_bitmap = 0;
303 feature_bitmap |= L2INPUT_FEAT_LEARN;
307 feature_bitmap |= L2INPUT_FEAT_FWD;
311 feature_bitmap |= L2INPUT_FEAT_FLOOD;
315 feature_bitmap |= L2INPUT_FEAT_UU_FLOOD;
319 feature_bitmap |= L2INPUT_FEAT_ARP_TERM;
323 feature_bitmap |= L2INPUT_FEAT_ARP_UFWD;
356 enable |= bd_config->
bd_id != ~0 && bd_config->
mac_age != 0;
424 "No operations on the default bridge domain are supported");
459 .path =
"set bridge-domain learn",
460 .short_help =
"set bridge-domain learn <bridge-domain-id> [disable]",
473 if (!
unformat (input,
"%d", &learn_limit))
476 0,
"expecting per bridge-domain max entry number got`%U'",
488 .path =
"set bridge-domain default-learn-limit",
489 .short_help =
"set bridge-domain default-learn-limit <maxentries>",
516 "No operations on the default bridge domain are supported");
552 .path =
"set bridge-domain forward",
553 .short_help =
"set bridge-domain forward <bridge-domain-id> [disable]",
582 "No operations on the default bridge domain are supported");
617 .path =
"set bridge-domain flood",
618 .short_help =
"set bridge-domain flood <bridge-domain-id> [disable]",
647 "No operations on the default bridge domain are supported");
682 .path =
"set bridge-domain uu-flood",
683 .short_help =
"set bridge-domain uu-flood <bridge-domain-id> [disable]",
712 "No operations on the default bridge domain are supported");
747 .path =
"set bridge-domain arp-ufwd",
748 .short_help =
"set bridge-domain arp-ufwd <bridge-domain-id> [disable]",
777 "No operations on the default bridge domain are supported");
815 "No operations on the default bridge domain are supported");
859 .path =
"set bridge-domain mac-age",
860 .short_help =
"set bridge-domain mac-age <bridge-domain-id> <mins>",
884 0,
"No operations on the default bridge domain are supported");
893 if (!
unformat (input,
"%u", &learn_limit))
896 0,
"expecting maxium number of learned entries but got `%U'",
908 .path =
"set bridge-domain learn-limit",
910 "set bridge-domain learn-limit <bridge-domain-id> <learn-limit>",
926 .path =
"set bridge-domain arp term",
927 .short_help =
"set bridge-domain arp term <bridge-domain-id> [disable]",
947 const ip46_address_t *
ip,
960 ip6_address_t *ip6_addr_key;
969 clib_memcpy (ip6_addr_key, &
ip->ip6, sizeof (ip6_address_t));
971 else if (*old_mac == new_mac)
980 ip6_addr_key = (ip6_address_t *) hp->
key;
986 if (old_mac && (*old_mac == new_mac))
989 ip6_addr_key = (ip6_address_t *) hp->
key;
1002 if (old_mac && (*old_mac == new_mac))
1009 if (old_mac && (*old_mac == new_mac))
1059 "No operations on the default bridge domain are supported");
1076 else if (
unformat (input,
"del-all"))
1104 is_add ?
"add" :
"del",
1124 .path =
"set bridge-domain arp entry",
1125 .short_help =
"set bridge-domain arp entry <bridge-domain-id> [<ip-addr> <mac-addr> [del] | del-all]",
1139 return (
format (s,
"flood"));
1141 return (
format (s,
"drop"));
1183 "No operations on the default bridge domain are supported");
1208 for (bd_index = start; bd_index <
end; bd_index++)
1217 "%=8s %=7s %=4s %=9s %=9s %=9s %=11s %=9s %=9s "
1218 "%=9s %=8s %=8s %=11s",
1219 "BD-ID",
"Index",
"BSN",
"Age(min)",
"Learning",
1220 "U-Forwrd",
"UU-Flood",
"Flooding",
"ARP-Term",
1221 "arp-ufwd",
"Learn-count",
"Learn-limit",
1231 "%=8d %=7d %=4d %=9v %=9s %=9s %=11U %=9s %=9s %=9s %=8d %=8d "
1238 bd_config->
feature_bitmap & L2INPUT_FEAT_ARP_TERM ?
"on" :
"off",
1239 bd_config->
feature_bitmap & L2INPUT_FEAT_ARP_UFWD ?
"on" :
"off",
1257 u32 vtr_opr, dot1q, tag1, tag2;
1261 "Interface",
"If-idx",
"ISN",
"SHG",
1262 "BVI",
"TxFlood",
"VLAN-Tag-Rewrite");
1269 swif_seq_num, member->
shg,
1271 "-", i < bd_config->flood_count ?
"*" :
"-",
1279 0, 0,
"uu",
"-",
"None");
1283 if ((detail || arp) &&
1287 ip6_address_t *ip6_addr;
1290 "\n IP4/IP6 to MAC table for ARP Termination");
1295 vlib_cli_output (vm,
"%=40U => %=20U",
1296 format_ip4_address, &ip4_addr,
1297 format_ethernet_address, &mac_addr);
1302 vlib_cli_output (vm,
"%=40U => %=20U",
1303 format_ip6_address, ip6_addr,
1304 format_ethernet_address, &mac_addr);
1309 if ((detail || bd_tag) && (bd_config->
bd_tag))
1354 .path =
"show bridge-domain",
1355 .short_help =
"show bridge-domain [bridge-domain-id [detail|int|arp|bd-tag]]",
1368 if (
fm->mac_table_initialized == 0)
1375 return VNET_API_ERROR_BD_ALREADY_EXISTS;
1377 return VNET_API_ERROR_BD_ID_EXCEED_MAX;
1380 bd_flags_t enable_flags = 0, disable_flags = 0;
1428 return VNET_API_ERROR_NO_SUCH_ENTRY;
1430 return VNET_API_ERROR_BD_NOT_MODIFIABLE;
1432 return VNET_API_ERROR_BD_IN_USE;
1454 u32 flood = 1, forward = 1, learn = 1, uu_flood = 1, arp_term =
1469 else if (
unformat (line_input,
"flood %d", &flood))
1471 else if (
unformat (line_input,
"uu-flood %d", &uu_flood))
1473 else if (
unformat (line_input,
"forward %d", &forward))
1475 else if (
unformat (line_input,
"learn %d", &learn))
1477 else if (
unformat (line_input,
"arp-term %d", &arp_term))
1479 else if (
unformat (line_input,
"arp-ufwd %d", &arp_ufwd))
1481 else if (
unformat (line_input,
"mac-age %d", &mac_age))
1483 else if (
unformat (line_input,
"bd-tag %s", &bd_tag))
1485 else if (
unformat (line_input,
"del"))
1488 flood = uu_flood = forward = learn = 0;
1511 if ((bd_tag) && (strlen ((
char *) bd_tag) > 63))
1520 a->flood = (
u8) flood;
1521 a->uu_flood = (
u8) uu_flood;
1522 a->forward = (
u8) forward;
1523 a->learn = (
u8) learn;
1524 a->arp_term = (
u8) arp_term;
1525 a->arp_ufwd = (
u8) arp_ufwd;
1526 a->mac_age = (
u8) mac_age;
1537 case VNET_API_ERROR_BD_IN_USE:
1540 case VNET_API_ERROR_NO_SUCH_ENTRY:
1543 case VNET_API_ERROR_BD_NOT_MODIFIABLE:
1546 case VNET_API_ERROR_BD_ID_EXCEED_MAX:
1592 .path =
"create bridge-domain",
1593 .short_help =
"create bridge-domain <bridge-domain-id>"
1594 " [learn <0|1>] [forward <0|1>] [uu-flood <0|1>] [flood <0|1>] [arp-term <0|1>]"
1595 " [arp-ufwd <0|1>] [mac-age <nn>] [bd-tag <tag>] [del]",
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define hash_get_pair(h, key)
#define hash_set(h, key, value)
@ L2_MAC_AGE_PROCESS_EVENT_START
static vlib_cli_command_t bd_flood_cli
(constructor) VLIB_CLI_COMMAND (bd_flood_cli)
#define clib_memcpy(d, s, n)
static vlib_cli_command_t bd_arp_term_cli
(constructor) VLIB_CLI_COMMAND (bd_arp_term_cli)
#define ip46_address_initializer
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_insert_elts(V, E, N, M)
Insert N vector elements starting at element M, insert given elements (no header, unspecified alignme...
@ L2_MAC_AGE_PROCESS_EVENT_STOP
static vlib_cli_command_t bd_show_cli
(constructor) VLIB_CLI_COMMAND (bd_show_cli)
static void clib_mem_free(void *p)
static_always_inline u64 mac_address_as_u64(const mac_address_t *mac)
#define clib_error_return(e, args...)
#define L2_FLOOD_MEMBER_BVI
u32 bd_remove_member(l2_bridge_domain_t *bd_config, u32 sw_if_index)
#define hash_foreach(key_var, value_var, h, body)
@ VNET_FLOOD_CLASS_NORMAL
#define hash_set_mem(h, key, value)
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.
clib_error_t * l2bd_init(vlib_main_t *vm)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static void b2_input_recache(u32 bd_index)
#define vec_delete(V, N, M)
Delete N elements starting at element M.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static void update_flood_count(l2_bridge_domain_t *bd_config)
static vlib_cli_command_t bd_learn_cli
(constructor) VLIB_CLI_COMMAND (bd_learn_cli)
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
void bd_flush_ip_mac(u32 bd_index)
Flush IP address to MAC address mapping tables in a BD.
l2_bridge_domain_t * bd_get(u32 bd_index)
#define hash_unset(h, key)
static clib_error_t * bd_arp_ufwd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set bridge-domain arp-unicast forward enable/disable.
@ VNET_FLOOD_CLASS_TUNNEL_NORMAL
u32 bd_default_learn_limit
int bd_add_del(l2_bridge_domain_add_del_args_t *a)
static void bd_set_bd_tag(vlib_main_t *vm, u32 bd_index, u8 *bd_tag)
Set the tag for the bridge domain.
u32 bd_input_walk(u32 bd_index, bd_input_walk_fn_t fn, void *data)
walk_rc_t(* bd_input_walk_fn_t)(u32 bd_index, u32 sw_if_index)
Walk all the input interfaces in the BD.
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.
#define hash_create_mem(elts, key_bytes, value_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_unset_mem(h, key)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vnet_main_t * vnet_get_main(void)
static clib_error_t * bd_learn_limit(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u8 * format_mac_address_t(u8 *s, va_list *args)
#define BD_REMOVE_ERROR_OK
f64 end
end of the time range
void bd_add_member(l2_bridge_domain_t *bd_config, l2_flood_member_t *member)
vnet_flood_class_t flood_class
#define vec_foreach_index(var, v)
Iterate over vector indices.
static clib_error_t * bd_default_learn_limit(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static u8 * format_uu_cfg(u8 *s, va_list *args)
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.
static int bd_delete(bd_main_t *bdm, u32 bd_index)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
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.
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.
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.
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.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
enum bd_flags_t_ bd_flags_t
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.
static void bd_free_ip_mac_tables(l2_bridge_domain_t *bd)
vl_api_mac_address_t mac_addr
l2learn_main_t l2learn_main
#define hash_get_mem(h, key)
static vlib_cli_command_t bd_default_learn_limit_cli
(constructor) VLIB_CLI_COMMAND (bd_default_learn_limit_cli)
void l2fib_flush_bd_mac(vlib_main_t *vm, u32 bd_index)
Flush all non static MACs in a bridge domain.
#define vec_free(V)
Free vector's memory (no header).
static u32 bd_is_valid(l2_bridge_domain_t *bd_config)
u32 bd_find_index(bd_main_t *bdm, u32 bd_id)
Get a bridge domain.
#define BD_REMOVE_ERROR_NOT_FOUND
static vlib_cli_command_t bd_create_cli
(constructor) VLIB_CLI_COMMAND (bd_create_cli)
format_function_t format_vnet_sw_if_index_name
description fragment has unexpected format
@ VNET_FLOOD_CLASS_NO_FLOOD
uword unformat_mac_address_t(unformat_input_t *input, va_list *args)
format_function_t format_ip46_address
#define VLIB_INIT_FUNCTION(x)
format_function_t format_vtr
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.
static vlib_cli_command_t bd_mac_age_cli
(constructor) VLIB_CLI_COMMAND (bd_mac_age_cli)
#define vec_foreach(var, vec)
Vector iterator.
void bd_validate(l2_bridge_domain_t *bd_config)
Init bridge domain if not done already.
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.
vlib_node_registration_t l2fib_mac_age_scanner_process_node
(constructor) VLIB_REGISTER_NODE (l2fib_mac_age_scanner_process_node)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static clib_error_t * bd_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Show bridge-domain state.
static vlib_cli_command_t bd_uu_flood_cli
(constructor) VLIB_CLI_COMMAND (bd_uu_flood_cli)
static vlib_main_t * vlib_get_main(void)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static vlib_cli_command_t bd_fwd_cli
(constructor) VLIB_CLI_COMMAND (bd_fwd_cli)
static vlib_cli_command_t bd_arp_entry_cli
(constructor) VLIB_CLI_COMMAND (bd_arp_entry_cli)
l2_flood_member_t * members
u32 bd_add_bd_index(bd_main_t *bdm, u32 bd_id)
Create a bridge domain.
@ VNET_FLOOD_CLASS_TUNNEL_MASTER
void bd_set_learn_limit(vlib_main_t *vm, u32 bd_index, u32 learn_limit)
Set learn limit for the bridge domain.
static vlib_cli_command_t bd_learn_limit_cli
(constructor) VLIB_CLI_COMMAND (bd_learn_limit_cli)
u8 * format_vnet_sw_if_index_name_with_NA(u8 *s, va_list *args)
Format sw_if_index.
static clib_error_t * bd_mac_age(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void bd_set_mac_age(vlib_main_t *vm, u32 bd_index, u8 age)
Set the mac age for the bridge domain.
vl_api_interface_index_t sw_if_index
#define hash_create(elts, value_bytes)
#define hash_foreach_mem(key_var, value_var, h, body)
uword * bd_index_by_bd_id
static void * clib_mem_alloc(uword size)
vl_api_fib_path_type_t type
static vlib_cli_command_t bd_arp_ufwd_cli
(constructor) VLIB_CLI_COMMAND (bd_arp_ufwd_cli)
void l2fib_table_init(void)
l2_bridge_domain_t * bd_configs
vl_api_wireguard_peer_flags_t flags