hs-test: logging improvements
[vpp.git] / src / vnet / flow / flow_types.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2020 Intel 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 option version = "0.0.4";
18 import "vnet/ethernet/ethernet_types.api";
19 import "vnet/ip/ip_types.api";
20
21 enum flow_type
22 {
23   FLOW_TYPE_ETHERNET = 1,
24   FLOW_TYPE_IP4,
25   FLOW_TYPE_IP6,
26   FLOW_TYPE_IP4_L2TPV3OIP,
27   FLOW_TYPE_IP4_IPSEC_ESP,
28   FLOW_TYPE_IP4_IPSEC_AH,
29   FLOW_TYPE_IP4_N_TUPLE,
30   FLOW_TYPE_IP6_N_TUPLE,
31   FLOW_TYPE_IP4_N_TUPLE_TAGGED,
32   FLOW_TYPE_IP6_N_TUPLE_TAGGED,
33   FLOW_TYPE_IP4_VXLAN,
34   FLOW_TYPE_IP6_VXLAN,
35   FLOW_TYPE_IP4_GTPC,
36   FLOW_TYPE_IP4_GTPU,
37 };
38
39 enum flow_type_v2
40 {
41   FLOW_TYPE_ETHERNET_V2 = 1,
42   FLOW_TYPE_IP4_V2,
43   FLOW_TYPE_IP6_V2,
44   FLOW_TYPE_IP4_L2TPV3OIP_V2,
45   FLOW_TYPE_IP4_IPSEC_ESP_V2,
46   FLOW_TYPE_IP4_IPSEC_AH_V2,
47   FLOW_TYPE_IP4_N_TUPLE_V2,
48   FLOW_TYPE_IP6_N_TUPLE_V2,
49   FLOW_TYPE_IP4_N_TUPLE_TAGGED_V2,
50   FLOW_TYPE_IP6_N_TUPLE_TAGGED_V2,
51   FLOW_TYPE_IP4_VXLAN_V2,
52   FLOW_TYPE_IP6_VXLAN_V2,
53   FLOW_TYPE_IP4_GTPC_V2,
54   FLOW_TYPE_IP4_GTPU_V2,
55   FLOW_TYPE_GENERIC_V2,
56 };
57
58 enum flow_action
59 {
60   FLOW_ACTION_COUNT = 1,
61   FLOW_ACTION_MARK = 2,
62   FLOW_ACTION_BUFFER_ADVANCE = 4,
63   FLOW_ACTION_REDIRECT_TO_NODE = 8,
64   FLOW_ACTION_REDIRECT_TO_QUEUE = 16,
65   FLOW_ACTION_DROP = 64,
66 };
67
68 enum flow_action_v2
69 {
70   FLOW_ACTION_COUNT_V2 = 1,
71   FLOW_ACTION_MARK_V2 = 2,
72   FLOW_ACTION_BUFFER_ADVANCE_V2 = 4,
73   FLOW_ACTION_REDIRECT_TO_NODE_V2 = 8,
74   FLOW_ACTION_REDIRECT_TO_QUEUE_V2 = 16,
75   FLOW_ACTION_RSS_V2 = 32,
76   FLOW_ACTION_DROP_V2 = 64,
77 };
78
79 enum rss_function
80 {
81   RSS_FUNC_DEFAULT,
82   RSS_FUNC_TOEPLITZ,
83   RSS_FUNC_SIMPLE_XOR,
84   RSS_FUNC_SYMMETRIC_TOEPLITZ,
85 };
86
87 typedef generic_pattern
88 {
89   u8 spec[1024];
90   u8 mask[1024];
91 };
92
93 typedef ip_port_and_mask
94 {
95   u16 port;
96   u16 mask;
97 };
98
99 typedef ip_prot_and_mask
100 {
101   vl_api_ip_proto_t prot;
102   u8 mask;
103 };
104
105 typedef flow_ethernet
106 {
107   i32 foo;
108   vl_api_mac_address_t src_addr;
109   vl_api_mac_address_t dst_addr;
110   u16 type;
111 };
112
113 typedef flow_ip4
114 {
115   i32 foo;
116   vl_api_ip4_address_and_mask_t src_addr;
117   vl_api_ip4_address_and_mask_t dst_addr;
118   vl_api_ip_prot_and_mask_t protocol;
119 };
120
121 typedef flow_ip6
122 {
123   i32 foo;
124   vl_api_ip6_address_and_mask_t src_addr;
125   vl_api_ip6_address_and_mask_t dst_addr;
126   vl_api_ip_prot_and_mask_t protocol;
127 };
128
129 typedef flow_ip4_n_tuple
130 {
131   i32 foo;
132   vl_api_ip4_address_and_mask_t src_addr;
133   vl_api_ip4_address_and_mask_t dst_addr;
134   vl_api_ip_prot_and_mask_t protocol;
135   vl_api_ip_port_and_mask_t src_port;
136   vl_api_ip_port_and_mask_t dst_port;
137 };
138
139 typedef flow_ip6_n_tuple
140 {
141   i32 foo;
142   vl_api_ip6_address_and_mask_t src_addr;
143   vl_api_ip6_address_and_mask_t dst_addr;
144   vl_api_ip_prot_and_mask_t protocol;
145   vl_api_ip_port_and_mask_t src_port;
146   vl_api_ip_port_and_mask_t dst_port;
147 };
148
149 typedef flow_ip4_n_tuple_tagged
150 {
151   i32 foo;
152   vl_api_ip4_address_and_mask_t src_addr;
153   vl_api_ip4_address_and_mask_t dst_addr;
154   vl_api_ip_prot_and_mask_t protocol;
155   vl_api_ip_port_and_mask_t src_port;
156   vl_api_ip_port_and_mask_t dst_port;
157 };
158
159 typedef flow_ip6_n_tuple_tagged
160 {
161   i32 foo;
162   vl_api_ip6_address_and_mask_t src_addr;
163   vl_api_ip6_address_and_mask_t dst_addr;
164   vl_api_ip_prot_and_mask_t protocol;
165   vl_api_ip_port_and_mask_t src_port;
166   vl_api_ip_port_and_mask_t dst_port;
167 };
168
169 typedef flow_ip4_l2tpv3oip
170 {
171   i32 foo;
172   vl_api_ip4_address_and_mask_t src_addr;
173   vl_api_ip4_address_and_mask_t dst_addr;
174   vl_api_ip_prot_and_mask_t protocol;
175   u32 session_id;
176 };
177
178 typedef flow_ip4_ipsec_esp
179 {
180   i32 foo;
181   vl_api_ip4_address_and_mask_t src_addr;
182   vl_api_ip4_address_and_mask_t dst_addr;
183   vl_api_ip_prot_and_mask_t protocol;
184   u32 spi;
185 };
186
187 typedef flow_ip4_ipsec_ah
188 {
189   i32 foo;
190   vl_api_ip4_address_and_mask_t src_addr;
191   vl_api_ip4_address_and_mask_t dst_addr;
192   vl_api_ip_prot_and_mask_t protocol;
193   u32 spi;
194 };
195
196 typedef flow_ip4_vxlan
197 {
198   i32 foo;
199   vl_api_ip4_address_and_mask_t src_addr;
200   vl_api_ip4_address_and_mask_t dst_addr;
201   vl_api_ip_prot_and_mask_t protocol;
202   vl_api_ip_port_and_mask_t src_port;
203   vl_api_ip_port_and_mask_t dst_port;
204   u32 vni;
205 };
206
207 typedef flow_ip6_vxlan
208 {
209   i32 foo;
210   vl_api_ip6_address_and_mask_t src_addr;
211   vl_api_ip6_address_and_mask_t dst_addr;
212   vl_api_ip_prot_and_mask_t protocol;
213   vl_api_ip_port_and_mask_t src_port;
214   vl_api_ip_port_and_mask_t dst_port;
215   u32 vni;
216 };
217
218 typedef flow_ip4_gtpc
219 {
220   i32 foo;
221   vl_api_ip4_address_and_mask_t src_addr;
222   vl_api_ip4_address_and_mask_t dst_addr;
223   vl_api_ip_prot_and_mask_t protocol;
224   vl_api_ip_port_and_mask_t src_port;
225   vl_api_ip_port_and_mask_t dst_port;
226   u32 teid;
227 };
228
229 typedef flow_ip4_gtpu
230 {
231   i32 foo;
232   vl_api_ip4_address_and_mask_t src_addr;
233   vl_api_ip4_address_and_mask_t dst_addr;
234   vl_api_ip_prot_and_mask_t protocol;
235   vl_api_ip_port_and_mask_t src_port;
236   vl_api_ip_port_and_mask_t dst_port;
237   u32 teid;
238 };
239
240 typedef flow_generic
241 {
242   i32 foo;
243   vl_api_generic_pattern_t pattern;
244 };
245
246 union flow
247 {
248   vl_api_flow_ethernet_t ethernet;
249   vl_api_flow_ip4_t ip4;
250   vl_api_flow_ip6_t ip6;
251   vl_api_flow_ip4_l2tpv3oip_t ip4_l2tpv3oip;
252   vl_api_flow_ip4_ipsec_esp_t ip4_ipsec_esp;
253   vl_api_flow_ip4_ipsec_ah_t ip4_ipsec_ah;
254   vl_api_flow_ip4_n_tuple_t ip4_n_tuple;
255   vl_api_flow_ip6_n_tuple_t ip6_n_tuple;
256   vl_api_flow_ip4_n_tuple_tagged_t ip4_n_tuple_tagged;
257   vl_api_flow_ip6_n_tuple_tagged_t ip6_n_tuple_tagged;
258   vl_api_flow_ip4_vxlan_t ip4_vxlan;
259   vl_api_flow_ip6_vxlan_t ip6_vxlan;
260   vl_api_flow_ip4_gtpc_t ip4_gtpc;
261   vl_api_flow_ip4_gtpu_t ip4_gtpu;
262 };
263
264 union flow_v2
265 {
266   vl_api_flow_ethernet_t ethernet;
267   vl_api_flow_ip4_t ip4;
268   vl_api_flow_ip6_t ip6;
269   vl_api_flow_ip4_l2tpv3oip_t ip4_l2tpv3oip;
270   vl_api_flow_ip4_ipsec_esp_t ip4_ipsec_esp;
271   vl_api_flow_ip4_ipsec_ah_t ip4_ipsec_ah;
272   vl_api_flow_ip4_n_tuple_t ip4_n_tuple;
273   vl_api_flow_ip6_n_tuple_t ip6_n_tuple;
274   vl_api_flow_ip4_n_tuple_tagged_t ip4_n_tuple_tagged;
275   vl_api_flow_ip6_n_tuple_tagged_t ip6_n_tuple_tagged;
276   vl_api_flow_ip4_vxlan_t ip4_vxlan;
277   vl_api_flow_ip6_vxlan_t ip6_vxlan;
278   vl_api_flow_ip4_gtpc_t ip4_gtpc;
279   vl_api_flow_ip4_gtpu_t ip4_gtpu;
280   vl_api_flow_generic_t generic;
281 };
282
283 /* main flow struct */
284 typedef flow_rule
285 {
286   /* flow type */
287   vl_api_flow_type_t type;
288   
289   /* flow index */
290   u32 index;
291   
292   /* bitmap of flow actions (FLOW_ACTION_*) */
293   vl_api_flow_action_t actions;
294
295   /* flow id for VNET_FLOW_ACTION_MARK */
296   u32 mark_flow_id;
297
298   /* node index and next index for FLOW_ACTION_REDIRECT_TO_NODE */
299   u32 redirect_node_index;
300   u32 redirect_device_input_next_index;
301
302   /* queue for FLOW_ACTION_REDIRECT_TO_QUEUE */
303   u32 redirect_queue;
304
305   /* buffer offset for FLOW_ACTION_BUFFER_ADVANCE */
306   i32 buffer_advance;
307   
308   /* flow enum */
309   vl_api_flow_t flow;
310 };
311
312 /* main flow struct */
313 typedef flow_rule_v2
314 {
315   /* flow type */
316   vl_api_flow_type_v2_t type;
317
318   /* flow index */
319   u32 index;
320
321   /* bitmap of flow actions (FLOW_ACTION_*) */
322   vl_api_flow_action_v2_t actions;
323
324   /* flow id for VNET_FLOW_ACTION_MARK */
325   u32 mark_flow_id;
326
327   /* node index and next index for FLOW_ACTION_REDIRECT_TO_NODE */
328   u32 redirect_node_index;
329   u32 redirect_device_input_next_index;
330
331   /* queue for FLOW_ACTION_REDIRECT_TO_QUEUE */
332   u32 redirect_queue;
333
334   /* start queue index and queue numbers for RSS queue group with FLOW_ACTION_RSS */
335   u32 queue_index;
336   u32 queue_num;
337
338   /* buffer offset for FLOW_ACTION_BUFFER_ADVANCE */
339   i32 buffer_advance;
340
341   /* RSS types, including IPv4/IPv6/TCP/UDP... */
342   u64 rss_types;
343
344   /* RSS functions, including IPv4/IPv6/TCP/UDP... */
345   vl_api_rss_function_t rss_fun;
346
347   /* flow enum */
348   vl_api_flow_v2_t flow;
349 };