Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 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 | */ |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 15 | /** |
| 16 | * @file |
| 17 | * @brief VXLAN GPE definitions |
| 18 | * |
| 19 | */ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 20 | #ifndef included_vnet_vxlan_gpe_h |
| 21 | #define included_vnet_vxlan_gpe_h |
| 22 | |
| 23 | #include <vppinfra/error.h> |
| 24 | #include <vppinfra/hash.h> |
| 25 | #include <vnet/vnet.h> |
| 26 | #include <vnet/ip/ip.h> |
Nick Zavaritsky | 27518c2 | 2020-02-27 15:54:58 +0000 | [diff] [blame] | 27 | #include <vnet/ip/vtep.h> |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 28 | #include <vnet/l2/l2_input.h> |
Hongjun Ni | 8a0a0ae | 2017-05-27 20:23:09 +0800 | [diff] [blame] | 29 | #include <vnet/l2/l2_output.h> |
| 30 | #include <vnet/l2/l2_bd.h> |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 31 | #include <vnet/ethernet/ethernet.h> |
| 32 | #include <vnet/vxlan-gpe/vxlan_gpe_packet.h> |
| 33 | #include <vnet/ip/ip4_packet.h> |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 34 | #include <vnet/ip/ip6_packet.h> |
Florin Coras | b040f98 | 2020-10-20 14:59:43 -0700 | [diff] [blame] | 35 | #include <vnet/udp/udp_packet.h> |
Hongjun Ni | 8a0a0ae | 2017-05-27 20:23:09 +0800 | [diff] [blame] | 36 | #include <vnet/dpo/dpo.h> |
| 37 | #include <vnet/adj/adj_types.h> |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 38 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 39 | /** |
| 40 | * @brief VXLAN GPE header struct |
| 41 | * |
| 42 | */ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 43 | typedef CLIB_PACKED (struct { |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 44 | /** 20 bytes */ |
| 45 | ip4_header_t ip4; |
| 46 | /** 8 bytes */ |
| 47 | udp_header_t udp; |
| 48 | /** 8 bytes */ |
| 49 | vxlan_gpe_header_t vxlan; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 50 | }) ip4_vxlan_gpe_header_t; |
| 51 | |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 52 | typedef CLIB_PACKED (struct { |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 53 | /** 40 bytes */ |
| 54 | ip6_header_t ip6; |
| 55 | /** 8 bytes */ |
| 56 | udp_header_t udp; |
| 57 | /** 8 bytes */ |
| 58 | vxlan_gpe_header_t vxlan; |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 59 | }) ip6_vxlan_gpe_header_t; |
| 60 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 61 | /** |
| 62 | * @brief Key struct for IPv4 VXLAN GPE tunnel. |
Artem Glazychev | ea96292 | 2021-05-28 19:09:14 +0700 | [diff] [blame] | 63 | * Key fields: local remote, vni, udp-port |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 64 | * all fields in NET byte order |
| 65 | * VNI shifted 8 bits |
| 66 | */ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 67 | typedef CLIB_PACKED(struct { |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 68 | union { |
| 69 | struct { |
| 70 | u32 local; |
| 71 | u32 remote; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 72 | |
| 73 | u32 vni; |
Artem Glazychev | ea96292 | 2021-05-28 19:09:14 +0700 | [diff] [blame] | 74 | u32 port; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 75 | }; |
| 76 | u64 as_u64[2]; |
| 77 | }; |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 78 | }) vxlan4_gpe_tunnel_key_t; |
| 79 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 80 | /** |
| 81 | * @brief Key struct for IPv6 VXLAN GPE tunnel. |
Artem Glazychev | ea96292 | 2021-05-28 19:09:14 +0700 | [diff] [blame] | 82 | * Key fields: local remote, vni, udp-port |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 83 | * all fields in NET byte order |
| 84 | * VNI shifted 8 bits |
| 85 | */ |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 86 | typedef CLIB_PACKED(struct { |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 87 | ip6_address_t local; |
| 88 | ip6_address_t remote; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 89 | u32 vni; |
Artem Glazychev | ea96292 | 2021-05-28 19:09:14 +0700 | [diff] [blame] | 90 | u32 port; |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 91 | }) vxlan6_gpe_tunnel_key_t; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 92 | |
Artem Glazychev | ea96292 | 2021-05-28 19:09:14 +0700 | [diff] [blame] | 93 | typedef union |
| 94 | { |
| 95 | struct |
| 96 | { |
| 97 | u32 tunnel_index; |
| 98 | u16 next_index; |
| 99 | u8 error; |
| 100 | }; |
| 101 | u64 as_u64; |
| 102 | } vxlan_gpe_decap_info_t; |
| 103 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 104 | /** |
| 105 | * @brief Struct for VXLAN GPE tunnel |
| 106 | */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 107 | typedef struct |
| 108 | { |
Dave Barach | eb987d3 | 2018-05-03 08:26:39 -0400 | [diff] [blame] | 109 | /* Required for pool_get_aligned */ |
| 110 | CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); |
| 111 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 112 | /** Rewrite string. $$$$ embed vnet_rewrite header */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 113 | u8 *rewrite; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 114 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 115 | /** encapsulated protocol */ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 116 | u8 protocol; |
| 117 | |
Hongjun Ni | 8a0a0ae | 2017-05-27 20:23:09 +0800 | [diff] [blame] | 118 | /* FIB DPO for IP forwarding of VXLAN-GPE encap packet */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 119 | dpo_id_t next_dpo; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 120 | /** tunnel local address */ |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 121 | ip46_address_t local; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 122 | /** tunnel remote address */ |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 123 | ip46_address_t remote; |
Artem Glazychev | ea96292 | 2021-05-28 19:09:14 +0700 | [diff] [blame] | 124 | /** local udp-port **/ |
| 125 | u16 local_port; |
| 126 | /** remote udp-port **/ |
| 127 | u16 remote_port; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 128 | |
Hongjun Ni | 8a0a0ae | 2017-05-27 20:23:09 +0800 | [diff] [blame] | 129 | /* mcast packet output intfc index (used only if dst is mcast) */ |
| 130 | u32 mcast_sw_if_index; |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 131 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 132 | /** FIB indices - tunnel partner lookup here */ |
| 133 | u32 encap_fib_index; |
| 134 | /** FIB indices - inner IP packet lookup here */ |
| 135 | u32 decap_fib_index; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 136 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 137 | /** VXLAN GPE VNI in HOST byte order, shifted left 8 bits */ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 138 | u32 vni; |
| 139 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 140 | /** vnet intfc hw_if_index */ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 141 | u32 hw_if_index; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 142 | /** vnet intfc sw_if_index */ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 143 | u32 sw_if_index; |
| 144 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 145 | /** flags */ |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 146 | u32 flags; |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 147 | |
| 148 | /** rewrite size for dynamic plugins like iOAM */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 149 | u8 rewrite_size; |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 150 | |
| 151 | /** Next node after VxLAN-GPE encap */ |
| 152 | uword encap_next_node; |
Hongjun Ni | 8a0a0ae | 2017-05-27 20:23:09 +0800 | [diff] [blame] | 153 | |
| 154 | /** |
| 155 | * Linkage into the FIB object graph |
| 156 | */ |
| 157 | fib_node_t node; |
| 158 | |
| 159 | /* |
| 160 | * The FIB entry for (depending on VXLAN-GPE tunnel is unicast or mcast) |
| 161 | * sending unicast VXLAN-GPE encap packets or receiving mcast VXLAN-GPE packets |
| 162 | */ |
| 163 | fib_node_index_t fib_entry_index; |
| 164 | adj_index_t mcast_adj_index; |
| 165 | |
| 166 | /** |
Paul Vinciguerra | bdc0e6b | 2018-09-22 05:32:50 -0700 | [diff] [blame] | 167 | * The tunnel is a child of the FIB entry for its destination. This is |
Hongjun Ni | 8a0a0ae | 2017-05-27 20:23:09 +0800 | [diff] [blame] | 168 | * so it receives updates when the forwarding information for that entry |
| 169 | * changes. |
| 170 | * The tunnels sibling index on the FIB entry's dependency list. |
| 171 | */ |
| 172 | u32 sibling_index; |
| 173 | |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 174 | } vxlan_gpe_tunnel_t; |
| 175 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 176 | /** Flags for vxlan_gpe_tunnel_t */ |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 177 | #define VXLAN_GPE_TUNNEL_IS_IPV4 1 |
| 178 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 179 | /** next nodes for VXLAN GPE input */ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 180 | #define foreach_vxlan_gpe_input_next \ |
| 181 | _(DROP, "error-drop") \ |
| 182 | _(IP4_INPUT, "ip4-input") \ |
| 183 | _(IP6_INPUT, "ip6-input") \ |
Gabriel Ganne | 7e665d6 | 2017-11-17 09:18:53 +0100 | [diff] [blame] | 184 | _(L2_INPUT, "l2-input") |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 185 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 186 | /** struct for next nodes for VXLAN GPE input */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 187 | typedef enum |
| 188 | { |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 189 | #define _(s,n) VXLAN_GPE_INPUT_NEXT_##s, |
| 190 | foreach_vxlan_gpe_input_next |
| 191 | #undef _ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 192 | VXLAN_GPE_INPUT_N_NEXT, |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 193 | } vxlan_gpe_input_next_t; |
| 194 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 195 | /** struct for VXLAN GPE errors */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 196 | typedef enum |
| 197 | { |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 198 | #define vxlan_gpe_error(n,s) VXLAN_GPE_ERROR_##n, |
| 199 | #include <vnet/vxlan-gpe/vxlan_gpe_error.def> |
| 200 | #undef vxlan_gpe_error |
| 201 | VXLAN_GPE_N_ERROR, |
| 202 | } vxlan_gpe_input_error_t; |
| 203 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 204 | /** Struct for VXLAN GPE node state */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 205 | typedef struct |
| 206 | { |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 207 | /** vector of encap tunnel instances */ |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 208 | vxlan_gpe_tunnel_t *tunnels; |
| 209 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 210 | /** lookup IPv4 VXLAN GPE tunnel by key */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 211 | uword *vxlan4_gpe_tunnel_by_key; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 212 | /** lookup IPv6 VXLAN GPE tunnel by key */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 213 | uword *vxlan6_gpe_tunnel_by_key; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 214 | |
Hongjun Ni | 8a0a0ae | 2017-05-27 20:23:09 +0800 | [diff] [blame] | 215 | /* local VTEP IPs ref count used by vxlan-bypass node to check if |
| 216 | received VXLAN packet DIP matches any local VTEP address */ |
Nick Zavaritsky | 27518c2 | 2020-02-27 15:54:58 +0000 | [diff] [blame] | 217 | vtep_table_t vtep_table; |
Hongjun Ni | 8a0a0ae | 2017-05-27 20:23:09 +0800 | [diff] [blame] | 218 | /* mcast shared info */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 219 | uword *mcast_shared; /* keyed on mcast ip46 addr */ |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 220 | /** Free vlib hw_if_indices */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 221 | u32 *free_vxlan_gpe_tunnel_hw_if_indices; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 222 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 223 | /** Mapping from sw_if_index to tunnel index */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 224 | u32 *tunnel_index_by_sw_if_index; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 225 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 226 | /** State convenience vlib_main_t */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 227 | vlib_main_t *vlib_main; |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 228 | /** State convenience vnet_main_t */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 229 | vnet_main_t *vnet_main; |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 230 | |
Junfeng Wang | 290526e | 2021-03-09 16:44:57 +0800 | [diff] [blame] | 231 | /* cache for last 8 vxlan_gpe tunnel */ |
Junfeng Wang | 290526e | 2021-03-09 16:44:57 +0800 | [diff] [blame] | 232 | vtep4_cache_t vtep4_u512; |
Junfeng Wang | 290526e | 2021-03-09 16:44:57 +0800 | [diff] [blame] | 233 | |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 234 | /** List of next nodes for the decap indexed on protocol */ |
| 235 | uword decap_next_node_list[VXLAN_GPE_PROTOCOL_MAX]; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 236 | } vxlan_gpe_main_t; |
| 237 | |
Dave Wallace | 71612d6 | 2017-10-24 01:32:41 -0400 | [diff] [blame] | 238 | extern vxlan_gpe_main_t vxlan_gpe_main; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 239 | |
| 240 | extern vlib_node_registration_t vxlan_gpe_encap_node; |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 241 | extern vlib_node_registration_t vxlan4_gpe_input_node; |
| 242 | extern vlib_node_registration_t vxlan6_gpe_input_node; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 243 | |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 244 | u8 *format_vxlan_gpe_encap_trace (u8 * s, va_list * args); |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 245 | |
Keith Burns (alagalah) | d46cca1 | 2016-08-25 11:21:39 -0700 | [diff] [blame] | 246 | /** Struct for VXLAN GPE add/del args */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 247 | typedef struct |
| 248 | { |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 249 | u8 is_add; |
Hongjun Ni | df921cc | 2016-05-25 01:16:19 +0800 | [diff] [blame] | 250 | u8 is_ip6; |
| 251 | ip46_address_t local, remote; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 252 | u8 protocol; |
Hongjun Ni | 8a0a0ae | 2017-05-27 20:23:09 +0800 | [diff] [blame] | 253 | u32 mcast_sw_if_index; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 254 | u32 encap_fib_index; |
| 255 | u32 decap_fib_index; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 256 | u32 vni; |
Artem Glazychev | ea96292 | 2021-05-28 19:09:14 +0700 | [diff] [blame] | 257 | u16 local_port; |
| 258 | u16 remote_port; |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 259 | } vnet_vxlan_gpe_add_del_tunnel_args_t; |
| 260 | |
| 261 | |
Hongjun Ni | 7deb139 | 2016-06-15 22:49:23 +0800 | [diff] [blame] | 262 | int vnet_vxlan_gpe_add_del_tunnel |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 263 | (vnet_vxlan_gpe_add_del_tunnel_args_t * a, u32 * sw_if_indexp); |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 264 | |
| 265 | |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 266 | int vxlan4_gpe_rewrite (vxlan_gpe_tunnel_t * t, u32 extension_size, |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 267 | u8 protocol_override, uword encap_next_node); |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 268 | int vxlan6_gpe_rewrite (vxlan_gpe_tunnel_t * t, u32 extension_size, |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 269 | u8 protocol_override, uword encap_next_node); |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 270 | |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 271 | /** |
| 272 | * @brief Struct for defining VXLAN GPE next nodes |
| 273 | */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 274 | typedef enum |
| 275 | { |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 276 | VXLAN_GPE_ENCAP_NEXT_IP4_LOOKUP, |
| 277 | VXLAN_GPE_ENCAP_NEXT_IP6_LOOKUP, |
| 278 | VXLAN_GPE_ENCAP_NEXT_DROP, |
| 279 | VXLAN_GPE_ENCAP_N_NEXT |
| 280 | } vxlan_gpe_encap_next_t; |
| 281 | |
| 282 | |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 283 | void vxlan_gpe_unregister_decap_protocol (u8 protocol_id, |
| 284 | uword next_node_index); |
Vengada Govindan | 6d403a0 | 2016-10-12 05:54:09 -0700 | [diff] [blame] | 285 | |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 286 | void vxlan_gpe_register_decap_protocol (u8 protocol_id, |
| 287 | uword next_node_index); |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 288 | |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 289 | void vnet_int_vxlan_gpe_bypass_mode (u32 sw_if_index, u8 is_ip6, |
| 290 | u8 is_enable); |
Keith Burns (alagalah) | 94b1442 | 2016-05-05 18:16:50 -0700 | [diff] [blame] | 291 | |
| 292 | #endif /* included_vnet_vxlan_gpe_h */ |
sharath reddy | 6f8273a | 2017-12-11 11:31:31 +0530 | [diff] [blame] | 293 | |
| 294 | /* |
| 295 | * fd.io coding-style-patch-verification: ON |
| 296 | * |
| 297 | * Local Variables: |
| 298 | * eval: (c-set-style "gnu") |
| 299 | * End: |
| 300 | */ |