Neale Ranns | ed234e7 | 2018-09-05 09:36:05 -0700 | [diff] [blame] | 1 | /* Hey Emacs use -*- mode: C -*- */ |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 2 | /* |
Neale Ranns | ed234e7 | 2018-09-05 09:36:05 -0700 | [diff] [blame] | 3 | * Copyright (c) 2018 Cisco and/or its affiliates. |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at: |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Neale Ranns | 83832e7 | 2019-07-31 02:48:02 -0700 | [diff] [blame] | 17 | /** |
| 18 | * @file |
| 19 | * This file defines QoS record, store and mark API messages which are generally |
| 20 | * called through a shared memory interface. |
| 21 | * |
| 22 | * Definitions of verbs: |
| 23 | * store: write a QoS value into the buffer meta-data |
| 24 | * record: Extract a QoS value from a packet header and store it. |
| 25 | * mark: Make a change to the content of a packet header by writing a stored |
| 26 | * QoS value |
| 27 | */ |
| 28 | option version = "1.1.0"; |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 29 | |
Neale Ranns | 83832e7 | 2019-07-31 02:48:02 -0700 | [diff] [blame] | 30 | import "vnet/ip/ip_types.api"; |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 31 | |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 32 | enum qos_source : u8 |
Neale Ranns | ed234e7 | 2018-09-05 09:36:05 -0700 | [diff] [blame] | 33 | { |
| 34 | QOS_API_SOURCE_EXT = 0, |
| 35 | QOS_API_SOURCE_VLAN = 1, |
| 36 | QOS_API_SOURCE_MPLS = 2, |
| 37 | QOS_API_SOURCE_IP = 3, |
| 38 | }; |
| 39 | |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 40 | /** |
Neale Ranns | 83832e7 | 2019-07-31 02:48:02 -0700 | [diff] [blame] | 41 | * QoS store. |
| 42 | * @param sw_if_index - The interface on which store is enabled. |
| 43 | * @param input_source - The input source/layer at which the QoS bits are stored |
| 44 | * See qos_source_t. This determines what packets have a |
| 45 | * value stored. i.e. If IP is seleted this affects on IP |
| 46 | * packets. |
| 47 | * @param value - The value to store. |
| 48 | */ |
| 49 | typedef qos_store |
| 50 | { |
| 51 | u32 sw_if_index; |
| 52 | vl_api_qos_source_t input_source; |
| 53 | u8 value; |
| 54 | }; |
| 55 | |
| 56 | /** |
| 57 | * Enable/Disable QoS storing |
| 58 | * The QoS bits from the packet at the specified input layer are copied |
| 59 | * into the packet. Storeing should be used in conjunction with marking |
| 60 | * @param enable - enable=1 or disable the feature |
| 61 | * @param store - Store configuration |
| 62 | */ |
| 63 | autoreply define qos_store_enable_disable |
| 64 | { |
| 65 | u32 client_index; |
| 66 | u32 context; |
| 67 | u8 enable; |
| 68 | vl_api_qos_store_t store; |
| 69 | }; |
| 70 | |
| 71 | /** |
| 72 | * Dump the QoS store configs |
| 73 | */ |
| 74 | define qos_store_dump |
| 75 | { |
| 76 | u32 client_index; |
| 77 | u32 context; |
| 78 | }; |
| 79 | |
| 80 | /** |
| 81 | * Details of QoS recording configs |
| 82 | */ |
| 83 | define qos_store_details |
| 84 | { |
| 85 | u32 context; |
| 86 | vl_api_qos_store_t store; |
| 87 | }; |
| 88 | |
| 89 | /** |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 90 | * QoS recording. |
| 91 | * @param sw_if_index - The interface on which recording is enabled. |
| 92 | * @param input_source - The input source/layer at which the QoS bits |
| 93 | are copied from the packet. See qos_source_t. |
| 94 | */ |
| 95 | typedef qos_record |
| 96 | { |
| 97 | u32 sw_if_index; |
| 98 | vl_api_qos_source_t input_source; |
| 99 | }; |
| 100 | |
| 101 | /** |
| 102 | * Enable/Disable QoS recording |
| 103 | * The QoS bits from the packet at the specified input layer are copied |
| 104 | * into the packet. Recording should be used in conjunction with marking |
| 105 | * @param enable - enable=1 or disable the feature |
| 106 | * @param record - Recording configuration |
| 107 | */ |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 108 | autoreply define qos_record_enable_disable |
| 109 | { |
| 110 | u32 client_index; |
| 111 | u32 context; |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 112 | u8 enable; |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 113 | vl_api_qos_record_t record; |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 114 | }; |
| 115 | |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 116 | /** |
| 117 | * Dump the QoS record configs |
| 118 | */ |
| 119 | define qos_record_dump |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 120 | { |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 121 | u32 client_index; |
| 122 | u32 context; |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 123 | }; |
| 124 | |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 125 | /** |
| 126 | * Details of QoS recording configs |
| 127 | */ |
| 128 | define qos_record_details |
| 129 | { |
| 130 | u32 context; |
| 131 | vl_api_qos_record_t record; |
| 132 | }; |
| 133 | |
| 134 | /** |
| 135 | * @brief A row within a QoS map |
| 136 | * Each value translates from an input value to an output. |
| 137 | */ |
| 138 | typedef qos_egress_map_row |
| 139 | { |
| 140 | u8 outputs[256]; |
| 141 | }; |
| 142 | |
| 143 | /** |
| 144 | * QoS Translation Map |
| 145 | * |
| 146 | * @param id - client provided identifier for the map |
| 147 | * @param rows - one row (per-input source) of output values |
| 148 | */ |
| 149 | typedef qos_egress_map |
| 150 | { |
| 151 | u32 id; |
| 152 | vl_api_qos_egress_map_row_t rows[4]; |
| 153 | }; |
| 154 | |
| 155 | /** |
| 156 | * @brief Update a QoS Map |
| 157 | * A QoS map, translates from the QoS value in the packet set by the 'record' |
| 158 | * feature, to the value used for output in the 'mark' feature. |
| 159 | * There is one row in the map for each input/record source. |
| 160 | * The MAP is then applied to the egress interface at for a given output source |
| 161 | * @param map - The Map |
| 162 | */ |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 163 | autoreply define qos_egress_map_update |
| 164 | { |
| 165 | u32 client_index; |
| 166 | u32 context; |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 167 | vl_api_qos_egress_map_t map; |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 168 | }; |
| 169 | |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 170 | /** |
| 171 | * @brief Delete a Qos Map |
| 172 | * @param map_id - ID of the map to delete |
| 173 | */ |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 174 | autoreply define qos_egress_map_delete |
| 175 | { |
| 176 | u32 client_index; |
| 177 | u32 context; |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 178 | u32 id; |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 179 | }; |
| 180 | |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 181 | /** |
| 182 | * Dump the QoS egress maps |
| 183 | */ |
| 184 | define qos_egress_map_dump |
| 185 | { |
| 186 | u32 client_index; |
| 187 | u32 context; |
| 188 | }; |
| 189 | |
| 190 | /** |
| 191 | * QoS map details |
| 192 | */ |
| 193 | define qos_egress_map_details |
| 194 | { |
| 195 | u32 context; |
| 196 | vl_api_qos_egress_map_t map; |
| 197 | }; |
| 198 | |
| 199 | /** |
| 200 | * QoS marking Cponfiguration |
| 201 | * The QoS bits from the buffer are mapped (using the desired egress map) |
| 202 | * into the header of the 'output-source'. Marking should be used in |
| 203 | * conjunction with recording |
| 204 | * @param sw_if_index - The interface on which recording is enabled. |
| 205 | * @param output_source - The output source/layer at which the QoS bits |
| 206 | * are written into the packet. See qos_source_t. |
| 207 | * @param map_id - The ID of the MAP in which the translation from input |
| 208 | * to output is performed. |
| 209 | */ |
| 210 | typedef qos_mark |
| 211 | { |
| 212 | u32 sw_if_index; |
| 213 | u32 map_id; |
| 214 | vl_api_qos_source_t output_source; |
| 215 | }; |
| 216 | |
| 217 | /** |
| 218 | * @brief Enable/Disable QoS marking |
| 219 | * @param enable - enable=1 or disable the feature |
| 220 | * @param mark - Marking config |
| 221 | */ |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 222 | autoreply define qos_mark_enable_disable |
| 223 | { |
| 224 | u32 client_index; |
| 225 | u32 context; |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 226 | u8 enable; |
Neale Ranns | 5281a90 | 2019-07-23 08:16:19 -0700 | [diff] [blame] | 227 | vl_api_qos_mark_t mark; |
| 228 | }; |
| 229 | |
| 230 | /** |
| 231 | * Dump QoS marking configs |
| 232 | */ |
| 233 | define qos_mark_dump |
| 234 | { |
| 235 | u32 client_index; |
| 236 | u32 context; |
| 237 | u32 sw_if_index; |
| 238 | }; |
| 239 | |
| 240 | /** |
| 241 | * QoS marking details |
| 242 | */ |
| 243 | autoreply define qos_mark_details |
| 244 | { |
| 245 | u32 context; |
| 246 | vl_api_qos_mark_t mark; |
Neale Ranns | 039cbfe | 2018-02-27 03:45:38 -0800 | [diff] [blame] | 247 | }; |
| 248 | |
| 249 | /* |
| 250 | * Local Variables: |
| 251 | * eval: (c-set-style "gnu") |
| 252 | * End: |
| 253 | */ |