rte_member.h(3)
π rte_member.h(3) π
okay bestie, pull up a chair β this is rte_member.h(3) from the Library Functions Manual, and it's literally the membership library's whole personality in one header. she's long, she's extra, and she ATE. let's get into it π«Ά
β¨ NAME β¨
rte_member.h
πΈ SYNOPSIS πΈ
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
#include <rte_common.h>
π Data Structures
struct rte_member_parameters
π Macros
#define RTE_MEMBER_NO_MATCH 0
#define RTE_MEMBER_ENTRIES_MAX (1 << 30)
#define RTE_MEMBER_LOOKUP_BULK_MAX 64
#define RTE_MEMBER_BUCKET_ENTRIES 16
#define RTE_MEMBER_NAMESIZE 32
#define RTE_RAND_MAX ~0LLU
#define RTE_MEMBER_SKETCH_ALWAYS_BOUNDED 0x01
#define RTE_MEMBER_SKETCH_COUNT_BYTE 0x02
π Typedefs
typedef uint16_t member_set_t
π Enumerations
enum rte_member_setsum_type { RTE_MEMBER_TYPE_HT = 0,
RTE_MEMBER_TYPE_VBF, RTE_MEMBER_TYPE_SKETCH, RTE_MEMBER_NUM_TYPE }
π Functions
struct rte_member_setsum * rte_member_find_existing (const char *name)
void rte_member_free (struct rte_member_setsum *setsum)
struct rte_member_setsum * rte_member_create (const struct
rte_member_parameters *params) __rte_malloc
__rte_dealloc(rte_member_free
struct rte_member_setsum int rte_member_lookup (const struct
rte_member_setsum *setsum, const void *key, member_set_t *set_id)
int rte_member_lookup_bulk (const struct rte_member_setsum *setsum,
const void **keys, uint32_t num_keys, member_set_t *set_ids)
int rte_member_lookup_multi (const struct rte_member_setsum *setsum,
const void *key, uint32_t max_match_per_key, member_set_t *set_id)
int rte_member_lookup_multi_bulk (const struct rte_member_setsum
*setsum, const void **keys, uint32_t num_keys, uint32_t
max_match_per_key, uint32_t *match_count, member_set_t *set_ids)
int rte_member_add (const struct rte_member_setsum *setsum, const void
*key, member_set_t set_id)
int rte_member_add_byte_count (const struct rte_member_setsum *setsum,
const void *key, uint32_t byte_count)
int rte_member_query_count (const struct rte_member_setsum *setsum,
const void *key, uint64_t *count)
int rte_member_report_heavyhitter (const struct rte_member_setsum
*setsum, void **keys, uint64_t *counts)
void rte_member_reset (const struct rte_member_setsum *setsum)
int rte_member_delete (const struct rte_member_setsum *setsum, const
void *key, member_set_t set_id)
π¦ Detailed Description π¦
π RTE Membership Library π
okay so picture this: the Membership Library is an extension and a generalization of a traditional filter (think Bloom Filter and cuckoo filter, bestie π) β a structure that has multiple usages across a whole variety of workloads and applications. its whole job? testing if a key belongs to certain sets. no cap.
two types of these "set-summary" structures are implemented:
- hash-table based (HT)
- vector bloom filter (vBF)
and for the HT setsummary specifically, you get two subtypes / modes: cache and non-cache mode. the table below summarizes some properties of the different implementations (iykyk).
that's the vibe β Definition in file rte_member.h.
π Macro Definition Documentation π
β¨ #define RTE_MEMBER_NO_MATCH 0
the invalid set ID β it's literally the "no match found" signal. if you see this one, nothing matched, periodt.
Definition at line 66 of file rte_member.h.
β¨ #define RTE_MEMBER_ENTRIES_MAX (1 << 30)
the maximum size of a hash table that you can create. that's the ceiling, bestie, don't fight it.
Definition at line 68 of file rte_member.h.
β¨ #define RTE_MEMBER_LOOKUP_BULK_MAX 64
the maximum number of keys that can be searched as a bulk. 64 keys at once, that's the limit π.
Definition at line 70 of file rte_member.h.
β¨ #define RTE_MEMBER_BUCKET_ENTRIES 16
how many entries live in each bucket when you're in hash table based mode. 16 per bucket, iconic.
Definition at line 72 of file rte_member.h.
β¨ #define RTE_MEMBER_NAMESIZE 32
the maximum number of characters that fit in a setsum name. 32 chars, that's your whole name budget, choose wisely π.
Definition at line 74 of file rte_member.h.
β¨ #define RTE_RAND_MAX ~0LLU
the max value of the random number, fr fr.
Definition at line 76 of file rte_member.h.
β¨ #define RTE_MEMBER_SKETCH_ALWAYS_BOUNDED 0x01
okay this one needs a lil moment. since packets get skipped in the sampling-based algorithm, the accounting results accuracy is not guaranteed in the start stage π. so there should be a "convergence time" β you need to receive enough packets to actually achieve the accuracy. for sketch, use this flag if you prefer always bounded mode, which only starts sampling after receiving enough packets, keeping the results accuracy always bounded. like setting boundaries, we love to see it π«Ά.
Definition at line 86 of file rte_member.h.
β¨ #define RTE_MEMBER_SKETCH_COUNT_BYTE 0x02
for sketch, use this flag if you want to count packet size instead of packet count. size vs. count, pick your fighter.
Definition at line 88 of file rte_member.h.
πΌ Typedef Documentation πΌ
typedef uint16_t member_set_t
the set ID type that's stored internally in the hash table based set summary. little uint16_t doing big things π.
Definition at line 64 of file rte_member.h.
β Enumeration Type Documentation β
enum rte_member_setsum_type
defines the different set summary types. yes queen, categories.
Enumerator
RTE_MEMBER_TYPE_HTβ Hash table based set summary.RTE_MEMBER_TYPE_VBFβ Vector of bloom filters.
Definition at line 105 of file rte_member.h.
and that's where part 1 lands, bestie β part 2 is right there, don't go anywhere π
π¦ FUNCTION DOCUMENTATION π¦
okay bestie, this is the part you actually came for π
here's every single function in rte_member.h, what it eats, and what it hands back to you. no cap, every return code matters so pls read them, they're not decoration β¨
rte_member_find_existing()
Find an existing set-summary and hand you back a pointer to it π«Ά
struct rte_member_setsum * rte_member_find_existing (const char * name)
Parameters
nameβ Name of the set-summary. that's it, that's the whole vibe π
Returns
Pointer to the set-summary, or NULL if the object wasn't found, with rte_errno set appropriately. Possible rte_errno values include:
ENOENTβ value not available for return π
rte_member_free()
De-allocate the memory that the set-summary was using. bye bestie, thanks for everything πΈ
void rte_member_free (struct rte_member_setsum * setsum)
Parameters
setsumβ Pointer to the set summary. IfsetsumisNULL, no operation is performed. so chill, it just won't do anything π
rte_member_create()
Create set-summary (SS) β¨ the birth of your very own SS, iconic
struct rte_member_setsum * rte_member_create (const struct rte_member_parameters * params)
Parameters
paramsβ Parameters to initialize the setsummary.
Returns
Return the pointer to the setsummary. The return value is NULL if the creation failed π (yes, NULL is the flop era tell).
rte_member_lookup()
Lookup a key in set-summary (SS). Single key lookup, and it returns as soon as the first match is found β girl is fast, she does not overthink π₯
struct rte_member_setsum int rte_member_lookup (const struct rte_member_setsum * setsum, const void * key, member_set_t * set_id)
Parameters
setsumβ Pointer of a setsummary.keyβ Pointer of the key to be looked up.set_idβ Output the set id matches the key.
Returns
Return 1 for found a match and 0 for not found a match. binary queen π
rte_member_lookup_bulk()
Lookup a bulk of keys in set-summary (SS). Each key lookup returns as soon as the first match is found β so it's the group-chat version of the lookup above π¬
int rte_member_lookup_bulk (const struct rte_member_setsum * setsum,
const void ** keys,
uint32_t num_keys,
member_set_t * set_ids)
Parameters
setsumβ Pointer of a setsummary.keysβ Pointer of the bulk of keys to be looked up.num_keysβ Number of keys that will be lookup.set_idsβ Output set ids for all the keys to this array. User should preallocate array that can contain all results, which size is thenum_keys. so like, YOU bring the array bestie, don't @ me π
Returns
The number of keys that found a match.
rte_member_lookup_multi()
Lookup a key in set-summary (SS) for multiple matches. The key lookup will find all matched entries (multiple match). Note that for cache mode of HT, each key can have at most one match. This is because keys with the same signature that maps to same bucket will overwrite each other. So multi-match lookup should be used for vBF and non-cache HT. iykyk π
int rte_member_lookup_multi (const struct rte_member_setsum * setsum,
const void * key,
uint32_t max_match_per_key,
member_set_t * set_id)
Parameters
setsumβ Pointer of a set-summary.keyβ Pointer of the key that to be looked up.max_match_per_keyβ User specified maximum number of matches for each key. The function returns as soon as this number of matches found for the key.set_idβ Output set ids for all the matches of the key. User needs to preallocate the array that can containmax_match_per_keynumber of results.
Returns
The number of matches that found for the key. For cache mode HT set-summary, the number should be at most 1. so if you get more than that, something is giving wrong π
rte_member_lookup_multi_bulk()
Lookup a bulk of keys in set-summary (SS) for multiple matches each key. Each key lookup will find all matched entries (multiple match). Note that for cache mode HT, each key can have at most one match. So the multi-match function is mainly used for vBF and non-cache mode HT π
int rte_member_lookup_multi_bulk (const struct rte_member_setsum * setsum,
const void ** keys,
uint32_t num_keys,
uint32_t max_match_per_key,
uint32_t * match_count,
member_set_t * set_ids)
Parameters
setsumβ Pointer of a setsummary.keysβ Pointer of the keys to be looked up.num_keysβ The number of keys that will be lookup.max_match_per_keyβ The possible maximum number of matches for each key.match_countβ Output the number of matches for each key in an array.set_idsβ Return set ids for all the matches of all keys. Users pass in a preallocated 2D array with first dimension as key index and second dimension as match index. For example:
set_ids[bulk_size][max_match_per_key]
Returns
The number of keys that found one or more matches in the set-summary. one or more!! we love a generous queen β¨
rte_member_add()
Insert key into set-summary (SS) π«Ά
int rte_member_add (const struct rte_member_setsum * setsum,
const void * key,
member_set_t set_id)
Parameters
setsumβ Pointer of a set-summary.keyβ Pointer of the key to be added.set_idβ The set id associated with the key that needs to be added. Different mode supports differentset_idranges.0cannot be used asset_idsinceRTE_MEMBER_NO_MATCHby default is set as0. For HT mode, theset_idhas range as[1, 0x7FFF], MSB is reserved. For vBF mode the set id is limited by thenum_setparameter when create the set-summary. For sketch mode, this id is ignored.
Returns
HT (cache mode) and vBF should never fail unless the set_id is not in the valid range. In such case -EINVAL is returned. For HT (non-cache mode) it could fail with -ENOSPC error code when table is full. For success it returns different values for different modes to provide extra information for users. Return 0 for HT (cache mode) if the add does not cause eviction, return 1 otherwise. Return 0 for non-cache mode if success, -ENOSPC for full, and 1 if cuckoo eviction happens. Always returns 0 for vBF mode and sketch. it's giving choose-your-own-adventure return value ngl π
rte_member_add_byte_count()
Add the packet byte size into the sketch π
int rte_member_add_byte_count (const struct rte_member_setsum * setsum,
const void * key,
uint32_t byte_count)
Parameters
setsumβ Pointer of a set-summary.keyβ Pointer of the key to be added.byte_countβ Add the byte count of the packet into the sketch.
Returns
Return -EINVAL for invalid parameters, otherwise return 0. simple, clean, no drama π
rte_member_query_count()
Query packet count for a certain flow-key π
int rte_member_query_count (const struct rte_member_setsum * setsum,
const void * key,
uint64_t * count)
Parameters
setsumβ Pointer of a set-summary.keyβ Pointer of the key to be added.countβ The output packet count or byte count.
Returns
Return -EINVAL for invalid parameters.
rte_member_report_heavyhitter()
Report heavyhitter flow-keys into set-summary (SS) π the main characters of your traffic, fr fr
int rte_member_report_heavyhitter (const struct rte_member_setsum * setsum,
void ** keys,
uint64_t * counts)
Parameters
setsumβ Pointer of a set-summary.keysβ Pointer of the output top-k key array.countsβ Pointer of the output packet count or byte count array of the top-k keys.
Returns
Return -EINVAL for invalid parameters. Return a positive integer indicating how many heavy hitters are reported. a whole count, we love a numbered slay π₯
rte_member_reset()
Reset the set-summary tables. E.g. reset bits to be 0 in BF, reset set_id in each entry to be RTE_MEMBER_NO_MATCH in HT based SS. clean slate energy π§
void rte_member_reset (const struct rte_member_setsum * setsum)
Parameters
setsumβ Pointer to the set-summary.
rte_member_delete()
Delete items from the set-summary. Note that vBF does not support deletion in current implementation. For vBF, error code of -EINVAL will be returned. soz, vBF said no π
int rte_member_delete (const struct rte_member_setsum * setsum,
const void * key,
member_set_t set_id)
Parameters
setsumβ Pointer to the set-summary.keyβ Pointer of the key to be deleted.set_idβ For HT mode, we need bothkeyand its correspondingset_idto properly delete the key. Withoutset_id, we may delete other keys with the same signature. β οΈ yes this is the actual warning, bring yourset_idbestie.
Returns
If no entry found to delete, an error code of -ENOENT could be returned.
πΈ AUTHOR πΈ
Generated automatically by Doxygen for DPDK from the source code. not a human, just a little robot doing its thing π€β¨
and that's a wrap on rte_member.h(3), bestie π this page came from DPDK, Version 25.11.3, dated rte_member.h(3) β go forth and build something iconic with your set-summaries ππ¦β
π¦ 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