Skip to content

Commit

Permalink
Support SAI API for L2_ECMP_GROUP and non-DF filtering
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
yfedoriachenko authored and RuslanValovyiGL committed Jul 6, 2024
1 parent 18ba20f commit 1c13fe8
Show file tree
Hide file tree
Showing 4 changed files with 275 additions and 1 deletion.
2 changes: 2 additions & 0 deletions inc/sai.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
#include "saimymac.h"
#include "saigenericprogrammable.h"
#include "saitwamp.h"
#include "sail2ecmpgroup.h"
#include "saiversion.h"
#include "saipoe.h"

Expand Down Expand Up @@ -148,6 +149,7 @@ typedef enum _sai_api_t
SAI_API_ARS_PROFILE = 49, /**<sai_ars_api_profile_t */
SAI_API_TWAMP = 50, /**< sai_twamp_api_t */
SAI_API_POE = 51, /**< sai_poe_api_t */
SAI_API_L2_ECMP_GROUP = 52, /**< sai_l2_ecmp_group_api_t */
SAI_API_MAX, /**< total number of APIs */

/** Custom range base value */
Expand Down
26 changes: 25 additions & 1 deletion inc/saibridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ typedef enum _sai_bridge_port_type_t
/** Bridge tunnel port */
SAI_BRIDGE_PORT_TYPE_TUNNEL,

/** Bridge L2 ECMP Group */
SAI_BRIDGE_PORT_TYPE_L2_ECMP_GROUP,

} sai_bridge_port_type_t;

/**
Expand Down Expand Up @@ -181,7 +184,7 @@ typedef enum _sai_bridge_port_attr_t
* @type sai_object_id_t
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_BRIDGE
* @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
* @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
*/
SAI_BRIDGE_PORT_ATTR_BRIDGE_ID,

Expand Down Expand Up @@ -259,6 +262,27 @@ typedef enum _sai_bridge_port_attr_t
*/
SAI_BRIDGE_PORT_ATTR_ISOLATION_GROUP,

/**
* @brief Indication if this bridge port is Not a Designated Forwarder
* When set, egress BUM traffic on this bridge port will be dropped.
*
* @type bool
* @flags CREATE_AND_SET
* @default false
* @validonly SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_PORT
*/
SAI_BRIDGE_PORT_ATTR_NON_DF,

/**
* @brief Associated L2 ECMP Group
*
* @type sai_object_id_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @objects SAI_OBJECT_TYPE_L2_ECMP_GROUP
* @condition SAI_BRIDGE_PORT_ATTR_TYPE == SAI_BRIDGE_PORT_TYPE_L2_ECMP_GROUP
*/
SAI_BRIDGE_PORT_ATTR_L2_ECMP_GROUP_ID,

/**
* @brief End of attributes
*/
Expand Down
246 changes: 246 additions & 0 deletions inc/sail2ecmpgroup.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
/**
* Copyright (c) 20XX 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 sail2ecmpgroup.h
*
* @brief This module defines SAI L2 ECMP GROUP interface
*/

#if !defined (__SAIL2ECMPGROUP_H_)
#define __SAIL2ECMPGROUP_H_

#include <saitypes.h>

/**
* @defgroup SAIL2ECMPGROUP SAI - L2 ECMP GROUP specific API definitions
*
* @{
*/

/**
* @brief Attribute id for L2 ECMP GROUP
*/
typedef enum _sai_l2_ecmp_group_attr_t
{
/**
* @brief Start of attributes
*/
SAI_L2_ECMP_GROUP_ATTR_START,

/**
* @brief Number of L2 ECMP GROUP members in the group
*
* @type sai_uint32_t
* @flags READ_ONLY
*/
SAI_L2_ECMP_GROUP_ATTR_MEMBER_COUNT = SAI_L2_ECMP_GROUP_ATTR_START,

/**
* @brief L2 ECMP GROUP member list
*
* @type sai_object_list_t
* @flags READ_ONLY
* @objects SAI_OBJECT_TYPE_L2_ECMP_GROUP_MEMBER
*/
SAI_L2_ECMP_GROUP_ATTR_MEMBER_LIST,

/**
* @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_L2_ECMP_GROUP_ATTR_COUNTER_ID,

/**
* @brief End of attributes
*/
SAI_L2_ECMP_GROUP_ATTR_END,

/** Custom range base value */
SAI_L2_ECMP_GROUP_ATTR_CUSTOM_RANGE_START = 0x10000000,

/** End of custom range base */
SAI_L2_ECMP_GROUP_ATTR_CUSTOM_RANGE_END

} sai_l2_ecmp_group_attr_t;

