58be0b57b7c024d4ce03eb761b7f0f8a372dd652
[cascardo/ovs.git] / include / openflow / openflow-1.2.h
1 /* Copyright (c) 2008, 2011, 2012, 2013, 2014 The Board of Trustees of The Leland Stanford
2  * Junior University
3  *
4  * We are making the OpenFlow specification and associated documentation
5  * (Software) available for public use and benefit with the expectation
6  * that others will use, modify and enhance the Software and contribute
7  * those enhancements back to the community. However, since we would
8  * like to make the Software available for broadest use, with as few
9  * restrictions as possible permission is hereby granted, free of
10  * charge, to any person obtaining a copy of this Software to deal in
11  * the Software under the copyrights without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
24  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27  * SOFTWARE.
28  *
29  * The name and trademarks of copyright holder(s) may NOT be used in
30  * advertising or publicity pertaining to the Software or any
31  * derivatives without specific, written prior permission.
32  */
33
34 /*
35  * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
36  * Copyright (c) 2012 Horms Solutions Ltd.
37  *
38  * Licensed under the Apache License, Version 2.0 (the "License");
39  * you may not use this file except in compliance with the License.
40  * You may obtain a copy of the License at:
41  *
42  *     http://www.apache.org/licenses/LICENSE-2.0
43  *
44  * Unless required by applicable law or agreed to in writing, software
45  * distributed under the License is distributed on an "AS IS" BASIS,
46  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47  * See the License for the specific language governing permissions and
48  * limitations under the License.
49  */
50
51 /* OpenFlow: protocol between controller and datapath. */
52
53 #ifndef OPENFLOW_12_H
54 #define OPENFLOW_12_H 1
55
56 #include "openflow/openflow-1.1.h"
57
58 /* Error type for experimenter error messages. */
59 #define OFPET12_EXPERIMENTER 0xffff
60
61 /*
62  * OXM Class IDs.
63  * The high order bit differentiate reserved classes from member classes.
64  * Classes 0x0000 to 0x7FFF are member classes, allocated by ONF.
65  * Classes 0x8000 to 0xFFFE are reserved classes, reserved for standardisation.
66  */
67 enum ofp12_oxm_class {
68     OFPXMC12_NXM_0          = 0x0000, /* Backward compatibility with NXM */
69     OFPXMC12_NXM_1          = 0x0001, /* Backward compatibility with NXM */
70     OFPXMC12_OPENFLOW_BASIC = 0x8000, /* Basic class for OpenFlow */
71     OFPXMC15_PACKET_REGS    = 0x8001, /* Packet registers (pipeline fields). */
72     OFPXMC12_EXPERIMENTER   = 0xffff, /* Experimenter class */
73 };
74
75 /* OXM Flow match field types for OpenFlow basic class. */
76 enum oxm12_ofb_match_fields {
77     OFPXMT12_OFB_IN_PORT,        /* Switch input port. */
78     OFPXMT12_OFB_IN_PHY_PORT,    /* Switch physical input port. */
79     OFPXMT12_OFB_METADATA,       /* Metadata passed between tables. */
80     OFPXMT12_OFB_ETH_DST,        /* Ethernet destination address. */
81     OFPXMT12_OFB_ETH_SRC,        /* Ethernet source address. */
82     OFPXMT12_OFB_ETH_TYPE,       /* Ethernet frame type. */
83     OFPXMT12_OFB_VLAN_VID,       /* VLAN id. */
84     OFPXMT12_OFB_VLAN_PCP,       /* VLAN priority. */
85     OFPXMT12_OFB_IP_DSCP,        /* IP DSCP (6 bits in ToS field). */
86     OFPXMT12_OFB_IP_ECN,         /* IP ECN (2 bits in ToS field). */
87     OFPXMT12_OFB_IP_PROTO,       /* IP protocol. */
88     OFPXMT12_OFB_IPV4_SRC,       /* IPv4 source address. */
89     OFPXMT12_OFB_IPV4_DST,       /* IPv4 destination address. */
90     OFPXMT12_OFB_TCP_SRC,        /* TCP source port. */
91     OFPXMT12_OFB_TCP_DST,        /* TCP destination port. */
92     OFPXMT12_OFB_UDP_SRC,        /* UDP source port. */
93     OFPXMT12_OFB_UDP_DST,        /* UDP destination port. */
94     OFPXMT12_OFB_SCTP_SRC,       /* SCTP source port. */
95     OFPXMT12_OFB_SCTP_DST,       /* SCTP destination port. */
96     OFPXMT12_OFB_ICMPV4_TYPE,    /* ICMP type. */
97     OFPXMT12_OFB_ICMPV4_CODE,    /* ICMP code. */
98     OFPXMT12_OFB_ARP_OP,         /* ARP opcode. */
99     OFPXMT12_OFB_ARP_SPA,        /* ARP source IPv4 address. */
100     OFPXMT12_OFB_ARP_TPA,        /* ARP target IPv4 address. */
101     OFPXMT12_OFB_ARP_SHA,        /* ARP source hardware address. */
102     OFPXMT12_OFB_ARP_THA,        /* ARP target hardware address. */
103     OFPXMT12_OFB_IPV6_SRC,       /* IPv6 source address. */
104     OFPXMT12_OFB_IPV6_DST,       /* IPv6 destination address. */
105     OFPXMT12_OFB_IPV6_FLABEL,    /* IPv6 Flow Label */
106     OFPXMT12_OFB_ICMPV6_TYPE,    /* ICMPv6 type. */
107     OFPXMT12_OFB_ICMPV6_CODE,    /* ICMPv6 code. */
108     OFPXMT12_OFB_IPV6_ND_TARGET, /* Target address for ND. */
109     OFPXMT12_OFB_IPV6_ND_SLL,    /* Source link-layer for ND. */
110     OFPXMT12_OFB_IPV6_ND_TLL,    /* Target link-layer for ND. */
111     OFPXMT12_OFB_MPLS_LABEL,     /* MPLS label. */
112     OFPXMT12_OFB_MPLS_TC,        /* MPLS TC. */
113
114     /* Following added in OpenFlow 1.3 */
115     OFPXMT13_OFB_MPLS_BOS,       /* MPLS BoS bit. */
116     OFPXMT13_OFB_PBB_ISID,       /* PBB I-SID. */
117     OFPXMT13_OFB_TUNNEL_ID,      /* Logical Port Metadata */
118     OFPXMT13_OFB_IPV6_EXTHDR,    /* IPv6 Extension Header pseudo-field */
119
120     /* Following added in OpenFlow 1.4. */
121     OFPXMT14_OFB_PBB_UCA = 41,  /* PBB UCA header field. */
122
123     /* Following added in OpenFlow 1.5. */
124     OFPXMT15_OFB_TCP_FLAGS = 42,  /* TCP flags. */
125  };
126
127 /* OXM implementation makes use of NXM as they are the same format
128  * with different field definitions
129  */
130
131 #define OXM_HEADER(FIELD, LENGTH) \
132     NXM_HEADER(OFPXMC12_OPENFLOW_BASIC, FIELD, LENGTH)
133 #define OXM_HEADER_W(FIELD, LENGTH) \
134     NXM_HEADER_W(OFPXMC12_OPENFLOW_BASIC, FIELD, LENGTH)
135
136 #define IS_OXM_HEADER(header) (NXM_VENDOR(header) == OFPXMC12_OPENFLOW_BASIC)
137
138 #define OXM_OF_IN_PORT        OXM_HEADER   (OFPXMT12_OFB_IN_PORT, 4)
139 #define OXM_OF_IN_PHY_PORT    OXM_HEADER   (OFPXMT12_OFB_IN_PHY_PORT, 4)
140 #define OXM_OF_METADATA       OXM_HEADER   (OFPXMT12_OFB_METADATA, 8)
141 #define OXM_OF_ETH_DST        OXM_HEADER   (OFPXMT12_OFB_ETH_DST, 6)
142 #define OXM_OF_ETH_DST_W      OXM_HEADER_W (OFPXMT12_OFB_ETH_DST, 6)
143 #define OXM_OF_ETH_SRC        OXM_HEADER   (OFPXMT12_OFB_ETH_SRC, 6)
144 #define OXM_OF_ETH_SRC_W      OXM_HEADER_W (OFPXMT12_OFB_ETH_SRC, 6)
145 #define OXM_OF_ETH_TYPE       OXM_HEADER   (OFPXMT12_OFB_ETH_TYPE, 2)
146 #define OXM_OF_VLAN_VID       OXM_HEADER   (OFPXMT12_OFB_VLAN_VID, 2)
147 #define OXM_OF_VLAN_VID_W     OXM_HEADER_W (OFPXMT12_OFB_VLAN_VID, 2)
148 #define OXM_OF_VLAN_PCP       OXM_HEADER   (OFPXMT12_OFB_VLAN_PCP, 1)
149 #define OXM_OF_IP_DSCP        OXM_HEADER   (OFPXMT12_OFB_IP_DSCP, 1)
150 #define OXM_OF_IP_ECN         OXM_HEADER   (OFPXMT12_OFB_IP_ECN, 1)
151 #define OXM_OF_IP_PROTO       OXM_HEADER   (OFPXMT12_OFB_IP_PROTO, 1)
152 #define OXM_OF_IPV4_SRC       OXM_HEADER   (OFPXMT12_OFB_IPV4_SRC, 4)
153 #define OXM_OF_IPV4_SRC_W     OXM_HEADER_W (OFPXMT12_OFB_IPV4_SRC, 4)
154 #define OXM_OF_IPV4_DST       OXM_HEADER   (OFPXMT12_OFB_IPV4_DST, 4)
155 #define OXM_OF_IPV4_DST_W     OXM_HEADER_W (OFPXMT12_OFB_IPV4_DST, 4)
156 #define OXM_OF_TCP_SRC        OXM_HEADER   (OFPXMT12_OFB_TCP_SRC, 2)
157 #define OXM_OF_TCP_DST        OXM_HEADER   (OFPXMT12_OFB_TCP_DST, 2)
158 #define OXM_OF_UDP_SRC        OXM_HEADER   (OFPXMT12_OFB_UDP_SRC, 2)
159 #define OXM_OF_UDP_DST        OXM_HEADER   (OFPXMT12_OFB_UDP_DST, 2)
160 #define OXM_OF_SCTP_SRC       OXM_HEADER   (OFPXMT12_OFB_SCTP_SRC, 2)
161 #define OXM_OF_SCTP_DST       OXM_HEADER   (OFPXMT12_OFB_SCTP_DST, 2)
162 #define OXM_OF_ICMPV4_TYPE    OXM_HEADER   (OFPXMT12_OFB_ICMPV4_TYPE, 1)
163 #define OXM_OF_ICMPV4_CODE    OXM_HEADER   (OFPXMT12_OFB_ICMPV4_CODE, 1)
164 #define OXM_OF_ARP_OP         OXM_HEADER   (OFPXMT12_OFB_ARP_OP, 2)
165 #define OXM_OF_ARP_SPA        OXM_HEADER   (OFPXMT12_OFB_ARP_SPA, 4)
166 #define OXM_OF_ARP_SPA_W      OXM_HEADER_W (OFPXMT12_OFB_ARP_SPA, 4)
167 #define OXM_OF_ARP_TPA        OXM_HEADER   (OFPXMT12_OFB_ARP_TPA, 4)
168 #define OXM_OF_ARP_TPA_W      OXM_HEADER_W (OFPXMT12_OFB_ARP_TPA, 4)
169 #define OXM_OF_ARP_SHA        OXM_HEADER   (OFPXMT12_OFB_ARP_SHA, 6)
170 #define OXM_OF_ARP_SHA_W      OXM_HEADER_W (OFPXMT12_OFB_ARP_SHA, 6)
171 #define OXM_OF_ARP_THA        OXM_HEADER   (OFPXMT12_OFB_ARP_THA, 6)
172 #define OXM_OF_ARP_THA_W      OXM_HEADER_W (OFPXMT12_OFB_ARP_THA, 6)
173 #define OXM_OF_IPV6_SRC       OXM_HEADER   (OFPXMT12_OFB_IPV6_SRC, 16)
174 #define OXM_OF_IPV6_SRC_W     OXM_HEADER_W (OFPXMT12_OFB_IPV6_SRC, 16)
175 #define OXM_OF_IPV6_DST       OXM_HEADER   (OFPXMT12_OFB_IPV6_DST, 16)
176 #define OXM_OF_IPV6_DST_W     OXM_HEADER_W (OFPXMT12_OFB_IPV6_DST, 16)
177 #define OXM_OF_IPV6_FLABEL    OXM_HEADER   (OFPXMT12_OFB_IPV6_FLABEL, 4)
178 #define OXM_OF_IPV6_FLABEL_W  OXM_HEADER_W (OFPXMT12_OFB_IPV6_FLABEL, 4)
179 #define OXM_OF_ICMPV6_TYPE    OXM_HEADER   (OFPXMT12_OFB_ICMPV6_TYPE, 1)
180 #define OXM_OF_ICMPV6_CODE    OXM_HEADER   (OFPXMT12_OFB_ICMPV6_CODE, 1)
181 #define OXM_OF_IPV6_ND_TARGET OXM_HEADER   (OFPXMT12_OFB_IPV6_ND_TARGET, 16)
182 #define OXM_OF_IPV6_ND_SLL    OXM_HEADER   (OFPXMT12_OFB_IPV6_ND_SLL, 6)
183 #define OXM_OF_IPV6_ND_TLL    OXM_HEADER   (OFPXMT12_OFB_IPV6_ND_TLL, 6)
184 #define OXM_OF_MPLS_LABEL     OXM_HEADER   (OFPXMT12_OFB_MPLS_LABEL, 4)
185 #define OXM_OF_MPLS_TC        OXM_HEADER   (OFPXMT12_OFB_MPLS_TC, 1)
186 #define OXM_OF_MPLS_BOS       OXM_HEADER   (OFPXMT13_OFB_MPLS_BOS, 1)
187 #define OXM_OF_PBB_ISID       OXM_HEADER   (OFPXMT12_OFB_PBB_ISID, 3)
188 #define OXM_OF_PBB_ISID_W     OXM_HEADER_W (OFPXMT12_OFB_PBB_ISID, 3)
189 #define OXM_OF_TUNNEL_ID      OXM_HEADER   (OFPXMT13_OFB_TUNNEL_ID, 8)
190 #define OXM_OF_TUNNEL_ID_W    OXM_HEADER_W (OFPXMT13_OFB_TUNNEL_ID, 8)
191 #define OXM_OF_IPV6_EXTHDR    OXM_HEADER   (OFPXMT13_OFB_IPV6_EXTHDR, 2)
192 #define OXM_OF_IPV6_EXTHDR_W  OXM_HEADER_W (OFPXMT13_OFB_IPV6_EXTHDR, 2)
193 #define OXM_OF_PBB_UCA        OXM_HEADER   (OFPXMT14_OFB_PBB_UCA, 1)
194 #define OXM_OF_TCP_FLAGS      OXM_HEADER   (OFPXMT15_OFB_TCP_FLAGS, 2)
195 #define OXM_OF_TCP_FLAGS_W    OXM_HEADER_W (OFPXMT15_OFB_TCP_FLAGS, 2)
196
197 #define OXM_OF_PKT_REG(N)    (NXM_HEADER  (OFPXMC15_PACKET_REGS, N, 8))
198 #define OXM_OF_PKT_REG_W(N)  (NXM_HEADER_W(OFPXMC15_PACKET_REGS, N, 8))
199
200 /* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate
201  * special conditions.
202  */
203 enum ofp12_vlan_id {
204     OFPVID12_PRESENT = 0x1000, /* Bit that indicate that a VLAN id is set */
205     OFPVID12_NONE    = 0x0000, /* No VLAN id was set. */
206 };
207
208 /* Bit definitions for IPv6 Extension Header pseudo-field. */
209 enum ofp12_ipv6exthdr_flags {
210     OFPIEH12_NONEXT = 1 << 0,   /* "No next header" encountered. */
211     OFPIEH12_ESP    = 1 << 1,   /* Encrypted Sec Payload header present. */
212     OFPIEH12_AUTH   = 1 << 2,   /* Authentication header present. */
213     OFPIEH12_DEST   = 1 << 3,   /* 1 or 2 dest headers present. */
214     OFPIEH12_FRAG   = 1 << 4,   /* Fragment header present. */
215     OFPIEH12_ROUTER = 1 << 5,   /* Router header present. */
216     OFPIEH12_HOP    = 1 << 6,   /* Hop-by-hop header present. */
217     OFPIEH12_UNREP  = 1 << 7,   /* Unexpected repeats encountered. */
218     OFPIEH12_UNSEQ  = 1 << 8    /* Unexpected sequencing encountered. */
219 };
220
221 /* Header for OXM experimenter match fields. */
222 struct ofp12_oxm_experimenter_header {
223     ovs_be32 oxm_header;   /* oxm_class = OFPXMC_EXPERIMENTER */
224     ovs_be32 experimenter; /* Experimenter ID which takes the same
225                               form as in struct ofp11_experimenter_header. */
226 };
227 OFP_ASSERT(sizeof(struct ofp12_oxm_experimenter_header) == 8);
228
229 enum ofp12_controller_max_len {
230     OFPCML12_MAX       = 0xffe5, /* maximum max_len value which can be used
231                                   * to request a specific byte length. */
232     OFPCML12_NO_BUFFER = 0xffff  /* indicates that no buffering should be
233                                   * applied and the whole packet is to be
234                                   * sent to the controller. */
235 };
236
237 /* OpenFlow 1.2 specific flags
238  * (struct ofp12_flow_mod, member flags). */
239 enum ofp12_flow_mod_flags {
240     OFPFF12_RESET_COUNTS  = 1 << 2   /* Reset flow packet and byte counts. */
241 };
242
243 /* OpenFlow 1.2 specific capabilities
244  * (struct ofp_switch_features, member capabilities). */
245 enum ofp12_capabilities {
246     OFPC12_PORT_BLOCKED   = 1 << 8   /* Switch will block looping ports. */
247 };
248
249 /* Full description for a queue. */
250 struct ofp12_packet_queue {
251     ovs_be32 queue_id;     /* id for the specific queue. */
252     ovs_be32 port;         /* Port this queue is attached to. */
253     ovs_be16 len;          /* Length in bytes of this queue desc. */
254     uint8_t pad[6];        /* 64-bit alignment. */
255     /* Followed by any number of queue properties expressed using
256      * ofp_queue_prop_header, to fill out a total of 'len' bytes. */
257 };
258 OFP_ASSERT(sizeof(struct ofp12_packet_queue) == 16);
259
260 /* Body of reply to OFPST_TABLE request. */
261 struct ofp12_table_stats {
262     uint8_t table_id;        /* Identifier of table.  Lower numbered tables
263                                 are consulted first. */
264     uint8_t pad[7];          /* Align to 64-bits. */
265     char name[OFP_MAX_TABLE_NAME_LEN];
266     ovs_be64 match;          /* Bitmap of (1 << OFPXMT_*) that indicate the
267                                 fields the table can match on. */
268     ovs_be64 wildcards;      /* Bitmap of (1 << OFPXMT_*) wildcards that are
269                                 supported by the table. */
270     ovs_be32 write_actions;  /* Bitmap of OFPAT_* that are supported
271                                 by the table with OFPIT_WRITE_ACTIONS. */
272     ovs_be32 apply_actions;  /* Bitmap of OFPAT_* that are supported
273                                 by the table with OFPIT_APPLY_ACTIONS. */
274     ovs_be64 write_setfields;/* Bitmap of (1 << OFPXMT_*) header fields that
275                                 can be set with OFPIT_WRITE_ACTIONS. */
276     ovs_be64 apply_setfields;/* Bitmap of (1 << OFPXMT_*) header fields that
277                                 can be set with OFPIT_APPLY_ACTIONS. */
278     ovs_be64 metadata_match; /* Bits of metadata table can match. */
279     ovs_be64 metadata_write; /* Bits of metadata table can write. */
280     ovs_be32 instructions;   /* Bitmap of OFPIT_* values supported. */
281     ovs_be32 config;         /* Bitmap of OFPTC_* values */
282     ovs_be32 max_entries;    /* Max number of entries supported. */
283     ovs_be32 active_count;   /* Number of active entries. */
284     ovs_be64 lookup_count;   /* Number of packets looked up in table. */
285     ovs_be64 matched_count;  /* Number of packets that hit table. */
286 };
287 OFP_ASSERT(sizeof(struct ofp12_table_stats) == 128);
288
289 /* Number of types of groups supported by ofp12_group_features_stats. */
290 #define OFPGT12_N_TYPES 4
291
292 /* Body of reply to OFPST12_GROUP_FEATURES request. Group features. */
293 struct ofp12_group_features_stats {
294     ovs_be32  types;           /* Bitmap of OFPGT11_* values supported. */
295     ovs_be32  capabilities;    /* Bitmap of OFPGFC12_* capability supported. */
296
297     /* Each element in the following arrays corresponds to the group type with
298      * the same number, e.g. max_groups[0] is the maximum number of OFPGT11_ALL
299      * groups, actions[2] is the actions supported by OFPGT11_INDIRECT
300      * groups. */
301     ovs_be32  max_groups[OFPGT12_N_TYPES]; /* Max number of groups. */
302     ovs_be32  actions[OFPGT12_N_TYPES];    /* Bitmaps of supported OFPAT_*. */
303 };
304 OFP_ASSERT(sizeof(struct ofp12_group_features_stats) == 40);
305
306 /* Group configuration flags */
307 enum ofp12_group_capabilities {
308     OFPGFC12_SELECT_WEIGHT   = 1 << 0, /* Support weight for select groups */
309     OFPGFC12_SELECT_LIVENESS = 1 << 1, /* Support liveness for select groups */
310     OFPGFC12_CHAINING        = 1 << 2, /* Support chaining groups */
311     OFPGFC12_CHAINING_CHECKS = 1 << 3, /* Check chaining for loops and delete */
312 };
313
314 /* Body for ofp12_stats_request/reply of type OFPST_EXPERIMENTER. */
315 struct ofp12_experimenter_stats_header {
316     ovs_be32 experimenter;    /* Experimenter ID which takes the same form
317                                  as in struct ofp_experimenter_header. */
318     ovs_be32 exp_type;        /* Experimenter defined. */
319     /* Experimenter-defined arbitrary additional data. */
320 };
321 OFP_ASSERT(sizeof(struct ofp12_experimenter_stats_header) == 8);
322
323 /* Role request and reply message. */
324 struct ofp12_role_request {
325     ovs_be32 role;            /* One of OFPCR12_ROLE_*. */
326     uint8_t pad[4];           /* Align to 64 bits. */
327     ovs_be64 generation_id;   /* Master Election Generation Id */
328 };
329 OFP_ASSERT(sizeof(struct ofp12_role_request) == 16);
330
331 /* Controller roles. */
332 enum ofp12_controller_role {
333     OFPCR12_ROLE_NOCHANGE,    /* Don't change current role. */
334     OFPCR12_ROLE_EQUAL,       /* Default role, full access. */
335     OFPCR12_ROLE_MASTER,      /* Full access, at most one master. */
336     OFPCR12_ROLE_SLAVE,       /* Read-only access. */
337 };
338
339 /* Packet received on port (datapath -> controller). */
340 struct ofp12_packet_in {
341     ovs_be32 buffer_id;     /* ID assigned by datapath. */
342     ovs_be16 total_len;     /* Full length of frame. */
343     uint8_t reason;         /* Reason packet is being sent (one of OFPR_*) */
344     uint8_t table_id;       /* ID of the table that was looked up */
345     /* Followed by:
346      *   - Match
347      *   - Exactly 2 all-zero padding bytes, then
348      *   - An Ethernet frame whose length is inferred from header.length.
349      * The padding bytes preceding the Ethernet frame ensure that the IP
350      * header (if any) following the Ethernet header is 32-bit aligned.
351      */
352     /* struct ofp12_match match; */
353     /* uint8_t pad[2];         Align to 64 bit + 16 bit */
354     /* uint8_t data[0];        Ethernet frame */
355 };
356 OFP_ASSERT(sizeof(struct ofp12_packet_in) == 8);
357
358 /* Flow removed (datapath -> controller). */
359 struct ofp12_flow_removed {
360     ovs_be64 cookie;          /* Opaque controller-issued identifier. */
361
362     ovs_be16 priority;        /* Priority level of flow entry. */
363     uint8_t reason;           /* One of OFPRR_*. */
364     uint8_t table_id;         /* ID of the table */
365
366     ovs_be32 duration_sec;    /* Time flow was alive in seconds. */
367     ovs_be32 duration_nsec;   /* Time flow was alive in nanoseconds beyond
368                                  duration_sec. */
369     ovs_be16 idle_timeout;    /* Idle timeout from original flow mod. */
370     ovs_be16 hard_timeout;    /* Hard timeout from original flow mod. */
371     ovs_be64 packet_count;
372     ovs_be64 byte_count;
373     /* struct ofp12_match match;  Description of fields. Variable size. */
374 };
375 OFP_ASSERT(sizeof(struct ofp12_flow_removed) == 40);
376
377 #endif /* openflow/openflow-1.2.h */