Setting tag sliver-openvswitch-2.2.90-1
[sliver-openvswitch.git] / include / openflow / openflow-1.1.h
index 7c78c63..e3e2d39 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 The Board of Trustees of The Leland Stanford
  * Junior University
  *
  * We are making the OpenFlow specification and associated documentation
  * an OpenFlow 1.0 reserved port number to or from, respectively, the
  * corresponding OpenFlow 1.1 reserved port number.
  */
-#define OFPP11_MAX    0xffffff00
-#define OFPP11_OFFSET (OFPP11_MAX - OFPP_MAX)
+#define OFPP11_MAX    OFP11_PORT_C(0xffffff00)
+#define OFPP11_OFFSET 0xffff0000    /* OFPP11_MAX - OFPP_MAX */
+
+/* Reserved wildcard port used only for flow mod (delete) and flow stats
+ * requests. Selects all flows regardless of output port
+ * (including flows with no output port)
+ *
+ * Define it via OFPP_NONE (0xFFFF) so that OFPP_ANY is still an enum ofp_port
+ */
+#define OFPP_ANY OFPP_NONE
 
 /* OpenFlow 1.1 port config flags are just the common flags. */
 #define OFPPC11_ALL \
@@ -119,6 +127,7 @@ struct ofp11_port {
     ovs_be32 curr_speed;    /* Current port bitrate in kbps. */
     ovs_be32 max_speed;     /* Max port bitrate in kbps */
 };
