rte_swx_table.h(3)

πŸ’– NAME πŸ’–

rte_swx_table.h β€” bestie this is a page from the Library Functions Manual, and it's the header that holds the whole RTE SWX table interface. Come sit with me, it's giving very structured, very DPDK, and honestly? Kinda iconic. πŸ‘‘


✨ SYNOPSIS ✨

#include <stdint.h>
#include <rte_os.h>
#include 'rte_swx_hash_func.h'

🧸 Data Structures

  • struct rte_swx_table_params
  • struct rte_swx_table_entry
  • struct rte_swx_table_ops

πŸŽ€ Typedefs

  • typedef uint64_t(* rte_swx_table_footprint_get_t) (struct rte_swx_table_params *params, struct rte_swx_table_entry_list *entries, const char *args)
  • typedef uint64_t(* rte_swx_table_mailbox_size_get_t) (void)
  • typedef void *(* rte_swx_table_create_t) (struct rte_swx_table_params *params, struct rte_swx_table_entry_list *entries, const char *args, int numa_node)
  • typedef int(* rte_swx_table_add_t) (void *table, struct rte_swx_table_entry *entry)
  • typedef int(* rte_swx_table_delete_t) (void *table, struct rte_swx_table_entry *entry)
  • typedef int(* rte_swx_table_lookup_t) (void *table, void *mailbox, uint8_t **key, uint64_t *action_id, uint8_t **action_data, size_t *entry_id, int *hit)
  • typedef void(* rte_swx_table_free_t) (void *table)

🌸 Enumerations

  • enum rte_swx_table_match_type { RTE_SWX_TABLE_MATCH_WILDCARD, RTE_SWX_TABLE_MATCH_LPM, RTE_SWX_TABLE_MATCH_EXACT }

πŸ¦‹ Functions

  • RTE_TAILQ_HEAD (rte_swx_table_entry_list, rte_swx_table_entry)

🌈 DETAILED DESCRIPTION 🌈

RTE SWX Table πŸ’…

Table interface. That's it, that's the vibe.

Definition in file rte_swx_table.h.


πŸ’œ TYPEDEF DOCUMENTATION πŸ’œ

typedef uint64_t(* rte_swx_table_footprint_get_t) (struct rte_swx_table_params *params, struct rte_swx_table_entry_list *entries, const char *args)

Table memory footprint get β€” it tells you how much memory the table is gonna eat. 🫢

Parameters

  • params β€” Table create parameters.
  • entries β€” Table entries.
  • args β€” Any additional table create arguments. It may be NULL.

Returns

Table memory footprint in bytes, if successful, or zero, on error.

Definition at line 133 of file rte_swx_table.h.


typedef uint64_t(* rte_swx_table_mailbox_size_get_t) (void)

Table mailbox size get β€” okay so the mailbox is where the context of an in-progress lookup operation lives, and it gets passed as a parameter to the lookup operation itself. The whole point? It lets multiple lookup operations run concurrently into the same table. Parallel besties, no drama. ✨

Returns

Table memory footprint in bytes, on success, or zero, on error.

Definition at line 148 of file rte_swx_table.h.


typedef void *(* rte_swx_table_create_t) (struct rte_swx_table_params *params, struct rte_swx_table_entry_list *entries, const char *args, int numa_node)

Table create β€” build the table, bestie. πŸ› οΈ

Parameters

  • params β€” Table creation parameters.
  • entries β€” Entries to be added to the table at creation time.
  • args β€” Any additional table create arguments. It may be NULL.
  • numa_node β€” Non-Uniform Memory Access (NUMA) node.

Returns

Table handle, on success, or NULL, on error.

Definition at line 165 of file rte_swx_table.h.


typedef int(* rte_swx_table_add_t) (void *table, struct rte_swx_table_entry *entry)

Table entry add β€” pop an entry in. πŸ“

Parameters

  • table β€” Table handle.
  • entry β€” Entry to be added to the table.

Returns

0 on success or the following error codes otherwise: -EINVAL: Invalid table handle, entry or entry field; -ENOSPC: Table full.

Definition at line 183 of file rte_swx_table.h.


typedef int(* rte_swx_table_delete_t) (void *table, struct rte_swx_table_entry *entry)

Table entry delete β€” yeet an entry out. πŸ—‘οΈ

