.TH "rte_hash.h" 3 "Version 25.11.0" "DPDK" \" -*- nroff -*-
.ad l
.nh
.SH NAME
rte_hash.h
.SH SYNOPSIS
.br
.PP
\fR#include <stdint\&.h>\fP
.br
\fR#include <stddef\&.h>\fP
.br
\fR#include <rte_common\&.h>\fP
.br
\fR#include <rte_rcu_qsbr\&.h>\fP
.br

.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBrte_hash_parameters\fP"
.br
.ti -1c
.RI "struct \fBrte_hash_rcu_config\fP"
.br
.in -1c
.SS "Macros"

.in +1c
.ti -1c
.RI "#define \fBRTE_HASH_ENTRIES_MAX\fP   (1 << 30)"
.br
.ti -1c
.RI "#define \fBRTE_HASH_NAMESIZE\fP   32"
.br
.ti -1c
.RI "#define \fBRTE_HASH_LOOKUP_BULK_MAX\fP   64"
.br
.ti -1c
.RI "#define \fBRTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT\fP   0x01"
.br
.ti -1c
.RI "#define \fBRTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD\fP   0x02"
.br
.ti -1c
.RI "#define \fBRTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY\fP   0x04"
.br
.ti -1c
.RI "#define \fBRTE_HASH_EXTRA_FLAGS_EXT_TABLE\fP   0x08"
.br
.ti -1c
.RI "#define \fBRTE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL\fP   0x10"
.br
.ti -1c
.RI "#define \fBRTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF\fP   0x20"
.br
.in -1c
.SS "Typedefs"

.in +1c
.ti -1c
.RI "\fBtypedef\fP uint32_t \fBhash_sig_t\fP"
.br
.ti -1c
.RI "\fBtypedef\fP uint32_t(* \fBrte_hash_function\fP) (const void *key, uint32_t key_len, uint32_t init_val)"
.br
.ti -1c
.RI "\fBtypedef\fP int(* \fBrte_hash_cmp_eq_t\fP) (const void *key1, const void *key2, size_t key_len)"
.br
.ti -1c
.RI "\fBtypedef\fP void(* \fBrte_hash_free_key_data\fP) (void *p, void *key_data)"
.br
.in -1c
.SS "Enumerations"

