openflow: Split OFPAT_* into OFPAT10_* and OFPAT11_*.
authorBen Pfaff <blp@nicira.com>
Thu, 16 Feb 2012 00:22:18 +0000 (16:22 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 7 Mar 2012 22:05:10 +0000 (14:05 -0800)
An upcoming commit will start referring to OpenFlow 1.1 actions, which are
renumbered relative to OpenFlow 1.0 actions, so this commit prepares by
changing all the existing uses of OFPAT_* to instead use OFPAT10_*.

This commit also introduces the OFPAT11_* constants.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
14 files changed:
include/openflow/openflow-1.0.h
include/openflow/openflow-1.1.h
lib/learn.c
lib/learning-switch.c
lib/ofp-parse.c
lib/ofp-print.c
lib/ofp-util.c
lib/ofp-util.def
lib/ofp-util.h
ofproto/connmgr.c
ofproto/fail-open.c
ofproto/in-band.c
ofproto/ofproto-dpif.c
ofproto/ofproto.c

index 457374d..bca1067 100644 (file)
@@ -268,28 +268,28 @@ struct ofp_packet_in {
 };
 OFP_ASSERT(sizeof(struct ofp_packet_in) == 20);
 
-enum ofp_action_type {
-    OFPAT_OUTPUT,           /* Output to switch port. */
-    OFPAT_SET_VLAN_VID,     /* Set the 802.1q VLAN id. */
-    OFPAT_SET_VLAN_PCP,     /* Set the 802.1q priority. */
-    OFPAT_STRIP_VLAN,       /* Strip the 802.1q header. */
-    OFPAT_SET_DL_SRC,       /* Ethernet source address. */
-    OFPAT_SET_DL_DST,       /* Ethernet destination address. */
-    OFPAT_SET_NW_SRC,       /* IP source address. */
-    OFPAT_SET_NW_DST,       /* IP destination address. */
-    OFPAT_SET_NW_TOS,       /* IP ToS (DSCP field, 6 bits). */
-    OFPAT_SET_TP_SRC,       /* TCP/UDP source port. */
-    OFPAT_SET_TP_DST,       /* TCP/UDP destination port. */
-    OFPAT_ENQUEUE,          /* Output to queue. */
-    OFPAT_VENDOR = 0xffff
-};
-
-/* Action structure for OFPAT_OUTPUT, which sends packets out 'port'.
+enum ofp10_action_type {
+    OFPAT10_OUTPUT,             /* Output to switch port. */
+    OFPAT10_SET_VLAN_VID,       /* Set the 802.1q VLAN id. */
+    OFPAT10_SET_VLAN_PCP,       /* Set the 802.1q priority. */
+    OFPAT10_STRIP_VLAN,         /* Strip the 802.1q header. */
+    OFPAT10_SET_DL_SRC,         /* Ethernet source address. */
+    OFPAT10_SET_DL_DST,         /* Ethernet destination address. */
+    OFPAT10_SET_NW_SRC,         /* IP source address. */
+    OFPAT10_SET_NW_DST,         /* IP destination address. */
+    OFPAT10_SET_NW_TOS,         /* IP ToS (DSCP field, 6 bits). */
+    OFPAT10_SET_TP_SRC,         /* TCP/UDP source port. */
+    OFPAT10_SET_TP_DST,         /* TCP/UDP destination port. */
+    OFPAT10_ENQUEUE,            /* Output to queue. */
+    OFPAT10_VENDOR = 0xffff
+};
+
+/* Action structure for OFPAT10_OUTPUT, which sends packets out 'port'.
  * When the 'port' is the OFPP_CONTROLLER, 'max_len' indicates the max
  * number of bytes to send.  A 'max_len' of zero means no bytes of the
  * packet should be sent. */
 struct ofp_action_output {
-    ovs_be16 type;                  /* OFPAT_OUTPUT. */
+    ovs_be16 type;                  /* OFPAT10_OUTPUT. */
     ovs_be16 len;                   /* Length is 8. */
     ovs_be16 port;                  /* Output port. */
     ovs_be16 max_len;               /* Max length to send to controller. */
@@ -301,62 +301,62 @@ OFP_ASSERT(sizeof(struct ofp_action_output) == 8);
  * set. */
 #define OFP_VLAN_NONE      0xffff
 
-/* Action structure for OFPAT_SET_VLAN_VID. */
+/* Action structure for OFPAT10_SET_VLAN_VID. */
 struct ofp_action_vlan_vid {
-    ovs_be16 type;                  /* OFPAT_SET_VLAN_VID. */
+    ovs_be16 type;                  /* OFPAT10_SET_VLAN_VID. */
     ovs_be16 len;                   /* Length is 8. */
     ovs_be16 vlan_vid;              /* VLAN id. */
     uint8_t pad[2];
 };
 OFP_ASSERT(sizeof(struct ofp_action_vlan_vid) == 8);
 
-/* Action structure for OFPAT_SET_VLAN_PCP. */
+/* Action structure for OFPAT10_SET_VLAN_PCP. */
 struct ofp_action_vlan_pcp {
-    ovs_be16 type;                  /* OFPAT_SET_VLAN_PCP. */
+    ovs_be16 type;                  /* OFPAT10_SET_VLAN_PCP. */
     ovs_be16 len;                   /* Length is 8. */
     uint8_t vlan_pcp;               /* VLAN priority. */
     uint8_t pad[3];
 };
 OFP_ASSERT(sizeof(struct ofp_action_vlan_pcp) == 8);
 
-/* Action structure for OFPAT_SET_DL_SRC/DST. */
+/* Action structure for OFPAT10_SET_DL_SRC/DST. */
 struct ofp_action_dl_addr {
-    ovs_be16 type;                  /* OFPAT_SET_DL_SRC/DST. */
+    ovs_be16 type;                  /* OFPAT10_SET_DL_SRC/DST. */
     ovs_be16 len;                   /* Length is 16. */
     uint8_t dl_addr[OFP_ETH_ALEN];  /* Ethernet address. */
     uint8_t pad[6];
 };
 OFP_ASSERT(sizeof(struct ofp_action_dl_addr) == 16);
 
-/* Action structure for OFPAT_SET_NW_SRC/DST. */
+/* Action structure for OFPAT10_SET_NW_SRC/DST. */
 struct ofp_action_nw_addr {
-    ovs_be16 type;                  /* OFPAT_SET_TW_SRC/DST. */
+    ovs_be16 type;                  /* OFPAT10_SET_TW_SRC/DST. */
     ovs_be16 len;                   /* Length is 8. */
     ovs_be32 nw_addr;               /* IP address. */
 };
 OFP_ASSERT(sizeof(struct ofp_action_nw_addr) == 8);
 
-/* Action structure for OFPAT_SET_NW_TOS. */
+/* Action structure for OFPAT10_SET_NW_TOS. */
 struct ofp_action_nw_tos {
-    ovs_be16 type;                  /* OFPAT_SET_TW_TOS. */
+    ovs_be16 type;                  /* OFPAT10_SET_TW_TOS. */
     ovs_be16 len;                   /* Length is 8. */
     uint8_t nw_tos;                 /* IP TOS (DSCP field, 6 bits). */
     uint8_t pad[3];
 };
 OFP_ASSERT(sizeof(struct ofp_action_nw_tos) == 8);
 
-/* Action structure for OFPAT_SET_TP_SRC/DST. */
+/* Action structure for OFPAT10_SET_TP_SRC/DST. */
 struct ofp_action_tp_port {
-    ovs_be16 type;                  /* OFPAT_SET_TP_SRC/DST. */
+    ovs_be16 type;                  /* OFPAT10_SET_TP_SRC/DST. */
     ovs_be16 len;                   /* Length is 8. */
     ovs_be16 tp_port;               /* TCP/UDP port. */
     uint8_t pad[2];
 };
 OFP_ASSERT(sizeof(struct ofp_action_tp_port) == 8);
 
-/* Action header for OFPAT_VENDOR. The rest of the body is vendor-defined. */
+/* Action header for OFPAT10_VENDOR. The rest of the body is vendor-defined. */
 struct ofp_action_vendor_header {
-    ovs_be16 type;                  /* OFPAT_VENDOR. */
+    ovs_be16 type;                  /* OFPAT10_VENDOR. */
     ovs_be16 len;                   /* Length is a multiple of 8. */
     ovs_be32 vendor;                /* Vendor ID, which takes the same form
                                        as in "struct ofp_vendor_header". */
@@ -367,7 +367,7 @@ OFP_ASSERT(sizeof(struct ofp_action_vendor_header) == 8);
  * header and any padding used to make the action 64-bit aligned.
  * NB: The length of an action *must* always be a multiple of eight. */
 struct ofp_action_header {
-    ovs_be16 type;                  /* One of OFPAT_*. */
+    ovs_be16 type;                  /* One of OFPAT10_*. */
     ovs_be16 len;                   /* Length of action, including this
                                        header.  This is the length of action,
                                        including any padding to make it
@@ -376,9 +376,9 @@ struct ofp_action_header {
 };
 OFP_ASSERT(sizeof(struct ofp_action_header) == 8);
 
-/* OFPAT_ENQUEUE action struct: send packets to given queue on port. */
+/* OFPAT10_ENQUEUE action struct: send packets to given queue on port. */
 struct ofp_action_enqueue {
-    ovs_be16 type;            /* OFPAT_ENQUEUE. */
+    ovs_be16 type;            /* OFPAT10_ENQUEUE. */
     ovs_be16 len;             /* Len is 16. */
     ovs_be16 port;            /* Port that queue belongs. Should
                                  refer to a valid physical port
index 02120a5..0e5c901 100644 (file)
@@ -93,4 +93,36 @@ enum ofp11_type {
     OFPT11_QUEUE_GET_CONFIG_REPLY,    /* Controller/switch message */
 };
 
+enum ofp11_action_type {
+    OFPAT11_OUTPUT,           /* Output to switch port. */
+    OFPAT11_SET_VLAN_VID,     /* Set the 802.1q VLAN id. */
+    OFPAT11_SET_VLAN_PCP,     /* Set the 802.1q priority. */
+    OFPAT11_SET_DL_SRC,       /* Ethernet source address. */
+    OFPAT11_SET_DL_DST,       /* Ethernet destination address. */
+    OFPAT11_SET_NW_SRC,       /* IP source address. */
+    OFPAT11_SET_NW_DST,       /* IP destination address. */
+    OFPAT11_SET_NW_TOS,       /* IP ToS (DSCP field, 6 bits). */
+    OFPAT11_SET_NW_ECN,       /* IP ECN (2 bits). */
+    OFPAT11_SET_TP_SRC,       /* TCP/UDP/SCTP source port. */
+    OFPAT11_SET_TP_DST,       /* TCP/UDP/SCTP destination port. */
+    OFPAT11_COPY_TTL_OUT,     /* Copy TTL "outwards" -- from next-to-outermost
+                                 to outermost */
+    OFPAT11_COPY_TTL_IN,      /* Copy TTL "inwards" -- from outermost to
+                               next-to-outermost */
+    OFPAT11_SET_MPLS_LABEL,   /* MPLS label */
+    OFPAT11_SET_MPLS_TC,      /* MPLS TC */
+    OFPAT11_SET_MPLS_TTL,     /* MPLS TTL */
+    OFPAT11_DEC_MPLS_TTL,     /* Decrement MPLS TTL */
+
+    OFPAT11_PUSH_VLAN,        /* Push a new VLAN tag */
+    OFPAT11_POP_VLAN,         /* Pop the outer VLAN tag */
+    OFPAT11_PUSH_MPLS,        /* Push a new MPLS tag */
+    OFPAT11_POP_MPLS,         /* Pop the outer MPLS tag */
+    OFPAT11_SET_QUEUE,        /* Set queue id when outputting to a port */
+    OFPAT11_GROUP,            /* Apply group. */
+    OFPAT11_SET_NW_TTL,       /* IP TTL. */
+    OFPAT11_DEC_NW_TTL,       /* Decrement IP TTL. */
+    OFPAT11_EXPERIMENTER = 0xffff
+};
+
 #endif /* openflow/openflow-1.1.h */
index d749ce2..9ca8b65 100644 (file)
@@ -255,7 +255,7 @@ learn_execute(const struct nx_action_learn *learn, const struct flow *flow,
             break;
 
         case NX_LEARN_DST_OUTPUT:
-            ofputil_put_OFPAT_OUTPUT(&actions)->port = htons(value);
+            ofputil_put_OFPAT10_OUTPUT(&actions)->port = htons(value);
             break;
         }
     }
index 125bc37..fb529f5 100644 (file)
@@ -471,7 +471,7 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn,
         struct ofp_action_output oao;
 
         memset(&oao, 0, sizeof oao);
-        oao.type = htons(OFPAT_OUTPUT);
+        oao.type = htons(OFPAT10_OUTPUT);
         oao.len = htons(sizeof oao);
         oao.port = htons(out_port);
 
@@ -481,7 +481,7 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn,
         struct ofp_action_enqueue oae;
 
         memset(&oae, 0, sizeof oae);
-        oae.type = htons(OFPAT_ENQUEUE);
+        oae.type = htons(OFPAT10_ENQUEUE);
         oae.len = htons(sizeof oae);
         oae.port = htons(out_port);
         oae.queue_id = htonl(queue_id);
index c630ccd..3f7a021 100644 (file)
@@ -124,7 +124,7 @@ put_output_action(struct ofpbuf *b, uint16_t port)
 {
     struct ofp_action_output *oao;
 
-    oao = ofputil_put_OFPAT_OUTPUT(b);
+    oao = ofputil_put_OFPAT10_OUTPUT(b);
     oao->port = htons(port);
     return oao;
 }
@@ -141,7 +141,7 @@ parse_enqueue(struct ofpbuf *b, char *arg)
         ovs_fatal(0, "\"enqueue\" syntax is \"enqueue:PORT:QUEUE\"");
     }
 
-    oae = ofputil_put_OFPAT_ENQUEUE(b);
+    oae = ofputil_put_OFPAT10_ENQUEUE(b);
     oae->port = htons(str_to_u32(port));
     oae->queue_id = htonl(str_to_u32(queue));
 }
