Skip to content

Commit

Permalink
Adaptive Routing and Switching (#1681)
Browse files Browse the repository at this point in the history
* Adaptive Routing and Switching
This PR introduces a new concept where forwarding is done based parametric quality computation of the forwarding paths.

---------

Signed-off-by: Jai Kumar <jai.kumar@broadcom.com>
  • Loading branch information
JaiOCP authored Feb 23, 2023
1 parent f12d9e3 commit cec6e1c
Show file tree
Hide file tree
Showing 14 changed files with 1,689 additions and 1 deletion.
853 changes: 853 additions & 0 deletions doc/ARS/Adaptive-Routing-and-Switching.md

Large diffs are not rendered by default.

Binary file added doc/ARS/OCP-2022-ARS.pptx
Binary file not shown.
Binary file added doc/figures/ARSPacketFlow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/figures/ARSPipeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions inc/sai.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#define __SAI_H_

#include "saiacl.h"
#include "saiars.h"
#include "saiarsprofile.h"
#include "saibridge.h"
#include "saibuffer.h"
#include "saicounter.h"
Expand Down Expand Up @@ -140,6 +142,8 @@ typedef enum _sai_api_t
SAI_API_MY_MAC = 45, /**< sai_my_mac_api_t */
SAI_API_IPSEC = 46, /**< sai_ipsec_api_t */
SAI_API_GENERIC_PROGRAMMABLE = 47, /**<sai_generic_programmable_t */
SAI_API_ARS = 48, /**<sai_ars_api_t */
SAI_API_ARS_PROFILE = 49, /**<sai_ars_api_profile_t */
SAI_API_MAX, /**< total number of APIs */
} sai_api_t;

Expand Down
41 changes: 40 additions & 1 deletion inc/saiacl.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ typedef enum _sai_acl_action_type_t
/** Set Forwarding class */
SAI_ACL_ACTION_TYPE_SET_FORWARDING_CLASS = 0x00000034,

/** Set ARS monitoring */
SAI_ACL_ACTION_TYPE_SET_ARS_MONITORING = 0x00000035,

/** Set ARS object */
SAI_ACL_ACTION_TYPE_SET_ARS_OBJECT = 0x00000036,

/** Disable ARS forwarding */
SAI_ACL_ACTION_TYPE_DISABLE_ARS_FORWARDING = 0x00000037,

} sai_acl_action_type_t;

/**
Expand Down Expand Up @@ -2937,10 +2946,40 @@ typedef enum _sai_acl_entry_attr_t
*/
SAI_ACL_ENTRY_ATTR_ACTION_SET_FORWARDING_CLASS = SAI_ACL_ENTRY_ATTR_ACTION_START + 0x34,

/**
* @brief Enable ARS monitoring for a destination that can be a LAG or nexthopgroup
*
* @type sai_acl_action_data_t sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_LAG, SAI_OBJECT_TYPE_NEXT_HOP_GROUP
* @default disabled
*/
SAI_ACL_ENTRY_ATTR_ACTION_SET_ARS_MONITORING = SAI_ACL_ENTRY_ATTR_ACTION_START + 0x35,

/**
* @brief Enable ARS object for a destination that can be a LAG or nexthopgroup
*
* @type sai_acl_action_data_t sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_ARS
* @default disabled
*/
SAI_ACL_ENTRY_ATTR_ACTION_SET_ARS_OBJECT = SAI_ACL_ENTRY_ATTR_ACTION_START + 0x36,

/**
* @brief Disable ARS forwarding for a destination that can be a LAG or nexthopgroup
*
* @type sai_acl_action_data_t sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_LAG, SAI_OBJECT_TYPE_NEXT_HOP_GROUP
* @default disabled
*/
SAI_ACL_ENTRY_ATTR_ACTION_DISABLE_ARS_FORWARDING = SAI_ACL_ENTRY_ATTR_ACTION_START + 0x37,

/**
* @brief End of Rule Actions
*/
SAI_ACL_ENTRY_ATTR_ACTION_END = SAI_ACL_ENTRY_ATTR_ACTION_SET_FORWARDING_CLASS,
SAI_ACL_ENTRY_ATTR_ACTION_END = SAI_ACL_ENTRY_ATTR_ACTION_DISABLE_ARS_FORWARDING,

/**
* @brief End of ACL Entry attributes
Expand Down
242 changes: 242 additions & 0 deletions inc/saiars.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
/**
* 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 saiars.h
*
* @brief This module defines SAI interface for adaptive routing and switching
*/

#if !defined (__SAIARS_H_)
#define __SAIARS_H_

