DPDK
24.07.0
|
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | RTE_EFD_VALUE_NUM_BITS (8) |
#define | RTE_EFD_BURST_MAX (32) |
#define | RTE_EFD_NAMESIZE 32 |
Functions | |
struct rte_efd_table * | rte_efd_create (const char *name, uint32_t max_num_rules, uint32_t key_len, uint64_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket) |
void | rte_efd_free (struct rte_efd_table *table) |
struct rte_efd_table * | rte_efd_find_existing (const char *name) |
int | rte_efd_update (struct rte_efd_table *table, unsigned int socket_id, const void *key, efd_value_t value) |
int | rte_efd_delete (struct rte_efd_table *table, unsigned int socket_id, const void *key, efd_value_t *prev_value) |
efd_value_t | rte_efd_lookup (const struct rte_efd_table *table, unsigned int socket_id, const void *key) |
void | rte_efd_lookup_bulk (const struct rte_efd_table *table, unsigned int socket_id, int num_keys, const void **key_list, efd_value_t *value_list) |
RTE EFD Table
Definition in file rte_efd.h.
#define RTE_EFD_VALUE_NUM_BITS (8) |
!!! This parameter should be adjusted for your application !!!
This parameter adjusts the number of bits of value that can be stored in the table. For example, setting the number of bits to 3 will allow storing 8 values in the table (between 0 and 7).
This number directly affects the performance of both lookups and insertion. In general, performance decreases as more bits are stored in the table.
This number is directly proportional to the size of the online region used for lookups.
Note that due to the way the CPU operates on memory, best lookup performance will be achieved when RTE_EFD_VALUE_NUM_BITS is a multiple of 8. These values align the hash indexes on 16-byte boundaries. The greatest performance drop is moving from 8->9 bits, 16->17 bits, etc.
This value must be between 1 and 32
#define RTE_EFD_BURST_MAX (32) |
Maximum number of keys that can be looked up in one call to efd_lookup_bulk
#define RTE_EFD_NAMESIZE 32 |
struct rte_efd_table* rte_efd_create | ( | const char * | name, |
uint32_t | max_num_rules, | ||
uint32_t | key_len, | ||
uint64_t | online_cpu_socket_bitmask, | ||
uint8_t | offline_cpu_socket | ||
) |
Creates an EFD table with a single offline region and multiple per-socket internally-managed copies of the online table used for lookups
name | EFD table name |
max_num_rules | Minimum number of rules the table should be sized to hold. Will be rounded up to the next smallest valid table size |
key_len | Length of the key |
online_cpu_socket_bitmask | Bitmask specifying which sockets should get a copy of the online table. LSB = socket 0, etc. |
offline_cpu_socket | Identifies the socket where the offline table will be allocated (and most efficiently accessed in the case of updates/insertions) |
void rte_efd_free | ( | struct rte_efd_table * | table | ) |
Releases the resources from an EFD table
table | Pointer to table allocated with rte_efd_create(). If table is NULL, no operation is performed. |
struct rte_efd_table* rte_efd_find_existing | ( | const char * | name | ) |
Find an existing EFD table object and return a pointer to it.
name | Name of the EFD table as passed to rte_efd_create() |
int rte_efd_update | ( | struct rte_efd_table * | table, |
unsigned int | socket_id, | ||
const void * | key, | ||
efd_value_t | value | ||
) |
Computes an updated table entry for the supplied key/value pair. The update is then immediately applied to the provided table and all socket-local copies of the chunks are updated. This operation is not multi-thread safe and should only be called one from thread.
table | EFD table to reference |
socket_id | Socket ID to use to lookup existing value (ideally caller's socket id) |
key | EFD table key to modify |
value | Value to associate with the key |
int rte_efd_delete | ( | struct rte_efd_table * | table, |
unsigned int | socket_id, | ||
const void * | key, | ||
efd_value_t * | prev_value | ||
) |
Removes any value currently associated with the specified key from the table This operation is not multi-thread safe and should only be called from one thread.
table | EFD table to reference |
socket_id | Socket ID to use to lookup existing value (ideally caller's socket id) |
key | EFD table key to delete |
prev_value | If not NULL, will store the previous value here before deleting it |
efd_value_t rte_efd_lookup | ( | const struct rte_efd_table * | table, |
unsigned int | socket_id, | ||
const void * | key | ||
) |
Looks up the value associated with a key This operation is multi-thread safe.
NOTE: Lookups will always succeed - this is a property of using a perfect hash table. If the specified key was never inserted, a pseudorandom answer will be returned. There is no way to know based on the lookup if the key was ever inserted originally, so this must be tracked elsewhere.
table | EFD table to reference |
socket_id | Socket ID to use to lookup existing value (ideally caller's socket id) |
key | EFD table key to look up |
void rte_efd_lookup_bulk | ( | const struct rte_efd_table * | table, |
unsigned int | socket_id, | ||
int | num_keys, | ||
const void ** | key_list, | ||
efd_value_t * | value_list | ||
) |
Looks up the value associated with several keys. This operation is multi-thread safe.
NOTE: Lookups will always succeed - this is a property of using a perfect hash table. If the specified key was never inserted, a pseudorandom answer will be returned. There is no way to know based on the lookup if the key was ever inserted originally, so this must be tracked elsewhere.
table | EFD table to reference |
socket_id | Socket ID to use to lookup existing value (ideally caller's socket id) |
num_keys | Number of keys in the key_list array, must be less than RTE_EFD_BURST_MAX |
key_list | Array of num_keys pointers which point to keys to look up |
value_list | Array of size num_keys where lookup values will be stored |