ofp-actions: Centralize all OpenFlow action code for maintainability.
[cascardo/ovs.git] / include / openflow / openflow-1.2.h
index f6befdb..58be0b5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, 2012 The Board of Trustees of The Leland Stanford
+/* Copyright (c) 2008, 2011, 2012, 2013, 2014 The Board of Trustees of The Leland Stanford
  * Junior University
  *
  * We are making the OpenFlow specification and associated documentation
@@ -55,6 +55,9 @@
 
 #include "openflow/openflow-1.1.h"
 
+/* Error type for experimenter error messages. */
+#define OFPET12_EXPERIMENTER 0xffff
+
 /*
  * OXM Class IDs.
  * The high order bit differentiate reserved classes from member classes.
@@ -65,6 +68,7 @@ enum ofp12_oxm_class {
     OFPXMC12_NXM_0          = 0x0000, /* Backward compatibility with NXM */
     OFPXMC12_NXM_1          = 0x0001, /* Backward compatibility with NXM */
     OFPXMC12_OPENFLOW_BASIC = 0x8000, /* Basic class for OpenFlow */
+    OFPXMC15_PACKET_REGS    = 0x8001, /* Packet registers (pipeline fields). */
     OFPXMC12_EXPERIMENTER   = 0xffff, /* Experimenter class */
 };
 
@@ -107,11 +111,18 @@ enum oxm12_ofb_match_fields {
     OFPXMT12_OFB_MPLS_LABEL,     /* MPLS label. */
     OFPXMT12_OFB_MPLS_TC,        /* MPLS TC. */
 
-    /* End Marker */
-    OFPXMT12_OFB_MAX,
-};
+    /* Following added in OpenFlow 1.3 */
+    OFPXMT13_OFB_MPLS_BOS,       /* MPLS BoS bit. */
+    OFPXMT13_OFB_PBB_ISID,       /* PBB I-SID. */
+    OFPXMT13_OFB_TUNNEL_ID,      /* Logical Port Metadata */
+    OFPXMT13_OFB_IPV6_EXTHDR,    /* IPv6 Extension Header pseudo-field */
 
-#define OFPXMT12_MASK ((1ULL << OFPXMT12_OFB_MAX) - 1)
+    /* Following added in OpenFlow 1.4. */
+    OFPXMT14_OFB_PBB_UCA = 41,  /* PBB UCA header field. */
+
+    /* Following added in OpenFlow 1.5. */
+    OFPXMT15_OFB_TCP_FLAGS = 42,  /* TCP flags. */
+ };
 
 /* OXM implementation makes use of NXM as they are the same format
  * with different field definitions
@@ -172,6 +183,19 @@ enum oxm12_ofb_match_fields {
 #define OXM_OF_IPV6_ND_TLL    OXM_HEADER   (OFPXMT12_OFB_IPV6_ND_TLL, 6)
 #define OXM_OF_MPLS_LABEL     OXM_HEADER   (OFPXMT12_OFB_MPLS_LABEL, 4)
 #define OXM_OF_MPLS_TC        OXM_HEADER   (OFPXMT12_OFB_MPLS_TC, 1)
+#define OXM_OF_MPLS_BOS       OXM_HEADER   (OFPXMT13_OFB_MPLS_BOS, 1)
+#define OXM_OF_PBB_ISID       OXM_HEADER   (OFPXMT12_OFB_PBB_ISID, 3)
+#define OXM_OF_PBB_ISID_W     OXM_HEADER_W (OFPXMT12_OFB_PBB_ISID, 3)
+#define OXM_OF_TUNNEL_ID      OXM_HEADER   (OFPXMT13_OFB_TUNNEL_ID, 8)
+#define OXM_OF_TUNNEL_ID_W    OXM_HEADER_W (OFPXMT13_OFB_TUNNEL_ID, 8)
+#define OXM_OF_IPV6_EXTHDR    OXM_HEADER   (OFPXMT13_OFB_IPV6_EXTHDR, 2)
+#define OXM_OF_IPV6_EXTHDR_W  OXM_HEADER_W (OFPXMT13_OFB_IPV6_EXTHDR, 2)
+#define OXM_OF_PBB_UCA        OXM_HEADER   (OFPXMT14_OFB_PBB_UCA, 1)
+#define OXM_OF_TCP_FLAGS      OXM_HEADER   (OFPXMT15_OFB_TCP_FLAGS, 2)
+#define OXM_OF_TCP_FLAGS_W    OXM_HEADER_W (OFPXMT15_OFB_TCP_FLAGS, 2)
+
+#define OXM_OF_PKT_REG(N)    (NXM_HEADER  (OFPXMC15_PACKET_REGS, N, 8))
+#define OXM_OF_PKT_REG_W(N)  (NXM_HEADER_W(OFPXMC15_PACKET_REGS, N, 8))
 
 /* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate
  * special conditions.
@@ -181,6 +205,19 @@ enum ofp12_vlan_id {
     OFPVID12_NONE    = 0x0000, /* No VLAN id was set. */
 };
 
