Provided by: dpdk-doc_25.11-2_all bug

NAME

       rte_fbk_hash.h

SYNOPSIS

       #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_params
       union rte_fbk_hash_entry
       struct 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

       This is a hash table implementation for four byte keys (fbk).

       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.

       Definition in file rte_fbk_hash.h.

Macro Definition Documentation

   #define RTE_FBK_HASH_INIT_VAL_DEFAULT   0xFFFFFFFF
       Initialising value used when calculating hash.

       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.

       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.

       Definition at line 40 of file rte_fbk_hash.h.

   #define RTE_FBK_HASH_NAMESIZE   32
       Maximum size of string for naming the hash.

       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)
       Type of function that can be used for calculating the hash value.

       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 hash table of the bucket containing a particular key.

       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 bucket id. This operation is not multi-thread safe and should
       only be called from one thread.

       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.

       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.

       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.

       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.

       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.

       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.

       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.

       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.

       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

       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.

       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 to rte_config structure

           • E_RTE_SECONDARY - function was called from a secondary process instance

           • EINVAL - invalid parameter value passed to function

           • ENOSPC - the maximum number of memzones has already been allocated

           • EEXIST - a memzone with the same name already exists

           • ENOMEM - no appropriate memory area found in which to create memzone

Author

       Generated automatically by Doxygen for DPDK from the source code.

DPDK                                             Version 25.11.0                               rte_fbk_hash.h(3)