FD.io VPP  v19.08-27-gf4dcae4
Vector Packet Processing
adj_midchain.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  * Midchain Adjacency sub-type. These adjs represent an L3 peer on a
17  * tunnel interface. The tunnel's adjacency is thus not the end of the chain,
18  * and needs to stack on/link to another chain (or portion of the graph) to
19  * reach the tunnel's destination.
20  */
21 
22 #ifndef __ADJ_MIDCHAIN_H__
23 #define __ADJ_MIDCHAIN_H__
24 
25 #include <vnet/adj/adj.h>
26 
27 /**
28  * @brief
29  * Convert an existing neighbour adjacency into a midchain
30  *
31  * @param adj_index
32  * The index of the neighbour adjacency.
33  *
34  * @param fixup
35  * The function that will be invoked at paket switch time to 'fixup'
36  * the rewrite applied with necessary per-packet info (i.e. length, checksums).
37  * @param fixup_data
38  * Context data set by the caller that is provided as an argument in the
39  * fixup function.
40  *
41  * @param flags
42  * Flags controlling the adjacency behaviour
43  *
44  * @param rewrite
45  * The rewrite.
46  */
47 extern void adj_nbr_midchain_update_rewrite(adj_index_t adj_index,
49  const void *fixup_data,
51  u8 *rewrite);
52 
53 /**
54  * @brief
55  * [re]stack a midchain. 'Stacking' is the act of forming parent-child
56  * relationships in the data-plane graph. Do NOT use this function to
57  * stack on a DPO type that might form a loop.
58  *
59  * @param adj_index
60  * The index of the midchain to stack
61  *
62  * @param dpo
63  * The parent DPO to stack onto (i.e. become a child of).
64  */
65 extern void adj_nbr_midchain_stack(adj_index_t adj_index,
66  const dpo_id_t *dpo);
67 
68 /**
69  * @brief
70  * [re]stack a midchain. 'Stacking' is the act of forming parent-child
71  * relationships in the data-plane graph. Since function performs recursive
72  * loop detection.
73  *
74  * @param adj_index
75  * The index of the midchain to stack
76  *
77  * @param fei
78  * The FIB entry to stack on
79  *
80  * @param fct
81  * The chain type to use from the fib entry fowarding
82  */
84  fib_node_index_t fei,
86 
87 /**
88  * @brief
89  * unstack a midchain. This will break the chain between the midchain and
90  * the next graph section. This is a implemented as stack-on-drop
91  *
92  * @param adj_index
93  * The index of the midchain to stack
94  */
95 extern void adj_nbr_midchain_unstack(adj_index_t adj_index);
96 
97 /**
98  * @brief descend the FIB graph looking for loops
99  *
100  * @param ai
101  * The adj index to traverse
102  *
103  * @param entry_indicies)
104  * A pointer to a vector of FIB entries already visited.
105  */
107  fib_node_index_t **entry_indicies);
108 
109 /**
110  * @brief
111  * Module initialisation
112  */
113 extern void adj_midchain_module_init(void);
114 
115 /**
116  * @brief
117  * Format a midchain adjacency
118  */
119 extern u8* format_adj_midchain(u8* s, va_list *ap);
120 
121 /**
122  * @brief
123  * create/attach a midchain delegate and stack it on the prefix passed
124  * @param ai - the index of the adjacency to stack
125  * @param fib_index - The FIB index of the prefix on which to stack
126  * @param pfx - The prefix on which to stack
127  */
129  u32 fib_index,
130  const fib_prefix_t *pfx);
131 
132 /**
133  * @brief restack a midchain delegate
134  */
136 
137 /**
138  * @brief unstack a midchain delegate (this stacks it on a drop)
139  */
141 
142 #endif
int adj_ndr_midchain_recursive_loop_detect(adj_index_t ai, fib_node_index_t **entry_indicies)
descend the FIB graph looking for loops
Definition: adj_midchain.c:660
u32 flags
Definition: vhost_user.h:141
void adj_midchain_delegate_stack(adj_index_t ai, u32 fib_index, const fib_prefix_t *pfx)
create/attach a midchain delegate and stack it on the prefix passed
void adj_nbr_midchain_unstack(adj_index_t adj_index)
unstack a midchain.
Definition: adj_midchain.c:539
unsigned char u8
Definition: types.h:56
u8 * format_adj_midchain(u8 *s, va_list *ap)
Format a midchain adjacency.
Definition: adj_midchain.c:687
void adj_nbr_midchain_stack(adj_index_t adj_index, const dpo_id_t *dpo)
[re]stack a midchain.
Definition: adj_midchain.c:642
Aggregrate type for a prefix.
Definition: fib_types.h:203
unsigned int u32
Definition: types.h:88
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:170
void adj_midchain_delegate_restack(adj_index_t ai)
restack a midchain delegate
void adj_nbr_midchain_stack_on_fib_entry(adj_index_t adj_index, fib_node_index_t fei, fib_forward_chain_type_t fct)
[re]stack a midchain.
Definition: adj_midchain.c:571
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
void(* adj_midchain_fixup_t)(vlib_main_t *vm, struct ip_adjacency_t_ *adj, vlib_buffer_t *b0, const void *data)
A function type for post-rewrite fixups on midchain adjacency.
Definition: adj.h:152
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
void adj_midchain_delegate_unstack(adj_index_t ai)
unstack a midchain delegate (this stacks it on a drop)
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
enum adj_flags_t_ adj_flags_t
Flags on an IP adjacency.
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite)
Midchain Adjacency sub-type.
Definition: adj_midchain.c:500
void adj_midchain_module_init(void)
Module initialisation.
Definition: adj_midchain.c:778