2 * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #define OFP_ERRORS_H 1
29 * We embed system errno values and OpenFlow standard and vendor extension
30 * error codes into the positive range of "int":
32 * - Errno values are assumed to use the range 1 through 2**30 - 1.
34 * (C and POSIX say that errno values are positive. We assume that they
35 * are less than 2**29. They are actually less than 65536 on at least
36 * Linux, FreeBSD, OpenBSD, and Windows.)
38 * - OpenFlow standard and vendor extension error codes use the range
39 * starting at 2**30 (OFPERR_OFS).
41 * Zero and negative values are not used.
44 #define OFPERR_OFS (1 << 30)
47 /* ## ------------------ ## */
48 /* ## OFPET_HELLO_FAILED ## */
49 /* ## ------------------ ## */
51 /* OF(0). Hello protocol failed. */
52 OFPERR_OFPET_HELLO_FAILED = OFPERR_OFS,
54 /* OF(0,0). No compatible version. */
55 OFPERR_OFPHFC_INCOMPATIBLE,
57 /* OF(0,1). Permissions error. */
60 /* ## ----------------- ## */
61 /* ## OFPET_BAD_REQUEST ## */
62 /* ## ----------------- ## */
64 /* OF(1). Request was not understood. */
65 OFPERR_OFPET_BAD_REQUEST,
67 /* OF(1,0). ofp_header.version not supported. */
68 OFPERR_OFPBRC_BAD_VERSION,
70 /* OF(1,1). ofp_header.type not supported. */
71 OFPERR_OFPBRC_BAD_TYPE,
73 /* OF(1,2). ofp_stats_msg.type not supported. */
74 OFPERR_OFPBRC_BAD_STAT,
76 /* OF(1,3). Vendor not supported (in ofp_vendor_header or
78 OFPERR_OFPBRC_BAD_VENDOR,
80 /* OF(1,4). Vendor subtype not supported. */
81 OFPERR_OFPBRC_BAD_SUBTYPE,
83 /* OF(1,5). Permissions error. */
86 /* OF(1,6). Wrong request length for type. */
87 OFPERR_OFPBRC_BAD_LEN,
89 /* OF(1,7). Specified buffer has already been used. */
90 OFPERR_OFPBRC_BUFFER_EMPTY,
92 /* OF(1,8). Specified buffer does not exist. */
93 OFPERR_OFPBRC_BUFFER_UNKNOWN,
95 /* OF1.1(1,9). Specified table-id invalid or does not exist. */
96 OFPERR_OFPBRC_BAD_TABLE_ID,
98 /* NX(1,256). Invalid NXM flow match. */
99 OFPERR_NXBRC_NXM_INVALID,
101 /* NX(1,257). The nxm_type, or nxm_type taken in combination with
102 * nxm_hasmask or nxm_length or both, is invalid or not implemented. */
103 OFPERR_NXBRC_NXM_BAD_TYPE,
105 /* NX(1,258). Invalid nxm_value. */
106 OFPERR_NXBRC_NXM_BAD_VALUE,
108 /* NX(1,259). Invalid nxm_mask. */
109 OFPERR_NXBRC_NXM_BAD_MASK,
111 /* NX(1,260). A prerequisite was not met. */
112 OFPERR_NXBRC_NXM_BAD_PREREQ,
114 /* NX(1,261). A given nxm_type was specified more than once. */
115 OFPERR_NXBRC_NXM_DUP_TYPE,
117 /* NX(1,512). A request specified a nonexistent table ID. */
118 OFPERR_NXBRC_BAD_TABLE_ID,
120 /* NX(1,513). NXT_ROLE_REQUEST specified an invalid role. */
121 OFPERR_NXBRC_BAD_ROLE,
123 /* NX(1,514). The in_port in an ofp_packet_out request is invalid. */
124 OFPERR_NXBRC_BAD_IN_PORT,
126 /* NX(1,515). Must-be-zero field had nonzero value. */
127 OFPERR_NXBRC_MUST_BE_ZERO,
129 /* NX(1,516). The reason in an ofp_port_status message is not valid. */
130 OFPERR_NXBRC_BAD_REASON,
132 /* ## ---------------- ## */
133 /* ## OFPET_BAD_ACTION ## */
134 /* ## ---------------- ## */
136 /* OF(2). Error in action description. */
137 OFPERR_OFPET_BAD_ACTION,
139 /* OF(2,0). Unknown action type. */
140 OFPERR_OFPBAC_BAD_TYPE,
142 /* OF(2,1). Length problem in actions. */
143 OFPERR_OFPBAC_BAD_LEN,
145 /* OF(2,2). Unknown experimenter id specified. */
146 OFPERR_OFPBAC_BAD_VENDOR,
148 /* OF(2,3). Unknown action type for experimenter id. */
149 OFPERR_OFPBAC_BAD_VENDOR_TYPE,
151 /* OF(2,4). Problem validating output port. */
152 OFPERR_OFPBAC_BAD_OUT_PORT,
154 /* OF(2,5). Bad action argument. */
155 OFPERR_OFPBAC_BAD_ARGUMENT,
157 /* OF(2,6). Permissions error. */
160 /* OF(2,7). Can't handle this many actions. */
161 OFPERR_OFPBAC_TOO_MANY,
163 /* OF(2,8). Problem validating output queue. */
164 OFPERR_OFPBAC_BAD_QUEUE,
166 /* OF1.1(2,9). Invalid group id in forward action. */
167 OFPERR_OFPBAC_BAD_OUT_GROUP,
169 /* OF1.1(2,10). Action can't apply for this match. */
170 OFPERR_OFPBAC_MATCH_INCONSISTENT,
172 /* OF1.1(2,11). Action order is unsupported for the action list in an
173 * Apply-Actions instruction */
174 OFPERR_OFPBAC_UNSUPPORTED_ORDER,
176 /* OF1.1(2,12). Actions uses an unsupported tag/encap. */
177 OFPERR_OFPBAC_BAD_TAG,
179 /* NX(2,256). Must-be-zero action argument had nonzero value. */
180 OFPERR_NXBAC_MUST_BE_ZERO,
182 /* ## --------------------- ## */
183 /* ## OFPET_BAD_INSTRUCTION ## */
184 /* ## --------------------- ## */
186 /* OF1.1(3). Error in instruction list. */
187 OFPERR_OFPET_BAD_INSTRUCTION,
189 /* OF1.1(3,0). Unknown instruction. */
190 OFPERR_OFPBIC_UNKNOWN_INST,
192 /* OF1.1(3,1). Switch or table does not support the instruction. */
193 OFPERR_OFPBIC_UNSUP_INST,
195 /* OF1.1(3,2). Invalid Table-ID specified. */
196 OFPERR_OFPBIC_BAD_TABLE_ID,
198 /* OF1.1(3,3). Metadata value unsupported by datapath. */
199 OFPERR_OFPBIC_UNSUP_METADATA,
201 /* OF1.1(3,4). Metadata mask value unsupported by datapath. */
202 OFPERR_OFPBIC_UNSUP_METADATA_MASK,
204 /* OF1.1(3,5). Specific experimenter instruction unsupported. */
205 OFPERR_OFPBIC_UNSUP_EXP_INST,
207 /* ## --------------- ## */
208 /* ## OFPET_BAD_MATCH ## */
209 /* ## --------------- ## */
211 /* OF1.1(4). Error in match. */
212 OFPERR_OFPET_BAD_MATCH,
214 /* OF1.1(4,0). Unsupported match type specified by the match */
215 OFPERR_OFPBMC_BAD_TYPE,
217 /* OF1.1(4,1). Length problem in match. */
218 OFPERR_OFPBMC_BAD_LEN,
220 /* OF1.1(4,2). Match uses an unsupported tag/encap. */
221 OFPERR_OFPBMC_BAD_TAG,
223 /* OF1.1(4,3). Unsupported datalink addr mask - switch does not support
224 * arbitrary datalink address mask. */
225 OFPERR_OFPBMC_BAD_DL_ADDR_MASK,
227 /* OF1.1(4,4). Unsupported network addr mask - switch does not support
228 * arbitrary network address mask. */
229 OFPERR_OFPBMC_BAD_NW_ADDR_MASK,
231 /* OF1.1(4,5). Unsupported wildcard specified in the match. */
232 OFPERR_OFPBMC_BAD_WILDCARDS,
234 /* OF1.1(4,6). Unsupported field in the match. */
235 OFPERR_OFPBMC_BAD_FIELD,
237 /* OF1.1(4,7). Unsupported value in a match field. */
238 OFPERR_OFPBMC_BAD_VALUE,
240 /* ## --------------------- ## */
241 /* ## OFPET_FLOW_MOD_FAILED ## */
242 /* ## --------------------- ## */
244 /* OF1.0(3), OF1.1(5). Problem modifying flow entry. */
245 OFPERR_OFPET_FLOW_MOD_FAILED,
247 /* OF1.1(5,0). Unspecified error. */
248 OFPERR_OFPFMFC_UNKNOWN,
250 /* OF1.0(3,0). Flow not added because of full tables. */
251 OFPERR_OFPFMFC_ALL_TABLES_FULL,
253 /* OF1.1(5,1). Flow not added because table was full. */
254 OFPERR_OFPFMFC_TABLE_FULL,
256 /* OF1.1(5,2). Table does not exist */
257 OFPERR_OFPFMFC_BAD_TABLE_ID,
259 /* OF1.0(3,1), OF1.1(5,3). Attempted to add overlapping flow with
260 * CHECK_OVERLAP flag set. */
261 OFPERR_OFPFMFC_OVERLAP,
263 /* OF1.0(3,2), OF1.1(5,4). Permissions error. */
264 OFPERR_OFPFMFC_EPERM,
266 /* OF1.1(5,5). Flow not added because of unsupported idle/hard timeout. */
267 OFPERR_OFPFMFC_BAD_TIMEOUT,
269 /* OF1.0(3,3). Flow not added because of non-zero idle/hard timeout. */
270 OFPERR_OFPFMFC_BAD_EMERG_TIMEOUT,
272 /* OF1.0(3,4), OF1.1(5,6). Unsupported or unknown command. */
273 OFPERR_OFPFMFC_BAD_COMMAND,
275 /* OF1.0(3,5). Unsupported action list - cannot process in the order
277 OFPERR_OFPFMFC_UNSUPPORTED,
279 /* NX1.0(3,256), NX1.1(5,256). Generic hardware error. */
280 OFPERR_NXFMFC_HARDWARE,
282 /* NX1.0(3,257), NX1.1(5,257). A nonexistent table ID was specified in the
283 * "command" field of struct ofp_flow_mod, when the nxt_flow_mod_table_id
284 * extension is enabled. */
285 OFPERR_NXFMFC_BAD_TABLE_ID,
287 /* ## ---------------------- ## */
288 /* ## OFPET_GROUP_MOD_FAILED ## */
289 /* ## ---------------------- ## */
291 /* OF1.1(6). Problem modifying group entry. */
292 OFPERR_OFPET_GROUP_MOD_FAILED,
294 /* OF1.1(6,0). Group not added because a group ADD attempted to replace an
295 * already-present group. */
296 OFPERR_OFPGMFC_GROUP_EXISTS,
298 /* OF1.1(6,1). Group not added because Group specified is invalid. */
299 OFPERR_OFPGMFC_INVALID_GROUP,
301 /* OF1.1(6,2). Switch does not support unequal load sharing with select
303 OFPERR_OFPGMFC_WEIGHT_UNSUPPORTED,
305 /* OF1.1(6,3). The group table is full. */
306 OFPERR_OFPGMFC_OUT_OF_GROUPS,
308 /* OF1.1(6,4). The maximum number of action buckets for a group has been
310 OFPERR_OFPGMFC_OUT_OF_BUCKETS,
312 /* OF1.1(6,5). Switch does not support groups that forward to groups. */
313 OFPERR_OFPGMFC_CHAINING_UNSUPPORTED,
315 /* OF1.1(6,6). This group cannot watch the watch_port or watch_group
317 OFPERR_OFPGMFC_WATCH_UNSUPPORTED,
319 /* OF1.1(6,7). Group entry would cause a loop. */
322 /* OF1.1(6,8). Group not modified because a group MODIFY attempted to
323 * modify a non-existent group. */
324 OFPERR_OFPGMFC_UNKNOWN_GROUP,
326 /* ## --------------------- ## */
327 /* ## OFPET_PORT_MOD_FAILED ## */
328 /* ## --------------------- ## */
330 /* OF1.0(4), OF1.1(7). OFPT_PORT_MOD failed. */
331 OFPERR_OFPET_PORT_MOD_FAILED,
333 /* OF1.0(4,0), OF1.1(7,0). Specified port does not exist. */
334 OFPERR_OFPPMFC_BAD_PORT,
336 /* OF1.0(4,1), OF1.1(7,1). Specified hardware address does not match the
338 OFPERR_OFPPMFC_BAD_HW_ADDR,
340 /* OF1.1(7,2). Specified config is invalid. */
341 OFPERR_OFPPMFC_BAD_CONFIG,
343 /* OF1.1(7,3). Specified advertise is invalid. */
344 OFPERR_OFPPMFC_BAD_ADVERTISE,
346 /* ## ---------------------- ## */
347 /* ## OFPET_TABLE_MOD_FAILED ## */
348 /* ## ---------------------- ## */
350 /* OF1.1(8). Table mod request failed. */
351 OFPERR_OFPET_TABLE_MOD_FAILED,
353 /* OF1.1(8,0). Specified table does not exist. */
354 OFPERR_OFPTMFC_BAD_TABLE,
356 /* OF1.1(8,1). Specified config is invalid. */
357 OFPERR_OFPTMFC_BAD_CONFIG,
359 /* ## --------------------- ## */
360 /* ## OFPET_QUEUE_OP_FAILED ## */
361 /* ## --------------------- ## */
363 /* OF1.0(5), OF1.1(9). Queue operation failed. */
364 OFPERR_OFPET_QUEUE_OP_FAILED,
366 /* OF1.0(5,0), OF1.1(9,0). Invalid port (or port does not exist). */
367 OFPERR_OFPQOFC_BAD_PORT,
369 /* OF1.0(5,1), OF1.1(9,1). Queue does not exist. */
370 OFPERR_OFPQOFC_BAD_QUEUE,
372 /* OF1.0(5,2), OF1.1(9,2). Permissions error. */
373 OFPERR_OFPQOFC_EPERM,
375 /* ## -------------------------- ## */
376 /* ## OFPET_SWITCH_CONFIG_FAILED ## */
377 /* ## -------------------------- ## */
379 /* OF1.1(10). Switch config request failed. */
380 OFPERR_OFPET_SWITCH_CONFIG_FAILED,
382 /* OF1.1(10,0). Specified flags is invalid. */
383 OFPERR_OFPSCFC_BAD_FLAGS,
385 /* OF1.1(10,1). Specified len is invalid. */
386 OFPERR_OFPSCFC_BAD_LEN,
389 extern const struct ofperr_domain ofperr_of10;
390 extern const struct ofperr_domain ofperr_of11;
392 const struct ofperr_domain *ofperr_domain_from_version(uint8_t version);
394 bool ofperr_is_valid(enum ofperr);
395 bool ofperr_is_category(enum ofperr);
396 bool ofperr_is_nx_extension(enum ofperr);
397 bool ofperr_is_encodable(enum ofperr, const struct ofperr_domain *);
399 enum ofperr ofperr_decode(const struct ofperr_domain *,
400 uint16_t type, uint16_t code);
401 enum ofperr ofperr_decode_type(const struct ofperr_domain *, uint16_t type);
403 enum ofperr ofperr_decode_msg(const struct ofp_header *, size_t *payload_ofs);
404 struct ofpbuf *ofperr_encode_reply(enum ofperr, const struct ofp_header *);
405 struct ofpbuf *ofperr_encode_hello(enum ofperr, const struct ofperr_domain *,
408 const char *ofperr_get_name(enum ofperr);
409 const char *ofperr_get_description(enum ofperr);
411 void ofperr_format(struct ds *, enum ofperr);
412 const char *ofperr_to_string(enum ofperr);
414 #endif /* ofp-errors.h */