diff options
author | Klement Sekera <ksekera@cisco.com> | 2020-10-26 13:42:41 +0000 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2020-11-03 11:46:44 +0000 |
commit | c358d78c4126c3bd660d16583842ac41afc77a3e (patch) | |
tree | e5d6e42fa2c3c29acdb3cd733b1082de38fff0a7 /src/plugins/nat/nat_api.c | |
parent | af4a414eb74d1456121023e6b3aa76af6c16f89a (diff) |
nat: bihash: fix buckets calc and remove mem param
Calculate bihash buckets as n_elts / 2.5 rounded to closest pow2
per Damjan's recommendation. Remove memory configuration parameters
because bihash init ignores them anyway as it resides in main heap now.
Type: improvement
Change-Id: I189f463f3c4640106cce4f12d3c5a62969276a82
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat_api.c')
-rw-r--r-- | src/plugins/nat/nat_api.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c index 39f1af70f9d..933d3a2c2e5 100644 --- a/src/plugins/nat/nat_api.c +++ b/src/plugins/nat/nat_api.c @@ -102,12 +102,9 @@ vl_api_nat_show_config_t_handler (vl_api_nat_show_config_t * mp) REPLY_MACRO2 (VL_API_NAT_SHOW_CONFIG_REPLY, ({ rmp->translation_buckets = htonl (sm->translation_buckets); - rmp->translation_memory_size = clib_host_to_net_u32 ( - sm->translation_memory_size > 0xffffffffULL - ? 0xffffffffUL - : (u32)sm->translation_memory_size); + rmp->translation_memory_size = 0; rmp->user_buckets = htonl (sm->user_buckets); - rmp->user_memory_size = clib_host_to_net_u64 (sm->user_memory_size); + rmp->user_memory_size = 0; rmp->max_translations_per_user = htonl (sm->max_translations_per_user); rmp->outside_vrf_id = htonl (sm->outside_vrf_id); rmp->inside_vrf_id = htonl (sm->inside_vrf_id); @@ -148,9 +145,9 @@ vl_api_nat_show_config_2_t_handler (vl_api_nat_show_config_2_t * mp) REPLY_MACRO2 (VL_API_NAT_SHOW_CONFIG_2_REPLY, ({ rmp->translation_buckets = htonl (sm->translation_buckets); - rmp->translation_memory_size = clib_host_to_net_u64 (sm->translation_memory_size); + rmp->translation_memory_size = 0; rmp->user_buckets = htonl (sm->user_buckets); - rmp->user_memory_size = clib_host_to_net_u64 (sm->user_memory_size); + rmp->user_memory_size = 0; rmp->max_translations_per_user = htonl (sm->max_translations_per_user); rmp->outside_vrf_id = htonl (sm->outside_vrf_id); rmp->inside_vrf_id = htonl (sm->inside_vrf_id); @@ -353,10 +350,8 @@ static void c.outside_vrf = ntohl (mp->outside_vrf); c.users = ntohl (mp->users); - c.user_memory = ntohl (mp->user_memory); c.sessions = ntohl (mp->sessions); - c.session_memory = ntohl (mp->session_memory); c.user_sessions = ntohl (mp->user_sessions); @@ -1768,8 +1763,7 @@ nat_ed_users_destroy (snat_main_per_thread_data_t * tsm) pool_flush (u, tsm->users, { }); /* *INDENT-ON* */ clib_bihash_free_8_8 (&tsm->user_hash); - clib_bihash_init_8_8 (&tsm->user_hash, "users", snat_main.user_buckets, - snat_main.user_memory_size); + clib_bihash_init_8_8 (&tsm->user_hash, "users", snat_main.user_buckets, 0); clib_bihash_set_kvp_format_fn_8_8 (&tsm->user_hash, format_user_kvp); } |