-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsaistatus.h
287 lines (239 loc) · 7.9 KB
/
saistatus.h
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
/**
* 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 saistatus.h
*
* @brief This module defines SAI Status codes
*/
#if !defined (__SAISTATUS_H_)
#define __SAISTATUS_H_
/**
* @defgroup SAISTATUS SAI - Status codes definitions
*
* @{
*/
#ifdef _WIN32
#define SAI_STATUS_CODE(_S_) ((sai_status_t)(_S_))
#else
/**
* @brief Any mapping schema from _S_ to error codes convenient on *nix can be used.
*/
#define SAI_STATUS_CODE(_S_) (-(_S_))
#endif
/**
* @brief Status success
*/
#define SAI_STATUS_SUCCESS 0x00000000L
/**
* @brief General failure
*/
#define SAI_STATUS_FAILURE SAI_STATUS_CODE(0x00000001L)
/**
* @brief The request is not supported
*/
#define SAI_STATUS_NOT_SUPPORTED SAI_STATUS_CODE(0x00000002L)
/**
* @brief Not enough memory to complete the operation
*/
#define SAI_STATUS_NO_MEMORY SAI_STATUS_CODE(0x00000003L)
/**
* @brief Insufficient system resources exist to complete the operation
*/
#define SAI_STATUS_INSUFFICIENT_RESOURCES SAI_STATUS_CODE(0x00000004L)
/**
* @brief An invalid parameter was passed to a function
*/
#define SAI_STATUS_INVALID_PARAMETER SAI_STATUS_CODE(0x00000005L)
/**
* @brief An item already exists. For example, create a route which already
* exists.
*/
#define SAI_STATUS_ITEM_ALREADY_EXISTS SAI_STATUS_CODE(0x00000006L)
/**
* @brief An item was not found. For example, remove a route which does not
* exist.
*/
#define SAI_STATUS_ITEM_NOT_FOUND SAI_STATUS_CODE(0x00000007L)
/**
* @brief The data was too large to fit into the specified buffer.
*/
#define SAI_STATUS_BUFFER_OVERFLOW SAI_STATUS_CODE(0x00000008L)
/**
* @brief Invalid port number
*/
#define SAI_STATUS_INVALID_PORT_NUMBER SAI_STATUS_CODE(0x00000009L)
/**
* @brief Invalid port member
*/
#define SAI_STATUS_INVALID_PORT_MEMBER SAI_STATUS_CODE(0x0000000AL)
/**
* @brief Invalid VLAN id
*/
#define SAI_STATUS_INVALID_VLAN_ID SAI_STATUS_CODE(0x0000000BL)
/**
* @brief Object is uninitialized
*/
#define SAI_STATUS_UNINITIALIZED SAI_STATUS_CODE(0x0000000CL)
/**
* @brief Table is full
*/
#define SAI_STATUS_TABLE_FULL SAI_STATUS_CODE(0x0000000DL)
/**
* @brief Mandatory attribute is missing
*/
#define SAI_STATUS_MANDATORY_ATTRIBUTE_MISSING SAI_STATUS_CODE(0x0000000EL)
/**
* @brief Function is not implemented
*/
#define SAI_STATUS_NOT_IMPLEMENTED SAI_STATUS_CODE(0x0000000FL)
/**
* @brief Address not found
*/
#define SAI_STATUS_ADDR_NOT_FOUND SAI_STATUS_CODE(0x00000010L)
/**
* @brief SAI Object is in use
*/
#define SAI_STATUS_OBJECT_IN_USE SAI_STATUS_CODE(0x00000011L)
/**
* @brief Invalid SAI Object type passed to a function.
*
* If the object id is passed as an attribute value in list, then
* #SAI_STATUS_INVALID_ATTR_VALUE_0 status code should be used.
*/
#define SAI_STATUS_INVALID_OBJECT_TYPE SAI_STATUS_CODE(0x00000012L)
/**
* @brief Invalid SAI Object ID passed to a function.
*
* Return #SAI_STATUS_INVALID_OBJECT_TYPE when the object type is invalid,
* otherwise return this #SAI_STATUS_INVALID_OBJECT_ID. This can happen if the
* object id is already deleted.
*/
#define SAI_STATUS_INVALID_OBJECT_ID SAI_STATUS_CODE(0x00000013L)
/**
* @brief The NV storage used is either invalid or corrupt. (rv for initialize_switch())
*/
#define SAI_STATUS_INVALID_NV_STORAGE SAI_STATUS_CODE(0x00000014L)
/**
* @brief The NV storage is full. (rv for shutdown_switch())
*/
#define SAI_STATUS_NV_STORAGE_FULL SAI_STATUS_CODE(0x00000015L)
/**
* @brief Version mismatch in case of Inservice upgrade (rv for initialize_switch())
*/
#define SAI_STATUS_SW_UPGRADE_VERSION_MISMATCH SAI_STATUS_CODE(0x00000016L)
/**
* @brief Operation not executed
*/
#define SAI_STATUS_NOT_EXECUTED SAI_STATUS_CODE(0x00000017L)
/**
* @brief Attribute is invalid
*
* Range from 0x00010000L to 0x0001FFFFL.
*
* Return this when the property attached to the attribute does not match
* the API call.
*
* For example:
* - When a READ_ONLY attribute is passed set_attribute or create call
* - When a CREATE_ONLY attribute is passed to set_attribute call
*
* The offset from #SAI_STATUS_INVALID_ATTRIBUTE_0 is the array index of
* the attribute list passed to the SAI API call.
*/
#define SAI_STATUS_INVALID_ATTRIBUTE_0 SAI_STATUS_CODE(0x00010000L)
/**
* @brief End of invalid attribute range
*/
#define SAI_STATUS_INVALID_ATTRIBUTE_MAX SAI_STATUS_CODE(0x0001FFFFL)
/**
* @brief Invalid attribute value
*
* Range from 0x00020000L to 0x0002FFFFL.
*/
#define SAI_STATUS_INVALID_ATTR_VALUE_0 SAI_STATUS_CODE(0x00020000L)
/**
* @brief End of invalid attribute value range
*/
#define SAI_STATUS_INVALID_ATTR_VALUE_MAX SAI_STATUS_CODE(0x0002FFFFL)
/**
* @brief Attribute is not implemented
*
* Range from 0x00030000L to 0x003FFFFL.
*
* Return this when the attribute is supported but not implemented on
* the platform.
*/
#define SAI_STATUS_ATTR_NOT_IMPLEMENTED_0 SAI_STATUS_CODE(0x00030000L)
/**
* @brief End of not implemented range
*/
#define SAI_STATUS_ATTR_NOT_IMPLEMENTED_MAX SAI_STATUS_CODE(0x0003FFFFL)
/**
* @brief Attribute is unknown
*
* Range from 0x00040000L to 0x004FFFFL.
*
* Return this when the attribute is undefined, e.g., the attribute id
* is out of range.
*/
#define SAI_STATUS_UNKNOWN_ATTRIBUTE_0 SAI_STATUS_CODE(0x00040000L)
/**
* @brief End of unknown attribute range
*/
#define SAI_STATUS_UNKNOWN_ATTRIBUTE_MAX SAI_STATUS_CODE(0x0004FFFFL)
/**
* @brief Attribute is not supported
*
* Range from 0x00050000L to 0x005FFFFL.
*
* Return this when the platform does not have the capability to support
* this attribute.
*/
#define SAI_STATUS_ATTR_NOT_SUPPORTED_0 SAI_STATUS_CODE(0x00050000L)
/**
* @brief End of attribute not supported range
*/
#define SAI_STATUS_ATTR_NOT_SUPPORTED_MAX SAI_STATUS_CODE(0x0005FFFFL)
/*
* Macros to check if attribute related error is within the specified range
*/
/**
* @brief Is invalid attribute helper
*/
#define SAI_STATUS_IS_INVALID_ATTRIBUTE(x) (((x) & (~0xFFFF)) == SAI_STATUS_INVALID_ATTRIBUTE_0)
/**
* @brief Is invalid attribute value helper
*/
#define SAI_STATUS_IS_INVALID_ATTR_VALUE(x) (((x) & (~0xFFFF)) == SAI_STATUS_INVALID_ATTR_VALUE_0)
/**
* @brief Is attribute not implemented helper
*/
#define SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(x) (((x) & (~0xFFFF)) == SAI_STATUS_ATTR_NOT_IMPLEMENTED_0)
/**
* @brief Is unknown attribute helper
*/
#define SAI_STATUS_IS_UNKNOWN_ATTRIBUTE(x) (((x) & (~0xFFFF)) == SAI_STATUS_INVALID_ATTRIBUTE_0)
/**
* @brief Is attribute not supported helper
*/
#define SAI_STATUS_IS_ATTR_NOT_SUPPORTED(x) (((x) & (~0xFFFF)) == SAI_STATUS_ATTR_NOT_SUPPORTED_0)
/**
* @}
*/
#endif /** __SAISTATUS_H_ */