learn: Fix bugs when learn actions use subfields wider than 64 bits.
[sliver-openvswitch.git] / include / openflow / nicira-ext.h
index 042d304..f8b863c 100644 (file)
@@ -116,6 +116,7 @@ enum nicira_type {
     NXT_FLOW_AGE = 18,
 
     NXT_SET_ASYNC_CONFIG = 19,  /* struct nx_async_config. */
+    NXT_SET_CONTROLLER_ID = 20, /* struct nx_controller_id. */
 };
 
 /* Header for Nicira vendor stats request and reply messages. */
@@ -192,8 +193,8 @@ enum nx_hash_fields {
  */
 struct nx_flow_mod_table_id {
     struct ofp_header header;
-    uint32_t vendor;            /* NX_VENDOR_ID. */
-    uint32_t subtype;           /* NXT_FLOW_MOD_TABLE_ID. */
+    ovs_be32 vendor;            /* NX_VENDOR_ID. */
+    ovs_be32 subtype;           /* NXT_FLOW_MOD_TABLE_ID. */
     uint8_t set;                /* Nonzero to enable, zero to disable. */
     uint8_t pad[7];
 };
@@ -336,6 +337,7 @@ enum nx_action_subtype {
     NXAST_EXIT,                 /* struct nx_action_header */
     NXAST_DEC_TTL,              /* struct nx_action_header */
     NXAST_FIN_TIMEOUT,          /* struct nx_action_fin_timeout */
+    NXAST_CONTROLLER,           /* struct nx_action_controller */
 };
 
 /* Header for Nicira-defined actions. */
@@ -785,6 +787,9 @@ enum nx_mp_algorithm {
  *     field[ofs:ofs+n_bits-1].  Actions are executed in the same order as the
  *     flow_mod_specs.
  *
+ *     A single NXAST_REG_LOAD action writes no more than 64 bits, so n_bits
+ *     greater than 64 yields multiple NXAST_REG_LOAD actions.
+ *
  * The flow_mod_spec destination spec for 'dst' of 2 (when 'src' is 0) is
  * empty.  It has the following meaning:
  *
@@ -1563,6 +1568,12 @@ OFP_ASSERT(sizeof(struct nx_action_output_reg) == 24);
 #define NXM_NX_REG3_W     NXM_HEADER_W(0x0001, 3, 4)
 #define NXM_NX_REG4       NXM_HEADER  (0x0001, 4, 4)
 #define NXM_NX_REG4_W     NXM_HEADER_W(0x0001, 4, 4)
+#define NXM_NX_REG5       NXM_HEADER  (0x0001, 5, 4)
+#define NXM_NX_REG5_W     NXM_HEADER_W(0x0001, 5, 4)
+#define NXM_NX_REG6       NXM_HEADER  (0x0001, 6, 4)
+#define NXM_NX_REG6_W     NXM_HEADER_W(0x0001, 6, 4)
+#define NXM_NX_REG7       NXM_HEADER  (0x0001, 7, 4)
+#define NXM_NX_REG7_W     NXM_HEADER_W(0x0001, 7, 4)
 
 /* Tunnel ID.
  *
@@ -1756,9 +1767,7 @@ enum nx_flow_format {
 
 /* NXT_SET_FLOW_FORMAT request. */
 struct nx_set_flow_format {
-    struct ofp_header header;
-    ovs_be32 vendor;            /* NX_VENDOR_ID. */
-    ovs_be32 subtype;           /* NXT_SET_FLOW_FORMAT. */
+    struct nicira_header nxh;
     ovs_be32 format;            /* One of NXFF_*. */
 };
 OFP_ASSERT(sizeof(struct nx_set_flow_format) == 20);
@@ -1921,5 +1930,45 @@ struct nx_aggregate_stats_reply {
     uint8_t pad[4];            /* Align to 64 bits. */
 };
 OFP_ASSERT(sizeof(struct nx_aggregate_stats_reply) == 48);
+\f
+/* NXT_SET_CONTROLLER_ID.
+ *
+ * Each OpenFlow controller connection has a 16-bit identifier that is
+ * initially 0.  This message changes the connection's ID to 'id'.
+ *
+ * Controller connection IDs need not be unique.
+ *
+ * The NXAST_CONTROLLER action is the only current user of controller
+ * connection IDs. */
+struct nx_controller_id {
+    struct nicira_header nxh;
+    uint8_t zero[6];            /* Must be zero. */
+    ovs_be16 controller_id;     /* New controller connection ID. */
+};
+OFP_ASSERT(sizeof(struct nx_controller_id) == 24);
+
+/* Action structure for NXAST_CONTROLLER.
+ *
+ * This generalizes using OFPAT_OUTPUT to send a packet to OFPP_CONTROLLER.  In
+ * addition to the 'max_len' that OFPAT_OUTPUT supports, it also allows
+ * specifying:
+ *
+ *    - 'reason': The reason code to use in the ofp_packet_in or nx_packet_in.
+ *
+ *    - 'controller_id': The ID of the controller connection to which the
+ *      ofp_packet_in should be sent.  The ofp_packet_in or nx_packet_in is
+ *      sent only to controllers that have the specified controller connection
+ *      ID.  See "struct nx_controller_id" for more information. */
+struct nx_action_controller {
+    ovs_be16 type;                  /* OFPAT_VENDOR. */
+    ovs_be16 len;                   /* Length is 16. */
+    ovs_be32 vendor;                /* NX_VENDOR_ID. */
+    ovs_be16 subtype;               /* NXAST_CONTROLLER. */
+    ovs_be16 max_len;               /* Maximum length to send to controller. */
+    ovs_be16 controller_id;         /* Controller ID to send packet-in. */
+    uint8_t reason;                 /* enum ofp_packet_in_reason (OFPR_*). */
+    uint8_t zero;                   /* Must be zero. */
+};
+OFP_ASSERT(sizeof(struct nx_action_controller) == 16);
 
 #endif /* openflow/nicira-ext.h */