Skip to content

Commit 7703f1f

Browse files
rvalovyiRuslanValovyiGL
authored andcommitted
Support SAI API for L2_ECMP_GROUP and non-DF filtering
This change includes: * new objects: L2_ECMP_GROUP and L2_ECMP_GROUP_MEMBER * new API for L2_ECMP_GROUP * new bridge port type L2_ECMP_GROUP * new bridge port attr L2_ECMP_GROUP_ID * new bridge port attr NON_DF for filtering BUM in EVPN MH setups Signed-off-by: RuslanValovyiGL <ruslan.valovyi@globallogic.com>
1 parent 18ba20f commit 7703f1f

File tree

4 files changed

+275
-1
lines changed

4 files changed

+275
-1
lines changed

inc/sai.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "saimymac.h"
7979
#include "saigenericprogrammable.h"
8080
#include "saitwamp.h"
81+
#include "sail2ecmpgroup.h"
8182
#include "saiversion.h"
8283
#include "saipoe.h"
8384

@@ -148,6 +149,7 @@ typedef enum _sai_api_t
148149
SAI_API_ARS_PROFILE = 49, /**<sai_ars_api_profile_t */
149150
SAI_API_TWAMP = 50, /**< sai_twamp_api_t */
150151
SAI_API_POE = 51, /**< sai_poe_api_t */
152+
SAI_API_L2_ECMP_GROUP = 52, /**< sai_l2_ecmp_group_api_t */
151153
SAI_API_MAX, /**< total number of APIs */
152154

153155
/** Custom range base value */

inc/saibridge.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ typedef enum _sai_bridge_port_type_t
8585
/** Bridge tunnel port */
8686
SAI_BRIDGE_PORT_TYPE_TUNNEL,
8787

88+
/** Bridge L2 ECMP Group */
89+
SAI_BRIDGE_PORT_TYPE_L2_ECMP_GROUP,
90+
8891
} sai_bridge_port_type_t;
8992

9093
/**
@@ -181,7 +184,7 @@ typedef enum _sai_bridge_port_attr_t
181184
* @type sai_object_id_t
182185
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
183186
* @objects SAI_OBJECT_TYPE_BRIDGE
184-
* @condition SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_SUB_PORT or SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_1D_ROUTER or SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_TUNNEL
187+
* @condition SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_SUB_PORT or SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_1D_ROUTER or SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_TUNNEL or SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_L2_ECMP_GROUP
185188
*/
186189
SAI_BRIDGE_PORT_ATTR_BRIDGE_ID,
187190

@@ -259,6 +262,27 @@ typedef enum _sai_bridge_port_attr_t
259262
*/
260263
SAI_BRIDGE_PORT_ATTR_ISOLATION_GROUP,
261264

265+
/**
266+
* @brief Indication if this bridge port is Not a Designated Forwarder
267+
* When set, egress BUM traffic on this bridge port will be dropped.
268+
*
269+
* @type bool
270+
* @flags CREATE_AND_SET
271+
* @default false
272+
* @validonly SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_PORT
273+
*/
274+
SAI_BRIDGE_PORT_ATTR_NON_DF,
275+
276+
/**
277+
* @brief Associated L2 ECMP Group
278+
*
279+
* @type sai_object_id_t
280+
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
281+
* @objects SAI_OBJECT_TYPE_L2_ECMP_GROUP
282+
* @condition SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_L2_ECMP_GROUP
283+
*/
284+
SAI_BRIDGE_PORT_ATTR_L2_ECMP_GROUP_ID,
285+
262286
/**
263287
* @brief End of attributes
264288
*/

