diff options
author | Klement Sekera <ksekera@cisco.com> | 2020-02-20 11:40:50 +0000 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2020-04-07 22:11:07 +0000 |
commit | 85bee7548bc5a360851d92807dae6d4159b68314 (patch) | |
tree | 494d7cf81d34b95b97770a52f277152e3428037f /src/plugins/nat/nat.h | |
parent | b1bb513792fecd735effebbd07d867ea93adc9f6 (diff) |
nat: ED: port re-use algorithm
Type: fix
Change-Id: I11440c855eb35d2a6095dfe135e4ab5090f11ff3
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat.h')
-rw-r--r-- | src/plugins/nat/nat.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/plugins/nat/nat.h b/src/plugins/nat/nat.h index fde6a0a7308..46dc040c574 100644 --- a/src/plugins/nat/nat.h +++ b/src/plugins/nat/nat.h @@ -31,6 +31,7 @@ #include <vppinfra/error.h> #include <vlibapi/api.h> #include <vlib/log.h> +#include <vppinfra/bihash_16_8.h> /* default session timeouts */ #define SNAT_UDP_TIMEOUT 300 @@ -368,7 +369,7 @@ typedef struct #define _(N, i, n, s) \ u16 busy_##n##_ports; \ u16 * busy_##n##_ports_per_thread; \ - uword * busy_##n##_port_bitmap; + u32 busy_##n##_port_refcounts[65535]; foreach_snat_protocol #undef _ /* *INDENT-ON* */ @@ -567,6 +568,28 @@ typedef int (nat_alloc_out_addr_and_port_function_t) (snat_address_t * u16 port_per_thread, u32 snat_thread_index); +typedef struct ed_bihash_key_s +{ + u32 src_address; + u32 dst_address; + u16 src_port; + u16 dst_port; + u8 protocol; +} ed_bihash_key_t; + +typedef struct ed_bihash_kv_s +{ + union + { + ed_bihash_key_t k; + clib_bihash_kv_16_8_t kv; + }; +} ed_bihash_kv_t; + +STATIC_ASSERT (STRUCT_SIZE_OF (ed_bihash_kv_t, k) <= + STRUCT_SIZE_OF (ed_bihash_kv_t, kv.key), + "ed key needs to fit in bihash key"); + typedef struct snat_main_s { /* ICMP session match functions */ @@ -723,6 +746,7 @@ typedef struct snat_main_s ip_lookup_main_t *ip4_lookup_main; api_main_t *api_main; + clib_bihash_16_8_t ed_ext_ports; } snat_main_t; typedef struct |