.TH "rte_fbk_hash.h" 3 "Version 25.11.0" "DPDK" \" -*- nroff -*-
.ad l
.nh
.SH NAME
rte_fbk_hash.h
.SH SYNOPSIS
.br
.PP
\fR#include <stdint\&.h>\fP
.br
\fR#include <errno\&.h>\fP
.br
\fR#include <string\&.h>\fP
.br
\fR#include <rte_common\&.h>\fP
.br
\fR#include <rte_hash_crc\&.h>\fP
.br
\fR#include <rte_jhash\&.h>\fP
.br

.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBrte_fbk_hash_params\fP"
.br
.ti -1c
.RI "union \fBrte_fbk_hash_entry\fP"
.br
.ti -1c
.RI "struct \fBrte_fbk_hash_table\fP"
.br
.in -1c
.SS "Macros"

.in +1c
.ti -1c
.RI "#define \fBRTE_FBK_HASH_INIT_VAL_DEFAULT\fP   0xFFFFFFFF"
.br
.ti -1c
.RI "#define \fBRTE_FBK_HASH_ENTRIES_MAX\fP   (1 << 20)"
.br
.ti -1c
.RI "#define \fBRTE_FBK_HASH_ENTRIES_PER_BUCKET_MAX\fP   256"
.br
.ti -1c
.RI "#define \fBRTE_FBK_HASH_NAMESIZE\fP   32"
.br
.in -1c
.SS "Typedefs"

.in +1c
.ti -1c
.RI "\fBtypedef\fP uint32_t(* \fBrte_fbk_hash_fn\fP) (uint32_t key, uint32_t init_val)"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "static uint32_t \fBrte_fbk_hash_get_bucket\fP (const struct \fBrte_fbk_hash_table\fP *ht, uint32_t key)"
.br
.ti -1c
.RI "static int \fBrte_fbk_hash_add_key_with_bucket\fP (struct \fBrte_fbk_hash_table\fP *ht, uint32_t key, uint16_t value, uint32_t bucket)"
.br
.ti -1c
.RI "static int \fBrte_fbk_hash_add_key\fP (struct \fBrte_fbk_hash_table\fP *ht, uint32_t key, uint16_t value)"
.br
.ti -1c
.RI "static int \fBrte_fbk_hash_delete_key_with_bucket\fP (struct \fBrte_fbk_hash_table\fP *ht, uint32_t key, uint32_t bucket)"
.br
.ti -1c
.RI "static int \fBrte_fbk_hash_delete_key\fP (struct \fBrte_fbk_hash_table\fP *ht, uint32_t key)"
.br
.ti -1c
.RI "static int \fBrte_fbk_hash_lookup_with_bucket\fP (const struct \fBrte_fbk_hash_table\fP *ht, uint32_t key, uint32_t bucket)"
.br
.ti -1c
.RI "static int \fBrte_fbk_hash_lookup\fP (const struct \fBrte_fbk_hash_table\fP *ht, uint32_t key)"
.br
.ti -1c
.RI "static void \fBrte_fbk_hash_clear_all\fP (struct \fBrte_fbk_hash_table\fP *ht)"
.br
.ti -1c
.RI "static double \fBrte_fbk_hash_get_load_factor\fP (struct \fBrte_fbk_hash_table\fP *ht)"
.br
.ti -1c
.RI "struct \fBrte_fbk_hash_table\fP * \fBrte_fbk_hash_find_existing\fP (const char *name)"
.br
.ti -1c
.RI "void \fBrte_fbk_hash_free\fP (struct \fBrte_fbk_hash_table\fP *ht)"
.br
.ti -1c
.RI "struct \fBrte_fbk_hash_table\fP * \fBrte_fbk_hash_create\fP (const struct \fBrte_fbk_hash_params\fP *params) \fB__rte_malloc\fP \fB__rte_dealloc\fP(\fBrte_fbk_hash_free\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
This is a hash table implementation for four byte keys (fbk)\&.