inc/sail2ecmpgroup.h

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
/**
2+
* Copyright (c) 20XX 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 sail2ecmpgroup.h
21+
*
22+
* @brief This module defines SAI L2 ECMP GROUP interface
23+
*/
24+
25+
#if !defined (__SAIL2ECMPGROUP_H_)
26+
#define __SAIL2ECMPGROUP_H_
27+
28+
#include <saitypes.h>
29+
30+
/**
31+
* @defgroup SAIL2ECMPGROUP SAI - L2 ECMP GROUP specific API definitions
32+
*
33+
* @{
34+
*/
35+
36+
/**
37+
* @brief Attribute id for L2 ECMP GROUP
38+
*/
39+
typedef enum _sai_l2_ecmp_group_attr_t
40+
{
41+
/**
42+
* @brief Start of attributes
43+
*/
44+
SAI_L2_ECMP_GROUP_ATTR_START,
45+
46+
/**
47+
* @brief Number of L2 ECMP GROUP members in the group
48+
*
49+
* @type sai_uint32_t
50+
* @flags READ_ONLY
51+
*/
52+
SAI_L2_ECMP_GROUP_ATTR_MEMBER_COUNT = SAI_L2_ECMP_GROUP_ATTR_START,
53+
54+
/**
55+
* @brief L2 ECMP GROUP member list
56+
*
57+
* @type sai_object_list_t
58+
* @flags READ_ONLY
59+
* @objects SAI_OBJECT_TYPE_L2_ECMP_GROUP_MEMBER
60+
*/
61+
SAI_L2_ECMP_GROUP_ATTR_MEMBER_LIST,
62+
63+
/**
64+
* @brief Attach a counter
65+
*
66+
* When it is empty, then packet hits won't be counted
67+
*
68+
* @type sai_object_id_t
69+
* @flags CREATE_AND_SET
70+
* @objects SAI_OBJECT_TYPE_COUNTER
71+
* @allownull true
72+
* @default SAI_NULL_OBJECT_ID
73+
*/
74+
SAI_L2_ECMP_GROUP_ATTR_COUNTER_ID,
75+
76+
/**
77+
* @brief End of attributes
78+
*/
79+
SAI_L2_ECMP_GROUP_ATTR_END,
80+
81+
/** Custom range base value */
82+
SAI_L2_ECMP_GROUP_ATTR_CUSTOM_RANGE_START = 0x10000000,
83+
84+
/** End of custom range base */
85+
SAI_L2_ECMP_GROUP_ATTR_CUSTOM_RANGE_END
86+
87+
} sai_l2_ecmp_group_attr_t;
88+
89+
typedef enum _sai_l2_ecmp_group_member_attr_t
90+
{
91+
/**
92+
* @brief Start of attributes
93+
*/
94+
SAI_L2_ECMP_GROUP_MEMBER_ATTR_START,
95+
96+
/**
97+
* @brief L2 ECMP GROUP id
98+
*
99+
* @type sai_object_id_t
100+
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
101+
* @objects SAI_OBJECT_TYPE_L2_ECMP_GROUP
102+
*/
103+
SAI_L2_ECMP_GROUP_MEMBER_ATTR_L2_ECMP_GROUP_ID = SAI_L2_ECMP_GROUP_MEMBER_ATTR_START,
104+
105+
/**
106+
* @brief P2P Tunnel oid
107+
*
108+
* @type sai_object_id_t
109+
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
110+
* @objects SAI_OBJECT_TYPE_TUNNEL
111+
*/
112+
SAI_L2_ECMP_GROUP_MEMBER_ATTR_TUNNEL_ID,
113+
114+
/**
115+
* @brief End of attributes
116+
*/
117+
SAI_L2_ECMP_GROUP_MEMBER_ATTR_END,
118+
119+
/** Custom range base value */
120+
SAI_L2_ECMP_GROUP_MEMBER_ATTR_CUSTOM_RANGE_START = 0x10000000,
121+
122+
/** End of custom range base */
123+
SAI_L2_ECMP_GROUP_MEMBER_ATTR_CUSTOM_RANGE_END
124+
125+
} sai_l2_ecmp_group_member_attr_t;
126+
127+
/**
128+
* @brief Create L2 ECMP group
129+
*
130+
* @param[out] l2_ecmp_group_id L2 ECMP group id
131+
* @param[in] switch_id Switch id
132+
* @param[in] attr_count Number of attributes
133+
* @param[in] attr_list Array of attributes
134+
*
135+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
136+
*/
137+
typedef sai_status_t (*sai_create_l2_ecmp_group_fn)(
138+
_Out_ sai_object_id_t *l2_ecmp_group_id,
139+
_In_ sai_object_id_t switch_id,
140+
_In_ uint32_t attr_count,
141+
_In_ const sai_attribute_t *attr_list);
142+
143+
/**
144+
* @brief Remove L2 ECMP group
145+
*
146+
* @param[in] l2_ecmp_group_id L2 ECMP group id
147+
*
148+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
149+
*/
150+
typedef sai_status_t (*sai_remove_l2_ecmp_group_fn)(
151+
_In_ sai_object_id_t l2_ecmp_group_id);
152+
153+
/**
154+
* @brief Set L2 ECMP Group attribute
155+
*
156+
* @param[in] l2_ecmp_group_id L2 ECMP group id
157+
* @param[in] attr Attribute
158+
*
159+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
160+
*/
161+
typedef sai_status_t (*sai_set_l2_ecmp_group_attribute_fn)(
162+
_In_ sai_object_id_t l2_ecmp_group_id,
163+
_In_ const sai_attribute_t *attr);
164+
165+
/**
166+
* @brief Get L2 ECMP Group attribute
167+
*
168+
* @param[in] l2_ecmp_group_id L2 ECMP group ID
169+
* @param[in] attr_count Number of attributes
170+
* @param[inout] attr_list Array of attributes
171+
*
172+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
173+
*/
174+
typedef sai_status_t (*sai_get_l2_ecmp_group_attribute_fn)(
175+
_In_ sai_object_id_t l2_ecmp_group_id,
176+
_In_ uint32_t attr_count,
177+
_Inout_ sai_attribute_t *attr_list);
178+
179+
/**
180+
* @brief Create L2 ECMP group member
181+
*
182+
* @param[out] l2_ecmp_group_member_id L2 ECMP group member id
183+
* @param[in] switch_id Switch ID
184+
* @param[in] attr_count Number of attributes
185+
* @param[in] attr_list Array of attributes
186+
*
187+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
188+
*/
189+
typedef sai_status_t (*sai_create_l2_ecmp_group_member_fn)(
190+
_Out_ sai_object_id_t *l2_ecmp_group_member_id,
191+
_In_ sai_object_id_t switch_id,
192+
_In_ uint32_t attr_count,
193+
_In_ const sai_attribute_t *attr_list);
194+
195+
/**
196+
* @brief Remove L2 ECMP group member
197+
*
198+
* @param[in] l2_ecmp_group_member_id L2 ECMP group member ID
199+
*
200+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
201+
*/
202+
typedef sai_status_t (*sai_remove_l2_ecmp_group_member_fn)(
203+
_In_ sai_object_id_t l2_ecmp_group_member_id);
204+
205+
/**
206+
* @brief Set L2 ECMP Group member attribute
207+
*
208+
* @param[in] l2_ecmp_group_member_id L2 ECMP group member ID
209+
* @param[in] attr Attribute
210+
*
211+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
212+
*/
213+
typedef sai_status_t (*sai_set_l2_ecmp_group_member_attribute_fn)(
214+
_In_ sai_object_id_t l2_ecmp_group_member_id,
215+
_In_ const sai_attribute_t *attr);
216+
217+
/**
218+
* @brief Get L2 ECMP Group member attribute
219+
*
220+
* @param[in] l2_ecmp_group_member_id L2 ECMP group member ID
221+
* @param[in] attr_count Number of attributes
222+
* @param[inout] attr_list Array of attributes
223+
*
224+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
225+
*/
226+
typedef sai_status_t (*sai_get_l2_ecmp_group_member_attribute_fn)(
227+
_In_ sai_object_id_t l2_ecmp_group_member_id,
228+
_In_ uint32_t attr_count,
229+
_Inout_ sai_attribute_t *attr_list);
230+
231+
typedef struct _sai_l2_ecmp_group_api_t
232+
{
233+
sai_create_l2_ecmp_group_fn create_l2_ecmp_group;
234+
sai_remove_l2_ecmp_group_fn remove_l2_ecmp_group;
235+
sai_set_l2_ecmp_group_attribute_fn set_l2_ecmp_group_attribute;
236+
sai_get_l2_ecmp_group_attribute_fn get_l2_ecmp_group_attribute;
237+
sai_create_l2_ecmp_group_member_fn create_l2_ecmp_group_member;
238+
sai_remove_l2_ecmp_group_member_fn remove_l2_ecmp_group_member;
239+
sai_set_l2_ecmp_group_member_attribute_fn set_l2_ecmp_group_member_attribute;
240+
sai_get_l2_ecmp_group_member_attribute_fn get_l2_ecmp_group_member_attribute;
241+
} sai_l2_ecmp_group_api_t;
242+
243+
/**
244+
* @}
245+
*/
246+
#endif /** __SAIL2ECMPGROUP_H_ */

inc/saitypes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ typedef enum _sai_object_type_t
298298
SAI_OBJECT_TYPE_POE_DEVICE = 108,
299299
SAI_OBJECT_TYPE_POE_PSE = 109,
300300
SAI_OBJECT_TYPE_POE_PORT = 110,
301+
SAI_OBJECT_TYPE_L2_ECMP_GROUP = 111,
302+
SAI_OBJECT_TYPE_L2_ECMP_GROUP_MEMBER = 112,
301303

302304
/** Must remain in last position */
303305
SAI_OBJECT_TYPE_MAX,

0 commit comments

Comments
 (0)