From d48c8eb7354c6c8b5b875dc70d616d11c17e9fb8 Mon Sep 17 00:00:00 2001 From: John Lo Date: Fri, 5 May 2017 12:35:25 -0400 Subject: 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 --- src/vnet/l2/l2_fib.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/vnet/l2/l2_fib.c') diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c index d8fcc319567..028a73269f9 100644 --- a/src/vnet/l2/l2_fib.c +++ b/src/vnet/l2/l2_fib.c @@ -215,7 +215,9 @@ show_l2fib (vlib_main_t * vm, if (total_entries == 0) vlib_cli_output (vm, "no l2fib entries"); else - vlib_cli_output (vm, "%lld l2fib entries", total_entries); + vlib_cli_output (vm, + "%lld l2fib entries with %d learned (or non-static) entries", + total_entries, l2learn_main.global_learn_count); if (raw) vlib_cli_output (vm, "Raw Hash Table:\n%U\n", @@ -347,7 +349,7 @@ l2fib_add_entry (u64 mac, BV (clib_bihash_add_del) (&mp->mac_table, &kv, 1 /* is_add */ ); /* increment counter if dynamically learned mac */ - if (result.fields.static_mac) + if (result.fields.static_mac == 0) { l2learn_main.global_learn_count++; } @@ -635,7 +637,7 @@ l2fib_del_entry (u64 mac, u32 bd_index) result.raw = kv.value; /* decrement counter if dynamically learned mac */ - if (result.fields.static_mac) + if (result.fields.static_mac == 0) { if (l2learn_main.global_learn_count > 0) { -- cgit 1.2.3-korg