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 /* OF1.0+(0). Hello protocol failed. */
52 OFPERR_OFPET_HELLO_FAILED = OFPERR_OFS,
54 /* OF1.0+(0,0). No compatible version. */
55 OFPERR_OFPHFC_INCOMPATIBLE,
57 /* OF1.0+(0,1). Permissions error. */
60 /* ## ----------------- ## */
61 /* ## OFPET_BAD_REQUEST ## */
62 /* ## ----------------- ## */
64 /* OF1.0+(1). Request was not understood. */
65 OFPERR_OFPET_BAD_REQUEST,
67 /* OF1.0+(1,0). ofp_header.version not supported. */
68 OFPERR_OFPBRC_BAD_VERSION,
70 /* OF1.0+(1,1). ofp_header.type not supported. */
71 OFPERR_OFPBRC_BAD_TYPE,
73 /* OF1.0+(1,2). ofp_stats_msg.type not supported. */
74 OFPERR_OFPBRC_BAD_STAT,
76 /* OF1.0+(1,3). Vendor not supported (in ofp_vendor_header or
78 OFPERR_OFPBRC_BAD_VENDOR,
80 /* OF1.0+(1,4). Vendor subtype not supported. */
81 OFPERR_OFPBRC_BAD_SUBTYPE,
83 /* OF1.0+(1,5). Permissions error. */
86 /* OF1.0+(1,6). Wrong request length for type. */
87 OFPERR_OFPBRC_BAD_LEN,
89 /* OF1.0+(1,7). Specified buffer has already been used. */
90 OFPERR_OFPBRC_BUFFER_EMPTY,
92 /* OF1.0+(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 /* NX1.0+(1,256). Invalid NXM flow match. */
99 OFPERR_NXBRC_NXM_INVALID,
101 /* NX1.0+(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 /* NX1.0+(1,258). Invalid nxm_value. */
106 OFPERR_NXBRC_NXM_BAD_VALUE,
108 /* NX1.0+(1,259). Invalid nxm_mask. */
109 OFPERR_NXBRC_NXM_BAD_MASK,
111 /* NX1.0+(1,260). A prerequisite was not met. */
112 OFPERR_NXBRC_NXM_BAD_PREREQ,
114 /* NX1.0+(1,261). A given nxm_type was specified more than once. */
115 OFPERR_NXBRC_NXM_DUP_TYPE,
117 /* NX1.0+(1,512). A request specified a nonexistent table ID. */
118 OFPERR_NXBRC_BAD_TABLE_ID,
120 /* NX1.0+(1,513). NXT_ROLE_REQUEST specified an invalid role. */
121 OFPERR_NXBRC_BAD_ROLE,
123 /* NX1.0+(1,514). The in_port in an ofp_packet_out request is invalid. */
124 OFPERR_NXBRC_BAD_IN_PORT,
126 /* NX1.0+(1,515). Must-be-zero field had nonzero value. */
127 OFPERR_NXBRC_MUST_BE_ZERO,
129 /* NX1.0+(1,516). The reason in an ofp_port_status message is not
131 OFPERR_NXBRC_BAD_REASON,
133 /* ## ---------------- ## */
134 /* ## OFPET_BAD_ACTION ## */
135 /* ## ---------------- ## */
137 /* OF1.0+(2). Error in action description. */
138 OFPERR_OFPET_BAD_ACTION,
140 /* OF1.0+(2,0). Unknown action type. */
141 OFPERR_OFPBAC_BAD_TYPE,
143 /* OF1.0+(2,1). Length problem in actions. */
144 OFPERR_OFPBAC_BAD_LEN,
146 /* OF1.0+(2,2). Unknown experimenter id specified. */
147 OFPERR_OFPBAC_BAD_VENDOR,
149 /* OF1.0+(2,3). Unknown action type for experimenter id. */
150 OFPERR_OFPBAC_BAD_VENDOR_TYPE,
152 /* OF1.0+(2,4). Problem validating output port. */
153 OFPERR_OFPBAC_BAD_OUT_PORT,
155 /* OF1.0+(2,5). Bad action argument. */
156 OFPERR_OFPBAC_BAD_ARGUMENT,
158 /* OF1.0+(2,6). Permissions error. */
161 /* OF1.0+(2,7). Can't handle this many actions. */
162 OFPERR_OFPBAC_TOO_MANY,
164 /* OF1.0+(2,8). Problem validating output queue. */
165 OFPERR_OFPBAC_BAD_QUEUE,
167 /* OF1.1(2,9). Invalid group id in forward action. */
168 OFPERR_OFPBAC_BAD_OUT_GROUP,
170 /* OF1.1(2,10). Action can't apply for this match. */
171 OFPERR_OFPBAC_MATCH_INCONSISTENT,
173 /* OF1.1(2,11). Action order is unsupported for the action list in an
174 * Apply-Actions instruction */
175 OFPERR_OFPBAC_UNSUPPORTED_ORDER,
177 /* OF1.1(2,12). Actions uses an unsupported tag/encap. */
178 OFPERR_OFPBAC_BAD_TAG,
180 /* NX1.0+(2,256). Must-be-zero action argument had nonzero value. */
181 OFPERR_NXBAC_MUST_BE_ZERO,
183 /* ## --------------------- ## */
184 /* ## OFPET_BAD_INSTRUCTION ## */
185 /* ## --------------------- ## */
187 /* OF1.1(3). Error in instruction list. */
188 OFPERR_OFPET_BAD_INSTRUCTION,
190 /* OF1.1(3,0). Unknown instruction. */
191 OFPERR_OFPBIC_UNKNOWN_INST,
193 /* OF1.1(3,1). Switch or table does not support the instruction. */
194 OFPERR_OFPBIC_UNSUP_INST,
196 /* OF1.1(3,2). Invalid Table-ID specified. */
197 OFPERR_OFPBIC_BAD_TABLE_ID,
199 /* OF1.1(3,3). Metadata value unsupported by datapath. */
200 OFPERR_OFPBIC_UNSUP_METADATA,
202 /* OF1.1(3,4). Metadata mask value unsupported by datapath. */
203 OFPERR_OFPBIC_UNSUP_METADATA_MASK,
205 /* OF1.1(3,5). Specific experimenter instruction unsupported. */
206 OFPERR_OFPBIC_UNSUP_EXP_INST,
208 /* ## --------------- ## */
209 /* ## OFPET_BAD_MATCH ## */
210 /* ## --------------- ## */
212 /* OF1.1(4). Error in match. */
213 OFPERR_OFPET_BAD_MATCH,
215 /* OF1.1(4,0). Unsupported match type specified by the match */
216 OFPERR_OFPBMC_BAD_TYPE,
218 /* OF1.1(4,1). Length problem in match. */
219 OFPERR_OFPBMC_BAD_LEN,
221 /* OF1.1(4,2). Match uses an unsupported tag/encap. */
222 OFPERR_OFPBMC_BAD_TAG,
224 /* OF1.1(4,3). Unsupported datalink addr mask - switch does not support
225 * arbitrary datalink address mask. */
226 OFPERR_OFPBMC_BAD_DL_ADDR_MASK,
228 /* OF1.1(4,4). Unsupported network addr mask - switch does not support
229 * arbitrary network address mask. */
230 OFPERR_OFPBMC_BAD_NW_ADDR_MASK,
232 /* OF1.1(4,5). Unsupported wildcard specified in the match. */
233 OFPERR_OFPBMC_BAD_WILDCARDS,
235 /* OF1.1(4,6). Unsupported field in the match. */
236 OFPERR_OFPBMC_BAD_FIELD,
238 /* OF1.1(4,7). Unsupported value in a match field. */
239 OFPERR_OFPBMC_BAD_VALUE,
241 /* ## --------------------- ## */
242 /* ## OFPET_FLOW_MOD_FAILED ## */
243 /* ## --------------------- ## */
245 /* OF1.0(3), OF1.1(5). Problem modifying flow entry. */
246 OFPERR_OFPET_FLOW_MOD_FAILED,
248 /* OF1.1(5,0). Unspecified error. */
249 OFPERR_OFPFMFC_UNKNOWN,
251 /* OF1.0(3,0). Flow not added because of full tables. */
252 OFPERR_OFPFMFC_ALL_TABLES_FULL,
254 /* OF1.1(5,1). Flow not added because table was full. */
255 OFPERR_OFPFMFC_TABLE_FULL,
257 /* OF1.1(5,2). Table does not exist */
258 OFPERR_OFPFMFC_BAD_TABLE_ID,
260 /* OF1.0(3,1), OF1.1(5,3). Attempted to add overlapping flow with
261 * CHECK_OVERLAP flag set. */
262 OFPERR_OFPFMFC_OVERLAP,
264 /* OF1.0(3,2), OF1.1(5,4). Permissions error. */
265 OFPERR_OFPFMFC_EPERM,
267 /* OF1.1(5,5). Flow not added because of unsupported idle/hard timeout. */
268 OFPERR_OFPFMFC_BAD_TIMEOUT,
270 /* OF1.0(3,3). Flow not added because of non-zero idle/hard timeout. */
271 OFPERR_OFPFMFC_BAD_EMERG_TIMEOUT,
273 /* OF1.0(3,4), OF1.1(5,6). Unsupported or unknown command. */
274 OFPERR_OFPFMFC_BAD_COMMAND,
276 /* OF1.0(3,5). Unsupported action list - cannot process in the order
278 OFPERR_OFPFMFC_UNSUPPORTED,
280 /* NX1.0(3,256), NX1.1(5,256). Generic hardware error. */
281 OFPERR_NXFMFC_HARDWARE,
283 /* NX1.0(3,257), NX1.1(5,257). A nonexistent table ID was specified in the
284 * "command" field of struct ofp_flow_mod, when the nxt_flow_mod_table_id
285 * extension is enabled. */
286 OFPERR_NXFMFC_BAD_TABLE_ID,
288 /* ## ---------------------- ## */
289 /* ## OFPET_GROUP_MOD_FAILED ## */
290 /* ## ---------------------- ## */
292 /* OF1.1(6). Problem modifying group entry. */
293 OFPERR_OFPET_GROUP_MOD_FAILED,
295 /* OF1.1(6,0). Group not added because a group ADD attempted to replace an
296 * already-present group. */
297 OFPERR_OFPGMFC_GROUP_EXISTS,
299 /* OF1.1(6,1). Group not added because Group specified is invalid. */
300 OFPERR_OFPGMFC_INVALID_GROUP,
302 /* OF1.1(6,2). Switch does not support unequal load sharing with select
304 OFPERR_OFPGMFC_WEIGHT_UNSUPPORTED,
306 /* OF1.1(6,3). The group table is full. */
307 OFPERR_OFPGMFC_OUT_OF_GROUPS,
309 /* OF1.1(6,4). The maximum number of action buckets for a group has been
311 OFPERR_OFPGMFC_OUT_OF_BUCKETS,
313 /* OF1.1(6,5). Switch does not support groups that forward to groups. */
314 OFPERR_OFPGMFC_CHAINING_UNSUPPORTED,
316 /* OF1.1(6,6). This group cannot watch the watch_port or watch_group
318 OFPERR_OFPGMFC_WATCH_UNSUPPORTED,
320 /* OF1.1(6,7). Group entry would cause a loop. */
323 /* OF1.1(6,8). Group not modified because a group MODIFY attempted to
324 * modify a non-existent group. */
325 OFPERR_OFPGMFC_UNKNOWN_GROUP,
327 /* ## --------------------- ## */
328 /* ## OFPET_PORT_MOD_FAILED ## */
329 /* ## --------------------- ## */
331 /* OF1.0(4), OF1.1(7). OFPT_PORT_MOD failed. */
332 OFPERR_OFPET_PORT_MOD_FAILED,
334 /* OF1.0(4,0), OF1.1(7,0). Specified port does not exist. */
335 OFPERR_OFPPMFC_BAD_PORT,
337 /* OF1.0(4,1), OF1.1(7,1). Specified hardware address does not match the
339 OFPERR_OFPPMFC_BAD_HW_ADDR,
341 /* OF1.1(7,2). Specified config is invalid. */
342 OFPERR_OFPPMFC_BAD_CONFIG,
344 /* OF1.1(7,3). Specified advertise is invalid. */
345 OFPERR_OFPPMFC_BAD_ADVERTISE,
347 /* ## ---------------------- ## */
348 /* ## OFPET_TABLE_MOD_FAILED ## */
349 /* ## ---------------------- ## */
351 /* OF1.1(8). Table mod request failed. */
352 OFPERR_OFPET_TABLE_MOD_FAILED,
354 /* OF1.1(8,0). Specified table does not exist. */
355 OFPERR_OFPTMFC_BAD_TABLE,
357 /* OF1.1(8,1). Specified config is invalid. */
358 OFPERR_OFPTMFC_BAD_CONFIG,
360 /* ## --------------------- ## */
361 /* ## OFPET_QUEUE_OP_FAILED ## */
362 /* ## --------------------- ## */
364 /* OF1.0(5), OF1.1(9). Queue operation failed. */
365 OFPERR_OFPET_QUEUE_OP_FAILED,
367 /* OF1.0(5,0), OF1.1(9,0). Invalid port (or port does not exist). */
368 OFPERR_OFPQOFC_BAD_PORT,
370 /* OF1.0(5,1), OF1.1(9,1). Queue does not exist. */
371 OFPERR_OFPQOFC_BAD_QUEUE,
373 /* OF1.0(5,2), OF1.1(9,2). Permissions error. */
374 OFPERR_OFPQOFC_EPERM,
376 /* ## -------------------------- ## */
377 /* ## OFPET_SWITCH_CONFIG_FAILED ## */
378 /* ## -------------------------- ## */
380 /* OF1.1(10). Switch config request failed. */
381 OFPERR_OFPET_SWITCH_CONFIG_FAILED,
383 /* OF1.1(10,0). Specified flags is invalid. */
384 OFPERR_OFPSCFC_BAD_FLAGS,
386 /* OF1.1(10,1). Specified len is invalid. */
387 OFPERR_OFPSCFC_BAD_LEN,
390 extern const struct ofperr_domain ofperr_of10;
391 extern const struct ofperr_domain ofperr_of11;
393 const struct ofperr_domain *ofperr_domain_from_version(uint8_t version);
395 bool ofperr_is_valid(enum ofperr);
396 bool ofperr_is_category(enum ofperr);
397 bool ofperr_is_nx_extension(enum ofperr);
398 bool ofperr_is_encodable(enum ofperr, const struct ofperr_domain *);
400 enum ofperr ofperr_decode(const struct ofperr_domain *,
401 uint16_t type, uint16_t code);
402 enum ofperr ofperr_decode_type(const struct ofperr_domain *, uint16_t type);
404 enum ofperr ofperr_decode_msg(const struct ofp_header *, size_t *payload_ofs);
405 struct ofpbuf *ofperr_encode_reply(enum ofperr, const struct ofp_header *);
406 struct ofpbuf *ofperr_encode_hello(enum ofperr, const struct ofperr_domain *,
409 const char *ofperr_get_name(enum ofperr);
410 const char *ofperr_get_description(enum ofperr);
412 void ofperr_format(struct ds *, enum ofperr);
413 const char *ofperr_to_string(enum ofperr);
415 #endif /* ofp-errors.h */