blob: 36434185a2736c9bad501930dcfa25c77a41d80a [file] [log] [blame]
Rich Lane1ac43002013-12-03 12:56:35 -08001// Copyright 2013, Big Switch Networks, Inc.
2//
3// LoxiGen is licensed under the Eclipse Public License,
4// version 1.0 (EPL), with the following special exception:
5//
6// LOXI Exception
7//
8// As a special exception to the terms of the EPL, you may
9// distribute libraries generated by LoxiGen (LoxiGen Libraries)
10// under the terms of your choice, provided that copyright and
11// licensing notices generated by LoxiGen are not altered or removed
12// from the LoxiGen Libraries and the notice provided below is (i)
13// included in the LoxiGen Libraries, if distributed in source code
14// form and (ii) included in any documentation for the LoxiGen
15// Libraries, if distributed in binary form.
16//
17// Notice: "Copyright 2013, Big Switch Networks, Inc.
18// This library was generated by the LoxiGen Compiler."
19//
20// You may not use this file except in compliance with the EPL or
21// LOXI Exception. You may obtain a copy of the EPL at:
22//
23// http://www.eclipse.org/legal/epl-v10.html
24//
25// Unless required by applicable law or agreed to in writing,
26// software distributed under the License is distributed on an "AS
27// IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
28// express or implied. See the EPL for the specific language
29// governing permissions and limitations under the EPL.
30
31#version 4
32
33// We have a number of switch agents that need to be configured by the
34// controller and report stats. Some of them will have large tables (1000+
35// entries) and so need an efficient synchronization mechanism (as can be
36// accomplished using the cookie field in flowtable entries). It's a
37// significant amount of work to do this from scratch for each new table.
38// This extension (and the corresponding Indigo code) provides a framework
39// to ease implementing new tables.
40
41// We don't plan on replacing our use of the OpenFlow flow table and group
42// table with this scheme. This is intended for controlling switch
43// functionality like the ARP and LACP agents which don't map at all to
44// flow-mods.
45
46// Each switch will have a number of tables indexed by a 16-bit table ID. Each
47// table has a name, id, a set of entries, and an array of checksum buckets.
48// There is no order to the entries; stats requests will return them in an
49// arbitrary order. The controller is expected to use the table name to
50// determine the semantics of a table.
51
52// Each entry has a key, value, stats, and checksum. The key and value are TLV
53// lists given by the controller in a gentable_entry_add message. The switch must
54// return these lists in stats replies exactly as it received them. The stats
55// are a list of TLVs controlled by the switch. The stats are expected to
56// include more than simple counters (for example, last hit time or seen TCP
57// flags). The checksum is an opaque value used for table synchronization.
58
59// LOXI includes a built-in type of_checksum_128_t, which is 128 bits but
60// only requires 32-bit alignment.
61
62
63// These TLV classes are used for keys, values, and stats. Like OXM, lists of
64// TLVs are tightly packed without padding. TLV lists may include duplicates
65// and the semantics of this is left to the particular table.
66//
67// If this is eventually standardized it would be good to add a "class" type
68// member as in OXM.
69struct of_bsn_tlv {
70 uint16_t type == ?;
71 uint16_t length;
72};
73
74
75// This message sets key=value in the given table. If key already exists in the
76// table then it modifies the value, preserving stats.
77//
78// If the switch cannot process the message then it should reply with an error
79// message. The contents of the table must not be changed in case of an error.
80struct of_bsn_gentable_entry_add : of_bsn_header {
81 uint8_t version;
82 uint8_t type == 4;
83 uint16_t length;
84 uint32_t xid;
85 uint32_t experimenter == 0x5c16c7;
86 uint32_t subtype == 46;
87 uint16_t table_id;
88 uint16_t key_length;
89 of_checksum_128_t checksum;
90 list(of_bsn_tlv_t) key;
91 list(of_bsn_tlv_t) value;
92};
93
94
95// This message deletes the entry with the given key in the given table.
96//
97// If the switch cannot process the message then it should reply with an error
98// message. The contents of the table must not be changed in case of an error.
99struct of_bsn_gentable_entry_delete : of_bsn_header {
100 uint8_t version;
101 uint8_t type == 4;
102 uint16_t length;
103 uint32_t xid;
104 uint32_t experimenter == 0x5c16c7;
105 uint32_t subtype == 47;
106 uint16_t table_id;
107 list(of_bsn_tlv_t) key;
108};
109
110
111// This message deletes a range of table entries. The checksum_mask must be a
112// prefix mask. The checksum must be zero in the bits where the checksum_mask
113// is zero.
114//
115// The switch may fail to delete some table entries. No error messages will be
116// sent, but the error_count in the reply message will be incremented.
117struct of_bsn_gentable_clear_request : of_bsn_header {
118 uint8_t version;
119 uint8_t type == 4;
120 uint16_t length;
121 uint32_t xid;
122 uint32_t experimenter == 0x5c16c7;
123 uint32_t subtype == 48;
124 uint16_t table_id;
125 pad(2);
126 of_checksum_128_t checksum;
127 of_checksum_128_t checksum_mask;
128};
129
130struct of_bsn_gentable_clear_reply : of_bsn_header {
131 uint8_t version;
132 uint8_t type == 4;
133 uint16_t length;
134 uint32_t xid;
135 uint32_t experimenter == 0x5c16c7;
136 uint32_t subtype == 49;
137 uint16_t table_id;
138 pad(2);
139 uint32_t deleted_count;
140 uint32_t error_count;
141};
142
143
144// This message sets the size of the buckets array. The switch may reject this
145// message if the table has entries.
146struct of_bsn_gentable_set_buckets_size : of_bsn_header {
147 uint8_t version;
148 uint8_t type == 4;
149 uint16_t length;
150 uint32_t xid;
151 uint32_t experimenter == 0x5c16c7;
152 uint32_t subtype == 50;
153 uint16_t table_id;
154 pad(2);
155 uint32_t buckets_size;
156};
157
158
159// Retrieve the configuration state (key, value, and checksum) for each table
160// entry in a range of buckets.
161//
162// The checksum_mask must be a prefix mask. The checksum must be zero in the
163// bits where the checksum_mask is zero.
164struct of_bsn_gentable_entry_desc_stats_request : of_bsn_stats_request {
165 uint8_t version;
166 uint8_t type == 18;
167 uint16_t length;
168 uint32_t xid;
169 uint16_t stats_type == 0xffff;
170 enum ofp_stats_request_flags flags;
171 pad(4);
172 uint32_t experimenter == 0x5c16c7;
173 uint32_t subtype == 2;
174 uint16_t table_id;
175 pad(2);
176 of_checksum_128_t checksum;
177 of_checksum_128_t checksum_mask;
178};
179
180struct of_bsn_gentable_entry_desc_stats_entry {
181 uint16_t length;
182 uint16_t key_length;
183 of_checksum_128_t checksum;
184 list(of_bsn_tlv_t) key;
185 list(of_bsn_tlv_t) value;
186};
187
188struct of_bsn_gentable_entry_desc_stats_reply : of_bsn_stats_reply {
189 uint8_t version;
190 uint8_t type == 19;
191 uint16_t length;
192 uint32_t xid;
193 uint16_t stats_type == 0xffff;
194 enum ofp_stats_reply_flags flags;
195 pad(4);
196 uint32_t experimenter == 0x5c16c7;
197 uint32_t subtype == 2;
198 list(of_bsn_gentable_entry_desc_stats_entry_t) entries;
199};
200
201
202// Retrieve the runtime state (key and stats) for each table entry in a range
203// of buckets.
204//
205// The checksum_mask must be a prefix mask. The checksum must be zero in the
206// bits where the checksum_mask is zero.
207struct of_bsn_gentable_entry_stats_request : of_bsn_stats_request {
208 uint8_t version;
209 uint8_t type == 18;
210 uint16_t length;
211 uint32_t xid;
212 uint16_t stats_type == 0xffff;
213 enum ofp_stats_request_flags flags;
214 pad(4);
215 uint32_t experimenter == 0x5c16c7;
216 uint32_t subtype == 3;
217 uint16_t table_id;
218 pad(2);
219 of_checksum_128_t checksum;
220 of_checksum_128_t checksum_mask;
221};
222
223struct of_bsn_gentable_entry_stats_entry {
224 uint16_t length;
225 uint16_t key_length;
226 list(of_bsn_tlv_t) key;
227 list(of_bsn_tlv_t) stats;
228};
229
230struct of_bsn_gentable_entry_stats_reply : of_bsn_stats_reply {
231 uint8_t version;
232 uint8_t type == 19;
233 uint16_t length;
234 uint32_t xid;
235 uint16_t stats_type == 0xffff;
236 enum ofp_stats_reply_flags flags;
237 pad(4);
238 uint32_t experimenter == 0x5c16c7;
239 uint32_t subtype == 3;
240 list(of_bsn_gentable_entry_stats_entry_t) entries;
241};
242
243
244// Retrieve the description for all tables.
245struct of_bsn_gentable_desc_stats_request : of_bsn_stats_request {
246 uint8_t version;
247 uint8_t type == 18;
248 uint16_t length;
249 uint32_t xid;
250 uint16_t stats_type == 0xffff;
251 enum ofp_stats_request_flags flags;
252 pad(4);
253 uint32_t experimenter == 0x5c16c7;
254 uint32_t subtype == 4;
255};
256
257struct of_bsn_gentable_desc_stats_entry {
258 uint16_t length;
259 uint16_t table_id;
260 of_table_name_t name;
261 uint32_t buckets_size;
262 /* TODO properties */
263};
264
265struct of_bsn_gentable_desc_stats_reply : of_bsn_stats_reply {
266 uint8_t version;
267 uint8_t type == 19;
268 uint16_t length;
269 uint32_t xid;
270 uint16_t stats_type == 0xffff;
271 enum ofp_stats_reply_flags flags;
272 pad(4);
273 uint32_t experimenter == 0x5c16c7;
274 uint32_t subtype == 4;
275 list(of_bsn_gentable_desc_stats_entry_t) entries;
276};
277
278
279// Retrieves stats for every table. This includes the total checksum, so the
280// controller can quickly check whether the whole table is in sync.
281//
282// The checksum of a table is the XOR of the checksums of all entries in the
283// table.
284struct of_bsn_gentable_stats_request : of_bsn_stats_request {
285 uint8_t version;
286 uint8_t type == 18;
287 uint16_t length;
288 uint32_t xid;
289 uint16_t stats_type == 0xffff;
290 enum ofp_stats_request_flags flags;
291 pad(4);
292 uint32_t experimenter == 0x5c16c7;
293 uint32_t subtype == 7;
294};
295
296struct of_bsn_gentable_stats_entry {
297 uint16_t table_id;
298 pad(2);
299 uint32_t entry_count;
300 of_checksum_128_t checksum;
301};
302
303struct of_bsn_gentable_stats_reply : of_bsn_stats_reply {
304 uint8_t version;
305 uint8_t type == 19;
306 uint16_t length;
307 uint32_t xid;
308 uint16_t stats_type == 0xffff;
309 enum ofp_stats_reply_flags flags;
310 pad(4);
311 uint32_t experimenter == 0x5c16c7;
312 uint32_t subtype == 7;
313 list(of_bsn_gentable_stats_entry_t) entries;
314};
315
316
317// Retrieves the checksum for every bucket in a table. The entries are ordered
318// by bucket index.
319//
320// The checksum of a bucket is the XOR of the checksums of all entries in the
321// bucket.
322struct of_bsn_gentable_bucket_stats_request : of_bsn_stats_request {
323 uint8_t version;
324 uint8_t type == 18;
325 uint16_t length;
326 uint32_t xid;
327 uint16_t stats_type == 0xffff;
328 enum ofp_stats_request_flags flags;
329 pad(4);
330 uint32_t experimenter == 0x5c16c7;
331 uint32_t subtype == 5;
332 uint16_t table_id;
333};
334
335struct of_bsn_gentable_bucket_stats_entry {
336 of_checksum_128_t checksum;
337};
338
339struct of_bsn_gentable_bucket_stats_reply : of_bsn_stats_reply {
340 uint8_t version;
341 uint8_t type == 19;
342 uint16_t length;
343 uint32_t xid;
344 uint16_t stats_type == 0xffff;
345 enum ofp_stats_reply_flags flags;
346 pad(4);
347 uint32_t experimenter == 0x5c16c7;
348 uint32_t subtype == 5;
349 list(of_bsn_gentable_bucket_stats_entry_t) entries;
350};