diff options
author | Florin Coras <fcoras@cisco.com> | 2017-11-29 00:07:11 -0500 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-11-29 11:59:46 +0000 |
commit | 93e658058033e251b98d18a1f0717a07a85adfc2 (patch) | |
tree | 469bda92e663851b7925aa60fd8677d38a5e6a86 /src/vnet/session/transport.c | |
parent | c6fb36fc2eb43c6158b390918d295f2c8eba737b (diff) |
session: fix preallocation of local endpoint table
Change-Id: I67a73e31bda9e497859297fcc1765e880572884a
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/transport.c')
-rw-r--r-- | src/vnet/session/transport.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c index c18cf15974e..b0a5906383d 100644 --- a/src/vnet/session/transport.c +++ b/src/vnet/session/transport.c @@ -314,16 +314,20 @@ void transport_init (void) { vlib_thread_main_t *vtm = vlib_get_thread_main (); - u32 local_endpoints_table_buckets = 250000; - u32 local_endpoints_table_memory = 512 << 20; + session_manager_main_t *smm = vnet_get_session_manager_main (); u32 num_threads; + if (smm->local_endpoints_table_buckets == 0) + smm->local_endpoints_table_buckets = 250000; + if (smm->local_endpoints_table_memory == 0) + smm->local_endpoints_table_memory = 512 << 20; + /* Initialize [port-allocator] random number seed */ port_allocator_seed = (u32) clib_cpu_time_now (); clib_bihash_init_24_8 (&local_endpoints_table, "local endpoints table", - local_endpoints_table_buckets, - local_endpoints_table_memory); + smm->local_endpoints_table_buckets, + smm->local_endpoints_table_memory); num_threads = 1 /* main thread */ + vtm->n_threads; if (num_threads > 1) clib_spinlock_init (&local_endpoints_lock); |