DPDK 25.03.0-rc0
rte_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 Intel Corporation
4 */
5
6#ifndef _RTE_FIB_H_
7#define _RTE_FIB_H_
8
18#include <stdint.h>
19
20#include <rte_rcu_qsbr.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26struct rte_fib;
27struct rte_rib;
28
30#define RTE_FIB_MAXDEPTH 32
31
33#define RTE_FIB_RCU_DQ_RECLAIM_MAX 16
35#define RTE_FIB_RCU_DQ_RECLAIM_SZ 128
36
43};
44
49};
50
52typedef int (*rte_fib_modify_fn_t)(struct rte_fib *fib, uint32_t ip,
53 uint8_t depth, uint64_t next_hop, int op);
55typedef void (*rte_fib_lookup_fn_t)(void *fib, const uint32_t *ips,
56 uint64_t *next_hops, const unsigned int n);
57
58enum rte_fib_op {
59 RTE_FIB_ADD,
60 RTE_FIB_DEL,
61};
62
65 RTE_FIB_DIR24_8_1B,
66 RTE_FIB_DIR24_8_2B,
67 RTE_FIB_DIR24_8_4B,
68 RTE_FIB_DIR24_8_8B
69};
70
88};
89
91#define RTE_FIB_F_LOOKUP_NETWORK_ORDER 1
92#define RTE_FIB_ALLOWED_FLAGS (RTE_FIB_F_LOOKUP_NETWORK_ORDER)
93
98 uint64_t default_nh;
99 int max_routes;
101 unsigned int rib_ext_sz;
102 union {
103 struct {
104 enum rte_fib_dir24_8_nh_sz nh_sz;
105 uint32_t num_tbl8;
106 } dir24_8;
107 };
108 unsigned int flags;
109};
110
114 struct rte_rcu_qsbr *v;
122 uint32_t dq_size;
124 uint32_t reclaim_thd;
128 uint32_t reclaim_max;
129};
130
144struct rte_fib *
145rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf);
146
157struct rte_fib *
158rte_fib_find_existing(const char *name);
159
167void
168rte_fib_free(struct rte_fib *fib);
169
184int
185rte_fib_add(struct rte_fib *fib, uint32_t ip, uint8_t depth, uint64_t next_hop);
186
199int
200rte_fib_delete(struct rte_fib *fib, uint32_t ip, uint8_t depth);
201
219int
220rte_fib_lookup_bulk(struct rte_fib *fib, uint32_t *ips,
221 uint64_t *next_hops, int n);
231void *
232rte_fib_get_dp(struct rte_fib *fib);
233
243struct rte_rib *
244rte_fib_get_rib(struct rte_fib *fib);
245
258int
259rte_fib_select_lookup(struct rte_fib *fib, enum rte_fib_lookup_type type);
260
277__rte_experimental
278int
279rte_fib_rcu_qsbr_add(struct rte_fib *fib, struct rte_fib_rcu_config *cfg);
280
281#ifdef __cplusplus
282}
283#endif
284
285#endif /* _RTE_FIB_H_ */
void * rte_fib_get_dp(struct rte_fib *fib)
int rte_fib_delete(struct rte_fib *fib, uint32_t ip, uint8_t depth)
rte_fib_lookup_type
Definition: rte_fib.h:72
@ RTE_FIB_LOOKUP_DIR24_8_SCALAR_UNI
Definition: rte_fib.h:82
@ RTE_FIB_LOOKUP_DIR24_8_SCALAR_INLINE
Definition: rte_fib.h:77
@ RTE_FIB_LOOKUP_DIR24_8_SCALAR_MACRO
Definition: rte_fib.h:75
@ RTE_FIB_LOOKUP_DEFAULT
Definition: rte_fib.h:73
@ RTE_FIB_LOOKUP_DIR24_8_VECTOR_AVX512
Definition: rte_fib.h:86
void(* rte_fib_lookup_fn_t)(void *fib, const uint32_t *ips, uint64_t *next_hops, const unsigned int n)
Definition: rte_fib.h:55
__rte_experimental int rte_fib_rcu_qsbr_add(struct rte_fib *fib, struct rte_fib_rcu_config *cfg)
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)
rte_fib_dir24_8_nh_sz
Definition: rte_fib.h:64
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)
int(* rte_fib_modify_fn_t)(struct rte_fib *fib, uint32_t ip, uint8_t depth, uint64_t next_hop, int op)
Definition: rte_fib.h:52
rte_fib_qsbr_mode
Definition: rte_fib.h:38
@ RTE_FIB_QSBR_MODE_DQ
Definition: rte_fib.h:40
@ RTE_FIB_QSBR_MODE_SYNC
Definition: rte_fib.h:42
void rte_fib_free(struct rte_fib *fib)
int rte_fib_lookup_bulk(struct rte_fib *fib, uint32_t *ips, uint64_t *next_hops, int n)
int rte_fib_add(struct rte_fib *fib, uint32_t ip, uint8_t depth, uint64_t next_hop)
rte_fib_type
Definition: rte_fib.h:46
@ RTE_FIB_DUMMY
Definition: rte_fib.h:47
@ RTE_FIB_DIR24_8
Definition: rte_fib.h:48
uint64_t default_nh
Definition: rte_fib.h:98
unsigned int flags
Definition: rte_fib.h:108
enum rte_fib_type type
Definition: rte_fib.h:96
unsigned int rib_ext_sz
Definition: rte_fib.h:101
struct rte_rcu_qsbr * v
Definition: rte_fib.h:114
enum rte_fib_qsbr_mode mode
Definition: rte_fib.h:118
uint32_t reclaim_max
Definition: rte_fib.h:128
uint32_t reclaim_thd
Definition: rte_fib.h:124
uint32_t dq_size
Definition: rte_fib.h:122