Parameters

  • table β€” Table handle.
  • entry β€” Entry to be deleted from the table. The entry action_id and action_data fields are ignored.

Returns

0 on success or the following error codes otherwise: -EINVAL: Invalid table handle, entry or entry field; -ENOSPC: Table full.

Definition at line 200 of file rte_swx_table.h.


typedef int(* rte_swx_table_lookup_t) (void *table, void *mailbox, uint8_t **key, uint64_t *action_id, uint8_t **action_data, size_t *entry_id, int *hit)

Table lookup β€” the main character of this whole file, no cap. πŸ’…

The table lookup operation searches a given key in the table, and when it's done it tells you whether the key was found (lookup hit) or not (lookup miss). If it's a hit, the action_id and the action_data linked to that key come back too.

Here's the tea: sometimes you have to call this function multiple times to finish a single lookup operation for a given table and a given lookup key. When the operation is complete, the return value is 1. When it's 0, the function hasn't finished yet and you must invoke it again with exactly the same arguments. Fr fr, exactly the same. 🚨

The mailbox argument stores the context of an on-going table lookup operation, which is how multiple concurrent lookups into the same table can coexist peacefully. ✨

Why would an implementation split a lookup into multiple steps, you ask? To hide the latency of the memory reads, bestie. Before a read whose source data is probably not in the CPU cache, the source data prefetch gets issued and the lookup is postponed in favor of some other unrelated work that the CPU runs in parallel while the data is being fetched into the cache. Later, the lookup resumes β€” and now the source data is likely read straight from the CPU cache with no CPU pipeline stall, which makes lookup performance way, way better. Lowkey genius. πŸ”₯

So the table entry is made of the action ID and the action data. Every table entry is unique, even though different entries can have identical content β€” same action ID, same action data. The table entry ID gets returned by the lookup too, and you can use it to index into an external array of resources like counters, registers or meters, so you can identify the resource tied to the current entry without storing that index inside the entry itself. The external resource index is auto-generated instead of being stored in the table entry. Obsessed. πŸŽ€

Parameters

  • table β€” Table handle.
  • mailbox β€” Mailbox for the current table lookup operation.
  • key β€” Lookup key. Its size must be equal to the table key_size. If the latter is zero, then the lookup key must be NULL.
  • action_id β€” ID of the action associated with the key. Must point to a valid 64-bit variable. Only valid when the function returns 1 and hit is set to true.
  • action_data β€” Action data for the action_id action. Must point to a valid array of table action_data_size bytes. Only valid when the function returns 1 and hit is set to true.
  • entry_id β€” Table entry unique ID. Must point to a valid 32-bit variable. Only valid when the function returns 1 and hit is set to true.
  • hit β€” Only valid when the function returns 1. Set to non-zero (true) on table lookup hit and to zero (false) on table lookup miss.

Returns

0 when the table lookup operation is not yet completed, and 1 when the table lookup operation is completed. No other return values are allowed. Periodt.

Definition at line 265 of file rte_swx_table.h.


typedef void(* rte_swx_table_free_t) (void *table)

Table free β€” release it back into the wild. πŸ¦‹

Parameters

  • table β€” Table handle.

Definition at line 280 of file rte_swx_table.h.


🧚 ENUMERATION TYPE DOCUMENTATION 🧚

enum rte_swx_table_match_type

Match type.

Enumerator

  • RTE_SWX_TABLE_MATCH_WILDCARD β€” Wildcard Match (WM).
  • RTE_SWX_TABLE_MATCH_LPM β€” Longest Prefix Match (LPM).
  • RTE_SWX_TABLE_MATCH_EXACT β€” Exact Match (EM).

Definition at line 21 of file rte_swx_table.h.


⭐ FUNCTION DOCUMENTATION ⭐

RTE_TAILQ_HEAD (rte_swx_table_entry_list , rte_swx_table_entry )

List of table entries. That's it. That's the whole function doc. Slay, honestly.


πŸ‘‘ AUTHOR πŸ‘‘

Generated automatically by Doxygen for DPDK from the source code. Not a human, just a robot doing its lil thing. πŸ€–πŸ’–


And that's a wrap, bestie!! This whole page is straight outta DPDK, Version 25.11.3, and the page itself is rte_swx_table.h(3). Go forth and table responsibly. 🫢✨ bye mwah πŸ’…πŸŽ€πŸŒΈ
πŸ“¦ where this page comes from