DPDK
17.05.2
Main Page
Related Pages
Data Structures
Files
Examples
File List
Globals
lib
librte_hash
rte_hash.h
Go to the documentation of this file.
1
/*-
2
* BSD LICENSE
3
*
4
* Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
10
*
11
* * Redistributions of source code must retain the above copyright
12
* notice, this list of conditions and the following disclaimer.
13
* * Redistributions in binary form must reproduce the above copyright
14
* notice, this list of conditions and the following disclaimer in
15
* the documentation and/or other materials provided with the
16
* distribution.
17
* * Neither the name of Intel Corporation nor the names of its
18
* contributors may be used to endorse or promote products derived
19
* from this software without specific prior written permission.
20
*
21
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
*/
33
34
#ifndef _RTE_HASH_H_
35
#define _RTE_HASH_H_
36
43
#include <stdint.h>
44
#include <stddef.h>
45
46
#ifdef __cplusplus
47
extern
"C"
{
48
#endif
49
51
#define RTE_HASH_ENTRIES_MAX (1 << 30)
52
54
#define RTE_HASH_NAMESIZE 32
55
57
#define RTE_HASH_LOOKUP_BULK_MAX 64
58
#define RTE_HASH_LOOKUP_MULTI_MAX RTE_HASH_LOOKUP_BULK_MAX
59
61
#define RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT 0x01
62
64
#define RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD 0x02
65
67
typedef
uint32_t
hash_sig_t
;
68
70
typedef
uint32_t (*
rte_hash_function
)(
const
void
*key, uint32_t key_len,
71
uint32_t
init_val
);
72
74
typedef
int (*
rte_hash_cmp_eq_t
)(
const
void
*key1,
const
void
*key2,
size_t
key_len);
75
79
struct
rte_hash_parameters
{
80
const
char
*
name
;
81
uint32_t
entries
;
82
uint32_t
reserved
;
83
uint32_t
key_len
;
84
rte_hash_function
hash_func
;
85
uint32_t
hash_func_init_val
;
86
int
socket_id
;
87
uint8_t
extra_flag
;
88
};
89
91
struct
rte_hash
;
92
110
struct
rte_hash
*
111
rte_hash_create
(
const
struct
rte_hash_parameters
*params);
112
124
void
rte_hash_set_cmp_func
(
struct
rte_hash
*h,
rte_hash_cmp_eq_t
func);
125
136
struct
rte_hash
*
137
rte_hash_find_existing
(
const
char
*
name
);
138
144
void
145
rte_hash_free
(
struct
rte_hash
*h);
146
152
void
153
rte_hash_reset
(
struct
rte_hash
*h);
154
171
int
172
rte_hash_add_key_data
(
const
struct
rte_hash
*h,
const
void
*key,
void
*data);
173
193
int32_t
194
rte_hash_add_key_with_hash_data
(
const
struct
rte_hash
*h,
const
void
*key,
195
hash_sig_t sig,
void
*data);
196
211
int32_t
212
rte_hash_add_key
(
const
struct
rte_hash
*h,
const
void
*key);
213
231
int32_t
232
rte_hash_add_key_with_hash
(
const
struct
rte_hash
*h,
const
void
*key, hash_sig_t sig);
233
250
int32_t
251
rte_hash_del_key
(
const
struct
rte_hash
*h,
const
void
*key);
252
271
int32_t
272
rte_hash_del_key_with_hash
(
const
struct
rte_hash
*h,
const
void
*key, hash_sig_t sig);
273
289
int
290
rte_hash_get_key_with_position
(
const
struct
rte_hash
*h,
const
int32_t position,
291
void
**key);
292
308
int
309
rte_hash_lookup_data
(
const
struct
rte_hash
*h,
const
void
*key,
void
**data);
310
329
int
330
rte_hash_lookup_with_hash_data
(
const
struct
rte_hash
*h,
const
void
*key,
331
hash_sig_t sig,
void
**data);
332
348
int32_t
349
rte_hash_lookup
(
const
struct
rte_hash
*h,
const
void
*key);
350
368
int32_t
369
rte_hash_lookup_with_hash
(
const
struct
rte_hash
*h,
370
const
void
*key, hash_sig_t sig);
371
383
hash_sig_t
384
rte_hash_hash
(
const
struct
rte_hash
*h,
const
void
*key);
385
403
int
404
rte_hash_lookup_bulk_data
(
const
struct
rte_hash
*h,
const
void
**keys,
405
uint32_t num_keys, uint64_t *hit_mask,
void
*data[]);
406
426
int
427
rte_hash_lookup_bulk
(
const
struct
rte_hash
*h,
const
void
**keys,
428
uint32_t num_keys, int32_t *positions);
429
449
int32_t
450
rte_hash_iterate
(
const
struct
rte_hash
*h,
const
void
**key,
void
**data, uint32_t *next);
451
#ifdef __cplusplus
452
}
453
#endif
454
455
#endif
/* _RTE_HASH_H_ */
Generated by
1.8.1.2