sizeof(*ht) + (sizeof(ht->t[0]) * params->entries);
uint32_t i;
struct rte_fbk_hash_list *fbk_hash_list;
+ rte_fbk_hash_fn default_hash_func = (rte_fbk_hash_fn)rte_jhash_1word;
fbk_hash_list = RTE_TAILQ_CAST(rte_fbk_hash_tailq.head,
rte_fbk_hash_list);
goto exit;
}
+ /* Default hash function */
+#if defined(RTE_ARCH_X86)
+ default_hash_func = (rte_fbk_hash_fn)rte_hash_crc_4byte;
+#elif defined(RTE_ARCH_ARM64)
+ if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_CRC32))
+ default_hash_func = (rte_fbk_hash_fn)rte_hash_crc_4byte;
+#endif
+
/* Set up hash table context. */
snprintf(ht->name, sizeof(ht->name), "%s", params->name);
ht->entries = params->entries;
ht->init_val = params->init_val;
}
else {
- ht->hash_func = RTE_FBK_HASH_FUNC_DEFAULT;
+ ht->hash_func = default_hash_func;
ht->init_val = RTE_FBK_HASH_INIT_VAL_DEFAULT;
}
#include <string.h>
#include <rte_config.h>
-#ifndef RTE_FBK_HASH_FUNC_DEFAULT
-#if defined(RTE_ARCH_X86) || defined(RTE_MACHINE_CPUFLAG_CRC32)
#include <rte_hash_crc.h>
-/** Default four-byte key hash function if none is specified. */
-#define RTE_FBK_HASH_FUNC_DEFAULT rte_hash_crc_4byte
-#else
#include <rte_jhash.h>
-#define RTE_FBK_HASH_FUNC_DEFAULT rte_jhash_1word
-#endif
-#endif
#ifndef RTE_FBK_HASH_INIT_VAL_DEFAULT
/** Initialising value used when calculating hash. */