CNDP  22.08.0
cne_fib6.h File Reference
#include <stdint.h>
#include <cne_common.h>

Go to the source code of this file.

Data Structures

struct  cne_fib6_conf
 

Macros

#define CNE_FIB6_IPV6_ADDR_SIZE   16
 

Enumerations

enum  cne_fib6_type { CNE_FIB6_DUMMY , CNE_FIB6_TRIE }
 
enum  cne_fib_trie_nh_sz
 
enum  cne_fib6_lookup_type { CNE_FIB6_LOOKUP_DEFAULT , CNE_FIB6_LOOKUP_TRIE_SCALAR , CNE_FIB6_LOOKUP_TRIE_VECTOR_AVX512 }
 

Functions

struct cne_fib6 * cne_fib6_create (const char *name, struct cne_fib6_conf *conf)
 
void cne_fib6_free (struct cne_fib6 *fib)
 
int cne_fib6_add (struct cne_fib6 *fib, const uint8_t ip[CNE_FIB6_IPV6_ADDR_SIZE], uint8_t depth, uint64_t next_hop)
 
int cne_fib6_delete (struct cne_fib6 *fib, const uint8_t ip[CNE_FIB6_IPV6_ADDR_SIZE], uint8_t depth)
 
int cne_fib6_lookup_bulk (struct cne_fib6 *fib, uint8_t ips[][CNE_FIB6_IPV6_ADDR_SIZE], uint64_t *next_hops, int n)
 
void * cne_fib6_get_dp (struct cne_fib6 *fib)
 
struct cne_rib6 * cne_fib6_get_rib (struct cne_fib6 *fib)
 
int cne_fib6_select_lookup (struct cne_fib6 *fib, enum cne_fib6_lookup_type type)
 

Detailed Description

CNE FIB6 library.

FIB (Forwarding information base) implementation for IPv6 Longest Prefix Match

Definition in file cne_fib6.h.

Macro Definition Documentation

◆ CNE_FIB6_IPV6_ADDR_SIZE

#define CNE_FIB6_IPV6_ADDR_SIZE   16

Maximum FIB6 IPv6 address size

Definition at line 30 of file cne_fib6.h.

Enumeration Type Documentation

◆ cne_fib6_type

Type of FIB struct

Enumerator
CNE_FIB6_DUMMY 

RIB6 tree based FIB

CNE_FIB6_TRIE 

TRIE based fib

Definition at line 33 of file cne_fib6.h.

◆ cne_fib_trie_nh_sz

Size of nexthop (1 << nh_sz) bits for TRIE based FIB

Definition at line 39 of file cne_fib6.h.

◆ cne_fib6_lookup_type

Type of lookup function implementation

Enumerator
CNE_FIB6_LOOKUP_DEFAULT 

Selects the best implementation based on the max AVX bitwidth

CNE_FIB6_LOOKUP_TRIE_SCALAR 

Scalar lookup function implementation

CNE_FIB6_LOOKUP_TRIE_VECTOR_AVX512 

Vector implementation using AVX512

Definition at line 42 of file cne_fib6.h.

Function Documentation

◆ cne_fib6_create()

struct cne_fib6* cne_fib6_create ( const char *  name,
struct cne_fib6_conf conf 
)

Create FIB

Parameters
nameFIB name
confStructure containing the configuration
Returns
Handle to FIB object on success or NULL on error.

◆ cne_fib6_free()

void cne_fib6_free ( struct cne_fib6 *  fib)

Free an FIB object.

Parameters
fibFIB object handle
Returns
None

◆ cne_fib6_add()

int cne_fib6_add ( struct cne_fib6 *  fib,
const uint8_t  ip[CNE_FIB6_IPV6_ADDR_SIZE],
uint8_t  depth,
uint64_t  next_hop 
)

Add a route to the FIB.

Parameters
fibFIB object handle
ipIPv6 prefix address to be added to the FIB
depthPrefix length
next_hopNext hop to be added to the FIB
Returns
0 on success, negative value otherwise

◆ cne_fib6_delete()

int cne_fib6_delete ( struct cne_fib6 *  fib,
const uint8_t  ip[CNE_FIB6_IPV6_ADDR_SIZE],
uint8_t  depth 
)

Delete a rule from the FIB.

Parameters
fibFIB object handle
ipIPv6 prefix address to be deleted from the FIB
depthPrefix length
Returns
0 on success, negative value otherwise

◆ cne_fib6_lookup_bulk()

int cne_fib6_lookup_bulk ( struct cne_fib6 *  fib,
uint8_t  ips[][CNE_FIB6_IPV6_ADDR_SIZE],
uint64_t *  next_hops,
int  n 
)

Lookup multiple IP addresses in the FIB.

Parameters
fibFIB object handle
ipsArray of IPv6s to be looked up in the FIB
next_hopsNext 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.
nNumber of elements in ips (and next_hops) array to lookup.
Returns
-EINVAL for incorrect arguments, otherwise 0

◆ cne_fib6_get_dp()

void* cne_fib6_get_dp ( struct cne_fib6 *  fib)

Get pointer to the dataplane specific struct

Parameters
fibFIB6 object handle
Returns
Pointer on the dataplane struct on success NULL othervise

◆ cne_fib6_get_rib()

struct cne_rib6* cne_fib6_get_rib ( struct cne_fib6 *  fib)

Get pointer to the RIB6

Parameters
fibFIB object handle
Returns
Pointer on the RIB6 on success NULL othervise

◆ cne_fib6_select_lookup()

int cne_fib6_select_lookup ( struct cne_fib6 *  fib,
enum cne_fib6_lookup_type  type 
)

Set lookup function based on type

Parameters
fibFIB object handle
typetype of lookup function
Returns
0 on success -EINVAL on failure