cnat: add ip/client bihash

This replace the cnat ip4/ip6 to client
lookups previously done with a regular
hash, by a bihash lookup.

Type: improvement

Do the client lookup in a bihash instead of
a hash.

Change-Id: I730c1893525c002b44ada8e290a36802835e88e9
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
This commit is contained in:
Nathan Skrzypczak
2021-06-04 18:37:27 +02:00
committed by Beno�t Ganne
parent 878a9f5706
commit 897844d1e9
4 changed files with 68 additions and 52 deletions
+9 -1
View File
@@ -36,12 +36,14 @@
#define CNAT_DEFAULT_SESSION_BUCKETS 1024
#define CNAT_DEFAULT_TRANSLATION_BUCKETS 1024
#define CNAT_DEFAULT_CLIENT_BUCKETS 1024
#define CNAT_DEFAULT_SNAT_BUCKETS 1024
#define CNAT_DEFAULT_SNAT_IF_MAP_LEN 4096
#define CNAT_DEFAULT_SESSION_MEMORY (1 << 20)
#define CNAT_DEFAULT_TRANSLATION_MEMORY (256 << 10)
#define CNAT_DEFAULT_SNAT_MEMORY (64 << 20)
#define CNAT_DEFAULT_CLIENT_MEMORY (256 << 10)
#define CNAT_DEFAULT_SNAT_MEMORY (64 << 10)
/* Should be prime >~ 100 * numBackends */
#define CNAT_DEFAULT_MAGLEV_LEN 1009
@@ -120,6 +122,12 @@ typedef struct cnat_main_
/* Number of buckets of the translation bihash */
u32 translation_hash_buckets;
/* Memory size of the client bihash */
uword client_hash_memory;
/* Number of buckets of the client bihash */
u32 client_hash_buckets;
/* Memory size of the source NAT prefix bihash */
uword snat_hash_memory;