#include <saitypes.h>

/**
* @defgroup SAIARS SAI - Adaptive Routing and Switching specific API definitions
*
* @{
*/

/**
* @brief Adaptive routing and switching path (re)assignment mode
*/
typedef enum _sai_ars_mode_t
{
/** Per flow-let quality based path (re)assignment */
SAI_ARS_MODE_FLOWLET_QUALITY,

/** Per flow-let random path (re)assignment */
SAI_ARS_MODE_FLOWLET_RANDOM,

/** Per packet quality based path (re)assignment */
SAI_ARS_MODE_PER_PACKET_QUALITY,

/** Per packet random path (re)assignment */
SAI_ARS_MODE_PER_PACKET_RANDOM,

/** Fixed path assignment */
SAI_ARS_MODE_FIXED,

} sai_ars_mode_t;

/**
* @brief Attribute id for adaptive routing and switching
*/
typedef enum _sai_ars_attr_t
{
/**
* @brief Start of attributes
*/
SAI_ARS_ATTR_START,

/**
* @brief ARS path assignment mode
*
* @type sai_ars_mode_t
* @flags CREATE_AND_SET
* @default SAI_ARS_MODE_FLOWLET_QUALITY
*/
SAI_ARS_ATTR_MODE = SAI_ARS_ATTR_START,

/**
* @brief Idle duration in microseconds. This duration is to classifying a flow-let in a macro flow.
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 256
*/
SAI_ARS_ATTR_IDLE_TIME,

/**
* @brief Maximum number of flow states that can be maintained per this ARS object
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 512
*/
SAI_ARS_ATTR_MAX_FLOWS,

/**
* @brief ARS monitoring
*
* @type bool
* @flags CREATE_AND_SET
* @default false
*/
SAI_ARS_ATTR_MON_ENABLE,

/**
* @brief Enable/Disable ARS Samplepacket session
*
* Enable ARS sampling by assigning samplepacket object id.
* Disable ARS sampling by assigning #SAI_NULL_OBJECT_ID as attribute value.
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_SAMPLEPACKET
* @allownull true
* @default SAI_NULL_OBJECT_ID
*/
SAI_ARS_ATTR_SAMPLEPACKET_ENABLE,

/**
* @brief Maximum number of alternate members per adaptive routing group
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 16
*/
SAI_ARS_ATTR_MAX_ALT_MEMEBERS_PER_GROUP,

/**
* @brief Maximum number of primary members per adaptive routing group
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 16
*/
SAI_ARS_ATTR_MAX_PRIMARY_MEMEBERS_PER_GROUP,

/**
* @brief Quality threshold for least cost ARS paths. Crossing down the threshold will result in using the non least cost sub optimal path.
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 16
*/
SAI_ARS_ATTR_PRIMARY_PATH_QUALITY_THRESHOLD,

/**
* @brief Cost of switching over to non least cost ARS paths
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 0
*/
SAI_ARS_ATTR_ALTERNATE_PATH_COST,

/**
* @brief Indicates the bias in favor of alternate path
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 0
*/
SAI_ARS_ATTR_ALTERNATE_PATH_BIAS,

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

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

/** End of custom range base */
SAI_ARS_ATTR_CUSTOM_RANGE_END

} sai_ars_attr_t;

/**
* @brief Create adaptive routing and switching object
*
* @param[out] ars_id Adaptive routing and switching 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_ars_fn)(
_Out_ sai_object_id_t *ars_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);

/**
* @brief Remove adaptive routing and switching object
*
* @param[in] ars_id Adaptive routing and switching id
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_remove_ars_fn)(
_In_ sai_object_id_t ars_id);

/**
* @brief Set Adaptive routing and switching attribute
*
* @param[in] ars_id Adaptive routing and switching id
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_set_ars_attribute_fn)(
_In_ sai_object_id_t ars_id,
_In_ const sai_attribute_t *attr);

/**
* @brief Get Adaptive routing and switching attribute
*
* @param[in] ars_id Adaptive routing and switching 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_ars_attribute_fn)(
_In_ sai_object_id_t ars_id,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

/**
* @brief Adaptive routing and switching methods table retrieved with sai_api_query()
*/
typedef struct _sai_ars_api_t
{
sai_create_ars_fn create_ars;
sai_remove_ars_fn remove_ars;
sai_set_ars_attribute_fn set_ars_attribute;
sai_get_ars_attribute_fn get_ars_attribute;
} sai_ars_api_t;

/**
* @}
*/
#endif /** __SAIARS_H_ */
Loading

0 comments on commit cec6e1c

Please sign in to comment.