-
Notifications
You must be signed in to change notification settings - Fork 609
Expand file tree
/
Copy pathsaimpls.h
More file actions
409 lines (370 loc) · 12.4 KB
/
Copy pathsaimpls.h
File metadata and controls
409 lines (370 loc) · 12.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
/**
* Copyright (c) 2014 Microsoft Open Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
* LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS
* FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
*
* See the Apache Version 2.0 License for specific language governing
* permissions and limitations under the License.
*
* Microsoft would like to thank the following companies for their review and
* assistance with these files: Intel Corporation, Mellanox Technologies Ltd,
* Dell Products, L.P., Facebook, Inc., Marvell International Ltd.
*
* @file saimpls.h
*
* @brief This module defines SAI MPLS interface
*/
#if !defined (__SAIMPLS_H_)
#define __SAIMPLS_H_
#include <saitypes.h>
/**
* @defgroup SAIMPLS SAI - MPLS specific API definitions
*
* @{
*/
typedef enum _sai_inseg_entry_psc_type_t
{
/**
* @brief EXP of MPLS label infers both TC and COLOR
*/
SAI_INSEG_ENTRY_PSC_TYPE_ELSP,
/**
* @brief MPLS label infers TC and EXP of MPLS label infers COLOR
*/
SAI_INSEG_ENTRY_PSC_TYPE_LLSP
} sai_inseg_entry_psc_type_t;
typedef enum _sai_inseg_entry_pop_ttl_mode_t
{
/**
* @brief Uniform mode
*
* TTL of inner header is computed based on TTL of outer header on pop.
*/
SAI_INSEG_ENTRY_POP_TTL_MODE_UNIFORM,
/**
* @brief Pipe mode
*
* TTL of inner header is left unchanged on pop.
*/
SAI_INSEG_ENTRY_POP_TTL_MODE_PIPE
} sai_inseg_entry_pop_ttl_mode_t;
typedef enum _sai_inseg_entry_pop_qos_mode_t
{
/**
* @brief Uniform mode
*
* DSCP or EXP of inner header is computed based on TC AND COLOR of outer header on pop.
*/
SAI_INSEG_ENTRY_POP_QOS_MODE_UNIFORM,
/**
* @brief Uniform mode
*
* DSCP or EXP of inner header is left unchanged on pop.
*/
SAI_INSEG_ENTRY_POP_QOS_MODE_PIPE
} sai_inseg_entry_pop_qos_mode_t;
/**
* @brief Attribute Id for SAI in segment
*/
typedef enum _sai_inseg_entry_attr_t
{
/**
* @brief Start of attributes
*/
SAI_INSEG_ENTRY_ATTR_START,
/**
* @brief Number of pops
*
* @type sai_uint8_t
* @flags CREATE_AND_SET
* @default 0
*/
SAI_INSEG_ENTRY_ATTR_NUM_OF_POP = SAI_INSEG_ENTRY_ATTR_START,
/**
* @brief Packet action
*
* @type sai_packet_action_t
* @flags CREATE_AND_SET
* @default SAI_PACKET_ACTION_FORWARD
*/
SAI_INSEG_ENTRY_ATTR_PACKET_ACTION,
/**
* @brief Packet priority for trap/log actions
*
* @type sai_uint8_t
* @flags CREATE_AND_SET
* @default 0
*/
SAI_INSEG_ENTRY_ATTR_TRAP_PRIORITY,
/**
* @brief The next hop id
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_NEXT_HOP, SAI_OBJECT_TYPE_NEXT_HOP_GROUP, SAI_OBJECT_TYPE_ROUTER_INTERFACE
* @allownull true
* @default SAI_NULL_OBJECT_ID
*/
SAI_INSEG_ENTRY_ATTR_NEXT_HOP_ID,
/**
* @brief Define PSC type for a label.
*
* Defines how to infer both TC and COLOR
*
* @type sai_inseg_entry_psc_type_t
* @flags CREATE_AND_SET
* @default SAI_INSEG_ENTRY_PSC_TYPE_ELSP
*/
SAI_INSEG_ENTRY_ATTR_PSC_TYPE,
/**
* @brief TC for a label.
*
* Associate TC by a label (override TC provided by QOS MAP)
* Mainly used for L-LSP tunnels, where label infers TC and EXP infers COLOR
*
* @type sai_uint8_t
* @flags CREATE_AND_SET
* @default 0
* @validonly SAI_INSEG_ENTRY_ATTR_PSC_TYPE == SAI_INSEG_ENTRY_PSC_TYPE_LLSP
*/
SAI_INSEG_ENTRY_ATTR_QOS_TC,
/**
* @brief Enable EXP -> TC MAP on label.
*
* Associate TC by a QOS MAP
* Mainly used for E-LSP tunnels, where EXP infers both TC and COLOR
* Overrides SAI_SWITCH_ATTR_QOS_MPLS_EXP_TO_TC_MAP and SAI_PORT_ATTR_QOS_MPLS_EXP_TO_TC_MAP
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_QOS_MAP
* @allownull true
* @default SAI_NULL_OBJECT_ID
* @validonly SAI_INSEG_ENTRY_ATTR_PSC_TYPE == SAI_INSEG_ENTRY_PSC_TYPE_ELSP
*/
SAI_INSEG_ENTRY_ATTR_MPLS_EXP_TO_TC_MAP,
/**
* @brief Enable EXP -> COLOR MAP on label.
*
* Associate COLOR by a QOS MAP
* Overrides SAI_SWITCH_ATTR_QOS_MPLS_EXP_TO_COLOR_MAP and SAI_PORT_ATTR_QOS_MPLS_EXP_TO_COLOR_MAP
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_QOS_MAP
* @allownull true
* @default SAI_NULL_OBJECT_ID
*/
SAI_INSEG_ENTRY_ATTR_MPLS_EXP_TO_COLOR_MAP,
/**
* @brief Define TTL setting for PHP or POP
*
* @type sai_inseg_entry_pop_ttl_mode_t
* @flags CREATE_AND_SET
* @default SAI_INSEG_ENTRY_POP_TTL_MODE_UNIFORM
*/
SAI_INSEG_ENTRY_ATTR_POP_TTL_MODE,
/**
* @brief Define QOS setting for PHP or POP
*
* @type sai_inseg_entry_pop_qos_mode_t
* @flags CREATE_AND_SET
* @default SAI_INSEG_ENTRY_POP_QOS_MODE_UNIFORM
*/
SAI_INSEG_ENTRY_ATTR_POP_QOS_MODE,
/**
* @brief Attach a counter
*
* When it is empty, then packet hits won't be counted
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_COUNTER
* @allownull true
* @default SAI_NULL_OBJECT_ID
*/
SAI_INSEG_ENTRY_ATTR_COUNTER_ID,
/**
* @brief End of attributes
*/
SAI_INSEG_ENTRY_ATTR_END,
/** Custom range base value */
SAI_INSEG_ENTRY_ATTR_CUSTOM_RANGE_START = 0x10000000,
/** End of custom range base */
SAI_INSEG_ENTRY_ATTR_CUSTOM_RANGE_END
} sai_inseg_entry_attr_t;
/**
* @brief In segment entry
*/
typedef struct _sai_inseg_entry_t
{
/**
* @brief Switch ID
*
* @objects SAI_OBJECT_TYPE_SWITCH
*/
sai_object_id_t switch_id;
/**
* @brief MPLS label
*/
sai_label_id_t label;
} sai_inseg_entry_t;
/**
* @brief Create In Segment entry
*
* @param[in] inseg_entry InSegment entry
* @param[in] attr_count Number of attributes
* @param[in] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_create_inseg_entry_fn)(
_In_ const sai_inseg_entry_t *inseg_entry,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);
/**
* @brief Remove In Segment entry
*
* @param[in] inseg_entry InSegment entry
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_remove_inseg_entry_fn)(
_In_ const sai_inseg_entry_t *inseg_entry);
/**
* @brief Set In Segment attribute value
*
* @param[in] inseg_entry InSegment entry
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_set_inseg_entry_attribute_fn)(
_In_ const sai_inseg_entry_t *inseg_entry,
_In_ const sai_attribute_t *attr);
/**
* @brief Get In Segment attribute value
*
* @param[in] inseg_entry InSegment entry
* @param[in] attr_count Number of attributes
* @param[inout] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_get_inseg_entry_attribute_fn)(
_In_ const sai_inseg_entry_t *inseg_entry,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);
/**
* @brief Bulk create In Segment entry
*
* @param[in] object_count Number of objects to create
* @param[in] inseg_entry List of object to create
* @param[in] attr_count List of attr_count. Caller passes the number
* of attribute for each object to create.
* @param[in] attr_list List of attributes for every object.
* @param[in] mode Bulk operation error handling mode.
* @param[out] object_statuses List of status for every object. Caller needs to
* allocate the buffer
*
* @return #SAI_STATUS_SUCCESS on success when all objects are created or
* #SAI_STATUS_FAILURE when any of the objects fails to create. When there is
* failure, Caller is expected to go through the list of returned statuses to
* find out which fails and which succeeds.
*/
typedef sai_status_t (*sai_bulk_create_inseg_entry_fn)(
_In_ uint32_t object_count,
_In_ const sai_inseg_entry_t *inseg_entry,
_In_ const uint32_t *attr_count,
_In_ const sai_attribute_t **attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses);
/**
* @brief Bulk remove In Segment entry
*
* @param[in] object_count Number of objects to remove
* @param[in] inseg_entry List of objects to remove
* @param[in] mode Bulk operation error handling mode.
* @param[out] object_statuses List of status for every object. Caller needs to
* allocate the buffer
*
* @return #SAI_STATUS_SUCCESS on success when all objects are removed or
* #SAI_STATUS_FAILURE when any of the objects fails to remove. When there is
* failure, Caller is expected to go through the list of returned statuses to
* find out which fails and which succeeds.
*/
typedef sai_status_t (*sai_bulk_remove_inseg_entry_fn)(
_In_ uint32_t object_count,
_In_ const sai_inseg_entry_t *inseg_entry,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses);
/**
* @brief Bulk set attribute on In Segment entry
*
* @param[in] object_count Number of objects to set attribute
* @param[in] inseg_entry List of objects to set attribute
* @param[in] attr_list List of attributes to set on objects, one attribute per object
* @param[in] mode Bulk operation error handling mode.
* @param[out] object_statuses List of status for every object. Caller needs to
* allocate the buffer
*
* @return #SAI_STATUS_SUCCESS on success when all objects are removed or
* #SAI_STATUS_FAILURE when any of the objects fails to remove. When there is
* failure, Caller is expected to go through the list of returned statuses to
* find out which fails and which succeeds.
*/
typedef sai_status_t (*sai_bulk_set_inseg_entry_attribute_fn)(
_In_ uint32_t object_count,
_In_ const sai_inseg_entry_t *inseg_entry,
_In_ const sai_attribute_t *attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses);
/**
* @brief Bulk get attribute on In Segment entry
*
* @param[in] object_count Number of objects to set attribute
* @param[in] inseg_entry List of objects to set attribute
* @param[in] attr_count List of attr_count. Caller passes the number
* of attribute for each object to get
* @param[inout] attr_list List of attributes to set on objects, one attribute per object
* @param[in] mode Bulk operation error handling mode
* @param[out] object_statuses List of status for every object. Caller needs to
* allocate the buffer
*
* @return #SAI_STATUS_SUCCESS on success when all objects are removed or
* #SAI_STATUS_FAILURE when any of the objects fails to remove. When there is
* failure, Caller is expected to go through the list of returned statuses to
* find out which fails and which succeeds.
*/
typedef sai_status_t (*sai_bulk_get_inseg_entry_attribute_fn)(
_In_ uint32_t object_count,
_In_ const sai_inseg_entry_t *inseg_entry,
_In_ const uint32_t *attr_count,
_Inout_ sai_attribute_t **attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses);
/**
* @brief MPLS methods table retrieved with sai_api_query()
*/
typedef struct _sai_mpls_api_t
{
sai_create_inseg_entry_fn create_inseg_entry;
sai_remove_inseg_entry_fn remove_inseg_entry;
sai_set_inseg_entry_attribute_fn set_inseg_entry_attribute;
sai_get_inseg_entry_attribute_fn get_inseg_entry_attribute;
sai_bulk_create_inseg_entry_fn create_inseg_entries;
sai_bulk_remove_inseg_entry_fn remove_inseg_entries;
sai_bulk_set_inseg_entry_attribute_fn set_inseg_entries_attribute;
sai_bulk_get_inseg_entry_attribute_fn get_inseg_entries_attribute;
} sai_mpls_api_t;
/**
* @}
*/
#endif /** __SAIMPLS_H_ */