realtek-doc/sources/rtk-gp3000/include/dal/ca8277b/dal_ca8277b_vlan.h
2025-12-04 22:26:46 +05:00

315 lines
No EOL
8.1 KiB
C
Executable file

/*
* Copyright (C) 2015 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_CA8277B_VLAN_H__
#define __DAL_CA8277B_VLAN_H__
/*
* Include Files
*/
#include <common/rt_type.h>
#include <rtk/vlan.h>
/*
* Symbol Definition
*/
#define DAL_CA8277B_DEFAULT_VLAN_ID (1)
/****************************************************************/
/* Type Definition */
/****************************************************************/
/*
* Macro Declaration
*/
/*
* Function Declaration
*/
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_init(void);
/* Module Name : Vlan */
/* Sub-module Name: Vlan table configure and modification */
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_create(rtk_vlan_t vid);
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_destroy(rtk_vlan_t vid);
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_destroyAll(uint32 restoreDefaultVlan);
/* Module Name : Vlan */
/* Sub-module Name: Port based and protocol based vlan */
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_portPvid_get(rtk_port_t port, uint32 *pPvid);
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_portPvid_set(rtk_port_t port, uint32 pvid);
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_port_get(rtk_vlan_t vid,rtk_portmask_t *pMemberPortmask,rtk_portmask_t *pUntagPortmask);
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_port_set(rtk_vlan_t vid,rtk_portmask_t *pMember_portmask,rtk_portmask_t *pUntag_portmask);
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_vlanFunctionEnable_get(rtk_enable_t *pEnable);
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_vlanFunctionEnable_set(rtk_enable_t enable);
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_fidMode_get(rtk_vlan_t vid, rtk_fidMode_t *pMode);
/* Function Name:
* dal_ca8277b_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_ca8277b_vlan_fidMode_set(rtk_vlan_t vid, rtk_fidMode_t mode);
#endif /* __DAL_CA8277B_VLAN_H__ */