From 770178e365b5c37ecdecfecb424003cca7343ede Mon Sep 17 00:00:00 2001 From: Klement Sekera Date: Fri, 17 Apr 2020 18:42:28 +0000 Subject: nat: improve perf - long read after short write Type: improvement Signed-off-by: Klement Sekera Change-Id: Idbbad246161d28f595c25e10d7282c8b33fa9876 --- src/plugins/nat/nat44_hairpinning.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/plugins/nat/nat44_hairpinning.c') 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); -- cgit 1.2.3-korg