diff options
author | Matus Fabian <matfabia@cisco.com> | 2016-10-19 06:17:52 -0700 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2016-11-28 11:35:22 +0000 |
commit | 475f055305cf904b1c1c0436654f2f3e1c4f3358 (patch) | |
tree | 0f6a205f837377289eb369caf1f083fa5610d6f2 /plugins/snat-plugin/snat/snat.h | |
parent | a10f62b11e7a710fde628ae75fe5791e54caba0a (diff) |
snat: thread safe (VPP-443)
All traffic corresponding to a specific SANT user is handled by a CPU core.
in2out: Non-translated packets worker lookup by src address and VRF hash in
snat-in2out-worker-handoff node.
out2in: Translated packets worker lookup by dst address and port number hash in
snat-out2in-worker-handoff node.
Change-Id: Ia092a605689539469841d382588f3f486a29a769
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'plugins/snat-plugin/snat/snat.h')
-rw-r--r-- | plugins/snat-plugin/snat/snat.h | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/plugins/snat-plugin/snat/snat.h b/plugins/snat-plugin/snat/snat.h index ca10b76adce..cb31dc51423 100644 --- a/plugins/snat-plugin/snat/snat.h +++ b/plugins/snat-plugin/snat/snat.h @@ -132,6 +132,17 @@ typedef struct { } snat_interface_t; typedef struct { + /* User pool */ + snat_user_t * users; + + /* Session pool */ + snat_session_t * sessions; + + /* Pool of doubly-linked list elements */ + dlist_elt_t * list_pool; +} snat_main_per_thread_data_t; + +typedef struct { /* Main lookup tables */ clib_bihash_8_8_t out2in; clib_bihash_8_8_t in2out; @@ -139,18 +150,26 @@ typedef struct { /* Find-a-user => src address lookup */ clib_bihash_8_8_t user_hash; + /* Non-translated packets worker lookup => src address + VRF */ + clib_bihash_8_8_t worker_by_in; + + /* Translated packets worker lookup => IP address + port number */ + clib_bihash_8_8_t worker_by_out; + + u32 num_workers; + u32 first_worker_index; + u32 next_worker; + u32 * workers; + + /* Per thread data */ + snat_main_per_thread_data_t * per_thread_data; + /* Find a static mapping by local */ clib_bihash_8_8_t static_mapping_by_local; /* Find a static mapping by external */ clib_bihash_8_8_t static_mapping_by_external; - /* User pool */ - snat_user_t * users; - - /* Session pool */ - snat_session_t * sessions; - /* Static mapping pool */ snat_static_mapping_t * static_mappings; @@ -160,12 +179,13 @@ typedef struct { /* Vector of outside addresses */ snat_address_t * addresses; - /* Pool of doubly-linked list elements */ - dlist_elt_t * list_pool; - /* Randomize port allocation order */ u32 random_seed; + /* Worker handoff index */ + u32 fq_in2out_index; + u32 fq_out2in_index; + /* Config parameters */ u8 static_mapping_only; u8 static_mapping_connection_tracking; @@ -196,6 +216,8 @@ extern vlib_node_registration_t snat_in2out_node; extern vlib_node_registration_t snat_out2in_node; extern vlib_node_registration_t snat_in2out_fast_node; extern vlib_node_registration_t snat_out2in_fast_node; +extern vlib_node_registration_t snat_in2out_worker_handoff_node; +extern vlib_node_registration_t snat_out2in_worker_handoff_node; void snat_free_outside_address_and_port (snat_main_t * sm, snat_session_key_t * k, |