diff options
author | Matus Fabian <matfabia@cisco.com> | 2017-09-26 01:23:01 -0700 |
---|---|---|
committer | Matus Fabian <matfabia@cisco.com> | 2017-09-26 01:29:05 -0700 |
commit | 7865b5c8a4f11731d8c6d4627e505afe990989b4 (patch) | |
tree | c03b34d36ab0545ef84ebd9d21f692b06a90b0b0 /src/plugins/nat/nat_api.c | |
parent | 51d2651e4aceff4016228c669480437eac84f221 (diff) |
NAT: remove worker_by_in lookup hash table (VPP-992)
Change-Id: I3873d3e411bf93cac82e73a0b8e3b22563aaf217
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat_api.c')
-rw-r--r-- | src/plugins/nat/nat_api.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c index 50b4a9ae8e1..b56b4436adc 100644 --- a/src/plugins/nat/nat_api.c +++ b/src/plugins/nat/nat_api.c @@ -856,6 +856,7 @@ static void snat_user_t *u; u32 session_index, head_index, elt_index; dlist_elt_t *head, *elt; + ip4_header_t ip; q = vl_api_client_index_to_input_queue (mp->client_index); if (q == 0) @@ -864,10 +865,13 @@ static void return; clib_memcpy (&ukey.addr, mp->ip_address, 4); + ip.src_address.as_u32 = ukey.addr.as_u32; ukey.fib_index = fib_table_find (FIB_PROTOCOL_IP4, ntohl (mp->vrf_id)); key.key = ukey.as_u64; - if (!clib_bihash_search_8_8 (&sm->worker_by_in, &key, &value)) - tsm = vec_elt_at_index (sm->per_thread_data, value.value); + if (sm->num_workers) + tsm = + vec_elt_at_index (sm->per_thread_data, + sm->worker_in2out_cb (&ip, ukey.fib_index)); else tsm = vec_elt_at_index (sm->per_thread_data, sm->num_workers); if (clib_bihash_search_8_8 (&tsm->user_hash, &key, &value)) @@ -2093,16 +2097,20 @@ vl_api_nat44_user_session_dump_t_handler (vl_api_nat44_user_session_dump_t * snat_user_t *u; u32 session_index, head_index, elt_index; dlist_elt_t *head, *elt; + ip4_header_t ip; q = vl_api_client_index_to_input_queue (mp->client_index); if (q == 0) return; clib_memcpy (&ukey.addr, mp->ip_address, 4); + ip.src_address.as_u32 = ukey.addr.as_u32; ukey.fib_index = fib_table_find (FIB_PROTOCOL_IP4, ntohl (mp->vrf_id)); key.key = ukey.as_u64; - if (!clib_bihash_search_8_8 (&sm->worker_by_in, &key, &value)) - tsm = vec_elt_at_index (sm->per_thread_data, value.value); + if (sm->num_workers) + tsm = + vec_elt_at_index (sm->per_thread_data, + sm->worker_in2out_cb (&ip, ukey.fib_index)); else tsm = vec_elt_at_index (sm->per_thread_data, sm->num_workers); if (clib_bihash_search_8_8 (&tsm->user_hash, &key, &value)) |