@@ -320,47 +320,47 @@ parse_named_action(enum ofputil_action_code code, const struct flow *flow,
     struct ofp_action_tp_port *oata;
 
     switch (code) {
-    case OFPUTIL_OFPAT_OUTPUT:
+    case OFPUTIL_OFPAT10_OUTPUT:
         parse_output(b, arg);
         break;
 
-    case OFPUTIL_OFPAT_SET_VLAN_VID:
-        oavv = ofputil_put_OFPAT_SET_VLAN_VID(b);
+    case OFPUTIL_OFPAT10_SET_VLAN_VID:
+        oavv = ofputil_put_OFPAT10_SET_VLAN_VID(b);
         oavv->vlan_vid = htons(str_to_u32(arg));
         break;
 
-    case OFPUTIL_OFPAT_SET_VLAN_PCP:
-        oavp = ofputil_put_OFPAT_SET_VLAN_PCP(b);
+    case OFPUTIL_OFPAT10_SET_VLAN_PCP:
+        oavp = ofputil_put_OFPAT10_SET_VLAN_PCP(b);
         oavp->vlan_pcp = str_to_u32(arg);
         break;
 
-    case OFPUTIL_OFPAT_STRIP_VLAN:
-        ofputil_put_OFPAT_STRIP_VLAN(b);
+    case OFPUTIL_OFPAT10_STRIP_VLAN:
+        ofputil_put_OFPAT10_STRIP_VLAN(b);
         break;
 
-    case OFPUTIL_OFPAT_SET_DL_SRC:
-    case OFPUTIL_OFPAT_SET_DL_DST:
+    case OFPUTIL_OFPAT10_SET_DL_SRC:
+    case OFPUTIL_OFPAT10_SET_DL_DST:
         oada = ofputil_put_action(code, b);
         str_to_mac(arg, oada->dl_addr);
         break;
 
-    case OFPUTIL_OFPAT_SET_NW_SRC:
-    case OFPUTIL_OFPAT_SET_NW_DST:
+    case OFPUTIL_OFPAT10_SET_NW_SRC:
+    case OFPUTIL_OFPAT10_SET_NW_DST:
         oana = ofputil_put_action(code, b);
         str_to_ip(arg, &oana->nw_addr);
         break;
 
-    case OFPUTIL_OFPAT_SET_NW_TOS:
-        ofputil_put_OFPAT_SET_NW_TOS(b)->nw_tos = str_to_u32(arg);
+    case OFPUTIL_OFPAT10_SET_NW_TOS:
+        ofputil_put_OFPAT10_SET_NW_TOS(b)->nw_tos = str_to_u32(arg);
         break;
 
-    case OFPUTIL_OFPAT_SET_TP_SRC:
-    case OFPUTIL_OFPAT_SET_TP_DST:
+    case OFPUTIL_OFPAT10_SET_TP_SRC:
+    case OFPUTIL_OFPAT10_SET_TP_DST:
         oata = ofputil_put_action(code, b);
         oata->tp_port = htons(str_to_u32(arg));
         break;
 
-    case OFPUTIL_OFPAT_ENQUEUE:
+    case OFPUTIL_OFPAT10_ENQUEUE:
         parse_enqueue(b, arg);
         break;
 
index c5312a3..1d71fc9 100644 (file)
@@ -182,7 +182,7 @@ ofp_print_action(struct ds *s, const union ofp_action *a,
     uint16_t port;
 
     switch (code) {
-    case OFPUTIL_OFPAT_OUTPUT:
+    case OFPUTIL_OFPAT10_OUTPUT:
         port = ntohs(a->output.port);
         if (port < OFPP_MAX) {
             ds_put_format(s, "output:%"PRIu16, port);
@@ -198,55 +198,55 @@ ofp_print_action(struct ds *s, const union ofp_action *a,
         }
         break;
 
-    case OFPUTIL_OFPAT_ENQUEUE:
+    case OFPUTIL_OFPAT10_ENQUEUE:
         oae = (const struct ofp_action_enqueue *) a;
         ds_put_format(s, "enqueue:");
         ofputil_format_port(ntohs(oae->port), s);
         ds_put_format(s, "q%"PRIu32, ntohl(oae->queue_id));
         break;
 
-    case OFPUTIL_OFPAT_SET_VLAN_VID:
+    case OFPUTIL_OFPAT10_SET_VLAN_VID:
         ds_put_format(s, "mod_vlan_vid:%"PRIu16,
                       ntohs(a->vlan_vid.vlan_vid));
         break;
 
-    case OFPUTIL_OFPAT_SET_VLAN_PCP:
+    case OFPUTIL_OFPAT10_SET_VLAN_PCP:
         ds_put_format(s, "mod_vlan_pcp:%"PRIu8, a->vlan_pcp.vlan_pcp);
         break;
 
-    case OFPUTIL_OFPAT_STRIP_VLAN:
+    case OFPUTIL_OFPAT10_STRIP_VLAN:
         ds_put_cstr(s, "strip_vlan");
         break;
 
-    case OFPUTIL_OFPAT_SET_DL_SRC:
+    case OFPUTIL_OFPAT10_SET_DL_SRC:
         oada = (const struct ofp_action_dl_addr *) a;
         ds_put_format(s, "mod_dl_src:"ETH_ADDR_FMT,
                       ETH_ADDR_ARGS(oada->dl_addr));
         break;
 
-    case OFPUTIL_OFPAT_SET_DL_DST:
+    case OFPUTIL_OFPAT10_SET_DL_DST:
         oada = (const struct ofp_action_dl_addr *) a;
         ds_put_format(s, "mod_dl_dst:"ETH_ADDR_FMT,
                       ETH_ADDR_ARGS(oada->dl_addr));
         break;
 
-    case OFPUTIL_OFPAT_SET_NW_SRC:
+    case OFPUTIL_OFPAT10_SET_NW_SRC:
         ds_put_format(s, "mod_nw_src:"IP_FMT, IP_ARGS(&a->nw_addr.nw_addr));
         break;
 
-    case OFPUTIL_OFPAT_SET_NW_DST:
+    case OFPUTIL_OFPAT10_SET_NW_DST:
         ds_put_format(s, "mod_nw_dst:"IP_FMT, IP_ARGS(&a->nw_addr.nw_addr));
         break;
 
-    case OFPUTIL_OFPAT_SET_NW_TOS:
+    case OFPUTIL_OFPAT10_SET_NW_TOS:
         ds_put_format(s, "mod_nw_tos:%d", a->nw_tos.nw_tos);
         break;
 
-    case OFPUTIL_OFPAT_SET_TP_SRC:
+    case OFPUTIL_OFPAT10_SET_TP_SRC:
         ds_put_format(s, "mod_tp_src:%d", ntohs(a->tp_port.tp_port));
         break;
 
-    case OFPUTIL_OFPAT_SET_TP_DST:
+    case OFPUTIL_OFPAT10_SET_TP_DST:
         ds_put_format(s, "mod_tp_dst:%d", ntohs(a->tp_port.tp_port));
         break;
 
index 4e28b51..e29450f 100644 (file)
@@ -2633,7 +2633,7 @@ make_add_simple_flow(const struct cls_rule *rule,
         struct ofpbuf *buffer;
 
         buffer = make_add_flow(rule, buffer_id, idle_timeout, sizeof *oao);
-        ofputil_put_OFPAT_OUTPUT(buffer)->port = htons(out_port);
+        ofputil_put_OFPAT10_OUTPUT(buffer)->port = htons(out_port);
         return buffer;
     } else {
         return make_add_flow(rule, buffer_id, idle_timeout, 0);
@@ -2765,7 +2765,7 @@ ofputil_port_to_ofp11(uint16_t ofp10_port)
                  : ofp10_port + OFPP11_OFFSET);
 }
 
-/* Checks that 'port' is a valid output port for the OFPAT_OUTPUT action, given
+/* Checks that 'port' is a valid output port for the OFPAT10_OUTPUT action, given
  * that the switch will never have more than 'max_ports' ports.  Returns 0 if
  * 'port' is valid, otherwise an OpenFlow return code. */
 enum ofperr
@@ -2901,24 +2901,24 @@ validate_actions(const union ofp_action *actions, size_t n_actions,
 
         error = 0;
         switch ((enum ofputil_action_code) code) {
-        case OFPUTIL_OFPAT_OUTPUT:
+        case OFPUTIL_OFPAT10_OUTPUT:
             error = ofputil_check_output_port(ntohs(a->output.port),
                                               max_ports);
             break;
 
-        case OFPUTIL_OFPAT_SET_VLAN_VID:
+        case OFPUTIL_OFPAT10_SET_VLAN_VID:
             if (a->vlan_vid.vlan_vid & ~htons(0xfff)) {
                 error = OFPERR_OFPBAC_BAD_ARGUMENT;
             }
             break;
 
-        case OFPUTIL_OFPAT_SET_VLAN_PCP:
+        case OFPUTIL_OFPAT10_SET_VLAN_PCP:
             if (a->vlan_pcp.vlan_pcp & ~7) {
                 error = OFPERR_OFPBAC_BAD_ARGUMENT;
             }
             break;
 
-        case OFPUTIL_OFPAT_ENQUEUE:
+        case OFPUTIL_OFPAT10_ENQUEUE:
             port = ntohs(((const struct ofp_action_enqueue *) a)->port);
             if (port >= max_ports && port != OFPP_IN_PORT
                 && port != OFPP_LOCAL) {
@@ -2972,14 +2972,14 @@ validate_actions(const union ofp_action *actions, size_t n_actions,
             }
             break;
 
-        case OFPUTIL_OFPAT_STRIP_VLAN:
-        case OFPUTIL_OFPAT_SET_NW_SRC:
-        case OFPUTIL_OFPAT_SET_NW_DST:
-        case OFPUTIL_OFPAT_SET_NW_TOS:
-        case OFPUTIL_OFPAT_SET_TP_SRC:
-        case OFPUTIL_OFPAT_SET_TP_DST:
-        case OFPUTIL_OFPAT_SET_DL_SRC:
-        case OFPUTIL_OFPAT_SET_DL_DST:
+        case OFPUTIL_OFPAT10_STRIP_VLAN:
+        case OFPUTIL_OFPAT10_SET_NW_SRC:
+        case OFPUTIL_OFPAT10_SET_NW_DST:
+        case OFPUTIL_OFPAT10_SET_NW_TOS:
+        case OFPUTIL_OFPAT10_SET_TP_SRC:
+        case OFPUTIL_OFPAT10_SET_TP_DST:
+        case OFPUTIL_OFPAT10_SET_DL_SRC:
+        case OFPUTIL_OFPAT10_SET_DL_DST:
         case OFPUTIL_NXAST_RESUBMIT:
         case OFPUTIL_NXAST_SET_TUNNEL:
         case OFPUTIL_NXAST_SET_QUEUE:
@@ -3022,10 +3022,10 @@ static const struct ofputil_action action_bad_vendor
 static const struct ofputil_action *
 ofputil_decode_ofpat_action(const union ofp_action *a)
 {
-    enum ofp_action_type type = ntohs(a->type);
+    enum ofp10_action_type type = ntohs(a->type);
 
     switch (type) {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME)                    \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME)                    \
         case ENUM: {                                        \
             static const struct ofputil_action action = {   \
                 OFPUTIL_##ENUM,                             \
@@ -3036,7 +3036,7 @@ ofputil_decode_ofpat_action(const union ofp_action *a)
         }
 #include "ofp-util.def"
 
-    case OFPAT_VENDOR:
+    case OFPAT10_VENDOR:
     default:
         return &action_bad_type;
     }
@@ -3067,7 +3067,7 @@ ofputil_decode_nxast_action(const union ofp_action *a)
     }
 }
 
-/* Parses 'a' to determine its type.  Returns a nonnegative OFPUTIL_OFPAT_* or
+/* Parses 'a' to determine its type.  Returns a nonnegative OFPUTIL_OFPAT10_* or
  * OFPUTIL_NXAST_* constant if successful, otherwise a negative OFPERR_* error
  * code.
  *
@@ -3083,7 +3083,7 @@ ofputil_decode_action(const union ofp_action *a)
     const struct ofputil_action *action;
     uint16_t len = ntohs(a->header.len);
 
-    if (a->type != htons(OFPAT_VENDOR)) {
+    if (a->type != htons(OFPAT10_VENDOR)) {
         action = ofputil_decode_ofpat_action(a);
     } else {
         switch (ntohl(a->vendor.vendor)) {
@@ -3104,7 +3104,7 @@ ofputil_decode_action(const union ofp_action *a)
             : -OFPERR_OFPBAC_BAD_LEN);
 }
 
-/* Parses 'a' and returns its type as an OFPUTIL_OFPAT_* or OFPUTIL_NXAST_*
+/* Parses 'a' and returns its type as an OFPUTIL_OFPAT10_* or OFPUTIL_NXAST_*
  * constant.  The caller must have already validated that 'a' is a valid action
  * understood by Open vSwitch (e.g. by a previous successful call to
  * ofputil_decode_action()). */
@@ -3113,7 +3113,7 @@ ofputil_decode_action_unsafe(const union ofp_action *a)
 {
     const struct ofputil_action *action;
 
-    if (a->type != htons(OFPAT_VENDOR)) {
+    if (a->type != htons(OFPAT10_VENDOR)) {
         action = ofputil_decode_ofpat_action(a);
     } else {
         action = ofputil_decode_nxast_action(a);
@@ -3123,7 +3123,7 @@ ofputil_decode_action_unsafe(const union ofp_action *a)
 }
 
 /* Returns the 'enum ofputil_action_code' corresponding to 'name' (e.g. if
- * 'name' is "output" then the return value is OFPUTIL_OFPAT_OUTPUT), or -1 if
+ * 'name' is "output" then the return value is OFPUTIL_OFPAT10_OUTPUT), or -1 if
  * 'name' is not the name of any action.
  *
  * ofp-util.def lists the mapping from names to action. */
@@ -3131,7 +3131,7 @@ int
 ofputil_action_code_from_name(const char *name)
 {
     static const char *names[OFPUTIL_N_ACTIONS] = {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME)             NAME,
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME)             NAME,
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME,
 #include "ofp-util.def"
     };
@@ -3155,7 +3155,7 @@ void *
 ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
 {
     switch (code) {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME)                    \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME)                    \
     case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)        \
     case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
@@ -3164,7 +3164,7 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
     NOT_REACHED();
 }
 
-#define OFPAT_ACTION(ENUM, STRUCT, NAME)                        \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME)                        \
     void                                                        \
     ofputil_init_##ENUM(struct STRUCT *s)                       \
     {                                                           \
@@ -3185,7 +3185,7 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
     ofputil_init_##ENUM(struct STRUCT *s)                       \
     {                                                           \
         memset(s, 0, sizeof *s);                                \
-        s->type = htons(OFPAT_VENDOR);                          \
+        s->type = htons(OFPAT10_VENDOR);                        \
         s->len = htons(sizeof *s);                              \
         s->vendor = htonl(NX_VENDOR_ID);                        \
         s->subtype = htons(ENUM);                               \
@@ -3205,9 +3205,9 @@ bool
 action_outputs_to_port(const union ofp_action *action, ovs_be16 port)
 {
     switch (ntohs(action->type)) {
-    case OFPAT_OUTPUT:
+    case OFPAT10_OUTPUT:
         return action->output.port == port;
-    case OFPAT_ENQUEUE:
+    case OFPAT10_ENQUEUE:
         return ((const struct ofp_action_enqueue *) action)->port == port;
     default:
         return false;
index c74980b..8739ac0 100644 (file)
@@ -1,21 +1,21 @@
 /* -*- c -*- */
 
-#ifndef OFPAT_ACTION
-#define OFPAT_ACTION(ENUM, STRUCT, NAME)
+#ifndef OFPAT10_ACTION
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME)
 #endif
-OFPAT_ACTION(OFPAT_OUTPUT,       ofp_action_output,   "output")
-OFPAT_ACTION(OFPAT_SET_VLAN_VID, ofp_action_vlan_vid, "mod_vlan_vid")
-OFPAT_ACTION(OFPAT_SET_VLAN_PCP, ofp_action_vlan_pcp, "mod_vlan_pcp")
-OFPAT_ACTION(OFPAT_STRIP_VLAN,   ofp_action_header,   "strip_vlan")
-OFPAT_ACTION(OFPAT_SET_DL_SRC,   ofp_action_dl_addr,  "mod_dl_src")
-OFPAT_ACTION(OFPAT_SET_DL_DST,   ofp_action_dl_addr,  "mod_dl_dst")
-OFPAT_ACTION(OFPAT_SET_NW_SRC,   ofp_action_nw_addr,  "mod_nw_src")
-OFPAT_ACTION(OFPAT_SET_NW_DST,   ofp_action_nw_addr,  "mod_nw_dst")
-OFPAT_ACTION(OFPAT_SET_NW_TOS,   ofp_action_nw_tos,   "mod_nw_tos")
-OFPAT_ACTION(OFPAT_SET_TP_SRC,   ofp_action_tp_port,  "mod_tp_src")
-OFPAT_ACTION(OFPAT_SET_TP_DST,   ofp_action_tp_port,  "mod_tp_dst")
-OFPAT_ACTION(OFPAT_ENQUEUE,      ofp_action_enqueue,  "enqueue")
-#undef OFPAT_ACTION
+OFPAT10_ACTION(OFPAT10_OUTPUT,       ofp_action_output,   "output")
+OFPAT10_ACTION(OFPAT10_SET_VLAN_VID, ofp_action_vlan_vid, "mod_vlan_vid")
+OFPAT10_ACTION(OFPAT10_SET_VLAN_PCP, ofp_action_vlan_pcp, "mod_vlan_pcp")
+OFPAT10_ACTION(OFPAT10_STRIP_VLAN,   ofp_action_header,   "strip_vlan")
+OFPAT10_ACTION(OFPAT10_SET_DL_SRC,   ofp_action_dl_addr,  "mod_dl_src")
+OFPAT10_ACTION(OFPAT10_SET_DL_DST,   ofp_action_dl_addr,  "mod_dl_dst")
+OFPAT10_ACTION(OFPAT10_SET_NW_SRC,   ofp_action_nw_addr,  "mod_nw_src")
+OFPAT10_ACTION(OFPAT10_SET_NW_DST,   ofp_action_nw_addr,  "mod_nw_dst")
+OFPAT10_ACTION(OFPAT10_SET_NW_TOS,   ofp_action_nw_tos,   "mod_nw_tos")
+OFPAT10_ACTION(OFPAT10_SET_TP_SRC,   ofp_action_tp_port,  "mod_tp_src")
+OFPAT10_ACTION(OFPAT10_SET_TP_DST,   ofp_action_tp_port,  "mod_tp_dst")
+OFPAT10_ACTION(OFPAT10_ENQUEUE,      ofp_action_enqueue,  "enqueue")
+#undef OFPAT10_ACTION
 
 #ifndef NXAST_ACTION
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)
index 781bfc5..5004758 100644 (file)
@@ -389,21 +389,21 @@ bool ofputil_frag_handling_from_string(const char *, enum ofp_config_flags *);
 
 /* The type of an action.
  *
- * For each implemented OFPAT_* and NXAST_* action type, there is a
+ * For each implemented OFPAT10_* and NXAST_* action type, there is a
  * corresponding constant prefixed with OFPUTIL_, e.g.:
  *
- * OFPUTIL_OFPAT_OUTPUT
- * OFPUTIL_OFPAT_SET_VLAN_VID
- * OFPUTIL_OFPAT_SET_VLAN_PCP
- * OFPUTIL_OFPAT_STRIP_VLAN
- * OFPUTIL_OFPAT_SET_DL_SRC
- * OFPUTIL_OFPAT_SET_DL_DST
- * OFPUTIL_OFPAT_SET_NW_SRC
- * OFPUTIL_OFPAT_SET_NW_DST
- * OFPUTIL_OFPAT_SET_NW_TOS
- * OFPUTIL_OFPAT_SET_TP_SRC
- * OFPUTIL_OFPAT_SET_TP_DST
- * OFPUTIL_OFPAT_ENQUEUE
+ * OFPUTIL_OFPAT10_OUTPUT
+ * OFPUTIL_OFPAT10_SET_VLAN_VID
+ * OFPUTIL_OFPAT10_SET_VLAN_PCP
+ * OFPUTIL_OFPAT10_STRIP_VLAN
+ * OFPUTIL_OFPAT10_SET_DL_SRC
+ * OFPUTIL_OFPAT10_SET_DL_DST
+ * OFPUTIL_OFPAT10_SET_NW_SRC
+ * OFPUTIL_OFPAT10_SET_NW_DST
+ * OFPUTIL_OFPAT10_SET_NW_TOS
+ * OFPUTIL_OFPAT10_SET_TP_SRC
+ * OFPUTIL_OFPAT10_SET_TP_DST
+ * OFPUTIL_OFPAT10_ENQUEUE
  * OFPUTIL_NXAST_RESUBMIT
  * OFPUTIL_NXAST_SET_TUNNEL
  * OFPUTIL_NXAST_SET_QUEUE
@@ -425,14 +425,14 @@ bool ofputil_frag_handling_from_string(const char *, enum ofp_config_flags *);
  * (The above list helps developers who want to "grep" for these definitions.)
  */
 enum ofputil_action_code {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME)             OFPUTIL_##ENUM,
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME)             OFPUTIL_##ENUM,
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM,
 #include "ofp-util.def"
 };
 
 /* The number of values of "enum ofputil_action_code". */
 enum {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME)             + 1
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME)             + 1
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1
     OFPUTIL_N_ACTIONS = 0
 #include "ofp-util.def"
@@ -460,7 +460,7 @@ void *ofputil_put_action(enum ofputil_action_code, struct ofpbuf *buf);
  *     Appends a new 'action', of length 'sizeof(struct <STRUCT>)', to 'buf',
  *     initializes it with ofputil_init_<ENUM>(), and returns it.
  */
-#define OFPAT_ACTION(ENUM, STRUCT, NAME)                \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME)              \
     void ofputil_init_##ENUM(struct STRUCT *);          \
     struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);
 #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)    \
index b01a471..ae0d3db 100644 (file)
@@ -1560,7 +1560,7 @@ connmgr_flushed(struct connmgr *mgr)
         struct cls_rule rule;
 
         memset(&action, 0, sizeof action);
-        action.type = htons(OFPAT_OUTPUT);
+        action.type = htons(OFPAT10_OUTPUT);
         action.output.len = htons(sizeof action);
         action.output.port = htons(OFPP_NORMAL);
         cls_rule_init_catchall(&rule, 0);
index 541bb05..6fb1ea8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -216,7 +216,7 @@ fail_open_flushed(struct fail_open *fo)
         /* Set up a flow that matches every packet and directs them to
          * OFPP_NORMAL. */
         memset(&action, 0, sizeof action);
-        action.type = htons(OFPAT_OUTPUT);
+        action.type = htons(OFPAT10_OUTPUT);
         action.output.len = htons(sizeof action);
         action.output.port = htons(OFPP_NORMAL);
 
index cd9c050..f738998 100644 (file)
@@ -412,7 +412,7 @@ in_band_run(struct in_band *ib)
     struct in_band_rule *rule, *next;
 
     memset(&actions, 0, sizeof actions);
-    actions.oa.output.type = htons(OFPAT_OUTPUT);
+    actions.oa.output.type = htons(OFPAT10_OUTPUT);
     actions.oa.output.len = htons(sizeof actions.oa);
     actions.oa.output.port = htons(OFPP_NORMAL);
     actions.oa.output.max_len = htons(0);
@@ -420,7 +420,7 @@ in_band_run(struct in_band *ib)
         a = &actions.oa;
         na = sizeof actions.oa / sizeof(union ofp_action);
     } else {
-        actions.nxsq.type = htons(OFPAT_VENDOR);
+        actions.nxsq.type = htons(OFPAT10_VENDOR);
         actions.nxsq.len = htons(sizeof actions.nxsq);
         actions.nxsq.vendor = htonl(NX_VENDOR_ID);
         actions.nxsq.subtype = htons(NXAST_SET_QUEUE);
index d8d1e38..fe10f12 100644 (file)
@@ -917,18 +917,18 @@ get_features(struct ofproto *ofproto_ OVS_UNUSED,
              bool *arp_match_ip, uint32_t *actions)
 {
     *arp_match_ip = true;
-    *actions = ((1u << OFPAT_OUTPUT) |
-                (1u << OFPAT_SET_VLAN_VID) |
-                (1u << OFPAT_SET_VLAN_PCP) |
-                (1u << OFPAT_STRIP_VLAN) |
-                (1u << OFPAT_SET_DL_SRC) |
-                (1u << OFPAT_SET_DL_DST) |
-                (1u << OFPAT_SET_NW_SRC) |
-                (1u << OFPAT_SET_NW_DST) |
-                (1u << OFPAT_SET_NW_TOS) |
-                (1u << OFPAT_SET_TP_SRC) |
-                (1u << OFPAT_SET_TP_DST) |
-                (1u << OFPAT_ENQUEUE));
+    *actions = ((1u << OFPAT10_OUTPUT) |
+                (1u << OFPAT10_SET_VLAN_VID) |
+                (1u << OFPAT10_SET_VLAN_PCP) |
+                (1u << OFPAT10_STRIP_VLAN) |
+                (1u << OFPAT10_SET_DL_SRC) |
+                (1u << OFPAT10_SET_DL_DST) |
+                (1u << OFPAT10_SET_NW_SRC) |
+                (1u << OFPAT10_SET_NW_DST) |
+                (1u << OFPAT10_SET_NW_TOS) |
+                (1u << OFPAT10_SET_TP_SRC) |
+                (1u << OFPAT10_SET_TP_DST) |
+                (1u << OFPAT10_ENQUEUE));
 }
 
 static void
@@ -4818,44 +4818,44 @@ do_xlate_actions(const union ofp_action *in, size_t n_in,
 
         code = ofputil_decode_action_unsafe(ia);
         switch (code) {
-        case OFPUTIL_OFPAT_OUTPUT:
+        case OFPUTIL_OFPAT10_OUTPUT:
             xlate_output_action(ctx, &ia->output);
             break;
 
-        case OFPUTIL_OFPAT_SET_VLAN_VID:
+        case OFPUTIL_OFPAT10_SET_VLAN_VID:
             ctx->flow.vlan_tci &= ~htons(VLAN_VID_MASK);
             ctx->flow.vlan_tci |= ia->vlan_vid.vlan_vid | htons(VLAN_CFI);
             break;
 
-        case OFPUTIL_OFPAT_SET_VLAN_PCP:
+        case OFPUTIL_OFPAT10_SET_VLAN_PCP:
             ctx->flow.vlan_tci &= ~htons(VLAN_PCP_MASK);
             ctx->flow.vlan_tci |= htons(
                 (ia->vlan_pcp.vlan_pcp << VLAN_PCP_SHIFT) | VLAN_CFI);
             break;
 
-        case OFPUTIL_OFPAT_STRIP_VLAN:
+        case OFPUTIL_OFPAT10_STRIP_VLAN:
             ctx->flow.vlan_tci = htons(0);
             break;
 
-        case OFPUTIL_OFPAT_SET_DL_SRC:
+        case OFPUTIL_OFPAT10_SET_DL_SRC:
             oada = ((struct ofp_action_dl_addr *) ia);
             memcpy(ctx->flow.dl_src, oada->dl_addr, ETH_ADDR_LEN);
             break;
 
-        case OFPUTIL_OFPAT_SET_DL_DST:
+        case OFPUTIL_OFPAT10_SET_DL_DST:
             oada = ((struct ofp_action_dl_addr *) ia);
             memcpy(ctx->flow.dl_dst, oada->dl_addr, ETH_ADDR_LEN);
             break;
 
-        case OFPUTIL_OFPAT_SET_NW_SRC:
+        case OFPUTIL_OFPAT10_SET_NW_SRC:
             ctx->flow.nw_src = ia->nw_addr.nw_addr;
             break;
 
-        case OFPUTIL_OFPAT_SET_NW_DST:
+        case OFPUTIL_OFPAT10_SET_NW_DST:
             ctx->flow.nw_dst = ia->nw_addr.nw_addr;
             break;
 
-        case OFPUTIL_OFPAT_SET_NW_TOS:
+        case OFPUTIL_OFPAT10_SET_NW_TOS:
             /* OpenFlow 1.0 only supports IPv4. */
             if (ctx->flow.dl_type == htons(ETH_TYPE_IP)) {
                 ctx->flow.nw_tos &= ~IP_DSCP_MASK;
@@ -4863,15 +4863,15 @@ do_xlate_actions(const union ofp_action *in, size_t n_in,
             }
             break;
 
-        case OFPUTIL_OFPAT_SET_TP_SRC:
+        case OFPUTIL_OFPAT10_SET_TP_SRC:
             ctx->flow.tp_src = ia->tp_port.tp_port;
             break;
 
-        case OFPUTIL_OFPAT_SET_TP_DST:
+        case OFPUTIL_OFPAT10_SET_TP_DST:
             ctx->flow.tp_dst = ia->tp_port.tp_port;
             break;
 
-        case OFPUTIL_OFPAT_ENQUEUE:
+        case OFPUTIL_OFPAT10_ENQUEUE:
             xlate_enqueue_action(ctx, (const struct ofp_action_enqueue *) ia);
             break;
 
index 0d10691..f9ed23e 100644 (file)
@@ -1864,7 +1864,7 @@ handle_features_request(struct ofconn *ofconn, const struct ofp_header *oh)
     uint32_t actions;
 
     ofproto->ofproto_class->get_features(ofproto, &arp_match_ip, &actions);
-    assert(actions & (1 << OFPAT_OUTPUT)); /* sanity check */
+    assert(actions & (1 << OFPAT10_OUTPUT)); /* sanity check */
 
     osf = make_openflow_xid(sizeof *osf, OFPT_FEATURES_REPLY, oh->xid, &buf);
     osf->datapath_id = htonll(ofproto->datapath_id);