summaryrefslogtreecommitdiffstats
path: root/lib/librte_table/rte_table_hash_cuckoo.h
blob: d9d43121903d6f88a8ffad422347e14db1886ea2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2018 Intel Corporation
 */

#ifndef __INCLUDE_RTE_TABLE_HASH_CUCKOO_H__
#define __INCLUDE_RTE_TABLE_HASH_CUCKOO_H__

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file
 * RTE Table Hash Cuckoo
 *
 ***/
#include <stdint.h>

#include <rte_hash.h>

#include "rte_table.h"

/** Hash table parameters */
struct rte_table_hash_cuckoo_params {
	/** Name */
	const char *name;

	/** Key size (number of bytes) */
	uint32_t key_size;

	/** Byte offset within packet meta-data where the key is located */
	uint32_t key_offset;

	/** Key mask */
	uint8_t *key_mask;

	/** Number of keys */
	uint32_t n_keys;

	/** Number of buckets */
	uint32_t n_buckets;

	/** Hash function */
	rte_hash_function f_hash;

	/** Seed value for the hash function */
	uint32_t seed;
};

/** Cuckoo hash table operations */
extern struct rte_table_ops rte_table_hash_cuckoo_ops;

#ifdef __cplusplus
}
#endif

#endif