summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2018-06-21 13:45:37 +0200
committerDave Barach <openvpp@barachs.net>2018-06-27 11:46:50 +0000
commit2d11e9f4b9e22f6da17fbe83b99e4ca9a5c0e507 (patch)
tree37def8d4d06296b0aee78a471484c8edf9501fe6
parent2e0798f90d9672b1c8dc702a2bdae485a6771ff8 (diff)
acl-plugin: tm: avoid hash calculation dependency on a memory store operation
A small store into a middle of a larger structure that was subsequently loaded for calculating the bihash key was noticeably impacting the performance. Change-Id: If7f33e1b66e8b438ba7cc91abc0ca749850c6e45 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
-rw-r--r--src/plugins/acl/public_inlines.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/acl/public_inlines.h b/src/plugins/acl/public_inlines.h
index ca4251903fa..576d081784c 100644
--- a/src/plugins/acl/public_inlines.h
+++ b/src/plugins/acl/public_inlines.h
@@ -605,7 +605,15 @@ multi_acl_match_get_applied_ace_index (acl_main_t * am, int is_ip6, fa_5tuple_t
*pkey++ = *pmatch++ & *pmask++;
*pkey++ = *pmatch++ & *pmask++;
- kv_key->pkt.mask_type_index_lsb = mask_type_index;
+ /*
+ * The use of temporary variable convinces the compiler
+ * to make a u64 write, avoiding the stall on crc32 operation
+ * just a bit later.
+ */
+ fa_packet_info_t tmp_pkt = kv_key->pkt;
+ tmp_pkt.mask_type_index_lsb = mask_type_index;
+ kv_key->pkt.as_u64 = tmp_pkt.as_u64;
+
int res =
clib_bihash_search_inline_2_48_8 (&am->acl_lookup_hash, &kv, &result);