qos: api clenup
[vpp.git] / src / vnet / qos / qos.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2018 Cisco and/or its affiliates.
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
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.1";
29
30 import "vnet/ip/ip_types.api";
31 import "vnet/interface_types.api";
32
33 enum qos_source : u8
34 {
35   QOS_API_SOURCE_EXT = 0,
36   QOS_API_SOURCE_VLAN = 1,
37   QOS_API_SOURCE_MPLS = 2,
38   QOS_API_SOURCE_IP = 3,
39 };
40
41 /**
42  * QoS store.
43  * @param sw_if_index - The interface on which store is enabled.
44  * @param input_source - The input source/layer at which the QoS bits are stored
45  *                       See qos_source_t. This determines what packets have a
46  *                       value stored. i.e. If IP is seleted this affects on IP
47  *                       packets.
48  * @param value - The value to store.
49  */
50 typedef qos_store
51 {
52   vl_api_interface_index_t sw_if_index;
53   vl_api_qos_source_t input_source;
54   u8 value;
55 };
56
57 /**
58  * Enable/Disable QoS storing
59  * The QoS bits from the packet at the specified input layer are copied
60  * into the packet. Storeing should be used in conjunction with marking
61  * @param enable - enable=1 or disable the feature
62  * @param store - Store configuration
63  */
64 autoreply define qos_store_enable_disable
65 {
66   u32 client_index;
67   u32 context;
68   bool enable [default=true];
69   vl_api_qos_store_t store;
70 };
71
72 /**
73  * Dump the QoS store configs
74  */
75 define qos_store_dump
76 {
77   u32 client_index;
78   u32 context;
79 };
80
81 /**
82  * Details of QoS recording configs
83  */
84 define qos_store_details
85 {
86   u32 context;
87   vl_api_qos_store_t store;
88 };
89
90 /**
91  * QoS recording.
92  * @param sw_if_index - The interface on which recording is enabled.
93  * @param input_source - The input source/layer at which the QoS bits
94                          are copied from the packet. See qos_source_t.
95  */
96 typedef qos_record
97 {
98   vl_api_interface_index_t sw_if_index;
99   vl_api_qos_source_t input_source;
100 };
101
102 /**
103  * Enable/Disable QoS recording
104  * The QoS bits from the packet at the specified input layer are copied
105  * into the packet. Recording should be used in conjunction with marking
106  * @param enable - enable=1 or disable the feature
107  * @param record - Recording configuration
108  */
109 autoreply define qos_record_enable_disable
110 {
111   u32 client_index;
112   u32 context;
113   bool enable [default=true];
114   vl_api_qos_record_t record;
115 };
116
117 /**
118  * Dump the QoS record configs
119  */
120 define qos_record_dump
121 {
122   u32 client_index;
123   u32 context;
124 };
125
126 /**
127  * Details of QoS recording configs
128  */
129 define qos_record_details
130 {
131   u32 context;
132   vl_api_qos_record_t record;
133 };
134
135 /**
136  * @brief A row within a QoS map
137  *  Each value translates from an input value to an output.
138  */
139 typedef qos_egress_map_row
140 {
141   u8 outputs[256];
142 };
143
144 /**
145  * QoS Translation Map
146  *
147  * @param id - client provided identifier for the map
148  * @param rows - one row (per-input source) of output values
149  */
150 typedef qos_egress_map
151 {
152   u32 id;
153   vl_api_qos_egress_map_row_t rows[4];
154 };
155
156 /**
157  *  @brief Update a QoS Map
158  *   A QoS map, translates from the QoS value in the packet set by the 'record'
159  *   feature, to the value used for output in the 'mark' feature.
160  *   There is one row in the map for each input/record source.
161  *   The MAP is then applied to the egress interface at for a given output source
162  * @param map - The Map
163  */
164 autoreply define qos_egress_map_update
165 {
166   u32 client_index;
167   u32 context;
168   vl_api_qos_egress_map_t map;
169 };
170
171 /**
172  * @brief Delete a Qos Map
173  * @param map_id - ID of the map to delete
174  */
175 autoreply define qos_egress_map_delete
176 {
177   u32 client_index;
178   u32 context;
179   u32 id;
180 };
181
182 /**
183  * Dump the QoS egress maps
184  */
185 define qos_egress_map_dump
186 {
187   u32 client_index;
188   u32 context;
189 };
190
191 /**
192  * QoS map details
193  */
194 define qos_egress_map_details
195 {
196   u32 context;
197   vl_api_qos_egress_map_t map;
198 };
199
200 /**
201  * QoS marking Cponfiguration
202  * The QoS bits from the buffer are mapped (using the desired egress map)
203  * into the header of the 'output-source'. Marking should be used in
204  * conjunction with recording
205  * @param sw_if_index - The interface on which recording is enabled.
206  * @param output_source - The output source/layer at which the QoS bits
207  *                        are written into the packet. See qos_source_t.
208  * @param map_id - The ID of the MAP in which the translation from input
209  *                 to output is performed.
210  */
211 typedef qos_mark
212 {
213   u32 sw_if_index;
214   u32 map_id;
215   vl_api_qos_source_t output_source;
216 };
217
218 /**
219  * @brief Enable/Disable QoS marking
220  * @param enable - enable=1 or disable the feature
221  * @param mark - Marking config
222  */
223 autoreply define qos_mark_enable_disable
224 {
225   u32 client_index;
226   u32 context;
227   bool enable [default=true];
228   vl_api_qos_mark_t mark;
229 };
230
231 /**
232  * Dump QoS marking configs
233  */
234 define qos_mark_dump
235 {
236   u32 client_index;
237   u32 context;
238   vl_api_interface_index_t sw_if_index;
239 };
240
241 /**
242  * QoS marking details
243  */
244 autoreply define qos_mark_details
245 {
246   u32 context;
247   vl_api_qos_mark_t mark;
248 };
249
250 /*
251  * Local Variables:
252  * eval: (c-set-style "gnu")
253  * End:
254  */