[ovs-dev] [PATCH 5/6] Add some missing Open Flow 1.1 definitions

Simon Horman horms at verge.net.au
Fri Mar 30 02:30:00 UTC 2012


Signed-off-by: Simon Horman <horms at verge.net.au>

---
v4
As suggested by Ben Pfaff
* Rename ofp11_match_type as ofp_match_type.
  It will also be used by Open Flow 1.2 as
  no values have been removed or had their meaning changed
  between Open Flow 1.1 and 1.2.
* Add ofp11_port_stats_request.
* Consolidate ofp11_flow_removed_reason into ofp_flow_removed_reason
* Consolidate ofp11_stats_request and ofp11_stats_reply into ofp11_stats_msg
* In the case of stats messages that are of fixed length,
  embed a ofp11_stats_msg structure in the message's structure.
  This is in keeping with the treatment of similar
  Open Flow 1.0 messages
* Use ovs_be16 in place of uint16_t
* Use ovs_be64 in place of uint64_t
* Remove ofp11_aggregate_stats_request,
  it is identical to ofp11_flow_stats_request
* Remove ofp11_match from ofp11_flow_mod and ofp11_flow_stats.
  This allows these structures to be used for both Open Flow 1.1 and 1.2
  by appending an Open Flow version specific match structure
* Add ofp11_match_header which contains the common
  head of the Open Flow 1.1 and 1.2 match structures.

v3
* No change

v2
* Initial Post
---
 include/openflow/openflow-1.1.h    |  541 ++++++++++++++++++++++++++++++++++++
 include/openflow/openflow-common.h |   15 +-
 2 files changed, 555 insertions(+), 1 deletions(-)

diff --git a/include/openflow/openflow-1.1.h b/include/openflow/openflow-1.1.h
index d02ece3..c1f5d64 100644
--- a/include/openflow/openflow-1.1.h
+++ b/include/openflow/openflow-1.1.h
@@ -163,6 +163,35 @@ struct ofp11_port_mod {
 };
 OFP_ASSERT(sizeof(struct ofp11_port_mod) == 40);
 
