Implement OFPT_TABLE_STATUS Message.
[cascardo/ovs.git] / include / openflow / openflow-1.4.h
index f7bdecb..4599f95 100644 (file)
@@ -37,7 +37,7 @@
 #ifndef OPENFLOW_14_H
 #define OPENFLOW_14_H 1
 
-#include "openflow/openflow-1.3.h"
+#include <openflow/openflow-1.3.h>
 
 
 /* ## ---------- ## */
@@ -72,7 +72,7 @@ struct ofp14_port {
     ovs_be32 port_no;
     ovs_be16 length;
     uint8_t pad[2];
-    uint8_t hw_addr[OFP_ETH_ALEN];
+    struct eth_addr hw_addr;
     uint8_t pad2[2];                  /* Align to 64 bits. */
     char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */
 
@@ -94,19 +94,10 @@ enum ofp14_port_mod_prop_type {
     OFPPMPT14_EXPERIMENTER      = 0xFFFF, /* Experimenter property. */
 };
 
-/* Ethernet port mod property. */
-struct ofp14_port_mod_prop_ethernet {
-    ovs_be16      type;       /* OFPPMPT14_ETHERNET. */
-    ovs_be16      length;     /* Length in bytes of this property. */
-    ovs_be32      advertise;  /* Bitmap of OFPPF_*.  Zero all bits to prevent
-                                 any action taking place. */
-};
-OFP_ASSERT(sizeof(struct ofp14_port_mod_prop_ethernet) == 8);
-
 struct ofp14_port_mod {
     ovs_be32 port_no;
     uint8_t pad[4];
-    uint8_t hw_addr[OFP_ETH_ALEN];
+    struct eth_addr hw_addr;
     uint8_t pad2[2];
     ovs_be32 config;        /* Bitmap of OFPPC_* flags. */
     ovs_be32 mask;          /* Bitmap of OFPPC_* flags to be changed. */
@@ -130,12 +121,12 @@ enum ofp14_table_mod_prop_eviction_flag {
     OFPTMPEF14_LIFETIME        = 1 << 2,     /* Using flow entry lifetime. */
 };
 
-struct ofp14_table_mod_prop_eviction {
-    ovs_be16         type;    /* OFPTMPT14_EVICTION. */
-    ovs_be16         length;  /* Length in bytes of this property. */
-    ovs_be32         flags;   /* Bitmap of OFPTMPEF14_* flags */
+/* What changed about the table */
+enum ofp14_table_reason {
+    OFPTR_VACANCY_DOWN = 3,    /* Vacancy down threshold event. */
+    OFPTR_VACANCY_UP   = 4,    /* Vacancy up threshold event. */
+#define OFPTR_BITS ((1u << OFPTR_VACANCY_DOWN) | (1u << OFPTR_VACANCY_UP))
 };
-OFP_ASSERT(sizeof(struct ofp14_table_mod_prop_eviction) == 8);
 
 struct ofp14_table_mod_prop_vacancy {
     ovs_be16         type;   /* OFPTMPT14_VACANCY. */
@@ -155,6 +146,24 @@ struct ofp14_table_mod {
 };
 OFP_ASSERT(sizeof(struct ofp14_table_mod) == 8);
 
+/* Body of reply to OFPMP_TABLE_DESC request. */
+struct ofp14_table_desc {
+    ovs_be16 length;       /* Length is padded to 64 bits. */
+    uint8_t table_id;      /* Identifier of table. Lower numbered tables
+                              are consulted first. */
+    uint8_t pad[1];        /* Align to 32-bits. */
+    ovs_be32 config;       /* Bitmap of OFPTC_* values. */
+    /* Followed by 0 or more OFPTMPT14_* properties. */
+};
+OFP_ASSERT(sizeof(struct ofp14_table_desc) == 8);
+
+/* A table config has changed in the datapath */
+struct ofp14_table_status {
+    uint8_t reason;    /* One of OFPTR_*. */
+    uint8_t pad[7];    /* Pad to 64 bits */
+    /* Followed by struct ofp14_table_desc */
+};
+OFP_ASSERT(sizeof(struct ofp14_table_status) == 8);
 
 /* ## ---------------- ## */
 /* ## ofp14_port_stats ## */
@@ -218,81 +227,41 @@ struct ofp14_queue_stats {
 OFP_ASSERT(sizeof(struct ofp14_queue_stats) == 48);
 
 
-/* ## -------------- ## */
-/* ## Miscellaneous. ## */
-/* ## -------------- ## */
+/* ## ---------------- ## */
+/* ## ofp14_queue_desc ## */
+/* ## ---------------- ## */
 
-/* Common header for all async config Properties */
-struct ofp14_async_config_prop_header {
-    ovs_be16    type;       /* One of OFPACPT_*. */
-    ovs_be16    length;     /* Length in bytes of this property. */
+struct ofp14_queue_desc_request {
+    ovs_be32 port;              /* All ports if OFPP_ANY. */
+    ovs_be32 queue;             /* All queues if OFPQ_ALL. */
 };
-OFP_ASSERT(sizeof(struct ofp14_async_config_prop_header) == 4);
-
-/* Asynchronous message configuration.
- * OFPT_GET_ASYNC_REPLY or OFPT_SET_ASYNC.
- */
-struct ofp14_async_config {
-    struct ofp_header header;
-    /* Async config Property list - 0 or more */
-    struct ofp14_async_config_prop_header properties[0];
+OFP_ASSERT(sizeof(struct ofp14_queue_desc_request) == 8);
+
+/* Body of reply to OFPMP_QUEUE_DESC request. */
+struct ofp14_queue_desc {
+    ovs_be32 port_no;           /* Port this queue is attached to. */
+    ovs_be32 queue_id;          /* ID for the specific queue. */
+    ovs_be16 len;               /* Length in bytes of this queue desc. */
+    uint8_t pad[6];             /* 64-bit alignment. */
 };
-OFP_ASSERT(sizeof(struct ofp14_async_config) == 8);
+OFP_ASSERT(sizeof(struct ofp14_queue_desc) == 16);
 
-/* Async Config property types.
-* Low order bit cleared indicates a property for the slave role.
-* Low order bit set indicates a property for the master/equal role.
-*/
-enum ofp14_async_config_prop_type {
-    OFPACPT_PACKET_IN_SLAVE       = 0, /* Packet-in mask for slave. */
-    OFPACPT_PACKET_IN_MASTER      = 1, /* Packet-in mask for master. */
-    OFPACPT_PORT_STATUS_SLAVE     = 2, /* Port-status mask for slave. */
-    OFPACPT_PORT_STATUS_MASTER    = 3, /* Port-status mask for master. */
-    OFPACPT_FLOW_REMOVED_SLAVE    = 4, /* Flow removed mask for slave. */
-    OFPACPT_FLOW_REMOVED_MASTER   = 5, /* Flow removed mask for master. */
-    OFPACPT_ROLE_STATUS_SLAVE     = 6, /* Role status mask for slave. */
-    OFPACPT_ROLE_STATUS_MASTER    = 7, /* Role status mask for master. */
-    OFPACPT_TABLE_STATUS_SLAVE    = 8, /* Table status mask for slave. */
-    OFPACPT_TABLE_STATUS_MASTER   = 9, /* Table status mask for master. */
-    OFPACPT_REQUESTFORWARD_SLAVE  = 10, /* RequestForward mask for slave. */
-    OFPACPT_REQUESTFORWARD_MASTER = 11, /* RequestForward mask for master. */
-    OFPTFPT_EXPERIMENTER_SLAVE    = 0xFFFE, /* Experimenter for slave. */
-    OFPTFPT_EXPERIMENTER_MASTER   = 0xFFFF, /* Experimenter for master. */
+enum ofp14_queue_desc_prop_type {
+    OFPQDPT14_MIN_RATE = 1,
+    OFPQDPT14_MAX_RATE = 2,
+    OFPQDPT14_EXPERIMENTER = 0xffff
 };
 
-/* Various reason based properties */
-struct ofp14_async_config_prop_reasons {
-    /* 'type' is one of OFPACPT_PACKET_IN_*, OFPACPT_PORT_STATUS_*,
-     * OFPACPT_FLOW_REMOVED_*, OFPACPT_ROLE_STATUS_*,
-     * OFPACPT_TABLE_STATUS_*, OFPACPT_REQUESTFORWARD_*. */
-    ovs_be16    type;
-    ovs_be16    length; /* Length in bytes of this property. */
-    ovs_be32    mask;   /* Bitmasks of reason values. */
-};
-OFP_ASSERT(sizeof(struct ofp14_async_config_prop_reasons) == 8);
-
-/* Experimenter async config property */
-struct ofp14_async_config_prop_experimenter {
-    ovs_be16        type;       /* One of OFPTFPT_EXPERIMENTER_SLAVE,
-                                   OFPTFPT_EXPERIMENTER_MASTER. */
-    ovs_be16        length;     /* Length in bytes of this property. */
-    ovs_be32        experimenter;  /* Experimenter ID which takes the same
-                                      form as in struct
-                                      ofp_experimenter_header. */
-    ovs_be32        exp_type;      /* Experimenter defined. */
-    /* Followed by:
-     *   - Exactly (length - 12) bytes containing the experimenter data, then
-     *   - Exactly (length + 7)/8*8 - (length) (between 0 and 7)
-     *     bytes of all-zero bytes */
-};
-OFP_ASSERT(sizeof(struct ofp14_async_config_prop_experimenter) == 12);
+/* ## -------------- ## */
+/* ## Miscellaneous. ## */
+/* ## -------------- ## */
 
-/* Common header for all Role Properties */
-struct ofp14_role_prop_header {
-    ovs_be16 type;   /* One of OFPRPT_*. */
-    ovs_be16 length; /* Length in bytes of this property. */
+/* Request forward reason */
+enum ofp14_requestforward_reason {
+    OFPRFR_GROUP_MOD = 0,      /* Forward group mod requests. */
+    OFPRFR_METER_MOD = 1,      /* Forward meter mod requests. */
+    OFPRFR_N_REASONS           /* Denotes number of reasons. */
 };
-OFP_ASSERT(sizeof(struct ofp14_role_prop_header) == 4);
 
 /* Role status event message. */
 struct ofp14_role_status {
@@ -310,6 +279,7 @@ enum ofp14_controller_role_reason {
     OFPCRR_MASTER_REQUEST = 0,  /* Another controller asked to be master. */
     OFPCRR_CONFIG         = 1,  /* Configuration changed on the switch. */
     OFPCRR_EXPERIMENTER   = 2,  /* Experimenter data changed. */
+    OFPCRR_N_REASONS            /* Denotes number of reasons. */
 };
 
 /* Role property types.
@@ -318,20 +288,11 @@ enum ofp14_role_prop_type {
     OFPRPT_EXPERIMENTER         = 0xFFFF, /* Experimenter property. */
 };
 
-/* Experimenter role property */
-struct ofp14_role_prop_experimenter {
-    ovs_be16        type;       /* One of OFPRPT_EXPERIMENTER. */
-    ovs_be16        length;     /* Length in bytes of this property. */
-    ovs_be32        experimenter; /* Experimenter ID which takes the same
-                                     form as in struct
-                                     ofp_experimenter_header. */
-    ovs_be32        exp_type;     /* Experimenter defined. */
-    /* Followed by:
-     *   - Exactly (length - 12) bytes containing the experimenter data, then
-     *   - Exactly (length + 7)/8*8 - (length) (between 0 and 7)
-     *     bytes of all-zero bytes */
+/* Group/Meter request forwarding. */
+struct ofp14_requestforward {
+    struct ofp_header request;  /* Request being forwarded. */
 };
-OFP_ASSERT(sizeof(struct ofp14_role_prop_experimenter) == 12);
+OFP_ASSERT(sizeof(struct ofp14_requestforward) == 8);
 
 /* Bundle control message types */
 enum ofp14_bundle_ctrl_type {
@@ -367,4 +328,51 @@ struct ofp14_bundle_ctrl_msg {
 };
 OFP_ASSERT(sizeof(struct ofp14_bundle_ctrl_msg) == 8);
 
+/* Body for ofp14_multipart_request of type OFPMP_FLOW_MONITOR.
+ *
+ * The OFPMP_FLOW_MONITOR request's body consists of an array of zero or more
+ * instances of this structure. The request arranges to monitor the flows
+ * that match the specified criteria, which are interpreted in the same way as
+ * for OFPMP_FLOW.
+ *
+ * 'id' identifies a particular monitor for the purpose of allowing it to be
+ * canceled later with OFPFMC_DELETE. 'id' must be unique among
+ * existing monitors that have not already been canceled.
+ */
+struct ofp14_flow_monitor_request {
+    ovs_be32 monitor_id;        /* Controller-assigned ID for this monitor. */
+    ovs_be32 out_port;          /* Required output port, if not OFPP_ANY. */
+    ovs_be32 out_group;         /* Required output port, if not OFPG_ANY. */
+    ovs_be16 flags;             /* OFPMF14_*. */
+    uint8_t table_id;           /* One table's ID or OFPTT_ALL (all tables). */
+    uint8_t command;            /* One of OFPFMC14_*. */
+    /* Followed by an ofp11_match structure. */
+};
+OFP_ASSERT(sizeof(struct ofp14_flow_monitor_request) == 16);
+
+/* Flow monitor commands */
+enum ofp14_flow_monitor_command {
+    OFPFMC14_ADD = 0, /* New flow monitor. */
+    OFPFMC14_MODIFY = 1, /* Modify existing flow monitor. */
+    OFPFMC14_DELETE = 2, /* Delete/cancel existing flow monitor. */
+};
+
+/* 'flags' bits in struct of_flow_monitor_request. */
+enum ofp14_flow_monitor_flags {
+    /* When to send updates. */
+    /* Common to NX and OpenFlow 1.4 */
+    OFPFMF14_INITIAL = 1 << 0,     /* Initially matching flows. */
+    OFPFMF14_ADD = 1 << 1,         /* New matching flows as they are added. */
+    OFPFMF14_REMOVED = 1 << 2,     /* Old matching flows as they are removed. */
+    OFPFMF14_MODIFY = 1 << 3,      /* Matching flows as they are changed. */
+
+    /* What to include in updates. */
+    /* Common to NX and OpenFlow 1.4 */
+    OFPFMF14_INSTRUCTIONS = 1 << 4, /* If set, instructions are included. */
+    OFPFMF14_NO_ABBREV = 1 << 5,    /* If set, include own changes in full. */
+    /* OpenFlow 1.4 */
+    OFPFMF14_ONLY_OWN = 1 << 6,     /* If set, don't include other controllers.
+                                     */
+};
+
 #endif /* openflow/openflow-1.4.h */