diff options
author | Damjan Marion <damarion@cisco.com> | 2020-09-14 12:18:44 +0200 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2020-09-14 22:15:49 +0200 |
commit | 9514781064ef80e0bf46b0a2df7a7088034033d9 (patch) | |
tree | e5a07471730ccc54285015094593481a7d2e4284 /src/vnet/l2/l2_fib.h | |
parent | f99a7d64476fc25636a1df200b256df445d9e446 (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_fib.h')
-rw-r--r-- | src/vnet/l2/l2_fib.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/vnet/l2/l2_fib.h b/src/vnet/l2/l2_fib.h index a1dbc9db5c7..41ef4ab3461 100644 --- a/src/vnet/l2/l2_fib.h +++ b/src/vnet/l2/l2_fib.h @@ -24,8 +24,8 @@ /* * The size of the hash table */ -#define L2FIB_NUM_BUCKETS (64 * 1024) -#define L2FIB_MEMORY_SIZE (512<<20) +#define L2FIB_NUM_BUCKETS (256 * 1024) +#define L2FIB_MEMORY_SIZE (128<<20) /* Ager scan interval is 1 minute for aging */ #define L2FIB_AGE_SCAN_INTERVAL (60.0) @@ -45,6 +45,15 @@ typedef struct /* hash table */ BVT (clib_bihash) mac_table; + /* number of buckets in the hash table */ + uword mac_table_n_buckets; + + /* hash table memory size */ + uword mac_table_memory_size; + + /* hash table initialized */ + u8 mac_table_initialized; + /* per swif vector of sequence number for interface based flush of MACs */ u8 *swif_seq_num; @@ -419,6 +428,8 @@ l2fib_lookup_4 (BVT (clib_bihash) * mac_table, void l2fib_clear_table (void); +void l2fib_table_init (void); + void l2fib_add_entry (const u8 * mac, u32 bd_index, |