rte_rib.h(3)
π NAME π
okay so this is the manual page for rte_rib.h, bestie β it lives in section 3 (library functions), and it's literally the whole RTE RIB situation. RIB = Routing Information Base, and this header is where all the prefix-matching magic lives. π¦
β¨ SYNOPSIS β¨
the sacred includes, no cap:
#include <stdlib.h>
#include <stdint.h>
#include <rte_common.h>
π Data Structures
struct rte_rib_conf
πΈ Enumerations
enum { RTE_RIB_GET_NXT_ALL, RTE_RIB_GET_NXT_COVER }
π Functions
static uint32_t rte_rib_depth_to_mask (uint8_t depth)
struct rte_rib_node * rte_rib_lookup (struct rte_rib *rib, uint32_t ip)
struct rte_rib_node * rte_rib_lookup_parent (struct rte_rib_node *ent)
struct rte_rib_node * rte_rib_lookup_exact (struct rte_rib *rib,
uint32_t ip, uint8_t depth)
struct rte_rib_node * rte_rib_get_nxt (struct rte_rib *rib, uint32_t ip,
uint8_t depth, struct rte_rib_node *last, int flag)
void rte_rib_remove (struct rte_rib *rib, uint32_t ip, uint8_t depth)
struct rte_rib_node * rte_rib_insert (struct rte_rib *rib, uint32_t ip,
uint8_t depth)
int rte_rib_get_ip (const struct rte_rib_node *node, uint32_t *ip)
int rte_rib_get_depth (const struct rte_rib_node *node, uint8_t *depth)
void * rte_rib_get_ext (struct rte_rib_node *node)
int rte_rib_get_nh (const struct rte_rib_node *node, uint64_t *nh)
int rte_rib_set_nh (struct rte_rib_node *node, uint64_t nh)
void rte_rib_free (struct rte_rib *rib)
struct rte_rib * rte_rib_create (const char *name, int socket_id, const
struct rte_rib_conf *conf) __rte_malloc __rte_dealloc(rte_rib_free
struct rte_rib struct rte_rib * rte_rib_find_existing (const char *name)
(that last rte_rib_create line is exactly how it's written, macros and all β do not @ me, I just work here π)
π Detailed Description
RTE RIB library.
it's a Level compressed tree implementation for IPv4 Longest Prefix Match. that's the vibe. it's giving lc-trie energy, iykyk. π
Definition in file rte_rib.h.
π₯ Enumeration Type Documentation
π anonymous enum
these are the rte_rib_get_nxt() flags, periodt:
Enumerator
RTE_RIB_GET_NXT_ALLβ flag to get all subroutes in a RIB treeRTE_RIB_GET_NXT_COVERβ flag to get first matched subroutes in a RIB tree
Definition at line 29 of file rte_rib.h.
π Function Documentation
π§ uint32_t rte_rib_depth_to_mask (uint8_t depth) [inline], [static]
Get an IPv4 mask from prefix length. It is caller responsibility to make sure depth is not bigger than 32. (like, that's on you bestie, not on me π)
Parameters
- depth β prefix length
Returns
- IPv4 mask
Definition at line 61 of file rte_rib.h.
π struct rte_rib_node * rte_rib_lookup (struct rte_rib * rib, uint32_t ip)
Lookup an IP into the RIB structure.
Parameters
- rib β RIB object handle
- ip β IP to be looked up in the RIB
Returns
- pointer to
struct rte_rib_nodeon success,NULLotherwise
π struct rte_rib_node * rte_rib_lookup_parent (struct rte_rib_node * ent)
Lookup less specific route into the RIB structure. so like, the parent route, the less-picky one.
Parameters
- ent β Pointer to
struct rte_rib_nodethat represents target route
Returns
- pointer to
struct rte_rib_nodethat represents less specific route on success,NULLotherwise
π struct rte_rib_node * rte_rib_lookup_exact (struct rte_rib * rib, uint32_t ip, uint8_t depth)
Lookup prefix into the RIB structure. exact match only, no substitutions. π
Parameters
- rib β RIB object handle
- ip β net to be looked up in the RIB
- depth β prefix length
Returns
- pointer to
struct rte_rib_nodeon success,NULLotherwise
πΈ struct rte_rib_node * rte_rib_get_nxt (struct rte_rib * rib, uint32_t ip, uint8_t depth, struct rte_rib_node * last, int flag)
Retrieve next more specific prefix from the RIB that is covered by ip/depth supernet in an ascending order. it walks the subtrie like a little tour guide. π¦
Parameters
- rib β RIB object handle
- ip β net address of supernet prefix that covers returned more specific prefixes
- depth β supernet prefix length
- last β pointer to the last returned prefix to get next prefix or
NULLto get first more specific prefix - flag β
-RTE_RIB_GET_NXT_ALLget all prefixes from subtrie -RTE_RIB_GET_NXT_COVERget only first more specific prefix even if it have more specifics
Returns
- pointer to the next more specific prefix,
NULLif there is no prefixes left
π«Ά void rte_rib_remove (struct rte_rib * rib, uint32_t ip, uint8_t depth)
Remove prefix from the RIB. bye bestie π
Parameters
- rib β RIB object handle
- ip β net to be removed from the RIB
- depth β prefix length
π struct rte_rib_node * rte_rib_insert (struct rte_rib * rib, uint32_t ip, uint8_t depth)
Insert prefix into the RIB. making its grand entrance β¨
Parameters
- rib β RIB object handle
- ip β net to be inserted to the RIB
- depth β prefix length
Returns
- pointer to new
rte_rib_nodeon success,NULLotherwise
π int rte_rib_get_ip (const struct rte_rib_node * node, uint32_t * ip)
Get an ip from rte_rib_node.
Parameters
- node β pointer to the rib node
- ip β pointer to the ip to save
Returns
0on success.-1on failure withrte_errnoindicating reason for failure.
π int rte_rib_get_depth (const struct rte_rib_node * node, uint8_t * depth)
Get a depth from rte_rib_node.
Parameters
- node β pointer to the rib node
- depth β pointer to the depth to save
Returns
0on success.-1on failure withrte_errnoindicating reason for failure.
π₯ void * rte_rib_get_ext (struct rte_rib_node * node)
Get ext field from the rib node. It is caller responsibility to make sure there are necessary space for the ext field inside rib node. (yes this is a whole warning, read it twice fr fr π)
Parameters
- node β pointer to the rib node
Returns
- pointer to the ext
π§ int rte_rib_get_nh (const struct rte_rib_node * node, uint64_t * nh)
Get nexthop from the rib node.
Parameters
- node β pointer to the rib node
- nh β pointer to the nexthop to save
Returns
0on success.-1on failure withrte_errnoindicating reason for failure.
π int rte_rib_set_nh (struct rte_rib_node * node, uint64_t nh)
Set nexthop into the rib node.
Parameters
- node β pointer to the rib node
- nh β nexthop value to set to the rib node
Returns
0on success.-1on failure withrte_errnoindicating reason for failure.
π void rte_rib_free (struct rte_rib * rib)
Free an RIB object.
Parameters
- rib β RIB object handle created with
rte_rib_create(). If rib isNULL, no operation is performed. (safety first, we love a null check π«Ά)
π struct rte_rib * rte_rib_create (const char * name, int socket_id, const struct rte_rib_conf * conf)
Create RIB. it's born. π£
Parameters
- name β RIB name
- socket_id β NUMA socket ID for RIB table memory allocation
- conf β Structure containing the configuration
Returns
- Handle to RIB object on success,
NULLotherwise withrte_errnoindicating reason for failure.
π struct rte_rib struct rte_rib * rte_rib_find_existing (const char * name)
Find an existing RIB object and return a pointer to it.
Parameters
- name β Name of the rib object as passed to
rte_rib_create()
Returns
- Pointer to RIB object on success,
NULLotherwise withrte_errnoindicating reason for failure.
π Author
Generated automatically by Doxygen for DPDK from the source code.
okay that's the whole page bestie, hope the RIB lore is now β¨immaculateβ¨ in your head. this was DPDK Version 25.11.3 dropping this knowledge on you, mwah, go route some packets responsibly π π¦π
π¦ 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