summaryrefslogtreecommitdiffstats
path: root/src/vnet/l2/l2_input.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-09-14 12:18:44 +0200
committerDamjan Marion <damarion@cisco.com>2020-09-14 22:15:49 +0200
commit9514781064ef80e0bf46b0a2df7a7088034033d9 (patch)
treee5a07471730ccc54285015094593481a7d2e4284 /src/vnet/l2/l2_input.c
parentf99a7d64476fc25636a1df200b256df445d9e446 (diff)
l2: allocate l2fib only when needed
Currently l2 fib allocates 512MB hash table unconditionally on startup. This patch postpones table creation up to the point where first interface is put into l2 mode or mac entry is added. In addition it reduces default table size to 128MB and increases number of buckets 4 times. This default setting should be enough to keep 1M mac entries. Also, new startup.conf section is added which allows user to change memory and bucket size. .i.e: l2fib { table-size 512M num-buckets 524288 } Type: improvement Change-Id: I2a29209aa3545181f0087544c97a54d8157b6ec5 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/l2/l2_input.c')
-rw-r--r--src/vnet/l2/l2_input.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vnet/l2/l2_input.c b/src/vnet/l2/l2_input.c
index 542bd42c4c2..bfb0751f4e2 100644
--- a/src/vnet/l2/l2_input.c
+++ b/src/vnet/l2/l2_input.c
@@ -598,6 +598,9 @@ set_int_l2_mode (vlib_main_t * vm, vnet_main_t * vnet_main, /* */
hi = vnet_get_sup_hw_interface (vnet_main, sw_if_index);
config = l2input_intf_config (sw_if_index);
+ if (l2fib_main.mac_table_initialized == 0)
+ l2fib_table_init ();
+
if (config->bridge)
{
/* Interface is already in bridge mode. Undo the existing config. */