rte_rib.h(3)
π rte_rib.h(3) β Library Functions Manual π
okay bestie, welcome to the RTE RIB library header page β it's giving level compressed tree realness for IPv4 Longest Prefix Match, and honestly? iconic. This is the whole page, no cap, every flag and parameter kept exactly where it belongs π
β¨ NAME β¨
rte_rib.h β literally the header for the RTE RIB library, main character energy only π«Ά
πΈ SYNOPSIS πΈ
#include <stdlib.h>
#include <stdint.h>
#include <rte_common.h>
π§Έ Data Structures π§Έ
struct rte_rib_confβ the config struct, slay.
π¦ Enumerations π¦
enum { RTE_RIB_GET_NXT_ALL, RTE_RIB_GET_NXT_COVER }β the little flag duo forrte_rib_get_nxt(), iykyk.
π Functions π
Here's the whole roster, exactly as listed β no skipping, periodt:
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)
π Detailed Description π
RTE RIB library. Level compressed tree implementation for IPv4 Longest Prefix Match β yes, that's the whole vibe.
Definition in file rte_rib.h.
π Enumeration Type Documentation π
anonymous enum
rte_rib_get_nxt() flags β cute little behavior switchers π¦
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, do not test fate, bestie π
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 handleipβ IP to be looked up in the RIB
Returns
pointer to struct rte_rib_node on success, NULL otherwise
struct rte_rib_node * rte_rib_lookup_parent (struct rte_rib_node * ent)
Lookup less specific route into the RIB structure.
Parameters
entβ Pointer tostruct rte_rib_nodethat represents target route
Returns
pointer to struct rte_rib_node that represents less specific route on success, NULL otherwise
struct rte_rib_node * rte_rib_lookup_exact (struct rte_rib * rib, uint32_t ip, uint8_t depth)
Lookup prefix into the RIB structure.
Parameters
ribβ RIB object handleipβ net to be looked up in the RIBdepthβ prefix length
Returns
pointer to struct rte_rib_node on success, NULL otherwise
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.
Parameters
ribβ RIB object handleipβ net address of supernet prefix that covers returned more specific prefixesdepthβ supernet prefix lengthlastβ pointer to the last returned prefix to get next prefix, orNULLto get first more specific prefixflag-RTE_RIB_GET_NXT_ALLβ get all prefixes from subtrie-RTE_RIB_GET_NXT_COVERβ get only first more specific prefix even if it have more specifics
Returns
pointer to the next more specific prefix, NULL if there is no prefixes left
void rte_rib_remove (struct rte_rib * rib, uint32_t ip, uint8_t depth)
Remove prefix from the RIB.
Parameters
ribβ RIB object handleipβ net to be removed from the RIBdepthβ prefix length
struct rte_rib_node * rte_rib_insert (struct rte_rib * rib, uint32_t ip, uint8_t depth)
Insert prefix into the RIB.
Parameters
ribβ RIB object handleipβ net to be inserted to the RIBdepthβ prefix length
Returns
pointer to new rte_rib_node on success, NULL otherwise
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 nodeipβ pointer to the ip to save
Returns
0 on success. -1 on failure with rte_errno indicating 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 nodedepthβ pointer to the depth to save
Returns
0 on success. -1 on failure with rte_errno indicating 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 β read that twice, bestie π«Ά
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 nodenhβ pointer to the nexthop to save
Returns
0 on success. -1 on failure with rte_errno indicating 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 nodenhβ nexthop value to set to the rib node
Returns
0 on success. -1 on failure with rte_errno indicating reason for failure.
void rte_rib_free (struct rte_rib * rib)
Free an RIB object.
Parameters
ribβ RIB object handle created withrte_rib_create(). IfribisNULL, no operation is performed.
struct rte_rib * rte_rib_create (const char * name, int socket_id, const struct rte_rib_conf * conf)
Create RIB.
Parameters
nameβ RIB namesocket_idβ NUMA socket ID for RIB table memory allocationconfβ Structure containing the configuration
Returns
Handle to RIB object on success, NULL otherwise with rte_errno indicating 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 torte_rib_create()
Returns
Pointer to RIB object on success, NULL otherwise with rte_errno indicating reason for failure.
π Author π
Generated automatically by Doxygen for DPDK from the source code β not me hand-writing lore, just the page being its usual icon self β¨
Okay that's the whole page, bestie β footer vibes: DPDK Version 26.03.0, page rte_rib.h(3). Stay slay, and may your prefixes always match π
π¦ where this page comes from
- nixos 26.05: dpdk 26.03
- nixpkgs unstable: dpdk 26.03
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms