summaryrefslogtreecommitdiffstats
path: root/src/plugins/cnat/cnat_client.c
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2020-11-04 11:41:05 +0100
committerBeno�t Ganne <bganne@cisco.com>2023-08-09 08:23:45 +0000
commit6d733a93b2eb9c16196ee17d5cdc77db21589571 (patch)
tree7e23016a4ceafedfe85974b58d56a4007780c52b /src/plugins/cnat/cnat_client.c
parent897844d1e96797f69e3e7e11d237d847fe4e46bf (diff)
cnat: remove rwlock on ts
Type: improvement Remove rwlock contention on timestamps. ~10% pps with 10k sessions. Use fixed-size-pools of increasing sizes starting with 4K, and with a x2 step each time. We don't free/shrink allocated pools. Change-Id: I5fea51faba40430106c823275a6356e81709d118 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/cnat/cnat_client.c')
-rw-r--r--src/plugins/cnat/cnat_client.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/cnat/cnat_client.c b/src/plugins/cnat/cnat_client.c
index 73835b093f0..5f0590efbf8 100644
--- a/src/plugins/cnat/cnat_client.c
+++ b/src/plugins/cnat/cnat_client.c
@@ -20,10 +20,9 @@
#include <cnat/cnat_translation.h>
cnat_client_t *cnat_client_pool;
-
cnat_client_db_t cnat_client_db;
-
dpo_type_t cnat_client_dpo;
+fib_source_t cnat_fib_source;
static_always_inline u8
cnat_client_is_clone (cnat_client_t * cc)
@@ -302,7 +301,6 @@ cnat_client_show (vlib_main_t * vm,
vlib_cli_output(vm, "%U", format_cnat_client, cci, 0);
vlib_cli_output (vm, "%d clients", pool_elts (cnat_client_pool));
- vlib_cli_output (vm, "%d timestamps", pool_elts (cnat_timestamps));
}
else
{
@@ -389,6 +387,9 @@ cnat_client_init (vlib_main_t * vm)
clib_bihash_init_16_8 (&cnat_client_db.cc_ip_id_hash, "CNat client DB",
cm->client_hash_buckets, cm->client_hash_memory);
+ cnat_fib_source = fib_source_allocate ("cnat", CNAT_FIB_SOURCE_PRIORITY,
+ FIB_SOURCE_BH_SIMPLE);
+
clib_spinlock_init (&cnat_client_db.throttle_lock);
cnat_client_db.throttle_mem =
hash_create_mem (0, sizeof (ip_address_t), sizeof (uword));