39 #ifndef _RTE_CUCKOO_HASH_H_
40 #define _RTE_CUCKOO_HASH_H_
42 #if defined(RTE_ARCH_X86)
43 #include "rte_cmp_x86.h"
46 #if defined(RTE_ARCH_ARM64)
47 #include "rte_cmp_arm64.h"
51 #if defined(RTE_LIBRTE_HASH_DEBUG)
52 #define RETURN_IF_TRUE(cond, retval) do { \
57 #define RETURN_IF_TRUE(cond, retval)
61 #if defined(RTE_ARCH_X86) || defined(RTE_MACHINE_CPUFLAG_CRC32)
63 #define DEFAULT_HASH_FUNC rte_hash_crc
66 #define DEFAULT_HASH_FUNC rte_jhash
69 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
74 enum cmp_jump_table_case {
100 rte_hash_k112_cmp_eq,
101 rte_hash_k128_cmp_eq,
109 enum cmp_jump_table_case {
127 ADD_KEY_SINGLEWRITER = 0,
129 ADD_KEY_MULTIWRITER_TM,
133 #define RTE_HASH_BUCKET_ENTRIES 8
135 #define NULL_SIGNATURE 0
139 #define KEY_ALIGNMENT 16
141 #define LCORE_CACHE_SIZE 64
143 #define RTE_HASH_MAX_PUSHES 100
145 #define RTE_HASH_BFS_QUEUE_MAX_LEN 1000
147 #define RTE_XABORT_CUCKOO_PATH_INVALIDED 0x4
149 #define RTE_HASH_TSX_MAX_RETRY 10
153 void *objs[LCORE_CACHE_SIZE];
157 struct rte_hash_key {
164 } __attribute__((aligned(KEY_ALIGNMENT)));
167 enum rte_hash_sig_compare_function {
168 RTE_HASH_COMPARE_SCALAR = 0,
169 RTE_HASH_COMPARE_SSE,
170 RTE_HASH_COMPARE_AVX2,
176 hash_sig_t sig_current[RTE_HASH_BUCKET_ENTRIES];
178 uint32_t key_idx[RTE_HASH_BUCKET_ENTRIES];
182 uint8_t flag[RTE_HASH_BUCKET_ENTRIES];
227 struct queue_node *prev;
uint32_t(* rte_hash_function)(const void *key, uint32_t key_len, uint32_t init_val)
enum rte_hash_sig_compare_function sig_cmp_fn
uint32_t key_len __rte_cache_aligned
rte_hash_function hash_func
struct rte_mbuf __rte_cache_aligned
#define RTE_HASH_NAMESIZE
char name[RTE_HASH_NAMESIZE]
struct rte_ring * free_slots
rte_spinlock_t * multiwriter_lock
int(* rte_hash_cmp_eq_t)(const void *key1, const void *key2, size_t key_len)
struct lcore_cache * local_free_slots
uint8_t hw_trans_mem_support
rte_hash_cmp_eq_t rte_hash_custom_cmp_eq
uint32_t hash_func_init_val
enum add_key_case add_key
struct rte_hash_bucket * buckets
enum cmp_jump_table_case cmp_jump_table_idx