ofp-actions: Prepare to treat OF1.2 actions as OF1.1 actions.
authorBen Pfaff <blp@nicira.com>
Tue, 25 Sep 2012 17:23:38 +0000 (10:23 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 26 Sep 2012 16:21:27 +0000 (09:21 -0700)
The numbering of OpenFlow 1.0 actions overlaps with the numbering
of OpenFlow 1.1+ actions, so the two sets of actions have to be
distinguished for input and output.  But OpenFlow 1.1 and 1.2
actions are numbered to avoid this problem, so there is no need
to distinguish them in the same way.  Therefore, this commit
prepares to treat them together.

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

index 19ed7a02e1ce0274a04fde0f0fd756b9f960c81c..bb45edc0ecc449e575e9b54c29b4c8d44b1f1aa2 100644 (file)
@@ -283,7 +283,6 @@ ofpact_from_nxast(const union ofp_action *a, enum ofputil_action_code code,
     case OFPUTIL_ACTION_INVALID:
 #define OFPAT10_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
 #define OFPAT11_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
-#define OFPAT12_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
 #include "ofp-util.def"
         NOT_REACHED();
 
@@ -398,7 +397,6 @@ ofpact_from_openflow10(const union ofp_action *a, struct ofpbuf *out)
     switch (code) {
     case OFPUTIL_ACTION_INVALID:
 #define OFPAT11_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
-#define OFPAT12_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
 #include "ofp-util.def"
         NOT_REACHED();
 
@@ -661,7 +659,6 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out)
     switch (code) {
     case OFPUTIL_ACTION_INVALID:
 #define OFPAT10_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
-#define OFPAT12_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
 #include "ofp-util.def"
         NOT_REACHED();
 
@@ -716,6 +713,10 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out)
         ofpact_put_SET_L4_DST_PORT(out)->port = ntohs(a->tp_port.tp_port);
         break;
 
+    case OFPUTIL_OFPAT12_SET_FIELD:
+        /* Not yet implemented. */
+        break;
+
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM:
 #include "ofp-util.def"
         return ofpact_from_nxast(a, code, out);
index fc988946dadf8c1cb91719acd2fe9a78d746ab09..e2a815be5c6b899656e79f20d9959ef486288c14 100644 (file)
@@ -3667,7 +3667,6 @@ ofputil_action_code_from_name(const char *name)
         NULL,
 #define OFPAT10_ACTION(ENUM, STRUCT, NAME)           NAME,
 #define OFPAT11_ACTION(ENUM, STRUCT, NAME)           NAME,
-#define OFPAT12_ACTION(ENUM, STRUCT, NAME)           NAME,
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME,
 #include "ofp-util.def"
     };
@@ -3697,7 +3696,6 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
 #define OFPAT10_ACTION(ENUM, STRUCT, NAME)                    \
     case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
 #define OFPAT11_ACTION OFPAT10_ACTION
-#define OFPAT12_ACTION OFPAT10_ACTION
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)        \
     case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
 #include "ofp-util.def"
@@ -3722,7 +3720,6 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
         return s;                                               \
     }
 #define OFPAT11_ACTION OFPAT10_ACTION
-#define OFPAT12_ACTION OFPAT10_ACTION
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)            \
     void                                                        \
     ofputil_init_##ENUM(struct STRUCT *s)                       \
index 6f5113e7fb13927eec9d3a4087cdf84f688c5636..2e50db16d1bf85096d8eaf27e680470ed86d5d59 100644 (file)
@@ -35,28 +35,7 @@ OFPAT11_ACTION(OFPAT11_SET_TP_DST,   ofp_action_tp_port,  "mod_tp_dst")
 //OFPAT11_ACTION(OFPAT11_SET_QUEUE,    ofp11_action_set_queue, "set_queue")
 //OFPAT11_ACTION(OFPAT11_SET_NW_TTL,   ofp11_action_nw_ttl, "set_nw_ttl")
 //OFPAT11_ACTION(OFPAT11_DEC_NW_TTL,   ofp_action_header,   "dec_ttl")
