#include <stddef.h>
#include <stdint.h>
#include <sys/queue.h>
#include <bsd/sys/queue.h>
#include <cne_rwlock.h>
#include <cne_fib.h>
Go to the source code of this file.
|
static uint32_t | fi_obj_index (fib_info_t *fi, uint32_t idx) |
|
static int | fib_info_alloc (fib_info_t *fi, void *obj) |
|
static void * | fib_info_free (fib_info_t *fi, uint32_t idx) |
|
static void | fib_info_destroy (fib_info_t *fi) |
|
static fib_info_t * | fib_info_create (struct cne_fib *fib, uint32_t objcnt, uint32_t index_shift) |
|
static void * | fib_info_object_get (fib_info_t *fi, uint32_t idx) |
|
static int | fib_info_index_valid (fib_info_t *fi, uint32_t idx) |
|
static struct cne_fib * | fib_info_get_fib (fib_info_t *fi) |
|
static int | fib_info_foreach (fib_info_t *fi, fib_func_t func, void *arg) |
|
static int | fib_info_get (fib_info_t *fi, uint64_t *idxs, void **objs, int n) |
|
static int | fib_info_lookup (fib_info_t *fi, uint32_t *ip, void **objs, int n) |
|
static int | fib_info_lookup_index (fib_info_t *fi, uint32_t *ip, uint64_t *idxs, int n) |
|
CNET FIB support routines and definitions.
Definition in file cnet_fib_info.h.
◆ fi_obj_index()
static uint32_t fi_obj_index |
( |
fib_info_t * |
fi, |
|
|
uint32_t |
idx |
|
) |
| |
|
inlinestatic |
Return the object index for the idx2obj array.
- Parameters
-
fi | The fib_info_t structure pointer. |
idx | The index of the object which includes the nexthop of some value in the upper bits. |
- Returns
- The index of the object or UINT32_MAX if fib_info_t pointer is NULL.
Definition at line 47 of file cnet_fib_info.h.
◆ fib_info_alloc()
static int fib_info_alloc |
( |
fib_info_t * |
fi, |
|
|
void * |
obj |
|
) |
| |
|
inlinestatic |
Allocate the FIB information structure for a given object. The object is added to the idx2obj table if space is available.
- Parameters
-
fi | The FIB information structure pointer. |
obj | The object pointer to put in the idx2obj table. |
- Returns
- -1 on error or the index value into the idx2obj table.
Definition at line 69 of file cnet_fib_info.h.
◆ fib_info_free()
static void* fib_info_free |
( |
fib_info_t * |
fi, |
|
|
uint32_t |
idx |
|
) |
| |
|
inlinestatic |
Remove the object from the FIB information structure and release the entry.
- Parameters
-
fi | The FIB information structure pointer. |
idx | The index location on the FIB table to release. |
- Returns
- The object pointer is returned and value could be NULL if an error.
Definition at line 106 of file cnet_fib_info.h.
◆ fib_info_destroy()
static void fib_info_destroy |
( |
fib_info_t * |
fi | ) |
|
|
inlinestatic |
Destroy and free resources in the FIB information structure.
- Parameters
-
fi | The FIB information structure pointer. |
Definition at line 130 of file cnet_fib_info.h.
◆ fib_info_create()
static fib_info_t* fib_info_create |
( |
struct cne_fib * |
fib, |
|
|
uint32_t |
objcnt, |
|
|
uint32_t |
index_shift |
|
) |
| |
|
inlinestatic |
Create the FIB information structure.
- Parameters
-
fib | The FIB table to add to the FIB information structure |
objcnt | The number of objects to support in the idx2obj table. The value will be aligned to the power of 2 value. |
index_shift | The index value used to shift the value to the index value in the object being stored. This allows for the object pointer, which could be a real pointer or a uint64_t value with a upper value and lower value encoded into the object pointer. |
- Returns
- NULL on error or pointer to the FIB information structure
Definition at line 157 of file cnet_fib_info.h.
◆ fib_info_object_get()
static void* fib_info_object_get |
( |
fib_info_t * |
fi, |
|
|
uint32_t |
idx |
|
) |
| |
|
inlinestatic |
Get the object pointed to by the index value in the FIB info structure
- Parameters
-
fi | The FIB information structure pointer. |
idx | The value to be used to index into the idx2obj table. |
- Returns
- The object value or pointer is return or NULL if an error occurred.
Definition at line 193 of file cnet_fib_info.h.
◆ fib_info_index_valid()
static int fib_info_index_valid |
( |
fib_info_t * |
fi, |
|
|
uint32_t |
idx |
|
) |
| |
|
inlinestatic |
Is the index value a valid value.
- Parameters
-
fi | The FIB information structure pointer. |
idx | The index value to validate. |
- Returns
- 1 on valid value or 0 if not a valid value.
Definition at line 217 of file cnet_fib_info.h.
◆ fib_info_get_fib()
static struct cne_fib* fib_info_get_fib |
( |
fib_info_t * |
fi | ) |
|
|
inlinestatic |
Return the FIB pointer from a valid FIB info structure.
- Parameters
-
fi | The FIB information structure pointer. |
- Returns
- NULL on error or pointer to the FIB structure.
Definition at line 236 of file cnet_fib_info.h.
◆ fib_info_foreach()
static int fib_info_foreach |
( |
fib_info_t * |
fi, |
|
|
fib_func_t |
func, |
|
|
void * |
arg |
|
) |
| |
|
inlinestatic |
Iterate over the idx2obj values and call a function from caller.
- Parameters
-
fi | The FIB information structure pointer. |
func | The function to call in the form of 'int (*fn)(void *obj, void *arg)' |
arg | A void pointer supplied to the function being called. |
- Returns
- -1 on error or 0 on success.
Definition at line 256 of file cnet_fib_info.h.
◆ fib_info_get()
static int fib_info_get |
( |
fib_info_t * |
fi, |
|
|
uint64_t * |
idxs, |
|
|
void ** |
objs, |
|
|
int |
n |
|
) |
| |
|
inlinestatic |
Get the FIB information objects into objects for given count 'n'
- Parameters
-
fi | The FIB information structure pointer. |
idxs | An array of index values to use in returning the object values. |
objs | An array to return the objects for the given index values. |
n | The number of indexes in the idxs array and must match the size for the objs array. |
- Returns
- -1 on error or the number of objects found and returned in objs array
Definition at line 284 of file cnet_fib_info.h.
◆ fib_info_lookup()
static int fib_info_lookup |
( |
fib_info_t * |
fi, |
|
|
uint32_t * |
ip, |
|
|
void ** |
objs, |
|
|
int |
n |
|
) |
| |
|
inlinestatic |
Do a build lookup in the FIB table and return the objects
- Parameters
-
fi | The FIB information structure pointer. |
ip | The array of IPv4 addresses to lookup in the FIB table. |
objs | The array of returning objects. |
n | The number of IPv4 addresses and the size of the object array |
- Returns
- -1 on error or number of objects returned
Definition at line 321 of file cnet_fib_info.h.
◆ fib_info_lookup_index()
static int fib_info_lookup_index |
( |
fib_info_t * |
fi, |
|
|
uint32_t * |
ip, |
|
|
uint64_t * |
idxs, |
|
|
int |
n |
|
) |
| |
|
inlinestatic |
Bulk lookup of IPv4 addresses and return the index values of the objects
- Parameters
-
fi | The FIB information structure pointer. |
ip | The array of IPv4 addresses to lookup in the FIB table. |
idxs | The array of index values to return |
n | The number of IPv4 addresses and the size of the object array |
- Returns
- -1 on error or number of objects returned
Definition at line 347 of file cnet_fib_info.h.