.PP
Note that the return value of the add function should always be checked as, if a bucket is full, the key is not added even if there is space in other buckets\&. This keeps the lookup function very simple and therefore fast\&. 
.PP
Definition in file \fBrte_fbk_hash\&.h\fP\&.
.SH "Macro Definition Documentation"
.PP 
.SS "#define RTE_FBK_HASH_INIT_VAL_DEFAULT   0xFFFFFFFF"
Initialising value used when calculating hash\&. 
.PP
Definition at line \fB33\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "#define RTE_FBK_HASH_ENTRIES_MAX   (1 << 20)"
The maximum number of entries in the hash table that is supported\&. 
.PP
Definition at line \fB37\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "#define RTE_FBK_HASH_ENTRIES_PER_BUCKET_MAX   256"
The maximum number of entries in each bucket that is supported\&. 
.PP
Definition at line \fB40\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "#define RTE_FBK_HASH_NAMESIZE   32"
Maximum size of string for naming the hash\&. 
.PP
Definition at line \fB43\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SH "Typedef Documentation"
.PP 
.SS "\fBtypedef\fP uint32_t(* rte_fbk_hash_fn) (uint32_t key, uint32_t init_val)"
Type of function that can be used for calculating the hash value\&. 
.PP
Definition at line \fB46\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SH "Function Documentation"
.PP 
.SS "uint32_t rte_fbk_hash_get_bucket (const struct \fBrte_fbk_hash_table\fP * ht, uint32_t key)\fR [inline]\fP, \fR [static]\fP"
Find the offset into hash table of the bucket containing a particular key\&.

.PP
\fBParameters\fP
.RS 4
\fIht\fP Pointer to hash table\&. 
.br
\fIkey\fP Key to calculate bucket for\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Offset into hash table\&. 
.RE
.PP

.PP
Definition at line \fB95\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "int rte_fbk_hash_add_key_with_bucket (struct \fBrte_fbk_hash_table\fP * ht, uint32_t key, uint16_t value, uint32_t bucket)\fR [inline]\fP, \fR [static]\fP"
Add a key to an existing hash table with bucket id\&. This operation is not multi-thread safe and should only be called from one thread\&.

.PP
\fBParameters\fP
.RS 4
\fIht\fP Hash table to add the key to\&. 
.br
\fIkey\fP Key to add to the hash table\&. 
.br
\fIvalue\fP Value to associate with key\&. 
.br
\fIbucket\fP Bucket to associate with key\&. 
.RE
.PP
\fBReturns\fP
.RS 4
0 if ok, or negative value on error\&. 
.RE
.PP

.PP
Definition at line \fB118\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "int rte_fbk_hash_add_key (struct \fBrte_fbk_hash_table\fP * ht, uint32_t key, uint16_t value)\fR [inline]\fP, \fR [static]\fP"
Add a key to an existing hash table\&. This operation is not multi-thread safe and should only be called from one thread\&.

.PP
\fBParameters\fP
.RS 4
\fIht\fP Hash table to add the key to\&. 
.br
\fIkey\fP Key to add to the hash table\&. 
.br
\fIvalue\fP Value to associate with key\&. 
.RE
.PP
\fBReturns\fP
.RS 4
0 if ok, or negative value on error\&. 
.RE
.PP

.PP
Definition at line \fB163\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "int rte_fbk_hash_delete_key_with_bucket (struct \fBrte_fbk_hash_table\fP * ht, uint32_t key, uint32_t bucket)\fR [inline]\fP, \fR [static]\fP"
Remove a key with a given bucket id from an existing hash table\&. This operation is not multi-thread safe and should only be called from one thread\&.

.PP
\fBParameters\fP
.RS 4
\fIht\fP Hash table to remove the key from\&. 
.br
\fIkey\fP Key to remove from the hash table\&. 
.br
\fIbucket\fP Bucket id associate with key\&. 
.RE
.PP
\fBReturns\fP
.RS 4
0 if ok, or negative value on error\&. 
.RE
.PP