+/* Group setup and teardown (controller -> datapath). */
+struct ofp11_group_mod {
+    struct ofp_header header;
+    ovs_be16 command;             /* One of OFPGC_*. */
+    uint8_t type;                 /* One of OFPGT_*. */
+    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
+                                       length field in the header. */
+};
+OFP_ASSERT(sizeof(struct ofp11_group_mod) == 16);
+
+/* Query for port queue configuration. */
+struct ofp11_queue_get_config_request {
+    struct ofp_header header;
+    ovs_be32 port;
+    /* Port to be queried. Should refer
+       to a valid physical port (i.e. < OFPP_MAX) */
+    uint8_t pad[4];
+};
+OFP_ASSERT(sizeof(struct ofp11_queue_get_config_request) == 16);
+
+/* Group commands */
+enum ofp11_group_mod_command {
+    OFPGC11_ADD,          /* New group. */
+    OFPGC11_MODIFY,       /* Modify all matching groups. */
+    OFPGC11_DELETE,       /* Delete all matching groups. */
+};
+
 /* OpenFlow 1.1 specific capabilities supported by the datapath (struct
  * ofp_switch_features, member capabilities). */
 enum ofp11_capabilities {
@@ -201,4 +230,516 @@ enum ofp11_action_type {
     OFPAT11_EXPERIMENTER = 0xffff
 };
 
+#define OFPMT11_STANDARD_LENGTH 88
+
+struct ofp11_match_header {
+    ovs_be16 type;             /* One of OFPMT_* */
+    ovs_be16 length;           /* Length of match */
+};
+OFP_ASSERT(sizeof(struct ofp11_match_header) == 4);
+
+/* Fields to match against flows */
+struct ofp11_match {
+    struct ofp11_match_header omh;
+    ovs_be32 in_port;          /* Input switch port. */
+    ovs_be32 wildcards;        /* Wildcard fields. */
+    uint8_t dl_src[OFP_ETH_ALEN]; /* Ethernet source address. */
+    uint8_t dl_src_mask[OFP_ETH_ALEN]; /* Ethernet source address mask.  */
+    uint8_t dl_dst[OFP_ETH_ALEN]; /* Ethernet destination address. */
+    uint8_t dl_dst_mask[OFP_ETH_ALEN]; /* Ethernet destination address mask. */
+    ovs_be16 dl_vlan;          /* Input VLAN id. */
+    uint8_t dl_vlan_pcp;       /* Input VLAN priority. */
+    uint8_t pad1[1];           /* Align to 32-bits */
+    ovs_be16 dl_type;          /* Ethernet frame type. */
+    uint8_t nw_tos;            /* IP ToS (actually DSCP field, 6 bits). */
+    uint8_t nw_proto;          /* IP protocol or lower 8 bits of ARP opcode. */
+    ovs_be32 nw_src;           /* IP source address. */
+    ovs_be32 nw_src_mask;      /* IP source address mask. */
+    ovs_be32 nw_dst;           /* IP destination address. */
+    ovs_be32 nw_dst_mask;      /* IP destination address mask. */
+    ovs_be16 tp_src;           /* TCP/UDP/SCTP source port. */
+    ovs_be16 tp_dst;           /* TCP/UDP/SCTP destination port. */
+    ovs_be32 mpls_label;       /* MPLS label. */
+    uint8_t mpls_tc;           /* MPLS TC. */
+    uint8_t pad2[3];           /* Align to 64-bits */
+    ovs_be64 metadata;         /* Metadata passed between tables. */
+    ovs_be64 metadata_mask;    /* Mask for metadata. */
+};
+OFP_ASSERT(sizeof(struct ofp11_match) == OFPMT11_STANDARD_LENGTH);
+
+/* Flow wildcards. */
+enum ofp11_flow_wildcards {
+    OFPFW11_IN_PORT    = 1 << 0,  /* Switch input port. */
+    OFPFW11_DL_VLAN    = 1 << 1,  /* VLAN vid. */
+    OFPFW11_DL_SRC     = 1 << 2,  /* Ethernet source address. */
+    OFPFW11_DL_DST     = 1 << 3,  /* Ethernet destination address. */
+    OFPFW11_DL_TYPE    = 1 << 4,  /* Ethernet frame type. */
+    OFPFW11_NW_PROTO   = 1 << 5,  /* IP protocol. */
+    OFPFW11_TP_SRC     = 1 << 6,  /* TCP/UDP source port. */
+    OFPFW11_TP_DST     = 1 << 7,  /* TCP/UDP destination port. */
+    OFPFW11_MPLS_LABEL = 1 << 8,  /* MPLS label. */
+    OFPFW11_MPLS_TC    = 1 << 9,  /* MPLS TC. */
+
+    /* Wildcard all fields. */
+    OFPFW11_ALL = ((1 << 10) - 1)
+};
+
+/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate
+ * special conditions.
+ */
+enum ofp11_vlan_id {
+    OFPVID11_ANY = 0xfffe,  /* Indicate that a VLAN id is set but don't care
+                               about it's value. Note: only valid when
+                               specifying the VLAN id in a match */
+    OFPVID11_NONE = 0xffff, /* No VLAN id was set. */
+};
+
+enum ofp11_instruction_type {
+    OFPIT11_GOTO_TABLE = 1,        /* Setup the next table in the lookup
+                                      pipeline */
+    OFPIT11_WRITE_METADATA = 2,    /* Setup the metadata field for use later
+                                      in pipeline */
+    OFPIT11_WRITE_ACTIONS = 3,     /* Write the action(s) onto the datapath
+                                      action set */
+    OFPIT11_APPLY_ACTIONS = 4,     /* Applies the action(s) immediately */
+    OFPIT11_CLEAR_ACTIONS = 5,     /* Clears all actions from the datapath
+                                      action set */
+    OFPIT11_EXPERIMENTER = 0xFFFF  /* Experimenter instruction */
+};
+
+/* Instruction structure for OFPIT_GOTO_TABLE */
+struct ofp11_instruction_goto_table {
+    ovs_be16 type;                 /* OFPIT_GOTO_TABLE */
+    ovs_be16 len;                  /* Length of this struct in bytes. */
+    uint8_t table_id;              /* Set next table in the lookup pipeline */
+    uint8_t pad[3];                /* Pad to 64 bits. */
+};
+OFP_ASSERT(sizeof(struct ofp11_instruction_goto_table) == 8);
+
+/* Instruction structure for OFPIT_WRITE_METADATA */
+struct ofp11_instruction_write_metadata {
+    ovs_be16 type;              /* OFPIT_WRITE_METADATA */
+    ovs_be16 len;               /* Length of this struct in bytes. */
+    uint8_t pad[4];             /* Align to 64-bits */
+    ovs_be64 metadata;          /* Metadata value to write */
+    ovs_be64 metadata_mask;     /* Metadata write bitmask */
+};
+OFP_ASSERT(sizeof(struct ofp11_instruction_write_metadata) == 24);
+
+/* Instruction structure for OFPIT_WRITE/APPLY/CLEAR_ACTIONS */
+struct ofp11_instruction_actions {
+    ovs_be16 type;              /* One of OFPIT_*_ACTIONS */
+    ovs_be16 len;               /* Length of this struct in bytes. */
+    uint8_t pad[4];             /* Align to 64-bits */
+    /* struct ofp_action_header actions[0];  Actions associated with
+                                             OFPIT_WRITE_ACTIONS and
+                                             OFPIT_APPLY_ACTIONS */
+};
+OFP_ASSERT(sizeof(struct ofp11_instruction_actions) == 8);
+
+/* Action structure for OFPAT_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 ofp11_action_output {
+    ovs_be16 type;                    /* OFPAT11_OUTPUT. */
+    ovs_be16 len;                     /* Length is 16. */
+    ovs_be32 port;                    /* Output port. */
+    ovs_be16 max_len;                 /* Max length to send to controller. */
+    uint8_t pad[6];                   /* Pad to 64 bits. */
+};
+OFP_ASSERT(sizeof(struct ofp11_action_output) == 16);
+
+/* Action structure for OFPAT_GROUP. */
+struct ofp11_action_group {
+    ovs_be16 type;                    /* OFPAT11_GROUP. */
+    ovs_be16 len;                     /* Length is 8. */
+    ovs_be32 group_id;                /* Group identifier. */
+};
+OFP_ASSERT(sizeof(struct ofp11_action_group) == 8);
+
+/* OFPAT_SET_QUEUE action struct: send packets to given queue on port. */
+struct ofp11_action_set_queue {
+    ovs_be16 type;                    /* OFPAT11_SET_QUEUE. */
+    ovs_be16 len;                     /* Len is 8. */
+    ovs_be32 queue_id;                /* Queue id for the packets. */
+};
+OFP_ASSERT(sizeof(struct ofp11_action_set_queue) == 8);
+
+/* Action structure for OFPAT11_SET_MPLS_LABEL. */
+struct ofp11_action_mpls_label {
+    ovs_be16 type;                    /* OFPAT11_SET_MPLS_LABEL. */
+    ovs_be16 len;                     /* Length is 8. */
+    ovs_be32 mpls_label;              /* MPLS label */
+};
+OFP_ASSERT(sizeof(struct ofp11_action_mpls_label) == 8);
+
+/* Action structure for OFPAT11_SET_MPLS_TC. */
+struct ofp11_action_mpls_tc {
+    ovs_be16 type;                    /* OFPAT11_SET_MPLS_TC. */
+    ovs_be16 len;                     /* Length is 8. */
+    uint8_t mpls_tc;                  /* MPLS TC */
+    uint8_t pad[3];
+};
+OFP_ASSERT(sizeof(struct ofp11_action_mpls_tc) == 8);
+
+/* Action structure for OFPAT11_SET_MPLS_TTL. */
+struct ofp11_action_mpls_ttl {
+    ovs_be16 type;                    /* OFPAT11_SET_MPLS_TTL. */
+    ovs_be16 len;                     /* Length is 8. */
+    uint8_t mpls_ttl;                 /* MPLS TTL */
+    uint8_t pad[3];
+};
+OFP_ASSERT(sizeof(struct ofp11_action_mpls_ttl) == 8);
+
+/* Action structure for OFPAT11_SET_NW_ECN. */
+struct ofp11_action_nw_ecn {
+    ovs_be16 type;                    /* OFPAT11_SET_TW_SRC/DST. */
+    ovs_be16 len;                     /* Length is 8. */
+    uint8_t nw_ecn;                   /* IP ECN (2 bits). */
+    uint8_t pad[3];
+};
+OFP_ASSERT(sizeof(struct ofp11_action_nw_ecn) == 8);
+
+/* Action structure for OFPAT11_SET_NW_TTL. */
+struct ofp11_action_nw_ttl {
+    ovs_be16 type;                    /* OFPAT11_SET_NW_TTL. */
+    ovs_be16 len;                     /* Length is 8. */
+    uint8_t nw_ttl;                   /* IP TTL */
+    uint8_t pad[3];
+};
+OFP_ASSERT(sizeof(struct ofp11_action_nw_ttl) == 8);
+
+/* Action structure for OFPAT11_PUSH_VLAN/MPLS. */
+struct ofp11_action_push {
+    ovs_be16 type;                    /* OFPAT11_PUSH_VLAN/MPLS. */
+    ovs_be16 len;                     /* Length is 8. */
+    ovs_be16 ethertype;               /* Ethertype */
+    uint8_t pad[2];
+};
+OFP_ASSERT(sizeof(struct ofp11_action_push) == 8);
+
+/* Action structure for OFPAT11_POP_MPLS. */
+struct ofp11_action_pop_mpls {
+    ovs_be16 type;                    /* OFPAT11_POP_MPLS. */
+    ovs_be16 len;                     /* Length is 8. */
+    ovs_be16 ethertype;               /* Ethertype */
+    uint8_t pad[2];
+};
+OFP_ASSERT(sizeof(struct ofp11_action_pop_mpls) == 8);
+
+/* Configure/Modify behavior of a flow table */
+struct ofp11_table_mod {
+    struct ofp_header header;
+    uint8_t table_id;       /* ID of the table, 0xFF indicates all tables */
+    uint8_t pad[3];         /* Pad to 32 bits */
+    ovs_be32 config;        /* Bitmap of OFPTC_* flags */
+};
+OFP_ASSERT(sizeof(struct ofp11_table_mod) == 16);
+
+/* 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 {
+    struct ofp_header header;
+    ovs_be64 cookie;             /* Opaque controller-issued identifier. */
+    ovs_be64 cookie_mask;        /* Mask used to restrict the cookie bits
+                                    that must match when the command is
+                                    OFPFC_MODIFY* or OFPFC_DELETE*. A value
+                                    of 0 indicates no restriction. */
+    /* Flow actions. */
+    uint8_t table_id;            /* ID of the table to put the flow in */
+    uint8_t command;             /* One of OFPFC_*. */
+    ovs_be16 idle_timeout;       /* Idle time before discarding (seconds). */
+    ovs_be16 hard_timeout;       /* Max time before discarding (seconds). */
+    ovs_be16 priority;           /* Priority level of flow entry. */
+    ovs_be32 buffer_id;          /* Buffered packet to apply to (or -1).
+                                    Not meaningful for OFPFC_DELETE*. */
+    ovs_be32 out_port;           /* For OFPFC_DELETE* commands, require
+                                    matching entries to include this as an
+                                    output port. A value of OFPP_ANY
+                                    indicates no restriction. */
+    ovs_be32 out_group;          /* For OFPFC_DELETE* commands, require
+                                    matching entries to include this as an
+                                    output group. A value of OFPG_ANY
+                                    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 */
+};
+OFP_ASSERT(sizeof(struct ofp11_flow_mod) == 48);
+
+/* Group types. Values in the range [128, 255] are reserved for experimental
+ * use. */
+enum ofp11_group_type {
+    OFPGT11_ALL,      /* All (multicast/broadcast) group. */
+    OFPGT11_SELECT,   /* Select group. */
+    OFPGT11_INDIRECT, /* Indirect group. */
+    OFPGT11_FF        /* Fast failover group. */
+};
+
+/* Bucket for use in groups. */
+struct ofp11_bucket {
+    ovs_be16 len;                    /* Length the bucket in bytes, including
+                                        this header and any padding to make it
+                                        64-bit aligned. */
+    ovs_be16 weight;                 /* Relative weight of bucket. Only
+                                        defined for select groups. */
+    ovs_be32 watch_port;             /* Port whose state affects whether this
+                                        bucket is live. Only required for fast
+                                        failover groups. */
+    ovs_be32 watch_group;            /* Group whose state affects whether this
+                                        bucket is live. Only required for fast
+                                        failover groups. */
+    uint8_t pad[4];
+    /* struct ofp_action_header actions[0]; The action length is inferred
+                                            from the length field in the
+                                            header. */
+};
+OFP_ASSERT(sizeof(struct ofp11_bucket) == 16);
+
+/* Queue configuration for a given port. */
+struct ofp11_queue_get_config_reply {
+    struct ofp_header header;
+    ovs_be32 port;
+    uint8_t pad[4];
+    /* struct ofp_packet_queue queues[0];  List of configured queues. */
+};
+OFP_ASSERT(sizeof(struct ofp11_queue_get_config_reply) == 16);
+
+struct ofp11_stats_msg {
+    struct ofp_header header;
+    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. */
+};
+OFP_ASSERT(sizeof(struct ofp11_stats_msg) == 16);
+
+/* Stats request of type OFPST_FLOW. */
+struct ofp11_flow_stats_request {
+    struct ofp11_stats_msg osm;
+    uint8_t table_id;         /* ID of table to read (from ofp_table_stats),
+                                 0xff for all tables. */
+    uint8_t pad[3];           /* Align to 64 bits. */
+    ovs_be32 out_port;        /* Require matching entries to include this
+                                 as an output port. A value of OFPP_ANY
+                                 indicates no restriction. */
+    ovs_be32 out_group;       /* Require matching entries to include this
+                                 as an output group. A value of OFPG_ANY
+                                 indicates no restriction. */
+    uint8_t pad2[4];          /* Align to 64 bits. */
+    ovs_be64 cookie;          /* Require matching entries to contain this
+                                 cookie value */
+    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. */
+};
+OFP_ASSERT(sizeof(struct ofp11_flow_stats_request) == 136);
+
+/* Body of reply to OFPST_FLOW request. */
+struct ofp11_flow_stats {
+    ovs_be16 length;           /* Length of this entry. */
+    uint8_t table_id;          /* ID of table flow came from. */
+    uint8_t pad;
+    ovs_be32 duration_sec;     /* Time flow has been alive in seconds. */
+    ovs_be32 duration_nsec;    /* Time flow has been alive in nanoseconds beyond
+                                  duration_sec. */
+    ovs_be16 priority;         /* Priority of the entry. Only meaningful
+                                  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_be64 cookie;           /* Opaque controller-issued identifier. */
+    ovs_be64 packet_count;     /* Number of packets in flow. */
+    ovs_be64 byte_count;       /* Number of bytes in flow. */
+    /* Open Flow version specific match */
+    /* struct ofp11_instruction instructions[0];  Instruction set. */
+};
+OFP_ASSERT(sizeof(struct ofp11_flow_stats) == 48);
+
+/* Body for ofp_stats_request of type OFPST_AGGREGATE. */
+/* Identical to ofp11_flow_stats_request */
+
+/* Body of reply to OFPST_TABLE request. */
+struct ofp11_table_stats {
+    struct ofp11_stats_msg osm;
+    uint8_t table_id;        /* Identifier of table. Lower numbered tables
+                                are consulted first. */
+    uint8_t pad[7];          /* Align to 64-bits. */
+    char name[OFP_MAX_TABLE_NAME_LEN];
+    ovs_be32 wildcards;      /* Bitmap of OFPFMF_* wildcards that are
+                                supported by the table. */
+    ovs_be32 match;          /* Bitmap of OFPFMF_* that indicate the fields
+                                the table can match on. */
+    ovs_be32 instructions;   /* Bitmap of OFPIT_* values supported. */
+    ovs_be32 write_actions;  /* Bitmap of OFPAT_* that are supported
+                                by the table with OFPIT_WRITE_ACTIONS.  */
+    ovs_be32 apply_actions;  /* Bitmap of OFPAT_* that are supported
+                                by the table with OFPIT_APPLY_ACTIONS. */
+    ovs_be32 config;         /* Bitmap of OFPTC_* values */
+    ovs_be32 max_entries;    /* Max number of entries supported. */
+    ovs_be32 active_count;   /* Number of active entries. */
+    ovs_be64 lookup_count;   /* Number of packets looked up in table. */
+    ovs_be64 matched_count;  /* Number of packets that hit table. */
+};
+OFP_ASSERT(sizeof(struct ofp11_table_stats) == 104);
+
+/* Body for ofp_stats_request of type OFPST_PORT. */
+struct ofp11_port_stats_request {
+    struct ofp11_stats_msg osm;
+    ovs_be32 port_no;        /* OFPST_PORT message must request statistics
+                              * either for a single port (specified in
+                              * port_no) or for all ports (if port_no ==
+                              * OFPP_ANY). */
+    uint8_t pad[4];
+};
+OFP_ASSERT(sizeof(struct ofp11_port_stats_request) == 24);
+
+/* Body of reply to OFPST_PORT request. If a counter is unsupported, set
+ * the field to all ones. */
+struct ofp11_port_stats {
+    struct ofp11_stats_msg osm;
+    ovs_be32 port_no;
+    uint8_t pad[4];           /* Align to 64-bits. */
+    ovs_be64 rx_packets;      /* Number of received packets. */
+    ovs_be64 tx_packets;      /* Number of transmitted packets. */
+    ovs_be64 rx_bytes;        /* Number of received bytes. */
+    ovs_be64 tx_bytes;        /* Number of transmitted bytes. */
+    ovs_be64 rx_dropped;      /* Number of packets dropped by RX. */
+    ovs_be64 tx_dropped;      /* Number of packets dropped by TX. */
+    ovs_be64 rx_errors;       /* Number of receive errors.  This is a
+                                 super-set of receive errors and should be
+                                 great than or equal to the sum of all
+                                 rx_*_err values. */
+    ovs_be64 tx_errors;       /* Number of transmit errors.  This is a
+                                 super-set of transmit errors. */
+    ovs_be64 rx_frame_err;    /* Number of frame alignment errors. */
+    ovs_be64 rx_over_err;     /* Number of packets with RX overrun. */
+    ovs_be64 rx_crc_err;      /* Number of CRC errors. */
+    ovs_be64 collisions;      /* Number of collisions. */
+};
+OFP_ASSERT(sizeof(struct ofp11_port_stats) == 120);
+
+struct ofp11_queue_stats_request {
+    struct ofp11_stats_msg osm;
+    ovs_be32 port_no;         /* All ports if OFPP_ANY. */
+    ovs_be32 queue_id;        /* All queues if OFPQ_ALL. */
+};
+OFP_ASSERT(sizeof(struct ofp11_queue_stats_request) == 24);
+
+struct ofp11_queue_stats {
+    struct ofp11_stats_msg osm;
+    ovs_be32 port_no;
+    ovs_be32 queue_id;         /* Queue id. */
+    ovs_be64 tx_bytes;         /* Number of transmitted bytes. */
+    ovs_be64 tx_packets;       /* Number of transmitted packets. */
+    ovs_be64 tx_errors;        /* # of packets dropped due to overrun. */
+};
+OFP_ASSERT(sizeof(struct ofp11_queue_stats) == 48);
+
+struct ofp11_group_stats_request {
+    struct ofp11_stats_msg osm;
+    ovs_be32 group_id;         /* All groups if OFPG_ALL. */
+    uint8_t pad[4];            /* Align to 64 bits. */
+};
+OFP_ASSERT(sizeof(struct ofp11_group_stats_request) == 24);
+
+/* Body of reply to OFPST11_GROUP request */
+struct ofp11_group_stats {
+    ovs_be16 length;           /* Length of this entry. */
+    uint8_t pad[2];            /* Align to 64 bits. */
+    ovs_be32 group_id;         /* Group identifier. */
+    ovs_be32 ref_count;        /* Number of flows or groups that
+                                  directly forward to this group. */
+    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]; */
+
+};
+OFP_ASSERT(sizeof(struct ofp11_group_stats) == 32);
+
+/* Used in group stats replies. */
+struct ofp11_bucket_counter {
+    struct ofp11_stats_msg osm;
+    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) == 32);
+
+/* 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 pad;                /* Pad to 64 bits. */
+    ovs_be32 group_id;          /* Group identifier. */
+    /* struct ofp11_bucket buckets[0]; */
+};
+OFP_ASSERT(sizeof(struct ofp11_group_desc_stats) == 8);
+
+/* Send packet (controller -> datapath). */
+struct ofp11_packet_out {
+    struct ofp_header header;
+    ovs_be32 buffer_id;       /* ID assigned by datapath (-1 if none). */
+    ovs_be32 in_port;         /* Packet's input port or OFPP_CONTROLLER. */
+    ovs_be16 actions_len;     /* Size of action array in bytes. */
+    uint8_t pad[6];
+    /* struct ofp_action_header actions[0];  Action list. */
+    /* uint8_t data[0]; */    /* Packet data. The length is inferred
+                                 from the length field in the header.
+                                 (Only meaningful if buffer_id == -1.) */
+};
+OFP_ASSERT(sizeof(struct ofp11_packet_out) == 24);
+
+/* Packet received on port (datapath -> controller). */
+struct ofp11_packet_in {
+    struct ofp_header header;
+    ovs_be32 buffer_id;     /* ID assigned by datapath. */
+    ovs_be32 in_port;       /* Port on which frame was received. */
+    ovs_be32 in_phy_port;   /* Physical Port on which frame was received. */
+    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. */
+};
+OFP_ASSERT(sizeof(struct ofp11_packet_in) == 24);
+
+/* Flow removed (datapath -> controller). */
+struct ofp11_flow_removed {
+    struct ofp_header header;
+    ovs_be64 cookie;          /* Opaque controller-issued identifier. */
+
+    ovs_be16 priority;        /* Priority level of flow entry. */
+    uint8_t reason;           /* One of OFPRR_*. */
+    uint8_t table_id;         /* ID of the table */
+
+    ovs_be32 duration_sec;    /* Time flow was alive in seconds. */
+    ovs_be32 duration_nsec;   /* Time flow was alive in nanoseconds beyond
+                                 duration_sec. */
+    ovs_be16 idle_timeout;    /* Idle timeout from original flow mod. */
+    uint8_t pad2[2];          /* Align to 64-bits. */
+    ovs_be64 packet_count;
+    ovs_be64 byte_count;
+    struct ofp11_match match; /* Description of fields. */
+};
+OFP_ASSERT(sizeof(struct ofp11_flow_removed) == 136);
+
 #endif /* openflow/openflow-1.1.h */
