1 /* Copyright (c) 2008, 2014 The Board of Trustees of The Leland Stanford
3 * Copyright (c) 2011, 2012 Open Networking Foundation
5 * We are making the OpenFlow specification and associated documentation
6 * (Software) available for public use and benefit with the expectation
7 * that others will use, modify and enhance the Software and contribute
8 * those enhancements back to the community. However, since we would
9 * like to make the Software available for broadest use, with as few
10 * restrictions as possible permission is hereby granted, free of
11 * charge, to any person obtaining a copy of this Software to deal in
12 * the Software under the copyrights without restriction, including
13 * without limitation the rights to use, copy, modify, merge, publish,
14 * distribute, sublicense, and/or sell copies of the Software, and to
15 * permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
25 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
26 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * The name and trademarks of copyright holder(s) may NOT be used in
31 * advertising or publicity pertaining to the Software or any
32 * derivatives without specific, written prior permission.
35 /* OpenFlow: protocol between controller and datapath. */
38 #define OPENFLOW_14_H 1
40 #include "openflow/openflow-1.3.h"
43 /* ## ---------- ## */
44 /* ## ofp14_port ## */
45 /* ## ---------- ## */
47 /* Port description property types. */
48 enum ofp_port_desc_prop_type {
49 OFPPDPT14_ETHERNET = 0, /* Ethernet property. */
50 OFPPDPT14_OPTICAL = 1, /* Optical property. */
51 OFPPDPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
54 /* Ethernet port description property. */
55 struct ofp14_port_desc_prop_ethernet {
56 ovs_be16 type; /* OFPPDPT14_ETHERNET. */
57 ovs_be16 length; /* Length in bytes of this property. */
58 uint8_t pad[4]; /* Align to 64 bits. */
59 /* Bitmaps of OFPPF_* that describe features. All bits zeroed if
60 * unsupported or unavailable. */
61 ovs_be32 curr; /* Current features. */
62 ovs_be32 advertised; /* Features being advertised by the port. */
63 ovs_be32 supported; /* Features supported by the port. */
64 ovs_be32 peer; /* Features advertised by peer. */
66 ovs_be32 curr_speed; /* Current port bitrate in kbps. */
67 ovs_be32 max_speed; /* Max port bitrate in kbps */
69 OFP_ASSERT(sizeof(struct ofp14_port_desc_prop_ethernet) == 32);
75 uint8_t hw_addr[OFP_ETH_ALEN];
76 uint8_t pad2[2]; /* Align to 64 bits. */
77 char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */
79 ovs_be32 config; /* Bitmap of OFPPC_* flags. */
80 ovs_be32 state; /* Bitmap of OFPPS_* flags. */
82 /* Followed by 0 or more OFPPDPT14_* properties. */
84 OFP_ASSERT(sizeof(struct ofp14_port) == 40);
87 /* ## -------------- ## */
88 /* ## ofp14_port_mod ## */
89 /* ## -------------- ## */
91 enum ofp14_port_mod_prop_type {
92 OFPPMPT14_ETHERNET = 0, /* Ethernet property. */
93 OFPPMPT14_OPTICAL = 1, /* Optical property. */
94 OFPPMPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
97 /* Ethernet port mod property. */
98 struct ofp14_port_mod_prop_ethernet {
99 ovs_be16 type; /* OFPPMPT14_ETHERNET. */
100 ovs_be16 length; /* Length in bytes of this property. */
101 ovs_be32 advertise; /* Bitmap of OFPPF_*. Zero all bits to prevent
102 any action taking place. */
104 OFP_ASSERT(sizeof(struct ofp14_port_mod_prop_ethernet) == 8);
106 struct ofp14_port_mod {
109 uint8_t hw_addr[OFP_ETH_ALEN];
111 ovs_be32 config; /* Bitmap of OFPPC_* flags. */
112 ovs_be32 mask; /* Bitmap of OFPPC_* flags to be changed. */
113 /* Followed by 0 or more OFPPMPT14_* properties. */
115 OFP_ASSERT(sizeof(struct ofp14_port_mod) == 24);
117 /* ## --------------- ## */
118 /* ## ofp14_table_mod ## */
119 /* ## --------------- ## */
121 enum ofp14_table_mod_prop_type {
122 OFPTMPT14_EVICTION = 0x2, /* Eviction property. */
123 OFPTMPT14_VACANCY = 0x3, /* Vacancy property. */
124 OFPTMPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
127 enum ofp14_table_mod_prop_eviction_flag {
128 OFPTMPEF14_OTHER = 1 << 0, /* Using other factors. */
129 OFPTMPEF14_IMPORTANCE = 1 << 1, /* Using flow entry importance. */
130 OFPTMPEF14_LIFETIME = 1 << 2, /* Using flow entry lifetime. */
133 struct ofp14_table_mod_prop_eviction {
134 ovs_be16 type; /* OFPTMPT14_EVICTION. */
135 ovs_be16 length; /* Length in bytes of this property. */
136 ovs_be32 flags; /* Bitmap of OFPTMPEF14_* flags */
138 OFP_ASSERT(sizeof(struct ofp14_table_mod_prop_eviction) == 8);
140 struct ofp14_table_mod_prop_vacancy {
141 ovs_be16 type; /* OFPTMPT14_VACANCY. */
142 ovs_be16 length; /* Length in bytes of this property. */
143 uint8_t vacancy_down; /* Vacancy threshold when space decreases (%). */
144 uint8_t vacancy_up; /* Vacancy threshold when space increases (%). */
145 uint8_t vacancy; /* Current vacancy (%) - only in ofp14_table_desc. */
146 uint8_t pad[1]; /* Align to 64 bits. */
148 OFP_ASSERT(sizeof(struct ofp14_table_mod_prop_vacancy) == 8);
150 struct ofp14_table_mod {
151 uint8_t table_id; /* ID of the table, OFPTT_ALL indicates all tables */
152 uint8_t pad[3]; /* Pad to 32 bits */
153 ovs_be32 config; /* Bitmap of OFPTC_* flags */
154 /* Followed by 0 or more OFPTMPT14_* properties. */
156 OFP_ASSERT(sizeof(struct ofp14_table_mod) == 8);
159 /* ## -------------- ## */
160 /* ## Miscellaneous. ## */
161 /* ## -------------- ## */
163 /* Common header for all async config Properties */
164 struct ofp14_async_config_prop_header {
165 ovs_be16 type; /* One of OFPACPT_*. */
166 ovs_be16 length; /* Length in bytes of this property. */
168 OFP_ASSERT(sizeof(struct ofp14_async_config_prop_header) == 4);
170 /* Asynchronous message configuration.
171 * OFPT_GET_ASYNC_REPLY or OFPT_SET_ASYNC.
173 struct ofp14_async_config {
174 struct ofp_header header;
175 /* Async config Property list - 0 or more */
176 struct ofp14_async_config_prop_header properties[0];
178 OFP_ASSERT(sizeof(struct ofp14_async_config) == 8);
180 /* Async Config property types.
181 * Low order bit cleared indicates a property for the slave role.
182 * Low order bit set indicates a property for the master/equal role.
184 enum ofp14_async_config_prop_type {
185 OFPACPT_PACKET_IN_SLAVE = 0, /* Packet-in mask for slave. */
186 OFPACPT_PACKET_IN_MASTER = 1, /* Packet-in mask for master. */
187 OFPACPT_PORT_STATUS_SLAVE = 2, /* Port-status mask for slave. */
188 OFPACPT_PORT_STATUS_MASTER = 3, /* Port-status mask for master. */
189 OFPACPT_FLOW_REMOVED_SLAVE = 4, /* Flow removed mask for slave. */
190 OFPACPT_FLOW_REMOVED_MASTER = 5, /* Flow removed mask for master. */
191 OFPACPT_ROLE_STATUS_SLAVE = 6, /* Role status mask for slave. */
192 OFPACPT_ROLE_STATUS_MASTER = 7, /* Role status mask for master. */
193 OFPACPT_TABLE_STATUS_SLAVE = 8, /* Table status mask for slave. */
194 OFPACPT_TABLE_STATUS_MASTER = 9, /* Table status mask for master. */
195 OFPACPT_REQUESTFORWARD_SLAVE = 10, /* RequestForward mask for slave. */
196 OFPACPT_REQUESTFORWARD_MASTER = 11, /* RequestForward mask for master. */
197 OFPTFPT_EXPERIMENTER_SLAVE = 0xFFFE, /* Experimenter for slave. */
198 OFPTFPT_EXPERIMENTER_MASTER = 0xFFFF, /* Experimenter for master. */
201 /* Various reason based properties */
202 struct ofp14_async_config_prop_reasons {
203 /* 'type' is one of OFPACPT_PACKET_IN_*, OFPACPT_PORT_STATUS_*,
204 * OFPACPT_FLOW_REMOVED_*, OFPACPT_ROLE_STATUS_*,
205 * OFPACPT_TABLE_STATUS_*, OFPACPT_REQUESTFORWARD_*. */
207 ovs_be16 length; /* Length in bytes of this property. */
208 ovs_be32 mask; /* Bitmasks of reason values. */
210 OFP_ASSERT(sizeof(struct ofp14_async_config_prop_reasons) == 8);
212 /* Experimenter async config property */
213 struct ofp14_async_config_prop_experimenter {
214 ovs_be16 type; /* One of OFPTFPT_EXPERIMENTER_SLAVE,
215 OFPTFPT_EXPERIMENTER_MASTER. */
216 ovs_be16 length; /* Length in bytes of this property. */
217 ovs_be32 experimenter; /* Experimenter ID which takes the same
219 ofp_experimenter_header. */
220 ovs_be32 exp_type; /* Experimenter defined. */
222 * - Exactly (length - 12) bytes containing the experimenter data, then
223 * - Exactly (length + 7)/8*8 - (length) (between 0 and 7)
224 * bytes of all-zero bytes */
226 OFP_ASSERT(sizeof(struct ofp14_async_config_prop_experimenter) == 12);
228 /* Common header for all Role Properties */
229 struct ofp14_role_prop_header {
230 ovs_be16 type; /* One of OFPRPT_*. */
231 ovs_be16 length; /* Length in bytes of this property. */
233 OFP_ASSERT(sizeof(struct ofp14_role_prop_header) == 4);
235 /* Role status event message. */
236 struct ofp14_role_status {
237 ovs_be32 role; /* One of OFPCR_ROLE_*. */
238 uint8_t reason; /* One of OFPCRR_*. */
239 uint8_t pad[3]; /* Align to 64 bits. */
240 ovs_be64 generation_id; /* Master Election Generation Id */
242 /* Followed by a list of struct ofp14_role_prop_header */
244 OFP_ASSERT(sizeof(struct ofp14_role_status) == 16);
246 /* What changed about the controller role */
247 enum ofp14_controller_role_reason {
248 OFPCRR_MASTER_REQUEST = 0, /* Another controller asked to be master. */
249 OFPCRR_CONFIG = 1, /* Configuration changed on the switch. */
250 OFPCRR_EXPERIMENTER = 2, /* Experimenter data changed. */
253 /* Role property types.
255 enum ofp14_role_prop_type {
256 OFPRPT_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
259 /* Experimenter role property */
260 struct ofp14_role_prop_experimenter {
261 ovs_be16 type; /* One of OFPRPT_EXPERIMENTER. */
262 ovs_be16 length; /* Length in bytes of this property. */
263 ovs_be32 experimenter; /* Experimenter ID which takes the same
265 ofp_experimenter_header. */
266 ovs_be32 exp_type; /* Experimenter defined. */
268 * - Exactly (length - 12) bytes containing the experimenter data, then
269 * - Exactly (length + 7)/8*8 - (length) (between 0 and 7)
270 * bytes of all-zero bytes */
272 OFP_ASSERT(sizeof(struct ofp14_role_prop_experimenter) == 12);
274 /* Bundle control message types */
275 enum ofp14_bundle_ctrl_type {
276 OFPBCT_OPEN_REQUEST = 0,
277 OFPBCT_OPEN_REPLY = 1,
278 OFPBCT_CLOSE_REQUEST = 2,
279 OFPBCT_CLOSE_REPLY = 3,
280 OFPBCT_COMMIT_REQUEST = 4,
281 OFPBCT_COMMIT_REPLY = 5,
282 OFPBCT_DISCARD_REQUEST = 6,
283 OFPBCT_DISCARD_REPLY = 7,
286 /* Bundle configuration flags. */
287 enum ofp14_bundle_flags {
288 OFPBF_ATOMIC = 1 << 0, /* Execute atomically. */
289 OFPBF_ORDERED = 1 << 1, /* Execute in specified order. */
292 /* Message structure for OFPT_BUNDLE_CONTROL and OFPT_BUNDLE_ADD_MESSAGE. */
293 struct ofp14_bundle_ctrl_msg {
294 ovs_be32 bundle_id; /* Identify the bundle. */
295 ovs_be16 type; /* OFPT_BUNDLE_CONTROL: one of OFPBCT_*.
296 * OFPT_BUNDLE_ADD_MESSAGE: not used. */
297 ovs_be16 flags; /* Bitmap of OFPBF_* flags. */
299 * - For OFPT_BUNDLE_ADD_MESSAGE only, an encapsulated OpenFlow message,
300 * beginning with an ofp_header whose xid is identical to this message's
302 * - For OFPT_BUNDLE_ADD_MESSAGE only, and only if at least one property is
303 * present, 0 to 7 bytes of padding to align on a 64-bit boundary.
304 * - Zero or more properties (see struct ofp14_bundle_prop_header). */
306 OFP_ASSERT(sizeof(struct ofp14_bundle_ctrl_msg) == 8);
308 #endif /* openflow/openflow-1.4.h */