+OFP_ASSERT(sizeof(struct ofp11_port) == 64);
 
 /* Modify behavior of the physical port */
 struct ofp11_port_mod {
@@ -141,8 +150,8 @@ OFP_ASSERT(sizeof(struct ofp11_port_mod) == 32);
 
 /* Group setup and teardown (controller -> datapath). */
 struct ofp11_group_mod {
-    ovs_be16 command;             /* One of OFPGC_*. */
-    uint8_t type;                 /* One of OFPGT_*. */
+    ovs_be16 command;             /* One of OFPGC11_*. */
+    uint8_t type;                 /* One of OFPGT11_*. */
     uint8_t pad;                  /* Pad to 64 bits. */
     ovs_be32 group_id;            /* Group identifier. */
     /* struct ofp11_bucket buckets[0]; The bucket length is inferred from the
@@ -195,8 +204,8 @@ enum ofp11_action_type {
 
     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_PUSH_MPLS,        /* Push a new MPLS Label Stack Entry */
+    OFPAT11_POP_MPLS,         /* Pop the outer MPLS Label Stack Entry */
     OFPAT11_SET_QUEUE,        /* Set queue id when outputting to a port */
     OFPAT11_GROUP,            /* Apply group. */
     OFPAT11_SET_NW_TTL,       /* IP TTL. */
@@ -281,6 +290,10 @@ enum ofp11_instruction_type {
     OFPIT11_EXPERIMENTER = 0xFFFF  /* Experimenter instruction */
 };
 
+#define OFPIT11_ALL (OFPIT11_GOTO_TABLE | OFPIT11_WRITE_METADATA |      \
+                     OFPIT11_WRITE_ACTIONS | OFPIT11_APPLY_ACTIONS |    \
+                     OFPIT11_CLEAR_ACTIONS)
+
 #define OFP11_INSTRUCTION_ALIGN 8
 
 /* Generic ofp_instruction structure. */
@@ -430,18 +443,6 @@ struct ofp11_table_mod {
 };
 OFP_ASSERT(sizeof(struct ofp11_table_mod) == 8);
 
-/* Flags to indicate behavior of the flow table for unmatched packets.
-   These flags are used in ofp_table_stats messages to describe the current
-   configuration and in ofp_table_mod messages to configure table behavior.  */
-enum ofp11_table_config {
-    OFPTC11_TABLE_MISS_CONTROLLER = 0,    /* Send to controller. */
-    OFPTC11_TABLE_MISS_CONTINUE = 1 << 0, /* Continue to the next table in the
-                                             pipeline (OpenFlow 1.0
-                                             behavior). */
-    OFPTC11_TABLE_MISS_DROP = 1 << 1,     /* Drop the packet. */
-    OFPTC11_TABLE_MISS_MASK = 3
-};
-
 /* Flow setup and teardown (controller -> datapath). */
 struct ofp11_flow_mod {
     ovs_be64 cookie;             /* Opaque controller-issued identifier. */
@@ -467,8 +468,8 @@ struct ofp11_flow_mod {
                                     indicates no restriction. */
     ovs_be16 flags;              /* One of OFPFF_*. */
     uint8_t pad[2];
-    /* Open Flow version specific match */
-    /* struct ofp_instruction instructions[0];  Instruction set */
+    /* Followed by an ofp11_match structure. */
+    /* Followed by an instruction set. */
 };
 OFP_ASSERT(sizeof(struct ofp11_flow_mod) == 40);
 
@@ -528,7 +529,7 @@ struct ofp11_stats_msg {
     ovs_be16 type;              /* One of the OFPST_* constants. */
     ovs_be16 flags;             /* OFPSF_REQ_* flags (none yet defined). */
     uint8_t pad[4];
-    /* uint8_t body[0];             Body of the request. */
+    /* Followed by the body of the request. */
 };
 OFP_ASSERT(sizeof(struct ofp11_stats_msg) == 16);
 
@@ -560,9 +561,9 @@ struct ofp11_flow_stats_request {
     ovs_be64 cookie_mask;     /* Mask used to restrict the cookie bits that
                                  must match. A value of 0 indicates
                                  no restriction. */
-    struct ofp11_match match; /* Fields to match. */
+    /* Followed by an ofp11_match structure. */
 };
-OFP_ASSERT(sizeof(struct ofp11_flow_stats_request) == 120);
+OFP_ASSERT(sizeof(struct ofp11_flow_stats_request) == 32);
 
 /* Body of reply to OFPST_FLOW request. */
 struct ofp11_flow_stats {
@@ -576,7 +577,8 @@ struct ofp11_flow_stats {
                                   when this is not an exact-match entry. */
     ovs_be16 idle_timeout;     /* Number of seconds idle before expiration. */
     ovs_be16 hard_timeout;     /* Number of seconds before expiration. */
-    uint8_t pad2[6];           /* Align to 64-bits. */
+    ovs_be16 flags;            /* OF 1.3: Set of OFPFF*. */
+    uint8_t  pad2[4];          /* Align to 64-bits. */
     ovs_be64 cookie;           /* Opaque controller-issued identifier. */
     ovs_be64 packet_count;     /* Number of packets in flow. */
     ovs_be64 byte_count;       /* Number of bytes in flow. */
@@ -588,6 +590,26 @@ OFP_ASSERT(sizeof(struct ofp11_flow_stats) == 48);
 /* Body for ofp_stats_request of type OFPST_AGGREGATE. */
 /* Identical to ofp11_flow_stats_request */
 
+/* Flow match fields. */
+enum ofp11_flow_match_fields {
+    OFPFMF11_IN_PORT     = 1 << 0,  /* Switch input port. */
+    OFPFMF11_DL_VLAN     = 1 << 1,  /* VLAN id. */
+    OFPFMF11_DL_VLAN_PCP = 1 << 2,  /* VLAN priority. */
+    OFPFMF11_DL_TYPE     = 1 << 3,  /* Ethernet frame type. */
+    OFPFMF11_NW_TOS      = 1 << 4,  /* IP ToS (DSCP field, 6 bits). */
+    OFPFMF11_NW_PROTO    = 1 << 5,  /* IP protocol. */
+    OFPFMF11_TP_SRC      = 1 << 6,  /* TCP/UDP/SCTP source port. */
+    OFPFMF11_TP_DST      = 1 << 7,  /* TCP/UDP/SCTP destination port. */
+    OFPFMF11_MPLS_LABEL  = 1 << 8,  /* MPLS label. */
+    OFPFMF11_MPLS_TC     = 1 << 9,  /* MPLS TC. */
+    OFPFMF11_TYPE        = 1 << 10, /* Match type. */
+    OFPFMF11_DL_SRC      = 1 << 11, /* Ethernet source address. */
+    OFPFMF11_DL_DST      = 1 << 12, /* Ethernet destination address. */
+    OFPFMF11_NW_SRC      = 1 << 13, /* IP source address. */
+    OFPFMF11_NW_DST      = 1 << 14, /* IP destination address. */
+    OFPFMF11_METADATA    = 1 << 15, /* Metadata passed between tables. */
+};
+
 /* Body of reply to OFPST_TABLE request. */
 struct ofp11_table_stats {
     uint8_t table_id;        /* Identifier of table. Lower numbered tables
@@ -666,6 +688,13 @@ struct ofp11_group_stats_request {
 };
 OFP_ASSERT(sizeof(struct ofp11_group_stats_request) == 8);
 
+/* Used in group stats replies. */
+struct ofp11_bucket_counter {
+    ovs_be64 packet_count;   /* Number of packets processed by bucket. */
+    ovs_be64 byte_count;     /* Number of bytes processed by bucket. */
+};
+OFP_ASSERT(sizeof(struct ofp11_bucket_counter) == 16);
+
 /* Body of reply to OFPST11_GROUP request */
 struct ofp11_group_stats {
     ovs_be16 length;           /* Length of this entry. */
@@ -676,22 +705,14 @@ struct ofp11_group_stats {
     uint8_t pad2[4];           /* Align to 64 bits. */
     ovs_be64 packet_count;     /* Number of packets processed by group. */
     ovs_be64 byte_count;       /* Number of bytes processed by group. */
-    /* struct ofp11_bucket_counter bucket_stats[0]; */
-
+    struct ofp11_bucket_counter bucket_stats[0];
 };
 OFP_ASSERT(sizeof(struct ofp11_group_stats) == 32);
 
-/* Used in group stats replies. */
-struct ofp11_bucket_counter {
-    ovs_be64 packet_count;   /* Number of packets processed by bucket. */
-    ovs_be64 byte_count;     /* Number of bytes processed by bucket. */
-};
-OFP_ASSERT(sizeof(struct ofp11_bucket_counter) == 16);
-
 /* Body of reply to OFPST11_GROUP_DESC request. */
 struct ofp11_group_desc_stats {
     ovs_be16 length;            /* Length of this entry. */
-    uint8_t type;               /* One of OFPGT_*. */
+    uint8_t type;               /* One of OFPGT11_*. */
     uint8_t pad;                /* Pad to 64 bits. */
     ovs_be32 group_id;          /* Group identifier. */
     /* struct ofp11_bucket buckets[0]; */
@@ -719,12 +740,7 @@ struct ofp11_packet_in {
     ovs_be16 total_len;     /* Full length of frame. */
     uint8_t reason;         /* Reason packet is being sent (one of OFPR_*) */
     uint8_t table_id;       /* ID of the table that was looked up */
-    uint8_t data[0];        /* Ethernet frame, halfway through 32-bit word,
-                               so the IP header is 32-bit aligned. The
-                               amount of data is inferred from the length
-                               field in the header. Because of padding,
-                               offsetof(struct ofp_packet_in, data) ==
-                               sizeof(struct ofp_packet_in) - 2. */
+    /* Followed by Ethernet frame. */
 };
 OFP_ASSERT(sizeof(struct ofp11_packet_in) == 16);
 
@@ -743,8 +759,8 @@ struct ofp11_flow_removed {
     uint8_t pad2[2];          /* Align to 64-bits. */
     ovs_be64 packet_count;
     ovs_be64 byte_count;
-    struct ofp11_match match; /* Description of fields. */
+    /* Followed by an ofp11_match structure. */
 };
-OFP_ASSERT(sizeof(struct ofp11_flow_removed) == 128);
+OFP_ASSERT(sizeof(struct ofp11_flow_removed) == 40);
 
 #endif /* openflow/openflow-1.1.h */