FD.io VPP  v17.01.1-3-gc6833f8
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 "fib_node.h"
23 #include "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  * Marher. Add new flags before this one, and then update it.
65  */
68 
69 typedef enum fib_path_list_flags_t_ {
78 
79 #define FIB_PATH_LIST_ATTRIBUTES { \
80  [FIB_PATH_LIST_ATTRIBUTE_SHARED] = "shared", \
81  [FIB_PATH_LIST_ATTRIBUTE_RESOLVED] = "resolved", \
82  [FIB_PATH_LIST_ATTRIBUTE_DROP] = "drop", \
83  [FIB_PATH_LIST_ATTRIBUTE_EXCLUSIVE] = "exclusive", \
84  [FIB_PATH_LIST_ATTRIBUTE_LOCAL] = "local", \
85  [FIB_PATH_LIST_ATTRIBUTE_LOOPED] = "looped", \
86 }
87 
88 #define FOR_EACH_PATH_LIST_ATTRIBUTE(_item) \
89  for (_item = FIB_PATH_LIST_ATTRIBUTE_FIRST; \
90  _item <= FIB_PATH_LIST_ATTRIBUTE_LAST; \
91  _item++)
92 
94  const fib_route_path_t *paths);
97  const dpo_id_t *dpo);
98 
100  fib_node_index_t pl_index,
102  const fib_route_path_t *path);
104  fib_node_index_t pl_index,
106  const fib_route_path_t *path);
108 
109 extern void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index,
111  dpo_id_t *dpo);
112 extern void fib_path_list_contribute_urpf(fib_node_index_t path_index,
113  index_t urpf);
114 extern index_t fib_path_list_get_urpf(fib_node_index_t path_list_index);
115 extern index_t fib_path_list_get_adj(fib_node_index_t path_list_index,
117 
120  fib_node_index_t child_index);
121 extern void fib_path_list_child_remove(fib_node_index_t pl_index,
122  fib_node_index_t sibling_index);
123 extern void fib_path_list_back_walk(fib_node_index_t pl_index,
125 extern void fib_path_list_lock(fib_node_index_t pl_index);
126 extern void fib_path_list_unlock(fib_node_index_t pl_index);
127 extern int fib_path_list_recursive_loop_detect(fib_node_index_t path_list_index,
128  fib_node_index_t **entry_indicies);
130 extern int fib_path_list_is_looped(fib_node_index_t path_list_index);
132 extern u8 * fib_path_list_format(fib_node_index_t pl_index,
133  u8 * s);
135  u32 indent,
136  u8 * s);
138  const fib_node_index_t *pis);
139 /**
140  * A callback function type for walking a path-list's paths
141  */
143  fib_node_index_t path_index,
144  void *ctx);
145 
146 extern void fib_path_list_walk(fib_node_index_t pl_index,
148  void *ctx);
149 
150 extern void fib_path_list_module_init(void);
151 
152 extern void fib_path_list_module_init(void);
153 
154 /*
155  * functions for testing.
156  */
159 
160 #endif
void fib_path_list_back_walk(fib_node_index_t pl_index, fib_node_back_walk_ctx_t *ctx)
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
int fib_path_list_recursive_loop_detect(fib_node_index_t path_list_index, fib_node_index_t **entry_indicies)
int fib_path_list_is_looped(fib_node_index_t path_list_index)
A representation of a path as described by a route producer.
Definition: fib_types.h:285
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
explicit drop path-list.
Definition: fib_path_list.h:45
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:41
fib_node_index_t fib_path_list_create_special(fib_protocol_t nh_proto, fib_path_list_flags_t flags, const dpo_id_t *dpo)
u32 fib_path_list_get_n_paths(fib_node_index_t pl_index)
fib_path_list_attribute_t_
Enumeration of path-list flags.
Definition: fib_path_list.h:28
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u8 * fib_path_list_adjs_format(fib_node_index_t pl_index, u32 indent, u8 *s)
u32 fib_path_list_get_resolving_interface(fib_node_index_t path_list_index)
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *paths)
enum fib_path_list_attribute_t_ fib_path_list_attribute_t
Enumeration of path-list flags.
fib_protocol_t fib_path_list_get_proto(fib_node_index_t path_list_index)
void fib_path_list_walk(fib_node_index_t pl_index, fib_path_list_walk_fn_t func, void *ctx)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:138
void fib_path_list_lock(fib_node_index_t pl_index)
index_t fib_path_list_get_adj(fib_node_index_t path_list_index, fib_forward_chain_type_t type)
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)
fib_path_list_flags_t_
Definition: fib_path_list.h:69
This path list is shareable.
Definition: fib_path_list.h:40
void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index, fib_forward_chain_type_t type, dpo_id_t *dpo)
explicit local path-list.
Definition: fib_path_list.h:49
u8 * fib_path_list_format(fib_node_index_t pl_index, u8 *s)
void fib_path_list_unlock(fib_node_index_t pl_index)
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:28
int(* 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&#39;s paths.
index_t fib_path_list_lb_map_add_or_lock(fib_node_index_t pl_index, const fib_node_index_t *pis)
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.
Context passed between object during a back walk.
Definition: fib_node.h:186
u32 fib_path_list_pool_size(void)
u32 fib_path_list_child_add(fib_node_index_t pl_index, fib_node_type_t type, fib_node_index_t child_index)
unsigned int u32
Definition: types.h:88
void fib_path_list_child_remove(fib_node_index_t pl_index, fib_node_index_t sibling_index)
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
void fib_path_list_contribute_urpf(fib_node_index_t path_index, index_t urpf)
Contribute (add) this path list&#39;s uRPF list.
void fib_path_list_module_init(void)
unsigned char u8
Definition: types.h:56
u32 fib_path_list_db_size(void)
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)
enum fib_path_list_flags_t_ fib_path_list_flags_t
u32 flags
Definition: vhost-user.h:75