FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
fib_path_list.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __FIB_PATH_LIST_H__
17 #define __FIB_PATH_LIST_H__
18 
19 #include <vlib/vlib.h>
20 #include <vnet/adj/adj.h>
21 
22 #include <vnet/fib/fib_node.h>
23 #include <vnet/fib/fib_path.h>
24 
25 /**
26  * Enumeration of path-list flags.
27  */
29  /**
30  * Marker. Add new flags after this one.
31  */
33  /**
34  * This path list is shareable. Shareable path-lists
35  * are inserted into the path-list data-base.
36  * All path-list are inherently shareable, the reason we share some and
37  * not others is to limit the size of the path-list database. This DB must
38  * be searched for each route update.
39  */
41  /**
42  * explicit drop path-list. Used when the entry source needs to
43  * force a drop, despite the fact the path info is present.
44  */
46  /**
47  * explicit local path-list.
48  */
50  /**
51  * exclusive path-list. Exclusive means the path will resolve via the
52  * exclusive (user provided) adj.
53  */
55  /**
56  * resolved path-list
57  */
59  /**
60  * looped path-list. one path looped implies the whole list is
61  */
63  /**
64  * a popular path-ist is one that is shared amongst many entries.
65  * Path list become popular as they gain more children, but they
66  * don't become unpopular as they lose them.
67  */
69  /**
70  * no uRPF - do not generate unicast RPF list for this path-list
71  */
73  /**
74  * Marher. Add new flags before this one, and then update it.
75  */
78 
79 typedef enum fib_path_list_flags_t_ {
90 
91 #define FIB_PATH_LIST_ATTRIBUTES { \
92  [FIB_PATH_LIST_ATTRIBUTE_SHARED] = "shared", \
93  [FIB_PATH_LIST_ATTRIBUTE_RESOLVED] = "resolved", \
94  [FIB_PATH_LIST_ATTRIBUTE_DROP] = "drop", \
95  [FIB_PATH_LIST_ATTRIBUTE_EXCLUSIVE] = "exclusive", \
96  [FIB_PATH_LIST_ATTRIBUTE_LOCAL] = "local", \
97  [FIB_PATH_LIST_ATTRIBUTE_LOOPED] = "looped", \
98  [FIB_PATH_LIST_ATTRIBUTE_POPULAR] = "popular", \
99  [FIB_PATH_LIST_ATTRIBUTE_NO_URPF] = "no-uRPF", \
100 }
101 
102 #define FOR_EACH_PATH_LIST_ATTRIBUTE(_item) \
103  for (_item = FIB_PATH_LIST_ATTRIBUTE_FIRST; \
104  _item <= FIB_PATH_LIST_ATTRIBUTE_LAST; \
105  _item++)
106 
107 /**
108  * The flags on a path-list that contribute to its key in the DB.
109  * So path-lists with these flags different are not conisdered the
110  * same.
111  */
112 #define FIB_PATH_LIST_KEY_FLAGS (FIB_PATH_LIST_FLAG_NO_URPF)
113 
115  const fib_route_path_t *paths);
118  const dpo_id_t *dpo);
119 
121  fib_node_index_t pl_index,
123  const fib_route_path_t *path);
125  fib_node_index_t pl_index,
127  const fib_route_path_t *path);
129  fib_node_index_t path_list_index,
130  const fib_route_path_t *rpaths);
132  fib_node_index_t path_list_index,
133  const fib_route_path_t *rpaths);
134 
136 
137 /**
138  * Flags to control how the path-list returns forwarding information
139  */
141 {
146 
147 extern void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index,
150  dpo_id_t *dpo);
151 extern void fib_path_list_contribute_urpf(fib_node_index_t path_index,
152  index_t urpf);
153 extern index_t fib_path_list_get_urpf(fib_node_index_t path_list_index);
154 extern index_t fib_path_list_get_adj(fib_node_index_t path_list_index,
156 
159  fib_node_index_t child_index);
160 extern void fib_path_list_child_remove(fib_node_index_t pl_index,
161  fib_node_index_t sibling_index);
162 extern void fib_path_list_back_walk(fib_node_index_t pl_index,
164 extern void fib_path_list_lock(fib_node_index_t pl_index);
165 extern void fib_path_list_unlock(fib_node_index_t pl_index);
166 extern int fib_path_list_recursive_loop_detect(fib_node_index_t path_list_index,
167  fib_node_index_t **entry_indicies);
169 extern int fib_path_list_is_looped(fib_node_index_t path_list_index);
170 extern int fib_path_list_is_popular(fib_node_index_t path_list_index);
172 extern u8 * fib_path_list_format(fib_node_index_t pl_index,
173  u8 * s);
174 extern u8 * format_fib_path_list(u8 * s, va_list *args);
175 
177  const fib_node_index_t *pis);
178 extern u32 fib_path_list_find_rpath (fib_node_index_t path_list_index,
179  const fib_route_path_t *rpath);
180 
181 /**
182  * A callback function type for walking a path-list's paths
183  */
185  fib_node_index_t pl_index,
186  fib_node_index_t path_index,
187  void *ctx);
188 
189 extern void fib_path_list_walk(fib_node_index_t pl_index,
191  void *ctx);
192 
194  fib_node_index_t pl_index,
195  fib_node_index_t path_index,
196  const struct fib_path_ext_t_ *ext_list,
197  void *ctx);
198 
199 extern void fib_path_list_walk_w_ext(fib_node_index_t pl_index,
200  const fib_path_ext_list_t *ext_list,
202  void *ctx);
203 
204 extern void fib_path_list_module_init(void);
205 
206 /*
207  * functions for testing.
208  */
211 
212 #endif
vlib.h
FIB_PATH_LIST_ATTRIBUTE_LAST
@ FIB_PATH_LIST_ATTRIBUTE_LAST
Marher.
Definition: fib_path_list.h:76
fib_path_list_get_proto
dpo_proto_t fib_path_list_get_proto(fib_node_index_t path_list_index)
Definition: fib_path_list.c:633
fib_path_list_create
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *paths)
Definition: fib_path_list.c:682
adj.h
FIB_PATH_LIST_FLAG_DROP
@ FIB_PATH_LIST_FLAG_DROP
Definition: fib_path_list.h:82
fib_path_list_paths_remove
fib_node_index_t * fib_path_list_paths_remove(fib_node_index_t path_list_index, const fib_route_path_t *rpaths)
Definition: fib_path_list.c:1025
FIB_PATH_LIST_ATTRIBUTE_RESOLVED
@ FIB_PATH_LIST_ATTRIBUTE_RESOLVED
resolved path-list
Definition: fib_path_list.h:58
FIB_PATH_LIST_ATTRIBUTE_EXCLUSIVE
@ FIB_PATH_LIST_ATTRIBUTE_EXCLUSIVE
exclusive path-list.
Definition: fib_path_list.h:54
fib_path_list_fwd_flags_t_
fib_path_list_fwd_flags_t_
Flags to control how the path-list returns forwarding information.
Definition: fib_path_list.h:140
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
fib_path_list_find_rpath
u32 fib_path_list_find_rpath(fib_node_index_t path_list_index, const fib_route_path_t *rpath)
Definition: fib_path_list.c:804
path
vl_api_fib_path_t path
Definition: mfib_types.api:44
fib_path_list_walk_rc_t
enum fib_path_list_walk_rc_t_ fib_path_list_walk_rc_t
return code to control pat-hlist walk
FIB_PATH_LIST_FLAG_LOCAL
@ FIB_PATH_LIST_FLAG_LOCAL
Definition: fib_path_list.h:83
fib_path_list_format
u8 * fib_path_list_format(fib_node_index_t pl_index, u8 *s)
Definition: fib_path_list.c:165
FIB_PATH_LIST_ATTRIBUTE_SHARED
@ FIB_PATH_LIST_ATTRIBUTE_SHARED
This path list is shareable.
Definition: fib_path_list.h:40
FIB_PATH_LIST_FLAG_NONE
@ FIB_PATH_LIST_FLAG_NONE
Definition: fib_path_list.h:80
fib_node.h
fib_path_list_get_resolving_interface
u32 fib_path_list_get_resolving_interface(fib_node_index_t path_list_index)
Definition: fib_path_list.c:611
fib_node_type_t
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
fib_path_list_lock
void fib_path_list_lock(fib_node_index_t pl_index)
Definition: fib_path_list.c:1344
fib_path_list_flags_t
enum fib_path_list_flags_t_ fib_path_list_flags_t
fib_path_list_walk_w_ext
void fib_path_list_walk_w_ext(fib_node_index_t pl_index, const fib_path_ext_list_t *ext_list, fib_path_list_walk_w_ext_fn_t func, void *ctx)
Definition: fib_path_list.c:1401
fib_path_list_child_add
u32 fib_path_list_child_add(fib_node_index_t pl_index, fib_node_type_t type, fib_node_index_t child_index)
Definition: fib_path_list.c:1296
fib_path_list_get_urpf
index_t fib_path_list_get_urpf(fib_node_index_t path_list_index)
Return the the child the RPF list pre-built for this path list.
Definition: fib_path_list.c:449
fib_forward_chain_type_t
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
fib_path_list_is_looped
int fib_path_list_is_looped(fib_node_index_t path_list_index)
Definition: fib_path_list.c:647
FIB_PATH_LIST_FLAG_SHARED
@ FIB_PATH_LIST_FLAG_SHARED
Definition: fib_path_list.h:81
fib_path_ext_list_t_
A list of path-extensions.
Definition: fib_types.h:644
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
fib_path_list_module_init
void fib_path_list_module_init(void)
Definition: fib_path_list.c:1425
fib_path_list_is_popular
int fib_path_list_is_popular(fib_node_index_t path_list_index)
Definition: fib_path_list.c:657
fib_path_list_create_special
fib_node_index_t fib_path_list_create_special(dpo_proto_t nh_proto, fib_path_list_flags_t flags, const dpo_id_t *dpo)
Definition: fib_path_list.c:774
fib_path_list_copy_and_path_remove
fib_node_index_t fib_path_list_copy_and_path_remove(fib_node_index_t pl_index, fib_path_list_flags_t flags, const fib_route_path_t *path)
Definition: fib_path_list.c:1086
fib_path_list_attribute_t
enum fib_path_list_attribute_t_ fib_path_list_attribute_t
Enumeration of path-list flags.
fib_path_list_pool_size
u32 fib_path_list_pool_size(void)
Definition: fib_path_list.c:1370
fib_path_list_recursive_loop_detect
int fib_path_list_recursive_loop_detect(fib_node_index_t path_list_index, fib_node_index_t **entry_indicies)
Definition: fib_path_list.c:1252
format_fib_path_list
u8 * format_fib_path_list(u8 *s, va_list *args)
Definition: fib_path_list.c:125
fib_path_list_walk_fn_t
fib_path_list_walk_rc_t(* fib_path_list_walk_fn_t)(fib_node_index_t pl_index, fib_node_index_t path_index, void *ctx)
A callback function type for walking a path-list's paths.
Definition: fib_path_list.h:184
FIB_PATH_LIST_FLAG_RESOLVED
@ FIB_PATH_LIST_FLAG_RESOLVED
Definition: fib_path_list.h:85
fib_path_list_unlock
void fib_path_list_unlock(fib_node_index_t pl_index)
Definition: fib_path_list.c:1357
fib_path_list_fwd_flags_t
enum fib_path_list_fwd_flags_t_ fib_path_list_fwd_flags_t
Flags to control how the path-list returns forwarding information.
paths
paths
Definition: map.api:460
FIB_PATH_LIST_ATTRIBUTE_NO_URPF
@ FIB_PATH_LIST_ATTRIBUTE_NO_URPF
no uRPF - do not generate unicast RPF list for this path-list
Definition: fib_path_list.h:72
fib_path_list_contribute_urpf
void fib_path_list_contribute_urpf(fib_node_index_t path_index, index_t urpf)
Contribute (add) this path list's uRPF list.
Definition: fib_path_list.c:435
FIB_PATH_LIST_FLAG_LOOPED
@ FIB_PATH_LIST_FLAG_LOOPED
Definition: fib_path_list.h:86
fib_path_list_get_n_paths
u32 fib_path_list_get_n_paths(fib_node_index_t pl_index)
Definition: fib_path_list.c:595
fib_path_list_copy_and_path_add
fib_node_index_t fib_path_list_copy_and_path_add(fib_node_index_t pl_index, fib_path_list_flags_t flags, const fib_route_path_t *path)
Definition: fib_path_list.c:907
u32
unsigned int u32
Definition: types.h:88
fib_route_path_t_
A representation of a path as described by a route producer.
Definition: fib_types.h:500
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
FIB_PATH_LIST_ATTRIBUTE_POPULAR
@ FIB_PATH_LIST_ATTRIBUTE_POPULAR
a popular path-ist is one that is shared amongst many entries.
Definition: fib_path_list.h:68
fib_path_list_walk
void fib_path_list_walk(fib_node_index_t pl_index, fib_path_list_walk_fn_t func, void *ctx)
Definition: fib_path_list.c:1382
FIB_PATH_LIST_FLAG_POPULAR
@ FIB_PATH_LIST_FLAG_POPULAR
Definition: fib_path_list.h:87
fib_path_list_db_size
u32 fib_path_list_db_size(void)
Definition: fib_path_list.c:1376
FIB_PATH_LIST_ATTRIBUTE_DROP
@ FIB_PATH_LIST_ATTRIBUTE_DROP
explicit drop path-list.
Definition: fib_path_list.h:45
fib_path_list_paths_add
fib_node_index_t * fib_path_list_paths_add(fib_node_index_t path_list_index, const fib_route_path_t *rpaths)
Definition: fib_path_list.c:831
fib_path_list_flags_t_
fib_path_list_flags_t_
Definition: fib_path_list.h:79
u8
unsigned char u8
Definition: types.h:56
fib_path_ext_t_
A path extension is a per-entry addition to the forwarding information when packets are sent for that...
Definition: fib_path_ext.h:98
FIB_PATH_LIST_FWD_FLAG_NONE
@ FIB_PATH_LIST_FWD_FLAG_NONE
Definition: fib_path_list.h:142
FIB_PATH_LIST_FLAG_NO_URPF
@ FIB_PATH_LIST_FLAG_NO_URPF
Definition: fib_path_list.h:88
FIB_PATH_LIST_ATTRIBUTE_FIRST
@ FIB_PATH_LIST_ATTRIBUTE_FIRST
Marker.
Definition: fib_path_list.h:32
fib_node_back_walk_ctx_t_
Context passed between object during a back walk.
Definition: fib_node.h:214
fib_path.h
FIB_PATH_LIST_ATTRIBUTE_LOOPED
@ FIB_PATH_LIST_ATTRIBUTE_LOOPED
looped path-list.
Definition: fib_path_list.h:62
FIB_PATH_LIST_FWD_FLAG_STICKY
@ FIB_PATH_LIST_FWD_FLAG_STICKY
Definition: fib_path_list.h:144
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
fib_path_list_child_remove
void fib_path_list_child_remove(fib_node_index_t pl_index, fib_node_index_t sibling_index)
Definition: fib_path_list.c:1335
fib_path_list_walk_w_ext_fn_t
fib_path_list_walk_rc_t(* fib_path_list_walk_w_ext_fn_t)(fib_node_index_t pl_index, fib_node_index_t path_index, const struct fib_path_ext_t_ *ext_list, void *ctx)
Definition: fib_path_list.h:193
fib_path_list_contribute_forwarding
void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index, fib_forward_chain_type_t type, fib_path_list_fwd_flags_t flags, dpo_id_t *dpo)
Definition: fib_path_list.c:1211
FIB_PATH_LIST_FLAG_EXCLUSIVE
@ FIB_PATH_LIST_FLAG_EXCLUSIVE
Definition: fib_path_list.h:84
fib_path_list_attribute_t_
fib_path_list_attribute_t_
Enumeration of path-list flags.
Definition: fib_path_list.h:28
FIB_PATH_LIST_ATTRIBUTE_LOCAL
@ FIB_PATH_LIST_ATTRIBUTE_LOCAL
explicit local path-list.
Definition: fib_path_list.h:49
fib_path_list_get_adj
index_t fib_path_list_get_adj(fib_node_index_t path_list_index, fib_forward_chain_type_t type)
Definition: fib_path_list.c:1242
fib_path_list_back_walk
void fib_path_list_back_walk(fib_node_index_t pl_index, fib_node_back_walk_ctx_t *ctx)
Definition: fib_path_list.c:465
fib_path_list_lb_map_add_or_lock
index_t fib_path_list_lb_map_add_or_lock(fib_node_index_t pl_index, const fib_node_index_t *pis)
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
FIB_PATH_LIST_FWD_FLAG_COLLAPSE
@ FIB_PATH_LIST_FWD_FLAG_COLLAPSE
Definition: fib_path_list.h:143
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105