blob: f225c19213429caa8a176d3ec1805467ee6f4544 [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;
Rich Lane7b2a8b62014-01-02 14:00:49 -0800262 uint32_t max_entries;
263 pad(4);
Rich Lane1ac43002013-12-03 12:56:35 -0800264 /* TODO properties */
265};
266
267struct of_bsn_gentable_desc_stats_reply : of_bsn_stats_reply {
268 uint8_t version;
269 uint8_t type == 19;
270 uint16_t length;
271 uint32_t xid;
272 uint16_t stats_type == 0xffff;
273 enum ofp_stats_reply_flags flags;
274 pad(4);
275 uint32_t experimenter == 0x5c16c7;
276 uint32_t subtype == 4;
277 list(of_bsn_gentable_desc_stats_entry_t) entries;
278};
279
280
281// Retrieves stats for every table. This includes the total checksum, so the
282// controller can quickly check whether the whole table is in sync.
283//
284// The checksum of a table is the XOR of the checksums of all entries in the
285// table.
286struct of_bsn_gentable_stats_request : of_bsn_stats_request {
287 uint8_t version;
288 uint8_t type == 18;
289 uint16_t length;
290 uint32_t xid;
291 uint16_t stats_type == 0xffff;
292 enum ofp_stats_request_flags flags;
293 pad(4);
294 uint32_t experimenter == 0x5c16c7;
295 uint32_t subtype == 7;
296};
297
298struct of_bsn_gentable_stats_entry {
299 uint16_t table_id;
300 pad(2);
301 uint32_t entry_count;
302 of_checksum_128_t checksum;
303};
304
305struct of_bsn_gentable_stats_reply : of_bsn_stats_reply {
306 uint8_t version;
307 uint8_t type == 19;
308 uint16_t length;
309 uint32_t xid;
310 uint16_t stats_type == 0xffff;
311 enum ofp_stats_reply_flags flags;
312 pad(4);
313 uint32_t experimenter == 0x5c16c7;
314 uint32_t subtype == 7;
315 list(of_bsn_gentable_stats_entry_t) entries;
316};
317
318
319// Retrieves the checksum for every bucket in a table. The entries are ordered
320// by bucket index.
321//
322// The checksum of a bucket is the XOR of the checksums of all entries in the
323// bucket.
324struct of_bsn_gentable_bucket_stats_request : of_bsn_stats_request {
325 uint8_t version;
326 uint8_t type == 18;
327 uint16_t length;
328 uint32_t xid;
329 uint16_t stats_type == 0xffff;
330 enum ofp_stats_request_flags flags;
331 pad(4);
332 uint32_t experimenter == 0x5c16c7;
333 uint32_t subtype == 5;
334 uint16_t table_id;
335};
336
337struct of_bsn_gentable_bucket_stats_entry {
338 of_checksum_128_t checksum;
339};
340
341struct of_bsn_gentable_bucket_stats_reply : of_bsn_stats_reply {
342 uint8_t version;
343 uint8_t type == 19;
344 uint16_t length;
345 uint32_t xid;
346 uint16_t stats_type == 0xffff;
347 enum ofp_stats_reply_flags flags;
348 pad(4);
349 uint32_t experimenter == 0x5c16c7;
350 uint32_t subtype == 5;
351 list(of_bsn_gentable_bucket_stats_entry_t) entries;
352};