Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 2 | * Copyright (c) 2016 Cisco and/or its affiliates. |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 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 | */ |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 15 | /** |
| 16 | * @file |
| 17 | * @brief LISP-GPE definitions. |
| 18 | */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 19 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 20 | #ifndef included_vnet_lisp_gpe_h |
| 21 | #define included_vnet_lisp_gpe_h |
| 22 | |
| 23 | #include <vppinfra/error.h> |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 24 | #include <vppinfra/mhash.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 25 | #include <vnet/vnet.h> |
| 26 | #include <vnet/ip/ip.h> |
| 27 | #include <vnet/l2/l2_input.h> |
| 28 | #include <vnet/ethernet/ethernet.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 29 | #include <vnet/ip/ip4_packet.h> |
| 30 | #include <vnet/ip/udp.h> |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 31 | #include <vnet/lisp-cp/lisp_types.h> |
| 32 | #include <vnet/lisp-gpe/lisp_gpe_packet.h> |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 33 | #include <vnet/adj/adj_types.h> |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 34 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 35 | /** IP4-UDP-LISP encap header */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 36 | /* *INDENT-OFF* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 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; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 42 | /* *INDENT-ON* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 43 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 44 | /** IP6-UDP-LISP encap header */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 45 | /* *INDENT-OFF* */ |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 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; |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 51 | /* *INDENT-ON* */ |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 52 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 53 | /** LISP-GPE tunnel structure */ |
Florin Coras | 3590ac5 | 2016-08-08 16:04:26 +0200 | [diff] [blame] | 54 | typedef struct |
| 55 | { |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 56 | /** tunnel src and dst addresses */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 57 | locator_pair_t *locator_pairs; |
Florin Coras | 3590ac5 | 2016-08-08 16:04:26 +0200 | [diff] [blame] | 58 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 59 | /** locator-pairs with best priority become sub-tunnels */ |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 60 | u32 *sub_tunnels; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 61 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 62 | /** decap next index */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 63 | u32 decap_next_index; |
| 64 | |
Florin Coras | 3590ac5 | 2016-08-08 16:04:26 +0200 | [diff] [blame] | 65 | /* TODO remove */ |
| 66 | ip_address_t src, dst; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 67 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 68 | /** FIB indices */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 69 | u32 encap_fib_index; /* tunnel partner lookup here */ |
| 70 | u32 decap_fib_index; /* inner IP lookup here */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 71 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 72 | /** index of the source address lookup FIB */ |
| 73 | u32 src_fib_index; |
| 74 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 75 | /** vnet intfc hw/sw_if_index */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 76 | u32 hw_if_index; |
| 77 | u32 sw_if_index; |
| 78 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 79 | /** L2 path-list */ |
| 80 | fib_node_index_t l2_path_list; |
| 81 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 82 | /** action for 'negative' tunnels */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 83 | u8 action; |
| 84 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 85 | /** LISP header fields in HOST byte order */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 86 | u8 flags; |
| 87 | u8 ver_res; |
| 88 | u8 res; |
| 89 | u8 next_protocol; |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 90 | u32 vni; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 91 | } lisp_gpe_tunnel_t; |
| 92 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 93 | /** |
| 94 | * @brief A path on which to forward lisp traffic |
| 95 | */ |
| 96 | typedef struct lisp_fwd_path_t_ |
| 97 | { |
| 98 | /** |
| 99 | * The adjacency constructed for the locator pair |
| 100 | */ |
| 101 | index_t lisp_adj; |
| 102 | |
| 103 | /** |
| 104 | * Priority. Only the paths with the best priority will be installed in FIB |
| 105 | */ |
| 106 | u8 priority; |
| 107 | |
| 108 | /** |
| 109 | * [UE]CMP weigt for the path |
| 110 | */ |
| 111 | u8 weight; |
| 112 | |
| 113 | } lisp_fwd_path_t; |
| 114 | |
| 115 | /** |
| 116 | * @brief A Forwarding entry can be 'normal' or 'negative' |
| 117 | * Negative implies we deliberately want to add a FIB entry for an EID |
| 118 | * that results in 'spcial' behaviour determined by an 'action'. |
| 119 | * @normal' means send it down some tunnels. |
| 120 | */ |
| 121 | typedef enum lisp_fwd_entry_type_t_ |
| 122 | { |
| 123 | LISP_FWD_ENTRY_TYPE_NORMAL, |
| 124 | LISP_FWD_ENTRY_TYPE_NEGATIVE, |
| 125 | } lisp_fwd_entry_type_t; |
| 126 | |
| 127 | typedef enum |
| 128 | { |
| 129 | NO_ACTION, |
| 130 | FORWARD_NATIVE, |
| 131 | SEND_MAP_REQUEST, |
| 132 | DROP |
| 133 | } negative_fwd_actions_e; |
| 134 | |
| 135 | /** |
| 136 | * LISP-GPE fwd entry key |
| 137 | */ |
| 138 | typedef struct lisp_gpe_fwd_entry_key_t_ |
| 139 | { |
| 140 | dp_address_t rmt; |
| 141 | dp_address_t lcl; |
| 142 | u32 vni; |
| 143 | } lisp_gpe_fwd_entry_key_t; |
| 144 | |
| 145 | /** |
| 146 | * @brief A LISP Forwarding Entry |
| 147 | * |
| 148 | * A forwarding entry is from a locai EID to a remote EID over a set of rloc pairs |
| 149 | */ |
| 150 | typedef struct lisp_fwd_entry_t_ |
| 151 | { |
| 152 | /** |
| 153 | * The Entry's key: {lEID,r-EID,vni} |
| 154 | */ |
| 155 | lisp_gpe_fwd_entry_key_t *key; |
| 156 | |
| 157 | /** |
| 158 | * The VRF (in the case of L3) or Bridge-Domain (for L2) index |
| 159 | */ |
| 160 | union |
| 161 | { |
| 162 | u32 eid_table_id; |
| 163 | u32 eid_bd_index; |
| 164 | }; |
| 165 | |
| 166 | /** |
| 167 | * The forwarding entry type |
| 168 | */ |
| 169 | lisp_fwd_entry_type_t type; |
| 170 | |
| 171 | union |
| 172 | { |
| 173 | /** |
| 174 | * @brief When the type is 'normal' |
| 175 | * The RLOC pair that form the route's paths. i.e. where to send |
| 176 | * packets for this route. |
| 177 | */ |
| 178 | lisp_fwd_path_t *paths; |
| 179 | |
| 180 | /** |
| 181 | * @brief When the type is negative. The action to take. |
| 182 | */ |
| 183 | negative_fwd_actions_e action; |
| 184 | }; |
| 185 | |
| 186 | /** |
| 187 | * The FIB index for the overlay, i.e. the FIB in which the EIDs |
| 188 | * are present |
| 189 | */ |
| 190 | u32 eid_fib_index; |
| 191 | |
| 192 | /** |
| 193 | * The SRC-FIB index for created for anding source-route entries |
| 194 | */ |
| 195 | u32 src_fib_index; |
| 196 | } lisp_fwd_entry_t; |
| 197 | |
| 198 | |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 199 | #define foreach_lisp_gpe_ip_input_next \ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 200 | _(DROP, "error-drop") \ |
| 201 | _(IP4_INPUT, "ip4-input") \ |
| 202 | _(IP6_INPUT, "ip6-input") \ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 203 | _(L2_INPUT, "l2-input") |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 204 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 205 | /** Enum of possible next nodes post LISP-GPE decap */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 206 | typedef enum |
| 207 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 208 | #define _(s,n) LISP_GPE_INPUT_NEXT_##s, |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 209 | foreach_lisp_gpe_ip_input_next |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 210 | #undef _ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 211 | LISP_GPE_INPUT_N_NEXT, |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 212 | } lisp_gpe_input_next_t; |
| 213 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 214 | typedef enum |
| 215 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 216 | #define lisp_gpe_error(n,s) LISP_GPE_ERROR_##n, |
| 217 | #include <vnet/lisp-gpe/lisp_gpe_error.def> |
| 218 | #undef lisp_gpe_error |
| 219 | LISP_GPE_N_ERROR, |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 220 | } lisp_gpe_error_t; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 221 | |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 222 | typedef struct tunnel_lookup |
| 223 | { |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 224 | /** Lookup lisp-gpe interfaces by dp table (eg. vrf/bridge index) */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 225 | uword *hw_if_index_by_dp_table; |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 226 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 227 | /** lookup decap tunnel termination sw_if_index by vni and vice versa */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 228 | uword *sw_if_index_by_vni; |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 229 | |
| 230 | // FIXME - Need this? |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 231 | uword *vni_by_sw_if_index; |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 232 | } tunnel_lookup_t; |
| 233 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 234 | /** LISP-GPE global state*/ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 235 | typedef struct lisp_gpe_main |
| 236 | { |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 237 | /** pool of encap tunnel instances */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 238 | lisp_gpe_tunnel_t *tunnels; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 239 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 240 | /** Free vlib hw_if_indices */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 241 | u32 *free_tunnel_hw_if_indices; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 242 | |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 243 | u8 is_en; |
| 244 | |
| 245 | /* L3 data structures |
| 246 | * ================== */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 247 | tunnel_lookup_t l3_ifaces; |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 248 | |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 249 | /* L2 data structures |
| 250 | * ================== */ |
| 251 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 252 | /** L2 LISP FIB */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 253 | BVT (clib_bihash) l2_fib; |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 254 | |
| 255 | tunnel_lookup_t l2_ifaces; |
| 256 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 257 | /** Load-balance for a miss in the table */ |
| 258 | index_t l2_lb_miss; |
| 259 | index_t l2_lb_cp_lkup; |
| 260 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 261 | /** convenience */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 262 | vlib_main_t *vlib_main; |
| 263 | vnet_main_t *vnet_main; |
| 264 | ip4_main_t *im4; |
| 265 | ip6_main_t *im6; |
| 266 | ip_lookup_main_t *lm4; |
| 267 | ip_lookup_main_t *lm6; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 268 | } lisp_gpe_main_t; |
| 269 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 270 | /** LISP-GPE global state*/ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 271 | lisp_gpe_main_t lisp_gpe_main; |
| 272 | |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 273 | always_inline lisp_gpe_main_t * |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 274 | vnet_lisp_gpe_get_main () |
| 275 | { |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 276 | return &lisp_gpe_main; |
| 277 | } |
| 278 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 279 | |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 280 | extern vlib_node_registration_t lisp_gpe_ip4_input_node; |
| 281 | extern vlib_node_registration_t lisp_gpe_ip6_input_node; |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 282 | extern vnet_hw_interface_class_t lisp_gpe_hw_class; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 283 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 284 | u8 *format_lisp_gpe_header_with_length (u8 * s, va_list * args); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 285 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 286 | /** Arguments to add an L2/L3 LISP-GPE interface*/ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 287 | typedef struct |
| 288 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 289 | u8 is_add; |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 290 | union |
| 291 | { |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 292 | /** vrf */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 293 | u32 table_id; |
| 294 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 295 | /** bridge domain */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 296 | u16 bd_id; |
| 297 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 298 | /** generic access */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 299 | u32 dp_table; |
| 300 | }; |
| 301 | u8 is_l2; |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 302 | |
| 303 | /** virtual network identifier in host byte order */ |
| 304 | u32 vni; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 305 | } vnet_lisp_gpe_add_del_iface_args_t; |
| 306 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 307 | /** Read LISP-GPE status */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 308 | u8 vnet_lisp_gpe_enable_disable_status (void); |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 309 | |
| 310 | /** Add/del LISP-GPE interface. */ |
Andrej Kozemcak | 8ebb2a1 | 2016-06-07 12:25:20 +0200 | [diff] [blame] | 311 | int |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 312 | vnet_lisp_gpe_add_del_iface (vnet_lisp_gpe_add_del_iface_args_t * a, |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 313 | u32 * hw_if_indexp); |
| 314 | |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 315 | typedef struct |
| 316 | { |
| 317 | u8 is_en; |
| 318 | } vnet_lisp_gpe_enable_disable_args_t; |
| 319 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 320 | clib_error_t |
| 321 | * vnet_lisp_gpe_enable_disable (vnet_lisp_gpe_enable_disable_args_t * a); |
Florin Coras | 577c355 | 2016-04-21 00:45:40 +0200 | [diff] [blame] | 322 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 323 | /** */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 324 | typedef struct |
| 325 | { |
| 326 | u8 is_add; |
Florin Coras | ed09a05 | 2016-05-06 14:22:40 +0200 | [diff] [blame] | 327 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 328 | /** type of mapping */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 329 | u8 is_negative; |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 330 | |
| 331 | /** action for negative mappings */ |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 332 | negative_fwd_actions_e action; |
Florin Coras | ed09a05 | 2016-05-06 14:22:40 +0200 | [diff] [blame] | 333 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 334 | /** local eid */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 335 | gid_address_t lcl_eid; |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 336 | |
| 337 | /** remote eid */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 338 | gid_address_t rmt_eid; |
Florin Coras | ed09a05 | 2016-05-06 14:22:40 +0200 | [diff] [blame] | 339 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 340 | /** vector of locator pairs */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 341 | locator_pair_t *locator_pairs; |
Florin Coras | ed09a05 | 2016-05-06 14:22:40 +0200 | [diff] [blame] | 342 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 343 | /** FIB index to lookup remote locator at encap */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 344 | u32 encap_fib_index; |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 345 | |
| 346 | /** FIB index to lookup inner IP at decap */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 347 | u32 decap_fib_index; |
Florin Coras | ed09a05 | 2016-05-06 14:22:40 +0200 | [diff] [blame] | 348 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 349 | /* TODO remove */ |
| 350 | u32 decap_next_index; |
Florin Coras | ed09a05 | 2016-05-06 14:22:40 +0200 | [diff] [blame] | 351 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 352 | /** VNI/tenant id in HOST byte order */ |
Florin Coras | ed09a05 | 2016-05-06 14:22:40 +0200 | [diff] [blame] | 353 | u32 vni; |
| 354 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 355 | /** vrf or bd where fwd entry should be inserted */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 356 | union |
| 357 | { |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 358 | /** table (vrf) id */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 359 | u32 table_id; |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 360 | |
| 361 | /** bridge domain id */ |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 362 | u16 bd_id; |
Florin Coras | 429e795 | 2016-08-02 02:31:03 +0200 | [diff] [blame] | 363 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 364 | /** generic access */ |
Florin Coras | 429e795 | 2016-08-02 02:31:03 +0200 | [diff] [blame] | 365 | u32 dp_table; |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 366 | }; |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 367 | } vnet_lisp_gpe_add_del_fwd_entry_args_t; |
| 368 | |
| 369 | int |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 370 | vnet_lisp_gpe_add_del_fwd_entry (vnet_lisp_gpe_add_del_fwd_entry_args_t * a, |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 371 | u32 * hw_if_indexp); |
| 372 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame^] | 373 | extern void |
| 374 | ip_src_fib_add_route (u32 src_fib_index, |
| 375 | const ip_prefix_t * src_prefix, |
| 376 | const lisp_fwd_path_t * paths); |
| 377 | extern void |
| 378 | ip_src_dst_fib_del_route (u32 src_fib_index, |
| 379 | const ip_prefix_t * src_prefix, |
| 380 | u32 dst_table_id, const ip_prefix_t * dst_prefix); |
| 381 | extern void |
| 382 | ip_src_fib_add_route_w_dpo (u32 src_fib_index, |
| 383 | const ip_prefix_t * src_prefix, |
| 384 | const dpo_id_t * src_dpo); |
| 385 | extern u32 |
| 386 | ip_dst_fib_add_route (u32 dst_table_id, const ip_prefix_t * dst_prefix); |
| 387 | |
| 388 | extern fib_route_path_t *lisp_gpe_mk_paths_for_sub_tunnels (lisp_gpe_tunnel_t |
| 389 | * t); |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 390 | |
| 391 | #define foreach_lgpe_ip4_lookup_next \ |
| 392 | _(DROP, "error-drop") \ |
| 393 | _(LISP_CP_LOOKUP, "lisp-cp-lookup") |
| 394 | |
| 395 | typedef enum lgpe_ip4_lookup_next |
| 396 | { |
| 397 | #define _(sym,str) LGPE_IP4_LOOKUP_NEXT_##sym, |
| 398 | foreach_lgpe_ip4_lookup_next |
| 399 | #undef _ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 400 | LGPE_IP4_LOOKUP_N_NEXT, |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 401 | } lgpe_ip4_lookup_next_t; |
| 402 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 403 | #define foreach_lgpe_ip6_lookup_next \ |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 404 | _(DROP, "error-drop") \ |
| 405 | _(LISP_CP_LOOKUP, "lisp-cp-lookup") |
| 406 | |
| 407 | typedef enum lgpe_ip6_lookup_next |
| 408 | { |
| 409 | #define _(sym,str) LGPE_IP6_LOOKUP_NEXT_##sym, |
| 410 | foreach_lgpe_ip6_lookup_next |
| 411 | #undef _ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 412 | LGPE_IP6_LOOKUP_N_NEXT, |
Florin Coras | 02655bd | 2016-04-26 00:17:24 +0200 | [diff] [blame] | 413 | } lgpe_ip6_lookup_next_t; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 414 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 415 | u8 *format_vnet_lisp_gpe_status (u8 * s, va_list * args); |
Filip Tehlar | 46d4e36 | 2016-05-09 09:39:26 +0200 | [diff] [blame] | 416 | |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 417 | #define L2_FIB_DEFAULT_HASH_NUM_BUCKETS (64 * 1024) |
| 418 | #define L2_FIB_DEFAULT_HASH_MEMORY_SIZE (32<<20) |
| 419 | |
| 420 | u32 |
| 421 | lisp_l2_fib_lookup (lisp_gpe_main_t * lgm, u16 bd_index, u8 src_mac[8], |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 422 | u8 dst_mac[8]); |
Florin Coras | 1a1adc7 | 2016-07-22 01:45:30 +0200 | [diff] [blame] | 423 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 424 | #endif /* included_vnet_lisp_gpe_h */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 425 | |
| 426 | /* |
| 427 | * fd.io coding-style-patch-verification: ON |
| 428 | * |
| 429 | * Local Variables: |
| 430 | * eval: (c-set-style "gnu") |
| 431 | * End: |
| 432 | */ |