.in +1c
.ti -1c
.RI "enum \fBrte_hash_qsbr_mode\fP { \fBRTE_HASH_QSBR_MODE_DQ\fP = 0, \fBRTE_HASH_QSBR_MODE_SYNC\fP }"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "void \fBrte_hash_free\fP (struct \fBrte_hash\fP *h)"
.br
.ti -1c
.RI "struct \fBrte_hash\fP * \fBrte_hash_create\fP (const struct \fBrte_hash_parameters\fP *params) \fB__rte_malloc\fP \fB__rte_dealloc\fP(\fBrte_hash_free\fP"
.br
.ti -1c
.RI "struct \fBrte_hash\fP void \fBrte_hash_set_cmp_func\fP (struct \fBrte_hash\fP *h, \fBrte_hash_cmp_eq_t\fP func)"
.br
.ti -1c
.RI "struct \fBrte_hash\fP * \fBrte_hash_find_existing\fP (const char *name)"
.br
.ti -1c
.RI "void \fBrte_hash_reset\fP (struct \fBrte_hash\fP *h)"
.br
.ti -1c
.RI "int32_t \fBrte_hash_count\fP (const struct \fBrte_hash\fP *h)"
.br
.ti -1c
.RI "int32_t \fBrte_hash_max_key_id\fP (const struct \fBrte_hash\fP *h)"
.br
.ti -1c
.RI "int \fBrte_hash_add_key_data\fP (const struct \fBrte_hash\fP *h, const void *key, void *data)"
.br
.ti -1c
.RI "int32_t \fBrte_hash_add_key_with_hash_data\fP (const struct \fBrte_hash\fP *h, const void *key, \fBhash_sig_t\fP sig, void *data)"
.br
.ti -1c
.RI "int32_t \fBrte_hash_add_key\fP (const struct \fBrte_hash\fP *h, const void *key)"
.br
.ti -1c
.RI "int32_t \fBrte_hash_add_key_with_hash\fP (const struct \fBrte_hash\fP *h, const void *key, \fBhash_sig_t\fP sig)"
.br
.ti -1c
.RI "int32_t \fBrte_hash_del_key\fP (const struct \fBrte_hash\fP *h, const void *key)"
.br
.ti -1c
.RI "int32_t \fBrte_hash_del_key_with_hash\fP (const struct \fBrte_hash\fP *h, const void *key, \fBhash_sig_t\fP sig)"
.br
.ti -1c
.RI "int \fBrte_hash_get_key_with_position\fP (const struct \fBrte_hash\fP *h, const int32_t position, void **key)"
.br
.ti -1c
.RI "int \fBrte_hash_free_key_with_position\fP (const struct \fBrte_hash\fP *h, const int32_t position)"
.br
.ti -1c
.RI "int \fBrte_hash_lookup_data\fP (const struct \fBrte_hash\fP *h, const void *key, void **data)"
.br
.ti -1c
.RI "int \fBrte_hash_lookup_with_hash_data\fP (const struct \fBrte_hash\fP *h, const void *key, \fBhash_sig_t\fP sig, void **data)"
.br
.ti -1c
.RI "int32_t \fBrte_hash_lookup\fP (const struct \fBrte_hash\fP *h, const void *key)"
.br
.ti -1c
.RI "int32_t \fBrte_hash_lookup_with_hash\fP (const struct \fBrte_hash\fP *h, const void *key, \fBhash_sig_t\fP sig)"
.br
.ti -1c
.RI "\fBhash_sig_t\fP \fBrte_hash_hash\fP (const struct \fBrte_hash\fP *h, const void *key)"
.br
.ti -1c
.RI "int \fBrte_hash_lookup_bulk_data\fP (const struct \fBrte_hash\fP *h, const void **keys, uint32_t num_keys, uint64_t *hit_mask, void *data[])"
.br
.ti -1c
.RI "int \fBrte_hash_lookup_with_hash_bulk\fP (const struct \fBrte_hash\fP *h, const void **keys, \fBhash_sig_t\fP *sig, uint32_t num_keys, int32_t *positions)"
.br
.ti -1c
.RI "int \fBrte_hash_lookup_with_hash_bulk_data\fP (const struct \fBrte_hash\fP *h, const void **keys, \fBhash_sig_t\fP *sig, uint32_t num_keys, uint64_t *hit_mask, void *data[])"
.br
.ti -1c
.RI "int \fBrte_hash_lookup_bulk\fP (const struct \fBrte_hash\fP *h, const void **keys, uint32_t num_keys, int32_t *positions)"
.br
.ti -1c
.RI "int32_t \fBrte_hash_iterate\fP (const struct \fBrte_hash\fP *h, const void **key, void **data, uint32_t *next)"
.br
.ti -1c
.RI "int \fBrte_hash_rcu_qsbr_add\fP (struct \fBrte_hash\fP *h, struct \fBrte_hash_rcu_config\fP *cfg)"
.br
.ti -1c
.RI "__rte_experimental int \fBrte_hash_rcu_qsbr_dq_reclaim\fP (struct \fBrte_hash\fP *h, unsigned int *freed, unsigned int *pending, unsigned int *available)"
.br
.in -1c
.SH "Detailed Description"
.PP 
RTE Hash Table 
.PP
Definition in file \fBrte_hash\&.h\fP\&.
.SH "Macro Definition Documentation"
.PP 
.SS "#define RTE_HASH_ENTRIES_MAX   (1 << 30)"
Maximum size of hash table that can be created\&. 
.PP
Definition at line \fB25\fP of file \fBrte_hash\&.h\fP\&.
.SS "#define RTE_HASH_NAMESIZE   32"
Maximum number of characters in hash name\&. 
.PP
Definition at line \fB28\fP of file \fBrte_hash\&.h\fP\&.
.SS "#define RTE_HASH_LOOKUP_BULK_MAX   64"
Maximum number of keys that can be searched for using rte_hash_lookup_bulk\&. 
.PP
Definition at line \fB31\fP of file \fBrte_hash\&.h\fP\&.
.SS "#define RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT   0x01"
Enable Hardware transactional memory support\&. 
.PP
Definition at line \fB35\fP of file \fBrte_hash\&.h\fP\&.
.SS "#define RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD   0x02"
Default behavior of insertion, single writer/multi writer 
.PP
Definition at line \fB38\fP of file \fBrte_hash\&.h\fP\&.
.SS "#define RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY   0x04"
Flag to support reader writer concurrency 
.PP
Definition at line \fB41\fP of file \fBrte_hash\&.h\fP\&.
.SS "#define RTE_HASH_EXTRA_FLAGS_EXT_TABLE   0x08"
Flag to indicate the extendable bucket table feature should be used 
.PP
Definition at line \fB44\fP of file \fBrte_hash\&.h\fP\&.
.SS "#define RTE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL   0x10"
Flag to disable freeing of key index on hash delete\&. Refer to rte_hash_del_xxx APIs for more details\&. This is enabled by default when RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF is enabled\&. However, if internal RCU is enabled, freeing of internal memory/index is done on delete 
.PP
Definition at line \fB52\fP of file \fBrte_hash\&.h\fP\&.
.SS "#define RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF   0x20"
Flag to support lock free reader writer concurrency\&. Both single writer and multi writer use cases are supported\&. 
.PP
Definition at line \fB57\fP of file \fBrte_hash\&.h\fP\&.
.SH "Typedef Documentation"
.PP 
.SS "\fBtypedef\fP uint32_t \fBhash_sig_t\fP"
The type of hash value of a key\&. It should be a value of at least 32bit with fully random pattern\&. 
.PP
Definition at line \fB63\fP of file \fBrte_hash\&.h\fP\&.
.SS "\fBtypedef\fP uint32_t(* rte_hash_function) (const void *key, uint32_t key_len, uint32_t init_val)"
Type of function that can be used for calculating the hash value\&. 
.PP
Definition at line \fB66\fP of file \fBrte_hash\&.h\fP\&.
.SS "\fBtypedef\fP int(* rte_hash_cmp_eq_t) (const void *key1, const void *key2, size_t key_len)"
Type of function used to compare the hash key\&. 
.PP
Definition at line \fB70\fP of file \fBrte_hash\&.h\fP\&.
.SS "\fBtypedef\fP void(* rte_hash_free_key_data) (void *p, void *key_data)"
Type of function used to free data stored in the key\&. Required when using internal RCU to allow application to free key-data once the key is returned to the ring of free key-slots\&. 
.PP
Definition at line \fB77\fP of file \fBrte_hash\&.h\fP\&.
.SH "Enumeration Type Documentation"
.PP 
.SS "enum \fBrte_hash_qsbr_mode\fP"
RCU reclamation modes 
.PP
\fBEnumerator\fP
.in +1c
.TP
\f(BIRTE_HASH_QSBR_MODE_DQ \fP
Create defer queue for reclaim\&. 
.TP
\f(BIRTE_HASH_QSBR_MODE_SYNC \fP
Use blocking mode reclaim\&. No defer queue created\&. 
.PP
Definition at line \fB94\fP of file \fBrte_hash\&.h\fP\&.
.SH "Function Documentation"
.PP 
.SS "void rte_hash_free (struct \fBrte_hash\fP * h)"
De-allocate all memory used by hash table\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to free, if NULL, the function does nothing\&. 
.RE
.PP

.SS "struct \fBrte_hash\fP * rte_hash_create (const struct \fBrte_hash_parameters\fP * params)"
Create a new hash table\&.

.PP
\fBParameters\fP
.RS 4
\fIparams\fP Parameters used to create and initialise the hash table\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Pointer to hash table structure that is used in future hash table operations, or NULL on error, with error code set in rte_errno\&. Possible rte_errno errors include:
.IP "\(bu" 2
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
.IP "\(bu" 2
E_RTE_SECONDARY - function was called from a secondary process instance
.IP "\(bu" 2
ENOENT - missing entry
.IP "\(bu" 2
EINVAL - invalid parameter passed to function
.IP "\(bu" 2
ENOSPC - the maximum number of memzones has already been allocated
.IP "\(bu" 2
EEXIST - a memzone with the same name already exists
.IP "\(bu" 2
ENOMEM - no appropriate memory area found in which to create memzone 
.PP
.RE
.PP

.SS "struct \fBrte_hash\fP void rte_hash_set_cmp_func (struct \fBrte_hash\fP * h, \fBrte_hash_cmp_eq_t\fP func)"
Set a new hash compare function other than the default one\&.

.PP
\fBNote\fP
.RS 4
Function pointer does not work with multi-process, so do not use it in multi-process mode\&.
.RE
.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table for which the function is to be changed 
.br
\fIfunc\fP New compare function 
.RE
.PP

.SS "struct \fBrte_hash\fP * rte_hash_find_existing (const char * name)"
Find an existing hash table object and return a pointer to it\&.

.PP
\fBParameters\fP
.RS 4
\fIname\fP Name of the hash table as passed to \fBrte_hash_create()\fP 
.RE
.PP
\fBReturns\fP
.RS 4
Pointer to hash table or NULL if object not found with rte_errno set appropriately\&. Possible rte_errno values include:
.IP "\(bu" 2
ENOENT - value not available for return 
.PP
.RE
.PP

.SS "void rte_hash_reset (struct \fBrte_hash\fP * h)"
Reset all hash structure, by zeroing all entries\&. When RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF is enabled, it is application's responsibility to make sure that none of the readers are referencing the hash table while calling this API\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to reset 
.RE
.PP

.SS "int32_t rte_hash_count (const struct \fBrte_hash\fP * h)"
Return the number of keys in the hash table 
.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to query from 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
-EINVAL if parameters are invalid
.IP "\(bu" 2
A value indicating how many keys were inserted in the table\&. 
.PP
.RE
.PP

.SS "int32_t rte_hash_max_key_id (const struct \fBrte_hash\fP * h)"
Return the maximum key value ID that could possibly be returned by rte_hash_add_key function\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to query from 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
-EINVAL if parameters are invalid
.IP "\(bu" 2
A value indicating the max key ID of key slots present in the table\&. 
.PP
.RE
.PP

.SS "int rte_hash_add_key_data (const struct \fBrte_hash\fP * h, const void * key, void * data)"
Add a key-value pair to an existing hash table\&. This operation is not multi-thread safe and should only be called from one thread by default\&. Thread safety can be enabled by setting flag during table creation\&. If the key exists already in the table, this API updates its value with 'data' passed in this API\&. It is the responsibility of the application to manage any memory associated with the old value\&. The readers might still be using the old value even after this API has returned\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to add the key to\&. 
.br
\fIkey\fP Key to add to the hash table\&. 
.br
\fIdata\fP Data to add to the hash table\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
0 if added successfully
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOSPC if there is no space in the hash for this key\&. 
.PP
.RE
.PP

.SS "int32_t rte_hash_add_key_with_hash_data (const struct \fBrte_hash\fP * h, const void * key, \fBhash_sig_t\fP sig, void * data)"
Add a key-value pair with a pre-computed hash value to an existing hash table\&. This operation is not multi-thread safe and should only be called from one thread by default\&. Thread safety can be enabled by setting flag during table creation\&. If the key exists already in the table, this API updates its value with 'data' passed in this API\&. It is the responsibility of the application to manage any memory associated with the old value\&. The readers might still be using the old value even after this API has returned\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to add the key to\&. 
.br
\fIkey\fP Key to add to the hash table\&. 
.br
\fIsig\fP Precomputed hash value for 'key' 
.br
\fIdata\fP Data to add to the hash table\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
0 if added successfully
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOSPC if there is no space in the hash for this key\&. 
.PP
.RE
.PP

.SS "int32_t rte_hash_add_key (const struct \fBrte_hash\fP * h, const void * key)"
Add a key to an existing hash table\&. This operation is not multi-thread safe and should only be called from one thread by default\&. Thread safety can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to add the key to\&. 
.br
\fIkey\fP Key to add to the hash table\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOSPC if there is no space in the hash for this key\&.
.IP "\(bu" 2
A non-negative value that can be used by the caller as an offset into an array of user data\&. This value is unique for this key\&. This unique key id may be larger than the user specified entry count when RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD flag is set\&. 
.PP
.RE
.PP

.SS "int32_t rte_hash_add_key_with_hash (const struct \fBrte_hash\fP * h, const void * key, \fBhash_sig_t\fP sig)"
Add a key to an existing hash table\&. This operation is not multi-thread safe and should only be called from one thread by default\&. Thread safety can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to add the key to\&. 
.br
\fIkey\fP Key to add to the hash table\&. 
.br
\fIsig\fP Precomputed hash value for 'key'\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOSPC if there is no space in the hash for this key\&.
.IP "\(bu" 2
A non-negative value that can be used by the caller as an offset into an array of user data\&. This value is unique for this key\&. This unique key ID may be larger than the user specified entry count when RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD flag is set\&. 
.PP
.RE
.PP

.SS "int32_t rte_hash_del_key (const struct \fBrte_hash\fP * h, const void * key)"
Remove a key from an existing hash table\&. This operation is not multi-thread safe and should only be called from one thread by default\&. Thread safety can be enabled by setting flag during table creation\&. If RTE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL or RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF is enabled and internal RCU is NOT enabled, the key index returned by rte_hash_add_key_xxx APIs will not be freed by this API\&. rte_hash_free_key_with_position API must be called additionally to free the index associated with the key\&. rte_hash_free_key_with_position API should be called after all the readers have stopped referencing the entry corresponding to this key\&. RCU mechanisms could be used to determine such a state\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to remove the key from\&. 
.br
\fIkey\fP Key to remove from the hash table\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOENT if the key is not found\&.
.IP "\(bu" 2
A non-negative value that can be used by the caller as an offset into an array of user data\&. This value is unique for this key, and is the same value that was returned when the key was added\&. 
.PP
.RE
.PP

.SS "int32_t rte_hash_del_key_with_hash (const struct \fBrte_hash\fP * h, const void * key, \fBhash_sig_t\fP sig)"
Remove a key from an existing hash table\&. This operation is not multi-thread safe and should only be called from one thread by default\&. Thread safety can be enabled by setting flag during table creation\&. If RTE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL or RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF is enabled and internal RCU is NOT enabled, the key index returned by rte_hash_add_key_xxx APIs will not be freed by this API\&. rte_hash_free_key_with_position API must be called additionally to free the index associated with the key\&. rte_hash_free_key_with_position API should be called after all the readers have stopped referencing the entry corresponding to this key\&. RCU mechanisms could be used to determine such a state\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to remove the key from\&. 
.br
\fIkey\fP Key to remove from the hash table\&. 
.br
\fIsig\fP Precomputed hash value for 'key'\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOENT if the key is not found\&.
.IP "\(bu" 2
A non-negative value that can be used by the caller as an offset into an array of user data\&. This value is unique for this key, and is the same value that was returned when the key was added\&. 
.PP
.RE
.PP

.SS "int rte_hash_get_key_with_position (const struct \fBrte_hash\fP * h, const int32_t position, void ** key)"
Find a key in the hash table given the position\&. This operation is multi-thread safe with regarding to other lookup threads\&. Read-write concurrency can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to get the key from\&. 
.br
\fIposition\fP Position returned when the key was inserted\&. 
.br
\fIkey\fP Output containing a pointer to the key 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
0 if retrieved successfully
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOENT if no valid key is found in the given position\&. 
.PP
.RE
.PP

.SS "int rte_hash_free_key_with_position (const struct \fBrte_hash\fP * h, const int32_t position)"
Free a hash key in the hash table given the position of the key\&. This operation is not multi-thread safe and should only be called from one thread by default\&. Thread safety can be enabled by setting flag during table creation\&. If RTE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL or RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF is enabled and internal RCU is NOT enabled, the key index returned by rte_hash_del_key_xxx APIs must be freed using this API\&. This API should be called after all the readers have stopped referencing the entry corresponding to this key\&. RCU mechanisms could be used to determine such a state\&. This API does not validate if the key is already freed\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to free the key from\&. 
.br
\fIposition\fP Position returned when the key was deleted\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
0 if freed successfully
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&. 
.PP
.RE
.PP

.SS "int rte_hash_lookup_data (const struct \fBrte_hash\fP * h, const void * key, void ** data)"
Find a key-value pair in the hash table\&. This operation is multi-thread safe with regarding to other lookup threads\&. Read-write concurrency can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to look in\&. 
.br
\fIkey\fP Key to find\&. 
.br
\fIdata\fP Output with pointer to data returned from the hash table\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
A non-negative value that can be used by the caller as an offset into an array of user data\&. This value is unique for this key, and is the same value that was returned when the key was added\&.
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOENT if the key is not found\&. 
.PP
.RE
.PP

.SS "int rte_hash_lookup_with_hash_data (const struct \fBrte_hash\fP * h, const void * key, \fBhash_sig_t\fP sig, void ** data)"
Find a key-value pair with a pre-computed hash value to an existing hash table\&. This operation is multi-thread safe with regarding to other lookup threads\&. Read-write concurrency can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to look in\&. 
.br
\fIkey\fP Key to find\&. 
.br
\fIsig\fP Precomputed hash value for 'key' 
.br
\fIdata\fP Output with pointer to data returned from the hash table\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
A non-negative value that can be used by the caller as an offset into an array of user data\&. This value is unique for this key, and is the same value that was returned when the key was added\&.
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOENT if the key is not found\&. 
.PP
.RE
.PP

.SS "int32_t rte_hash_lookup (const struct \fBrte_hash\fP * h, const void * key)"
Find a key in the hash table\&. This operation is multi-thread safe with regarding to other lookup threads\&. Read-write concurrency can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to look in\&. 
.br
\fIkey\fP Key to find\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOENT if the key is not found\&.
.IP "\(bu" 2
A non-negative value that can be used by the caller as an offset into an array of user data\&. This value is unique for this key, and is the same value that was returned when the key was added\&. 
.PP
.RE
.PP

.SS "int32_t rte_hash_lookup_with_hash (const struct \fBrte_hash\fP * h, const void * key, \fBhash_sig_t\fP sig)"
Find a key in the hash table\&. This operation is multi-thread safe with regarding to other lookup threads\&. Read-write concurrency can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to look in\&. 
.br
\fIkey\fP Key to find\&. 
.br
\fIsig\fP Precomputed hash value for 'key'\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOENT if the key is not found\&.
.IP "\(bu" 2
A non-negative value that can be used by the caller as an offset into an array of user data\&. This value is unique for this key, and is the same value that was returned when the key was added\&. 
.PP
.RE
.PP

.SS "\fBhash_sig_t\fP rte_hash_hash (const struct \fBrte_hash\fP * h, const void * key)"
Calc a hash value by key\&. This operation is not multi-process safe\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to look in\&. 
.br
\fIkey\fP Key to find\&. 
.RE
.PP
\fBReturns\fP
.RS 4
.IP "\(bu" 2
hash value 
.PP
.RE
.PP

.SS "int rte_hash_lookup_bulk_data (const struct \fBrte_hash\fP * h, const void ** keys, uint32_t num_keys, uint64_t * hit_mask, void * data[])"
Find multiple keys in the hash table\&. This operation is multi-thread safe with regarding to other lookup threads\&. Read-write concurrency can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to look in\&. 
.br
\fIkeys\fP A pointer to a list of keys to look for\&. 
.br
\fInum_keys\fP How many keys are in the keys list (less than RTE_HASH_LOOKUP_BULK_MAX)\&. 
.br
\fIhit_mask\fP Output containing a bitmask with all successful lookups\&. 
.br
\fIdata\fP Output containing array of data returned from all the successful lookups\&. 
.RE
.PP
\fBReturns\fP
.RS 4
-EINVAL if there's an error, otherwise number of successful lookups\&. 
.RE
.PP

.SS "int rte_hash_lookup_with_hash_bulk (const struct \fBrte_hash\fP * h, const void ** keys, \fBhash_sig_t\fP * sig, uint32_t num_keys, int32_t * positions)"
Find multiple keys in the hash table with precomputed hash value array\&. This operation is multi-thread safe with regarding to other lookup threads\&. Read-write concurrency can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to look in\&. 
.br
\fIkeys\fP A pointer to a list of keys to look for\&. 
.br
\fIsig\fP A pointer to a list of precomputed hash values for keys\&. 
.br
\fInum_keys\fP How many keys are in the keys list (less than RTE_HASH_LOOKUP_BULK_MAX)\&. 
.br
\fIpositions\fP Output containing a list of values, corresponding to the list of keys that can be used by the caller as an offset into an array of user data\&. These values are unique for each key, and are the same values that were returned when each key was added\&. If a key in the list was not found, then -ENOENT will be the value\&. 
.RE
.PP
\fBReturns\fP
.RS 4
-EINVAL if there's an error, otherwise 0\&. 
.RE
.PP

.SS "int rte_hash_lookup_with_hash_bulk_data (const struct \fBrte_hash\fP * h, const void ** keys, \fBhash_sig_t\fP * sig, uint32_t num_keys, uint64_t * hit_mask, void * data[])"
Find multiple keys in the hash table with precomputed hash value array\&. This operation is multi-thread safe with regarding to other lookup threads\&. Read-write concurrency can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to look in\&. 
.br
\fIkeys\fP A pointer to a list of keys to look for\&. 
.br
\fIsig\fP A pointer to a list of precomputed hash values for keys\&. 
.br
\fInum_keys\fP How many keys are in the keys list (less than RTE_HASH_LOOKUP_BULK_MAX)\&. 
.br
\fIhit_mask\fP Output containing a bitmask with all successful lookups\&. 
.br
\fIdata\fP Output containing array of data returned from all the successful lookups\&. 
.RE
.PP
\fBReturns\fP
.RS 4
-EINVAL if there's an error, otherwise number of successful lookups\&. 
.RE
.PP

.SS "int rte_hash_lookup_bulk (const struct \fBrte_hash\fP * h, const void ** keys, uint32_t num_keys, int32_t * positions)"
Find multiple keys in the hash table\&. This operation is multi-thread safe with regarding to other lookup threads\&. Read-write concurrency can be enabled by setting flag during table creation\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to look in\&. 
.br
\fIkeys\fP A pointer to a list of keys to look for\&. 
.br
\fInum_keys\fP How many keys are in the keys list (less than RTE_HASH_LOOKUP_BULK_MAX)\&. 
.br
\fIpositions\fP Output containing a list of values, corresponding to the list of keys that can be used by the caller as an offset into an array of user data\&. These values are unique for each key, and are the same values that were returned when each key was added\&. If a key in the list was not found, then -ENOENT will be the value\&. 
.RE
.PP
\fBReturns\fP
.RS 4
-EINVAL if there's an error, otherwise 0\&. 
.RE
.PP

.SS "int32_t rte_hash_iterate (const struct \fBrte_hash\fP * h, const void ** key, void ** data, uint32_t * next)"
Iterate through the hash table, returning key-value pairs\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP Hash table to iterate 
.br
\fIkey\fP Output containing the key where current iterator was pointing at 
.br
\fIdata\fP Output containing the data associated with key\&. Returns NULL if data was not stored\&. 
.br
\fInext\fP Pointer to iterator\&. Should be 0 to start iterating the hash table\&. Iterator is incremented after each call of this function\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Position where key was stored, if successful\&.
.IP "\(bu" 2
-EINVAL if the parameters are invalid\&.
.IP "\(bu" 2
-ENOENT if end of the hash table\&. 
.PP
.RE
.PP

.SS "int rte_hash_rcu_qsbr_add (struct \fBrte_hash\fP * h, struct \fBrte_hash_rcu_config\fP * cfg)"
Associate RCU QSBR variable with a Hash object\&. This API should be called to enable the integrated RCU QSBR support and should be called immediately after creating the Hash object\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP the hash object to add RCU QSBR 
.br
\fIcfg\fP RCU QSBR configuration 
.RE
.PP
\fBReturns\fP
.RS 4
On success - 0 On error - 1 with error code set in rte_errno\&. Possible rte_errno codes are:
.IP "\(bu" 2
EINVAL - invalid pointer
.IP "\(bu" 2
EEXIST - already added QSBR
.IP "\(bu" 2
ENOMEM - memory allocation failure 
.PP
.RE
.PP

.SS "__rte_experimental int rte_hash_rcu_qsbr_dq_reclaim (struct \fBrte_hash\fP * h, unsigned int * freed, unsigned int * pending, unsigned int * available)"
Reclaim resources from the defer queue\&. This API reclaim the resources from the defer queue if rcu is enabled\&.

.PP
\fBParameters\fP
.RS 4
\fIh\fP The hash object to reclaim resources\&. 
.br
\fIfreed\fP Number of resources that were freed\&. 
.br
\fIpending\fP Number of resources pending on the defer queue\&. This number might not be accurate if multi-thread safety is configured\&. 
.br
\fIavailable\fP Number of resources that can be added to the defer queue\&. This number might not be accurate if multi-thread safety is configured\&. 
.RE
.PP
\fBReturns\fP
.RS 4
On success - 0 On error - 1 with error code set in rte_errno\&. Possible rte_errno codes are:
.IP "\(bu" 2
EINVAL - invalid pointer 
.PP
.RE
.PP

.SH "Author"
.PP 
Generated automatically by Doxygen for DPDK from the source code\&.
