FD.io VPP  v16.12-rc0-308-g931be3a
Vector Packet Processing
lisp_gpe.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  * @file
17  * @brief LISP-GPE definitions.
18  */
19 
20 #ifndef included_vnet_lisp_gpe_h
21 #define included_vnet_lisp_gpe_h
22 
23 #include <vppinfra/error.h>
24 #include <vppinfra/mhash.h>
25 #include <vnet/vnet.h>
26 #include <vnet/ip/ip.h>
27 #include <vnet/l2/l2_input.h>
28 #include <vnet/ethernet/ethernet.h>
29 #include <vnet/ip/ip4_packet.h>
30 #include <vnet/ip/udp.h>
33 #include <vnet/adj/adj_types.h>
34 
35 /** IP4-UDP-LISP encap header */
36 /* *INDENT-OFF* */
37 typedef CLIB_PACKED (struct {
38  ip4_header_t ip4; /* 20 bytes */
39  udp_header_t udp; /* 8 bytes */
40  lisp_gpe_header_t lisp; /* 8 bytes */
41 }) ip4_udp_lisp_gpe_header_t;
42 /* *INDENT-ON* */
43 
44 /** IP6-UDP-LISP encap header */
45 /* *INDENT-OFF* */
46 typedef CLIB_PACKED (struct {
47  ip6_header_t ip6; /* 40 bytes */
48  udp_header_t udp; /* 8 bytes */
49  lisp_gpe_header_t lisp; /* 8 bytes */
50 }) ip6_udp_lisp_gpe_header_t;
51 /* *INDENT-ON* */
52 
53 #define foreach_lisp_gpe_ip_input_next \
54 _(DROP, "error-drop") \
55 _(IP4_INPUT, "ip4-input") \
56 _(IP6_INPUT, "ip6-input") \
57 _(L2_INPUT, "l2-input")
58 
59 /** Enum of possible next nodes post LISP-GPE decap */
60 typedef enum
61 {
62 #define _(s,n) LISP_GPE_INPUT_NEXT_##s,
64 #undef _
67 
68 typedef enum
69 {
70 #define lisp_gpe_error(n,s) LISP_GPE_ERROR_##n,
72 #undef lisp_gpe_error
73  LISP_GPE_N_ERROR,
75 
76 typedef struct tunnel_lookup
77 {
78  /** Lookup lisp-gpe interfaces by dp table (eg. vrf/bridge index) */
80 
81  /** lookup decap tunnel termination sw_if_index by vni and vice versa */
83 
84  // FIXME - Need this?
87 
88 /** LISP-GPE global state*/
89 typedef struct lisp_gpe_main
90 {
91  /**
92  * @brief DB of all forwarding entries. The Key is:{l-EID,r-EID,vni}
93  * where the EID encodes L2 or L3
94  */
96 
97  /**
98  * @brief A Pool of all LISP forwarding entries
99  */
101 
102  /** Free vlib hw_if_indices */
104 
106 
107  /* L3 data structures
108  * ================== */
110 
111  /* L2 data structures
112  * ================== */
113 
114  /** L2 LISP FIB */
115  BVT (clib_bihash) l2_fib;
116 
117  tunnel_lookup_t l2_ifaces;
118 
119  /** Load-balance for a miss in the table */
120  dpo_id_t l2_lb_cp_lkup;
121 
122  /** convenience */
130 
131 /** LISP-GPE global state*/
133 
136 {
137  return &lisp_gpe_main;
138 }
139 
140 
144 
145 u8 *format_lisp_gpe_header_with_length (u8 * s, va_list * args);
146 
147 /** Read LISP-GPE status */
149 
150 u32
152  u32 overlay_table_id, u32 vni);
153 
154 /** Add/del LISP-GPE interface. */
155 extern void lisp_gpe_del_l2_iface (lisp_gpe_main_t * lgm, u32 vni, u32 bd_id);
156 extern u32 lisp_gpe_add_l2_iface (lisp_gpe_main_t * lgm, u32 vni, u32 bd_id);
157 extern void lisp_gpe_del_l3_iface (lisp_gpe_main_t * lgm, u32 vni, u32 bd_id);
158 extern u32 lisp_gpe_add_l3_iface (lisp_gpe_main_t * lgm, u32 vni, u32 bd_id);
159 
160 
161 typedef struct
162 {
165 
168 
169 typedef enum
170 {
176 
177 /** */
178 typedef struct
179 {
181 
182  /** type of mapping */
184 
185  /** action for negative mappings */
186  negative_fwd_actions_e action;
187 
188  /** local eid */
190 
191  /** remote eid */
193 
194  /** vector of locator pairs */
196 
197  /** FIB index to lookup remote locator at encap */
199 
200  /** FIB index to lookup inner IP at decap */
202 
203  /* TODO remove */
205 
206  /** VNI/tenant id in HOST byte order */
208 
209  /** vrf or bd where fwd entry should be inserted */
210  union
211  {
212  /** table (vrf) id */
214 
215  /** bridge domain id */
217 
218  /** generic access */
220  };
222 
223 #define foreach_lgpe_ip4_lookup_next \
224  _(DROP, "error-drop") \
225  _(LISP_CP_LOOKUP, "lisp-cp-lookup")
226 
228 {
229 #define _(sym,str) LGPE_IP4_LOOKUP_NEXT_##sym,
231 #undef _
234 
235 #define foreach_lgpe_ip6_lookup_next \
236  _(DROP, "error-drop") \
237  _(LISP_CP_LOOKUP, "lisp-cp-lookup")
238 
240 {
241 #define _(sym,str) LGPE_IP6_LOOKUP_NEXT_##sym,
243 #undef _
246 
247 u8 *format_vnet_lisp_gpe_status (u8 * s, va_list * args);
248 
249 #endif /* included_vnet_lisp_gpe_h */
250 
251 /*
252  * fd.io coding-style-patch-verification: ON
253  *
254  * Local Variables:
255  * eval: (c-set-style "gnu")
256  * End:
257  */
#define foreach_lisp_gpe_ip_input_next
Definition: lisp_gpe.h:53
u32 * free_tunnel_hw_if_indices
Free vlib hw_if_indices.
Definition: lisp_gpe.h:103
lisp_gpe_main_t lisp_gpe_main
LISP-GPE global state.
Definition: lisp_gpe.h:132
a
Definition: bitmap.h:516
LISP-GPE global state.
Definition: lisp_gpe.h:89
u32 encap_fib_index
FIB index to lookup remote locator at encap.
Definition: lisp_gpe.h:198
clib_error_t * vnet_lisp_gpe_enable_disable(vnet_lisp_gpe_enable_disable_args_t *a)
Enable/disable LISP-GPE.
Definition: lisp_gpe.c:183
struct _vlib_node_registration vlib_node_registration_t
vnet_hw_interface_class_t lisp_gpe_hw_class
uword * vni_by_sw_if_index
Definition: lisp_gpe.h:85
void lisp_gpe_del_l2_iface(lisp_gpe_main_t *lgm, u32 vni, u32 bd_id)
Add/del LISP-GPE interface.
Definition: interface.c:603
vlib_node_registration_t lisp_gpe_ip4_input_node
(constructor) VLIB_REGISTER_NODE (lisp_gpe_ip4_input_node)
Definition: decap.c:452
static lisp_gpe_main_t * vnet_lisp_gpe_get_main()
Definition: lisp_gpe.h:135
lgpe_ip6_lookup_next
Definition: lisp_gpe.h:239
#define always_inline
Definition: clib.h:84
u16 bd_id
bridge domain id
Definition: lisp_gpe.h:216
static BVT(clib_bihash)
Definition: adj_nbr.c:26
u8 is_add
Definition: lisp_gpe.h:180
typedef CLIB_PACKED(struct{ip4_header_t ip4;udp_header_t udp;lisp_gpe_header_t lisp;}) ip4_udp_lisp_gpe_header_t
IP4-UDP-LISP encap header.
uword * lisp_gpe_fwd_entries
DB of all forwarding entries.
Definition: lisp_gpe.h:95
int vlib_main(vlib_main_t *volatile vm, unformat_input_t *input)
Definition: main.c:1573
struct tunnel_lookup tunnel_lookup_t
Definition: lisp_gpe.h:178
u32 lisp_gpe_add_l3_iface(lisp_gpe_main_t *lgm, u32 vni, u32 bd_id)
Add/del LISP-GPE L3 interface.
Definition: interface.c:469
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
u32 table_id
table (vrf) id
Definition: lisp_gpe.h:213
vlib_node_registration_t lisp_gpe_ip6_input_node
(constructor) VLIB_REGISTER_NODE (lisp_gpe_ip6_input_node)
Definition: decap.c:474
vnet_main_t vnet_main
Definition: misc.c:43
u32 decap_next_index
Definition: lisp_gpe.h:204
LISP-GPE packet header structure.
u8 * format_lisp_gpe_header_with_length(u8 *s, va_list *args)
Definition: interface.c:172
u8 is_negative
type of mapping
Definition: lisp_gpe.h:183
uword * sw_if_index_by_vni
lookup decap tunnel termination sw_if_index by vni and vice versa
Definition: lisp_gpe.h:82
u32 vni
VNI/tenant id in HOST byte order.
Definition: lisp_gpe.h:207
void lisp_gpe_del_l3_iface(lisp_gpe_main_t *lgm, u32 vni, u32 bd_id)
Definition: interface.c:509
lisp_gpe_input_next_t
Enum of possible next nodes post LISP-GPE decap.
Definition: lisp_gpe.h:60
u32 decap_fib_index
FIB index to lookup inner IP at decap.
Definition: lisp_gpe.h:201
enum lgpe_ip6_lookup_next lgpe_ip6_lookup_next_t
LISP-GPE header.
#define foreach_lgpe_ip4_lookup_next
Definition: lisp_gpe.h:223
struct _gid_address_t gid_address_t
enum lgpe_ip4_lookup_next lgpe_ip4_lookup_next_t
unsigned int u32
Definition: types.h:88
IPv4 main type.
Definition: ip4.h:95
uword * hw_if_index_by_dp_table
Lookup lisp-gpe interfaces by dp table (eg.
Definition: lisp_gpe.h:79
lisp_gpe_error_t
Definition: lisp_gpe.h:68
#define foreach_lgpe_ip6_lookup_next
Definition: lisp_gpe.h:235
gid_address_t rmt_eid
remote eid
Definition: lisp_gpe.h:192
u64 uword
Definition: types.h:112
u32 lisp_gpe_l3_iface_find_or_create(lisp_gpe_main_t *lgm, u32 overlay_table_id, u32 vni)
negative_fwd_actions_e action
action for negative mappings
Definition: lisp_gpe.h:186
Definition: lisp_gpe.h:174
unsigned short u16
Definition: types.h:57
struct lisp_gpe_fwd_entry_t_ * lisp_fwd_entry_pool
A Pool of all LISP forwarding entries.
Definition: lisp_gpe.h:100
u32 lisp_gpe_add_l2_iface(lisp_gpe_main_t *lgm, u32 vni, u32 bd_id)
Add/del LISP-GPE L2 interface.
Definition: interface.c:546
struct _vnet_hw_interface_class vnet_hw_interface_class_t
unsigned char u8
Definition: types.h:56
tunnel_lookup_t l3_ifaces
Definition: lisp_gpe.h:109
u8 * format_vnet_lisp_gpe_status(u8 *s, va_list *args)
Format LISP-GPE status.
Definition: lisp_gpe.c:282
u32 dp_table
generic access
Definition: lisp_gpe.h:219
negative_fwd_actions_e
Definition: lisp_gpe.h:169
locator_pair_t * locator_pairs
vector of locator pairs
Definition: lisp_gpe.h:195
u8 vnet_lisp_gpe_enable_disable_status(void)
Read LISP-GPE status.
Definition: lisp_gpe.c:174
lgpe_ip4_lookup_next
Definition: lisp_gpe.h:227
gid_address_t lcl_eid
local eid
Definition: lisp_gpe.h:189
A LISP Forwarding Entry.