diff --git a/include/openflow/openflow-common.h b/include/openflow/openflow-common.h
index f10862f..fd38b72 100644
--- a/include/openflow/openflow-common.h
+++ b/include/openflow/openflow-common.h
@@ -221,7 +221,8 @@ enum ofp_packet_in_reason {
 enum ofp_flow_removed_reason {
     OFPRR_IDLE_TIMEOUT,         /* Flow idle time exceeded idle_timeout. */
     OFPRR_HARD_TIMEOUT,         /* Time exceeded hard_timeout. */
-    OFPRR_DELETE                /* Evicted by a DELETE flow mod. */
+    OFPRR_DELETE,               /* Evicted by a DELETE flow mod. */
+    OFPRR_GROUP_DELETE          /* Group was removed. */
 };
 
 /* What changed about the physical port */
@@ -240,4 +241,16 @@ struct ofp_port_status {
 };
 OFP_ASSERT(sizeof(struct ofp_port_status) == 16);
 
+/* The match type indicates the match structure (set of fields that compose the
+ * match) in use. The match type is placed in the type field at the beginning
+ * of all match structures. The "OpenFlow Extensible Match" type corresponds
+ * to OXM TLV format described below and must be supported by all OpenFlow
+ * switches. Extensions that define other match types may be published on the
+ * ONF wiki. Support for extensions is optional.
+ */
+enum ofp_match_type {
+    OFPMT_STANDARD = 0,         /* The match fields defined in the ofp11_match
+                                   structure apply */
+};
+
 #endif /* openflow/openflow-common.h */
-- 
1.7.6.3




More information about the dev mailing list