New upstream version 18.08
[deb_dpdk.git] / lib / librte_table / rte_table_hash_cuckoo.h
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 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 /**
13  * @file
14  * RTE Table Hash Cuckoo
15  *
16  ***/
17 #include <stdint.h>
18
19 #include <rte_hash.h>
20
21 #include "rte_table.h"
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