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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __GBP_VXLAN_H__
17 #define __GBP_VXLAN_H__
19 #include <vnet/fib/fib_types.h>
20 #include <plugins/gbp/gbp_itf.h>
22 #define foreach_gbp_vxlan_tunnel_layer \
26 typedef enum gbp_vxlan_tunnel_layer_t_
28 #define _(s,n) GBP_VXLAN_TUN_##s,
29 foreach_gbp_vxlan_tunnel_layer
31 } gbp_vxlan_tunnel_layer_t;
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;
39 typedef struct gbp_vxlan_tunnel_t_
46 * The BD or RD value (depending on the layer) that the tunnel is bound to
49 gbp_vxlan_tunnel_layer_t gt_layer;
56 * Reference to the GPB-BD
63 * References to the GBP-RD
70 * gbp-itf config for this interface
75 * list of child vxlan-gbp tunnels built from this template
80 * The source address to use for child tunnels
82 ip46_address_t gt_src;
86 * The different types of interfaces that endpoints are learned on
88 typedef enum gbp_vxlan_tunnel_type_t_
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)
95 GBP_VXLAN_TEMPLATE_TUNNEL,
98 * A real VXLAN-GBP tunnel (from vnet/vxlan-gbp/...)
101 } gbp_vxlan_tunnel_type_t;
103 extern int gbp_vxlan_tunnel_add (u32 vni, gbp_vxlan_tunnel_layer_t layer,
105 const ip4_address_t * src,
107 extern int gbp_vxlan_tunnel_del (u32 vni);
109 extern gbp_vxlan_tunnel_type_t gbp_vxlan_tunnel_get_type (u32 sw_if_index);
111 extern gbp_itf_hdl_t gbp_vxlan_tunnel_clone_and_lock (u32 parent_tunnel,
112 const ip46_address_t *
114 const ip46_address_t *
117 extern u32 vxlan_gbp_tunnel_get_parent (u32 sw_if_index);
118 extern gbp_itf_hdl_t vxlan_gbp_tunnel_lock_itf (u32 sw_if_index);
120 typedef walk_rc_t (*gbp_vxlan_cb_t) (gbp_vxlan_tunnel_t * gt, void *ctx);
121 extern void gbp_vxlan_walk (gbp_vxlan_cb_t cb, void *ctx);
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);
126 extern gbp_vxlan_tunnel_t *gbp_vxlan_tunnel_get (index_t gti);
130 * fd.io coding-style-patch-verification: ON
133 * eval: (c-set-style "gnu")