Skip to content

Commit 4c3cccc

Browse files
committed
Add dash outbound portmap API
Signed-off-by: Junhua Zhai <junhua.zhai@outlook.com>
1 parent 5ff3424 commit 4c3cccc

5 files changed

Lines changed: 380 additions & 0 deletions

File tree

experimental/saiexperimentaldashoutboundcatopa.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,18 @@ typedef enum _sai_outbound_ca_to_pa_entry_attr_t
243243
*/
244244
SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_IP_ADDR_FAMILY,
245245

246+
/**
247+
* @brief Action parameter outbound port map id
248+
*
249+
* @type sai_object_id_t
250+
* @flags CREATE_AND_SET
251+
* @objects SAI_OBJECT_TYPE_OUTBOUND_PORT_MAP
252+
* @allownull true
253+
* @default SAI_NULL_OBJECT_ID
254+
* @validonly SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_ACTION == SAI_OUTBOUND_CA_TO_PA_ENTRY_ACTION_SET_PRIVATE_LINK_MAPPING
255+
*/
256+
SAI_OUTBOUND_CA_TO_PA_ENTRY_ATTR_OUTBOUND_PORT_MAP_ID,
257+
246258
/**
247259
* @brief End of attributes
248260
*/
Lines changed: 357 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,357 @@
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+
/**
108+
* @brief Rule priority in table
109+
*/
110+
sai_uint32_t priority;
111+
112+
} sai_outbound_port_map_port_range_entry_t;
113+
114+
/**
115+
* @brief Attribute ID for outbound port map port range entry
116+
*/
117+
typedef enum _sai_outbound_port_map_port_range_entry_attr_t
118+
{
119+
/**
120+
* @brief Start of attributes
121+
*/
122+
SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_START,
123+
124+
/**
125+
* @brief Action
126+
*
127+
* @type sai_outbound_port_map_port_range_entry_action_t
128+
* @flags CREATE_AND_SET
129+
* @default SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ACTION_SKIP_MAPPING
130+
*/
131+
SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_ACTION = SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_START,
132+
133+
/**
134+
* @brief Action parameter back end IP
135+
*
136+
* @type sai_ip_address_t
137+
* @flags CREATE_AND_SET
138+
* @default 0.0.0.0
139+
* @validonly SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_ACTION == SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ACTION_MAP_TO_PRIVATE_LINK_SERVICE
140+
*/
141+
SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_BACKEND_IP,
142+
143+
/**
144+
* @brief Action parameter match port base
145+
*
146+
* @type sai_uint16_t
147+
* @flags CREATE_AND_SET
148+
* @isvlan true
149+
* @default 0
150+
* @validonly SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_ACTION == SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ACTION_MAP_TO_PRIVATE_LINK_SERVICE
151+
*/
152+
SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_MATCH_PORT_BASE,
153+
154+
/**
155+
* @brief Action parameter back end port base
156+
*
157+
* @type sai_uint16_t
158+
* @flags CREATE_AND_SET
159+
* @isvlan true
160+
* @default 0
161+
* @validonly SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_ACTION == SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ACTION_MAP_TO_PRIVATE_LINK_SERVICE
162+
*/
163+
SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_BACKEND_PORT_BASE,
164+
165+
/**
166+
* @brief Attach a counter. When it is empty, then packet hits won't be counted.
167+
*
168+
* @type sai_object_id_t
169+
* @flags CREATE_AND_SET
170+
* @objects SAI_OBJECT_TYPE_COUNTER
171+
* @allownull true
172+
* @default SAI_NULL_OBJECT_ID
173+
*/
174+
SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_COUNTER_ID,
175+
176+
/**
177+
* @brief End of attributes
178+
*/
179+
SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_END,
180+
181+
/** Custom range base value */
182+
SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_CUSTOM_RANGE_START = 0x10000000,
183+
184+
/** End of custom range base */
185+
SAI_OUTBOUND_PORT_MAP_PORT_RANGE_ENTRY_ATTR_CUSTOM_RANGE_END,
186+
187+
} sai_outbound_port_map_port_range_entry_attr_t;
188+
189+
/**
190+
* @brief Create outbound port map
191+
*
192+
* @param[out] outbound_port_map_id Entry id
193+
* @param[in] switch_id Switch id
194+
* @param[in] attr_count Number of attributes
195+
* @param[in] attr_list Array of attributes
196+
*
197+
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
198+
*/
199+
typedef sai_status_t (*sai_create_outbound_port_map_fn)(
200+
_Out_ sai_object_id_t *outbound_port_map_id,
201+
_In_ sai_object_id_t switch_id,
202+
_In_ uint32_t attr_count,
203+
_In_ const sai_attribute_t *attr_list);
204+
205+
/**
206+
* @brief Remove outbound port map
207+
*
208+
* @param[in] outbound_port_map_id Entry id
209+
*
210+
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
211+
*/
212+
typedef sai_status_t (*sai_remove_outbound_port_map_fn)(
213+
_In_ sai_object_id_t outbound_port_map_id);
214+
215+
/**
216+
* @brief Set attribute for outbound port map
217+
*
218+
* @param[in] outbound_port_map_id Entry id
219+
* @param[in] attr Attribute
220+
*
221+
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
222+
*/
223+
typedef sai_status_t (*sai_set_outbound_port_map_attribute_fn)(
224+
_In_ sai_object_id_t outbound_port_map_id,
225+
_In_ const sai_attribute_t *attr);
226+
227+
/**
228+
* @brief Get attribute for outbound port map
229+
*
230+
* @param[in] outbound_port_map_id Entry id
231+
* @param[in] attr_count Number of attributes
232+
* @param[inout] attr_list Array of attributes
233+
*
234+
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
235+
*/
236+
typedef sai_status_t (*sai_get_outbound_port_map_attribute_fn)(
237+
_In_ sai_object_id_t outbound_port_map_id,
238+
_In_ uint32_t attr_count,
239+
_Inout_ sai_attribute_t *attr_list);
240+
241+
/**
242+
* @brief Create outbound port map port range entry
243+
*
244+
* @param[in] outbound_port_map_port_range_entry Entry
245+
* @param[in] attr_count Number of attributes
246+
* @param[in] attr_list Array of attributes
247+
*
248+
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
249+
*/
250+
typedef sai_status_t (*sai_create_outbound_port_map_port_range_entry_fn)(
251+
_In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry,
252+
_In_ uint32_t attr_count,
253+
_In_ const sai_attribute_t *attr_list);
254+
255+
/**
256+
* @brief Remove outbound port map port range entry
257+
*
258+
* @param[in] outbound_port_map_port_range_entry Entry
259+
*
260+
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
261+
*/
262+
typedef sai_status_t (*sai_remove_outbound_port_map_port_range_entry_fn)(
263+
_In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry);
264+
265+
/**
266+
* @brief Set attribute for outbound port map port range entry
267+
*
268+
* @param[in] outbound_port_map_port_range_entry Entry
269+
* @param[in] attr Attribute
270+
*
271+
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
272+
*/
273+
typedef sai_status_t (*sai_set_outbound_port_map_port_range_entry_attribute_fn)(
274+
_In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry,
275+
_In_ const sai_attribute_t *attr);
276+
277+
/**
278+
* @brief Get attribute for outbound port map port range entry
279+
*
280+
* @param[in] outbound_port_map_port_range_entry Entry
281+
* @param[in] attr_count Number of attributes
282+
* @param[inout] attr_list Array of attributes
283+
*
284+
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
285+
*/
286+
typedef sai_status_t (*sai_get_outbound_port_map_port_range_entry_attribute_fn)(
287+
_In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry,
288+
_In_ uint32_t attr_count,
289+
_Inout_ sai_attribute_t *attr_list);
290+
291+
/**
292+
* @brief Bulk create outbound port map port range entry
293+
*
294+
* @param[in] object_count Number of objects to create
295+
* @param[in] outbound_port_map_port_range_entry List of object to create
296+
* @param[in] attr_count List of attr_count. Caller passes the number
297+
* of attribute for each object to create.
298+
* @param[in] attr_list List of attributes for every object.
299+
* @param[in] mode Bulk operation error handling mode.
300+
* @param[out] object_statuses List of status for every object. Caller needs to
301+
* allocate the buffer
302+
*
303+
* @return #SAI_STATUS_SUCCESS on success when all objects are created or
304+
* #SAI_STATUS_FAILURE when any of the objects fails to create. When there is
305+
* failure, Caller is expected to go through the list of returned statuses to
306+
* find out which fails and which succeeds.
307+
*/
308+
typedef sai_status_t (*sai_bulk_create_outbound_port_map_port_range_entry_fn)(
309+
_In_ uint32_t object_count,
310+
_In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry,
311+
_In_ const uint32_t *attr_count,
312+
_In_ const sai_attribute_t **attr_list,
313+
_In_ sai_bulk_op_error_mode_t mode,
314+
_Out_ sai_status_t *object_statuses);
315+
316+
/**
317+
* @brief Bulk remove outbound port map port range entry
318+
*
319+
* @param[in] object_count Number of objects to remove
320+
* @param[in] outbound_port_map_port_range_entry List of objects to remove
321+
* @param[in] mode Bulk operation error handling mode.
322+
* @param[out] object_statuses List of status for every object. Caller needs to
323+
* allocate the buffer
324+
*
325+
* @return #SAI_STATUS_SUCCESS on success when all objects are removed or
326+
* #SAI_STATUS_FAILURE when any of the objects fails to remove. When there is
327+
* failure, Caller is expected to go through the list of returned statuses to
328+
* find out which fails and which succeeds.
329+
*/
330+
typedef sai_status_t (*sai_bulk_remove_outbound_port_map_port_range_entry_fn)(
331+
_In_ uint32_t object_count,
332+
_In_ const sai_outbound_port_map_port_range_entry_t *outbound_port_map_port_range_entry,
333+
_In_ sai_bulk_op_error_mode_t mode,
334+
_Out_ sai_status_t *object_statuses);
335+
336+
typedef struct _sai_dash_outbound_port_map_api_t
337+
{
338+
sai_create_outbound_port_map_fn create_outbound_port_map;
339+
sai_remove_outbound_port_map_fn remove_outbound_port_map;
340+
sai_set_outbound_port_map_attribute_fn set_outbound_port_map_attribute;
341+
sai_get_outbound_port_map_attribute_fn get_outbound_port_map_attribute;
342+
sai_bulk_object_create_fn create_outbound_port_maps;
343+
sai_bulk_object_remove_fn remove_outbound_port_maps;
344+
345+
sai_create_outbound_port_map_port_range_entry_fn create_outbound_port_map_port_range_entry;
346+
sai_remove_outbound_port_map_port_range_entry_fn remove_outbound_port_map_port_range_entry;
347+
sai_set_outbound_port_map_port_range_entry_attribute_fn set_outbound_port_map_port_range_entry_attribute;
348+
sai_get_outbound_port_map_port_range_entry_attribute_fn get_outbound_port_map_port_range_entry_attribute;
349+
sai_bulk_create_outbound_port_map_port_range_entry_fn create_outbound_port_map_port_range_entries;
350+
sai_bulk_remove_outbound_port_map_port_range_entry_fn remove_outbound_port_map_port_range_entries;
351+
352+
} sai_dash_outbound_port_map_api_t;
353+
354+
/**
355+
* @}
356+
*/
357+
#endif /** __SAIEXPERIMENTALDASHOUTBOUNDPORTMAP_H_ */

experimental/saiextensions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "saiportextensions.h"
3535

3636
/* new experimental object type includes */
37+
#include "saiexperimentaldashoutboundportmap.h"
3738
#include "saiexperimentaldashappliance.h"
3839
#include "saiexperimentaldashflow.h"
3940
#include "saiexperimentaldashtunnel.h"
@@ -89,6 +90,8 @@ typedef enum _sai_api_extensions_t
8990

9091
SAI_API_DASH_APPLIANCE,
9192

93+
SAI_API_DASH_OUTBOUND_PORT_MAP,
94+
9295
/* Add new experimental APIs above this line */
9396

9497
SAI_API_EXTENSIONS_RANGE_END

0 commit comments

Comments
 (0)