+/* Bit definitions for IPv6 Extension Header pseudo-field. */
+enum ofp12_ipv6exthdr_flags {
+    OFPIEH12_NONEXT = 1 << 0,   /* "No next header" encountered. */
+    OFPIEH12_ESP    = 1 << 1,   /* Encrypted Sec Payload header present. */
+    OFPIEH12_AUTH   = 1 << 2,   /* Authentication header present. */
+    OFPIEH12_DEST   = 1 << 3,   /* 1 or 2 dest headers present. */
+    OFPIEH12_FRAG   = 1 << 4,   /* Fragment header present. */
+    OFPIEH12_ROUTER = 1 << 5,   /* Router header present. */
+    OFPIEH12_HOP    = 1 << 6,   /* Hop-by-hop header present. */
+    OFPIEH12_UNREP  = 1 << 7,   /* Unexpected repeats encountered. */
+    OFPIEH12_UNSEQ  = 1 << 8    /* Unexpected sequencing encountered. */
+};
+
 /* Header for OXM experimenter match fields. */
 struct ofp12_oxm_experimenter_header {
     ovs_be32 oxm_header;   /* oxm_class = OFPXMC_EXPERIMENTER */
@@ -189,26 +226,6 @@ struct ofp12_oxm_experimenter_header {
 };
 OFP_ASSERT(sizeof(struct ofp12_oxm_experimenter_header) == 8);
 
-enum ofp12_action_type {
-    OFPAT12_OUTPUT       = 0,  /* Output to switch port. */
-    OFPAT12_COPY_TTL_OUT = 11, /* Copy TTL "outwards" -- from next-to-outermost
-                                  to outermost */
-    OFPAT12_COPY_TTL_IN,       /* Copy TTL "inwards" -- from outermost to
-                                  next-to-outermost */
-    OFPAT12_SET_MPLS_TTL = 15, /* MPLS TTL */
-    OFPAT12_DEC_MPLS_TTL,      /* Decrement MPLS TTL */
-    OFPAT12_PUSH_VLAN,         /* Push a new VLAN tag */
-    OFPAT12_POP_VLAN,          /* Pop the outer VLAN tag */
-    OFPAT12_PUSH_MPLS,         /* Push a new MPLS tag */
-    OFPAT12_POP_MPLS,          /* Pop the outer MPLS tag */
-    OFPAT12_SET_QUEUE,         /* Set queue id when outputting to a port */
-    OFPAT12_GROUP,             /* Apply group. */
-    OFPAT12_SET_NW_TTL,        /* IP TTL. */
-    OFPAT12_DEC_NW_TTL,        /* Decrement IP TTL. */
-    OFPAT12_SET_FIELD,         /* Set a header field using OXM TLV format. */
-    OFPAT12_EXPERIMENTER = 0xffff
-};
-
 enum ofp12_controller_max_len {
     OFPCML12_MAX       = 0xffe5, /* maximum max_len value which can be used
                                   * to request a specific byte length. */
@@ -217,18 +234,6 @@ enum ofp12_controller_max_len {
                                   * sent to the controller. */
 };
 
-/* Action structure for OFPAT12_SET_FIELD. */
-struct ofp12_action_set_field {
-    ovs_be16 type;                  /* OFPAT12_SET_FIELD. */
-    ovs_be16 len;                   /* Length is padded to 64 bits. */
-    ovs_be32 dst;                   /* OXM TLV header */
-    /* Followed by:
-     * - Exactly ((oxm_len + 4) + 7)/8*8 - (oxm_len + 4) (between 0 and 7)
-     *   bytes of all-zero bytes
-     */
-};
-OFP_ASSERT(sizeof(struct ofp12_action_set_field) == 8);
-
 /* OpenFlow 1.2 specific flags
  * (struct ofp12_flow_mod, member flags). */
 enum ofp12_flow_mod_flags {
@@ -241,22 +246,16 @@ enum ofp12_capabilities {
     OFPC12_PORT_BLOCKED   = 1 << 8   /* Switch will block looping ports. */
 };
 
-/* OpenFlow 1.2 specific types
- * (struct ofp11_stats_request/reply, member type). */
-enum ofp12_stats_types {
-    /* Group features.
-     * The request body is empty.
-     * The reply body is struct ofp12_group_features_stats. */
-    OFPST12_GROUP_FEATURES = 8
-};
-
-/* OpenFlow 1.2 specific properties
- * (struct ofp_queue_prop_header member property). */
-enum ofp12_queue_properties {
-    OFPQT12_MIN_RATE = 1,         /* Minimum datarate guaranteed. */
-    OFPQT12_MAX_RATE = 2,         /* Maximum datarate. */
-    OFPQT12_EXPERIMENTER = 0xffff /* Experimenter defined property. */
+/* Full description for a queue. */
+struct ofp12_packet_queue {
+    ovs_be32 queue_id;     /* id for the specific queue. */
+    ovs_be32 port;         /* Port this queue is attached to. */
+    ovs_be16 len;          /* Length in bytes of this queue desc. */
+    uint8_t pad[6];        /* 64-bit alignment. */
+    /* Followed by any number of queue properties expressed using
+     * ofp_queue_prop_header, to fill out a total of 'len' bytes. */
 };
+OFP_ASSERT(sizeof(struct ofp12_packet_queue) == 16);
 
 /* Body of reply to OFPST_TABLE request. */
 struct ofp12_table_stats {
@@ -287,12 +286,20 @@ struct ofp12_table_stats {
 };
 OFP_ASSERT(sizeof(struct ofp12_table_stats) == 128);
 
+/* Number of types of groups supported by ofp12_group_features_stats. */
+#define OFPGT12_N_TYPES 4
+
 /* Body of reply to OFPST12_GROUP_FEATURES request. Group features. */
 struct ofp12_group_features_stats {
-    ovs_be32  types;           /* Bitmap of OFPGT_* values supported. */
+    ovs_be32  types;           /* Bitmap of OFPGT11_* values supported. */
     ovs_be32  capabilities;    /* Bitmap of OFPGFC12_* capability supported. */
-    ovs_be32  max_groups[4];   /* Maximum number of groups for each type. */
-    ovs_be32  actions[4];      /* Bitmaps of OFPAT_* that are supported. */
+
+    /* Each element in the following arrays corresponds to the group type with
+     * the same number, e.g. max_groups[0] is the maximum number of OFPGT11_ALL
+     * groups, actions[2] is the actions supported by OFPGT11_INDIRECT
+     * groups. */
+    ovs_be32  max_groups[OFPGT12_N_TYPES]; /* Max number of groups. */
+    ovs_be32  actions[OFPGT12_N_TYPES];    /* Bitmaps of supported OFPAT_*. */
 };
 OFP_ASSERT(sizeof(struct ofp12_group_features_stats) == 40);