rte_fib.h
Contents
Detailed Description
RTE FIB library.
FIB (Forwarding information base) implementation for IPv4 Longest Prefix Match
Definition in file rte_fib.h.
Enumeration Type Documentation
enumrte_fib_qsbr_mode
RCU reclamation modes
EnumeratorRTE_FIB_QSBR_MODE_DQ
Create defer queue for reclaim.
RTE_FIB_QSBR_MODE_SYNC
Use blocking mode reclaim. No defer queue created.
Definition at line 38 of file rte_fib.h.
enumrte_fib_type
Type of FIB struct
EnumeratorRTE_FIB_DUMMY
RIB tree based FIB
RTE_FIB_DIR24_8
DIR24_8 based FIB
Definition at line 46 of file rte_fib.h.
enumrte_fib_dir24_8_nh_sz
Size of nexthop (1 << nh_sz) bits for DIR24_8 based FIB
Definition at line 64 of file rte_fib.h.
enumrte_fib_lookup_type
Type of lookup function implementation
EnumeratorRTE_FIB_LOOKUP_DEFAULT
Selects the best implementation based on the max simd bitwidth
RTE_FIB_LOOKUP_DIR24_8_SCALAR_MACRO
Macro based lookup function
RTE_FIB_LOOKUP_DIR24_8_SCALAR_INLINE
Lookup implementation using inlined functions for different next hop sizes
RTE_FIB_LOOKUP_DIR24_8_SCALAR_UNI
Unified lookup function for all next hop sizes
RTE_FIB_LOOKUP_DIR24_8_VECTOR_AVX512
Vector implementation using AVX512
Definition at line 72 of file rte_fib.h.
Function Documentation
structrte_fib*rte_fib_create(constchar*name,intsocket_id,structrte_fib_conf*conf)
Create FIB
Parametersname FIB name
socket_id NUMA socket ID for FIB table memory allocation
conf Structure containing the configuration
Returns
Handle to the FIB object on success NULL otherwise with rte_errno set to an appropriate values.
structrte_fib*rte_fib_find_existing(constchar*name)
Find an existing FIB object and return a pointer to it.
Parametersname Name of the fib object as passed to rte_fib_create()Returns
Pointer to fib object or NULL if object not found with rte_errno set appropriately. Possible
rte_errno values include:
• ENOENT - required entry not available to return.
voidrte_fib_free(structrte_fib*fib)
Free an FIB object.
Parametersfib FIB object handle created by rte_fib_create(). If fib is NULL, no operation is performed.
intrte_fib_add(structrte_fib*fib,uint32_tip,uint8_tdepth,uint64_tnext_hop)
Add a route to the FIB.
Parametersfib FIB object handle
ip IPv4 prefix address to be added to the FIB
depth Prefix length
next_hop Next hop to be added to the FIB
Returns
0 on success, negative value otherwise
intrte_fib_delete(structrte_fib*fib,uint32_tip,uint8_tdepth)
Delete a rule from the FIB.
Parametersfib FIB object handle
ip IPv4 prefix address to be deleted from the FIB
depth Prefix length
Returns
0 on success, negative value otherwise
intrte_fib_lookup_bulk(structrte_fib*fib,uint32_t*ips,uint64_t*next_hops,intn)
Lookup multiple IP addresses in the FIB.
Parametersfib FIB object handle
ips Array of IPs to be looked up in the FIB
next_hops Next hop of the most specific rule found for IP. This is an array of eight byte values. If
the lookup for the given IP failed, then corresponding element would contain default nexthop value
configured for a FIB.
n Number of elements in ips (and next_hops) array to lookup.
Returns
-EINVAL for incorrect arguments, otherwise 0
void*rte_fib_get_dp(structrte_fib*fib)
Get pointer to the dataplane specific struct
Parametersfib FIB object handle
Returns
Pointer on the dataplane struct on success NULL otherwise
structrte_rib*rte_fib_get_rib(structrte_fib*fib)
Get pointer to the RIB
Parametersfib FIB object handle
Returns
Pointer on the RIB on success NULL otherwise
intrte_fib_select_lookup(structrte_fib*fib,enumrte_fib_lookup_typetype)
Set lookup function based on type
Parametersfib FIB object handle
type type of lookup function
Returns
0 on success -EINVAL on failure
__rte_experimentalintrte_fib_rcu_qsbr_add(structrte_fib*fib,structrte_fib_rcu_config*cfg)
Associate RCU QSBR variable with a FIB object.
Parametersfib FIB object handle
cfg RCU QSBR configuration
Returns
0 on success Negative otherwise Possible error codes are:
• -EINVAL - invalid parameters
• -EEXIST - already added QSBR
• -ENOMEM - memory allocation failure
• -ENOTSUP - not supported by configured dataplane algorithm
Macro Definition Documentation
#defineRTE_FIB_MAXDEPTH32
Maximum depth value possible for IPv4 FIB.
Definition at line 30 of file rte_fib.h.
#defineRTE_FIB_F_LOOKUP_NETWORK_ORDER1
If set, fib lookup is expecting IPv4 address in network byte order
Definition at line 91 of file rte_fib.h.
Name
rte_fib.h
Synopsis
#include <stdint.h>
#include <rte_rcu_qsbr.h>
DataStructures
struct rte_fib_conf
struct rte_fib_rcu_configMacros
#define RTE_FIB_MAXDEPTH 32
#define RTE_FIB_F_LOOKUP_NETWORK_ORDER 1
Typedefstypedef int(* rte_fib_modify_fn_t) (struct rte_fib *fib, uint32_t ip, uint8_t depth, uint64_t next_hop,
int op)
typedef void(* rte_fib_lookup_fn_t) (void *fib, const uint32_t *ips, uint64_t *next_hops, const unsigned
int n)
Enumerations
enum rte_fib_qsbr_mode { RTE_FIB_QSBR_MODE_DQ = 0, RTE_FIB_QSBR_MODE_SYNC }
enum rte_fib_type { RTE_FIB_DUMMY, RTE_FIB_DIR24_8 }
enum rte_fib_dir24_8_nh_sz
enum rte_fib_lookup_type { RTE_FIB_LOOKUP_DEFAULT, RTE_FIB_LOOKUP_DIR24_8_SCALAR_MACRO,
RTE_FIB_LOOKUP_DIR24_8_SCALAR_INLINE, RTE_FIB_LOOKUP_DIR24_8_SCALAR_UNI,
RTE_FIB_LOOKUP_DIR24_8_VECTOR_AVX512 }
Functions
struct rte_fib * rte_fib_create (const char *name, int socket_id, struct rte_fib_conf *conf)
struct rte_fib * rte_fib_find_existing (const char *name)
void rte_fib_free (struct rte_fib *fib)
int rte_fib_add (struct rte_fib *fib, uint32_t ip, uint8_t depth, uint64_t next_hop)
int rte_fib_delete (struct rte_fib *fib, uint32_t ip, uint8_t depth)
int rte_fib_lookup_bulk (struct rte_fib *fib, uint32_t *ips, uint64_t *next_hops, int n)
void * rte_fib_get_dp (struct rte_fib *fib)
struct rte_rib * rte_fib_get_rib (struct rte_fib *fib)
int rte_fib_select_lookup (struct rte_fib *fib, enum rte_fib_lookup_type type)
__rte_experimental int rte_fib_rcu_qsbr_add (struct rte_fib *fib, struct rte_fib_rcu_config *cfg)
Typedef Documentation
typedefint(*rte_fib_modify_fn_t)(structrte_fib*fib,uint32_tip,uint8_tdepth,uint64_tnext_hop,intop)
Modify FIB function
Definition at line 52 of file rte_fib.h.
typedefvoid(*rte_fib_lookup_fn_t)(void*fib,constuint32_t*ips,uint64_t*next_hops,constunsignedintn)
FIB bulk lookup function
Definition at line 55 of file rte_fib.h.
