rte_fbk_hash.h(3)
π rte_fbk_hash.h β Library Functions Manual π
okay so bestie, welcome to rte_fbk_hash.h(3) β a whole icon, no notes. this is the four-byte-key hash table era of DPDK and it's giving speed. πΈ
β¨ NAME β¨
rte_fbk_hash.h β the header for the four byte key (fbk) hash table. yes that's literally it, she's mysterious like that π
π¦ SYNOPSIS π¦
lowkey the whole vibe starts with these includes, bestie:
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <rte_common.h>
#include <rte_hash_crc.h>
#include <rte_jhash.h>
π Data Structures π
struct rte_fbk_hash_paramsunion rte_fbk_hash_entrystruct rte_fbk_hash_table
π Macros π
#define RTE_FBK_HASH_INIT_VAL_DEFAULT 0xFFFFFFFF
#define RTE_FBK_HASH_ENTRIES_MAX (1 << 20)
#define RTE_FBK_HASH_ENTRIES_PER_BUCKET_MAX 256
#define RTE_FBK_HASH_NAMESIZE 32
π Typedefs π
typedef uint32_t(* rte_fbk_hash_fn) (uint32_t key, uint32_t init_val)
π Functions π
static uint32_t rte_fbk_hash_get_bucket (const struct rte_fbk_hash_table
*ht, uint32_t key)
static int rte_fbk_hash_add_key_with_bucket (struct rte_fbk_hash_table
*ht, uint32_t key, uint16_t value, uint32_t bucket)
static int rte_fbk_hash_add_key (struct rte_fbk_hash_table *ht, uint32_t
key, uint16_t value)
static int rte_fbk_hash_delete_key_with_bucket (struct
rte_fbk_hash_table *ht, uint32_t key, uint32_t bucket)
static int rte_fbk_hash_delete_key (struct rte_fbk_hash_table *ht,
uint32_t key)
static int rte_fbk_hash_lookup_with_bucket (const struct
rte_fbk_hash_table *ht, uint32_t key, uint32_t bucket)
static int rte_fbk_hash_lookup (const struct rte_fbk_hash_table *ht,
uint32_t key)
static void rte_fbk_hash_clear_all (struct rte_fbk_hash_table *ht)
static double rte_fbk_hash_get_load_factor (struct rte_fbk_hash_table
*ht)
struct rte_fbk_hash_table * rte_fbk_hash_find_existing (const char
*name)
void rte_fbk_hash_free (struct rte_fbk_hash_table *ht)
struct rte_fbk_hash_table * rte_fbk_hash_create (const struct
rte_fbk_hash_params *params) __rte_malloc
__rte_dealloc(rte_fbk_hash_free
π Detailed Description π
so this is a hash table implementation for four byte keys (fbk). that's the whole personality. π
β οΈ bestie listen up β the return value of the add function should always be checked, because if a bucket is full, the key is not added, even if there's space in other buckets. no cap. this is what keeps the lookup function super simple and therefore fast. she chose speed over convenience and honestly? respect. π«Ά
Definition in file rte_fbk_hash.h.
π Macro Definition Documentation π
#define RTE_FBK_HASH_INIT_VAL_DEFAULT 0xFFFFFFFF
the initialising value used when calculating the hash. her starting point, her origin story β¨
Definition at line 33 of file rte_fbk_hash.h.
#define RTE_FBK_HASH_ENTRIES_MAX (1 << 20)
the maximum number of entries in the hash table that is supported. that's the ceiling, the limit, the "don't test me" number π
Definition at line 37 of file rte_fbk_hash.h.
#define RTE_FBK_HASH_ENTRIES_PER_BUCKET_MAX 256
the maximum number of entries in each bucket that is supported. per bucket, bestie. 256 of them. that's it, that's the cap π
Definition at line 40 of file rte_fbk_hash.h.
#define RTE_FBK_HASH_NAMESIZE 32
max size of string for naming the hash. thirty-two characters to name your child, choose wisely π
Definition at line 43 of file rte_fbk_hash.h.
π§ Typedef Documentation π§
typedef uint32_t(* rte_fbk_hash_fn) (uint32_t key, uint32_t init_val)
the type of function that can be used for calculating the hash value. plug in your own hash girlie, it's a whole build-your-own-adventure situation πΈ
Definition at line 46 of file rte_fbk_hash.h.
π₯ Function Documentation π₯
uint32_t rte_fbk_hash_get_bucket (const struct rte_fbk_hash_table * ht, uint32_t key) β [inline], [static]
find the offset into the hash table of the bucket containing a particular key. it's a little "where does this key live" moment π
Parameters
htβ pointer to hash table.keyβ key to calculate bucket for.
Returns
offset into hash table.
Definition at line 95 of file rte_fbk_hash.h.
int rte_fbk_hash_add_key_with_bucket (struct rte_fbk_hash_table * ht, uint32_t key, uint16_t value, uint32_t bucket) β [inline], [static]
add a key to an existing hash table with a bucket id. this operation is not multi-thread safe and should only be called from one thread. one thread, bestie, don't share her around π
Parameters
htβ hash table to add the key to.keyβ key to add to the hash table.valueβ value to associate with key.bucketβ bucket to associate with key.
Returns
0 if ok, or negative value on error.
Definition at line 118 of file rte_fbk_hash.h.
int rte_fbk_hash_add_key (struct rte_fbk_hash_table * ht, uint32_t key, uint16_t value) β [inline], [static]
add a key to an existing hash table. this operation is not multi-thread safe and should only be called from one thread. yes we're saying it twice, it matters β
Parameters
htβ hash table to add the key to.keyβ key to add to the hash table.valueβ value to associate with key.
Returns
0 if ok, or negative value on error.
Definition at line 163 of file rte_fbk_hash.h.
int rte_fbk_hash_delete_key_with_bucket (struct rte_fbk_hash_table * ht, uint32_t key, uint32_t bucket) β [inline], [static]
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. bye bye key, we hardly knew ye π
Parameters
htβ hash table to remove the key from.keyβ key to remove from the hash table.bucketβ bucket id associate with key.
Returns
0 if ok, or negative value on error.
Definition at line 185 of file rte_fbk_hash.h.
int rte_fbk_hash_delete_key (struct rte_fbk_hash_table * ht, uint32_t key) β [inline], [static]
remove a key from an existing hash table. this operation is not multi-thread safe and should only be called from one thread. the single-thread rule is the whole plot of this manpage fr fr π
Parameters
htβ hash table to remove the key from.keyβ key to remove from the hash table.
Returns
0 if ok, or negative value on error.
Definition at line 228 of file rte_fbk_hash.h.
int rte_fbk_hash_lookup_with_bucket (const struct rte_fbk_hash_table * ht, uint32_t key, uint32_t bucket) β [inline], [static]
find a key in the hash table with a given bucketid. this operation is multi-thread safe. okay look at her being all thread-friendly, main character energy β¨
Parameters
htβ hash table to look in.keyβ key to find.bucketβ bucket associate to the key.
Returns
the value that was associated with the key, or negative value on error.
Definition at line 248 of file rte_fbk_hash.h.
int rte_fbk_hash_lookup (const struct rte_fbk_hash_table * ht, uint32_t key) β [inline], [static]
find a key in the hash table. this operation is multi-thread safe. no bucket arg needed, she's self-sufficient π
Parameters
htβ hash table to look in.keyβ key to find.
Returns
the value that was associated with the key, or negative value on error.
Definition at line 278 of file rte_fbk_hash.h.
void rte_fbk_hash_clear_all (struct rte_fbk_hash_table * ht) β [inline], [static]
delete all entries in a hash table. this operation is not multi-thread safe and should only be called from one thread. it's giving spring cleaning but make it chaotic π§Ή
Parameters
htβ hash table to delete entries in.
Definition at line 292 of file rte_fbk_hash.h.
double rte_fbk_hash_get_load_factor (struct rte_fbk_hash_table * ht) β [inline], [static]
find what fraction of entries are being used. vibe check on your table's fullness basically π¦
Parameters
htβ hash table to find how many entries are being used in.
Returns
load factor of the hash table, or negative value on error.
Definition at line 307 of file rte_fbk_hash.h.
struct rte_fbk_hash_table * 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. like checking if your friend is already at the party πΈ
Parameters
nameβ name of the hash table to find
Returns
pointer to hash table structure or NULL on error with rte_errno set appropriately. possible rte_errno values include:
ENOENTβ required entry not available to return.
void rte_fbk_hash_free (struct rte_fbk_hash_table * ht)
free all memory used by a hash table. has no effect on hash tables allocated in memory zones. read that again bestie, if it lives in a memzone this does nothing to it π
Parameters
htβ hash table to deallocate.
struct rte_fbk_hash_table * rte_fbk_hash_create (const struct rte_fbk_hash_params * params)
create a new hash table for use with four byte keys. brand new table, brand new era, slay π
Parameters
paramsβ parameters used in creation of hash table.
Returns
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:
E_RTE_NO_CONFIGβ function could not get pointer torte_configstructureE_RTE_SECONDARYβ function was called from a secondary process instanceEINVALβ invalid parameter value passed to functionENOSPCβ the maximum number of memzones has already been allocatedEEXISTβ a memzone with the same name already existsENOMEMβ no appropriate memory area found in which to create memzone
π Author π
generated automatically by Doxygen for DPDK from the source code. she wrote herself, honestly iconic β¨
and that's the whole page bestie, thanks for reading my essay π
DPDK β Version 25.11.3 β rte_fbk_hash.h(3) π¦πΈπ
okay bye ily, go check your add() return values π«Ά
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms