[ovs-dev] [PATCH 04/22] ofproto: Add types for (draft) OpenFlow 1.5 group mod

Simon Horman simon.horman at netronome.com
Mon Nov 10 04:47:51 UTC 2014


EXT-350
Signed-off-by: Simon Horman <simon.horman at netronome.com>
---
 include/openflow/openflow-1.5.h | 159 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 158 insertions(+), 1 deletion(-)

diff --git a/include/openflow/openflow-1.5.h b/include/openflow/openflow-1.5.h
index a5a51c0..a413755 100644
--- a/include/openflow/openflow-1.5.h
+++ b/include/openflow/openflow-1.5.h
@@ -37,8 +37,165 @@
 #ifndef OPENFLOW_15_H
 #define OPENFLOW_15_H 1
 
-#include "openflow/openflow-1.4.h"
+#include "openflow/openflow-common.h"
 
+/* Group commands */
+enum ofp15_group_mod_command {
+    /* Present since OpenFLow 1.1 - 1.4 */
+    OFPGC15_ADD    = 0,       /* New group. */
+    OFPGC15_MODIFY = 1,       /* Modify all matching groups. */
+    OFPGC15_DELETE = 2,       /* Delete all matching groups. */
 
+    /* New in OpenFLow 1.5 */
+    OFPGC15_INSERT_BUCKET = 3,/* Insert action buckets to the already available
+                               list of action buckets in a matching group */
+    OFPGC15_REMOVE_BUCKET = 5,/* Remove all action buckets or any specific
+                                 action bucket from matching group */
+};
+
+/* Group bucket property types.  */
+enum ofp15_group_bucket_prop_type {
+    OFPGBPT15_WEIGHT                 = 0,  /* Select groups only. */
+    OFPGBPT15_WATCH_PORT             = 1,  /* Fast failover groups only. */
+    OFPGBPT15_WATCH_GROUP            = 2,  /* Fast failover groups only. */
+    OFPGBPT15_EXPERIMENTER      = 0xFFFF,  /* Experimenter defined. */
+};
+
+/* Common header for all group bucket properties. */
+struct ofp15_group_bucket_prop_header {
+    ovs_be16         type;    /* One of OFPGBPT15_*. */
+    ovs_be16         length;  /* Length in bytes of this property. */
+};
+OFP_ASSERT(sizeof(struct ofp15_group_bucket_prop_header) == 4);
+
+/* Group bucket weight property, for select groups only. */
+struct ofp15_group_bucket_prop_weight {
+    ovs_be16         type;    /* OFPGBPT15_WEIGHT. */
+    ovs_be16         length;  /* 8. */
+    ovs_be16         weight;  /* Relative weight of bucket. */
+    uint8_t          pad[2];  /* Pad to 64 bits. */
+};
+OFP_ASSERT(sizeof(struct ofp15_group_bucket_prop_weight) == 8);
+
+/* Group bucket watch port or watch group property, for fast failover groups
+ * only. */
+struct ofp15_group_bucket_prop_watch {
+    ovs_be16         type;    /* OFPGBPT15_WATCH_PORT or OFPGBPT15_WATCH_GROUP. */
+    ovs_be16         length;  /* 8. */
+    ovs_be32         watch;   /* The port or the group.  */
+};
+OFP_ASSERT(sizeof(struct ofp15_group_bucket_prop_watch) == 8);
+
+/* Experimenter group bucket property */
+struct ofp15_group_bucket_prop_experimenter {
+    ovs_be16         type;         /* OFPGBPT15_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 */
+    /* ovs_be32         experimenter_data[0]; */
+};
+OFP_ASSERT(sizeof(struct ofp15_group_bucket_prop_experimenter) == 12);
+
+/* Bucket for use in groups. */
+struct ofp15_bucket {
+    ovs_be16 len;                   /* Length the bucket in bytes, including
+                                       this header and any padding to make it
+                                       64-bit aligned. */
+    ovs_be16 action_list_len;       /* Length of all actions in bytes. */
+    ovs_be32 bucket_id;             /* Bucket Id used to identify bucket*/
+    /* Followed by exactly len - 8 bytes of group bucket properties. */
+    /* Followed by:
+     *   - Exactly 'action_list_len' bytes containing an array of
+     *     struct ofp_action_*.
+     *   - Zero or more bytes of group bucket properties to fill out the
+     *     overall length in header.length. */
+};
+OFP_ASSERT(sizeof(struct ofp15_bucket) == 8);
+
+/* Bucket Id can be any value between 0 and OFPG_BUCKET_MAX */
+enum ofp15_group_bucket {
+    OFPG15_BUCKET_MAX   = 0xffffff00, /* Last usable bucket ID */
+    OFPG15_BUCKET_FIRST = 0xfffffffd, /* First bucket ID in the list of action
+                                         buckets of a group. This is applicable
+                                         for OFPGC15_INSERT_BUCKET and
+                                         OFPGC15_REMOVE_BUCKET commands */
+    OFPG15_BUCKET_LAST  = 0xfffffffe, /* Last bucket ID in the list of action
+                                         buckets of a group. This is applicable
+                                         for OFPGC15_INSERT_BUCKET and
+                                         OFPGC15_REMOVE_BUCKET commands */
+    OFPG15_BUCKET_ALL   = 0xffffffff  /* All action buckets in a group,
+                                         This is applicable for
+                                         only OFPGC15_REMOVE_BUCKET command */
+};
+
+/* Group property types.  */
+enum ofp_group_prop_type {
+    OFPGPT15_EXPERIMENTER      = 0xFFFF,  /* Experimenter defined. */
+};
+
+/* Common header for all group properties. */
+struct ofp15_group_prop_header {
+    ovs_be16         type;    /* One of OFPGPT15_*. */
+    ovs_be16         length;  /* Length in bytes of this property. */
+};
+OFP_ASSERT(sizeof(struct ofp15_group_prop_header) == 4);
+
+/* Experimenter group property */
+struct ofp15_group_prop_experimenter {
+    ovs_be16         type;         /* OFPGPT15_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 */
+    /* ovs_be32         experimenter_data[0]; */
+};
+OFP_ASSERT(sizeof(struct ofp15_group_prop_experimenter) == 12);
+
+/* Group setup and teardown (controller -> datapath). */
+struct ofp15_group_mod {
+    ovs_be16 command;             /* One of OFPGC15_*. */
+    uint8_t type;                 /* One of OFPGT11_*. */
+    uint8_t pad;                  /* Pad to 64 bits. */
+    ovs_be32 group_id;            /* Group identifier. */
+    ovs_be16 bucket_list_len;     /* Length of action buckets data. */
+    uint8_t pad1[2];              /* Pad to 64 bits. */
+    ovs_be32 command_bucket_id;   /* Bucket Id used as part of
+                                   * OFPGC15_INSERT_BUCKET and
+                                   * OFPGC15_REMOVE_BUCKET commands
+                                   * execution.*/
+    /* Followed by:
+     *   - Exactly 'bucket_list_len' bytes containing an array of
+     *     struct ofp15_bucket.
+     *   - Zero or more bytes of group properties to fill out the overall
+     *     length in header.length. */
+};
+OFP_ASSERT(sizeof(struct ofp15_group_mod) == 16);
+
+/* Body of reply to OFPMP_GROUP_DESC request. */
+struct ofp15_group_desc_stats {
+    ovs_be16 length;              /* Length of this entry. */
+    uint8_t type;                 /* One of OFPGT11_*. */
+    uint8_t pad;                  /* Pad to 64 bits. */
+    ovs_be32 group_id;            /* Group identifier. */
+    ovs_be16 bucket_list_len;     /* Length of action buckets data. */
+    uint8_t pad2[6];              /* Pad to 64 bits. */
+    /* Followed by:
+     *   - Exactly 'bucket_list_len' bytes containing an array of
+     *     struct ofp_bucket.
+     *   - Zero or more bytes of group properties to fill out the overall
+     *     length in header.length. */
+};
+OFP_ASSERT(sizeof(struct ofp15_group_desc_stats) == 16);
 
 #endif /* openflow/openflow-1.5.h */
-- 
2.1.1




More information about the dev mailing list