summaryrefslogtreecommitdiffstats
path: root/src/plugins/acl/public_inlines.h
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2018-05-26 19:02:34 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2018-05-27 09:25:33 +0000
commite64386ec4b307c5fbb623a8cd3e060c235a245ad (patch)
tree90679c16145680fdbcd2d7c19fc4ab55f6c73ef4 /src/plugins/acl/public_inlines.h
parent525c9d0f8645ef9901316f042c195adc970b4546 (diff)
acl-plugin: use clib_bihash_search_inline_2_40_8 rather than clib_bihash_search_40_8 for session lookups
Use inline version rather than calling the function, this gives slightly better performance. The straighforward diff uncovered an interesting problem: the stateful ACL IPv4 unit tests would fail for the "make test" but succeed in "make test-debug". Also, they would succeed even in "make test", if before calling the clib_bihash_search_inline_2_40_8 we would change the code to store the key in a temporary variable. Debugging revealed that the generated optimized code is not what one would expect: the zeroing of the u64s overlaying the memcpy into ipv4 value of ip46_address_t made the optimizer not notice the latter, and think that those fields should be always zero in the bihash, thus generating incorrect assembly for the bihash key comparison for the ipv4 nodes. Changing the zeroing to be non-overlapping by zeroing only the pad fields resulted in the optimizer generating the correct code and the tests pass. Change-Id: Ib0f55cef2b5fe70c931d17ca4dc32a5755d160cd Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/plugins/acl/public_inlines.h')
-rw-r--r--src/plugins/acl/public_inlines.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/plugins/acl/public_inlines.h b/src/plugins/acl/public_inlines.h
index 3e6c95ad6d9..e7b085271f6 100644
--- a/src/plugins/acl/public_inlines.h
+++ b/src/plugins/acl/public_inlines.h
@@ -270,10 +270,8 @@ acl_fill_5tuple (acl_main_t * am, vlib_buffer_t * b0, int is_ip6,
}
else
{
- p5tuple_pkt->kv.key[0] = 0;
- p5tuple_pkt->kv.key[1] = 0;
- p5tuple_pkt->kv.key[2] = 0;
- p5tuple_pkt->kv.key[3] = 0;
+ ip46_address_mask_ip4(&p5tuple_pkt->addr[0]);
+ ip46_address_mask_ip4(&p5tuple_pkt->addr[1]);
clib_memcpy (&p5tuple_pkt->addr[0].ip4,
get_ptr_to_offset (b0,
offsetof (ip4_header_t,