netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / lib / ofp-errors.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
3  *
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:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef OFP_ERRORS_H
18 #define OFP_ERRORS_H 1
19
20 #include <stdbool.h>
21 #include <stddef.h>
22 #include <stdint.h>
23
24 #include "openflow/openflow.h"
25
26 struct ds;
27 struct ofpbuf;
28
29 /* Error codes.
30  *
31  * We embed system errno values and OpenFlow standard and vendor extension
32  * error codes into the positive range of "int":
33  *
34  *   - Errno values are assumed to use the range 1 through 2**30 - 1.
35  *
36  *     (C and POSIX say that errno values are positive.  We assume that they
37  *     are less than 2**29.  They are actually less than 65536 on at least
38  *     Linux, FreeBSD, OpenBSD, and Windows.)
39  *
40  *   - OpenFlow standard and vendor extension error codes use the range
41  *     starting at 2**30 (OFPERR_OFS).
42  *
43  * Zero and negative values are not used.
44  */
45
46 #define OFPERR_OFS (1 << 30)
47
48 /* OpenFlow error codes
49  * --------------------
50  *
51  * The comments below are parsed by the extract-ofp-errors program at build
52  * time and used to determine the mapping between "enum ofperr" constants and
53  * error type/code values used in the OpenFlow protocol:
54  *
55  *   - The first part of each comment specifies the vendor, OpenFlow versions,
56  *     type, and sometimes a code for each protocol that supports the error:
57  *
58  *         # The vendor is OF for standard OpenFlow error codes.  Otherwise it
59  *           is one of the *_VENDOR_ID codes defined in openflow-common.h.
60  *
61  *         # The version can specify a specific OpenFlow version, a version
62  *           range delimited by "-", or an open-ended range with "+".
63  *
64  *         # Standard OpenFlow errors have both a type and a code.  Extension
65  *           errors generally have only a type, no code.  There is one
66  *           exception: Nicira extension (NX) errors for OpenFlow 1.0 and 1.1
67  *           have both a type and a code.  (This means that the version
68  *           specification for NX errors may not include version 1.0 or 1.1 (or
69  *           both) along with version 1.2 or later, because the requirements
70  *           for those versions are different.)
71  *
72  *   - Additional text is a human-readable description of the meaning of each
73  *     error, used to explain the error to the user.  Any text enclosed in
74  *     square brackets is omitted; this can be used to explain rationale for
75  *     choice of error codes in the case where this is desirable.
76  *
77  *
78  * Expected duplications
79  * ---------------------
80  *
81  * Occasionally, in one version of OpenFlow a single named error can indicate
82  * two or more distinct errors, then a later version of OpenFlow splits those
83  * meanings into different error codes.  When that happens, both errors are
84  * assigned the same value in the earlier version.  That is ordinarily a
85  * mistake, so the build system reports an error.  When that happens, add the
86  * error message to the list of "Expected duplications" below to suppress the
87  * error.  In such a case, the named error defined earlier is how OVS
88  * interprets the earlier, merged form of the error.
89  *
90  * For example, OpenFlow 1.1 defined (3,5) as OFPBIC_UNSUP_EXP_INST, then
91  * OpenFlow 1.2 broke this error into OFPBIC_BAD_EXPERIMENTER as (3,5) and
92  * OFPBIC_BAD_EXT_TYPE as (3,6).  To allow the OVS code to report just a single
93  * error code, instead of protocol version dependent errors, this list of
94  * errors only lists the latter two errors, giving both of them the same code
95  * (3,5) for OpenFlow 1.1.  Then, when OVS serializes either error into
96  * OpenFlow 1.1, it uses the same code (3,5).  In the other direction, when OVS
97  * deserializes (3,5) from OpenFlow 1.1, it translates it into
98  * OFPBIC_BAD_EXPERIMENTER (because its definition precedes that of
99  * OFPBIC_BAD_EXT_TYPE below).  See the "encoding OFPBIC_* experimenter errors"
100  * and "decoding OFPBIC_* experimenter errors" tests in tests/ofp-errors.at for
101  * full details.
102  */
103 enum ofperr {
104 /* Expected duplications. */
105
106     /* Expected: 0x0,3,5 in OF1.1 means both OFPBIC_BAD_EXPERIMENTER and
107      * OFPBIC_BAD_EXP_TYPE. */
108
109     /* Expected: 0x0,1,5 in OF1.0 means both OFPBRC_EPERM and
110      * OFPBRC_IS_SLAVE. */
111
112     /* Expected: 0x0,1,5 in OF1.1 means both OFPBRC_EPERM and
113      * OFPBRC_IS_SLAVE. */
114
115 /* ## ------------------ ## */
116 /* ## OFPET_HELLO_FAILED ## */
117 /* ## ------------------ ## */
118
119     /* OF1.0+(0,0).  No compatible version. */
120     OFPERR_OFPHFC_INCOMPATIBLE = OFPERR_OFS,
121
122     /* OF1.0+(0,1).  Permissions error. */
123     OFPERR_OFPHFC_EPERM,
124
125 /* ## ----------------- ## */
126 /* ## OFPET_BAD_REQUEST ## */
127 /* ## ----------------- ## */
128
129     /* OF1.0+(1,0).  ofp_header.version not supported. */
130     OFPERR_OFPBRC_BAD_VERSION,
131
132     /* OF1.0+(1,1).  ofp_header.type not supported. */
133     OFPERR_OFPBRC_BAD_TYPE,
134
135     /* OF1.0+(1,2).  ofp_stats_msg.type not supported. */
136     OFPERR_OFPBRC_BAD_STAT,
137
138     /* OF1.0+(1,3).  Vendor not supported (in ofp_vendor_header or
139      * ofp_stats_msg). */
140     OFPERR_OFPBRC_BAD_VENDOR,
141
142     /* OF1.0+(1,4).  Vendor subtype not supported. */
143     OFPERR_OFPBRC_BAD_SUBTYPE,
144
145     /* OF1.0+(1,5).  Permissions error. */
146     OFPERR_OFPBRC_EPERM,
147
148     /* OF1.0+(1,6).  Wrong request length for type. */
149     OFPERR_OFPBRC_BAD_LEN,
150
151     /* OF1.0+(1,7).  Specified buffer has already been used. */
152     OFPERR_OFPBRC_BUFFER_EMPTY,
153
154     /* OF1.0+(1,8).  Specified buffer does not exist. */
155     OFPERR_OFPBRC_BUFFER_UNKNOWN,
156
157     /* NX1.0(1,512), OF1.1+(1,9).  Specified table-id invalid or does not exist.
158      * [ A non-standard error (1,512), formerly OFPERR_NXBRC_BAD_TABLE_ID,
159      *   is used for OpenFlow 1.0 as there seems to be no appropriate error
160      *   code defined the specification. ] */
161     OFPERR_OFPBRC_BAD_TABLE_ID,
162
163     /* OF1.0-1.1(1,5), OF1.2+(1,10).  Denied because controller is slave. */
164     OFPERR_OFPBRC_IS_SLAVE,
165
166     /* NX1.0-1.1(1,514), OF1.2+(1,11).  Invalid port.  [ A non-standard error
167      * (1,514), formerly OFPERR_NXBRC_BAD_IN_PORT is used for OpenFlow 1.0 and
168      * 1.1 as there seems to be no appropriate error code defined the
169      * specifications. ] */
170     OFPERR_OFPBRC_BAD_PORT,
171
172     /* OF1.2+(1,12).  Invalid packet in packet-out. */
173     OFPERR_OFPBRC_BAD_PACKET,
174
175     /* OF1.3+(1,13).  Multipart request overflowed the assigned buffer. */
176     OFPERR_OFPBRC_MULTIPART_BUFFER_OVERFLOW,
177
178     /* NX1.0-1.1(1,256), NX1.2+(2).  Invalid NXM flow match. */
179     OFPERR_NXBRC_NXM_INVALID,
180
181     /* NX1.0-1.1(1,257), NX1.2+(3).  The nxm_type, or nxm_type taken in
182      * combination with nxm_hasmask or nxm_length or both, is invalid or not
183      * implemented. */
184     OFPERR_NXBRC_NXM_BAD_TYPE,
185
186     /* NX1.0-1.1(1,515), NX1.2+(4).  Must-be-zero field had nonzero value. */
187     OFPERR_NXBRC_MUST_BE_ZERO,
188
189     /* NX1.0-1.1(1,516), NX1.2+(5).  The reason in an ofp_port_status message
190      * is not valid. */
191     OFPERR_NXBRC_BAD_REASON,
192
193     /* NX1.0-1.1(1,520), NX1.2+(9).  The 'event' in an NXST_FLOW_MONITOR reply
194      * does not specify one of the NXFME_ABBREV, NXFME_ADD, NXFME_DELETE, or
195      * NXFME_MODIFY. */
196     OFPERR_NXBRC_FM_BAD_EVENT,
197
198     /* NX1.0-1.1(1,521), NX1.2+(10).  The error that occurred cannot be
199      * represented in this OpenFlow version. */
200     OFPERR_NXBRC_UNENCODABLE_ERROR,
201
202 /* ## ---------------- ## */
203 /* ## OFPET_BAD_ACTION ## */
204 /* ## ---------------- ## */
205
206     /* OF1.0+(2,0).  Unknown action type. */
207     OFPERR_OFPBAC_BAD_TYPE,
208
209     /* OF1.0+(2,1).  Length problem in actions. */
210     OFPERR_OFPBAC_BAD_LEN,
211
212     /* OF1.0+(2,2).  Unknown experimenter id specified. */
213     OFPERR_OFPBAC_BAD_VENDOR,
214
215     /* OF1.0+(2,3).  Unknown action type for experimenter id. */
216     OFPERR_OFPBAC_BAD_VENDOR_TYPE,
217
218     /* OF1.0+(2,4).  Problem validating output port. */
219     OFPERR_OFPBAC_BAD_OUT_PORT,
220
221     /* OF1.0+(2,5).  Bad action argument. */
222     OFPERR_OFPBAC_BAD_ARGUMENT,
223
224     /* OF1.0+(2,6).  Permissions error. */
225     OFPERR_OFPBAC_EPERM,
226
227     /* OF1.0+(2,7).  Can't handle this many actions. */
228     OFPERR_OFPBAC_TOO_MANY,
229
230     /* OF1.0+(2,8).  Problem validating output queue. */
231     OFPERR_OFPBAC_BAD_QUEUE,
232
233     /* OF1.1+(2,9).  Invalid group id in forward action. */
234     OFPERR_OFPBAC_BAD_OUT_GROUP,
235
236     /* NX1.0(1,522), OF1.1+(2,10).  Action can't apply for this match or a
237      * prerequisite for use of this field is unmet. */
238     OFPERR_OFPBAC_MATCH_INCONSISTENT,
239
240     /* OF1.1+(2,11).  Action order is unsupported for the action list in an
241      * Apply-Actions instruction */
242     OFPERR_OFPBAC_UNSUPPORTED_ORDER,
243
244     /* OF1.1+(2,12).  Actions uses an unsupported tag/encap. */
245     OFPERR_OFPBAC_BAD_TAG,
246
247     /* NX1.0-1.1(1,523), OF1.2+(2,13).  Action uses unknown or unsupported OXM
248      * or NXM field. */
249     OFPERR_OFPBAC_BAD_SET_TYPE,
250
251     /* NX1.0-1.1(1,524), OF1.2+(2,14).  Action references past the end of an
252      * OXM or NXM field, or uses a length of zero. */
253     OFPERR_OFPBAC_BAD_SET_LEN,
254
255     /* NX1.0-1.1(1,525), OF1.2+(2,15).  Action sets a field to an invalid or
256      * unsupported value, or modifies a read-only field. */
257     OFPERR_OFPBAC_BAD_SET_ARGUMENT,
258
259     /* ONF1.3-1.4(4250), OF1.5+(2,16).  Field in Set-Field action has Has-Mask
260      * bit set to 1. */
261     OFPERR_OFPBAC_BAD_SET_MASK,
262
263     /* NX1.0-1.1(2,256), NX1.2+(11).  Must-be-zero action argument had nonzero
264      * value. */
265     OFPERR_NXBAC_MUST_BE_ZERO,
266
267     /* NX1.0-1.1(2,526), NX1.2+(15).  Conjunction action must be only action
268      * present.  conjunction(id, k/n) must satisfy 1 <= k <= n and 2 <= n <=
269      * 64. */
270     OFPERR_NXBAC_BAD_CONJUNCTION,
271
272 /* ## --------------------- ## */
273 /* ## OFPET_BAD_INSTRUCTION ## */
274 /* ## --------------------- ## */
275
276     /* OF1.1+(3,0).  Unknown instruction. */
277     OFPERR_OFPBIC_UNKNOWN_INST,
278
279     /* NX1.0(2,257), OF1.1+(3,1).  Switch or table does not support the
280      * instruction. */
281     OFPERR_OFPBIC_UNSUP_INST,
282
283     /* OF1.1+(3,2).  Invalid Table-ID specified. */
284     OFPERR_OFPBIC_BAD_TABLE_ID,
285
286     /* OF1.1+(3,3).  Metadata value unsupported by datapath. */
287     OFPERR_OFPBIC_UNSUP_METADATA,
288
289     /* OF1.1+(3,4).  Metadata mask value unsupported by datapath. */
290     OFPERR_OFPBIC_UNSUP_METADATA_MASK,
291
292     /* OF1.1+(3,5).  Unknown experimenter id specified. */
293     OFPERR_OFPBIC_BAD_EXPERIMENTER,
294
295     /* OF1.1(3,5), OF1.2+(3,6).  Unknown instruction for experimenter id. */
296     OFPERR_OFPBIC_BAD_EXP_TYPE,
297
298     /* OF1.2+(3,7).  Length problem in instructions. */
299     OFPERR_OFPBIC_BAD_LEN,
300
301     /* OF1.2+(3,8).  Permissions error. */
302     OFPERR_OFPBIC_EPERM,
303
304     /* NX1.1(3,256), ONF1.2-1.3(2600), OF1.4+(3,9).  Duplicate instruction. */
305     OFPERR_OFPBIC_DUP_INST,
306
307 /* ## --------------- ## */
308 /* ## OFPET_BAD_MATCH ## */
309 /* ## --------------- ## */
310
311     /* OF1.1+(4,0).  Unsupported match type specified by the match */
312     OFPERR_OFPBMC_BAD_TYPE,
313
314     /* OF1.1+(4,1).  Length problem in match. */
315     OFPERR_OFPBMC_BAD_LEN,
316
317     /* OF1.1+(4,2).  Match uses an unsupported tag/encap. */
318     OFPERR_OFPBMC_BAD_TAG,
319
320     /* OF1.1+(4,3).  Unsupported datalink addr mask - switch does not support
321      * arbitrary datalink address mask. */
322     OFPERR_OFPBMC_BAD_DL_ADDR_MASK,
323
324     /* OF1.1+(4,4).  Unsupported network addr mask - switch does not support
325      * arbitrary network address mask. */
326     OFPERR_OFPBMC_BAD_NW_ADDR_MASK,
327
328     /* NX1.0(1,262), OF1.1+(4,5).  Unsupported wildcard specified in the
329      * match. */
330     OFPERR_OFPBMC_BAD_WILDCARDS,
331
332     /* NX1.0(0,263), OF1.1+(4,6).  Unsupported field in the match. */
333     OFPERR_OFPBMC_BAD_FIELD,
334
335     /* NX1.0(1,258), OF1.1+(4,7).  Unsupported value in a match
336      * field. */
337     OFPERR_OFPBMC_BAD_VALUE,
338
339     /* NX1.0-1.1(1,259), OF1.2+(4,8).  Unsupported mask specified in the match,
340      * field is not dl-address or nw-address. */
341     OFPERR_OFPBMC_BAD_MASK,
342
343     /* NX1.0-1.1(1,260), OF1.2+(4,9).  A prerequisite was not met. */
344     OFPERR_OFPBMC_BAD_PREREQ,
345
346     /* NX1.0-1.1(1,261), OF1.2+(4,10).  A field type was duplicated. */
347     OFPERR_OFPBMC_DUP_FIELD,
348
349     /* OF1.2+(4,11).  Permissions error. */
350     OFPERR_OFPBMC_EPERM,
351
352 /* ## --------------------- ## */
353 /* ## OFPET_FLOW_MOD_FAILED ## */
354 /* ## --------------------- ## */
355
356     /* OF1.1+(5,0).  Unspecified error. */
357     OFPERR_OFPFMFC_UNKNOWN,
358
359     /* OF1.0(3,0), OF1.1+(5,1).  Flow not added because of full table(s). */
360     OFPERR_OFPFMFC_TABLE_FULL,
361
362     /* OF1.1+(5,2).  Table does not exist */
363     OFPERR_OFPFMFC_BAD_TABLE_ID,
364
365     /* OF1.0(3,1), OF1.1+(5,3).  Attempted to add overlapping flow with
366      * CHECK_OVERLAP flag set. */
367     OFPERR_OFPFMFC_OVERLAP,
368
369     /* OF1.0(3,2), OF1.1+(5,4).  Permissions error. */
370     OFPERR_OFPFMFC_EPERM,
371
372     /* OF1.1+(5,5).  Flow not added because of unsupported idle/hard
373      * timeout. */
374     OFPERR_OFPFMFC_BAD_TIMEOUT,
375
376     /* OF1.0(3,3).  Flow not added because of non-zero idle/hard timeout. */
377     OFPERR_OFPFMFC_BAD_EMERG_TIMEOUT,
378
379     /* OF1.0(3,4), OF1.1+(5,6).  Unsupported or unknown command. */
380     OFPERR_OFPFMFC_BAD_COMMAND,
381
382     /* NX1.0(3,258), NX1.1(5,258), OF1.2+(5,7).  Unsupported or unknown
383      * flags. */
384     OFPERR_OFPFMFC_BAD_FLAGS,
385
386     /* OF1.0(3,5).  Unsupported action list - cannot process in the order
387      * specified. */
388     OFPERR_OFPFMFC_UNSUPPORTED,
389
390     /* NX1.0-1.1(5,256), NX1.2+(12).  Generic hardware error. */
391     OFPERR_NXFMFC_HARDWARE,
392
393     /* NX1.0-1.1(5,257), NX1.2+(13).  A nonexistent table ID was specified in
394      * the "command" field of struct ofp_flow_mod, when the
395      * nxt_flow_mod_table_id extension is enabled. */
396     OFPERR_NXFMFC_BAD_TABLE_ID,
397
398 /* ## ---------------------- ## */
399 /* ## OFPET_GROUP_MOD_FAILED ## */
400 /* ## ---------------------- ## */
401
402     /* OF1.1+(6,0).  Group not added because a group ADD attempted to replace
403      * an already-present group. */
404     OFPERR_OFPGMFC_GROUP_EXISTS,
405
406     /* OF1.1+(6,1).  Group not added because Group specified is invalid. */
407     OFPERR_OFPGMFC_INVALID_GROUP,
408
409     /* OF1.1+(6,2).  Switch does not support unequal load sharing with select
410      * groups. */
411     OFPERR_OFPGMFC_WEIGHT_UNSUPPORTED,
412
413     /* OF1.1+(6,3).  The group table is full. */
414     OFPERR_OFPGMFC_OUT_OF_GROUPS,
415
416     /* OF1.1+(6,4).  The maximum number of action buckets for a group has been
417      * exceeded. */
418     OFPERR_OFPGMFC_OUT_OF_BUCKETS,
419
420     /* OF1.1+(6,5).  Switch does not support groups that forward to groups. */
421     OFPERR_OFPGMFC_CHAINING_UNSUPPORTED,
422
423     /* OF1.1+(6,6).  This group cannot watch the watch_port or watch_group
424      * specified. */
425     OFPERR_OFPGMFC_WATCH_UNSUPPORTED,
426
427     /* OF1.1+(6,7).  Group entry would cause a loop. */
428     OFPERR_OFPGMFC_LOOP,
429
430     /* OF1.1+(6,8).  Group not modified because a group MODIFY attempted to
431      * modify a non-existent group. */
432     OFPERR_OFPGMFC_UNKNOWN_GROUP,
433
434     /* OF1.2+(6,9).  Group not deleted because another
435                     group is forwarding to it. */
436     OFPERR_OFPGMFC_CHAINED_GROUP,
437
438     /* OF1.2+(6,10).  Unsupported or unknown group type. */
439     OFPERR_OFPGMFC_BAD_TYPE,
440
441     /* OF1.2+(6,11).  Unsupported or unknown command. */
442     OFPERR_OFPGMFC_BAD_COMMAND,
443
444     /* OF1.2+(6,12).  Error in bucket. */
445     OFPERR_OFPGMFC_BAD_BUCKET,
446
447     /* OF1.2+(6,13).  Error in watch port/group. */
448     OFPERR_OFPGMFC_BAD_WATCH,
449
450     /* OF1.2+(6,14).  Permissions error. */
451     OFPERR_OFPGMFC_EPERM,
452
453     /* OF1.5+(6,15).  Invalid bucket identifier used in
454      * INSERT BUCKET or REMOVE BUCKET command. */
455     OFPERR_OFPGMFC_UNKNOWN_BUCKET,
456
457     /* OF1.5+(6,16).  Can't insert bucket because a bucket
458      * already exist with that bucket-id. */
459     OFPERR_OFPGMFC_BUCKET_EXISTS,
460
461 /* ## --------------------- ## */
462 /* ## OFPET_PORT_MOD_FAILED ## */
463 /* ## --------------------- ## */
464
465     /* OF1.0(4,0), OF1.1+(7,0).  Specified port does not exist. */
466     OFPERR_OFPPMFC_BAD_PORT,
467
468     /* OF1.0(4,1), OF1.1+(7,1).  Specified hardware address does not match the
469      * port number. */
470     OFPERR_OFPPMFC_BAD_HW_ADDR,
471
472     /* OF1.1+(7,2).  Specified config is invalid. */
473     OFPERR_OFPPMFC_BAD_CONFIG,
474
475     /* OF1.1+(7,3).  Specified advertise is invalid. */
476     OFPERR_OFPPMFC_BAD_ADVERTISE,
477
478     /* OF1.2+(7,4).  Permissions error. */
479     OFPERR_OFPPMFC_EPERM,
480
481 /* ## ---------------------- ## */
482 /* ## OFPET_TABLE_MOD_FAILED ## */
483 /* ## ---------------------- ## */
484
485     /* OF1.1+(8,0).  Specified table does not exist. */
486     OFPERR_OFPTMFC_BAD_TABLE,
487
488     /* OF1.1+(8,1).  Specified config is invalid. */
489     OFPERR_OFPTMFC_BAD_CONFIG,
490
491     /* OF1.2+(8,2).  Permissions error. */
492     OFPERR_OFPTMFC_EPERM,
493
494 /* ## --------------------- ## */
495 /* ## OFPET_QUEUE_OP_FAILED ## */
496 /* ## --------------------- ## */
497
498     /* OF1.0(5,0), OF1.1+(9,0).  Invalid port (or port does not exist). */
499     OFPERR_OFPQOFC_BAD_PORT,
500
501     /* OF1.0(5,1), OF1.1+(9,1).  Queue does not exist. */
502     OFPERR_OFPQOFC_BAD_QUEUE,
503
504     /* OF1.0(5,2), OF1.1+(9,2).  Permissions error. */
505     OFPERR_OFPQOFC_EPERM,
506
507     /* NX1.4+(23).  System error retrieving queue details. */
508     OFPERR_NXQOFC_QUEUE_ERROR,
509
510 /* ## -------------------------- ## */
511 /* ## OFPET_SWITCH_CONFIG_FAILED ## */
512 /* ## -------------------------- ## */
513
514     /* OF1.1+(10,0).  Specified flags is invalid. */
515     OFPERR_OFPSCFC_BAD_FLAGS,
516
517     /* OF1.1+(10,1).  Specified len is invalid. */
518     OFPERR_OFPSCFC_BAD_LEN,
519
520     /* OF1.2+(10,2).  Permissions error. */
521     OFPERR_OFPSCFC_EPERM,
522
523 /* ## ------------------------- ## */
524 /* ## OFPET_ROLE_REQUEST_FAILED ## */
525 /* ## ------------------------- ## */
526
527     /* OF1.2+(11,0).  Stale Message: old generation_id. */
528     OFPERR_OFPRRFC_STALE,
529
530     /* OF1.2+(11,1).  Controller role change unsupported. */
531     OFPERR_OFPRRFC_UNSUP,
532
533     /* NX1.0-1.1(1,513), OF1.2+(11,2).  Invalid role. */
534     OFPERR_OFPRRFC_BAD_ROLE,
535
536 /* ## ---------------------- ## */
537 /* ## OFPET_METER_MOD_FAILED ## */
538 /* ## ---------------------- ## */
539
540     /* OF1.3+(12,0).  Unspecified error. */
541     OFPERR_OFPMMFC_UNKNOWN,
542
543     /* OF1.3+(12,1).  Meter not added because a Meter ADD attempted to
544      * replace an existing Meter. */
545     OFPERR_OFPMMFC_METER_EXISTS,
546
547     /* OF1.3+(12,2).  Meter not added because Meter specified is invalid. */
548     OFPERR_OFPMMFC_INVALID_METER,
549
550     /* OF1.3+(12,3).  Meter not modified because a Meter MODIFY attempted
551      * to modify a non-existent Meter. */
552     OFPERR_OFPMMFC_UNKNOWN_METER,
553
554     /* OF1.3+(12,4).  Unsupported or unknown command. */
555     OFPERR_OFPMMFC_BAD_COMMAND,
556
557     /* OF1.3+(12,5).  Flag configuration unsupported. */
558     OFPERR_OFPMMFC_BAD_FLAGS,
559
560     /* OF1.3+(12,6).  Rate unsupported. */
561     OFPERR_OFPMMFC_BAD_RATE,
562
563     /* OF1.3+(12,7).  Burst size unsupported. */
564     OFPERR_OFPMMFC_BAD_BURST,
565
566     /* OF1.3+(12,8).  Band unsupported. */
567     OFPERR_OFPMMFC_BAD_BAND,
568
569     /* OF1.3+(12,9).  Band value unsupported. */
570     OFPERR_OFPMMFC_BAD_BAND_VALUE,
571
572     /* OF1.3+(12,10).  No more meters available. */
573     OFPERR_OFPMMFC_OUT_OF_METERS,
574
575     /* OF1.3+(12,11).  The maximum number of properties for a meter has
576      * been exceeded. */
577     OFPERR_OFPMMFC_OUT_OF_BANDS,
578
579 /* ## --------------------------- ## */
580 /* ## OFPET_TABLE_FEATURES_FAILED ## */
581 /* ## --------------------------- ## */
582
583     /* OF1.3+(13,0).  Specified table does not exist. */
584     OFPERR_OFPTFFC_BAD_TABLE,
585
586     /* OF1.3+(13,1).  Invalid metadata mask. */
587     OFPERR_OFPTFFC_BAD_METADATA,
588
589     /* OF1.3+(13,5).  Permissions error. */
590     OFPERR_OFPTFFC_EPERM,
591
592 /* ## ------------------ ## */
593 /* ## OFPET_BAD_PROPERTY ## */
594 /* ## ------------------ ## */
595
596     /* NX1.0-1.1(13,2), NX1.2(25), OF1.3(13,2), OF1.4+(14,0).  Unknown property
597      * type.
598      *
599      * [Known as OFPTFFC_BAD_TYPE in OF1.3.] */
600     OFPERR_OFPBPC_BAD_TYPE,
601
602     /* NX1.0-1.1(13,3), NX1.2(26), OF1.3(13,3), OF1.4+(14,1).  Length problem
603      * in property.
604      *
605      * [Known as OFPTFFC_BAD_LEN in OF1.3.] */
606     OFPERR_OFPBPC_BAD_LEN,
607
608     /* NX1.0-1.1(13,4), NX1.2(27), OF1.3(13,4), OF1.4+(14,2).  Unsupported
609      * property value.
610      *
611      * [Known as OFPTFFC_BAD_ARGUMENT in OF1.3.] */
612     OFPERR_OFPBPC_BAD_VALUE,
613
614     /* NX1.0-1.1(14,3), NX1.2(28), ONF1.3(4443), OF1.4+(14,3).  Can't handle
615      * this many properties. */
616     OFPERR_OFPBPC_TOO_MANY,
617
618     /* NX1.0-1.1(14,4), NX1.2(29), ONF1.3(4444), OF1.4+(14,4).  A property type
619      * was duplicated. */
620     OFPERR_OFPBPC_DUP_TYPE,
621
622     /* NX1.0-1.1(14,5), NX1.2(30), ONF1.3(4445), OF1.4+(14,5).  Unknown
623      * experimenter id specified. */
624     OFPERR_OFPBPC_BAD_EXPERIMENTER,
625
626     /* NX1.0-1.1(14,6), NX1.2(31), ONF1.3(4446), OF1.4+(14,6).  Unknown
627      * exp_type for experimenter id. */
628     OFPERR_OFPBPC_BAD_EXP_TYPE,
629
630     /* NX1.0-1.1(14,7), NX1.2(32), ONF1.3(4447), OF1.4+(14,7).  Unknown value
631      * for experimenter id. */
632     OFPERR_OFPBPC_BAD_EXP_VALUE,
633
634     /* NX1.0-1.1(14,8), NX1.2(33), ONF1.3(4448), OF1.4+(14,8).  Permissions
635      * error. */
636     OFPERR_OFPBPC_EPERM,
637
638 /* ## -------------------------- ## */
639 /* ## OFPET_ASYNC_CONFIG_FAILED  ## */
640 /* ## -------------------------- ## */
641
642     /* OF1.4+(15,0).  One mask is invalid. */
643     OFPERR_OFPACFC_INVALID,
644
645     /* OF1.4+(15,1).  Requested configuration not supported. */
646     OFPERR_OFPACFC_UNSUPPORTED,
647
648     /* OF1.4+(15,2).  Permissions error. */
649     OFPERR_OFPACFC_EPERM,
650
651 /* ## -------------------- ## */
652 /* ## OFPET_BUNDLE_FAILED  ## */
653 /* ## -------------------- ## */
654
655     /* ONF1.3(2300), OF1.4+(17,0).  Unspecified error. */
656     OFPERR_OFPBFC_UNKNOWN,
657
658     /* ONF1.3(2301), OF1.4+(17,1).  Permissions error. */
659     OFPERR_OFPBFC_EPERM,
660
661     /* ONF1.3(2302), OF1.4+(17,2).  Bundle ID doesn't exist. */
662     OFPERR_OFPBFC_BAD_ID,
663
664     /* ONF1.3(2303), OF1.4+(17,3).  Bundle ID already exists. */
665     OFPERR_OFPBFC_BUNDLE_EXIST,
666
667     /* ONF1.3(2304), OF1.4+(17,4).  Bundle ID is closed. */
668     OFPERR_OFPBFC_BUNDLE_CLOSED,
669
670     /* ONF1.3(2305), OF1.4+(17,5).  Too many bundle IDs. */
671     OFPERR_OFPBFC_OUT_OF_BUNDLES,
672
673     /* ONF1.3(2306), OF1.4+(17,6).  Unsupported of unknown message control
674      * type. */
675     OFPERR_OFPBFC_BAD_TYPE,
676
677     /* ONF1.3(2307), OF1.4+(17,7).  Unsupported, unknown, or inconsistent
678      * flags. */
679     OFPERR_OFPBFC_BAD_FLAGS,
680
681     /* ONF1.3(2308), OF1.4+(17,8).  Length problem in included message. */
682     OFPERR_OFPBFC_MSG_BAD_LEN,
683
684     /* ONF1.3(2309), OF1.4+(17,9).  Inconsistent or duplicate XID. */
685     OFPERR_OFPBFC_MSG_BAD_XID,
686
687     /* ONF1.3(2310), OF1.4+(17,10).  Unsupported message in this bundle. */
688     OFPERR_OFPBFC_MSG_UNSUP,
689
690     /* ONF1.3(2311), OF1.4+(17,11).  Unsupported message combination in this
691      * bundle. */
692     OFPERR_OFPBFC_MSG_CONFLICT,
693
694     /* ONF1.3(2312), OF1.4+(17,12).  Cant handle this many messages in
695      * bundle. */
696     OFPERR_OFPBFC_MSG_TOO_MANY,
697
698     /* ONF1.3(2313), OF1.4+(17,13).  One message in bundle failed. */
699     OFPERR_OFPBFC_MSG_FAILED,
700
701     /* ONF1.3(2314), OF1.4+(17,14).  Bundle is taking too long. */
702     OFPERR_OFPBFC_TIMEOUT,
703
704     /* ONF1.3(2315), OF1.4+(17,15).  Bundle is locking the resource. */
705     OFPERR_OFPBFC_BUNDLE_IN_PROGRESS,
706
707     /* NX1.3+(22).  In an OFPT_BUNDLE_ADD_MESSAGE, the OpenFlow version in the
708      * inner and outer messages differ. */
709     OFPERR_NXBFC_BAD_VERSION,
710
711 /* ## ------------------------- ## */
712 /* ## OFPET_FLOW_MONITOR_FAILED ## */
713 /* ## ------------------------- ## */
714
715     /* OF1.4+(16,0).  Unspecified error. */
716     OFPERR_OFPMOFC_UNKNOWN,
717
718     /* NX1.0-1.1(1,517), NX1.2-1.3(6), OF1.4+(16,1).  Monitor not added
719      * because a Monitor ADD attempted to replace an existing Monitor. */
720     OFPERR_OFPMOFC_MONITOR_EXISTS,
721
722     /* OF1.4+(16,2).  Monitor not added because
723      * Monitor specified is invalid. */
724     OFPERR_OFPMOFC_INVALID_MONITOR,
725
726     /* NX1.0-1.1(1,519), NX1.2-1.3(8), OF1.4+(16,3).  Monitor not modified
727      * because a Monitor MODIFY attempted to modify a non-existent Monitor. */
728     OFPERR_OFPMOFC_UNKNOWN_MONITOR,
729
730     /* OF1.4+(16,4).  Unsupported or unknown command. */
731     OFPERR_OFPMOFC_BAD_COMMAND,
732
733     /* NX1.0-1.1(1,518), NX1.2-1.3(7), OF1.4+(16,5).  Flag configuration
734      * unsupported. */
735     OFPERR_OFPMOFC_BAD_FLAGS,
736
737     /* OF1.4+(16,6).  Specified table does not exist. */
738     OFPERR_OFPMOFC_BAD_TABLE_ID,
739
740     /* OF1.4+(16,7).  Error in output port/group. */
741     OFPERR_OFPMOFC_BAD_OUT,
742
743 /* ## ----------------------------- ## */
744 /* ## OFPET_TLV_TABLE_MOD_FAILED ## */
745 /* ## ----------------------------- ## */
746
747     /* NX1.0-1.1(1,527), NX1.2+(16).  The TLV table mod command is not
748      * recognized as a valid operation. */
749     OFPERR_NXTTMFC_BAD_COMMAND,
750
751     /* NX1.0-1.1(1,528), NX1.2+(17).  The option length is not a valid
752      * option size for TLVs. */
753     OFPERR_NXTTMFC_BAD_OPT_LEN,
754
755     /* NX1.0-1.1(1,529), NX1.2+(18).  The field index is out of range for
756      * the supported NX_TUN_METADATA<n> match. */
757     OFPERR_NXTTMFC_BAD_FIELD_IDX,
758
759     /* NX1.0-1.1(1,530), NX1.2+(19).  The total set of configured options
760      * exceeds the maximum supported by the switch. */
761     OFPERR_NXTTMFC_TABLE_FULL,
762
763     /* NX1.0-1.1(1,531), NX1.2+(20).  The controller issued an NXTTMC_ADD
764      * command for a field index that is already mapped. */
765     OFPERR_NXTTMFC_ALREADY_MAPPED,
766
767     /* NX1.0-1.1(1,532), NX1.2+(21).  The option TLV that is attempting
768      * to be mapped is the same as one assigned to a different field. */
769     OFPERR_NXTTMFC_DUP_ENTRY,
770
771 /* ## ---------- ## */
772 /* ## NXT_RESUME ## */
773 /* ## ---------- ## */
774
775     /* NX1.0-1.1(1,533), NX1.2+(34).  This datapath doesn't support
776      * NXT_RESUME. */
777     OFPERR_NXR_NOT_SUPPORTED,
778
779     /* NX1.0-1.1(1,534), NX1.2+(35).  Continuation is stale: Open vSwitch
780      * process has been restarted or bridge has been destroyed since
781      * continuation was generated, or continuation was not generated by this
782      * Open vSwitch instance. */
783     OFPERR_NXR_STALE,
784 };
785
786 const char *ofperr_domain_get_name(enum ofp_version);
787
788 bool ofperr_is_valid(enum ofperr);
789
790 enum ofperr ofperr_from_name(const char *);
791
792 enum ofperr ofperr_decode_msg(const struct ofp_header *,
793                               struct ofpbuf *payload);
794 struct ofpbuf *ofperr_encode_reply(enum ofperr, const struct ofp_header *);
795 struct ofpbuf *ofperr_encode_hello(enum ofperr, enum ofp_version ofp_version,
796                                    const char *);
797 int ofperr_get_vendor(enum ofperr, enum ofp_version);
798 int ofperr_get_type(enum ofperr, enum ofp_version);
799 int ofperr_get_code(enum ofperr, enum ofp_version);
800
801 const char *ofperr_get_name(enum ofperr);
802 const char *ofperr_get_description(enum ofperr);
803
804 void ofperr_format(struct ds *, enum ofperr);
805 const char *ofperr_to_string(enum ofperr);
806
807 #endif /* ofp-errors.h */