aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat_reass.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-12-07 23:22:51 -0800
committerOle Trøan <otroan@employees.org>2017-12-13 14:15:35 +0000
commit51e759fd0655b6089360e1ccf2f5341704549fd4 (patch)
tree125a66214683c3aae9b1ddec253ef7910b3e38d8 /src/plugins/nat/nat_reass.c
parent331acc632477ed2da1c9c0b90915a227b5e343d5 (diff)
NAT64: multi-thread support (VPP-891)
Change-Id: Iebf859b6d86482e4465423bad598eecf87e53ec4 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat_reass.c')
-rw-r--r--src/plugins/nat/nat_reass.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/nat/nat_reass.c b/src/plugins/nat/nat_reass.c
index 239bc70d836..a97d8f017e9 100644
--- a/src/plugins/nat/nat_reass.c
+++ b/src/plugins/nat/nat_reass.c
@@ -195,6 +195,27 @@ nat_ip4_reass_lookup (nat_reass_ip4_key_t * k, f64 now)
}
nat_reass_ip4_t *
+nat_ip4_reass_find (ip4_address_t src, ip4_address_t dst, u16 frag_id,
+ u8 proto)
+{
+ nat_reass_main_t *srm = &nat_reass_main;
+ nat_reass_ip4_t *reass = 0;
+ nat_reass_ip4_key_t k;
+ f64 now = vlib_time_now (srm->vlib_main);
+
+ k.src.as_u32 = src.as_u32;
+ k.dst.as_u32 = dst.as_u32;
+ k.frag_id = frag_id;
+ k.proto = proto;
+
+ clib_spinlock_lock_if_init (&srm->ip4_reass_lock);
+ reass = nat_ip4_reass_lookup (&k, now);
+ clib_spinlock_unlock_if_init (&srm->ip4_reass_lock);
+
+ return reass;
+}
+
+nat_reass_ip4_t *
nat_ip4_reass_find_or_create (ip4_address_t src, ip4_address_t dst,
u16 frag_id, u8 proto, u8 reset_timeout,
u32 ** bi_to_drop)
@@ -282,6 +303,7 @@ nat_ip4_reass_find_or_create (ip4_address_t src, ip4_address_t dst,
reass->key.as_u64[1] = kv.key[1] = k.as_u64[1];
kv.value = reass - srm->ip4_reass_pool;
reass->sess_index = (u32) ~ 0;
+ reass->thread_index = (u32) ~ 0;
reass->last_heard = now;
if (clib_bihash_add_del_16_8 (&srm->ip4_reass_hash, &kv, 1))