[PATCH v11 3/7] hash: add a check on hash entry max size
Yoan Picchi
yoan.picchi at arm.com
Fri Jul 5 19:45:22 CEST 2024
If were to change RTE_HASH_BUCKET_ENTRIES to be over 8, it would no longer
fit in the vector (8*16b=128b), therefore failing to check some of the
signatures. This patch adds a compile time check to fallback to scalar
code in this case.
Signed-off-by: Yoan Picchi <yoan.picchi at arm.com>
---
lib/hash/compare_signatures_arm_pvt.h | 2 +-
lib/hash/compare_signatures_x86_pvt.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/hash/compare_signatures_arm_pvt.h b/lib/hash/compare_signatures_arm_pvt.h
index 80b6afb7a5..74b3286c95 100644
--- a/lib/hash/compare_signatures_arm_pvt.h
+++ b/lib/hash/compare_signatures_arm_pvt.h
@@ -23,7 +23,7 @@ compare_signatures(uint32_t *prim_hash_matches, uint32_t *sec_hash_matches,
/* For match mask the first bit of every two bits indicates the match */
switch (sig_cmp_fn) {
-#if defined(__ARM_NEON)
+#if defined(__ARM_NEON) && RTE_HASH_BUCKET_ENTRIES <= 8
case RTE_HASH_COMPARE_NEON: {
uint16x8_t vmat, vsig, x;
int16x8_t shift = {-15, -13, -11, -9, -7, -5, -3, -1};
diff --git a/lib/hash/compare_signatures_x86_pvt.h b/lib/hash/compare_signatures_x86_pvt.h
index 11a82aced9..f77b37f1cd 100644
--- a/lib/hash/compare_signatures_x86_pvt.h
+++ b/lib/hash/compare_signatures_x86_pvt.h
@@ -23,7 +23,7 @@ compare_signatures(uint32_t *prim_hash_matches, uint32_t *sec_hash_matches,
/* For match mask the first bit of every two bits indicates the match */
switch (sig_cmp_fn) {
-#if defined(__SSE2__)
+#if defined(__SSE2__) && RTE_HASH_BUCKET_ENTRIES <= 8
case RTE_HASH_COMPARE_SSE:
/* Compare all signatures in the bucket */
*prim_hash_matches = _mm_movemask_epi8(_mm_cmpeq_epi16(_mm_load_si128(
--
2.34.1
More information about the dev
mailing list