typedef enum _sai_l2_ecmp_group_member_attr_t
{
/**
* @brief Start of attributes
*/
SAI_L2_ECMP_GROUP_MEMBER_ATTR_START,

/**
* @brief L2 ECMP GROUP id
*
* @type sai_object_id_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @objects SAI_OBJECT_TYPE_L2_ECMP_GROUP
*/
SAI_L2_ECMP_GROUP_MEMBER_ATTR_L2_ECMP_GROUP_ID = SAI_L2_ECMP_GROUP_MEMBER_ATTR_START,

/**
* @brief P2P Tunnel oid
*
* @type sai_object_id_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @objects SAI_OBJECT_TYPE_TUNNEL
*/
SAI_L2_ECMP_GROUP_MEMBER_ATTR_TUNNEL_ID,

/**
* @brief End of attributes
*/
SAI_L2_ECMP_GROUP_MEMBER_ATTR_END,

/** Custom range base value */
SAI_L2_ECMP_GROUP_MEMBER_ATTR_CUSTOM_RANGE_START = 0x10000000,

/** End of custom range base */
SAI_L2_ECMP_GROUP_MEMBER_ATTR_CUSTOM_RANGE_END

} sai_l2_ecmp_group_member_attr_t;

/**
* @brief Create L2 ECMP group
*
* @param[out] l2_ecmp_group_id L2 ECMP group id
* @param[in] switch_id Switch id
* @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_l2_ecmp_group_fn)(
_Out_ sai_object_id_t *l2_ecmp_group_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);

/**
* @brief Remove L2 ECMP group
*
* @param[in] l2_ecmp_group_id L2 ECMP group id
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_remove_l2_ecmp_group_fn)(
_In_ sai_object_id_t l2_ecmp_group_id);

/**
* @brief Set L2 ECMP Group attribute
*
* @param[in] l2_ecmp_group_id L2 ECMP group id
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_set_l2_ecmp_group_attribute_fn)(
_In_ sai_object_id_t l2_ecmp_group_id,
_In_ const sai_attribute_t *attr);

/**
* @brief Get L2 ECMP Group attribute
*
* @param[in] l2_ecmp_group_id L2 ECMP group ID
* @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_l2_ecmp_group_attribute_fn)(
_In_ sai_object_id_t l2_ecmp_group_id,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

/**
* @brief Create L2 ECMP group member
*
* @param[out] l2_ecmp_group_member_id L2 ECMP group member id
* @param[in] switch_id Switch ID
* @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_l2_ecmp_group_member_fn)(
_Out_ sai_object_id_t *l2_ecmp_group_member_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);

/**
* @brief Remove L2 ECMP group member
*
* @param[in] l2_ecmp_group_member_id L2 ECMP group member ID
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_remove_l2_ecmp_group_member_fn)(
_In_ sai_object_id_t l2_ecmp_group_member_id);

/**
* @brief Set L2 ECMP Group member attribute
*
* @param[in] l2_ecmp_group_member_id L2 ECMP group member ID
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_set_l2_ecmp_group_member_attribute_fn)(
_In_ sai_object_id_t l2_ecmp_group_member_id,
_In_ const sai_attribute_t *attr);

/**
* @brief Get L2 ECMP Group member attribute
*
* @param[in] l2_ecmp_group_member_id L2 ECMP group member ID
* @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_l2_ecmp_group_member_attribute_fn)(
_In_ sai_object_id_t l2_ecmp_group_member_id,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

typedef struct _sai_l2_ecmp_group_api_t
{
sai_create_l2_ecmp_group_fn create_l2_ecmp_group;
sai_remove_l2_ecmp_group_fn remove_l2_ecmp_group;
sai_set_l2_ecmp_group_attribute_fn set_l2_ecmp_group_attribute;
sai_get_l2_ecmp_group_attribute_fn get_l2_ecmp_group_attribute;
sai_create_l2_ecmp_group_member_fn create_l2_ecmp_group_member;
sai_remove_l2_ecmp_group_member_fn remove_l2_ecmp_group_member;
sai_set_l2_ecmp_group_member_attribute_fn set_l2_ecmp_group_member_attribute;
sai_get_l2_ecmp_group_member_attribute_fn get_l2_ecmp_group_member_attribute;
} sai_l2_ecmp_group_api_t;

/**
* @}
*/
#endif /** __SAIL2ECMPGROUP_H_ */
2 changes: 2 additions & 0 deletions inc/saitypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ typedef enum _sai_object_type_t
SAI_OBJECT_TYPE_POE_DEVICE = 108,
SAI_OBJECT_TYPE_POE_PSE = 109,
SAI_OBJECT_TYPE_POE_PORT = 110,
SAI_OBJECT_TYPE_L2_ECMP_GROUP = 111,
SAI_OBJECT_TYPE_L2_ECMP_GROUP_MEMBER = 112,

/** Must remain in last position */
SAI_OBJECT_TYPE_MAX,
Expand Down

0 comments on commit 1c13fe8

Please sign in to comment.