Skip to content

Add DASH HA API #1547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dash
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
228 changes: 228 additions & 0 deletions experimental/saiexperimentaldashha.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
/**
* 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 saiexperimentaldashha.h
*
* @brief This module defines SAI P4 extension interface
*/

#if !defined (__SAIEXPERIMENTALDASHHA_H_)
#define __SAIEXPERIMENTALDASHHA_H_

#include <saitypes.h>

/**
* @defgroup SAIEXPERIMENTALDASHHA SAI - Extension specific API definitions
*
* @{
*/

/**
* @brief Attribute data for #SAI_DASH_HA_SESSION_ATTR_ROLE
*/
typedef enum _sai_dash_ha_session_role_t
{
/**
* @brief This device accepts new connections if session is down
*/
SAI_DASH_HA_SESSION_ROLE_ACTIVE,

/**
* @brief This device doesn't accept new connections if session is down
*/
SAI_DASH_HA_SESSION_ROLE_BACKUP,

} sai_dash_ha_session_role_t;

/**
* @brief Attribute data for #SAI_DASH_HA_SESSION_ATTR_OPER_STATE
*/
typedef enum _sai_dash_ha_session_oper_state_t
{
/**
* @brief No connectivity with a peering device
*/
SAI_DASH_HA_SESSION_OPER_STATE_DOWN,

/**
* @brief Connected to a peering device, not yet fully synced
*/
SAI_DASH_HA_SESSION_OPER_STATE_CONNECTED,

/**
* @brief Connected to a peering device, fully synced
*/
SAI_DASH_HA_SESSION_OPER_STATE_SYNCED,

} sai_dash_ha_session_oper_state_t;

/**
* @brief Attribute ID for DASH HA session
*/
typedef enum _sai_dash_ha_session_attr_t
{
/**
* @brief Start of attributes
*/
SAI_DASH_HA_SESSION_ATTR_START,

/**
* @brief HA session administrative state
*
* @type bool
* @flags CREATE_AND_SET
* @default false
*/
SAI_DASH_HA_SESSION_ATTR_ADMIN_STATE = SAI_DASH_HA_SESSION_ATTR_START,

/**
* @brief Peer's IP address
*
* @type sai_ip_address_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
*/
SAI_DASH_HA_SESSION_ATTR_PEER_IP,

/**
* @brief Device role
*
* @type sai_dash_ha_session_role_t
* @flags CREATE_AND_SET
* @default SAI_DASH_HA_SESSION_ROLE_ACTIVE
*/
SAI_DASH_HA_SESSION_ATTR_ROLE,

/**
* @brief List of ENI to sync
*
* @type sai_object_list_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @objects SAI_OBJECT_TYPE_ENI
* @allownull false
*/
SAI_DASH_HA_SESSION_ATTR_ENI_OBJECT_ID_LIST,

/**
* @brief Operational state of the session sync
*
* @type sai_dash_ha_session_oper_state_t
* @flags READ_ONLY
*/
SAI_DASH_HA_SESSION_ATTR_OPER_STATE,

/**
* @brief Sync message batch size
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 1
*/
SAI_DASH_HA_SESSION_ATTR_BATCH_SIZE,

/**
* @brief Sync latency
*
* the greatest latency allowed before a newly
* learned connection is sent to a peer if batch is not full.
* Value is in microseconds.
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 0
*/
SAI_DASH_HA_SESSION_ATTR_BATCH_TIMEOUT,

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

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

/** End of custom range base */
SAI_DASH_HA_SESSION_ATTR_CUSTOM_RANGE_END,

} sai_dash_ha_session_attr_t;

/**
* @brief Create DASH HA session
*
* @param[out] dash_ha_session_id Entry 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_dash_ha_session_fn)(
_Out_ sai_object_id_t *dash_ha_session_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);

/**
* @brief Remove DASH HA session
*
* @param[in] dash_ha_session_id Entry id
*
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
*/
typedef sai_status_t (*sai_remove_dash_ha_session_fn)(
_In_ sai_object_id_t dash_ha_session_id);

/**
* @brief Set attribute for DASH HA session
*
* @param[in] dash_ha_session_id Entry id
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success Failure status code on error
*/
typedef sai_status_t (*sai_set_dash_ha_session_attribute_fn)(
_In_ sai_object_id_t dash_ha_session_id,
_In_ const sai_attribute_t *attr);

/**
* @brief Get attribute for DASH HA session
*
* @param[in] dash_ha_session_id Entry 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_dash_ha_session_attribute_fn)(
_In_ sai_object_id_t dash_ha_session_id,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

typedef struct _sai_dash_ha_api_t
{
sai_create_dash_ha_session_fn create_dash_ha_session;
sai_remove_dash_ha_session_fn remove_dash_ha_session;
sai_set_dash_ha_session_attribute_fn set_dash_ha_session_attribute;
sai_get_dash_ha_session_attribute_fn get_dash_ha_session_attribute;

} sai_dash_ha_api_t;

/**
* @}
*/
#endif /** __SAIEXPERIMENTALDASHHA_H_ */
3 changes: 3 additions & 0 deletions experimental/saiextensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "saiswitchextensions.h"

/* new experimental object type includes */
#include "saiexperimentaldashha.h"
#include "saiexperimentaldashvnet.h"
#include "saiexperimentaldashacl.h"
#include "saiexperimentaldash.h"
Expand All @@ -54,6 +55,8 @@ typedef enum _sai_api_extensions_t

SAI_API_DASH_VNET,

SAI_API_DASH_HA,

/* Add new experimental APIs above this line */

SAI_API_EXTENSIONS_RANGE_END
Expand Down
2 changes: 2 additions & 0 deletions experimental/saitypesextensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ typedef enum _sai_object_type_extensions_t

SAI_OBJECT_TYPE_PA_VALIDATION_ENTRY,

SAI_OBJECT_TYPE_DASH_HA_SESSION,

/* Add new experimental object types above this line */

SAI_OBJECT_TYPE_EXTENSIONS_RANGE_END
Expand Down