nicira-ext: Renumber NXT_FLOW_MOD_TABLE_ID.
authorBen Pfaff <blp@nicira.com>
Thu, 9 Jun 2011 22:18:21 +0000 (15:18 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 10 Jun 2011 16:03:22 +0000 (09:03 -0700)
We don't know of anyone using this command in production yet, so it seems
reasonable to give it a new number instead of coping with it having a
conflicting number.

include/openflow/nicira-ext.h
lib/ofp-util.c

index 4270c16..c516b9f 100644 (file)
@@ -141,19 +141,15 @@ enum nicira_type {
     NXT_ROLE_REQUEST,
     NXT_ROLE_REPLY,
 
-    /* Use the upper 8 bits of the 'command' member in struct ofp_flow_mod to
-     * designate the table to which a flow is to be added?  See the big comment
-     * on struct nxt_flow_mod_table_id for more information.
-     *
-     * A screwup caused this extension to be assigned the same value as
-     * NXT_SET_FLOW_FORMAT (see below).  The two extensions do have different
-     * lengths, so they can still be distinguished. */
-    NXT_FLOW_MOD_TABLE_ID,
-
     /* Flexible flow specification (aka NXM = Nicira Extended Match). */
-    NXT_SET_FLOW_FORMAT = NXT_FLOW_MOD_TABLE_ID, /* Set flow format. */
+    NXT_SET_FLOW_FORMAT,        /* Set flow format. */
     NXT_FLOW_MOD,               /* Analogous to OFPT_FLOW_MOD. */
-    NXT_FLOW_REMOVED            /* Analogous to OFPT_FLOW_REMOVED. */
+    NXT_FLOW_REMOVED,           /* Analogous to OFPT_FLOW_REMOVED. */
+
+    /* Use the upper 8 bits of the 'command' member in struct ofp_flow_mod to
+     * designate the table to which a flow is to be added?  See the big comment
+     * on struct nxt_flow_mod_table_id for more information. */
+    NXT_FLOW_MOD_TABLE_ID
 };
 
 /* Header for Nicira vendor stats request and reply messages. */
index 750918d..dfbbf1b 100644 (file)
@@ -373,6 +373,10 @@ ofputil_decode_vendor(const struct ofp_header *oh,
         { OFPUTIL_NXT_FLOW_REMOVED,
           NXT_FLOW_REMOVED, "NXT_FLOW_REMOVED",
           sizeof(struct nx_flow_removed), 8 },
+
+        { OFPUTIL_NXT_FLOW_MOD_TABLE_ID,
+          NXT_FLOW_MOD_TABLE_ID, "NXT_FLOW_MOD_TABLE_ID",
+          sizeof(struct nxt_flow_mod_table_id), 0 },
     };
 
     static const struct ofputil_msg_category nxt_category = {
@@ -399,21 +403,6 @@ ofputil_decode_vendor(const struct ofp_header *oh,
     }
 
     nh = (const struct nicira_header *) oh;
-
-    if (nh->subtype == htonl(NXT_FLOW_MOD_TABLE_ID)
-        && oh->length == htons(sizeof(struct nxt_flow_mod_table_id))) {
-        /* NXT_SET_FLOW_FORMAT and NXT_FLOW_MOD_TABLE_ID accidentally have the
-         * same value but different lengths.  ofputil_lookup_openflow_message()
-         * doesn't support this case, so special case it here. */
-        static const struct ofputil_msg_type nxt_flow_mod_table_id =
-            { OFPUTIL_NXT_FLOW_MOD_TABLE_ID,
-              NXT_FLOW_MOD_TABLE_ID, "NXT_FLOW_MOD_TABLE_ID",
-              sizeof(struct nxt_flow_mod_table_id), 0 };
-
-        *typep = &nxt_flow_mod_table_id;
-        return 0;
-    }
-
     return ofputil_lookup_openflow_message(&nxt_category, ntohl(nh->subtype),
                                            ntohs(oh->length), typep);
 }