aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/l2/l2_bd.c
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2017-05-05 12:35:25 -0400
committerFlorin Coras <florin.coras@gmail.com>2017-05-05 19:27:53 +0000
commitd48c8eb7354c6c8b5b875dc70d616d11c17e9fb8 (patch)
treee24b478a6e7f9237c4e068ad5dfa6511bb8c842a /src/vnet/l2/l2_bd.c
parentb1291e259cb246632f91ce0bbc30273354918e93 (diff)
Fix L2FIB learn counter and memory cleanup of mac_by_ip6 hash table
Fix global_learn_count to be incremented or decremented by add and deletion of non-static MAC entries from L2FIB only. Without this fix, the counter may reach the threshold of 1M and stop MAC leanring even though number of MAC entries in L2FIB is less than the threshold. Cleanup indirect hash key memory used by mac_by_ip6 hash table on BD deletion. Change-Id: I13986c4e6304c7956122520dd3f83d6bb6e65a15 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.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/vnet/l2/l2_bd.c b/src/vnet/l2/l2_bd.c
index 4d540220a35..351e6987446 100644
--- a/src/vnet/l2/l2_bd.c
+++ b/src/vnet/l2/l2_bd.c
@@ -94,8 +94,11 @@ bd_delete (bd_main_t * bdm, u32 bd_index)
{
l2_bridge_domain_t *bd = &l2input_main.bd_configs[bd_index];
u32 bd_id = bd->bd_id;
- l2fib_flush_bd_mac (vlib_get_main (), bd_index);
+ u64 mac_addr;
+ ip6_address_t *ip6_addr_key;
+ /* flush non-static MACs in BD and removed bd_id from hash table */
+ l2fib_flush_bd_mac (vlib_get_main (), bd_index);
hash_unset (bdm->bd_index_by_bd_id, bd_id);
/* mark this index clear */
@@ -105,9 +108,15 @@ bd_delete (bd_main_t * bdm, u32 bd_index)
bd->bd_id = ~0;
bd->feature_bitmap = 0;
- /* free memory used by BD and flush non-static MACs in BD */
+ /* free memory used by BD */
vec_free (bd->members);
hash_free (bd->mac_by_ip4);
+ /* *INDENT-OFF* */
+ hash_foreach_mem (ip6_addr_key, mac_addr, bd->mac_by_ip6,
+ ({
+ clib_mem_free (ip6_addr_key); /* free memory used for ip6 addr key */
+ }));
+ /* *INDENT-ON* */
hash_free (bd->mac_by_ip6);
return 0;