aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/l2/l2_bd.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_bd.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_bd.c')
-rw-r--r--src/vnet/l2/l2_bd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vnet/l2/l2_bd.c b/src/vnet/l2/l2_bd.c
index e6fb6223d93..94852c90769 100644
--- a/src/vnet/l2/l2_bd.c
+++ b/src/vnet/l2/l2_bd.c
@@ -1226,9 +1226,13 @@ int
bd_add_del (l2_bridge_domain_add_del_args_t * a)
{
bd_main_t *bdm = &bd_main;
+ l2fib_main_t *fm = &l2fib_main;
vlib_main_t *vm = bdm->vlib_main;
int rv = 0;
+ if (fm->mac_table_initialized == 0)
+ l2fib_table_init ();
+
u32 bd_index = bd_find_index (bdm, a->bd_id);
if (a->is_add)
{