From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 54FD14559B; Fri, 5 Jul 2024 19:46:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24D1942FCF; Fri, 5 Jul 2024 19:45:48 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 0FE0942FAD for ; Fri, 5 Jul 2024 19:45:33 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9067214BF; Fri, 5 Jul 2024 10:45:57 -0700 (PDT) Received: from ampere-altra-2-3.austin.arm.com (ampere-altra-2-3.austin.arm.com [10.118.14.97]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 771303F73B; Fri, 5 Jul 2024 10:45:32 -0700 (PDT) From: Yoan Picchi To: Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin Cc: dev@dpdk.org, nd@arm.com, Yoan Picchi Subject: [PATCH v11 3/7] hash: add a check on hash entry max size Date: Fri, 5 Jul 2024 17:45:22 +0000 Message-Id: <20240705174526.3035295-4-yoan.picchi@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240705174526.3035295-1-yoan.picchi@arm.com> References: <20231020165159.1649282-1-yoan.picchi@arm.com> <20240705174526.3035295-1-yoan.picchi@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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