realtek-doc/sources/rtk-dms-1250/include/dal/cypress/dal_cypress_trunk.h
Markus Stockhausen 18a30ac6d1 add XGS1210 sdk
2025-04-27 15:53:52 -04:00

287 lines
8.1 KiB
C

/*
* Copyright (C) 2009-2016 Realtek Semiconductor Corp.
* All Rights Reserved.
*
* This program is the proprietary software of Realtek Semiconductor
* Corporation and/or its licensors, and only be used, duplicated,
* modified or distributed under the authorized license from Realtek.
*
* ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
* THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
*
* $Revision$
* $Date$
*
* Purpose : Definition those public TRUNK APIs and its data type in the SDK.
*
* Feature : The file have include the following module and sub-modules
* 1) Trunk
*
*/
#ifndef __DAL_CYPRESS_TRUNK_H__
#define __DAL_CYPRESS_TRUNK_H__
/*
* Include Files
*/
#include <common/rt_type.h>
#include <common/rt_error.h>
#include <rtk/trunk.h>
#include <dal/dal_mapper.h>
/*
* Symbol Definition
*/
/*
* Data Declaration
*/
/*
* Macro Definition
*/
/*
* Function Declaration
*/
/* Module Name : TRUNK */
/* Function Name:
* dal_cypress_trunkMapper_init
* Description:
* Hook trunk module of the specified device.
* Input:
* unit - unit id
* Output:
* None
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* Note:
* Must Hook trunk module before calling any trunk APIs.
*/
extern int32
dal_cypress_trunkMapper_init(dal_mapper_t *pMapper);
/* Function Name:
* dal_cypress_trunk_init
* Description:
* Initialize trunk module of the specified device.
* Input:
* unit - unit id
* Output:
* None
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* Note:
* Must initialize trunk module before calling any vlan APIs.
*/
extern int32
dal_cypress_trunk_init(uint32 unit);
/* Function Name:
* dal_cypress_trunk_distributionAlgorithmBind_get
* Description:
* Get the distribution algorithm ID binded for a trunk group from the specified device.
* Input:
* unit - unit id
* trk_gid - trunk group id
* Output:
* pAlgo_idx - pointer buffer of the distribution algorithm ID
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_LA_TRUNK_ID - invalid trunk ID
* RT_ERR_NULL_POINTER - input parameter may be null pointer
* Note:
*/
extern int32
dal_cypress_trunk_distributionAlgorithmBind_get(uint32 unit, uint32 trk_gid, uint32 *pAlgo_idx);
/* Function Name:
* dal_cypress_trunk_distributionAlgorithmBind_set
* Description:
* Set the distribution algorithm ID binded for a trunk group from the specified device.
* Input:
* unit - unit id
* trk_gid - trunk group id
* algo_idx - index the distribution algorithm
* Output:
* None
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_LA_TRUNK_ID - invalid trunk ID
* RT_ERR_LA_ALGO_ID - invalid trunk algorithm ID
* Note:
*/
extern int32
dal_cypress_trunk_distributionAlgorithmBind_set(uint32 unit, uint32 trk_gid, uint32 algo_idx);
/* Function Name:
* dal_cypress_trunk_distributionAlgorithmParam_get
* Description:
* Get the distribution algorithm by algorithm ID from the specified device.
* Input:
* unit - unit id
* algo_idx - algorithm index
* Output:
* pAlgo_bitmask - pointer buffer of bitmask of the distribution algorithm
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_LA_ALGO_ID - invalid trunk algorithm ID
* RT_ERR_NULL_POINTER - input parameter may be null pointer
* Note:
*/
extern int32
dal_cypress_trunk_distributionAlgorithmParam_get(uint32 unit, uint32 algo_idx, uint32 *pAlgo_bitmask);
/* Function Name:
* dal_cypress_trunk_distributionAlgorithmParam_set
* Description:
* Set the distribution algorithm by algorithm ID from the specified device.
* Input:
* unit - unit id
* algo_idx - algorithm index
* algo_bitmask - bitmask of the distribution algorithm
* Output:
* None
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_LA_ALGO_ID - invalid trunk algorithm ID
* RT_ERR_LA_HASHMASK - invalid hash mask
* Note:
*/
extern int32
dal_cypress_trunk_distributionAlgorithmParam_set(uint32 unit, uint32 algo_idx, uint32 algo_bitmask);
/* Function Name:
* dal_cypress_trunk_distributionAlgorithmShift_get
* Description:
* Get the shift bits of distribution algorithm parameters from the specified device.
* Input:
* unit - unit id
* algo_idx - algorithm index
* Output:
* pShift - pointer buffer of shift bits of the distribution algorithm
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_LA_ALGO_ID - invalid trunk algorithm ID
* RT_ERR_NULL_POINTER - input parameter may be null pointer
* Note:
*/
extern int32
dal_cypress_trunk_distributionAlgorithmShift_get(uint32 unit, uint32 algo_idx, rtk_trunk_distAlgoShift_t *pShift);
/* Function Name:
* dal_cypress_trunk_distributionAlgorithmShift_set
* Description:
* Set the shift bits of distribution algorithm parameters from the specified device.
* Input:
* unit - unit id
* algo_idx - algorithm index
* pShift - shift bits of the distribution algorithm parameters
* Output:
* None
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_LA_ALGO_ID - invalid trunk algorithm ID
* RT_ERR_LA_ALGO_SHIFT - invalid trunk algorithm shift
* RT_ERR_NULL_POINTER - input parameter may be null pointer
* Note:
*/
extern int32
dal_cypress_trunk_distributionAlgorithmShift_set(uint32 unit, uint32 algo_idx, rtk_trunk_distAlgoShift_t *pShift);
/* Function Name:
* dal_cypress_trunk_trafficSeparate_get
* Description:
* Get the traffic separation setting of a trunk group from the specified device.
* Input:
* unit - unit id
* trk_gid - trunk group id
* Output:
* pSeparateType - pointer to traffic separation type
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_LA_TRUNK_ID - invalid trunk ID
* RT_ERR_NULL_POINTER - input parameter may be null pointer
* Note:
*/
extern int32
dal_cypress_trunk_trafficSeparate_get(uint32 unit, uint32 trk_gid, rtk_trunk_separateType_t *pSeparateType);
/* Function Name:
* dal_cypress_trunk_trafficSeparate_set
* Description:
* Set the traffic separation setting of a trunk group from the specified device.
* Input:
* unit - unit id
* trk_gid - trunk group id
* separateType - traffic separation setting
* Output:
* None
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_LA_TRUNK_ID - invalid trunk ID
* RT_ERR_INPUT - Invalid input parameter
* Note:
*/
extern int32
dal_cypress_trunk_trafficSeparate_set(uint32 unit, uint32 trk_gid, rtk_trunk_separateType_t separateType);
/* Function Name:
* dal_cypress_trunk_port_get
* Description:
* Get the members of the trunk id from the specified device.
* Input:
* unit - unit id
* trk_gid - trunk group id
* Output:
* pTrunk_member_portmask - pointer buffer of trunk member ports
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_LA_TRUNK_ID - invalid trunk ID
* RT_ERR_NULL_POINTER - input parameter may be null pointer
* Note:
*/
extern int32
dal_cypress_trunk_port_get(uint32 unit, uint32 trk_gid, rtk_portmask_t *pTrunk_member_portmask);
/* Function Name:
* dal_cypress_trunk_port_set
* Description:
* Set the members of the trunk id to the specified device.
* Input:
* unit - unit id
* trk_gid - trunk group id
* pTrunk_member_portmask - trunk member ports
* Output:
* None
* Return:
* RT_ERR_OK
* RT_ERR_FAILED
* RT_ERR_LA_TRUNK_ID - invalid trunk ID
* RT_ERR_NULL_POINTER - null pointer
* RT_ERR_LA_MEMBER_OVERLAP - the specified port mask is overlapped with other group
* RT_ERR_LA_PORTMASK - error port mask
* RT_ERR_LA_PORTNUM_NORMAL - it can only aggregate at most eight ports when 802.1ad normal mode
* Note:
* None.
*/
extern int32
dal_cypress_trunk_port_set(uint32 unit, uint32 trk_gid, rtk_portmask_t *pTrunk_member_portmask);
#endif /* __DAL_CYPRESS_TRUNK_H__ */