FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
gbp_vxlan.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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 __GBP_VXLAN_H__
17 #define __GBP_VXLAN_H__
18 
19 #include <vnet/fib/fib_types.h>
20 #include <plugins/gbp/gbp_itf.h>
21 
22 #define foreach_gbp_vxlan_tunnel_layer \
23  _ (L2, "l2") \
24  _ (L3, "l3")
25 
27 {
28 #define _(s,n) GBP_VXLAN_TUN_##s,
30 #undef _
32 
33 /**
34  * GBP VXLAN (template) tunnel.
35  * A template tunnel has only a VNI, it does not have src,dst address.
36  * As such it cannot be used to send traffic. It is used in the RX path
37  * to RX vxlan-gbp packets that do not match an existing tunnel;
38  */
39 typedef struct gbp_vxlan_tunnel_t_
40 {
44 
45  /**
46  * The BD or RD value (depending on the layer) that the tunnel is bound to
47  */
50 
51  union
52  {
53  struct
54  {
55  /**
56  * Reference to the GPB-BD
57  */
59  };
60  struct
61  {
62  /**
63  * References to the GBP-RD
64  */
66  };
67  };
68 
69  /**
70  * gbp-itf config for this interface
71  */
73 
74  /**
75  * list of child vxlan-gbp tunnels built from this template
76  */
78 
79  /**
80  * The source address to use for child tunnels
81  */
82  ip46_address_t gt_src;
84 
85 /**
86  * The different types of interfaces that endpoints are learned on
87  */
89 {
90  /**
91  * This is the object type defined above.
92  * A template representation of a vxlan-gbp tunnel. from this tunnel
93  * type, real vxlan-gbp tunnels are created (by cloning the VNI)
94  */
96 
97  /**
98  * A real VXLAN-GBP tunnel (from vnet/vxlan-gbp/...)
99  */
102 
104  u32 bd_rd_id,
105  const ip4_address_t * src,
106  u32 * sw_if_indexp);
107 extern int gbp_vxlan_tunnel_del (u32 vni);
108 
110 
112  const ip46_address_t *
113  src,
114  const ip46_address_t *
115  dst);
116 
119 
121 extern void gbp_vxlan_walk (gbp_vxlan_cb_t cb, void *ctx);
122 
123 extern u8 *format_gbp_vxlan_tunnel (u8 * s, va_list * args);
124 extern u8 *format_gbp_vxlan_tunnel_layer (u8 * s, va_list * args);
125 
127 #endif
128 
129 /*
130  * fd.io coding-style-patch-verification: ON
131  *
132  * Local Variables:
133  * eval: (c-set-style "gnu")
134  * End:
135  */
gbp_itf_hdl_t_
Definition: gbp_itf.h:45
gbp_vxlan_walk
void gbp_vxlan_walk(gbp_vxlan_cb_t cb, void *ctx)
Definition: gbp_vxlan.c:304
vni
u32 vni
Definition: flow_types.api:160
foreach_gbp_vxlan_tunnel_layer
#define foreach_gbp_vxlan_tunnel_layer
Definition: gbp_vxlan.h:22
gbp_vxlan_tunnel_t_::gt_src
ip46_address_t gt_src
The source address to use for child tunnels.
Definition: gbp_vxlan.h:82
GBP_VXLAN_TEMPLATE_TUNNEL
@ GBP_VXLAN_TEMPLATE_TUNNEL
This is the object type defined above.
Definition: gbp_vxlan.h:95
vxlan_gbp_tunnel_get_parent
u32 vxlan_gbp_tunnel_get_parent(u32 sw_if_index)
Definition: gbp_vxlan.c:222
gbp_vxlan_tunnel_get
gbp_vxlan_tunnel_t * gbp_vxlan_tunnel_get(index_t gti)
Definition: gbp_vxlan.c:84
format_gbp_vxlan_tunnel_layer
u8 * format_gbp_vxlan_tunnel_layer(u8 *s, va_list *args)
Definition: gbp_vxlan.c:335
gbp_vxlan_tunnel_layer_t_
gbp_vxlan_tunnel_layer_t_
Definition: gbp_vxlan.h:26
gbp_vxlan_tunnel_del
int gbp_vxlan_tunnel_del(u32 vni)
Definition: gbp_vxlan.c:550
gbp_vxlan_tunnel_layer_t
enum gbp_vxlan_tunnel_layer_t_ gbp_vxlan_tunnel_layer_t
gbp_vxlan_tunnel_t_::gt_itf
gbp_itf_hdl_t gt_itf
gbp-itf config for this interface
Definition: gbp_vxlan.h:72
bd_rd_id
u32 bd_rd_id
Definition: gbp.api:387
fib_types.h
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
gbp_vxlan_tunnel_get_type
gbp_vxlan_tunnel_type_t gbp_vxlan_tunnel_get_type(u32 sw_if_index)
Definition: gbp_vxlan.c:253
gbp_itf.h
src
vl_api_address_t src
Definition: gre.api:54
gbp_vxlan_tunnel_t_::gt_vni
u32 gt_vni
Definition: gbp_vxlan.h:43
gbp_vxlan_tunnel_t_::gt_sw_if_index
u32 gt_sw_if_index
Definition: gbp_vxlan.h:42
ip4_address_t
Definition: ip4_packet.h:50
gbp_vxlan_tunnel_t_::gt_layer
gbp_vxlan_tunnel_layer_t gt_layer
Definition: gbp_vxlan.h:49
gbp_vxlan_cb_t
walk_rc_t(* gbp_vxlan_cb_t)(gbp_vxlan_tunnel_t *gt, void *ctx)
Definition: gbp_vxlan.h:120
gbp_vxlan_tunnel_t_
GBP VXLAN (template) tunnel.
Definition: gbp_vxlan.h:39
gbp_vxlan_tunnel_type_t_
gbp_vxlan_tunnel_type_t_
The different types of interfaces that endpoints are learned on.
Definition: gbp_vxlan.h:88
gbp_vxlan_tunnel_t
struct gbp_vxlan_tunnel_t_ gbp_vxlan_tunnel_t
GBP VXLAN (template) tunnel.
gbp_vxlan_tunnel_t_::gt_gbd
index_t gt_gbd
Reference to the GPB-BD.
Definition: gbp_vxlan.h:58
u32
unsigned int u32
Definition: types.h:88
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
gbp_vxlan_tunnel_t_::gt_hw_if_index
u32 gt_hw_if_index
Definition: gbp_vxlan.h:41
u8
unsigned char u8
Definition: types.h:56
gbp_vxlan_tunnel_t_::gt_grd
index_t gt_grd
References to the GBP-RD.
Definition: gbp_vxlan.h:65
gbp_vxlan_tunnel_t_::gt_tuns
index_t * gt_tuns
list of child vxlan-gbp tunnels built from this template
Definition: gbp_vxlan.h:77
VXLAN_GBP_TUNNEL
@ VXLAN_GBP_TUNNEL
A real VXLAN-GBP tunnel (from vnet/vxlan-gbp/...)
Definition: gbp_vxlan.h:100
format_gbp_vxlan_tunnel
u8 * format_gbp_vxlan_tunnel(u8 *s, va_list *args)
Definition: gbp_vxlan.c:344
gbp_vxlan_tunnel_type_t
enum gbp_vxlan_tunnel_type_t_ gbp_vxlan_tunnel_type_t
The different types of interfaces that endpoints are learned on.
gbp_vxlan_tunnel_clone_and_lock
gbp_itf_hdl_t gbp_vxlan_tunnel_clone_and_lock(u32 parent_tunnel, const ip46_address_t *src, const ip46_address_t *dst)
Definition: gbp_vxlan.c:271
gbp_vxlan_tunnel_add
int gbp_vxlan_tunnel_add(u32 vni, gbp_vxlan_tunnel_layer_t layer, u32 bd_rd_id, const ip4_address_t *src, u32 *sw_if_indexp)
Definition: gbp_vxlan.c:439
vxlan_gbp_tunnel_lock_itf
gbp_itf_hdl_t vxlan_gbp_tunnel_lock_itf(u32 sw_if_index)
Definition: gbp_vxlan.c:237
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
walk_rc_t
enum walk_rc_t_ walk_rc_t
Walk return code.
gbp_vxlan_tunnel_t_::gt_bd_rd_id
u32 gt_bd_rd_id
The BD or RD value (depending on the layer) that the tunnel is bound to.
Definition: gbp_vxlan.h:48