Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 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 __LISP_GPE_FWD_ENTRY_H__ |
| 21 | #define __LISP_GPE_FWD_ENTRY_H__ |
| 22 | |
| 23 | #include <vnet/lisp-gpe/lisp_gpe.h> |
| 24 | |
| 25 | /** |
| 26 | * @brief A path on which to forward lisp traffic |
| 27 | */ |
| 28 | typedef struct lisp_fwd_path_t_ |
| 29 | { |
| 30 | /** |
| 31 | * The adjacency constructed for the locator pair |
| 32 | */ |
| 33 | index_t lisp_adj; |
| 34 | |
| 35 | /** |
| 36 | * Priority. Only the paths with the best priority will be installed in FIB |
| 37 | */ |
| 38 | u8 priority; |
| 39 | |
| 40 | /** |
| 41 | * [UE]CMP weigt for the path |
| 42 | */ |
| 43 | u8 weight; |
| 44 | |
| 45 | } lisp_fwd_path_t; |
| 46 | |
| 47 | /** |
| 48 | * @brief A Forwarding entry can be 'normal' or 'negative' |
| 49 | * Negative implies we deliberately want to add a FIB entry for an EID |
| 50 | * that results in 'special' behaviour determined by an 'action'. |
| 51 | * @normal means send it down some tunnels. |
| 52 | */ |
| 53 | typedef enum lisp_gpe_fwd_entry_type_t_ |
| 54 | { |
| 55 | LISP_GPE_FWD_ENTRY_TYPE_NORMAL, |
| 56 | LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE, |
| 57 | } lisp_gpe_fwd_entry_type_t; |
| 58 | |
| 59 | |
| 60 | /** |
| 61 | * LISP-GPE fwd entry key |
| 62 | */ |
| 63 | typedef struct lisp_gpe_fwd_entry_key_t_ |
| 64 | { |
| 65 | dp_address_t rmt; |
| 66 | dp_address_t lcl; |
| 67 | u32 vni; |
| 68 | } lisp_gpe_fwd_entry_key_t; |
| 69 | |
| 70 | /** |
| 71 | * @brief A LISP Forwarding Entry |
| 72 | * |
| 73 | * A forwarding entry is from a locai EID to a remote EID over a set of rloc pairs |
| 74 | */ |
| 75 | typedef struct lisp_gpe_fwd_entry_t_ |
| 76 | { |
| 77 | /** |
| 78 | * This object joins the FIB control plane graph to receive updates to |
| 79 | * for changes to the graph. |
| 80 | */ |
| 81 | fib_node_t node; |
| 82 | |
| 83 | /** |
Florin Coras | ce1b4c7 | 2017-01-26 14:25:34 -0800 | [diff] [blame] | 84 | * The Entry's key: {lEID,rEID,vni} |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 85 | */ |
| 86 | lisp_gpe_fwd_entry_key_t *key; |
| 87 | |
| 88 | /** |
| 89 | * The forwarding entry type |
| 90 | */ |
| 91 | lisp_gpe_fwd_entry_type_t type; |
| 92 | |
| 93 | /** |
| 94 | * The tenant the entry belongs to |
| 95 | */ |
| 96 | u32 tenant; |
| 97 | |
| 98 | /** |
| 99 | * The VRF (in the case of L3) or Bridge-Domain (for L2) index |
| 100 | */ |
| 101 | union |
| 102 | { |
| 103 | /** |
| 104 | * Fields relevant to an L2 entry |
| 105 | */ |
| 106 | struct |
| 107 | { |
| 108 | /** |
| 109 | * The VRF ID |
| 110 | */ |
| 111 | u32 eid_table_id; |
| 112 | |
| 113 | /** |
| 114 | * The FIB index for the overlay, i.e. the FIB in which the EIDs |
| 115 | * are present |
| 116 | */ |
| 117 | u32 eid_fib_index; |
| 118 | /** |
| 119 | * The SRC-FIB index for created for anding source-route entries |
| 120 | */ |
| 121 | u32 src_fib_index; |
| 122 | }; |
| 123 | /** |
| 124 | * Fields relevant to an L2 entry |
| 125 | */ |
| 126 | struct |
| 127 | { |
| 128 | /** |
| 129 | * The Bridge-Domain (for L2) index |
| 130 | */ |
| 131 | u32 eid_bd_id; |
| 132 | |
| 133 | /** |
| 134 | * The Bridge-domain index for the overlay EIDs |
| 135 | */ |
| 136 | u32 eid_bd_index; |
| 137 | |
| 138 | /** |
| 139 | * The path-list created for the forwarding |
| 140 | */ |
| 141 | fib_node_index_t path_list_index; |
| 142 | |
| 143 | /** |
| 144 | * Child index of this entry on the path-list |
| 145 | */ |
| 146 | u32 child_index; |
| 147 | |
| 148 | /** |
| 149 | * The DPO used to forward |
| 150 | */ |
| 151 | dpo_id_t dpo; |
| 152 | } l2; |
Florin Coras | ce1b4c7 | 2017-01-26 14:25:34 -0800 | [diff] [blame] | 153 | |
| 154 | /** |
| 155 | * Fields relevant to an NSH entry |
| 156 | */ |
| 157 | struct |
| 158 | { |
| 159 | /** |
| 160 | * The path-list created for the forwarding |
| 161 | */ |
| 162 | fib_node_index_t path_list_index; |
| 163 | |
| 164 | /** |
| 165 | * Child index of this entry on the path-list |
| 166 | */ |
| 167 | u32 child_index; |
| 168 | |
| 169 | /** |
| 170 | * The DPO contributed by NSH |
| 171 | */ |
| 172 | dpo_id_t dpo; |
| 173 | |
| 174 | /** |
| 175 | * The DPO used for forwarding. Obtained after stacking tx node |
| 176 | * onto lb choice |
| 177 | */ |
| 178 | dpo_id_t choice; |
| 179 | } nsh; |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 180 | }; |
| 181 | |
| 182 | union |
| 183 | { |
| 184 | /** |
| 185 | * @brief When the type is 'normal' |
| 186 | * The RLOC pair that form the route's paths. i.e. where to send |
| 187 | * packets for this route. |
| 188 | */ |
| 189 | lisp_fwd_path_t *paths; |
| 190 | |
| 191 | /** |
| 192 | * @brief When the type is negative. The action to take. |
| 193 | */ |
| 194 | negative_fwd_actions_e action; |
| 195 | }; |
| 196 | } lisp_gpe_fwd_entry_t; |
| 197 | |
| 198 | extern int |
| 199 | vnet_lisp_gpe_add_del_fwd_entry (vnet_lisp_gpe_add_del_fwd_entry_args_t * a, |
| 200 | u32 * hw_if_indexp); |
| 201 | |
| 202 | extern void vnet_lisp_gpe_fwd_entry_flush (void); |
| 203 | |
| 204 | extern u32 lisp_l2_fib_lookup (lisp_gpe_main_t * lgm, |
| 205 | u16 bd_index, u8 src_mac[8], u8 dst_mac[8]); |
| 206 | |
Florin Coras | ce1b4c7 | 2017-01-26 14:25:34 -0800 | [diff] [blame] | 207 | extern const dpo_id_t *lisp_nsh_fib_lookup (lisp_gpe_main_t * lgm, |
| 208 | u32 spi_si); |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 209 | #endif |
| 210 | |
| 211 | /* |
| 212 | * fd.io coding-style-patch-verification: ON |
| 213 | * |
| 214 | * Local Variables: |
| 215 | * eval: (c-set-style "gnu") |
| 216 | * End: |
| 217 | */ |