diff options
author | Benoît Ganne <bganne@cisco.com> | 2022-06-08 10:49:17 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2022-06-29 21:23:38 +0000 |
commit | b03eec969f3db186fc354c3e885e51c0b24803f0 (patch) | |
tree | 54871a6dc00bad0644f75755d616f10ad67de6c2 /src/vnet/l2/l2_output_classify.c | |
parent | b0057282d64a4f9ac5966fceb427057b0665b772 (diff) |
classify: use 32 bits hash
classify hash used to be stored as u64 in buffer metadata, use 32 bits
instead:
- on almost all our supported arch (x86 and arm64) we use crc32c
intrinsics to compute the final hash: we really get a 32-bits hash
- the hash itself is used to compute a 32-bits bucket index by masking
upper bits: we always discard the higher 32-bits
- this allows to increase the l2 classify buffer metadata padding such
as it does not overlap with the ip fib_index metadata anymore. This
overlap is an issue when using the 'set metadata' action in the ip
ACL node which updates both fields
Type: fix
Change-Id: I5d35bdae97b96c3cae534e859b63950fb500ff50
Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet/l2/l2_output_classify.c')
-rw-r--r-- | src/vnet/l2/l2_output_classify.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/vnet/l2/l2_output_classify.c b/src/vnet/l2/l2_output_classify.c index 96d0b14753a..97beb37f351 100644 --- a/src/vnet/l2/l2_output_classify.c +++ b/src/vnet/l2/l2_output_classify.c @@ -172,8 +172,7 @@ VLIB_NODE_FN (l2_output_classify_node) (vlib_main_t * vm, int type_index0, type_index1; vnet_classify_table_t *t0, *t1; u32 table_index0, table_index1; - u64 hash0, hash1; - + u32 hash0, hash1; /* prefetch next iteration */ { @@ -257,7 +256,7 @@ VLIB_NODE_FN (l2_output_classify_node) (vlib_main_t * vm, u32 type_index0; vnet_classify_table_t *t0; u32 table_index0; - u64 hash0; + u32 hash0; bi0 = from[0]; b0 = vlib_get_buffer (vm, bi0); @@ -308,14 +307,14 @@ VLIB_NODE_FN (l2_output_classify_node) (vlib_main_t * vm, u32 next0 = ~0; ethernet_header_t *h0; u32 table_index0; - u64 hash0; + u32 hash0; vnet_classify_table_t *t0; vnet_classify_entry_t *e0; if (PREDICT_TRUE (n_left_from > 2)) { vlib_buffer_t *p2 = vlib_get_buffer (vm, from[2]); - u64 phash2; + u32 phash2; u32 table_index2; vnet_classify_table_t *tp2; |