ofp-errors: Use OFPERR_OFPBRC_BAD_TABLE_ID
authorSimon Horman <horms@verge.net.au>
Wed, 5 Sep 2012 02:50:38 +0000 (11:50 +0900)
committerBen Pfaff <blp@nicira.com>
Wed, 5 Sep 2012 17:19:14 +0000 (10:19 -0700)
* In the case of OpenFlow 1.1+ OFPERR_OFPBRC_BAD_TABLE_ID is defined
  in the specification and seems to be the most appropriate error
  to use when an unknown table id is encountered.

* In the case of OpenFlow 1.0 no appropriate error message
  seems to exist. Perhaps because an invalid port is not possible?
  I'm unsure.

  In any case, make use of a non-standard error code (1,512).
  This was formerly known as OFPERR_NXBRC_BAD_TABLE_ID but
  has been rolled into OFPERR_OFPBRC_BAD_TABLE_ID to allow the
  latter to be used without concern for the prevailing Open Flow version.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-errors.h
ofproto/ofproto.c

index 9a5dbcb..a883e20 100644 (file)
@@ -112,7 +112,10 @@ enum ofperr {
     /* OF1.0+(1,8).  Specified buffer does not exist. */
     OFPERR_OFPBRC_BUFFER_UNKNOWN,
 
-    /* OF1.1+(1,9).  Specified table-id invalid or does not exist. */
+    /* NX1.0(1,512), OF1.1+(1,9).  Specified table-id invalid or does not exist.
+     * [ A non-standard error (1,512), formerly OFPERR_NXBRC_BAD_TABLE_ID,
+     *   is used for OpenFlow 1.0 as there seems to be no appropriste error
+     *   code defined the specification. ] */
     OFPERR_OFPBRC_BAD_TABLE_ID,
 
     /* OF1.2+(1,10).  Denied because controller is slave. */
@@ -134,9 +137,6 @@ enum ofperr {
      * nxm_hasmask or nxm_length or both, is invalid or not implemented. */
     OFPERR_NXBRC_NXM_BAD_TYPE,
 
-    /* NX1.0+(1,512).  A request specified a nonexistent table ID. */
-    OFPERR_NXBRC_BAD_TABLE_ID,
-
     /* NX1.0+(1,515).  Must-be-zero field had nonzero value. */
     OFPERR_NXBRC_MUST_BE_ZERO,
 
index 3c4184f..9b235e9 100644 (file)
@@ -2363,7 +2363,7 @@ check_table_id(const struct ofproto *ofproto, uint8_t table_id)
 {
     return (table_id == 0xff || table_id < ofproto->n_tables
             ? 0
-            : OFPERR_NXBRC_BAD_TABLE_ID);
+            : OFPERR_OFPBRC_BAD_TABLE_ID);
 
 }
 
@@ -2914,7 +2914,7 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn,
     } else if (fm->table_id < ofproto->n_tables) {
         table = &ofproto->tables[fm->table_id];
     } else {
-        return OFPERR_NXFMFC_BAD_TABLE_ID;
+        return OFPERR_OFPBRC_BAD_TABLE_ID;
     }
 
     if (table->flags & OFTABLE_READONLY) {