FD.io VPP  v17.01-9-ge7dcee4
Vector Packet Processing
fib_path.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 /**
17  * Given a route of the form;
18  * q.r.s.t/Y
19  * via <interface> <next-hop>
20  *
21  * The prefix is: q.r.s.t./Y
22  * the path is: 'via <interface> <next-hop>
23  *
24  * The path is the description of where to send the traffic, and the
25  * the prefix is a description of which traffic to send.
26  * It is the aim of the FIB to resolve the path, i.e. to find the corresponding
27  * adjacency to match the path's description.
28  */
29 
30 #ifndef __FIB_PATH_H__
31 #define __FIB_PATH_H__
32 
33 #include <vnet/ip/ip.h>
34 #include <vnet/dpo/load_balance.h>
35 
36 #include <vnet/fib/fib_types.h>
37 #include <vnet/adj/adj_types.h>
38 
39 /**
40  * Enurmeration of path configuration attributes
41  */
43  /**
44  * Marker. Add new types after this one.
45  */
47  /**
48  * The path is forced to a drop, whatever the next-hop info says.
49  * something somewhere knows better...
50  */
52  /**
53  * The path uses an adj that is exclusive. I.e. it is known only by
54  * the source of the route.
55  */
57  /**
58  * Recursion constraint via host
59  */
61  /**
62  * Recursion constraint via attached
63  */
65  /**
66  * The path is a for-us path
67  */
69  /**
70  * Marker. Add new types before this one, then update it.
71  */
73 } __attribute__ ((packed)) fib_path_cfg_attribute_t;
74 
75 /**
76  * The maximum number of path attributes
77  */
78 #define FIB_PATH_CFG_ATTRIBUTE_MAX (FIB_PATH_CFG_ATTRIBUTE_LAST + 1)
79 
80 #define FIB_PATH_CFG_ATTRIBUTES { \
81  [FIB_PATH_CFG_ATTRIBUTE_DROP] = "drop", \
82  [FIB_PATH_CFG_ATTRIBUTE_EXCLUSIVE] = "exclusive", \
83  [FIB_PATH_CFG_ATTRIBUTE_RESOLVE_HOST] = "resolve-host", \
84  [FIB_PATH_CFG_ATTRIBUTE_RESOLVE_ATTACHED] = "resolve-attached", \
85  [FIB_PATH_CFG_ATTRIBUTE_LOCAL] = "local", \
86 }
87 
88 #define FOR_EACH_FIB_PATH_CFG_ATTRIBUTE(_item) \
89  for (_item = FIB_PATH_CFG_ATTRIBUTE_FIRST; \
90  _item <= FIB_PATH_CFG_ATTRIBUTE_LAST; \
91  _item++)
92 
93 /**
94  * Path config flags from the attributes
95  */
96 typedef enum fib_path_cfg_flags_t_ {
103 } __attribute__ ((packed)) fib_path_cfg_flags_t;
104 
105 
106 extern u8 *fib_path_format(fib_node_index_t pi, u8 *s);
108  u32 indent,
109  u8 *s);
110 
111 extern u8 * format_fib_path(u8 * s, va_list * args);
112 
114  fib_protocol_t nh_proto,
116  const fib_route_path_t *path);
118  fib_protocol_t nh_proto,
120  const dpo_id_t *dpo);
121 
122 extern int fib_path_cmp(fib_node_index_t path_index1,
123  fib_node_index_t path_index2);
124 extern int fib_path_cmp_for_sort(void * a1, void * a2);
125 extern int fib_path_cmp_w_route_path(fib_node_index_t path_index,
126  const fib_route_path_t *rpath);
128  fib_node_index_t path_list_index);
129 extern int fib_path_resolve(fib_node_index_t path_index);
130 extern int fib_path_is_resolved(fib_node_index_t path_index);
131 extern int fib_path_is_recursive(fib_node_index_t path_index);
132 extern int fib_path_is_exclusive(fib_node_index_t path_index);
133 extern int fib_path_is_deag(fib_node_index_t path_index);
134 extern int fib_path_is_looped(fib_node_index_t path_index);
136 extern void fib_path_destroy(fib_node_index_t path_index);
137 extern uword fib_path_hash(fib_node_index_t path_index);
139  fib_node_index_t path_index,
141  load_balance_path_t *hash_key);
142 extern void fib_path_contribute_forwarding(fib_node_index_t path_index,
144  dpo_id_t *dpo);
145 extern void fib_path_contribute_urpf(fib_node_index_t path_index,
146  index_t urpf);
149  fib_node_index_t **entry_indicies);
151 extern int fib_path_get_weight(fib_node_index_t path_index);
152 
153 extern void fib_path_module_init(void);
154 extern int fib_path_encode(fib_node_index_t path_list_index,
155  fib_node_index_t path_index,
156  void *ctx);
157 
158 #endif
The path is forced to a drop, whatever the next-hop info says.
Definition: fib_path.h:51
u32 fib_path_get_resolving_interface(fib_node_index_t fib_entry_index)
Definition: fib_path.c:1616
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
uword fib_path_hash(fib_node_index_t path_index)
Definition: fib_path.c:1169
fib_path_cfg_attribute_t_
Given a route of the form; q.r.s.t/Y via <interface> <next-hop>
Definition: fib_path.h:42
The path is a for-us path.
Definition: fib_path.h:68
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
The path uses an adj that is exclusive.
Definition: fib_path.h:56
adj_index_t fib_path_get_adj(fib_node_index_t path_index)
Definition: fib_path.c:1641
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
int fib_path_resolve(fib_node_index_t path_index)
Definition: fib_path.c:1457
u8 * format_fib_path(u8 *s, va_list *args)
Definition: fib_path.c:357
load_balance_path_t * fib_path_append_nh_for_multipath_hash(fib_node_index_t path_index, fib_forward_chain_type_t fct, load_balance_path_t *hash_key)
Definition: fib_path.c:1823
Recursion constraint via attached.
Definition: fib_path.h:64
fib_node_index_t fib_path_create(fib_node_index_t pl_index, fib_protocol_t nh_proto, fib_path_cfg_flags_t flags, const fib_route_path_t *path)
Definition: fib_path.c:974
int fib_path_cmp(fib_node_index_t path_index1, fib_node_index_t path_index2)
Definition: fib_path.c:1277
fib_node_index_t fib_path_copy(fib_node_index_t path_index, fib_node_index_t path_list_index)
Definition: fib_path.c:1115
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
u8 * fib_path_format(fib_node_index_t pi, u8 *s)
Definition: fib_path.c:475
void fib_path_contribute_urpf(fib_node_index_t path_index, index_t urpf)
Contribute the path&#39;s adjacency to the list passed.
Definition: fib_path.c:1674
int fib_path_get_weight(fib_node_index_t path_index)
Definition: fib_path.c:1656
fib_path_cfg_flags_t_
Path config flags from the attributes.
Definition: fib_path.h:96
int fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, void *ctx)
Definition: fib_path.c:1900
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:28
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
unsigned int u32
Definition: types.h:88
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
void fib_path_destroy(fib_node_index_t path_index)
Definition: fib_path.c:1148
void fib_path_module_init(void)
Definition: fib_path.c:1953
fib_node_index_t fib_path_create_special(fib_node_index_t pl_index, fib_protocol_t nh_proto, fib_path_cfg_flags_t flags, const dpo_id_t *dpo)
Definition: fib_path.c:1070
int fib_path_cmp_w_route_path(fib_node_index_t path_index, const fib_route_path_t *rpath)
Definition: fib_path.c:1289
u64 uword
Definition: types.h:112
unsigned char u8
Definition: types.h:56
int fib_path_recursive_loop_detect(fib_node_index_t path_index, fib_node_index_t **entry_indicies)
Definition: fib_path.c:1377
int fib_path_is_looped(fib_node_index_t path_index)
Definition: fib_path.c:1890
Recursion constraint via host.
Definition: fib_path.h:60
One path from an [EU]CMP set that the client wants to add to a load-balance object.
Definition: load_balance.h:61
enum fib_path_cfg_flags_t_ fib_path_cfg_flags_t
Path config flags from the attributes.
void fib_path_contribute_forwarding(fib_node_index_t path_index, fib_forward_chain_type_t type, dpo_id_t *dpo)
Definition: fib_path.c:1724
int fib_path_is_deag(fib_node_index_t path_index)
Definition: fib_path.c:1867
int fib_path_is_exclusive(fib_node_index_t path_index)
Definition: fib_path.c:1857
fib_protocol_t fib_path_get_proto(fib_node_index_t path_index)
Definition: fib_path.c:1943
u32 flags
Definition: vhost-user.h:75
int fib_path_is_resolved(fib_node_index_t path_index)
Definition: fib_path.c:1877
int fib_path_is_recursive(fib_node_index_t path_index)
Definition: fib_path.c:1847
u8 * fib_path_adj_format(fib_node_index_t pi, u32 indent, u8 *s)
Definition: fib_path.c:486
int fib_path_cmp_for_sort(void *a1, void *a2)
Definition: fib_path.c:1259