Skip to content

Commit

Permalink
table: remove experimental CRC API for some arches
Browse files Browse the repository at this point in the history
x86 and ARM architectures provide a non-experimental implementation for
rte_crc32_u64().
Experimental API rte_crc32_u64_generic() was only exported for other
arches.

Leaving this API exposed could result in portability issues: an
application using rte_crc32_u64_generic() would not compile on x86 or
ARM.

Move this symbol code in the only caller of the table library, and
remove this symbol.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
david-marchand authored and ovsrobot committed Mar 22, 2024
1 parent 0219d46 commit dc37242
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions lib/table/rte_table_hash_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,6 @@ extern "C" {
#include <rte_compat.h>
#include <rte_common.h>

__rte_experimental
static inline uint64_t
rte_crc32_u64_generic(uint64_t crc, uint64_t value)
{
int i;

crc = (crc & 0xFFFFFFFFLLU) ^ value;
for (i = 63; i >= 0; i--) {
uint64_t mask;

mask = -(crc & 1LLU);
crc = (crc >> 1LLU) ^ (0x82F63B78LLU & mask);
}

return crc;
}

#if defined(RTE_ARCH_X86_64)

#include <x86intrin.h>
Expand All @@ -48,7 +31,17 @@ rte_crc32_u64(uint64_t crc, uint64_t v)
static inline uint64_t
rte_crc32_u64(uint64_t crc, uint64_t v)
{
return rte_crc32_u64_generic(crc, v);
int i;

crc = (crc & 0xFFFFFFFFLLU) ^ v;
for (i = 63; i >= 0; i--) {
uint64_t mask;

mask = -(crc & 1LLU);
crc = (crc >> 1LLU) ^ (0x82F63B78LLU & mask);
}

return crc;
}

#endif
Expand Down

0 comments on commit dc37242

Please sign in to comment.