2 * Copyright (c) 2008, 2009, 2010, 2011 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 /* ## ---------------- ## */
127 /* ## OFPET_BAD_ACTION ## */
128 /* ## ---------------- ## */
130 /* OF(2). Error in action description. */
131 OFPERR_OFPET_BAD_ACTION,
133 /* OF(2,0). Unknown action type. */
134 OFPERR_OFPBAC_BAD_TYPE,
136 /* OF(2,1). Length problem in actions. */
137 OFPERR_OFPBAC_BAD_LEN,
139 /* OF(2,2). Unknown experimenter id specified. */
140 OFPERR_OFPBAC_BAD_VENDOR,
142 /* OF(2,3). Unknown action type for experimenter id. */
143 OFPERR_OFPBAC_BAD_VENDOR_TYPE,
145 /* OF(2,4). Problem validating output port. */
146 OFPERR_OFPBAC_BAD_OUT_PORT,
148 /* OF(2,5). Bad action argument. */
149 OFPERR_OFPBAC_BAD_ARGUMENT,
151 /* OF(2,6). Permissions error. */
154 /* OF(2,7). Can't handle this many actions. */
155 OFPERR_OFPBAC_TOO_MANY,
157 /* OF(2,8). Problem validating output queue. */
158 OFPERR_OFPBAC_BAD_QUEUE,
160 /* OF1.1(2,9). Invalid group id in forward action. */
161 OFPERR_OFPBAC_BAD_OUT_GROUP,
163 /* OF1.1(2,10). Action can't apply for this match. */
164 OFPERR_OFPBAC_MATCH_INCONSISTENT,
166 /* OF1.1(2,11). Action order is unsupported for the action list in an
167 * Apply-Actions instruction */
168 OFPERR_OFPBAC_UNSUPPORTED_ORDER,
170 /* OF1.1(2,12). Actions uses an unsupported tag/encap. */
171 OFPERR_OFPBAC_BAD_TAG,
173 /* ## --------------------- ## */
174 /* ## OFPET_BAD_INSTRUCTION ## */
175 /* ## --------------------- ## */
177 /* OF1.1(3). Error in instruction list. */
178 OFPERR_OFPET_BAD_INSTRUCTION,
180 /* OF1.1(3,0). Unknown instruction. */
181 OFPERR_OFPBIC_UNKNOWN_INST,
183 /* OF1.1(3,1). Switch or table does not support the instruction. */
184 OFPERR_OFPBIC_UNSUP_INST,
186 /* OF1.1(3,2). Invalid Table-ID specified. */
187 OFPERR_OFPBIC_BAD_TABLE_ID,
189 /* OF1.1(3,3). Metadata value unsupported by datapath. */
190 OFPERR_OFPBIC_UNSUP_METADATA,
192 /* OF1.1(3,4). Metadata mask value unsupported by datapath. */
193 OFPERR_OFPBIC_UNSUP_METADATA_MASK,
195 /* OF1.1(3,5). Specific experimenter instruction unsupported. */
196 OFPERR_OFPBIC_UNSUP_EXP_INST,
198 /* ## --------------- ## */
199 /* ## OFPET_BAD_MATCH ## */
200 /* ## --------------- ## */
202 /* OF1.1(4). Error in match. */
203 OFPERR_OFPET_BAD_MATCH,
205 /* OF1.1(4,0). Unsupported match type specified by the match */
206 OFPERR_OFPBMC_BAD_TYPE,
208 /* OF1.1(4,1). Length problem in match. */
209 OFPERR_OFPBMC_BAD_LEN,
211 /* OF1.1(4,2). Match uses an unsupported tag/encap. */
212 OFPERR_OFPBMC_BAD_TAG,
214 /* OF1.1(4,3). Unsupported datalink addr mask - switch does not support
215 * arbitrary datalink address mask. */
216 OFPERR_OFPBMC_BAD_DL_ADDR_MASK,
218 /* OF1.1(4,4). Unsupported network addr mask - switch does not support
219 * arbitrary network address mask. */
220 OFPERR_OFPBMC_BAD_NW_ADDR_MASK,
222 /* OF1.1(4,5). Unsupported wildcard specified in the match. */
223 OFPERR_OFPBMC_BAD_WILDCARDS,
225 /* OF1.1(4,6). Unsupported field in the match. */
226 OFPERR_OFPBMC_BAD_FIELD,
228 /* OF1.1(4,7). Unsupported value in a match field. */
229 OFPERR_OFPBMC_BAD_VALUE,
231 /* ## --------------------- ## */
232 /* ## OFPET_FLOW_MOD_FAILED ## */
233 /* ## --------------------- ## */
235 /* OF1.0(3), OF1.1(5). Problem modifying flow entry. */
236 OFPERR_OFPET_FLOW_MOD_FAILED,
238 /* OF1.1(5,0). Unspecified error. */
239 OFPERR_OFPFMFC_UNKNOWN,
241 /* OF1.0(3,0). Flow not added because of full tables. */
242 OFPERR_OFPFMFC_ALL_TABLES_FULL,
244 /* OF1.1(5,1). Flow not added because table was full. */
245 OFPERR_OFPFMFC_TABLE_FULL,
247 /* OF1.1(5,2). Table does not exist */
248 OFPERR_OFPFMFC_BAD_TABLE_ID,
250 /* OF1.0(3,1), OF1.1(5,3). Attempted to add overlapping flow with
251 * CHECK_OVERLAP flag set. */
252 OFPERR_OFPFMFC_OVERLAP,
254 /* OF1.0(3,2), OF1.1(5,4). Permissions error. */
255 OFPERR_OFPFMFC_EPERM,
257 /* OF1.1(5,5). Flow not added because of unsupported idle/hard timeout. */
258 OFPERR_OFPFMFC_BAD_TIMEOUT,
260 /* OF1.0(3,3). Flow not added because of non-zero idle/hard timeout. */
261 OFPERR_OFPFMFC_BAD_EMERG_TIMEOUT,
263 /* OF1.0(3,4), OF1.1(5,6). Unsupported or unknown command. */
264 OFPERR_OFPFMFC_BAD_COMMAND,
266 /* OF1.0(3,5). Unsupported action list - cannot process in the order
268 OFPERR_OFPFMFC_UNSUPPORTED,
270 /* NX1.0(3,256), NX1.1(5,256). Generic hardware error. */
271 OFPERR_NXFMFC_HARDWARE,
273 /* NX1.0(3,257), NX1.1(5,257). A nonexistent table ID was specified in the
274 * "command" field of struct ofp_flow_mod, when the nxt_flow_mod_table_id
275 * extension is enabled. */
276 OFPERR_NXFMFC_BAD_TABLE_ID,
278 /* ## ---------------------- ## */
279 /* ## OFPET_GROUP_MOD_FAILED ## */
280 /* ## ---------------------- ## */
282 /* OF1.1(6). Problem modifying group entry. */
283 OFPERR_OFPET_GROUP_MOD_FAILED,
285 /* OF1.1(6,0). Group not added because a group ADD attempted to replace an
286 * already-present group. */
287 OFPERR_OFPGMFC_GROUP_EXISTS,
289 /* OF1.1(6,1). Group not added because Group specified is invalid. */
290 OFPERR_OFPGMFC_INVALID_GROUP,
292 /* OF1.1(6,2). Switch does not support unequal load sharing with select
294 OFPERR_OFPGMFC_WEIGHT_UNSUPPORTED,
296 /* OF1.1(6,3). The group table is full. */
297 OFPERR_OFPGMFC_OUT_OF_GROUPS,
299 /* OF1.1(6,4). The maximum number of action buckets for a group has been
301 OFPERR_OFPGMFC_OUT_OF_BUCKETS,
303 /* OF1.1(6,5). Switch does not support groups that forward to groups. */
304 OFPERR_OFPGMFC_CHAINING_UNSUPPORTED,
306 /* OF1.1(6,6). This group cannot watch the watch_port or watch_group
308 OFPERR_OFPGMFC_WATCH_UNSUPPORTED,
310 /* OF1.1(6,7). Group entry would cause a loop. */
313 /* OF1.1(6,8). Group not modified because a group MODIFY attempted to
314 * modify a non-existent group. */
315 OFPERR_OFPGMFC_UNKNOWN_GROUP,
317 /* ## --------------------- ## */
318 /* ## OFPET_PORT_MOD_FAILED ## */
319 /* ## --------------------- ## */
321 /* OF1.0(4), OF1.1(7). OFPT_PORT_MOD failed. */
322 OFPERR_OFPET_PORT_MOD_FAILED,
324 /* OF1.0(4,0), OF1.1(7,0). Specified port does not exist. */
325 OFPERR_OFPPMFC_BAD_PORT,
327 /* OF1.0(4,1), OF1.1(7,1). Specified hardware address does not match the
329 OFPERR_OFPPMFC_BAD_HW_ADDR,
331 /* OF1.1(7,2). Specified config is invalid. */
332 OFPERR_OFPPMFC_BAD_CONFIG,
334 /* OF1.1(7,3). Specified advertise is invalid. */
335 OFPERR_OFPPMFC_BAD_ADVERTISE,
337 /* ## ---------------------- ## */
338 /* ## OFPET_TABLE_MOD_FAILED ## */
339 /* ## ---------------------- ## */
341 /* OF1.1(8). Table mod request failed. */
342 OFPERR_OFPET_TABLE_MOD_FAILED,
344 /* OF1.1(8,0). Specified table does not exist. */
345 OFPERR_OFPTMFC_BAD_TABLE,
347 /* OF1.1(8,1). Specified config is invalid. */
348 OFPERR_OFPTMFC_BAD_CONFIG,
350 /* ## --------------------- ## */
351 /* ## OFPET_QUEUE_OP_FAILED ## */
352 /* ## --------------------- ## */
354 /* OF1.0(5), OF1.1(9). Queue operation failed. */
355 OFPERR_OFPET_QUEUE_OP_FAILED,
357 /* OF1.0(5,0), OF1.1(9,0). Invalid port (or port does not exist). */
358 OFPERR_OFPQOFC_BAD_PORT,
360 /* OF1.0(5,1), OF1.1(9,1). Queue does not exist. */
361 OFPERR_OFPQOFC_BAD_QUEUE,
363 /* OF1.0(5,2), OF1.1(9,2). Permissions error. */
364 OFPERR_OFPQOFC_EPERM,
366 /* ## -------------------------- ## */
367 /* ## OFPET_SWITCH_CONFIG_FAILED ## */
368 /* ## -------------------------- ## */
370 /* OF1.1(10). Switch config request failed. */
371 OFPERR_OFPET_SWITCH_CONFIG_FAILED,
373 /* OF1.1(10,0). Specified flags is invalid. */
374 OFPERR_OFPSCFC_BAD_FLAGS,
376 /* OF1.1(10,1). Specified len is invalid. */
377 OFPERR_OFPSCFC_BAD_LEN,
380 extern const struct ofperr_domain ofperr_of10;
381 extern const struct ofperr_domain ofperr_of11;
383 const struct ofperr_domain *ofperr_domain_from_version(uint8_t version);
385 bool ofperr_is_valid(enum ofperr);
386 bool ofperr_is_category(enum ofperr);
387 bool ofperr_is_nx_extension(enum ofperr);
388 bool ofperr_is_encodable(enum ofperr, const struct ofperr_domain *);
390 enum ofperr ofperr_decode(const struct ofperr_domain *,
391 uint16_t type, uint16_t code);
392 enum ofperr ofperr_decode_type(const struct ofperr_domain *, uint16_t type);
394 enum ofperr ofperr_decode_msg(const struct ofp_header *, size_t *payload_ofs);
395 struct ofpbuf *ofperr_encode_reply(enum ofperr, const struct ofp_header *);
396 struct ofpbuf *ofperr_encode_hello(enum ofperr, const struct ofperr_domain *,
399 const char *ofperr_get_name(enum ofperr);
400 const char *ofperr_get_description(enum ofperr);
402 void ofperr_format(struct ds *, enum ofperr);
403 const char *ofperr_to_string(enum ofperr);
405 #endif /* ofp-errors.h */