xref: /dpdk/lib/table/rte_table_hash_cuckoo.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4 
5 #ifndef __INCLUDE_RTE_TABLE_HASH_CUCKOO_H__
6 #define __INCLUDE_RTE_TABLE_HASH_CUCKOO_H__
7 
8 /**
9  * @file
10  * RTE Table Hash Cuckoo
11  */
12 
13 #include <stdint.h>
14 
15 #include <rte_hash.h>
16 
17 #include "rte_table.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /** Hash table parameters */
24 struct rte_table_hash_cuckoo_params {
25 	/** Name */
26 	const char *name;
27 
28 	/** Key size (number of bytes) */
29 	uint32_t key_size;
30 
31 	/** Byte offset within packet meta-data where the key is located */
32 	uint32_t key_offset;
33 
34 	/** Key mask */
35 	uint8_t *key_mask;
36 
37 	/** Number of keys */
38 	uint32_t n_keys;
39 
40 	/** Number of buckets */
41 	uint32_t n_buckets;
42 
43 	/** Hash function */
44 	rte_hash_function f_hash;
45 
46 	/** Seed value for the hash function */
47 	uint32_t seed;
48 };
49 
50 /** Cuckoo hash table operations */
51 extern struct rte_table_ops rte_table_hash_cuckoo_ops;
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif
58