.PP
Definition at line \fB185\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "int rte_fbk_hash_delete_key (struct \fBrte_fbk_hash_table\fP * ht, uint32_t key)\fR [inline]\fP, \fR [static]\fP"
Remove a key from an existing hash table\&. This operation is not multi-thread safe and should only be called from one thread\&.

.PP
\fBParameters\fP
.RS 4
\fIht\fP Hash table to remove the key from\&. 
.br
\fIkey\fP Key to remove from the hash table\&. 
.RE
.PP
\fBReturns\fP
.RS 4
0 if ok, or negative value on error\&. 
.RE
.PP

.PP
Definition at line \fB228\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "int rte_fbk_hash_lookup_with_bucket (const struct \fBrte_fbk_hash_table\fP * ht, uint32_t key, uint32_t bucket)\fR [inline]\fP, \fR [static]\fP"
Find a key in the hash table with a given bucketid\&. This operation is multi-thread safe\&.

.PP
\fBParameters\fP
.RS 4
\fIht\fP Hash table to look in\&. 
.br
\fIkey\fP Key to find\&. 
.br
\fIbucket\fP Bucket associate to the key\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The value that was associated with the key, or negative value on error\&. 
.RE
.PP

.PP
Definition at line \fB248\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "int rte_fbk_hash_lookup (const struct \fBrte_fbk_hash_table\fP * ht, uint32_t key)\fR [inline]\fP, \fR [static]\fP"
Find a key in the hash table\&. This operation is multi-thread safe\&.

.PP
\fBParameters\fP
.RS 4
\fIht\fP Hash table to look in\&. 
.br
\fIkey\fP Key to find\&. 
.RE
.PP
\fBReturns\fP
.RS 4
The value that was associated with the key, or negative value on error\&. 
.RE
.PP

.PP
Definition at line \fB278\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "void rte_fbk_hash_clear_all (struct \fBrte_fbk_hash_table\fP * ht)\fR [inline]\fP, \fR [static]\fP"
Delete all entries in a hash table\&. This operation is not multi-thread safe and should only be called from one thread\&.

.PP
\fBParameters\fP
.RS 4
\fIht\fP Hash table to delete entries in\&. 
.RE
.PP

.PP
Definition at line \fB292\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "double rte_fbk_hash_get_load_factor (struct \fBrte_fbk_hash_table\fP * ht)\fR [inline]\fP, \fR [static]\fP"
Find what fraction of entries are being used\&.

.PP
\fBParameters\fP
.RS 4
\fIht\fP Hash table to find how many entries are being used in\&. 
.RE
.PP
\fBReturns\fP
.RS 4
Load factor of the hash table, or negative value on error\&. 
.RE
.PP

.PP
Definition at line \fB307\fP of file \fBrte_fbk_hash\&.h\fP\&.
.SS "struct \fBrte_fbk_hash_table\fP * rte_fbk_hash_find_existing (const char * name)"
Performs a lookup for an existing hash table, and returns a pointer to the table if found\&.

.PP
\fBParameters\fP
.RS 4
\fIname\fP Name of the hash table to find
.RE
.PP
\fBReturns\fP
.RS 4
pointer to hash table structure or NULL on error with rte_errno set appropriately\&. Possible rte_errno values include:
.IP "\(bu" 2
ENOENT - required entry not available to return\&. 
.PP
.RE
.PP

.SS "void rte_fbk_hash_free (struct \fBrte_fbk_hash_table\fP * ht)"
Free all memory used by a hash table\&. Has no effect on hash tables allocated in memory zones

.PP
\fBParameters\fP
.RS 4
\fIht\fP Hash table to deallocate\&. 
.RE
.PP

.SS "struct \fBrte_fbk_hash_table\fP * rte_fbk_hash_create (const struct \fBrte_fbk_hash_params\fP * params)"
Create a new hash table for use with four byte keys\&.

.PP
\fBParameters\fP
.RS 4
\fIparams\fP Parameters used in creation of 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 rte_errno set appropriately\&. Possible rte_errno error values 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
EINVAL - invalid parameter value 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

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