summaryrefslogtreecommitdiffstats
path: root/src/vnet/l2/l2_bd.c
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2017-03-24 20:11:15 -0400
committerDamjan Marion <dmarion.lists@gmail.com>2017-03-28 12:29:10 +0000
commitda1f2c7cffb0de4ef05a48ffd107214eb11fa45f (patch)
tree56267e11122a2de325d204b8ad5fb49884eec93c /src/vnet/l2/l2_bd.c
parent6792ec059696a358b6c98d8d86e9740b34c01e24 (diff)
Implement MAC Flush for BD or Interface from the L2FIB
Allow non-static MACs in the L2FIB which is associated with an interface or a bridge domain (BD) be flushed. MAC flush are initiated automatically when an interface is removed from a BD or when a BD is deleted. MAC flush can also be invoked manually via the following CLI: l2fib mac-flush interface <if-name> l2fib mac-flush bridge-domain <bd-id> Change-Id: Ie33243622834810a765f48ebcd22bdb8e8fc87a4 Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/vnet/l2/l2_bd.c')
-rw-r--r--src/vnet/l2/l2_bd.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/vnet/l2/l2_bd.c b/src/vnet/l2/l2_bd.c
index f741b64371f..6c01368bd92 100644
--- a/src/vnet/l2/l2_bd.c
+++ b/src/vnet/l2/l2_bd.c
@@ -115,6 +115,8 @@ bd_delete_bd_index (bd_main_t * bdm, u32 bd_id)
l2input_main.bd_configs[bd_index].bd_id = ~0;
l2input_main.bd_configs[bd_index].feature_bitmap = 0;
+ l2fib_flush_bd_mac (vlib_get_main (), bd_index);
+
return 0;
}
@@ -900,7 +902,6 @@ bd_show (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
u32 bd_index = ~0;
l2_bridge_domain_t *bd_config;
u32 start, end;
- u32 printed;
u32 detail = 0;
u32 intf = 0;
u32 arp = 0;
@@ -942,7 +943,8 @@ bd_show (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
}
/* Show all bridge-domains that have been initialized */
- printed = 0;
+ u32 printed = 0;
+ u8 *as = 0;
for (bd_index = start; bd_index < end; bd_index++)
{
bd_config = vec_elt_at_index (l2input_main.bd_configs, bd_index);
@@ -952,26 +954,32 @@ bd_show (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
{
printed = 1;
vlib_cli_output (vm,
- "%=5s %=7s %=10s %=10s %=10s %=10s %=10s %=14s",
- "ID", "Index", "Learning", "U-Forwrd",
- "UU-Flood", "Flooding", "ARP-Term",
+ "%=5s %=7s %=4s %=9s %=9s %=9s %=9s %=9s %=9s %=9s",
+ "ID", "Index", "BSN", "Age(min)", "Learning",
+ "U-Forwrd", "UU-Flood", "Flooding", "ARP-Term",
"BVI-Intf");
}
+ if (bd_config->mac_age)
+ as = format (as, "%d", bd_config->mac_age);
+ else
+ as = format (as, "off");
vlib_cli_output (vm,
- "%=5d %=7d %=10s %=10s %=10s %=10s %=10s %=14U",
- bd_config->bd_id, bd_index,
+ "%=5d %=7d %=4d %=9v %=9s %=9s %=9s %=9s %=9s %=9U",
+ bd_config->bd_id, bd_index, bd_config->seq_num, as,
bd_config->feature_bitmap & L2INPUT_FEAT_LEARN ?
"on" : "off",
- bd_config->feature_bitmap & L2INPUT_FEAT_FWD ? "on"
- : "off",
+ bd_config->feature_bitmap & L2INPUT_FEAT_FWD ?
+ "on" : "off",
bd_config->feature_bitmap & L2INPUT_FEAT_UU_FLOOD ?
"on" : "off",
bd_config->feature_bitmap & L2INPUT_FEAT_FLOOD ?
"on" : "off",
bd_config->feature_bitmap & L2INPUT_FEAT_ARP_TERM ?
- "on" : "off", format_vnet_sw_if_index_name_with_NA,
+ "on" : "off",
+ format_vnet_sw_if_index_name_with_NA,
vnm, bd_config->bvi_sw_if_index);
+ vec_reset_length (as);
if (detail || intf)
{
@@ -981,19 +989,21 @@ bd_show (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
{
l2_flood_member_t *member =
vec_elt_at_index (bd_config->members, i);
+ l2_input_config_t *int_config =
+ l2input_intf_config (member->sw_if_index);
u32 vtr_opr, dot1q, tag1, tag2;
if (i == 0)
{
- vlib_cli_output (vm, "\n%=30s%=7s%=5s%=5s%=9s%=30s",
- "Interface", "Index", "SHG", "BVI",
- "TxFlood", "VLAN-Tag-Rewrite");
+ vlib_cli_output (vm, "\n%=30s%=7s%=5s%=5s%=5s%=9s%=30s",
+ "Interface", "If-idx", "ISN", "SHG",
+ "BVI", "TxFlood", "VLAN-Tag-Rewrite");
}
l2vtr_get (vm, vnm, member->sw_if_index, &vtr_opr, &dot1q,
&tag1, &tag2);
- vlib_cli_output (vm, "%=30U%=7d%=5d%=5s%=9s%=30U",
+ vlib_cli_output (vm, "%=30U%=7d%=5d%=5d%=5s%=9s%=30U",
format_vnet_sw_if_index_name, vnm,
member->sw_if_index, member->sw_if_index,
- member->shg,
+ int_config->seq_num, member->shg,
member->flags & L2_FLOOD_MEMBER_BVI ? "*" :
"-", i < bd_config->flood_count ? "*" : "-",
format_vtr, vtr_opr, dot1q, tag1, tag2);
@@ -1027,6 +1037,7 @@ bd_show (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
}
}
}
+ vec_free (as);
if (!printed)
{