|
| 1 | +/** |
| 2 | + * Copyright (c) 2014 Microsoft Open Technologies, Inc. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | + * not use this file except in compliance with the License. You may obtain |
| 6 | + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + * |
| 8 | + * THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR |
| 9 | + * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT |
| 10 | + * LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS |
| 11 | + * FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT. |
| 12 | + * |
| 13 | + * See the Apache Version 2.0 License for specific language governing |
| 14 | + * permissions and limitations under the License. |
| 15 | + * |
| 16 | + * Microsoft would like to thank the following companies for their review and |
| 17 | + * assistance with these files: Intel Corporation, Mellanox Technologies Ltd, |
| 18 | + * Dell Products, L.P., Facebook, Inc., Marvell International Ltd. |
| 19 | + * |
| 20 | + * @file saiexperimentaldashoutboundportmap.h |
| 21 | + * |
| 22 | + * @brief This module defines SAI extensions for DASH outbound port map |
| 23 | + * |
| 24 | + * @warning This module is a SAI experimental module |
| 25 | + */ |
| 26 | + |
| 27 | +#if !defined (__SAIEXPERIMENTALDASHOUTBOUNDPORTMAP_H_) |
| 28 | +#define __SAIEXPERIMENTALDASHOUTBOUNDPORTMAP_H_ |
| 29 | + |
| 30 | +#include <saitypesextensions.h> |
| 31 | + |
| 32 | +/** |
| 33 | + * @defgroup SAIEXPERIMENTALDASHOUTBOUNDPORTMAP SAI - Experimental: DASH outbound port map specific API definitions |
| 34 | + * |
| 35 | + * @{ |
| 36 | + */ |
| 37 | + |
| 38 | +/** |
| 39 | + * @brief Attribute data for #SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_ACTION |
| 40 | + */ |
| 41 | +typedef enum _sai_outbound_port_map_port_range_entry_action_t |
| 42 | +{ |
| 43 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ACTION_SKIP_MAPPING, |
| 44 | + |
| 45 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ACTION_MAP_TO_PRIVATE_LINK_SERVICE, |
| 46 | + |
| 47 | +} sai_outbound_port_map_port_range_entry_action_t; |
| 48 | + |
| 49 | +/** |
| 50 | + * @brief Attribute ID for outbound port map |
| 51 | + */ |
| 52 | +typedef enum _sai_outbound_port_map_attr_t |
| 53 | +{ |
| 54 | + /** |
| 55 | + * @brief Start of attributes |
| 56 | + */ |
| 57 | + SAI_OUTBOUND_PORT_MAP_ATTR_START, |
| 58 | + |
| 59 | + /** |
| 60 | + * @brief Attach a counter. When it is empty, then packet hits won't be counted. |
| 61 | + * |
| 62 | + * @type sai_object_id_t |
| 63 | + * @flags CREATE_AND_SET |
| 64 | + * @objects SAI_OBJECT_TYPE_COUNTER |
| 65 | + * @allownull true |
| 66 | + * @default SAI_NULL_OBJECT_ID |
| 67 | + */ |
| 68 | + SAI_OUTBOUND_PORT_MAP_ATTR_COUNTER_ID = SAI_OUTBOUND_PORT_MAP_ATTR_START, |
| 69 | + |
| 70 | + /** |
| 71 | + * @brief End of attributes |
| 72 | + */ |
| 73 | + SAI_OUTBOUND_PORT_MAP_ATTR_END, |
| 74 | + |
| 75 | + /** Custom range base value */ |
| 76 | + SAI_OUTBOUND_PORT_MAP_ATTR_CUSTOM_RANGE_START = 0x10000000, |
| 77 | + |
| 78 | + /** End of custom range base */ |
| 79 | + SAI_OUTBOUND_PORT_MAP_ATTR_CUSTOM_RANGE_END, |
| 80 | + |
| 81 | +} sai_outbound_port_map_attr_t; |
| 82 | + |
| 83 | +/** |
| 84 | + * @brief Entry for outbound_port_map_port_range_entry |
| 85 | + */ |
| 86 | +typedef struct _sai_outbound_port_map_port_range_entry_t |
| 87 | +{ |
| 88 | + /** |
| 89 | + * @brief Switch ID |
| 90 | + * |
| 91 | + * @objects SAI_OBJECT_TYPE_SWITCH |
| 92 | + */ |
| 93 | + sai_object_id_t switch_id; |
| 94 | + |
| 95 | + /** |
| 96 | + * @brief Exact matched key outbound_port_map_id |
| 97 | + * |
| 98 | + * @objects SAI_OBJECT_TYPE_OUTBOUND_PORT_MAP |
| 99 | + */ |
| 100 | + sai_object_id_t outbound_port_map_id; |
| 101 | + |
| 102 | + /** |
| 103 | + * @brief Range matched key dst_port_range |
| 104 | + */ |
| 105 | + sai_u32_range_t dst_port_range; |
| 106 | + |
| 107 | +} sai_outbound_port_map_port_range_entry_t; |
| 108 | + |
| 109 | +/** |
| 110 | + * @brief Attribute ID for outbound port map port range entry |
| 111 | + */ |
| 112 | +typedef enum _sai_outbound_port_map_port_range_entry_attr_t |
| 113 | +{ |
| 114 | + /** |
| 115 | + * @brief Start of attributes |
| 116 | + */ |
| 117 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_START, |
| 118 | + |
| 119 | + /** |
| 120 | + * @brief Action |
| 121 | + * |
| 122 | + * @type sai_outbound_port_map_port_range_entry_action_t |
| 123 | + * @flags CREATE_AND_SET |
| 124 | + * @default SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ACTION_SKIP_MAPPING |
| 125 | + */ |
| 126 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_ACTION = SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_START, |
| 127 | + |
| 128 | + /** |
| 129 | + * @brief Action parameter back end IP |
| 130 | + * |
| 131 | + * @type sai_ip_address_t |
| 132 | + * @flags CREATE_AND_SET |
| 133 | + * @default 0.0.0.0 |
| 134 | + * @validonly SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_ACTION == SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ACTION_MAP_TO_PRIVATE_LINK_SERVICE |
| 135 | + */ |
| 136 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_BACKEND_IP, |
| 137 | + |
| 138 | + /** |
| 139 | + * @brief Action parameter match port base |
| 140 | + * |
| 141 | + * @type sai_uint16_t |
| 142 | + * @flags CREATE_AND_SET |
| 143 | + * @isvlan true |
| 144 | + * @default 0 |
| 145 | + * @validonly SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_ACTION == SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ACTION_MAP_TO_PRIVATE_LINK_SERVICE |
| 146 | + */ |
| 147 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_MATCH_PORT_BASE, |
| 148 | + |
| 149 | + /** |
| 150 | + * @brief Action parameter back end port base |
| 151 | + * |
| 152 | + * @type sai_uint16_t |
| 153 | + * @flags CREATE_AND_SET |
| 154 | + * @isvlan true |
| 155 | + * @default 0 |
| 156 | + * @validonly SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_ACTION == SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ACTION_MAP_TO_PRIVATE_LINK_SERVICE |
| 157 | + */ |
| 158 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_BACKEND_PORT_BASE, |
| 159 | + |
| 160 | + /** |
| 161 | + * @brief Attach a counter. When it is empty, then packet hits won't be counted. |
| 162 | + * |
| 163 | + * @type sai_object_id_t |
| 164 | + * @flags CREATE_AND_SET |
| 165 | + * @objects SAI_OBJECT_TYPE_COUNTER |
| 166 | + * @allownull true |
| 167 | + * @default SAI_NULL_OBJECT_ID |
| 168 | + */ |
| 169 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_COUNTER_ID, |
| 170 | + |
| 171 | + /** |
| 172 | + * @brief End of attributes |
| 173 | + */ |
| 174 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_END, |
| 175 | + |
| 176 | + /** Custom range base value */ |
| 177 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_CUSTOM_RANGE_START = 0x10000000, |
| 178 | + |
| 179 | + /** End of custom range base */ |
| 180 | + SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_CUSTOM_RANGE_END, |
| 181 | + |
| 182 | +} sai_outbound_port_map_port_range_entry_attr_t; |
| 183 | + |
| 184 | +/** |
| 185 | + * @brief Create outbound port map |
| 186 | + * |
| 187 | + * @param[out] outbound_port_map_id Entry id |
| 188 | + * @param[in] switch_id Switch id |
| 189 | + * @param[in] attr_count Number of attributes |
| 190 | + * @param[in] attr_list Array of attributes |
| 191 | + * |
| 192 | + * @return #SAI_STATUS_SUCCESS on success Failure status code on error |
| 193 | + */ |
| 194 | +typedef sai_status_t (*sai_create_outbound_port_map_fn)( |
| 195 | + _Out_ sai_object_id_t *outbound_port_map_id, |
| 196 | + _In_ sai_object_id_t switch_id, |
| 197 | + _In_ uint32_t attr_count, |
| 198 | + _In_ const sai_attribute_t *attr_list); |
| 199 | + |
| 200 | +/** |
| 201 | + * @brief Remove outbound port map |
| 202 | + * |
| 203 | + * @param[in] outbound_port_map_id Entry id |
| 204 | + * |
| 205 | + * @return #SAI_STATUS_SUCCESS on success Failure status code on error |
| 206 | + */ |
| 207 | +typedef sai_status_t (*sai_remove_outbound_port_map_fn)( |
| 208 | + _In_ sai_object_id_t outbound_port_map_id); |
| 209 | + |
| 210 | +/** |
| 211 | + * @brief Set attribute for outbound port map |
| 212 | + * |
| 213 | + * @param[in] outbound_port_map_id Entry id |
| 214 | + * @param[in] attr Attribute |
| 215 | + * |
| 216 | + * @return #SAI_STATUS_SUCCESS on success Failure status code on error |
| 217 | + */ |
| 218 | +typedef sai_status_t (*sai_set_outbound_port_map_attribute_fn)( |
| 219 | + _In_ sai_object_id_t outbound_port_map_id, |
| 220 | + _In_ const sai_attribute_t *attr); |
| 221 | + |
| 222 | +/** |
| 223 | + * @brief Get attribute for outbound port map |
| 224 | + * |
| 225 | + * @param[in] outbound_port_map_id Entry id |
| 226 | + * @param[in] attr_count Number of attributes |
| 227 | + * @param[inout] attr_list Array of attributes |
| 228 | + * |
| 229 | + * @return #SAI_STATUS_SUCCESS on success Failure status code on error |
| 230 | + */ |
| 231 | +typedef sai_status_t (*sai_get_outbound_port_map_attribute_fn)( |
| 232 | + _In_ sai_object_id_t outbound_port_map_id, |
| 233 | + _In_ uint32_t attr_count, |
| 234 | + _Inout_ sai_attribute_t *attr_list); |
| 235 | + |
| 236 | +/** |
| 237 | + * @brief Create outbound port map port range entry |
| 238 | + * |
| 239 | + * @param[in] outbound_port_map_port_range_entry Entry |
| 240 | + * @param[in] attr_count Number of attributes |
| 241 | + * @param[in] attr_list Array of attributes |
| 242 | + * |
| 243 | + * @return #SAI_STATUS_SUCCESS on success Failure status code on error |
| 244 | + */ |
| 245 | +typedef sai_status_t (*sai_create_outbound_port_map_port_range_entry_fn)( |
| 246 | + _In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry, |
| 247 | + _In_ uint32_t attr_count, |
| 248 | + _In_ const sai_attribute_t *attr_list); |
| 249 | + |
| 250 | +/** |
| 251 | + * @brief Remove outbound port map port range entry |
| 252 | + * |
| 253 | + * @param[in] outbound_port_map_port_range_entry Entry |
| 254 | + * |
| 255 | + * @return #SAI_STATUS_SUCCESS on success Failure status code on error |
| 256 | + */ |
| 257 | +typedef sai_status_t (*sai_remove_outbound_port_map_port_range_entry_fn)( |
| 258 | + _In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry); |
| 259 | + |
| 260 | +/** |
| 261 | + * @brief Set attribute for outbound port map port range entry |
| 262 | + * |
| 263 | + * @param[in] outbound_port_map_port_range_entry Entry |
| 264 | + * @param[in] attr Attribute |
| 265 | + * |
| 266 | + * @return #SAI_STATUS_SUCCESS on success Failure status code on error |
| 267 | + */ |
| 268 | +typedef sai_status_t (*sai_set_outbound_port_map_port_range_entry_attribute_fn)( |
| 269 | + _In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry, |
| 270 | + _In_ const sai_attribute_t *attr); |
| 271 | + |
| 272 | +/** |
| 273 | + * @brief Get attribute for outbound port map port range entry |
| 274 | + * |
| 275 | + * @param[in] outbound_port_map_port_range_entry Entry |
| 276 | + * @param[in] attr_count Number of attributes |
| 277 | + * @param[inout] attr_list Array of attributes |
| 278 | + * |
| 279 | + * @return #SAI_STATUS_SUCCESS on success Failure status code on error |
| 280 | + */ |
| 281 | +typedef sai_status_t (*sai_get_outbound_port_map_port_range_entry_attribute_fn)( |
| 282 | + _In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry, |
| 283 | + _In_ uint32_t attr_count, |
| 284 | + _Inout_ sai_attribute_t *attr_list); |
| 285 | + |
| 286 | +/** |
| 287 | + * @brief Bulk create outbound port map port range entry |
| 288 | + * |
| 289 | + * @param[in] object_count Number of objects to create |
| 290 | + * @param[in] outbound_port_map_port_range_entry List of object to create |
| 291 | + * @param[in] attr_count List of attr_count. Caller passes the number |
| 292 | + * of attribute for each object to create. |
| 293 | + * @param[in] attr_list List of attributes for every object. |
| 294 | + * @param[in] mode Bulk operation error handling mode. |
| 295 | + * @param[out] object_statuses List of status for every object. Caller needs to |
| 296 | + * allocate the buffer |
| 297 | + * |
| 298 | + * @return #SAI_STATUS_SUCCESS on success when all objects are created or |
| 299 | + * #SAI_STATUS_FAILURE when any of the objects fails to create. When there is |
| 300 | + * failure, Caller is expected to go through the list of returned statuses to |
| 301 | + * find out which fails and which succeeds. |
| 302 | + */ |
| 303 | +typedef sai_status_t (*sai_bulk_create_outbound_port_map_port_range_entry_fn)( |
| 304 | + _In_ uint32_t object_count, |
| 305 | + _In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry, |
| 306 | + _In_ const uint32_t *attr_count, |
| 307 | + _In_ const sai_attribute_t **attr_list, |
| 308 | + _In_ sai_bulk_op_error_mode_t mode, |
| 309 | + _Out_ sai_status_t *object_statuses); |
| 310 | + |
| 311 | +/** |
| 312 | + * @brief Bulk remove outbound port map port range entry |
| 313 | + * |
| 314 | + * @param[in] object_count Number of objects to remove |
| 315 | + * @param[in] outbound_port_map_port_range_entry List of objects to remove |
| 316 | + * @param[in] mode Bulk operation error handling mode. |
| 317 | + * @param[out] object_statuses List of status for every object. Caller needs to |
| 318 | + * allocate the buffer |
| 319 | + * |
| 320 | + * @return #SAI_STATUS_SUCCESS on success when all objects are removed or |
| 321 | + * #SAI_STATUS_FAILURE when any of the objects fails to remove. When there is |
| 322 | + * failure, Caller is expected to go through the list of returned statuses to |
| 323 | + * find out which fails and which succeeds. |
| 324 | + */ |
| 325 | +typedef sai_status_t (*sai_bulk_remove_outbound_port_map_port_range_entry_fn)( |
| 326 | + _In_ uint32_t object_count, |
| 327 | + _In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry, |
| 328 | + _In_ sai_bulk_op_error_mode_t mode, |
| 329 | + _Out_ sai_status_t *object_statuses); |
| 330 | + |
| 331 | +typedef struct _sai_dash_outbound_port_map_api_t |
| 332 | +{ |
| 333 | + sai_create_outbound_port_map_fn create_outbound_port_map; |
| 334 | + sai_remove_outbound_port_map_fn remove_outbound_port_map; |
| 335 | + sai_set_outbound_port_map_attribute_fn set_outbound_port_map_attribute; |
| 336 | + sai_get_outbound_port_map_attribute_fn get_outbound_port_map_attribute; |
| 337 | + sai_bulk_object_create_fn create_outbound_port_maps; |
| 338 | + sai_bulk_object_remove_fn remove_outbound_port_maps; |
| 339 | + |
| 340 | + sai_create_outbound_port_map_port_range_entry_fn create_outbound_port_map_port_range_entry; |
| 341 | + sai_remove_outbound_port_map_port_range_entry_fn remove_outbound_port_map_port_range_entry; |
| 342 | + sai_set_outbound_port_map_port_range_entry_attribute_fn set_outbound_port_map_port_range_entry_attribute; |
| 343 | + sai_get_outbound_port_map_port_range_entry_attribute_fn get_outbound_port_map_port_range_entry_attribute; |
| 344 | + sai_bulk_create_outbound_port_map_port_range_entry_fn create_outbound_port_map_port_range_entries; |
| 345 | + sai_bulk_remove_outbound_port_map_port_range_entry_fn remove_outbound_port_map_port_range_entries; |
| 346 | + |
| 347 | +} sai_dash_outbound_port_map_api_t; |
| 348 | + |
| 349 | +/** |
| 350 | + * @} |
| 351 | + */ |
| 352 | +#endif /** __SAIEXPERIMENTALDASHOUTBOUNDPORTMAP_H_ */ |
0 commit comments