-
-#ifndef OFPAT12_ACTION
-#define OFPAT12_ACTION(ENUM, STRUCT, NAME)
-#endif
-//OFPAT12_ACTION(OFPAT12_OUTPUT, , "output")
-//OFPAT12_ACTION(OFPAT12_COPY_TTL_OUT, ofp_action_header, "copy_ttl_out")
-//OFPAT12_ACTION(OFPAT12_COPY_TTL_IN, ofp_action_header, "copy_ttl_in")
-//OFPAT12_ACTION(OFPAT12_SET_MPLS_TTL, , "set_mpls_ttl")
-//OFPAT12_ACTION(OFPAT12_DEC_MPLS_TTL, ofp_action_header, "dec_mpls_ttl")
-//OFPAT12_ACTION(OFPAT12_PUSH_VLAN, , "push_vlan")
-//OFPAT12_ACTION(OFPAT12_POP_VLAN, ofp_action_header, "pop_vlan")
-//OFPAT12_ACTION(OFPAT12_PUSH_MPLS, , "push_mpls")
-//OFPAT12_ACTION(OFPAT12_POP_MPLS, , "pop_mpls")
-//OFPAT12_ACTION(OFPAT12_SET_QUEUE, , "set_queue")
-//OFPAT12_ACTION(OFPAT12_GROUP, , "group")
-//OFPAT12_ACTION(OFPAT12_SET_NW_TTL, , "set_nw_ttl")
-//OFPAT12_ACTION(OFPAT12_DEC_NW_TTL, ofp_action_header, "dec_ttl")
-//Use non-NULL name for OFPAT12_SET_FIELD once the code for
-//the OFPUTIL_OFPAT12_SET_FIELD case in parse_named_action() is implemented
-//OFPAT12_ACTION(OFPAT12_SET_FIELD, ofp12_action_set_field, "set_field")
-OFPAT12_ACTION(OFPAT12_SET_FIELD, ofp12_action_set_field, NULL)
-//OFPAT12_ACTION(OFPAT12_EXPERIMENTER, , )
+OFPAT11_ACTION(OFPAT12_SET_FIELD, ofp12_action_set_field, NULL)
 
 #ifndef NXAST_ACTION
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)
@@ -84,5 +63,4 @@ NXAST_ACTION(NXAST_DEC_TTL_CNT_IDS, nx_action_cnt_ids,      1, NULL)
 
 #undef OFPAT10_ACTION
 #undef OFPAT11_ACTION
-#undef OFPAT12_ACTION
 #undef NXAST_ACTION
index 4e9f946f018d57bd6a80f9e7fd652d95b9d4f933..6b5f36722424b6ab70e2d38daf01181761ca2540 100644 (file)
@@ -560,7 +560,6 @@ enum OVS_PACKED_ENUM ofputil_action_code {
     OFPUTIL_ACTION_INVALID,
 #define OFPAT10_ACTION(ENUM, STRUCT, NAME)           OFPUTIL_##ENUM,
 #define OFPAT11_ACTION(ENUM, STRUCT, NAME)           OFPUTIL_##ENUM,
-#define OFPAT12_ACTION(ENUM, STRUCT, NAME)           OFPUTIL_##ENUM,
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM,
 #include "ofp-util.def"
 };
@@ -569,7 +568,6 @@ enum OVS_PACKED_ENUM ofputil_action_code {
 enum {
 #define OFPAT10_ACTION(ENUM, STRUCT, NAME)           + 1
 #define OFPAT11_ACTION(ENUM, STRUCT, NAME)           + 1
-#define OFPAT12_ACTION(ENUM, STRUCT, NAME)           + 1
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1
     OFPUTIL_N_ACTIONS = 1
 #include "ofp-util.def"
@@ -599,9 +597,6 @@ void *ofputil_put_action(enum ofputil_action_code, struct ofpbuf *buf);
 #define OFPAT11_ACTION(ENUM, STRUCT, NAME)              \
     void ofputil_init_##ENUM(struct STRUCT *);          \
     struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);
-#define OFPAT12_ACTION(ENUM, STRUCT, NAME)              \
-    void ofputil_init_##ENUM(struct STRUCT *);          \
-    struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)    \
     void ofputil_init_##ENUM(struct STRUCT *);          \
     struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);