]> git.proxmox.com Git - mirror_ovs.git/blame - include/openflow/openflow-1.0.h
Initial OpenFlow 1.3 support
[mirror_ovs.git] / include / openflow / openflow-1.0.h
CommitLineData
53931554 1/*
e0edde6f 2 * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
53931554
BP
3 *
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/* OpenFlow: protocol between controller and datapath. */
18
19#ifndef OPENFLOW_OPENFLOW10_H
20#define OPENFLOW_OPENFLOW10_H 1
21
87ea5e5e 22#include "openflow/openflow-common.h"
53931554 23
c6100d92
BP
24/* Port number(s) meaning
25 * --------------- --------------------------------------
26 * 0x0000 not assigned a meaning by OpenFlow 1.0
27 * 0x0001...0xfeff "physical" ports
28 * 0xff00...0xfff7 "reserved" but not assigned a meaning by OpenFlow 1.0
29 * 0xfff8...0xffff "reserved" OFPP_* ports with assigned meanings
30 */
53931554 31enum ofp_port {
c6100d92
BP
32 /* Ranges. */
33 OFPP_MAX = 0xff00, /* Maximum number of physical switch ports. */
34 OFPP_FIRST_RESV = 0xfff8, /* First assigned reserved port number. */
35 OFPP_LAST_RESV = 0xffff, /* Last assigned reserved port number. */
53931554 36
c6100d92 37 /* Reserved output "ports". */
53931554
BP
38 OFPP_IN_PORT = 0xfff8, /* Send the packet out the input port. This
39 virtual port must be explicitly used
40 in order to send back out of the input
41 port. */
42 OFPP_TABLE = 0xfff9, /* Perform actions in flow table.
43 NB: This can only be the destination
44 port for packet-out messages. */
45 OFPP_NORMAL = 0xfffa, /* Process with normal L2/L3 switching. */
46 OFPP_FLOOD = 0xfffb, /* All physical ports except input port and
47 those disabled by STP. */
48 OFPP_ALL = 0xfffc, /* All physical ports except input port. */
49 OFPP_CONTROLLER = 0xfffd, /* Send to controller. */
50 OFPP_LOCAL = 0xfffe, /* Local openflow "port". */
51 OFPP_NONE = 0xffff /* Not associated with a physical port. */
52};
53
53931554
BP
54#define OFP_DEFAULT_MISS_SEND_LEN 128
55
56enum ofp_config_flags {
57 /* Handling of IP fragments. */
58 OFPC_FRAG_NORMAL = 0, /* No special handling for fragments. */
59 OFPC_FRAG_DROP = 1, /* Drop fragments. */
60 OFPC_FRAG_REASM = 2, /* Reassemble (only if OFPC_IP_REASM set). */
61 OFPC_FRAG_NX_MATCH = 3, /* Make first fragments available for matching. */
62 OFPC_FRAG_MASK = 3,
63
2e1ae200
JR
64 /* OFPC_INVALID_TTL_TO_CONTROLLER is deprecated in OpenFlow 1.3 */
65
53931554
BP
66 /* TTL processing - applicable for IP and MPLS packets. */
67 OFPC_INVALID_TTL_TO_CONTROLLER = 1 << 2, /* Send packets with invalid TTL
68 to the controller. */
69};
70
71/* Switch configuration. */
72struct ofp_switch_config {
53931554
BP
73 ovs_be16 flags; /* OFPC_* flags. */
74 ovs_be16 miss_send_len; /* Max bytes of new flow that datapath should
75 send to the controller. */
76};
982697a4 77OFP_ASSERT(sizeof(struct ofp_switch_config) == 4);
53931554 78
9e1fd49b
BP
79/* OpenFlow 1.0 specific capabilities supported by the datapath (struct
80 * ofp_switch_features, member capabilities). */
81enum ofp10_capabilities {
82 OFPC10_STP = 1 << 3, /* 802.1d spanning tree. */
83 OFPC10_RESERVED = 1 << 4, /* Reserved, must not be set. */
53931554
BP
84};
85
9e1fd49b
BP
86/* OpenFlow 1.0 specific flags to indicate behavior of the physical port.
87 * These flags are used in ofp10_phy_port to describe the current
88 * configuration. They are used in the ofp10_port_mod message to configure the
89 * port's behavior.
53931554 90 */
9e1fd49b
BP
91enum ofp10_port_config {
92 OFPPC10_NO_STP = 1 << 1, /* Disable 802.1D spanning tree on port. */
93 OFPPC10_NO_RECV_STP = 1 << 3, /* Drop received 802.1D STP packets. */
94 OFPPC10_NO_FLOOD = 1 << 4, /* Do not include port when flooding. */
95#define OFPPC10_ALL (OFPPC_PORT_DOWN | OFPPC10_NO_STP | OFPPC_NO_RECV | \
96 OFPPC10_NO_RECV_STP | OFPPC10_NO_FLOOD | OFPPC_NO_FWD | \
97 OFPPC_NO_PACKET_IN)
53931554
BP
98};
99
9e1fd49b
BP
100/* OpenFlow 1.0 specific current state of the physical port. These are not
101 * configurable from the controller.
53931554 102 */
9e1fd49b
BP
103enum ofp10_port_state {
104 /* The OFPPS10_STP_* bits have no effect on switch operation. The
53931554
BP
105 * controller must adjust OFPPC_NO_RECV, OFPPC_NO_FWD, and
106 * OFPPC_NO_PACKET_IN appropriately to fully implement an 802.1D spanning
107 * tree. */
9e1fd49b
BP
108 OFPPS10_STP_LISTEN = 0 << 8, /* Not learning or relaying frames. */
109 OFPPS10_STP_LEARN = 1 << 8, /* Learning but not relaying frames. */
110 OFPPS10_STP_FORWARD = 2 << 8, /* Learning and relaying frames. */
111 OFPPS10_STP_BLOCK = 3 << 8, /* Not part of spanning tree. */
112 OFPPS10_STP_MASK = 3 << 8 /* Bit mask for OFPPS10_STP_* values. */
113
114#define OFPPS10_ALL (OFPPS_LINK_DOWN | OFPPS10_STP_MASK)
53931554
BP
115};
116
9e1fd49b
BP
117/* OpenFlow 1.0 specific features of physical ports available in a datapath. */
118enum ofp10_port_features {
119 OFPPF10_COPPER = 1 << 7, /* Copper medium. */
120 OFPPF10_FIBER = 1 << 8, /* Fiber medium. */
121 OFPPF10_AUTONEG = 1 << 9, /* Auto-negotiation. */
122 OFPPF10_PAUSE = 1 << 10, /* Pause. */
123 OFPPF10_PAUSE_ASYM = 1 << 11 /* Asymmetric pause. */
53931554
BP
124};
125
126/* Description of a physical port */
9e1fd49b 127struct ofp10_phy_port {
53931554
BP
128 ovs_be16 port_no;
129 uint8_t hw_addr[OFP_ETH_ALEN];
130 char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */
131
9e1fd49b
BP
132 ovs_be32 config; /* Bitmap of OFPPC_* and OFPPC10_* flags. */
133 ovs_be32 state; /* Bitmap of OFPPS_* and OFPPS10_* flags. */
53931554 134
9e1fd49b
BP
135 /* Bitmaps of OFPPF_* and OFPPF10_* that describe features. All bits
136 * zeroed if unsupported or unavailable. */
53931554
BP
137 ovs_be32 curr; /* Current features. */
138 ovs_be32 advertised; /* Features being advertised by the port. */
139 ovs_be32 supported; /* Features supported by the port. */
140 ovs_be32 peer; /* Features advertised by peer. */
141};
9e1fd49b 142OFP_ASSERT(sizeof(struct ofp10_phy_port) == 48);
53931554
BP
143
144/* Modify behavior of the physical port */
9e1fd49b 145struct ofp10_port_mod {
53931554
BP
146 ovs_be16 port_no;
147 uint8_t hw_addr[OFP_ETH_ALEN]; /* The hardware address is not
148 configurable. This is used to
149 sanity-check the request, so it must
150 be the same as returned in an
9e1fd49b 151 ofp10_phy_port struct. */
53931554
BP
152
153 ovs_be32 config; /* Bitmap of OFPPC_* flags. */
154 ovs_be32 mask; /* Bitmap of OFPPC_* flags to be changed. */
155
156 ovs_be32 advertise; /* Bitmap of "ofp_port_features"s. Zero all
157 bits to prevent any action taking place. */
158 uint8_t pad[4]; /* Pad to 64-bits. */
159};
982697a4 160OFP_ASSERT(sizeof(struct ofp10_port_mod) == 24);
53931554 161
688af176
SH
162/* Query for port queue configuration. */
163struct ofp10_queue_get_config_request {
688af176
SH
164 ovs_be16 port; /* Port to be queried. Should refer
165 to a valid physical port (i.e. < OFPP_MAX) */
166 uint8_t pad[2];
167 /* 32-bit alignment. */
168};
982697a4 169OFP_ASSERT(sizeof(struct ofp10_queue_get_config_request) == 4);
688af176
SH
170
171/* Queue configuration for a given port. */
172struct ofp10_queue_get_config_reply {
688af176
SH
173 ovs_be16 port;
174 uint8_t pad[6];
175 /* struct ofp10_packet_queue queues[0]; List of configured queues. */
176};
982697a4 177OFP_ASSERT(sizeof(struct ofp10_queue_get_config_reply) == 8);
688af176 178
53931554
BP
179/* Packet received on port (datapath -> controller). */
180struct ofp_packet_in {
53931554
BP
181 ovs_be32 buffer_id; /* ID assigned by datapath. */
182 ovs_be16 total_len; /* Full length of frame. */
183 ovs_be16 in_port; /* Port on which frame was received. */
184 uint8_t reason; /* Reason packet is being sent (one of OFPR_*) */
185 uint8_t pad;
186 uint8_t data[0]; /* Ethernet frame, halfway through 32-bit word,
187 so the IP header is 32-bit aligned. The
188 amount of data is inferred from the length
189 field in the header. Because of padding,
190 offsetof(struct ofp_packet_in, data) ==
191 sizeof(struct ofp_packet_in) - 2. */
192};
982697a4 193OFP_ASSERT(sizeof(struct ofp_packet_in) == 12);
53931554 194
08f94c0e
BP
195enum ofp10_action_type {
196 OFPAT10_OUTPUT, /* Output to switch port. */
197 OFPAT10_SET_VLAN_VID, /* Set the 802.1q VLAN id. */
198 OFPAT10_SET_VLAN_PCP, /* Set the 802.1q priority. */
199 OFPAT10_STRIP_VLAN, /* Strip the 802.1q header. */
200 OFPAT10_SET_DL_SRC, /* Ethernet source address. */
201 OFPAT10_SET_DL_DST, /* Ethernet destination address. */
202 OFPAT10_SET_NW_SRC, /* IP source address. */
203 OFPAT10_SET_NW_DST, /* IP destination address. */
204 OFPAT10_SET_NW_TOS, /* IP ToS (DSCP field, 6 bits). */
205 OFPAT10_SET_TP_SRC, /* TCP/UDP source port. */
206 OFPAT10_SET_TP_DST, /* TCP/UDP destination port. */
207 OFPAT10_ENQUEUE, /* Output to queue. */
208 OFPAT10_VENDOR = 0xffff
53931554
BP
209};
210
08f94c0e 211/* Action structure for OFPAT10_OUTPUT, which sends packets out 'port'.
53931554
BP
212 * When the 'port' is the OFPP_CONTROLLER, 'max_len' indicates the max
213 * number of bytes to send. A 'max_len' of zero means no bytes of the
214 * packet should be sent. */
d01c980f 215struct ofp10_action_output {
08f94c0e 216 ovs_be16 type; /* OFPAT10_OUTPUT. */
53931554
BP
217 ovs_be16 len; /* Length is 8. */
218 ovs_be16 port; /* Output port. */
219 ovs_be16 max_len; /* Max length to send to controller. */
220};
d01c980f 221OFP_ASSERT(sizeof(struct ofp10_action_output) == 8);
53931554 222
08f94c0e 223/* Action header for OFPAT10_VENDOR. The rest of the body is vendor-defined. */
53931554 224struct ofp_action_vendor_header {
08f94c0e 225 ovs_be16 type; /* OFPAT10_VENDOR. */
53931554
BP
226 ovs_be16 len; /* Length is a multiple of 8. */
227 ovs_be32 vendor; /* Vendor ID, which takes the same form
228 as in "struct ofp_vendor_header". */
229};
230OFP_ASSERT(sizeof(struct ofp_action_vendor_header) == 8);
231
232/* Action header that is common to all actions. The length includes the
233 * header and any padding used to make the action 64-bit aligned.
234 * NB: The length of an action *must* always be a multiple of eight. */
235struct ofp_action_header {
08f94c0e 236 ovs_be16 type; /* One of OFPAT10_*. */
53931554
BP
237 ovs_be16 len; /* Length of action, including this
238 header. This is the length of action,
239 including any padding to make it
240 64-bit aligned. */
241 uint8_t pad[4];
242};
243OFP_ASSERT(sizeof(struct ofp_action_header) == 8);
244
08f94c0e 245/* OFPAT10_ENQUEUE action struct: send packets to given queue on port. */
53931554 246struct ofp_action_enqueue {
08f94c0e 247 ovs_be16 type; /* OFPAT10_ENQUEUE. */
53931554
BP
248 ovs_be16 len; /* Len is 16. */
249 ovs_be16 port; /* Port that queue belongs. Should
250 refer to a valid physical port
251 (i.e. < OFPP_MAX) or OFPP_IN_PORT. */
252 uint8_t pad[6]; /* Pad for 64-bit alignment. */
253 ovs_be32 queue_id; /* Where to enqueue the packets. */
254};
255OFP_ASSERT(sizeof(struct ofp_action_enqueue) == 16);
256
257union ofp_action {
258 ovs_be16 type;
259 struct ofp_action_header header;
260 struct ofp_action_vendor_header vendor;
d01c980f 261 struct ofp10_action_output output10;
53931554
BP
262 struct ofp_action_vlan_vid vlan_vid;
263 struct ofp_action_vlan_pcp vlan_pcp;
264 struct ofp_action_nw_addr nw_addr;
265 struct ofp_action_nw_tos nw_tos;
266 struct ofp_action_tp_port tp_port;
267};
268OFP_ASSERT(sizeof(union ofp_action) == 8);
269
270/* Send packet (controller -> datapath). */
271struct ofp_packet_out {
53931554
BP
272 ovs_be32 buffer_id; /* ID assigned by datapath or UINT32_MAX. */
273 ovs_be16 in_port; /* Packet's input port (OFPP_NONE if none). */
274 ovs_be16 actions_len; /* Size of action array in bytes. */
275 /* Followed by:
276 * - Exactly 'actions_len' bytes (possibly 0 bytes, and always a multiple
277 * of 8) containing actions.
278 * - If 'buffer_id' == UINT32_MAX, packet data to fill out the remainder
279 * of the message length.
280 */
281};
982697a4 282OFP_ASSERT(sizeof(struct ofp_packet_out) == 8);
53931554 283
53931554
BP
284/* Flow wildcards. */
285enum ofp_flow_wildcards {
eec25dc1
BP
286 OFPFW10_IN_PORT = 1 << 0, /* Switch input port. */
287 OFPFW10_DL_VLAN = 1 << 1, /* VLAN vid. */
288 OFPFW10_DL_SRC = 1 << 2, /* Ethernet source address. */
289 OFPFW10_DL_DST = 1 << 3, /* Ethernet destination address. */
290 OFPFW10_DL_TYPE = 1 << 4, /* Ethernet frame type. */
291 OFPFW10_NW_PROTO = 1 << 5, /* IP protocol. */
292 OFPFW10_TP_SRC = 1 << 6, /* TCP/UDP source port. */
293 OFPFW10_TP_DST = 1 << 7, /* TCP/UDP destination port. */
53931554
BP
294
295 /* IP source address wildcard bit count. 0 is exact match, 1 ignores the
296 * LSB, 2 ignores the 2 least-significant bits, ..., 32 and higher wildcard
297 * the entire field. This is the *opposite* of the usual convention where
298 * e.g. /24 indicates that 8 bits (not 24 bits) are wildcarded. */
eec25dc1
BP
299 OFPFW10_NW_SRC_SHIFT = 8,
300 OFPFW10_NW_SRC_BITS = 6,
301 OFPFW10_NW_SRC_MASK = (((1 << OFPFW10_NW_SRC_BITS) - 1)
302 << OFPFW10_NW_SRC_SHIFT),
303 OFPFW10_NW_SRC_ALL = 32 << OFPFW10_NW_SRC_SHIFT,
53931554
BP
304
305 /* IP destination address wildcard bit count. Same format as source. */
eec25dc1
BP
306 OFPFW10_NW_DST_SHIFT = 14,
307 OFPFW10_NW_DST_BITS = 6,
308 OFPFW10_NW_DST_MASK = (((1 << OFPFW10_NW_DST_BITS) - 1)
309 << OFPFW10_NW_DST_SHIFT),
310 OFPFW10_NW_DST_ALL = 32 << OFPFW10_NW_DST_SHIFT,
53931554 311
eec25dc1
BP
312 OFPFW10_DL_VLAN_PCP = 1 << 20, /* VLAN priority. */
313 OFPFW10_NW_TOS = 1 << 21, /* IP ToS (DSCP field, 6 bits). */
53931554
BP
314
315 /* Wildcard all fields. */
eec25dc1 316 OFPFW10_ALL = ((1 << 22) - 1)
53931554
BP
317};
318
319/* The wildcards for ICMP type and code fields use the transport source
320 * and destination port fields, respectively. */
eec25dc1
BP
321#define OFPFW10_ICMP_TYPE OFPFW10_TP_SRC
322#define OFPFW10_ICMP_CODE OFPFW10_TP_DST
53931554
BP
323
324/* Values below this cutoff are 802.3 packets and the two bytes
325 * following MAC addresses are used as a frame length. Otherwise, the
326 * two bytes are used as the Ethernet type.
327 */
328#define OFP_DL_TYPE_ETH2_CUTOFF 0x0600
329
330/* Value of dl_type to indicate that the frame does not include an
331 * Ethernet type.
332 */
333#define OFP_DL_TYPE_NOT_ETH_TYPE 0x05ff
334
335/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate
f9515094 336 * special conditions. All ones indicates that 802.1Q header is not present.
53931554 337 */
0c436519 338#define OFP10_VLAN_NONE 0xffff
53931554
BP
339
340/* Fields to match against flows */
eec25dc1 341struct ofp10_match {
53931554
BP
342 ovs_be32 wildcards; /* Wildcard fields. */
343 ovs_be16 in_port; /* Input switch port. */
344 uint8_t dl_src[OFP_ETH_ALEN]; /* Ethernet source address. */
345 uint8_t dl_dst[OFP_ETH_ALEN]; /* Ethernet destination address. */
346 ovs_be16 dl_vlan; /* Input VLAN. */
347 uint8_t dl_vlan_pcp; /* Input VLAN priority. */
348 uint8_t pad1[1]; /* Align to 64-bits. */
349 ovs_be16 dl_type; /* Ethernet frame type. */
350 uint8_t nw_tos; /* IP ToS (DSCP field, 6 bits). */
351 uint8_t nw_proto; /* IP protocol or lower 8 bits of
352 ARP opcode. */
353 uint8_t pad2[2]; /* Align to 64-bits. */
354 ovs_be32 nw_src; /* IP source address. */
355 ovs_be32 nw_dst; /* IP destination address. */
356 ovs_be16 tp_src; /* TCP/UDP source port. */
357 ovs_be16 tp_dst; /* TCP/UDP destination port. */
358};
eec25dc1 359OFP_ASSERT(sizeof(struct ofp10_match) == 40);
53931554
BP
360
361/* Value used in "idle_timeout" and "hard_timeout" to indicate that the entry
362 * is permanent. */
363#define OFP_FLOW_PERMANENT 0
364
365/* By default, choose a priority in the middle. */
366#define OFP_DEFAULT_PRIORITY 0x8000
367
35805806
BP
368enum ofp10_flow_mod_flags {
369 OFPFF10_EMERG = 1 << 2 /* Ramark this is for emergency. */
53931554
BP
370};
371
372/* Flow setup and teardown (controller -> datapath). */
35805806 373struct ofp10_flow_mod {
eec25dc1 374 struct ofp10_match match; /* Fields to match */
53931554
BP
375 ovs_be64 cookie; /* Opaque controller-issued identifier. */
376
377 /* Flow actions. */
378 ovs_be16 command; /* One of OFPFC_*. */
379 ovs_be16 idle_timeout; /* Idle time before discarding (seconds). */
380 ovs_be16 hard_timeout; /* Max time before discarding (seconds). */
381 ovs_be16 priority; /* Priority level of flow entry. */
382 ovs_be32 buffer_id; /* Buffered packet to apply to (or -1).
383 Not meaningful for OFPFC_DELETE*. */
384 ovs_be16 out_port; /* For OFPFC_DELETE* commands, require
385 matching entries to include this as an
386 output port. A value of OFPP_NONE
387 indicates no restriction. */
388 ovs_be16 flags; /* One of OFPFF_*. */
389 struct ofp_action_header actions[0]; /* The action length is inferred
390 from the length field in the
391 header. */
392};
35805806 393OFP_ASSERT(sizeof(struct ofp10_flow_mod) == 64);
53931554 394
53931554
BP
395/* Flow removed (datapath -> controller). */
396struct ofp_flow_removed {
eec25dc1 397 struct ofp10_match match; /* Description of fields. */
53931554
BP
398 ovs_be64 cookie; /* Opaque controller-issued identifier. */
399
400 ovs_be16 priority; /* Priority level of flow entry. */
401 uint8_t reason; /* One of OFPRR_*. */
402 uint8_t pad[1]; /* Align to 32-bits. */
403
404 ovs_be32 duration_sec; /* Time flow was alive in seconds. */
405 ovs_be32 duration_nsec; /* Time flow was alive in nanoseconds beyond
406 duration_sec. */
407 ovs_be16 idle_timeout; /* Idle timeout from original flow mod. */
408 uint8_t pad2[2]; /* Align to 64-bits. */
409 ovs_be64 packet_count;
410 ovs_be64 byte_count;
411};
982697a4 412OFP_ASSERT(sizeof(struct ofp_flow_removed) == 80);
53931554
BP
413
414/* OFPT_ERROR: Error message (datapath -> controller). */
415struct ofp_error_msg {
53931554
BP
416 ovs_be16 type;
417 ovs_be16 code;
418 uint8_t data[0]; /* Variable-length data. Interpreted based
419 on the type and code. */
420};
982697a4 421OFP_ASSERT(sizeof(struct ofp_error_msg) == 4);
53931554 422
53931554 423/* Statistics request or reply message. */
e2b9ac44 424struct ofp10_stats_msg {
53931554
BP
425 struct ofp_header header;
426 ovs_be16 type; /* One of the OFPST_* constants. */
427 ovs_be16 flags; /* Requests: always 0.
428 * Replies: 0 or OFPSF_REPLY_MORE. */
429};
e2b9ac44 430OFP_ASSERT(sizeof(struct ofp10_stats_msg) == 12);
53931554
BP
431
432enum ofp_stats_reply_flags {
433 OFPSF_REPLY_MORE = 1 << 0 /* More replies to follow. */
434};
435
53931554 436/* Stats request of type OFPST_AGGREGATE or OFPST_FLOW. */
e2b9ac44 437struct ofp10_flow_stats_request {
eec25dc1 438 struct ofp10_match match; /* Fields to match. */
53931554
BP
439 uint8_t table_id; /* ID of table to read (from ofp_table_stats)
440 or 0xff for all tables. */
441 uint8_t pad; /* Align to 32 bits. */
442 ovs_be16 out_port; /* Require matching entries to include this
443 as an output port. A value of OFPP_NONE
444 indicates no restriction. */
445};
e2b9ac44 446OFP_ASSERT(sizeof(struct ofp10_flow_stats_request) == 44);
53931554
BP
447
448/* Body of reply to OFPST_FLOW request. */
e2b9ac44 449struct ofp10_flow_stats {
53931554
BP
450 ovs_be16 length; /* Length of this entry. */
451 uint8_t table_id; /* ID of table flow came from. */
452 uint8_t pad;
eec25dc1 453 struct ofp10_match match; /* Description of fields. */
53931554
BP
454 ovs_be32 duration_sec; /* Time flow has been alive in seconds. */
455 ovs_be32 duration_nsec; /* Time flow has been alive in nanoseconds
456 beyond duration_sec. */
457 ovs_be16 priority; /* Priority of the entry. Only meaningful
458 when this is not an exact-match entry. */
459 ovs_be16 idle_timeout; /* Number of seconds idle before expiration. */
460 ovs_be16 hard_timeout; /* Number of seconds before expiration. */
461 uint8_t pad2[6]; /* Align to 64 bits. */
462 ovs_32aligned_be64 cookie; /* Opaque controller-issued identifier. */
463 ovs_32aligned_be64 packet_count; /* Number of packets in flow. */
464 ovs_32aligned_be64 byte_count; /* Number of bytes in flow. */
465 struct ofp_action_header actions[0]; /* Actions. */
466};
e2b9ac44 467OFP_ASSERT(sizeof(struct ofp10_flow_stats) == 88);
53931554
BP
468
469/* Body of reply to OFPST_TABLE request. */
e2b9ac44 470struct ofp10_table_stats {
53931554
BP
471 uint8_t table_id; /* Identifier of table. Lower numbered tables
472 are consulted first. */
473 uint8_t pad[3]; /* Align to 32-bits. */
474 char name[OFP_MAX_TABLE_NAME_LEN];
eec25dc1 475 ovs_be32 wildcards; /* Bitmap of OFPFW10_* wildcards that are
53931554
BP
476 supported by the table. */
477 ovs_be32 max_entries; /* Max number of entries supported. */
478 ovs_be32 active_count; /* Number of active entries. */
479 ovs_32aligned_be64 lookup_count; /* # of packets looked up in table. */
480 ovs_32aligned_be64 matched_count; /* Number of packets that hit table. */
481};
e2b9ac44 482OFP_ASSERT(sizeof(struct ofp10_table_stats) == 64);
53931554
BP
483
484/* Stats request of type OFPST_PORT. */
e2b9ac44 485struct ofp10_port_stats_request {
53931554
BP
486 ovs_be16 port_no; /* OFPST_PORT message may request statistics
487 for a single port (specified with port_no)
488 or for all ports (port_no == OFPP_NONE). */
489 uint8_t pad[6];
490};
e2b9ac44 491OFP_ASSERT(sizeof(struct ofp10_port_stats_request) == 8);
53931554
BP
492
493/* Body of reply to OFPST_PORT request. If a counter is unsupported, set
494 * the field to all ones. */
e2b9ac44 495struct ofp10_port_stats {
53931554
BP
496 ovs_be16 port_no;
497 uint8_t pad[6]; /* Align to 64-bits. */
498 ovs_32aligned_be64 rx_packets; /* Number of received packets. */
499 ovs_32aligned_be64 tx_packets; /* Number of transmitted packets. */
500 ovs_32aligned_be64 rx_bytes; /* Number of received bytes. */
501 ovs_32aligned_be64 tx_bytes; /* Number of transmitted bytes. */
502 ovs_32aligned_be64 rx_dropped; /* Number of packets dropped by RX. */
503 ovs_32aligned_be64 tx_dropped; /* Number of packets dropped by TX. */
504 ovs_32aligned_be64 rx_errors; /* Number of receive errors. This is a
505 super-set of receive errors and should be
506 great than or equal to the sum of all
507 rx_*_err values. */
508 ovs_32aligned_be64 tx_errors; /* Number of transmit errors. This is a
509 super-set of transmit errors. */
510 ovs_32aligned_be64 rx_frame_err; /* Number of frame alignment errors. */
511 ovs_32aligned_be64 rx_over_err; /* Number of packets with RX overrun. */
512 ovs_32aligned_be64 rx_crc_err; /* Number of CRC errors. */
513 ovs_32aligned_be64 collisions; /* Number of collisions. */
514};
e2b9ac44 515OFP_ASSERT(sizeof(struct ofp10_port_stats) == 104);
53931554
BP
516
517/* All ones is used to indicate all queues in a port (for stats retrieval). */
518#define OFPQ_ALL 0xffffffff
519
520/* Body for stats request of type OFPST_QUEUE. */
e2b9ac44 521struct ofp10_queue_stats_request {
53931554
BP
522 ovs_be16 port_no; /* All ports if OFPP_ALL. */
523 uint8_t pad[2]; /* Align to 32-bits. */
524 ovs_be32 queue_id; /* All queues if OFPQ_ALL. */
525};
e2b9ac44 526OFP_ASSERT(sizeof(struct ofp10_queue_stats_request) == 8);
53931554
BP
527
528/* Body for stats reply of type OFPST_QUEUE consists of an array of this
529 * structure type. */
e2b9ac44 530struct ofp10_queue_stats {
53931554
BP
531 ovs_be16 port_no;
532 uint8_t pad[2]; /* Align to 32-bits. */
533 ovs_be32 queue_id; /* Queue id. */
534 ovs_32aligned_be64 tx_bytes; /* Number of transmitted bytes. */
535 ovs_32aligned_be64 tx_packets; /* Number of transmitted packets. */
536 ovs_32aligned_be64 tx_errors; /* # of packets dropped due to overrun. */
537};
e2b9ac44 538OFP_ASSERT(sizeof(struct ofp10_queue_stats) == 32);
53931554
BP
539
540/* Vendor extension stats message. */
982697a4 541struct ofp10_vendor_stats_msg {
e2b9ac44 542 struct ofp10_stats_msg osm; /* Type OFPST_VENDOR. */
53931554
BP
543 ovs_be32 vendor; /* Vendor ID:
544 * - MSB 0: low-order bytes are IEEE OUI.
545 * - MSB != 0: defined by OpenFlow
546 * consortium. */
547 /* Followed by vendor-defined arbitrary additional data. */
548};
982697a4 549OFP_ASSERT(sizeof(struct ofp10_vendor_stats_msg) == 16);
53931554
BP
550
551/* Vendor extension. */
552struct ofp_vendor_header {
553 struct ofp_header header; /* Type OFPT_VENDOR. */
554 ovs_be32 vendor; /* Vendor ID:
555 * - MSB 0: low-order bytes are IEEE OUI.
556 * - MSB != 0: defined by OpenFlow
557 * consortium. */
558 /* Vendor-defined arbitrary additional data. */
559};
560OFP_ASSERT(sizeof(struct ofp_vendor_header) == 12);
561
562#endif /* openflow/openflow-1.0.h */