acl-plugin: use clib_bihash_search_inline_2_40_8 rather than clib_bihash_search_40_8... 55/12755/2
authorAndrew Yourtchenko <ayourtch@gmail.com>
Sat, 26 May 2018 17:02:34 +0000 (19:02 +0200)
committerDamjan Marion <dmarion.lists@gmail.com>
Sun, 27 May 2018 09:25:33 +0000 (09:25 +0000)
commite64386ec4b307c5fbb623a8cd3e060c235a245ad
tree90679c16145680fdbcd2d7c19fc4ab55f6c73ef4
parent525c9d0f8645ef9901316f042c195adc970b4546
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>
src/plugins/acl/public_inlines.h
src/plugins/acl/session_inlines.h