DPDK 22.11.4
rte_hash.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2015 Intel Corporation
3 */
4
5#ifndef _RTE_HASH_H_
6#define _RTE_HASH_H_
7
14#include <stdint.h>
15#include <stddef.h>
16
17#include <rte_rcu_qsbr.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
24#define RTE_HASH_ENTRIES_MAX (1 << 30)
25
27#define RTE_HASH_NAMESIZE 32
28
30#define RTE_HASH_LOOKUP_BULK_MAX 64
31#define RTE_HASH_LOOKUP_MULTI_MAX RTE_HASH_LOOKUP_BULK_MAX
32
34#define RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT 0x01
35
37#define RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD 0x02
38
40#define RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY 0x04
41
43#define RTE_HASH_EXTRA_FLAGS_EXT_TABLE 0x08
44
51#define RTE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL 0x10
52
56#define RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF 0x20
57
62typedef uint32_t hash_sig_t;
63
65typedef uint32_t (*rte_hash_function)(const void *key, uint32_t key_len,
66 uint32_t init_val);
67
69typedef int (*rte_hash_cmp_eq_t)(const void *key1, const void *key2, size_t key_len);
70
76typedef void (*rte_hash_free_key_data)(void *p, void *key_data);
77
82 const char *name;
83 uint32_t entries;
84 uint32_t reserved;
85 uint32_t key_len;
89 uint8_t extra_flag;
90};
91
98};
99
102 struct rte_rcu_qsbr *v;
107 uint32_t dq_size;
123};
124
126struct rte_hash;
127
145struct rte_hash *
147
160
171struct rte_hash *
173
181void
183
194void
196
205int32_t
206rte_hash_count(const struct rte_hash *h);
207
218int32_t
220
244int
245rte_hash_add_key_data(const struct rte_hash *h, const void *key, void *data);
246
273int32_t
274rte_hash_add_key_with_hash_data(const struct rte_hash *h, const void *key,
275 hash_sig_t sig, void *data);
276
295int32_t
296rte_hash_add_key(const struct rte_hash *h, const void *key);
297
319int32_t
320rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key, hash_sig_t sig);
321
349int32_t
350rte_hash_del_key(const struct rte_hash *h, const void *key);
351
381int32_t
382rte_hash_del_key_with_hash(const struct rte_hash *h, const void *key, hash_sig_t sig);
383
401int
402rte_hash_get_key_with_position(const struct rte_hash *h, const int32_t position,
403 void **key);
404
427int
429 const int32_t position);
430
450int
451rte_hash_lookup_data(const struct rte_hash *h, const void *key, void **data);
452
475int
476rte_hash_lookup_with_hash_data(const struct rte_hash *h, const void *key,
477 hash_sig_t sig, void **data);
478
496int32_t
497rte_hash_lookup(const struct rte_hash *h, const void *key);
498
518int32_t
520 const void *key, hash_sig_t sig);
521
534rte_hash_hash(const struct rte_hash *h, const void *key);
535
555int
556rte_hash_lookup_bulk_data(const struct rte_hash *h, const void **keys,
557 uint32_t num_keys, uint64_t *hit_mask, void *data[]);
558
582int
583rte_hash_lookup_with_hash_bulk(const struct rte_hash *h, const void **keys,
584 hash_sig_t *sig, uint32_t num_keys, int32_t *positions);
585
607int
609 const void **keys, hash_sig_t *sig,
610 uint32_t num_keys, uint64_t *hit_mask, void *data[]);
611
633int
634rte_hash_lookup_bulk(const struct rte_hash *h, const void **keys,
635 uint32_t num_keys, int32_t *positions);
636
656int32_t
657rte_hash_iterate(const struct rte_hash *h, const void **key, void **data, uint32_t *next);
658
677
678#ifdef __cplusplus
679}
680#endif
681
682#endif /* _RTE_HASH_H_ */
int32_t rte_hash_add_key(const struct rte_hash *h, const void *key)
int32_t rte_hash_del_key_with_hash(const struct rte_hash *h, const void *key, hash_sig_t sig)
uint32_t(* rte_hash_function)(const void *key, uint32_t key_len, uint32_t init_val)
Definition: rte_hash.h:65
int rte_hash_lookup_data(const struct rte_hash *h, const void *key, void **data)
void rte_hash_free(struct rte_hash *h)
int rte_hash_add_key_data(const struct rte_hash *h, const void *key, void *data)
int32_t rte_hash_add_key_with_hash_data(const struct rte_hash *h, const void *key, hash_sig_t sig, void *data)
int32_t rte_hash_count(const struct rte_hash *h)
int rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_config *cfg)
int rte_hash_lookup_bulk(const struct rte_hash *h, const void **keys, uint32_t num_keys, int32_t *positions)
int32_t rte_hash_iterate(const struct rte_hash *h, const void **key, void **data, uint32_t *next)
rte_hash_qsbr_mode
Definition: rte_hash.h:93
@ RTE_HASH_QSBR_MODE_SYNC
Definition: rte_hash.h:97
@ RTE_HASH_QSBR_MODE_DQ
Definition: rte_hash.h:95
struct rte_hash * rte_hash_find_existing(const char *name)
void(* rte_hash_free_key_data)(void *p, void *key_data)
Definition: rte_hash.h:76
int rte_hash_lookup_with_hash_data(const struct rte_hash *h, const void *key, hash_sig_t sig, void **data)
int32_t rte_hash_lookup(const struct rte_hash *h, const void *key)
int rte_hash_lookup_with_hash_bulk(const struct rte_hash *h, const void **keys, hash_sig_t *sig, uint32_t num_keys, int32_t *positions)
int rte_hash_free_key_with_position(const struct rte_hash *h, const int32_t position)
int rte_hash_get_key_with_position(const struct rte_hash *h, const int32_t position, void **key)
struct rte_hash * rte_hash_create(const struct rte_hash_parameters *params)
int32_t rte_hash_lookup_with_hash(const struct rte_hash *h, const void *key, hash_sig_t sig)
int32_t rte_hash_del_key(const struct rte_hash *h, const void *key)
int32_t rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key, hash_sig_t sig)
hash_sig_t rte_hash_hash(const struct rte_hash *h, const void *key)
uint32_t hash_sig_t
Definition: rte_hash.h:62
int32_t rte_hash_max_key_id(const struct rte_hash *h)
void rte_hash_set_cmp_func(struct rte_hash *h, rte_hash_cmp_eq_t func)
void rte_hash_reset(struct rte_hash *h)
int rte_hash_lookup_with_hash_bulk_data(const struct rte_hash *h, const void **keys, hash_sig_t *sig, uint32_t num_keys, uint64_t *hit_mask, void *data[])
int(* rte_hash_cmp_eq_t)(const void *key1, const void *key2, size_t key_len)
Definition: rte_hash.h:69
int rte_hash_lookup_bulk_data(const struct rte_hash *h, const void **keys, uint32_t num_keys, uint64_t *hit_mask, void *data[])
uint32_t hash_func_init_val
Definition: rte_hash.h:87
uint8_t extra_flag
Definition: rte_hash.h:89
uint32_t entries
Definition: rte_hash.h:83
uint32_t key_len
Definition: rte_hash.h:85
const char * name
Definition: rte_hash.h:82
uint32_t reserved
Definition: rte_hash.h:84
rte_hash_function hash_func
Definition: rte_hash.h:86
struct rte_rcu_qsbr * v
Definition: rte_hash.h:102
uint32_t trigger_reclaim_limit
Definition: rte_hash.h:111
rte_hash_free_key_data free_key_data_func
Definition: rte_hash.h:121
enum rte_hash_qsbr_mode mode
Definition: rte_hash.h:103
uint32_t dq_size
Definition: rte_hash.h:107
uint32_t max_reclaim_size
Definition: rte_hash.h:112
char name[RTE_HASH_NAMESIZE]