The AVX implementation for calcualting checksum was not
handling carry-over addition correctly in some cases.
This patch adds an additional shuffle to add 16-bit padding
to the final part of the calculation to handle such cases.

Fixes: 92eb03f7b03a ("odp-execute: Add ISA implementation of set_masked IPv4 
action")
Signed-off-by: Emma Finn <[email protected]>
Reported-by: Eelco Chaudron <[email protected]>
---
 lib/odp-execute-avx512.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/odp-execute-avx512.c b/lib/odp-execute-avx512.c
index 50c48bfd4..911fdd3ea 100644
--- a/lib/odp-execute-avx512.c
+++ b/lib/odp-execute-avx512.c
@@ -366,6 +366,8 @@ avx512_get_delta(__m256i old_header, __m256i new_header)
                                           0xF, 0xF, 0xF, 0xF);
     v_delta = _mm256_permutexvar_epi32(v_swap32a, v_delta);
 
+    v_delta = _mm256_hadd_epi32(v_delta, v_zeros);
+    v_delta = _mm256_shuffle_epi8(v_delta, v_swap16a);
     v_delta = _mm256_hadd_epi32(v_delta, v_zeros);
     v_delta = _mm256_hadd_epi16(v_delta, v_zeros);
 
-- 
2.25.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to