blob: 5d4405c6010bf0784c80f48f29a98ce88269ddda [file] [log] [blame]
Rich Lanea06d0c32013-03-25 08:52:03 -07001// Copyright 2013, Big Switch Networks, Inc.
2//
3// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
4// the following special exception:
5//
6// LOXI Exception
7//
8// As a special exception to the terms of the EPL, you may distribute libraries
9// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
10// that copyright and licensing notices generated by LoxiGen are not altered or removed
11// from the LoxiGen Libraries and the notice provided below is (i) included in
12// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
13// documentation for the LoxiGen Libraries, if distributed in binary form.
14//
15// Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
16//
17// You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
18// a copy of the EPL at:
19//
20// http://www.eclipse.org/legal/epl-v10.html
21//
22// Unless required by applicable law or agreed to in writing, software
23// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
25// EPL for the specific language governing permissions and limitations
26// under the EPL.
Rich Lane5d33a622013-04-08 17:33:11 -070027//
28// Also derived from the OpenFlow header files which have these copyrights:
29// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
30// Copyright (c) 2011, 2012 Open Networking Foundation
Rich Lanea06d0c32013-03-25 08:52:03 -070031
32#version 1
33
Rich Lane5d33a622013-04-08 17:33:11 -070034enum macro_definitions {
35 OFP_MAX_TABLE_NAME_LEN = 32,
36 OFP_MAX_PORT_NAME_LEN = 16,
37
38 OFP_TCP_PORT = 6633,
39 OFP_SSL_PORT = 6633,
40
41 OFP_ETH_ALEN = 6,
42
43 OFP_DEFAULT_MISS_SEND_LEN = 128,
44
45 OFP_VLAN_NONE = 0xffff,
46
47 OFPFW_ICMP_TYPE = 0x40,
48 OFPFW_ICMP_CODE = 0x80,
49
50 OFP_DL_TYPE_ETH2_CUTOFF = 0x600,
51 OFP_DL_TYPE_NOT_ETH_TYPE = 0x5ff,
52
53 OFP_FLOW_PERMANENT = 0,
54
55 OFP_DEFAULT_PRIORITY = 0x8000,
56
57 DESC_STR_LEN = 256,
58 SERIAL_NUM_LEN = 32,
59
60 OFPQ_ALL = 0xffffffff,
61 OFPQ_MIN_RATE_UNCFG = 0xffff,
62};
63
64enum ofp_type {
65 OFPT_HELLO = 0,
66 OFPT_ERROR = 1,
67 OFPT_ECHO_REQUEST = 2,
68 OFPT_ECHO_REPLY = 3,
69 OFPT_VENDOR = 4,
70 OFPT_FEATURES_REQUEST = 5,
71 OFPT_FEATURES_REPLY = 6,
72 OFPT_GET_CONFIG_REQUEST = 7,
73 OFPT_GET_CONFIG_REPLY = 8,
74 OFPT_SET_CONFIG = 9,
75 OFPT_PACKET_IN = 10,
76 OFPT_FLOW_REMOVED = 11,
77 OFPT_PORT_STATUS = 12,
78 OFPT_PACKET_OUT = 13,
79 OFPT_FLOW_MOD = 14,
80 OFPT_PORT_MOD = 15,
81 OFPT_STATS_REQUEST = 16,
82 OFPT_STATS_REPLY = 17,
83 OFPT_BARRIER_REQUEST = 18,
84 OFPT_BARRIER_REPLY = 19,
85 OFPT_QUEUE_GET_CONFIG_REQUEST = 20,
86 OFPT_QUEUE_GET_CONFIG_REPLY = 21,
87};
88
89enum ofp_port_config {
90 OFPPC_PORT_DOWN = 0x1,
91 OFPPC_NO_STP = 0x2,
92 OFPPC_NO_RECV = 0x4,
93 OFPPC_NO_RECV_STP = 0x8,
94 OFPPC_NO_FLOOD = 0x10,
95 OFPPC_NO_FWD = 0x20,
96 OFPPC_NO_PACKET_IN = 0x40,
97};
98
99enum ofp_port_state {
100 OFPPS_STP_LISTEN = 0,
101 OFPPS_LINK_DOWN = 1,
102 OFPPS_STP_LEARN = 0x100,
103 OFPPS_STP_FORWARD = 0x200,
104 OFPPS_STP_BLOCK = 0x300,
105 OFPPS_STP_MASK = 0x300,
106};
107
108enum ofp_port {
109 OFPP_MAX = 0xffffff00,
110 OFPP_IN_PORT = 0xfffffff8,
111 OFPP_TABLE = 0xfffffff9,
112 OFPP_NORMAL = 0xfffffffa,
113 OFPP_FLOOD = 0xfffffffb,
114 OFPP_ALL = 0xfffffffc,
115 OFPP_CONTROLLER = 0xfffffffd,
116 OFPP_LOCAL = 0xfffffffe,
117 OFPP_NONE = 0xffffffff,
118};
119
120enum ofp_port_features {
121 OFPPF_10MB_HD = 0x1,
122 OFPPF_10MB_FD = 0x2,
123 OFPPF_100MB_HD = 0x4,
124 OFPPF_100MB_FD = 0x8,
125 OFPPF_1GB_HD = 0x10,
126 OFPPF_1GB_FD = 0x20,
127 OFPPF_10GB_FD = 0x40,
128 OFPPF_COPPER = 0x80,
129 OFPPF_FIBER = 0x100,
130 OFPPF_AUTONEG = 0x200,
131 OFPPF_PAUSE = 0x400,
132 OFPPF_PAUSE_ASYM = 0x800,
133};
134
135enum ofp_queue_properties {
136 OFPQT_NONE = 0,
137 OFPQT_MIN_RATE = 1,
138};
139
140enum ofp_flow_wildcards {
141 OFPFW_IN_PORT = 0x1,
142 OFPFW_DL_VLAN = 0x2,
143 OFPFW_DL_SRC = 0x4,
144 OFPFW_NW_DST_BITS = 0x6,
145 OFPFW_NW_SRC_BITS = 0x6,
146 OFPFW_NW_SRC_SHIFT = 0x8,
147 OFPFW_DL_DST = 0x8,
148 OFPFW_NW_DST_SHIFT = 0xe,
149 OFPFW_DL_TYPE = 0x10,
150 OFPFW_NW_PROTO = 0x20,
151 OFPFW_TP_SRC = 0x40,
152 OFPFW_TP_DST = 0x80,
153 OFPFW_NW_SRC_ALL = 0x2000,
154 OFPFW_NW_SRC_MASK = 0x3f00,
155 OFPFW_NW_DST_ALL = 0x80000,
156 OFPFW_NW_DST_MASK = 0xfc000,
157 OFPFW_DL_VLAN_PCP = 0x100000,
158 OFPFW_NW_TOS = 0x200000,
159 OFPFW_ALL = 0x3fffff,
160};
161
162enum ofp_action_type {
163 OFPAT_OUTPUT = 0,
164 OFPAT_SET_VLAN_VID = 1,
165 OFPAT_SET_VLAN_PCP = 2,
166 OFPAT_STRIP_VLAN = 3,
167 OFPAT_SET_DL_SRC = 4,
168 OFPAT_SET_DL_DST = 5,
169 OFPAT_SET_NW_SRC = 6,
170 OFPAT_SET_NW_DST = 7,
171 OFPAT_SET_NW_TOS = 8,
172 OFPAT_SET_TP_SRC = 9,
173 OFPAT_SET_TP_DST = 10,
174 OFPAT_ENQUEUE = 11,
175 OFPAT_VENDOR = 0xffff,
176};
177
178enum ofp_capabilities {
179 OFPC_FLOW_STATS = 0x1,
180 OFPC_TABLE_STATS = 0x2,
181 OFPC_PORT_STATS = 0x4,
182 OFPC_STP = 0x8,
183 OFPC_RESERVED = 0x10,
184 OFPC_IP_REASM = 0x20,
185 OFPC_QUEUE_STATS = 0x40,
186 OFPC_ARP_MATCH_IP = 0x80,
187};
188
189enum ofp_config_flags {
190 OFPC_FRAG_NORMAL = 0x0,
191 OFPC_FRAG_DROP = 0x1,
192 OFPC_FRAG_REASM = 0x2,
193 OFPC_FRAG_MASK = 0x3,
194};
195
196enum ofp_flow_mod_command {
197 OFPFC_ADD = 0,
198 OFPFC_MODIFY = 1,
199 OFPFC_MODIFY_STRICT = 2,
200 OFPFC_DELETE = 3,
201 OFPFC_DELETE_STRICT = 4,
202};
203
204enum ofp_flow_mod_flags {
205 OFPFF_SEND_FLOW_REM = 0x1,
206 OFPFF_CHECK_OVERLAP = 0x2,
207 OFPFF_EMERG = 0x4,
208};
209
210enum ofp_stats_reply_flags {
211 OFPSF_REPLY_MORE = 0x1,
212};
213
214enum ofp_stats_types {
215 OFPST_DESC = 0,
216 OFPST_FLOW = 1,
217 OFPST_AGGREGATE = 2,
218 OFPST_TABLE = 3,
219 OFPST_PORT = 4,
220 OFPST_QUEUE = 5,
221 OFPST_VENDOR = 0xffff,
222};
223
224enum ofp_packet_in_reason {
225 OFPR_NO_MATCH = 0,
226 OFPR_ACTION = 1,
227};
228
229enum ofp_flow_removed_reason {
230 OFPRR_IDLE_TIMEOUT = 0,
231 OFPRR_HARD_TIMEOUT = 1,
232 OFPRR_DELETE = 2,
233};
234
235enum ofp_port_reason {
236 OFPPR_ADD = 0,
237 OFPPR_DELETE = 1,
238 OFPPR_MODIFY = 2,
239};
240
241enum ofp_error_type {
242 OFPET_HELLO_FAILED = 0,
243 OFPET_BAD_REQUEST = 1,
244 OFPET_BAD_ACTION = 2,
245 OFPET_FLOW_MOD_FAILED = 3,
246 OFPET_PORT_MOD_FAILED = 4,
247 OFPET_QUEUE_OP_FAILED = 5,
248};
249
250enum ofp_hello_failed_code {
251 OFPHFC_INCOMPATIBLE = 0,
252 OFPHFC_EPERM = 1,
253};
254
255enum ofp_bad_request_code {
256 OFPBRC_BAD_VERSION = 0,
257 OFPBRC_BAD_TYPE = 1,
258 OFPBRC_BAD_STAT = 2,
259 OFPBRC_BAD_VENDOR = 3,
260 OFPBRC_BAD_SUBTYPE = 4,
261 OFPBRC_EPERM = 5,
262 OFPBRC_BAD_LEN = 6,
263 OFPBRC_BUFFER_EMPTY = 7,
264 OFPBRC_BUFFER_UNKNOWN = 8,
265};
266
267enum ofp_bad_action_code {
268 OFPBAC_BAD_TYPE = 0,
269 OFPBAC_BAD_LEN = 1,
270 OFPBAC_BAD_VENDOR = 2,
271 OFPBAC_BAD_VENDOR_TYPE = 3,
272 OFPBAC_BAD_OUT_PORT = 4,
273 OFPBAC_BAD_ARGUMENT = 5,
274 OFPBAC_EPERM = 6,
275 OFPBAC_TOO_MANY = 7,
276 OFPBAC_BAD_QUEUE = 8,
277};
278
279enum ofp_flow_mod_failed_code {
280 OFPFMFC_ALL_TABLES_FULL = 0,
281 OFPFMFC_OVERLAP = 1,
282 OFPFMFC_EPERM = 2,
283 OFPFMFC_BAD_EMERG_TIMEOUT = 3,
284 OFPFMFC_BAD_COMMAND = 4,
285 OFPFMFC_UNSUPPORTED = 5,
286};
287
288enum ofp_port_mod_failed_code {
289 OFPPMFC_BAD_PORT = 0,
290 OFPPMFC_BAD_HW_ADDR = 1,
291};
292
293enum ofp_queue_op_failed_code {
294 OFPQOFC_BAD_PORT = 0,
295 OFPQOFC_BAD_QUEUE = 1,
296 OFPQOFC_EPERM = 2,
297};
298
Rich Lane68ae4d72013-05-09 10:55:19 -0700299struct of_header {
Rich Lanea06d0c32013-03-25 08:52:03 -0700300 uint8_t version;
301 uint8_t type;
302 uint16_t length;
303 uint32_t xid;
304};
305
Rich Lane68ae4d72013-05-09 10:55:19 -0700306struct of_hello {
Rich Lanea06d0c32013-03-25 08:52:03 -0700307 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700308 uint8_t type == 0;
Rich Lanea06d0c32013-03-25 08:52:03 -0700309 uint16_t length;
310 uint32_t xid;
311};
312
Rich Lane68ae4d72013-05-09 10:55:19 -0700313struct of_echo_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700314 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700315 uint8_t type == 2;
Rich Lanea06d0c32013-03-25 08:52:03 -0700316 uint16_t length;
317 uint32_t xid;
318 of_octets_t data;
319};
320
Rich Lane68ae4d72013-05-09 10:55:19 -0700321struct of_echo_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700322 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700323 uint8_t type == 3;
Rich Lanea06d0c32013-03-25 08:52:03 -0700324 uint16_t length;
325 uint32_t xid;
326 of_octets_t data;
327};
328
Rich Lane68ae4d72013-05-09 10:55:19 -0700329struct of_experimenter {
Rich Lanea06d0c32013-03-25 08:52:03 -0700330 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700331 uint8_t type == 4;
Rich Lanea06d0c32013-03-25 08:52:03 -0700332 uint16_t length;
333 uint32_t xid;
334 uint32_t experimenter;
335 uint32_t subtype;
336 of_octets_t data;
337};
338
Rich Lane68ae4d72013-05-09 10:55:19 -0700339struct of_barrier_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700340 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700341 uint8_t type == 18;
Rich Lanea06d0c32013-03-25 08:52:03 -0700342 uint16_t length;
343 uint32_t xid;
344};
345
Rich Lane68ae4d72013-05-09 10:55:19 -0700346struct of_barrier_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700347 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700348 uint8_t type == 19;
Rich Lanea06d0c32013-03-25 08:52:03 -0700349 uint16_t length;
350 uint32_t xid;
351};
352
Rich Lane68ae4d72013-05-09 10:55:19 -0700353struct of_get_config_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700354 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700355 uint8_t type == 7;
Rich Lanea06d0c32013-03-25 08:52:03 -0700356 uint16_t length;
357 uint32_t xid;
358};
359
Rich Lane68ae4d72013-05-09 10:55:19 -0700360struct of_get_config_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700361 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700362 uint8_t type == 8;
Rich Lanea06d0c32013-03-25 08:52:03 -0700363 uint16_t length;
364 uint32_t xid;
365 uint16_t flags;
366 uint16_t miss_send_len;
367};
368
Rich Lane68ae4d72013-05-09 10:55:19 -0700369struct of_set_config {
Rich Lanea06d0c32013-03-25 08:52:03 -0700370 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700371 uint8_t type == 9;
Rich Lanea06d0c32013-03-25 08:52:03 -0700372 uint16_t length;
373 uint32_t xid;
374 uint16_t flags;
375 uint16_t miss_send_len;
376};
377
Rich Lane68ae4d72013-05-09 10:55:19 -0700378struct of_port_desc {
Rich Lanea06d0c32013-03-25 08:52:03 -0700379 of_port_no_t port_no;
380 of_mac_addr_t hw_addr;
381 of_port_name_t name;
382 uint32_t config;
383 uint32_t state;
384 uint32_t curr;
385 uint32_t advertised;
386 uint32_t supported;
387 uint32_t peer;
388};
389
Rich Lane68ae4d72013-05-09 10:55:19 -0700390struct of_features_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700391 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700392 uint8_t type == 5;
Rich Lanea06d0c32013-03-25 08:52:03 -0700393 uint16_t length;
394 uint32_t xid;
395};
396
Rich Lane68ae4d72013-05-09 10:55:19 -0700397struct of_features_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700398 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700399 uint8_t type == 6;
Rich Lanea06d0c32013-03-25 08:52:03 -0700400 uint16_t length;
401 uint32_t xid;
402 uint64_t datapath_id;
403 uint32_t n_buffers;
404 uint8_t n_tables;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700405 pad(3);
Rich Lanea06d0c32013-03-25 08:52:03 -0700406 uint32_t capabilities;
407 uint32_t actions;
408 list(of_port_desc_t) ports;
409};
410
Rich Lane68ae4d72013-05-09 10:55:19 -0700411struct of_port_status {
Rich Lanea06d0c32013-03-25 08:52:03 -0700412 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700413 uint8_t type == 12;
Rich Lanea06d0c32013-03-25 08:52:03 -0700414 uint16_t length;
415 uint32_t xid;
416 uint8_t reason;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700417 pad(7);
Rich Lanea06d0c32013-03-25 08:52:03 -0700418 of_port_desc_t desc;
419};
420
Rich Lane68ae4d72013-05-09 10:55:19 -0700421struct of_port_mod {
Rich Lanea06d0c32013-03-25 08:52:03 -0700422 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700423 uint8_t type == 15;
Rich Lanea06d0c32013-03-25 08:52:03 -0700424 uint16_t length;
425 uint32_t xid;
426 of_port_no_t port_no;
427 of_mac_addr_t hw_addr;
428 uint32_t config;
429 uint32_t mask;
430 uint32_t advertise;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700431 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -0700432};
433
Rich Lane68ae4d72013-05-09 10:55:19 -0700434struct of_packet_in {
Rich Lanea06d0c32013-03-25 08:52:03 -0700435 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700436 uint8_t type == 10;
Rich Lanea06d0c32013-03-25 08:52:03 -0700437 uint16_t length;
438 uint32_t xid;
439 uint32_t buffer_id;
440 uint16_t total_len;
441 of_port_no_t in_port;
442 uint8_t reason;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700443 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700444 of_octets_t data;
445};
446
Rich Lane68ae4d72013-05-09 10:55:19 -0700447struct of_action_output {
Rich Lane31b87142013-05-09 22:05:42 -0700448 uint16_t type == 0;
Rich Lanea06d0c32013-03-25 08:52:03 -0700449 uint16_t len;
450 of_port_no_t port;
451 uint16_t max_len;
452};
453
Rich Lane68ae4d72013-05-09 10:55:19 -0700454struct of_action_set_vlan_vid {
Rich Lane31b87142013-05-09 22:05:42 -0700455 uint16_t type == 1;
Rich Lanea06d0c32013-03-25 08:52:03 -0700456 uint16_t len;
457 uint16_t vlan_vid;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700458 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700459};
460
Rich Lane68ae4d72013-05-09 10:55:19 -0700461struct of_action_strip_vlan {
Rich Lane31b87142013-05-09 22:05:42 -0700462 uint16_t type == 3;
Rich Lanea06d0c32013-03-25 08:52:03 -0700463 uint16_t len;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700464 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -0700465};
466
Rich Lane68ae4d72013-05-09 10:55:19 -0700467struct of_action_set_vlan_pcp {
Rich Lane31b87142013-05-09 22:05:42 -0700468 uint16_t type == 2;
Rich Lanea06d0c32013-03-25 08:52:03 -0700469 uint16_t len;
470 uint8_t vlan_pcp;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700471 pad(3);
Rich Lanea06d0c32013-03-25 08:52:03 -0700472};
473
Rich Lane68ae4d72013-05-09 10:55:19 -0700474struct of_action_set_dl_src {
Rich Lane31b87142013-05-09 22:05:42 -0700475 uint16_t type == 4;
Rich Lanea06d0c32013-03-25 08:52:03 -0700476 uint16_t len;
477 of_mac_addr_t dl_addr;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700478 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700479};
480
Rich Lane68ae4d72013-05-09 10:55:19 -0700481struct of_action_set_dl_dst {
Rich Lane31b87142013-05-09 22:05:42 -0700482 uint16_t type == 5;
Rich Lanea06d0c32013-03-25 08:52:03 -0700483 uint16_t len;
484 of_mac_addr_t dl_addr;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700485 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700486};
487
Rich Lane68ae4d72013-05-09 10:55:19 -0700488struct of_action_set_nw_src {
Rich Lane31b87142013-05-09 22:05:42 -0700489 uint16_t type == 6;
Rich Lanea06d0c32013-03-25 08:52:03 -0700490 uint16_t len;
491 uint32_t nw_addr;
492};
493
Rich Lane68ae4d72013-05-09 10:55:19 -0700494struct of_action_set_nw_dst {
Rich Lane31b87142013-05-09 22:05:42 -0700495 uint16_t type == 7;
Rich Lanea06d0c32013-03-25 08:52:03 -0700496 uint16_t len;
497 uint32_t nw_addr;
498};
499
Rich Lane68ae4d72013-05-09 10:55:19 -0700500struct of_action_set_tp_src {
Rich Lane31b87142013-05-09 22:05:42 -0700501 uint16_t type == 9;
Rich Lanea06d0c32013-03-25 08:52:03 -0700502 uint16_t len;
503 uint16_t tp_port;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700504 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700505};
506
Rich Lane68ae4d72013-05-09 10:55:19 -0700507struct of_action_set_tp_dst {
Rich Lane31b87142013-05-09 22:05:42 -0700508 uint16_t type == 10;
Rich Lanea06d0c32013-03-25 08:52:03 -0700509 uint16_t len;
510 uint16_t tp_port;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700511 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700512};
513
Rich Lane68ae4d72013-05-09 10:55:19 -0700514struct of_action_set_nw_tos {
Rich Lane31b87142013-05-09 22:05:42 -0700515 uint16_t type == 8;
Rich Lanea06d0c32013-03-25 08:52:03 -0700516 uint16_t len;
517 uint8_t nw_tos;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700518 pad(3);
Rich Lanea06d0c32013-03-25 08:52:03 -0700519};
520
Rich Lane68ae4d72013-05-09 10:55:19 -0700521struct of_action_experimenter {
Rich Lane31b87142013-05-09 22:05:42 -0700522 uint16_t type == 65535;
Rich Lanea06d0c32013-03-25 08:52:03 -0700523 uint16_t len;
524 uint32_t experimenter;
525 of_octets_t data;
526};
527
Rich Lane68ae4d72013-05-09 10:55:19 -0700528struct of_action_enqueue {
Rich Lane31b87142013-05-09 22:05:42 -0700529 uint16_t type == 11;
Rich Lanea06d0c32013-03-25 08:52:03 -0700530 uint16_t len;
531 of_port_no_t port;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700532 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700533 uint32_t queue_id;
534};
535
Rich Lane68ae4d72013-05-09 10:55:19 -0700536struct of_action {
Rich Lanea06d0c32013-03-25 08:52:03 -0700537 uint16_t type;
538 uint16_t len;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700539 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -0700540};
541
Rich Lane68ae4d72013-05-09 10:55:19 -0700542struct of_packet_out {
Rich Lanea06d0c32013-03-25 08:52:03 -0700543 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700544 uint8_t type == 13;
Rich Lanea06d0c32013-03-25 08:52:03 -0700545 uint16_t length;
546 uint32_t xid;
547 uint32_t buffer_id;
548 of_port_no_t in_port;
549 uint16_t actions_len;
550 list(of_action_t) actions;
551 of_octets_t data;
552};
553
Rich Lane68ae4d72013-05-09 10:55:19 -0700554struct of_match_v1 {
Rich Lanea06d0c32013-03-25 08:52:03 -0700555 of_wc_bmap_t wildcards;
556 of_port_no_t in_port;
557 of_mac_addr_t eth_src;
558 of_mac_addr_t eth_dst;
559 uint16_t vlan_vid;
560 uint8_t vlan_pcp;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700561 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700562 uint16_t eth_type;
563 uint8_t ip_dscp;
564 uint8_t ip_proto;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700565 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700566 uint32_t ipv4_src;
567 uint32_t ipv4_dst;
568 uint16_t tcp_src;
569 uint16_t tcp_dst;
570};
571
Rich Lane68ae4d72013-05-09 10:55:19 -0700572struct of_flow_add {
Rich Lanea06d0c32013-03-25 08:52:03 -0700573 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700574 uint8_t type == 14;
Rich Lanea06d0c32013-03-25 08:52:03 -0700575 uint16_t length;
576 uint32_t xid;
577 of_match_t match;
578 uint64_t cookie;
Rich Lane31b87142013-05-09 22:05:42 -0700579 of_fm_cmd_t _command == 0;
Rich Lanea06d0c32013-03-25 08:52:03 -0700580 uint16_t idle_timeout;
581 uint16_t hard_timeout;
582 uint16_t priority;
583 uint32_t buffer_id;
584 of_port_no_t out_port;
585 uint16_t flags;
586 list(of_action_t) actions;
587};
588
Rich Lane68ae4d72013-05-09 10:55:19 -0700589struct of_flow_modify {
Rich Lanea06d0c32013-03-25 08:52:03 -0700590 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700591 uint8_t type == 14;
Rich Lanea06d0c32013-03-25 08:52:03 -0700592 uint16_t length;
593 uint32_t xid;
594 of_match_t match;
595 uint64_t cookie;
Rich Lane31b87142013-05-09 22:05:42 -0700596 of_fm_cmd_t _command == 1;
Rich Lanea06d0c32013-03-25 08:52:03 -0700597 uint16_t idle_timeout;
598 uint16_t hard_timeout;
599 uint16_t priority;
600 uint32_t buffer_id;
601 of_port_no_t out_port;
602 uint16_t flags;
603 list(of_action_t) actions;
604};
605
Rich Lane68ae4d72013-05-09 10:55:19 -0700606struct of_flow_modify_strict {
Rich Lanea06d0c32013-03-25 08:52:03 -0700607 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700608 uint8_t type == 14;
Rich Lanea06d0c32013-03-25 08:52:03 -0700609 uint16_t length;
610 uint32_t xid;
611 of_match_t match;
612 uint64_t cookie;
Rich Lane31b87142013-05-09 22:05:42 -0700613 of_fm_cmd_t _command == 2;
Rich Lanea06d0c32013-03-25 08:52:03 -0700614 uint16_t idle_timeout;
615 uint16_t hard_timeout;
616 uint16_t priority;
617 uint32_t buffer_id;
618 of_port_no_t out_port;
619 uint16_t flags;
620 list(of_action_t) actions;
621};
622
Rich Lane68ae4d72013-05-09 10:55:19 -0700623struct of_flow_delete {
Rich Lanea06d0c32013-03-25 08:52:03 -0700624 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700625 uint8_t type == 14;
Rich Lanea06d0c32013-03-25 08:52:03 -0700626 uint16_t length;
627 uint32_t xid;
628 of_match_t match;
629 uint64_t cookie;
Rich Lane31b87142013-05-09 22:05:42 -0700630 of_fm_cmd_t _command == 3;
Rich Lanea06d0c32013-03-25 08:52:03 -0700631 uint16_t idle_timeout;
632 uint16_t hard_timeout;
633 uint16_t priority;
634 uint32_t buffer_id;
635 of_port_no_t out_port;
636 uint16_t flags;
637 list(of_action_t) actions;
638};
639
Rich Lane68ae4d72013-05-09 10:55:19 -0700640struct of_flow_delete_strict {
Rich Lanea06d0c32013-03-25 08:52:03 -0700641 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700642 uint8_t type == 14;
Rich Lanea06d0c32013-03-25 08:52:03 -0700643 uint16_t length;
644 uint32_t xid;
645 of_match_t match;
646 uint64_t cookie;
Rich Lane31b87142013-05-09 22:05:42 -0700647 of_fm_cmd_t _command == 4;
Rich Lanea06d0c32013-03-25 08:52:03 -0700648 uint16_t idle_timeout;
649 uint16_t hard_timeout;
650 uint16_t priority;
651 uint32_t buffer_id;
652 of_port_no_t out_port;
653 uint16_t flags;
654 list(of_action_t) actions;
655};
656
Rich Lane68ae4d72013-05-09 10:55:19 -0700657struct of_flow_removed {
Rich Lanea06d0c32013-03-25 08:52:03 -0700658 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700659 uint8_t type == 11;
Rich Lanea06d0c32013-03-25 08:52:03 -0700660 uint16_t length;
661 uint32_t xid;
662 of_match_t match;
663 uint64_t cookie;
664 uint16_t priority;
665 uint8_t reason;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700666 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700667 uint32_t duration_sec;
668 uint32_t duration_nsec;
669 uint16_t idle_timeout;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700670 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700671 uint64_t packet_count;
672 uint64_t byte_count;
673};
674
Rich Lane68ae4d72013-05-09 10:55:19 -0700675struct of_error_msg {
Rich Lanea06d0c32013-03-25 08:52:03 -0700676 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700677 uint8_t type == 1;
Rich Lanea06d0c32013-03-25 08:52:03 -0700678 uint16_t length;
679 uint32_t xid;
680 uint16_t err_type;
681 uint16_t code;
682 of_octets_t data;
683};
684
685// STATS ENTRIES: flow, table, port, queue,
Rich Lane68ae4d72013-05-09 10:55:19 -0700686struct of_flow_stats_entry {
Rich Lanea06d0c32013-03-25 08:52:03 -0700687 uint16_t length;
688 uint8_t table_id;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700689 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700690 of_match_t match;
691 uint32_t duration_sec;
692 uint32_t duration_nsec;
693 uint16_t priority;
694 uint16_t idle_timeout;
695 uint16_t hard_timeout;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700696 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700697 uint64_t cookie;
698 uint64_t packet_count;
699 uint64_t byte_count;
700 list(of_action_t) actions;
701};
702
Rich Lane68ae4d72013-05-09 10:55:19 -0700703struct of_table_stats_entry {
Rich Lanea06d0c32013-03-25 08:52:03 -0700704 uint8_t table_id;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700705 pad(3);
Rich Lanea06d0c32013-03-25 08:52:03 -0700706 of_table_name_t name;
707 of_wc_bmap_t wildcards;
708 uint32_t max_entries;
709 uint32_t active_count;
710 uint64_t lookup_count;
711 uint64_t matched_count;
712};
713
Rich Lane68ae4d72013-05-09 10:55:19 -0700714struct of_port_stats_entry {
Rich Lanea06d0c32013-03-25 08:52:03 -0700715 of_port_no_t port_no;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700716 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700717 uint64_t rx_packets;
718 uint64_t tx_packets;
719 uint64_t rx_bytes;
720 uint64_t tx_bytes;
721 uint64_t rx_dropped;
722 uint64_t tx_dropped;
723 uint64_t rx_errors;
724 uint64_t tx_errors;
725 uint64_t rx_frame_err;
726 uint64_t rx_over_err;
727 uint64_t rx_crc_err;
728 uint64_t collisions;
729};
730
Rich Lane68ae4d72013-05-09 10:55:19 -0700731struct of_queue_stats_entry {
Rich Lanea06d0c32013-03-25 08:52:03 -0700732 of_port_no_t port_no;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700733 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700734 uint32_t queue_id;
735 uint64_t tx_bytes;
736 uint64_t tx_packets;
737 uint64_t tx_errors;
738};
739
740// STATS request/reply: Desc, flow, agg, table, port, queue
741
Rich Lane68ae4d72013-05-09 10:55:19 -0700742struct of_desc_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700743 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700744 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700745 uint16_t length;
746 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700747 uint16_t stats_type == 0;
Rich Lanea06d0c32013-03-25 08:52:03 -0700748 uint16_t flags;
749};
750
Rich Lane68ae4d72013-05-09 10:55:19 -0700751struct of_desc_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700752 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700753 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700754 uint16_t length;
755 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700756 uint16_t stats_type == 0;
Rich Lanea06d0c32013-03-25 08:52:03 -0700757 uint16_t flags;
758 of_desc_str_t mfr_desc;
759 of_desc_str_t hw_desc;
760 of_desc_str_t sw_desc;
761 of_serial_num_t serial_num;
762 of_desc_str_t dp_desc;
763};
764
Rich Lane68ae4d72013-05-09 10:55:19 -0700765struct of_flow_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700766 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700767 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700768 uint16_t length;
769 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700770 uint16_t stats_type == 1;
Rich Lanea06d0c32013-03-25 08:52:03 -0700771 uint16_t flags;
772 of_match_t match;
773 uint8_t table_id;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700774 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700775 of_port_no_t out_port;
776};
777
Rich Lane68ae4d72013-05-09 10:55:19 -0700778struct of_flow_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700779 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700780 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700781 uint16_t length;
782 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700783 uint16_t stats_type == 1;
Rich Lanea06d0c32013-03-25 08:52:03 -0700784 uint16_t flags;
785 list(of_flow_stats_entry_t) entries;
786};
787
Rich Lane68ae4d72013-05-09 10:55:19 -0700788struct of_aggregate_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700789 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700790 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700791 uint16_t length;
792 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700793 uint16_t stats_type == 2;
Rich Lanea06d0c32013-03-25 08:52:03 -0700794 uint16_t flags;
795 of_match_t match;
796 uint8_t table_id;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700797 pad(1);
Rich Lanea06d0c32013-03-25 08:52:03 -0700798 of_port_no_t out_port;
799};
800
Rich Lane68ae4d72013-05-09 10:55:19 -0700801struct of_aggregate_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700802 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700803 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700804 uint16_t length;
805 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700806 uint16_t stats_type == 2;
Rich Lanea06d0c32013-03-25 08:52:03 -0700807 uint16_t flags;
808 uint64_t packet_count;
809 uint64_t byte_count;
810 uint32_t flow_count;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700811 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -0700812};
813
Rich Lane68ae4d72013-05-09 10:55:19 -0700814struct of_table_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700815 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700816 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700817 uint16_t length;
818 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700819 uint16_t stats_type == 3;
Rich Lanea06d0c32013-03-25 08:52:03 -0700820 uint16_t flags;
821};
822
Rich Lane68ae4d72013-05-09 10:55:19 -0700823struct of_table_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700824 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700825 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700826 uint16_t length;
827 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700828 uint16_t stats_type == 3;
Rich Lanea06d0c32013-03-25 08:52:03 -0700829 uint16_t flags;
830 list(of_table_stats_entry_t) entries;
831};
832
Rich Lane68ae4d72013-05-09 10:55:19 -0700833struct of_port_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700834 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700835 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700836 uint16_t length;
837 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700838 uint16_t stats_type == 4;
Rich Lanea06d0c32013-03-25 08:52:03 -0700839 uint16_t flags;
840 of_port_no_t port_no;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700841 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700842};
843
Rich Lane68ae4d72013-05-09 10:55:19 -0700844struct of_port_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700845 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700846 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700847 uint16_t length;
848 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700849 uint16_t stats_type == 4;
Rich Lanea06d0c32013-03-25 08:52:03 -0700850 uint16_t flags;
851 list(of_port_stats_entry_t) entries;
852};
853
Rich Lane68ae4d72013-05-09 10:55:19 -0700854struct of_queue_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700855 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700856 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700857 uint16_t length;
858 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700859 uint16_t stats_type == 5;
Rich Lanea06d0c32013-03-25 08:52:03 -0700860 uint16_t flags;
861 of_port_no_t port_no;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700862 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700863 uint32_t queue_id;
864};
865
Rich Lane68ae4d72013-05-09 10:55:19 -0700866struct of_queue_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700867 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700868 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700869 uint16_t length;
870 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700871 uint16_t stats_type == 5;
Rich Lanea06d0c32013-03-25 08:52:03 -0700872 uint16_t flags;
873 list(of_queue_stats_entry_t) entries;
874};
875
Rich Lane68ae4d72013-05-09 10:55:19 -0700876struct of_experimenter_stats_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700877 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700878 uint8_t type == 16;
Rich Lanea06d0c32013-03-25 08:52:03 -0700879 uint16_t length;
880 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700881 uint16_t stats_type == 0xffff;
Rich Lanea06d0c32013-03-25 08:52:03 -0700882 uint16_t flags;
883 uint32_t experimenter;
884 of_octets_t data;
885};
886
Rich Lane68ae4d72013-05-09 10:55:19 -0700887struct of_experimenter_stats_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700888 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700889 uint8_t type == 17;
Rich Lanea06d0c32013-03-25 08:52:03 -0700890 uint16_t length;
891 uint32_t xid;
Rich Lane31b87142013-05-09 22:05:42 -0700892 uint16_t stats_type == 0xffff;
Rich Lanea06d0c32013-03-25 08:52:03 -0700893 uint16_t flags;
894 uint32_t experimenter;
895 of_octets_t data;
896};
897
898// END OF STATS OBJECTS
899
Rich Lane68ae4d72013-05-09 10:55:19 -0700900struct of_queue_prop {
Rich Lanea06d0c32013-03-25 08:52:03 -0700901 uint16_t type;
902 uint16_t len;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700903 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -0700904};
905
Rich Lane68ae4d72013-05-09 10:55:19 -0700906struct of_queue_prop_min_rate {
Rich Lane31b87142013-05-09 22:05:42 -0700907 uint16_t type == 1;
Rich Lanea06d0c32013-03-25 08:52:03 -0700908 uint16_t len;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700909 pad(4);
Rich Lanea06d0c32013-03-25 08:52:03 -0700910 uint16_t rate;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700911 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700912};
913
Rich Lane68ae4d72013-05-09 10:55:19 -0700914struct of_packet_queue {
Rich Lanea06d0c32013-03-25 08:52:03 -0700915 uint32_t queue_id;
916 uint16_t len;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700917 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700918 list(of_queue_prop_t) properties;
919};
920
Rich Lane68ae4d72013-05-09 10:55:19 -0700921struct of_queue_get_config_request {
Rich Lanea06d0c32013-03-25 08:52:03 -0700922 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700923 uint8_t type == 20;
Rich Lanea06d0c32013-03-25 08:52:03 -0700924 uint16_t length;
925 uint32_t xid;
926 of_port_no_t port;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700927 pad(2);
Rich Lanea06d0c32013-03-25 08:52:03 -0700928};
929
Rich Lane68ae4d72013-05-09 10:55:19 -0700930struct of_queue_get_config_reply {
Rich Lanea06d0c32013-03-25 08:52:03 -0700931 uint8_t version;
Rich Lane31b87142013-05-09 22:05:42 -0700932 uint8_t type == 21;
Rich Lanea06d0c32013-03-25 08:52:03 -0700933 uint16_t length;
934 uint32_t xid;
935 of_port_no_t port;
Rich Lanee2af4ee2013-05-09 11:04:06 -0700936 pad(6);
Rich Lanea06d0c32013-03-25 08:52:03 -0700937 list(of_packet_queue_t) queues;
938};