/* * Copyright (C) 2014 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: 39101 $ * $Date: 2013-05-03 17:35:27 +0800 (週五, 03 五月 2013) $ * * Purpose : Definition of VLAN API * * Feature : The file includes the following modules and sub-modules * (1) Vlan table configure and modification * (2) Accept frame type * (3) Vlan ingress/egress filter * (4) Port based and protocol based vlan * (5) TPID configuration * (6) Ingress tag handling * (7) Tag format handling * */ #ifndef __DAL_RTL9602C_VLAN_H__ #define __DAL_RTL9602C_VLAN_H__ /* * Include Files */ #include #include /* * Symbol Definition */ #define DAL_RTL9602C_DEFAULT_VLAN_ID (1) typedef enum rtl9602c_vlan_l2HashType_e { RTL9602C_VLAN_HASH_SVL = 0, RTL9602C_VLAN_HASH_IVL, RTL9602C_VLAN_HASH_END }rtl9602c_vlan_l2HashType_t; typedef struct rtl9602c_vlan4kentry_s{ uint32 vid; rtk_portmask_t mbr; rtk_portmask_t untag; rtk_portmask_t exMbr; uint32 fid_msti; rtl9602c_vlan_l2HashType_t ivl_svl; rtk_enable_t svlanHash; }rtl9602c_vlan4kentry_t; typedef enum rtl9602c_dal_vlan_egrTagMode_e { RTL9602C_DAL_VLAN_EGR_TAG_MODE_ORI = 0, RTL9602C_DAL_VLAN_EGR_TAG_MODE_KEEP, RTL9602C_DAL_VLAN_EGR_TAG_MODE_PRI_TAG, RTL9602C_DAL_VLAN_EGR_TAG_MODE_END } rtl9602c_dal_vlan_egrTagMode_t; typedef enum rtl9602c_dal_vlanAcpFrameType_e { RTL9602C_DAL_VLAN_ACCEPT_ALL = 0, RTL9602C_DAL_VLAN_ACCEPT_TAGGED_ONLY, RTL9602C_DAL_VLAN_ACCEPT_UNTAGGED_ONLY, RTL9602C_DAL_VLAN_ACCEPT_1Q_1P_TAGGED_ONLY, RTL9602C_DAL_VLAN_ACCEPT_TYPE_END } rtl9602c_dal_vlanAcpFrameType_t; typedef enum rtl9602c_dal_protoVlanFrameType_e { RTL9602C_DAL_PPVLAN_FRAME_TYPE_ETHERNET = 0, RTL9602C_DAL_PPVLAN_FRAME_TYPE_LLC, RTL9602C_DAL_PPVLAN_FRAME_TYPE_RFC1042, RTL9602C_DAL_PPVLAN_FRAME_TYPE_END } rtl9602c_dal_protoVlanFrameType_t; typedef struct rtl9602c_dal_protoValnEntryCfg_s { uint32 index; rtl9602c_dal_protoVlanFrameType_t frameType; uint32 etherType; } rtl9602c_dal_protoValnEntryCfg_t; typedef struct rtl9602c_dal_protoVlanCfg_s { uint32 index; rtk_enable_t valid; uint32 vid; uint32 priority; } rtl9602c_dal_protoVlanCfg_t; typedef enum rtl9602c_dal_vlan_cfiKeepMode_e { RTL9602C_DAL_CFI_ALWAYS_0 = 0, RTL9602C_DAL_CFI_KEEP_INGRESS, RTL9602C_DAL_CFI_KEEP_TYPE_END } rtl9602c_dal_vlan_cfiKeepMode_t; typedef enum rtl9602c_dal_vlanTag_e { RTL9602C_DAL_VLAN_UNTAG = 0, RTL9602C_DAL_VLAN_TAG, RTL9602C_DAL_VLAN_TAG_TYPE_END } rtl9602c_dal_vlanTag_t; /* * Macro Declaration */ /* * Function Declaration */ extern int32 dal_rtl9602c_vlan_existCheck(rtk_vlan_t vid); /* Function Name: * dal_rtl9602c_vlan_init * Description: * Initialize vlan module. * Input: * None * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * Note: * Must initialize vlan module before calling any vlan APIs. */ extern int32 dal_rtl9602c_vlan_init(void); /* Module Name : Vlan */ /* Sub-module Name: Vlan table configure and modification */ /* Function Name: * dal_rtl9602c_vlan_create * Description: * Create the vlan in the specified device. * Input: * vid - vlan id to be created * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_EXIST - vlan is exist * Note: */ extern int32 dal_rtl9602c_vlan_create(rtk_vlan_t vid); /* Function Name: * dal_rtl9602c_vlan_destroy * Description: * Destroy the vlan. * Input: * vid - vlan id to be destroyed * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * Note: * None */ extern int32 dal_rtl9602c_vlan_destroy(rtk_vlan_t vid); /* Function Name: * dal_rtl9602c_vlan_destroyAll * Description: * Destroy all vlans except default vlan. * Input: * restore_default_vlan - keep and restore default vlan id or not? * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_UNIT_ID - invalid unit id * Note: * The restore argument is permit following value: * - 0: remove default vlan * - 1: restore default vlan */ extern int32 dal_rtl9602c_vlan_destroyAll(uint32 restoreDefaultVlan); /* Function Name: * dal_rtl9602c_vlan_fid_get * Description: * Get the filter id of the vlan. * Input: * vid - vlan id * Output: * pFid - pointer buffer of filter id * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * (1) In IVL mode, vid is equal with fid after vlan create. * (2) You don't need to care fid when you use the IVL mode. * (3) The API should be used for SVL mode. */ extern int32 dal_rtl9602c_vlan_fid_get(rtk_vlan_t vid, rtk_fid_t *pFid); /* Function Name: * dal_rtl9602c_vlan_fid_set * Description: * Set the filter id of the vlan. * Input: * vid - vlan id * fid - filter id * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * RT_ERR_OUT_OF_RANGE - input parameter out of range * Note: */ extern int32 dal_rtl9602c_vlan_fid_set(rtk_vlan_t vid, rtk_fid_t fid); /* Function Name: * dal_rtl9602c_vlan_fidMode_get * Description: * Get the filter id mode of the vlan. * Input: * vid - vlan id * Output: * pMode - pointer buffer of filter id mode * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * mode can be: -VLAN__FID_IVL * -VLAN__FID_SVL */ extern int32 dal_rtl9602c_vlan_fidMode_get(rtk_vlan_t vid, rtk_fidMode_t *pMode); /* Function Name: * dal_rtl9602c_vlan_fidMode_set * Description: * Set the filter id mode of the vlan. * Input: * vid - vlan id * mode - filter id mode * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * RT_ERR_OUT_OF_RANGE - input parameter out of range * Note: * mode can be: -VLAN__FID_IVL * -VLAN__FID_SVL */ extern int32 dal_rtl9602c_vlan_fidMode_set(rtk_vlan_t vid, rtk_fidMode_t mode); /* Function Name: * dal_rtl9602c_vlan_port_get * Description: * Get the vlan members. * Input: * vid - vlan id * Output: * pMember_portmask - pointer buffer of member ports * pUntag_portmask - pointer buffer of untagged member ports * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * None */ extern int32 dal_rtl9602c_vlan_port_get( rtk_vlan_t vid, rtk_portmask_t *pMemberPortmask, rtk_portmask_t *pUntagPortmask); /* Function Name: * dal_rtl9602c_vlan_port_set * Description: * Replace the vlan members. * Input: * vid - vlan id * pMember_portmask - member ports * pUntag_portmask - untagged member ports * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * Don't care the original vlan members and replace with new configure * directly. */ extern int32 dal_rtl9602c_vlan_port_set( rtk_vlan_t vid, rtk_portmask_t *pMember_portmask, rtk_portmask_t *pUntag_portmask); /* Function Name: * dal_rtl9602c_vlan_stg_get * Description: * Get spanning tree group instance of the vlan from the specified device. * Input: * vid - vlan id * Output: * pStg - pointer buffer of spanning tree group instance * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * None */ extern int32 dal_rtl9602c_vlan_stg_get(rtk_vlan_t vid, rtk_stg_t *pStg); /* Function Name: * dal_rtl9602c_vlan_stg_set * Description: * Set spanning tree group instance of the vlan. * Input: * vid - vlan id * stg - spanning tree group instance * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * RT_ERR_MSTI - invalid msti * Note: * None */ extern int32 dal_rtl9602c_vlan_stg_set(rtk_vlan_t vid, rtk_stg_t stg); /* Module Name : vlan */ /* Sub-module Name : vlan port attribute */ /* Function Name: * dal_rtl9602c_vlan_portAcceptFrameType_get * Description: * Get vlan accept frame type of the port. * Input: * port - port id * Output: * pAcceptFrameType - pointer buffer of accept frame type * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * The accept frame type as following: * - ACCEPT_FRAME_TYPE_ALL * - ACCEPT_FRAME_TYPE_TAG_ONLY * - ACCEPT_FRAME_TYPE_UNTAG_ONLY * - ACCPET_FRAME_TYPE_1P_1Q_TAG_ONLY * */ extern int32 dal_rtl9602c_vlan_portAcceptFrameType_get( rtk_port_t port, rtk_vlan_acceptFrameType_t *pAcceptFrameType); /* Function Name: * dal_rtl9602c_vlan_portAcceptFrameType_set * Description: * Set vlan accept frame type of the port. * Input: * port - port id * acceptFrameType - accept frame type * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_VLAN_ACCEPT_FRAME_TYPE - invalid accept frame type * RT_ERR_CHIP_NOT_SUPPORTED - functions not supported by this chip model * Note: * The accept frame type as following: * - ACCEPT_FRAME_TYPE_ALL * - ACCEPT_FRAME_TYPE_TAG_ONLY * - ACCEPT_FRAME_TYPE_UNTAG_ONLY */ extern int32 dal_rtl9602c_vlan_portAcceptFrameType_set( rtk_port_t port, rtk_vlan_acceptFrameType_t acceptFrameType); /* Function Name: * dal_rtl9602c_vlan_vlanFunctionEnable_get * Description: * Get the VLAN enable status. * Input: * enable - enable status * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * Note: * The status of vlan function is as following: * - DISABLED * - ENABLED */ extern int32 dal_rtl9602c_vlan_vlanFunctionEnable_get(rtk_enable_t *pEnable); /* Function Name: * dal_rtl9602c_vlan_vlanFunctionEnable_set * Description: * Set the VLAN enable status. * Input: * enable - enable status * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * Note: * The status of vlan function is as following: * - DISABLED * - ENABLED */ extern int32 dal_rtl9602c_vlan_vlanFunctionEnable_set(rtk_enable_t enable); /* Module Name : Vlan */ /* Sub-module Name: Vlan ingress/egress filter */ /* Function Name: * dal_rtl9602c_vlan_portIgrFilterEnable_get * Description: * Get vlan ingress filter status of the port. * Input: * port - port id * Output: * pEnable - pointer buffer of ingress filter status * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * The status of vlan function is as following: * - DISABLED * - ENABLED */ extern int32 dal_rtl9602c_vlan_portIgrFilterEnable_get(rtk_port_t port, rtk_enable_t *pEnable); /* Function Name: * dal_rtl9602c_vlan_portIgrFilterEnable_set * Description: * Set vlan ingress filter status of the port to the specified device. * Input: * port - port id * enable - ingress filter configure * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_INPUT - invalid input parameter * Note: * The status of vlan ingress filter is as following: * - DISABLED * - ENABLED */ extern int32 dal_rtl9602c_vlan_portIgrFilterEnable_set(rtk_port_t port, rtk_enable_t enable); /* Function Name: * dal_rtl9602c_vlan_leaky_get * Description: * Get VLAN leaky. * Input: * type - Packet type for VLAN leaky. * Output: * pEnable - Leaky status. * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_INPUT - Invalid input parameters. * Note: * This API can get VLAN leaky status for RMA and IGMP/MLD packets. * The leaky frame types are as following: * - LEAKY_BRG_GROUP, * - LEAKY_FD_PAUSE, * - LEAKY_SP_MCAST, * - LEAKY_1X_PAE, * - LEAKY_UNDEF_BRG_04, * - LEAKY_UNDEF_BRG_05, * - LEAKY_UNDEF_BRG_06, * - LEAKY_UNDEF_BRG_07, * - LEAKY_PROVIDER_BRIDGE_GROUP_ADDRESS, * - LEAKY_UNDEF_BRG_09, * - LEAKY_UNDEF_BRG_0A, * - LEAKY_UNDEF_BRG_0B, * - LEAKY_UNDEF_BRG_0C, * - LEAKY_PROVIDER_BRIDGE_GVRP_ADDRESS, * - LEAKY_8021AB, * - LEAKY_UNDEF_BRG_0F, * - LEAKY_BRG_MNGEMENT, * - LEAKY_UNDEFINED_11, * - LEAKY_UNDEFINED_12, * - LEAKY_UNDEFINED_13, * - LEAKY_UNDEFINED_14, * - LEAKY_UNDEFINED_15, * - LEAKY_UNDEFINED_16, * - LEAKY_UNDEFINED_17, * - LEAKY_UNDEFINED_18, * - LEAKY_UNDEFINED_19, * - LEAKY_UNDEFINED_1A, * - LEAKY_UNDEFINED_1B, * - LEAKY_UNDEFINED_1C, * - LEAKY_UNDEFINED_1D, * - LEAKY_UNDEFINED_1E, * - LEAKY_UNDEFINED_1F, * - LEAKY_GMRP, * - LEAKY_GVRP, * - LEAKY_UNDEF_GARP_22, * - LEAKY_UNDEF_GARP_23, * - LEAKY_UNDEF_GARP_24, * - LEAKY_UNDEF_GARP_25, * - LEAKY_UNDEF_GARP_26, * - LEAKY_UNDEF_GARP_27, * - LEAKY_UNDEF_GARP_28, * - LEAKY_UNDEF_GARP_29, * - LEAKY_UNDEF_GARP_2A, * - LEAKY_UNDEF_GARP_2B, * - LEAKY_UNDEF_GARP_2C, * - LEAKY_UNDEF_GARP_2D, * - LEAKY_UNDEF_GARP_2E, * - LEAKY_UNDEF_GARP_2F, * - LEAKY_IGMP, * - LEAKY_CDP, * - LEAKY_SSTP, */ extern int32 dal_rtl9602c_vlan_leaky_get(rtk_leaky_type_t type, rtk_enable_t *pEnable); /* Function Name: * dal_rtl9602c_vlan_leaky_set * Description: * Set VLAN leaky. * Input: * type - Packet type for VLAN leaky. * enable - Leaky status. * Output: * None * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_INPUT - Invalid input parameters. * RT_ERR_ENABLE - Invalid enable input * Note: * This API can set VLAN leaky for RMA and IGMP/MLD packets. * The leaky frame types are as following: * - LEAKY_BRG_GROUP, * - LEAKY_FD_PAUSE, * - LEAKY_SP_MCAST, * - LEAKY_1X_PAE, * - LEAKY_UNDEF_BRG_04, * - LEAKY_UNDEF_BRG_05, * - LEAKY_UNDEF_BRG_06, * - LEAKY_UNDEF_BRG_07, * - LEAKY_PROVIDER_BRIDGE_GROUP_ADDRESS, * - LEAKY_UNDEF_BRG_09, * - LEAKY_UNDEF_BRG_0A, * - LEAKY_UNDEF_BRG_0B, * - LEAKY_UNDEF_BRG_0C, * - LEAKY_PROVIDER_BRIDGE_GVRP_ADDRESS, * - LEAKY_8021AB, * - LEAKY_UNDEF_BRG_0F, * - LEAKY_BRG_MNGEMENT, * - LEAKY_UNDEFINED_11, * - LEAKY_UNDEFINED_12, * - LEAKY_UNDEFINED_13, * - LEAKY_UNDEFINED_14, * - LEAKY_UNDEFINED_15, * - LEAKY_UNDEFINED_16, * - LEAKY_UNDEFINED_17, * - LEAKY_UNDEFINED_18, * - LEAKY_UNDEFINED_19, * - LEAKY_UNDEFINED_1A, * - LEAKY_UNDEFINED_1B, * - LEAKY_UNDEFINED_1C, * - LEAKY_UNDEFINED_1D, * - LEAKY_UNDEFINED_1E, * - LEAKY_UNDEFINED_1F, * - LEAKY_GMRP, * - LEAKY_GVRP, * - LEAKY_UNDEF_GARP_22, * - LEAKY_UNDEF_GARP_23, * - LEAKY_UNDEF_GARP_24, * - LEAKY_UNDEF_GARP_25, * - LEAKY_UNDEF_GARP_26, * - LEAKY_UNDEF_GARP_27, * - LEAKY_UNDEF_GARP_28, * - LEAKY_UNDEF_GARP_29, * - LEAKY_UNDEF_GARP_2A, * - LEAKY_UNDEF_GARP_2B, * - LEAKY_UNDEF_GARP_2C, * - LEAKY_UNDEF_GARP_2D, * - LEAKY_UNDEF_GARP_2E, * - LEAKY_UNDEF_GARP_2F, * - LEAKY_IGMP, * - LEAKY_CDP, * - LEAKY_SSTP, */ extern int32 dal_rtl9602c_vlan_leaky_set(rtk_leaky_type_t type, rtk_enable_t enable); /* Function Name: * dal_rtl9602c_vlan_portLeaky_get * Description: * Get VLAN port-based leaky. * Input: * port - port ID * type - Packet type for VLAN leaky. * Output: * pEnable - Leaky status. * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_INPUT - Invalid input parameters. * RT_ERR_ENABLE - Invalid enable input * RT_ERR_NULL_POINTER - NULL Pointer * Note: * This API can set VLAN leaky for RMA and IGMP/MLD packets. * The leaky frame types are as following: * - LEAKY_IPMULTICAST */ extern int32 dal_rtl9602c_vlan_portLeaky_get(rtk_port_t port, rtk_leaky_type_t type, rtk_enable_t *pEnable); /* Function Name: * dal_rtl9602c_vlan_portLeaky_set * Description: * Set VLAN port-based leaky. * Input: * port - port ID * type - Packet type for VLAN leaky. * enable - Leaky status. * Output: * None * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_INPUT - Invalid input parameters. * RT_ERR_ENABLE - Invalid enable input * Note: * This API can set VLAN leaky for RMA and IGMP/MLD packets. * The leaky frame types are as following: * - LEAKY_IPMULTICAST */ extern int32 dal_rtl9602c_vlan_portLeaky_set(rtk_port_t port, rtk_leaky_type_t type, rtk_enable_t enable); /* Function Name: * dal_rtl9602c_vlan_keepType_get * Description: * Get VLAN keep format setting. * Input: * type - Packet type for VLAN keep format. * Output: * pEnable - Leaky status. * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_INPUT - Invalid input parameters. * RT_ERR_NULL_POINTER - NULL pointer * Note: */ extern int32 dal_rtl9602c_vlan_keepType_get(rtk_vlan_keep_type_t type, rtk_enable_t *pEnable); /* Function Name: * dal_rtl9602c_vlan_keepType_set * Description: * Set VLAN keep format setting. * Input: * type - Packet type for VLAN keep format. * Output: * pEnable - Leaky status. * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_INPUT - Invalid input parameters. * Note: */ extern int32 dal_rtl9602c_vlan_keepType_set(rtk_vlan_keep_type_t type, rtk_enable_t enable); /* Module Name : Vlan */ /* Sub-module Name: Port based and protocol based vlan */ /* Function Name: * dal_rtl9602c_vlan_portPvid_get * Description: * Get port default vlan id. * Input: * port - port id * Output: * pPvid - pointer buffer of port default vlan id * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * None */ extern int32 dal_rtl9602c_vlan_portPvid_get(rtk_port_t port, uint32 *pPvid); /* Function Name: * dal_rtl9602c_vlan_portPvid_set * Description: * Set port default vlan id. * Input: * port - port id * pvid - port default vlan id * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_VLAN_VID - invalid vid * Note: * None */ extern int32 dal_rtl9602c_vlan_portPvid_set(rtk_port_t port, uint32 pvid); /* Function Name: * dal_rtl9602c_vlan_protoGroup_get * Description: * Get protocol group for protocol based vlan. * Input: * protoGroupIdx - protocol group index * Output: * pProtoGroup - pointer to protocol group * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_OUT_OF_RANGE - protocol group index is out of range * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * None */ extern int32 dal_rtl9602c_vlan_protoGroup_get( uint32 protoGroupIdx, rtk_vlan_protoGroup_t *pProtoGroup); /* Function Name: * dal_rtl9602c_vlan_protoGroup_set * Description: * Set protocol group for protocol based vlan. * Input: * protoGroupIdx - protocol group index * protoGroup - protocol group * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_FRAME_TYPE - invalid frame type * RT_ERR_OUT_OF_RANGE - protocol group index is out of range * RT_ERR_INPUT - invalid input parameter * Note: * Frame type is as following: * - FRAME_TYPE_ETHERNET * - FRAME_TYPE_RFC1042 (SNAP) * - FRAME_TYPE_LLCOTHER */ extern int32 dal_rtl9602c_vlan_protoGroup_set( uint32 protoGroupIdx, rtk_vlan_protoGroup_t *pProtoGroup); /* Function Name: * dal_rtl9602c_vlan_portProtoVlan_get * Description: * Get vlan of specificed protocol group on specified port. * Input: * port - port id * protoGroup_idx - protocol group index * Output: * pVlan_cfg - pointer to vlan configuration of protocol group * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_OUT_OF_RANGE - protocol group index is out of range * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * None */ extern int32 dal_rtl9602c_vlan_portProtoVlan_get( rtk_port_t port, uint32 protoGroupIdx, rtk_vlan_protoVlanCfg_t *pVlanCfg); /* Function Name: * dal_rtl9602c_vlan_portProtoVlan_set * Description: * Set vlan of specificed protocol group on specified port. * Input: * port - port id * protoGroupIdx - protocol group index * pVlanCfg - vlan configuration of protocol group * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_OUT_OF_RANGE - protocol group index is out of range * RT_ERR_INPUT - invalid input parameter * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * None */ extern int32 dal_rtl9602c_vlan_portProtoVlan_set( rtk_port_t port, uint32 protoGroupIdx, rtk_vlan_protoVlanCfg_t *pVlanCfg); /* Module Name : Vlan */ /* Sub-module Name: Tag format handling */ /* Function Name: * dal_rtl9602c_vlan_tagMode_get * Description: * Get vlan tagged mode of the port. * Input: * port - port id * Output: * pTagMode - pointer buffer of vlan tagged mode * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * The vlan tagged mode as following: * - VLAN_TAG_MODE_ORIGINAL (depend on chip normal decision) * - VLAN_TAG_MODE_KEEP_FORMAT (keep ingress format to egress) * - VLAN_TAG_MODE_PRI (always priority tag out) */ extern int32 dal_rtl9602c_vlan_tagMode_get(rtk_port_t port, rtk_vlan_tagMode_t *pTagMode); /* Function Name: * dal_rtl9602c_vlan_tagMode_set * Description: * Set vlan tagged mode of the port. * Input: * port - port id * tagMode - vlan tagged mode * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_INPUT - invalid input parameter * Note: * The vlan tagged mode as following: * - VLAN_TAG_MODE_ORIGINAL (depend on chip normal decision) * - VLAN_TAG_MODE_KEEP_FORMAT (keep ingress format to egress) * - VLAN_TAG_MODE_PRI (always priority tag out) */ extern int32 dal_rtl9602c_vlan_tagMode_set(rtk_port_t port, rtk_vlan_tagMode_t tagMode); /* Function Name: * dal_rtl9602c_vlan_cfiKeepEnable_get * Description: * Get state of CFI keep * Input: * None * Output: * pEnable - Pointer of CFI Keep * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_NULL_POINTER - Null pointer * Note: * ENABLED: Keep original CFI value * DISABLED: Always output VLAN tag with CFI = 0 */ extern int32 dal_rtl9602c_vlan_cfiKeepEnable_get(rtk_enable_t *pEnable); /* Function Name: * dal_rtl9602c_vlan_cfiKeepEnable_set * Description: * Set state of CFI keep * Input: * enable - state of CFI KEEP * Output: * None * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_INPUT - Invalid input parameter. * Note: * ENABLED: Keep original CFI value * DISABLED: Always output VLAN tag with CFI = 0 */ extern int32 dal_rtl9602c_vlan_cfiKeepEnable_set(rtk_enable_t enable); /* Function Name: * dal_rtl9602c_vlan_reservedVidAction_get * Description: * Get the action of VID 0 and VID 4095 packet * Input: * None * Output: * pAction_vid0 - Pointer of VID 0 action * pAction_vid4095 - Pointer of VID 4095 action * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_NULL_POINTER - Null pointer * Note: * RESVID_ACTION_UNTAG: VID 0 or VID 4095 tagged packets will be treated as untagged packets * RESVID_ACTION_TAG: VID 0 or VID 4095 tagged packets will be treated as tagged packets */ extern int32 dal_rtl9602c_vlan_reservedVidAction_get(rtk_vlan_resVidAction_t *pAction_vid0, rtk_vlan_resVidAction_t *pAction_vid4095); /* Function Name: * dal_rtl9602c_vlan_reservedVidAction_set * Description: * Set the action of VID 0 and VID 4095 packet * Input: * None * Output: * action_vid0 - Pointer of VID 0 action * action_vid4095 - Pointer of VID 4095 action * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_INPUT - Error Input * Note: * RESVID_ACTION_UNTAG: VID 0 or VID 4095 tagged packets will be treated as untagged packets * RESVID_ACTION_TAG: VID 0 or VID 4095 tagged packets will be treated as tagged packets */ extern int32 dal_rtl9602c_vlan_reservedVidAction_set(rtk_vlan_resVidAction_t action_vid0, rtk_vlan_resVidAction_t action_vid4095); /* Function Name: * dal_rtl9602c_vlan_tagModeIp4mc_get * Description: * Get vlan tagged mode for ipv4 multicast packet of the port. * Input: * port - port id * Output: * pTagMode - pointer buffer of vlan tagged mode * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * The ipv4 multicast vlan tagged mode as following: * - VLAN_TAG_MODE_IPMC_ORIGINAL (depend on chip normal decision) * - VLAN_TAG_MODE_IPMC_KEEP_FORMAT (keep ingress format to egress) * - VLAN_TAG_MODE_IPMC_PRI (always priority tag out) * - VLAN_TAG_MODE_IPMC_DEFAUL (as default tag mode setting) */ extern int32 dal_rtl9602c_vlan_tagModeIp4mc_get(rtk_port_t port, rtk_vlan_tagModeIpmc_t *pTagMode); /* Function Name: * dal_rtl9602c_vlan_tagModeIp4mc_set * Description: * Set vlan tagged mode of the port. * Input: * port - port id * tagMode - vlan tagged mode * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_INPUT - invalid input parameter * Note: * The ipv4 multicast vlan tagged mode as following: * - VLAN_TAG_MODE_IPMC_ORIGINAL (depend on chip normal decision) * - VLAN_TAG_MODE_IPMC_KEEP_FORMAT (keep ingress format to egress) * - VLAN_TAG_MODE_IPMC_PRI (always priority tag out) * - VLAN_TAG_MODE_IPMC_DEFAUL (as default tag mode setting) */ extern int32 dal_rtl9602c_vlan_tagModeIp4mc_set(rtk_port_t port, rtk_vlan_tagModeIpmc_t tagMode); /* Function Name: * dal_rtl9602c_vlan_tagModeIp6mc_get * Description: * Get vlan tagged mode for ipv6 multicast packet of the port. * Input: * port - port id * Output: * pTagMode - pointer buffer of vlan tagged mode * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * The ipv6 multicast vlan tagged mode as following: * - VLAN_TAG_MODE_IPMC_ORIGINAL (depend on chip normal decision) * - VLAN_TAG_MODE_IPMC_KEEP_FORMAT (keep ingress format to egress) * - VLAN_TAG_MODE_IPMC_PRI (always priority tag out) * - VLAN_TAG_MODE_IPMC_DEFAUL (as default tag mode setting) */ extern int32 dal_rtl9602c_vlan_tagModeIp6mc_get(rtk_port_t port, rtk_vlan_tagModeIpmc_t *pTagMode); /* Function Name: * dal_rtl9602c_vlan_tagModeIp6mc_set * Description: * Set vlan tagged mode of the port. * Input: * port - port id * tagMode - vlan tagged mode * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_INPUT - invalid input parameter * Note: * The ipv4 multicast vlan tagged mode as following: * - VLAN_TAG_MODE_IPMC_ORIGINAL (depend on chip normal decision) * - VLAN_TAG_MODE_IPMC_KEEP_FORMAT (keep ingress format to egress) * - VLAN_TAG_MODE_IPMC_PRI (always priority tag out) * - VLAN_TAG_MODE_IPMC_DEFAUL (as default tag mode setting) */ extern int32 dal_rtl9602c_vlan_tagModeIp6mc_set(rtk_port_t port, rtk_vlan_tagModeIpmc_t tagMode); /* Function Name: * dal_rtl9602c_vlan_lutSvlanHashState_set * Description: * Packet from SVLAN aware port will hash by SVLAN id. * Input: * vid - vlan id * enable - state for svlan aware port lut hash force using svlan * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: */ extern int32 dal_rtl9602c_vlan_lutSvlanHashState_set(rtk_vlan_t vid, rtk_enable_t enable); /* Function Name: * dal_rtl9602c_vlan_lutSvlanHashState_get * Description: * Packet from SVLAN aware port will hash by SVLAN id. * Input: * vid - vlan id * Output: * pEnable - pointer to svlan aware port SVLAN lut hash status * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: */ extern int32 dal_rtl9602c_vlan_lutSvlanHashState_get(rtk_vlan_t vid, rtk_enable_t *pEnable); /* Function Name: * dal_rtl9602c_vlan_extPort_get * Description: * Get the vlan extension members. * Input: * vid - vlan id * Output: * pExt_portmask - pointer buffer of extension member ports * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * None */ extern int32 dal_rtl9602c_vlan_extPort_get( rtk_vlan_t vid, rtk_portmask_t *pExt_portmask); /* Function Name: * dal_rtl9602c_vlan_extPort_set * Description: * Replace the vlan extension members. * Input: * vid - vlan id * pExt_portmask - extension member ports * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_VLAN_VID - invalid vid * RT_ERR_VLAN_ENTRY_NOT_FOUND - specified vlan entry not found * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * Don't care the original vlan members and replace with new configure * directly. */ extern int32 dal_rtl9602c_vlan_extPort_set( rtk_vlan_t vid, rtk_portmask_t *pExt_portmask); /* Function Name: * dal_rtl9602c_vlan_extPortPvid_get * Description: * Get extension port default vlan id. * Input: * extPort - Extension port id * Output: * pPvid - pointer buffer of port default vlan id * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_NULL_POINTER - input parameter may be null pointer * Note: * None */ extern int32 dal_rtl9602c_vlan_extPortPvid_get(uint32 extPort, uint32 *pPvid); /* Function Name: * dal_rtl9602c_vlan_extPortPvid_set * Description: * Set extension port default vlan id. * Input: * extPort - extension port id * pvid - extension port default vlan id * Output: * None * Return: * RT_ERR_OK * RT_ERR_FAILED * RT_ERR_NOT_INIT - The module is not initial * RT_ERR_PORT_ID - invalid port id * RT_ERR_VLAN_VID - invalid vid * Note: * None */ extern int32 dal_rtl9602c_vlan_extPortPvid_set(uint32 extPort, uint32 pvid); #endif /* __DAL_RTL9602C_VLAN_H__ */