diff options
author | lijinhui <lijh_7@chinatelecom.cn> | 2022-08-15 17:41:39 +0800 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2023-03-06 14:20:27 +0000 |
commit | e13baaa788d852d97e982057f864c839948517d4 (patch) | |
tree | 57c32e70589c4c9aea8c4f9010a93b5c77f3a392 | |
parent | af62f93478e760b675bba7aba06b30efd63d12b4 (diff) |
interface: fix 4 or more interfaces equality comparison bug with xor operation using (a^a)^(b^b)
Type: fix
Signed-off-by: lijinhui <lijh_7@chinatelecom.cn>
Change-Id: I80783eed2b819a9e6fd4cee973821c9d97c285a6
-rw-r--r-- | src/vnet/ethernet/interface.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/vnet/ethernet/interface.c b/src/vnet/ethernet/interface.c index 46d4203cda1..bf2256630f0 100644 --- a/src/vnet/ethernet/interface.c +++ b/src/vnet/ethernet/interface.c @@ -527,7 +527,7 @@ simulated_ethernet_interface_tx (vlib_main_t * vm, while (n_left_from >= 4) { u32 sw_if_index0, sw_if_index1, sw_if_index2, sw_if_index3; - u32 not_all_match_config; + u32x4 xor_ifx4; /* Prefetch next iteration. */ if (PREDICT_TRUE (n_left_from >= 8)) @@ -544,12 +544,11 @@ simulated_ethernet_interface_tx (vlib_main_t * vm, sw_if_index2 = vnet_buffer (b[2])->sw_if_index[VLIB_TX]; sw_if_index3 = vnet_buffer (b[3])->sw_if_index[VLIB_TX]; - not_all_match_config = (sw_if_index0 ^ sw_if_index1) - ^ (sw_if_index2 ^ sw_if_index3); - not_all_match_config += sw_if_index0 ^ new_rx_sw_if_index; + xor_ifx4 = u32x4_gather (&sw_if_index0, &sw_if_index1, &sw_if_index2, + &sw_if_index3); /* Speed path / expected case: all pkts on the same intfc */ - if (PREDICT_TRUE (not_all_match_config == 0)) + if (PREDICT_TRUE (u32x4_is_all_equal (xor_ifx4, new_rx_sw_if_index))) { next[0] = next_index; next[1] = next_index; |