openflow: Add OpenFlow1.5 port desc request.
[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 /* Body for ofp15_multipart_request of type OFPMP_PORT_DESC. */
43 struct ofp15_port_desc_request {
44     ovs_be32 port_no;         /* All ports if OFPP_ANY. */
45     uint8_t pad[4];            /* Align to 64 bits. */
46 };
47 OFP_ASSERT(sizeof(struct ofp15_port_desc_request) == 8);
48
49 /* Group commands */
50 enum ofp15_group_mod_command {
51     /* Present since OpenFlow 1.1 - 1.4 */
52     OFPGC15_ADD    = 0,       /* New group. */
53     OFPGC15_MODIFY = 1,       /* Modify all matching groups. */
54     OFPGC15_DELETE = 2,       /* Delete all matching groups. */
55
56     /* New in OpenFlow 1.5 */
57     OFPGC15_INSERT_BUCKET = 3,/* Insert action buckets to the already available
58                                  list of action buckets in a matching group */
59     /* OFPGCXX_YYY = 4, */    /* Reserved for future use. */
60     OFPGC15_REMOVE_BUCKET = 5,/* Remove all action buckets or any specific
61                                  action bucket from matching group */
62 };
63
64 /* Group bucket property types.  */
65 enum ofp15_group_bucket_prop_type {
66     OFPGBPT15_WEIGHT                 = 0,  /* Select groups only. */
67     OFPGBPT15_WATCH_PORT             = 1,  /* Fast failover groups only. */
68     OFPGBPT15_WATCH_GROUP            = 2,  /* Fast failover groups only. */
69     OFPGBPT15_EXPERIMENTER      = 0xFFFF,  /* Experimenter defined. */
70 };
71
72 /* Group bucket weight property, for select groups only. */
73 struct ofp15_group_bucket_prop_weight {
74     ovs_be16         type;    /* OFPGBPT15_WEIGHT. */
75     ovs_be16         length;  /* 8. */
76     ovs_be16         weight;  /* Relative weight of bucket. */
77     uint8_t          pad[2];  /* Pad to 64 bits. */
78 };
79 OFP_ASSERT(sizeof(struct ofp15_group_bucket_prop_weight) == 8);
80
81 /* Group bucket watch port or watch group property, for fast failover groups
82  * only. */
83 struct ofp15_group_bucket_prop_watch {
84     ovs_be16         type;    /* OFPGBPT15_WATCH_PORT or OFPGBPT15_WATCH_GROUP. */
85     ovs_be16         length;  /* 8. */
86     ovs_be32         watch;   /* The port or the group.  */
87 };
88 OFP_ASSERT(sizeof(struct ofp15_group_bucket_prop_watch) == 8);
89
90 /* Bucket for use in groups. */
91 struct ofp15_bucket {
92     ovs_be16 len;                   /* Length the bucket in bytes, including
93                                        this header and any padding to make it
94                                        64-bit aligned. */
95     ovs_be16 action_array_len;      /* Length of all actions in bytes. */
96     ovs_be32 bucket_id;             /* Bucket Id used to identify bucket*/
97     /* Followed by exactly len - 8 bytes of group bucket properties. */
98     /* Followed by:
99      *   - Exactly 'action_array_len' bytes containing an array of
100      *     struct ofp_action_*.
101      *   - Zero or more bytes of group bucket properties to fill out the
102      *     overall length in header.length. */
103 };
104 OFP_ASSERT(sizeof(struct ofp15_bucket) == 8);
105
106 /* Bucket Id can be any value between 0 and OFPG_BUCKET_MAX */
107 enum ofp15_group_bucket {
108     OFPG15_BUCKET_MAX   = 0xffffff00, /* Last usable bucket ID */
109     OFPG15_BUCKET_FIRST = 0xfffffffd, /* First bucket ID in the list of action
110                                          buckets of a group. This is applicable
111                                          for OFPGC15_INSERT_BUCKET and
112                                          OFPGC15_REMOVE_BUCKET commands */
113     OFPG15_BUCKET_LAST  = 0xfffffffe, /* Last bucket ID in the list of action
114                                          buckets of a group. This is applicable
115                                          for OFPGC15_INSERT_BUCKET and
116                                          OFPGC15_REMOVE_BUCKET commands */
117     OFPG15_BUCKET_ALL   = 0xffffffff  /* All action buckets in a group,
118                                          This is applicable for
119                                          only OFPGC15_REMOVE_BUCKET command */
120 };
121
122 /* Group property types.  */
123 enum ofp_group_prop_type {
124     OFPGPT15_EXPERIMENTER      = 0xFFFF,  /* Experimenter defined. */
125 };
126
127 /* Group setup and teardown (controller -> datapath). */
128 struct ofp15_group_mod {
129     ovs_be16 command;             /* One of OFPGC15_*. */
130     uint8_t type;                 /* One of OFPGT11_*. */
131     uint8_t pad;                  /* Pad to 64 bits. */
132     ovs_be32 group_id;            /* Group identifier. */
133     ovs_be16 bucket_array_len;    /* Length of action buckets data. */
134     uint8_t pad1[2];              /* Pad to 64 bits. */
135     ovs_be32 command_bucket_id;   /* Bucket Id used as part of
136                                    * OFPGC15_INSERT_BUCKET and
137                                    * OFPGC15_REMOVE_BUCKET commands
138                                    * execution.*/
139     /* Followed by:
140      *   - Exactly 'bucket_array_len' bytes containing an array of
141      *     struct ofp15_bucket.
142      *   - Zero or more bytes of group properties to fill out the overall
143      *     length in header.length. */
144 };
145 OFP_ASSERT(sizeof(struct ofp15_group_mod) == 16);
146
147 /* Body of reply to OFPMP_GROUP_DESC request. */
148 struct ofp15_group_desc_stats {
149     ovs_be16 length;              /* Length of this entry. */
150     uint8_t type;                 /* One of OFPGT11_*. */
151     uint8_t pad;                  /* Pad to 64 bits. */
152     ovs_be32 group_id;            /* Group identifier. */
153     ovs_be16 bucket_list_len;     /* Length of action buckets data. */
154     uint8_t pad2[6];              /* Pad to 64 bits. */
155     /* Followed by:
156      *   - Exactly 'bucket_list_len' bytes containing an array of
157      *     struct ofp_bucket.
158      *   - Zero or more bytes of group properties to fill out the overall
159      *     length in header.length. */
160 };
161 OFP_ASSERT(sizeof(struct ofp15_group_desc_stats) == 16);
162
163 #endif /* openflow/openflow-1.5.h */