summaryrefslogtreecommitdiffstats
path: root/src/plugins/snat/snat.h
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-08-03 00:58:05 -0700
committerNeale Ranns <nranns@cisco.com>2017-08-04 08:21:27 +0000
commit7801ca29b8f1b3a7b2ff68f3f84a0ae02a58b563 (patch)
treedc50748b1e03a0ae93f2214baa7ca98d5e6064fa /src/plugins/snat/snat.h
parent33129bb9a3e954b7c9ba7a72f16550b1cf91dc9e (diff)
SNAT: fix address and port allocation for multiple worker threads (VPP-925)
There is a chance to allocate the same outside address and port. Assign a block of port numbers to each worker. Change-Id: I6ef7dc0aab4834705f4e6097c362940d18d747e8 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/snat/snat.h')
-rw-r--r--src/plugins/snat/snat.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/snat/snat.h b/src/plugins/snat/snat.h
index 61ed52f61e2..aa0f82fc9df 100644
--- a/src/plugins/snat/snat.h
+++ b/src/plugins/snat/snat.h
@@ -241,6 +241,8 @@ typedef struct {
/* Pool of doubly-linked list elements */
dlist_elt_t * list_pool;
+
+ u32 snat_thread_index;
} snat_main_per_thread_data_t;
struct snat_main_s;
@@ -284,6 +286,8 @@ typedef struct snat_main_s {
u32 * workers;
snat_get_worker_function_t * worker_in2out_cb;
snat_get_worker_function_t * worker_out2in_cb;
+ u16 port_per_thread;
+ u32 num_snat_thread;
/* Per thread data */
snat_main_per_thread_data_t * per_thread_data;
@@ -374,12 +378,13 @@ extern vlib_node_registration_t snat_det_out2in_node;
extern vlib_node_registration_t snat_hairpin_dst_node;
extern vlib_node_registration_t snat_hairpin_src_node;
-void snat_free_outside_address_and_port (snat_main_t * sm,
- snat_session_key_t * k,
+void snat_free_outside_address_and_port (snat_main_t * sm,
+ snat_session_key_t * k,
u32 address_index);
-int snat_alloc_outside_address_and_port (snat_main_t * sm,
+int snat_alloc_outside_address_and_port (snat_main_t * sm,
u32 fib_index,
+ u32 thread_index,
snat_session_key_t * k,
u32 * address_indexp);