aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44_hairpinning.c
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2020-04-17 18:42:28 +0000
committerOle Trøan <otroan@employees.org>2020-04-27 08:21:53 +0000
commit770178e365b5c37ecdecfecb424003cca7343ede (patch)
treeaf15bdeb8d44f50e76d4187933bf956f7eff217d /src/plugins/nat/nat44_hairpinning.c
parente65eea360c394429320a45d695ee4d770673b3d4 (diff)
nat: improve perf - long read after short write
Type: improvement Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: Idbbad246161d28f595c25e10d7282c8b33fa9876
Diffstat (limited to 'src/plugins/nat/nat44_hairpinning.c')
-rw-r--r--src/plugins/nat/nat44_hairpinning.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/plugins/nat/nat44_hairpinning.c b/src/plugins/nat/nat44_hairpinning.c
index c0b84127741..bdf9e3ce813 100644
--- a/src/plugins/nat/nat44_hairpinning.c
+++ b/src/plugins/nat/nat44_hairpinning.c
@@ -126,9 +126,9 @@ snat_hairpinning (snat_main_t * sm,
if (is_ed)
{
clib_bihash_kv_16_8_t ed_kv, ed_value;
- make_ed_kv (&ed_kv, &ip0->dst_address, &ip0->src_address,
+ make_ed_kv (&ip0->dst_address, &ip0->src_address,
ip0->protocol, sm->outside_fib_index, udp0->dst_port,
- udp0->src_port);
+ udp0->src_port, ~0ULL, &ed_kv);
rv = clib_bihash_search_16_8 (&sm->per_thread_data[ti].out2in_ed,
&ed_kv, &ed_value);
si = ed_value.value;
@@ -226,11 +226,12 @@ snat_icmp_hairpinning (snat_main_t * sm,
if (is_ed)
{
clib_bihash_kv_16_8_t ed_kv, ed_value;
- make_ed_kv (&ed_kv, &ip0->dst_address, &ip0->src_address,
+ make_ed_kv (&ip0->dst_address, &ip0->src_address,
inner_ip0->protocol, sm->outside_fib_index,
- l4_header->src_port, l4_header->dst_port);
- if (clib_bihash_search_16_8 (&sm->per_thread_data[ti].out2in_ed,
- &ed_kv, &ed_value))
+ l4_header->src_port, l4_header->dst_port, ~0ULL,
+ &ed_kv);
+ if (clib_bihash_search_16_8
+ (&sm->per_thread_data[ti].out2in_ed, &ed_kv, &ed_value))
return 1;
si = ed_value.value;
}
@@ -397,8 +398,8 @@ nat44_ed_hairpinning_unknown_proto (snat_main_t * sm,
tsm = &sm->per_thread_data[ti];
old_addr = ip->dst_address.as_u32;
- make_ed_kv (&s_kv, &ip->dst_address, &ip->src_address, ip->protocol,
- sm->outside_fib_index, 0, 0);
+ make_ed_kv (&ip->dst_address, &ip->src_address, ip->protocol,
+ sm->outside_fib_index, 0, 0, ~0ULL, &s_kv);
if (clib_bihash_search_16_8 (&tsm->out2in_ed, &s_kv, &s_value))
{
make_sm_kv (&kv, &ip->dst_address, 0, 0, 0);