CNDP  22.08.0
cne_fib.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2018 Vladimir Medvedkin <medvedkinv@gmail.com>
3  * Copyright (c) 2019-2022 Intel Corporation
4  */
5 
6 #ifndef _CNE_FIB_H_
7 #define _CNE_FIB_H_
8 
18 #include <stdint.h> // for uint32_t, uint64_t, uint8_t
19 #include <cne_common.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 struct cne_fib;
26 struct cne_rib;
27 
29 #define CNE_FIB_MAXDEPTH 32
30 
35 };
36 
38 typedef int (*cne_fib_modify_fn_t)(struct cne_fib *fib, uint32_t ip, uint8_t depth,
39  uint64_t next_hop, int op);
41 typedef void (*cne_fib_lookup_fn_t)(void *fib, const uint32_t *ips, uint64_t *next_hops,
42  const unsigned int n);
43 
44 enum cne_fib_op {
45  CNE_FIB_ADD,
46  CNE_FIB_DEL,
47 };
48 
51  CNE_FIB_DIR24_8_1B,
52  CNE_FIB_DIR24_8_2B,
53  CNE_FIB_DIR24_8_4B,
54  CNE_FIB_DIR24_8_8B
55 };
56 
74 };
75 
77 struct cne_fib_conf {
78  enum cne_fib_type type;
80  uint64_t default_nh;
81  int max_routes;
82  union {
83  struct {
84  enum cne_fib_dir24_8_nh_sz nh_sz;
85  uint32_t num_tbl8;
86  } dir24_8;
87  };
88 };
89 
100 struct cne_fib *cne_fib_create(const char *name, struct cne_fib_conf *conf);
101 
110 void cne_fib_free(struct cne_fib *fib);
111 
126 int cne_fib_add(struct cne_fib *fib, uint32_t ip, uint8_t depth, uint64_t next_hop);
127 
140 int cne_fib_delete(struct cne_fib *fib, uint32_t ip, uint8_t depth);
141 
159 int cne_fib_lookup_bulk(struct cne_fib *fib, uint32_t *ips, uint64_t *next_hops, int n);
160 
170 void *cne_fib_get_dp(struct cne_fib *fib);
171 
180 struct cne_rib *cne_fib_get_rib(struct cne_fib *fib);
181 
194 int cne_fib_select_lookup(struct cne_fib *fib, enum cne_fib_lookup_type type);
195 
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif /* _CNE_FIB_H_ */
int cne_fib_lookup_bulk(struct cne_fib *fib, uint32_t *ips, uint64_t *next_hops, int n)
int(* cne_fib_modify_fn_t)(struct cne_fib *fib, uint32_t ip, uint8_t depth, uint64_t next_hop, int op)
Definition: cne_fib.h:38
int cne_fib_delete(struct cne_fib *fib, uint32_t ip, uint8_t depth)
void(* cne_fib_lookup_fn_t)(void *fib, const uint32_t *ips, uint64_t *next_hops, const unsigned int n)
Definition: cne_fib.h:41
cne_fib_type
Definition: cne_fib.h:32
@ CNE_FIB_DIR24_8
Definition: cne_fib.h:34
@ CNE_FIB_DUMMY
Definition: cne_fib.h:33
cne_fib_lookup_type
Definition: cne_fib.h:58
@ CNE_FIB_LOOKUP_DIR24_8_SCALAR_INLINE
Definition: cne_fib.h:63
@ CNE_FIB_LOOKUP_DIR24_8_VECTOR_AVX512
Definition: cne_fib.h:72
@ CNE_FIB_LOOKUP_DEFAULT
Definition: cne_fib.h:59
@ CNE_FIB_LOOKUP_DIR24_8_SCALAR_MACRO
Definition: cne_fib.h:61
@ CNE_FIB_LOOKUP_DIR24_8_SCALAR_UNI
Definition: cne_fib.h:68
void cne_fib_free(struct cne_fib *fib)
struct cne_fib * cne_fib_create(const char *name, struct cne_fib_conf *conf)
cne_fib_dir24_8_nh_sz
Definition: cne_fib.h:50
int cne_fib_add(struct cne_fib *fib, uint32_t ip, uint8_t depth, uint64_t next_hop)
struct cne_rib * cne_fib_get_rib(struct cne_fib *fib)
void * cne_fib_get_dp(struct cne_fib *fib)
int cne_fib_select_lookup(struct cne_fib *fib, enum cne_fib_lookup_type type)
uint64_t default_nh
Definition: cne_fib.h:80
enum cne_fib_type type
Definition: cne_fib.h:78