4d778181b582d4cf7468b4a2d62ef60b23f18b87
[cascardo/ovs.git] / include / openflow / openflow-1.5.h
1 /* Copyright (c) 2008, 2014 The Board of Trustees of The Leland Stanford
2 * Junior University
3 * Copyright (c) 2011, 2014 Open Networking Foundation
4 *
5 * We are making the OpenFlow specification and associated documentation
6 * (Software) available for public use and benefit with the expectation
7 * that others will use, modify and enhance the Software and contribute
8 * those enhancements back to the community. However, since we would
9 * like to make the Software available for broadest use, with as few
10 * restrictions as possible permission is hereby granted, free of
11 * charge, to any person obtaining a copy of this Software to deal in
12 * the Software under the copyrights without restriction, including
13 * without limitation the rights to use, copy, modify, merge, publish,
14 * distribute, sublicense, and/or sell copies of the Software, and to
15 * permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
25 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
26 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 * SOFTWARE.
29 *
30 * The name and trademarks of copyright holder(s) may NOT be used in
31 * advertising or publicity pertaining to the Software or any
32 * derivatives without specific, written prior permission.
33 */
34
35 /* OpenFlow: protocol between controller and datapath. */
36
37 #ifndef OPENFLOW_15_H
38 #define OPENFLOW_15_H 1
39
40 #include <openflow/openflow-common.h>
41
42 /* Group commands */
43 enum ofp15_group_mod_command {
44     /* Present since OpenFlow 1.1 - 1.4 */
45     OFPGC15_ADD    = 0,       /* New group. */
46     OFPGC15_MODIFY = 1,       /* Modify all matching groups. */
47     OFPGC15_DELETE = 2,       /* Delete all matching groups. */
48
49     /* New in OpenFlow 1.5 */
50     OFPGC15_INSERT_BUCKET = 3,/* Insert action buckets to the already available
51                                  list of action buckets in a matching group */
52     /* OFPGCXX_YYY = 4, */    /* Reserved for future use. */
53     OFPGC15_REMOVE_BUCKET = 5,/* Remove all action buckets or any specific
54                                  action bucket from matching group */
55 };
56
57 /* Group bucket property types.  */
58 enum ofp15_group_bucket_prop_type {
59     OFPGBPT15_WEIGHT                 = 0,  /* Select groups only. */
60     OFPGBPT15_WATCH_PORT             = 1,  /* Fast failover groups only. */
61     OFPGBPT15_WATCH_GROUP            = 2,  /* Fast failover groups only. */
62     OFPGBPT15_EXPERIMENTER      = 0xFFFF,  /* Experimenter defined. */
63 };
64
65 /* Group bucket weight property, for select groups only. */
66 struct ofp15_group_bucket_prop_weight {
67     ovs_be16         type;    /* OFPGBPT15_WEIGHT. */
68     ovs_be16         length;  /* 8. */
69     ovs_be16         weight;  /* Relative weight of bucket. */
70     uint8_t          pad[2];  /* Pad to 64 bits. */
71 };
72 OFP_ASSERT(sizeof(struct ofp15_group_bucket_prop_weight) == 8);
73
74 /* Group bucket watch port or watch group property, for fast failover groups
75  * only. */
76 struct ofp15_group_bucket_prop_watch {
77     ovs_be16         type;    /* OFPGBPT15_WATCH_PORT or OFPGBPT15_WATCH_GROUP. */
78     ovs_be16         length;  /* 8. */
79     ovs_be32         watch;   /* The port or the group.  */
80 };
81 OFP_ASSERT(sizeof(struct ofp15_group_bucket_prop_watch) == 8);
82
83 /* Bucket for use in groups. */
84 struct ofp15_bucket {
85     ovs_be16 len;                   /* Length the bucket in bytes, including
86                                        this header and any padding to make it
87                                        64-bit aligned. */
88     ovs_be16 action_array_len;      /* Length of all actions in bytes. */
89     ovs_be32 bucket_id;             /* Bucket Id used to identify bucket*/
90     /* Followed by exactly len - 8 bytes of group bucket properties. */
91     /* Followed by:
92      *   - Exactly 'action_array_len' bytes containing an array of
93      *     struct ofp_action_*.
94      *   - Zero or more bytes of group bucket properties to fill out the
95      *     overall length in header.length. */
96 };
97 OFP_ASSERT(sizeof(struct ofp15_bucket) == 8);
98
99 /* Bucket Id can be any value between 0 and OFPG_BUCKET_MAX */
100 enum ofp15_group_bucket {
101     OFPG15_BUCKET_MAX   = 0xffffff00, /* Last usable bucket ID */
102     OFPG15_BUCKET_FIRST = 0xfffffffd, /* First bucket ID in the list of action
103                                          buckets of a group. This is applicable
104                                          for OFPGC15_INSERT_BUCKET and
105                                          OFPGC15_REMOVE_BUCKET commands */
106     OFPG15_BUCKET_LAST  = 0xfffffffe, /* Last bucket ID in the list of action
107                                          buckets of a group. This is applicable
108                                          for OFPGC15_INSERT_BUCKET and
109                                          OFPGC15_REMOVE_BUCKET commands */
110     OFPG15_BUCKET_ALL   = 0xffffffff  /* All action buckets in a group,
111                                          This is applicable for
112                                          only OFPGC15_REMOVE_BUCKET command */
113 };
114
115 /* Group property types.  */
116 enum ofp_group_prop_type {
117     OFPGPT15_EXPERIMENTER      = 0xFFFF,  /* Experimenter defined. */
118 };
119
120 /* Group setup and teardown (controller -> datapath). */
121 struct ofp15_group_mod {
122     ovs_be16 command;             /* One of OFPGC15_*. */
123     uint8_t type;                 /* One of OFPGT11_*. */
124     uint8_t pad;                  /* Pad to 64 bits. */
125     ovs_be32 group_id;            /* Group identifier. */
126     ovs_be16 bucket_array_len;    /* Length of action buckets data. */
127     uint8_t pad1[2];              /* Pad to 64 bits. */
128     ovs_be32 command_bucket_id;   /* Bucket Id used as part of
129                                    * OFPGC15_INSERT_BUCKET and
130                                    * OFPGC15_REMOVE_BUCKET commands
131                                    * execution.*/
132     /* Followed by:
133      *   - Exactly 'bucket_array_len' bytes containing an array of
134      *     struct ofp15_bucket.
135      *   - Zero or more bytes of group properties to fill out the overall
136      *     length in header.length. */
137 };
138 OFP_ASSERT(sizeof(struct ofp15_group_mod) == 16);
139
140 /* Body of reply to OFPMP_GROUP_DESC request. */
141 struct ofp15_group_desc_stats {
142     ovs_be16 length;              /* Length of this entry. */
143     uint8_t type;                 /* One of OFPGT11_*. */
144     uint8_t pad;                  /* Pad to 64 bits. */
145     ovs_be32 group_id;            /* Group identifier. */
146     ovs_be16 bucket_list_len;     /* Length of action buckets data. */
147     uint8_t pad2[6];              /* Pad to 64 bits. */
148     /* Followed by:
149      *   - Exactly 'bucket_list_len' bytes containing an array of
150      *     struct ofp_bucket.
151      *   - Zero or more bytes of group properties to fill out the overall
152      *     length in header.length. */
153 };
154 OFP_ASSERT(sizeof(struct ofp15_group_desc_stats) == 16);
155
156 #endif /* openflow/openflow-1.5.h */