Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +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 | * Midchain Adjacency sub-type. These adjs represent an L3 peer on a |
| 17 | * tunnel interface. The tunnel's adjacency is thus not the end of the chain, |
| 18 | * and needs to stack on/link to another chain (or portion of the graph) to |
| 19 | * reach the tunnel's destination. |
| 20 | */ |
| 21 | |
| 22 | #ifndef __ADJ_MIDCHAIN_H__ |
| 23 | #define __ADJ_MIDCHAIN_H__ |
| 24 | |
| 25 | #include <vnet/adj/adj.h> |
| 26 | |
| 27 | /** |
| 28 | * @brief |
| 29 | * Convert an existing neighbour adjacency into a midchain |
| 30 | * |
| 31 | * @param adj_index |
| 32 | * The index of the neighbour adjacency. |
| 33 | * |
Neale Ranns | db14f5a | 2018-01-29 10:43:33 -0800 | [diff] [blame] | 34 | * @param fixup |
| 35 | * The function that will be invoked at paket switch time to 'fixup' |
| 36 | * the rewrite applied with necessary per-packet info (i.e. length, checksums). |
| 37 | * @param fixup_data |
| 38 | * Context data set by the caller that is provided as an argument in the |
| 39 | * fixup function. |
| 40 | * |
| 41 | * @param flags |
| 42 | * Flags controlling the adjacency behaviour |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 43 | * |
| 44 | * @param rewrite |
| 45 | * The rewrite. |
| 46 | */ |
| 47 | extern void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 48 | adj_midchain_fixup_t fixup, |
Neale Ranns | db14f5a | 2018-01-29 10:43:33 -0800 | [diff] [blame] | 49 | const void *fixup_data, |
Neale Ranns | fa5d198 | 2017-02-20 14:19:51 -0800 | [diff] [blame] | 50 | adj_flags_t flags, |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 51 | u8 *rewrite); |
| 52 | |
| 53 | /** |
| 54 | * @brief |
| 55 | * [re]stack a midchain. 'Stacking' is the act of forming parent-child |
| 56 | * relationships in the data-plane graph. |
| 57 | * |
| 58 | * @param adj_index |
| 59 | * The index of the midchain to stack |
| 60 | * |
| 61 | * @param dpo |
| 62 | * The parent DPO to stack onto (i.e. become a child of). |
| 63 | */ |
| 64 | extern void adj_nbr_midchain_stack(adj_index_t adj_index, |
| 65 | const dpo_id_t *dpo); |
| 66 | |
| 67 | /** |
| 68 | * @brief |
Neale Ranns | 5e575b1 | 2016-10-03 09:40:25 +0100 | [diff] [blame] | 69 | * unstack a midchain. This will break the chain between the midchain and |
| 70 | * the next graph section. This is a implemented as stack-on-drop |
| 71 | * |
| 72 | * @param adj_index |
| 73 | * The index of the midchain to stack |
| 74 | */ |
| 75 | extern void adj_nbr_midchain_unstack(adj_index_t adj_index); |
| 76 | |
| 77 | /** |
| 78 | * @brief |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 79 | * Module initialisation |
| 80 | */ |
| 81 | extern void adj_midchain_module_init(void); |
| 82 | |
| 83 | /** |
| 84 | * @brief |
| 85 | * Format a midchain adjacency |
| 86 | */ |
| 87 | extern u8* format_adj_midchain(u8* s, va_list *ap); |
| 88 | |
| 89 | #endif |