{"id":921,"date":"2022-06-13T20:20:51","date_gmt":"2022-06-13T12:20:51","guid":{"rendered":"https:\/\/www.iotot.com\/?p=921"},"modified":"2022-06-13T20:20:51","modified_gmt":"2022-06-13T12:20:51","slug":"rtl8305nb-cg%e5%af%84%e5%ad%98%e5%99%a8%e5%ae%9a%e4%b9%89","status":"publish","type":"post","link":"https:\/\/blog.iotot.com\/?p=921","title":{"rendered":"RTL8305NB-CG\u5bc4\u5b58\u5668\u5b9a\u4e49"},"content":{"rendered":"<p>https:\/\/github.com\/Undrizzle\/apps\/blob\/58b712ebf8055266be3192df1292a2246a89d825\/rtl8306e\/rtk_api_ext.h<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">\/*\r\n* Copyright (C) 2010 Realtek Semiconductor Corp.\r\n* All Rights Reserved.\r\n*\r\n* This program is the proprietary software of Realtek Semiconductor\r\n* Corporation and\/or its licensors, and only be used, duplicated,\r\n* modified or distributed under the authorized license from Realtek.\r\n*\r\n* ANY USE OF THE SOFTWARE OTEHR THAN AS AUTHORIZED UNDER \r\n* THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.\r\n* \r\n* $Revision: 10083 $ \r\n* $Date: 2010-06-07 11:18:41 +0800 (\u661f\u671f\u4e00, 07 \u516d\u6708 2010) $\r\n*\r\n* Purpose : Realtek common API function list supported by RTL8306E switch, \r\n*               they could also be applied to chips \r\n*               RTL8306M\/RTL8305N\/RTL8303\/RTL8304E\/RTL8306N\r\n* \r\n* Feature : This file consists of following modules:\r\n*              (1)   Port Configuration              \r\n*              (2)   Rate Limit\r\n*              (3)   QOS\r\n*              (4)   TRAP\r\n*              (5)   VLAN\r\n*              (6)   Spanning Tree\r\n*              (7)   Address Table\r\n*              (8)   CPU Port\r\n*              (9)   Mirror\r\n*              (10)  IEEE 802.1x\r\n*              (11)  SVLAN\r\n*\/\r\n\r\n\r\n#ifndef __RTK_API_EXT_H__\r\n#define __RTK_API_EXT_H__\r\n\r\n#include \"rtl8306e_types.h\"\r\n#include \"rtk_api.h\"\r\n\r\n\/*\r\n * Function Declaration\r\n *\/\r\n \r\n\/*Misc*\/\r\n\r\n\/* Function Name:\r\n *      rtk_switch_init\r\n * Description:\r\n *      Set chip to default configuration enviroment\r\n * Input:\r\n *      none\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                     -  Success\r\n *      RT_ERR_FAILED               -  Failure\r\n * Note:\r\n *     The API can set chip registers to default configuration for\r\n *     different release chip model.\r\n *\/ \r\nextern rtk_api_ret_t rtk_switch_init(void);\r\n\r\n\/* Function Name:\r\n *      rtk_switch_maxPktLen_set\r\n * Description:\r\n *      Set the max packet length of the specific unit\r\n * Input:\r\n *      len       -       max packet length\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                    -  Success\r\n *      RT_ERR_FAILED               -  Failure\r\n *      RT_ERR_INPUT                -  Invalid input parameter\r\n * Note:\r\n *      The API can set max packet length of the specific unit to\r\n *          MAXPKTLEN_1522B,\r\n *          MAXPKTLEN_1536B,\r\n *          MAXPKTLEN_1552B,\r\n *          MAXPKTLEN_2000B, \r\n *\/ \r\nextern rtk_api_ret_t rtk_switch_maxPktLen_set(rtk_switch_maxPktLen_t len); \r\n\r\n\/* Function Name:\r\n *      rtk_switch_maxPktLen_get\r\n * Description:\r\n *      Get the max packet length of the specific unit\r\n * Input:\r\n *      none\r\n * Output:\r\n *      pLen                             -    the pointer of max packet length\r\n * Return: \r\n *      RT_ERR_OK                    -  Success\r\n *      RT_ERR_FAILED               -  Failure\r\n *      RT_ERR_NULL_POINTER     -  Input parameter is null pointer \r\n * Note:\r\n *      The API can set max packet length of the specific unit to\r\n *          MAXPKTLEN_1522B,\r\n *          MAXPKTLEN_1536B,\r\n *          MAXPKTLEN_1552B,\r\n *          MAXPKTLEN_2000B, \r\n *\/\r\n extern rtk_api_ret_t rtk_switch_maxPktLen_get(rtk_switch_maxPktLen_t *pLen);\r\n\r\n\/* Function Name:\r\n *      rtk_port_phyReg_set\r\n * Description:\r\n *      Set PHY register data of the specific port\r\n * Input:\r\n *      phy                - phy number, 0 ~ 6 \r\n *      reg                 - Register id\r\n *      regData           - Register data\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK         -  Success\r\n *      RT_ERR_FAILED   -   Failure\r\n * Note:\r\n *      This API can set PHY register data of the specific port.\r\n *      RTL8306E switch has 5 FE port, and port 4 could be set as\r\n *      phy mode or mac mode, port 5 is mac mode which connect\r\n *      with mii interface. so parameter phy 0 ~4 means port 0 ~4\r\n *      phy register, 5 means port 4 mac mode, 6 means port 5.\r\n *      \r\n *\/\r\nextern rtk_api_ret_t rtk_port_phyReg_set(rtk_port_t port, rtk_port_phy_reg_t reg, rtk_port_phy_data_t value);\r\n\r\n\/* Function Name:\r\n *      rtk_port_phyReg_get\r\n * Description:\r\n *      Get PHY register data of the specific port\r\n * Input:\r\n *      phy                  - phy number, 0 ~ 6\r\n *      reg                   - Register id\r\n * Output:\r\n *      pData               - the pointer of Register data\r\n * Return:\r\n *      RT_ERR_OK        -  Success\r\n *      RT_ERR_FAILED   -  Failure\r\n * Note:\r\n *      This API can set PHY register data of the specific port.\r\n *      RTL8306E switch has 5 FE port, and port 4 could be set as\r\n *      phy mode or mac mode, port 5 is mac mode which connect\r\n *      with mii interface. so parameter phy 0 ~4 means port 0 ~4\r\n *      phy register, 5 means port 4 mac mode, 6 means port 5.\r\n *      \r\n *\/\r\nextern rtk_api_ret_t rtk_port_phyReg_get(rtk_port_t port, rtk_port_phy_reg_t reg, rtk_port_phy_data_t *pData); \r\n\r\n\/* Function Name:\r\n *      rtk_port_phyAutoNegoAbility_set\r\n * Description:\r\n *      Set ethernet PHY auto-negotiation desired ability\r\n * Input:\r\n *      port       -  Port id\r\n *      pAbility   -  Ability structure\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                        \r\n *      RT_ERR_FAILED                  \r\n *      RT_ERR_SMI       \r\n *      RT_ERR_PORT_ID\r\n *      RT_ERR_PHY_REG_ID\r\n *      RT_ERR_NULL_POINTER\r\n *      RT_ERR_BUSYWAIT_TIMEOUT\r\n *     \r\n * Note:\r\n *      (1) RTL8306E switch only has 5 phy, so the input port id should be 0~4.\r\n *      (2) In auto-negotiation mode, phy autoNegotiation ability must be enabled\r\n *\/ \r\nextern rtk_api_ret_t rtk_port_phyAutoNegoAbility_set(rtk_port_t port, rtk_port_phy_ability_t *pAbility);\r\n\r\n\/* Function Name:\r\n *      rtk_port_phyAutoNegoAbility_get\r\n * Description:\r\n *      Get ethernet PHY auto-negotiation desired ability\r\n * Input:\r\n *      port       -  Port id\r\n * Output:\r\n *      pAbility   -  Ability structure\r\n * Return:\r\n *      RT_ERR_OK                        \r\n *      RT_ERR_FAILED                  \r\n *      RT_ERR_SMI       \r\n *      RT_ERR_PORT_ID\r\n *      RT_ERR_PHY_REG_ID\r\n *      RT_ERR_NULL_POINTER\r\n *      RT_ERR_PHY_AUTO_NEGO_MODE\r\n *      RT_ERR_BUSYWAIT_TIMEOUT\r\n *     \r\n * Note:\r\n *      (1) RTL8306E switch only has 5 phy, so the input port id should be 0~4.\r\n *      (2) In auto-negotiation mode, phy autoNegotiation ability must be enabled\r\n *\/  \r\nextern rtk_api_ret_t rtk_port_phyAutoNegoAbility_get(rtk_port_t port, rtk_port_phy_ability_t *pAbility);\r\n\r\n\/* Function Name:\r\n *     rtk_port_phyForceModeAbility_set\r\n * Description:\r\n *      Set the port PHY force mode, config its speed\/duplex mode\/pause\/asy_pause \r\n * Input:\r\n *      port       -  Port id\r\n *      pAbility   -  Ability structure\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                        \r\n *      RT_ERR_FAILED                  \r\n *      RT_ERR_SMI       \r\n *      RT_ERR_PORT_ID\r\n *      RT_ERR_PHY_REG_ID\r\n *      RT_ERR_NULL_POINTER\r\n *      RT_ERR_PHY_FORCE_1000\r\n *      RT_ERR_BUSYWAIT_TIMEOUT\r\n *     \r\n * Note:\r\n *      (1) RTL8306E switch only has 5 phy, so the input port id should be 0~4.\r\n *      (2) In force mode,  phy autoNegotiation ability must be disabled.\r\n *\/\r\nextern rtk_api_ret_t rtk_port_phyForceModeAbility_set(rtk_port_t port, rtk_port_phy_ability_t *pAbility);\r\n\r\n\/* Function Name:\r\n *      rtk_port_phyForceModeAbility_get\r\n * Description:\r\n *      Get the port PHY speed\/duplex mode\/pause\/asy_pause in force mode\r\n * Input:\r\n *      port       -  Port id\r\n * Output:\r\n *      pAbility   -  Ability structure\r\n * Return:\r\n *      RT_ERR_OK                        \r\n *      RT_ERR_FAILED                  \r\n *      RT_ERR_SMI       \r\n *      RT_ERR_PORT_ID\r\n *      RT_ERR_PHY_REG_ID\r\n *      RT_ERR_NULL_POINTER\r\n *      RT_ERR_BUSYWAIT_TIMEOUT\r\n *     \r\n * Note:\r\n *      (1) RTL8306E switch only has 5 phy, so the input port id should be 0~4.\r\n *      (2) In force mode, phy autoNegotiation ability must be disabled.\r\n *\/\r\nextern rtk_api_ret_t rtk_port_phyForceModeAbility_get(rtk_port_t port, rtk_port_phy_ability_t *pAbility);\r\n\r\n\/* Function Name:\r\n *      rtk_port_phyStatus_get\r\n * Description:\r\n *      Get ethernet PHY linking status\r\n * Input:\r\n *      port             -  Port id\r\n * Output:\r\n *      pLinkStatus   -  the pointer of PHY link status \r\n *      pSpeed         -  the pointer of PHY link speed\r\n *      pDuplex        -  the pointer of PHY duplex \r\n * Return:\r\n *      RT_ERR_OK                        \r\n *      RT_ERR_FAILED                  \r\n *      RT_ERR_SMI       \r\n *      RT_ERR_PORT_ID\r\n *      RT_ERR_NULL_POINTER\r\n *     \r\n * Note:\r\n *      RTL8306E switch only has 5 phy, so the input port id should be 0~4.\r\n *\/\r\nextern rtk_api_ret_t rtk_port_phyStatus_get(rtk_port_t port, rtk_port_linkStatus_t *pLinkStatus, rtk_port_speed_t *pSpeed, rtk_port_duplex_t *pDuplex);\r\n\r\n\/* Function Name:\r\n *      rtk_port_macForceLinkExt0_set\r\n * Description:\r\n *      Set external interface 0(MAC 5) force linking configuration.\r\n * Input:\r\n *      mode - external interface mode\r\n *      pPortability - port ability configuration\r\n * Output:\r\n *      None \r\n * Return:\r\n *      RT_ERR_OK              - Success\r\n *      RT_ERR_FAILED          - Failure\r\n *      RT_ERR_INPUT       - Invalid input parameters.\r\n * Note:\r\n *      (1) This API can set external interface 0(MAC 5) force mode properties,\r\n *      including link status,speed,duplex,and tx pause and tx pause ability.\r\n *      In force mode, autoNegotiation ability must be disabled.\r\n *      (2) For 8306E, the external interface 0(MAC 5) operating mode can be\r\n *      MAC Mode (T)MII, PHY Mode (T)MII and RMII. The operating mode is \r\n *      determined by strapping pin upon reset, and can not be configured \r\n *      by software, except the selection of MII or TMII. \r\n *      (3)The input parament mode here is only used to select MII or TMII.\r\n *      When operating mode is configured as MAC Mode (T)MII or PHY Mode (T)MII\r\n *      via strapping pin, then the selection of MII or TMII can be done via software.\r\n *      For example, set mode MODE_EXT_TMII_MAC to select TMII, and set mode\r\n *      MODE_EXT_MII_MAC to select MII.\r\n *\/\r\nextern rtk_api_ret_t rtk_port_macForceLinkExt0_set(rtk_mode_ext_t mode, rtk_port_mac_ability_t *pPortability);\r\n\r\n\/* Function Name:\r\n *      rtk_port_macForceLinkExt0_get\r\n * Description:\r\n *      Get external interface 0(MAC 5) force linking configuration.\r\n * Input:\r\n *      None\r\n * Output:\r\n *      pMode - external interface mode\r\n *      pPortability - port ability configuration\r\n * Return:\r\n *      RT_ERR_OK              - Success\r\n *      RT_ERR_FAILED          - Failure \r\n *      RT_ERR_INPUT - Invalid input parameters.\r\n * Note:\r\n *      This API can get external interface 0 (MAC 5) force mode properties.\r\n *      The external interface 0 operating mode can be:\r\n *      - MODE_EXT_MII_MAC,\r\n *      - MODE_EXT_MII_PHY, \r\n *      - MODE_EXT_TMII_MAC,\r\n *      - MODE_EXT_TMII_PHY, \r\n *      - MODE_EXT_RMII, \r\n *\/\r\nextern rtk_api_ret_t rtk_port_macForceLinkExt0_get(rtk_mode_ext_t *pMode, rtk_port_mac_ability_t *pPortability);\r\n\r\n\/* Function Name:\r\n *      rtk_port_isolation_set\r\n * Description:\r\n *      Set permitted port isolation portmask\r\n * Input:\r\n *      port                - port id, 0 ~ 5 \r\n *      portmask         - Permit port mask\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK             -   Success\r\n *      RT_ERR_PORT_ID     -   Invalid port number\r\n *      RT_ERR_PORT_MASK -   Invalid portmask\r\n *      RT_ERR_FAILED        -   Failure\r\n * Note:\r\n *      This API set the port mask that a port can trasmit packet to of each port.\r\n *      A port can only transmit packet to ports included in permitted portmask  \r\n *\/\r\nextern rtk_api_ret_t rtk_port_isolation_set(rtk_port_t port, rtk_portmask_t portmask);\r\n\r\n\/* Function Name:\r\n *      rtk_port_isolation_get\r\n * Description:\r\n *      Get permitted port isolation portmask\r\n * Input:\r\n *      port                - port id, 0 ~ 5 \r\n * Output:\r\n *      pPortmask       - the pointer of permit port mask\r\n * Return:\r\n *      RT_ERR_OK                  -   Success\r\n *      RT_ERR_PORT_ID          -   Invalid port number\r\n *      RT_ERR_NULL_POINTER  -   Input parameter is null pointer\r\n *      RT_ERR_FAILED             -   Failure\r\n * Note:\r\n *      This API get the port mask that a port can trasmit packet to of each port.\r\n *      A port can only transmit packet to ports included in permitted portmask  \r\n *\/\r\n \r\nextern rtk_api_ret_t rtk_port_isolation_get(rtk_port_t port, rtk_portmask_t *pPortmask);\r\n\r\n\/* Function Name:\r\n *      rtk_stat_port_reset\r\n * Description:\r\n *      Reset per port MIB counter by port.\r\n * Input:\r\n *      port - port id.\r\n * Output:\r\n *      None\r\n * Return:\r\n *      RT_ERR_OK              - set shared meter successfully\r\n *      RT_ERR_FAILED          - FAILED to iset shared meter\r\n * Note:\r\n *\/\r\nextern rtk_api_ret_t rtk_stat_port_reset(rtk_port_t port);\r\n\r\n\r\n\/* Function Name:\r\n *      rtk_rate_igrBandwidthCtrlRate_set\r\n * Description:\r\n *      Set port ingress bandwidth control\r\n * Input:\r\n *      port            -  Port id\r\n *      rate            -  Rate of share meter\r\n *      ifg_include   -  Rate's calculation including IFG, ENABLE:include DISABLE:exclude\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK              -  Success\r\n *      RT_ERR_PORT_ID      -  Invalid port number\r\n *      RT_ERR_FAILED        -  Failure\r\n *      RT_ERR_ENABLE       -  Invalid IFG parameter\r\n *      RT_ERR_INBW_RATE -  Invalid ingress rate parameter\r\n * Note:\r\n *      The rate unit is 64Kbps and the range is from 64Kbps to 100Mbps. The granularity of rate is 64Kbps. \r\n *      The ifg_include parameter is used for rate calculation with\/without inter-frame-gap and preamble. \r\n *\/ \r\nextern rtk_api_ret_t rtk_rate_igrBandwidthCtrlRate_set( rtk_port_t port, rtk_rate_t rate,  rtk_enable_t ifg_include);\r\n\r\n\/* Function Name:\r\n *      rtk_rate_igrBandwidthCtrlRate_get\r\n * Description:\r\n *      Get port ingress bandwidth control\r\n * Input:\r\n *      port             -  Port id\r\n * Output:\r\n *      pRate           -  the pointer of rate of share meter\r\n *      pIfg_include   -  Rate's calculation including IFG, ENABLE:include DISABLE:exclude\r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_PORT_ID              -  Invalid port number\r\n *      RT_ERR_FAILED                -  Failure\r\n *      RT_ERR_ENABLE               -  Invalid IFG parameter\r\n *      RT_ERR_NULL_POINTER      -  null pointer\r\n * Note:\r\n *      The rate unit is 64Kbps and the range is from 64Kbps to 100Mbps. The granularity of rate is 64Kbps. \r\n *      The ifg_include parameter is used for rate calculation with\/without inter-frame-gap and preamble. \r\n *\/\r\nextern rtk_api_ret_t rtk_rate_igrBandwidthCtrlRate_get(rtk_port_t port, rtk_rate_t *pRate, rtk_enable_t *pIfg_include);\r\n\r\n\/* Function Name:\r\n *      rtk_rate_egrBandwidthCtrlRate_set\r\n * Description:\r\n *      Set port egress bandwidth control\r\n * Input:\r\n *      port            -  Port id\r\n *      rate            -  Rate of bandwidth control\r\n *      ifg_include   -  Rate's calculation including IFG, ENABLE:include DISABLE:exclude\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                   -  Success\r\n *      RT_ERR_PORT_ID           -  Invalid port number\r\n *      RT_ERR_FAILED             -  Failure\r\n *      RT_ERR_ENABLE             -  Invalid IFG parameter\r\n *      RT_ERR_QOS_EBW_RATE -  Invalid egress rate parameter\r\n * Note:\r\n *      The rate unit is 64Kbps and the range is from 64Kbps to 100Mbps. The granularity of rate is 64Kbps. \r\n *      The ifg_include parameter is used for rate calculation with\/without inter-frame-gap and preamble. \r\n *\/\r\nextern rtk_api_ret_t rtk_rate_egrBandwidthCtrlRate_set(rtk_port_t port, rtk_rate_t rate,  rtk_enable_t ifg_include);\r\n\r\n\/* Function Name:\r\n *      rtk_rate_igrBandwidthCtrlRate_get\r\n * Description:\r\n *      Get port ingress bandwidth control\r\n * Input:\r\n *      port             -  Port id\r\n * Output:\r\n *      pRate           -  the pointer of rate of bandwidth control\r\n *      pIfg_include   -  Rate's calculation including IFG, ENABLE:include DISABLE:exclude\r\n * Return:\r\n *      RT_ERR_OK                     -  Success\r\n *      RT_ERR_PORT_ID             -  Invalid port number\r\n *      RT_ERR_FAILED                -  Failure\r\n *      RT_ERR_NULL_POINTER      -  null pointer\r\n * Note:\r\n *      The rate unit is 64Kbps and the range is from 64Kbps to 100Mbps. The granularity of rate is 64Kbps. \r\n *      The ifg_include parameter is used for rate calculation with\/without inter-frame-gap and preamble. \r\n *\/\r\nextern rtk_api_ret_t rtk_rate_egrBandwidthCtrlRate_get(rtk_port_t port, rtk_rate_t *pRate, rtk_enable_t *pIfg_include);\r\n\r\n\/* QoS *\/\r\n\r\n\/* Function Name:\r\n *      rtk_qos_init\r\n * Description:\r\n *      Configure Qos default settings with queue number assigment to each port\r\n * Input:\r\n *      queueNum     -  Queue number of each port\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                     -  Success\r\n *      RT_ERR_FAILED                -  Failure\r\n *      RT_ERR_QUEUE_NUM         -  Error queue number\r\n * Note:\r\n *    This API will initialize related Qos setting with queue number assigment.\r\n *    The queue number is from 1 to 4.\r\n *\/ \r\nextern rtk_api_ret_t rtk_qos_init(rtk_queue_num_t queueNum);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_1pPriRemap_set\r\n * Description:\r\n *      Configure 1Q priorities mapping to internal absolute priority\r\n * Input:\r\n *      dot1p_pri   -  802.1p priority value\r\n *      int_pri       -  internal priority value\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                         -  Success\r\n *      RT_ERR_FAILED                    -  Failure\r\n *      RT_ERR_VLAN_PRIORITY        -  Invalid 1p priority\r\n *      RT_ERR_QOS_INT_PRIORITY   -  Invalid priority\r\n * Note:\r\n *      Priority of 802.1Q assignment for internal asic priority, and it is used for queue usage \r\n *      and packet scheduling.\r\n *\/ \r\nextern rtk_api_ret_t rtk_qos_1pPriRemap_set(rtk_pri_t dot1p_pri, rtk_pri_t int_pri);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_priSel_set\r\n * Description:\r\n *      Configure the priority order among different priority mechanisms.\r\n * Input:\r\n *      pPriDec - priority level for port, dscp, 802.1Q, ACL and VID based priority decision.\r\n * Output:\r\n *      None\r\n * Return:\r\n *      RT_ERR_OK              - success\r\n *      RT_ERR_NULL_POINTER  -   Input parameter is null pointer\r\n *      RT_ERR_FAILED          - failure \r\n *      RT_ERR_QOS_SEL_PRI_SOURCE - Invalid priority decision source parameter.\r\n * Note: \r\n *      (1)For 8306E, there are 5 types of priority mechanisms that could be set arbitration level, which are \r\n *      ACL-based  priority, DSCP-based priority, 1Q-based priority, Port-based priority, VID-based priority.\r\n *      Each one could be set level from 1 to 5.\r\n *      (2)ASIC will follow user's arbitration level setting of priority mechanisms to select internal priority for receiving frame. \r\n *      If two priority mechanisms are the same level, the ASIC will chose the priority mechanism with highest level to \r\n *      assign internal priority to receiving frame.\r\n *\/\r\nextern rtk_api_ret_t rtk_qos_priSel_set(rtk_priority_select_t *pPriDec);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_priSel_get\r\n * Description:\r\n *      Get the priority order configuration among different priority mechanism.\r\n * Input:\r\n *      None\r\n * Output:\r\n *      pPriDec - priority level for port, dscp, 802.1Q, ACL and VID based priority decision.\r\n * Return:\r\n *      RT_ERR_OK              - success\r\n *      RT_ERR_NULL_POINTER  -   Input parameter is null pointer\r\n *      RT_ERR_FAILED          - failure \r\n * Note:\r\n *      (1)For 8306E, there are 5 types of priority mechanisms that could be set arbitration level, which are \r\n *      ACL-based  priority, DSCP-based priority, 1Q-based priority,Port-based priority, VID-based priority.\r\n *      Each one could be set level from 1 to 5.\r\n *      (2)ASIC will follow user's arbitration level setting of priority mechanisms to select internal priority for receiving frame. \r\n *      If two priority mechanisms are the same level, the ASIC will chose the priority mechanism with the highest level to \r\n *      assign internal priority to receiving frame.\r\n *\/\r\nextern rtk_api_ret_t rtk_qos_priSel_get(rtk_priority_select_t *pPriDec);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_1pPriRemap_get\r\n * Description:\r\n *      Get 1Q priorities mapping to internal absolute priority\r\n * Input:\r\n *      dot1p_pri    -  802.1p priority value\r\n * Output:\r\n *      pInt_pri      -  the pointer of internal priority value\r\n * Return:\r\n *      RT_ERR_OK                         -  Success\r\n *      RT_ERR_FAILED                    -  Failure\r\n *      RT_ERR_VLAN_PRIORITY        -  Invalid 1p priority\r\n *      RT_ERR_NULL_POINTER         -   null pointer\r\n * Note:\r\n *      Priority of 802.1Q assignment for internal asic priority, and it is used for queue usage \r\n *      and packet scheduling.\r\n *\/\r\nextern rtk_api_ret_t rtk_qos_1pPriRemap_get(rtk_pri_t dot1p_pri, rtk_pri_t *pInt_pri);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_dscpPriRemap_set\r\n * Description:\r\n *      Set DSCP-based priority\r\n * Input:\r\n *      code      -  dscp code\r\n *      int_pri    -  internal priority value\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                         -  Success\r\n *      RT_ERR_FAILED                    -  Failure\r\n *      RT_ERR_QOS_INT_PRIORITY   -  invalid internal priority\r\n *      RT_ERR_QOS_DSCP_VALUE    -   invalid DSCP value  \r\n * Note:\r\n *      switch support 16 kinds of dscp code:\r\n *          RTL8306_DSCP_EF          \r\n *                 - DSCP for the Expedited forwarding PHB, 101110   \r\n *          RTL8306_DSCP_AFL1         \r\n *                 - DSCP for AF PHB Class 1 low drop, 001010\r\n *          RTL8306_DSCP_AFM1     \r\n *                 - DSCP for AF PHB Class 1 medium drop, 001100\r\n *          RTL8306_DSCP_AFH1      \r\n *                 - DSCP for AF PHB Class 1 high drop, 001110\r\n *          RTL8306_DSCP_AFL2       \r\n *                 - DSCP for AF PHB Class 2 low drop, 01001\r\n *          RTL8306_DSCP_AFM2       \r\n *                 - DSCP for AF PHB Class 2 medium drop, 010100\r\n *          RTL8306_DSCP_AFH2   \r\n *                 - DSCP for AF PHB Class 2 high drop, 010110\r\n *          RTL8306_DSCP_AFL3    \r\n *                 - DSCP for AF PHB Class 3 low drop, 011010\r\n *          RTL8306_DSCP_AFM3      \r\n *                 - DSCP for AF PHB Class 3 medium drop, 011100\r\n *          RTL8306_DSCP_AFH3    \r\n *                 - DSCP for AF PHB Class 3 high drop, 0111\r\n *          RTL8306_DSCP_AFL4     \r\n *                 - DSCP for AF PHB Class 4 low drop, 100010\r\n *          RTL8306_DSCP_AFM4    \r\n *                 - DSCP for AF PHB Class 4 medium drop, 100100\r\n *          RTL8306_DSCP_AFH4     \r\n *                 - DSCP for AF PHB Class 4 high drop, 100110\r\n *          RTL8306_DSCP_NC        \r\n *                 - DSCP for network control, 110000 or 111000\r\n *          RTL8306_DSCP_REG_PRI \r\n *                 - DSCP Register match priority, user could define two dscp code\r\n *          RTL8306_DSCP_BF        \r\n *                 - DSCP Default PHB\r\n *\r\n *     The Differentiated Service Code Point is a selector for router's per-hop behaviors. As a selector, there is no implication that a numerically \r\n *     greater DSCP implies a better network service. As can be seen, the DSCP totally overlaps the old precedence field of TOS. So if values of \r\n *     DSCP are carefully chosen then backward compatibility can be achieved.         \r\n *\/ \r\nextern rtk_api_ret_t rtk_qos_dscpPriRemap_set(rtk_dscp_t dscp, rtk_pri_t int_pri);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_dscpPriRemap_get\r\n * Description:\r\n *      Get DSCP-based priority\r\n * Input:\r\n *      dscp      -  dscp code\r\n * Output:\r\n *      pInt_pri  -  the pointer of internal priority value\r\n * Return:\r\n *      RT_ERR_OK                           -  Success\r\n *      RT_ERR_FAILED                     -  Failure\r\n *      RT_ERR_QOS_DSCP_VALUE      -  Invalid DSCP value\r\n *      RT_ERR_NULL_POINTER           -  Input parameter is null pointer\r\n * Note:\r\n *      switch support 16 kinds of dscp code:\r\n *          RTL8306_DSCP_EF          \r\n *                 - DSCP for the Expedited forwarding PHB, 101110   \r\n *          RTL8306_DSCP_AFL1         \r\n *                 - DSCP for AF PHB Class 1 low drop, 001010\r\n *          RTL8306_DSCP_AFM1     \r\n *                 - DSCP for AF PHB Class 1 medium drop, 001100\r\n *          RTL8306_DSCP_AFH1      \r\n *                 - DSCP for AF PHB Class 1 high drop, 001110\r\n *          RTL8306_DSCP_AFL2       \r\n *                 - DSCP for AF PHB Class 2 low drop, 01001\r\n *          RTL8306_DSCP_AFM2       \r\n *                 - DSCP for AF PHB Class 2 medium drop, 010100\r\n *          RTL8306_DSCP_AFH2   \r\n *                 - DSCP for AF PHB Class 2 high drop, 010110\r\n *          RTL8306_DSCP_AFL3    \r\n *                 - DSCP for AF PHB Class 3 low drop, 011010\r\n *          RTL8306_DSCP_AFM3      \r\n *                 - DSCP for AF PHB Class 3 medium drop, 011100\r\n *          RTL8306_DSCP_AFH3    \r\n *                 - DSCP for AF PHB Class 3 high drop, 0111\r\n *          RTL8306_DSCP_AFL4     \r\n *                 - DSCP for AF PHB Class 4 low drop, 100010\r\n *          RTL8306_DSCP_AFM4    \r\n *                 - DSCP for AF PHB Class 4 medium drop, 100100\r\n *          RTL8306_DSCP_AFH4     \r\n *                 - DSCP for AF PHB Class 4 high drop, 100110\r\n *          RTL8306_DSCP_NC        \r\n *                 - DSCP for network control, 110000 or 111000\r\n *          RTL8306_DSCP_REG_PRI \r\n *                 - DSCP Register match priority, user could define two dscp code\r\n *          RTL8306_DSCP_BF        \r\n *                 - DSCP Default PHB\r\n *     The Differentiated Service Code Point is a selector for router's per-hop behaviors. As a selector, there is no implication that a numerically \r\n *     greater DSCP implies a better network service. As can be seen, the DSCP totally overlaps the old precedence field of TOS. So if values of \r\n *     DSCP are carefully chosen then backward compatibility can be achieved.         \r\n *\/ \r\nextern rtk_api_ret_t rtk_qos_dscpPriRemap_get(rtk_dscp_t dscp, rtk_pri_t *pInt_pri);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_portPri_set\r\n * Description:\r\n *      Configure priority usage to each port\r\n * Input:\r\n *      port                - Port id.                \r\n *      int_pri             -  internal priority value\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                        -  Success\r\n *      RT_ERR_FAILED                  -   Failure\r\n *      RT_ERR_PORT_ID                -   Error port id\r\n *      RT_ERR_QOS_INT_PRIORITY  -   Error internal priority value\r\n * Note:\r\n *     The API can set priority of port assignments for queue usage and packet scheduling.\r\n *\/\r\n \r\nextern rtk_api_ret_t rtk_qos_portPri_set(rtk_port_t port, rtk_pri_t int_pri) ;\r\n\r\n\/* Function Name:\r\n *      rtk_qos_portPri_get\r\n * Description:\r\n *      Get priority usage to each port\r\n * Input:\r\n *      port                  - Port id.                \r\n * Output:\r\n *      pInt_pri             -  the pointer of internal priority value\r\n * Return:\r\n *      RT_ERR_OK                        -  Success\r\n *      RT_ERR_FAILED                  -   Failure\r\n *      RT_ERR_PORT_ID                -   Error port id\r\n *      RT_ERR_NULL_POINTER        -   null pointer\r\n * Note:\r\n *      The API can get priority of port assignments for queue usage and packet scheduling.\r\n *\/\r\n \r\nextern rtk_api_ret_t rtk_qos_portPri_get(rtk_port_t port, rtk_pri_t *pInt_pri) ;\r\n\r\n\/* Function Name:\r\n *      rtk_qos_priMap_set\r\n * Description:\r\n *      Set internal priority mapping to queue ID for different queue number\r\n * Input:\r\n *      queue_num       - Queue number usage\r\n *      pPri2qid            - Priority mapping to queue ID               \r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                        -  Success\r\n *      RT_ERR_FAILED                  -   Failure\r\n *      RT_ERR_QUEUE_ID              -   Error queue id\r\n *      RT_ERR_NULL_POINTER        -   null pointer\r\n * Note:\r\n *      ASIC supports priority mapping to queue with different queue number from 1 to 4.\r\n *      For different queue numbers usage, ASIC supports different internal available queue IDs.\r\n *\/\r\n\r\nextern rtk_api_ret_t rtk_qos_priMap_set(rtk_queue_num_t queue_num, rtk_qos_pri2queue_t *pPri2qid);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_priMap_get\r\n * Description:\r\n *      Get priority to queue ID mapping table parameters\r\n * Input:\r\n *      queue_num       - Queue number usage\r\n *      pPri2qid            - Priority mapping to queue ID               \r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                        -  Success\r\n *      RT_ERR_FAILED                  -   Failure\r\n *      RT_ERR_QUEUE_ID              -   Error queue id\r\n *      RT_ERR_NULL_POINTER        -   null pointer\r\n * Note:\r\n *      ASIC supports priority mapping to queue with different queue number from 1 to 4.\r\n *      For different queue numbers usage, ASIC supports different internal available queue IDs.\r\n *\/\r\n \r\nextern rtk_api_ret_t rtk_qos_priMap_get(rtk_queue_num_t queue_num, rtk_qos_pri2queue_t *pPri2qid);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_1pRemarkEnable_set\r\n * Description:\r\n *      Set 802.1P remarking ability\r\n * Input:\r\n *      port       -  port number (0~5)\r\n *      enabled  -  TRUE or FALSE\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK              -  Success\r\n *      RT_ERR_FAILED        -   Failure\r\n *      RT_ERR_PORT_ID      -   Invalid port id\r\n * Note:\r\n *      \r\n *\/\r\nextern rtk_api_ret_t rtk_qos_1pRemarkEnable_set(rtk_port_t port, rtk_enable_t enable); \r\n\r\n\/* Function Name:\r\n *      rtk_qos_1pRemarkEnable_get\r\n * Description:\r\n *      Get 802.1P remarking ability\r\n * Input:\r\n *      port        -  port number (0~5)\r\n * Output:\r\n *      pEnabled  -  pointer of the ability status\r\n * Return:\r\n *      RT_ERR_OK                     -  Success\r\n *      RT_ERR_FAILED               -   Failure\r\n *      RT_ERR_PORT_ID             -   Invalid port id\r\n *      RT_ERR_NULL_POINTER     -   Input parameter is null pointer\r\n * Note:\r\n *      \r\n *\/\r\nextern rtk_api_ret_t rtk_qos_1pRemarkEnable_get(rtk_port_t port, rtk_enable_t *pEnable);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_1pRemark_set\r\n * Description:\r\n *      Set 802.1P remarking priority\r\n * Input:\r\n *      int_pri        -  Packet priority(0~4)\r\n *      dot1p_pri    -  802.1P priority(0~7)\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                           - Success\r\n *      RT_ERR_FAILED                      - Failure\r\n *      RT_ERR_VLAN_PRIORITY          - Invalid 1p priority\r\n *      RT_ERR_QOS_INT_PRIORITY     - Invalid internal priority \r\n * Note:\r\n *      switch determines packet priority, the priority souce could\r\n *      be port-based, 1Q-based, dscp-based, vid-based, ip address,\r\n *      cpu tag.\r\n *\/ \r\nextern rtk_api_ret_t rtk_qos_1pRemark_set(rtk_pri_t int_pri, rtk_pri_t dot1p_pri);\r\n\r\n\/* Function Name:\r\n *      rtk_qos_1pRemark_get\r\n * Description:\r\n *      Get 802.1P remarking priority\r\n * Input:\r\n *      int_pri        -  Packet priority(0~4)\r\n * Output:\r\n *      pDot1p_pri  -  the pointer of 802.1P priority(0~7)\r\n * Return:\r\n *      RT_ERR_OK                           -  Success\r\n *      RT_ERR_FAILED                      -  Failure\r\n *      RT_ERR_NULL_POINTER            -  Input parameter is null pointer\r\n *      RT_ERR_QOS_INT_PRIORITY     -  Invalid internal priority \r\n * Note:\r\n *      switch determines packet priority, the priority souce could\r\n *      be port-based, 1Q-based, dscp-based, vid-based, ip address,\r\n *      cpu tag.\r\n *\/\r\nextern rtk_api_ret_t rtk_qos_1pRemark_get(rtk_pri_t int_pri, rtk_pri_t *pDot1p_pri);\r\n\r\n\/* Trap &amp; Reserved Multicast Address (More Action like leaky, bypass storm not define) *\/\r\n\r\n\/* Function Name:\r\n *      rtk_trap_unknownMcastPktAction_set\r\n * Description:\r\n *      Set behavior of unknown multicast\r\n * Input:\r\n *      port                -   port id\r\n *      type               -   unknown multicast packet type\r\n *      mcast_action    -  unknown multicast action\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -  Failure\r\n *      RT_ERR_PORT_ID              -  Invalid port id    \r\n *      RT_ERR_INPUT                 -  Invalid input parameter \r\n * Note:\r\n *      When receives an unknown multicast packet, switch may trap, drop this packet\r\n *      The unknown multicast packet type is as following:\r\n *               - MCAST_IPV4\r\n *               - MCAST_IPV6\r\n *      The unknown multicast action is as following:\r\n *               - MCAST_ACTION_FORWARD\r\n *               - MCAST_ACTION_DROP\r\n *\/\r\nextern rtk_api_ret_t rtk_trap_unknownMcastPktAction_set(rtk_port_t port, rtk_mcast_type_t type, rtk_trap_mcast_action_t mcast_action);\r\n\r\n\/* Function Name:\r\n *      rtk_trap_unknownMcastPktAction_get\r\n * Description:\r\n *      Get behavior of unknown multicast\r\n * Input:\r\n *      port                  -   port id\r\n *      type                 -   unknown multicast packet type\r\n * Output:\r\n *      pMcast_action    -   the pointer of unknown multicast action\r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -  Failure\r\n *      RT_ERR_PORT_ID              -  Invalid port id    \r\n *      RT_ERR_NULL_POINTER      -  Input parameter is null pointer\r\n * Note:\r\n *      When receives an unknown multicast packet, switch may trap, drop this packet.\r\n *      The unknown multicast packet type is as following:\r\n *               - MCAST_IPV4\r\n *               - MCAST_IPV6\r\n *      The unknown multicast action is as following:\r\n *               - MCAST_ACTION_FORWARD\r\n *               - MCAST_ACTION_DROP\r\n *\/\r\nextern rtk_api_ret_t rtk_trap_unknownMcastPktAction_get(rtk_port_t port, rtk_mcast_type_t type, rtk_trap_mcast_action_t *pMcast_action);\r\n\r\n\/* Function Name:\r\n *      rtk_trap_igmpCtrlPktAction_set\r\n * Description:\r\n *      Set IGMP\/MLD trap function\r\n * Input:\r\n *      type                -   IGMP\/MLD packet type\r\n *      igmp_action      -   IGMP\/MLD action\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -  Failure\r\n *      RT_ERR_INPUT                 -  Invalid input parameter\r\n *      RT_ERR_NOT_ALLOWED     -  Actions not allowed by the function\r\n * Note:\r\n *      This API can set both IPv4 IGMP\/IPv6 MLD with\/without PPPoE header trapping function.\r\n *      All 4 kinds of IGMP\/MLD function can be set separately.\r\n *      The IGMP\/MLD packet type is as following:\r\n *          - IGMP_IPV4\r\n *          - IGMP_MLD\r\n *          - IGMP_PPPOE_IPV4\r\n *          - IGMP_PPPOE_MLD\r\n *      The IGMP\/MLD action is as following:\r\n *          - IGMP_ACTION_FORWARD\r\n *          - IGMP_ACTION_TRAP2CPU\r\n *\/  \r\nextern rtk_api_ret_t rtk_trap_igmpCtrlPktAction_set(rtk_igmp_type_t type, rtk_trap_igmp_action_t igmp_action);\r\n\r\n\/* Function Name:\r\n *      rtk_trap_igmpCtrlPktAction_get\r\n * Description:\r\n *      Get IGMP\/MLD trap function\r\n * Input:\r\n *      type                -   IGMP\/MLD packet type\r\n * Output:\r\n *      pIgmp_action    -   the pointer of IGMP\/MLD action\r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -  Failure\r\n *      RT_ERR_INPUT                 -  Invalid input parameter\r\n *      RT_ERR_NULL_POINTER      -  Input parameter is null pointer\r\n * Note:\r\n *      This API can get both IPv4 IGMP\/IPv6 MLD with\/without PPPoE header trapping function.\r\n *      All 4 kinds of IGMP\/MLD function can be set separately.\r\n *      The IGMP\/MLD packet type is as following:\r\n *          - IGMP_IPV4\r\n *          - IGMP_MLD\r\n *          - IGMP_PPPOE_IPV4\r\n *          - IGMP_PPPOE_MLD\r\n *      The IGMP\/MLD action is as following:\r\n *          - IGMP_ACTION_FORWARD\r\n *          - IGMP_ACTION_TRAP2CPU\r\n *\/\r\nextern rtk_api_ret_t rtk_trap_igmpCtrlPktAction_get(rtk_igmp_type_t type, rtk_trap_igmp_action_t *pIgmp_action);\r\n\r\n\r\n\/* CVLAN *\/\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_init\r\n * Description:\r\n *      Initialize VLAN\r\n * Input:\r\n *      none\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                     -  Success\r\n *      RT_ERR_FAILED                -  Failure\r\n * Note:\r\n *      VLAN is disabled by default. User has to call this API to enable VLAN before\r\n *      using it. And It will set a default VLAN(vid 1) including all ports and set \r\n *      all ports PVID to the default VLAN.\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_init(void);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_set\r\n * Description:\r\n *      Set a VLAN entry\r\n * Input:\r\n *      vid              - VLAN ID to configure, should be 1~4094\r\n *      mbrmsk        - VLAN member set portmask\r\n *      untagmsk     - VLAN untag set portmask\r\n *      fid              -  filtering database id, could be any value for RTL8306E\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                     -  Success\r\n *      RT_ERR_FAILED                -  Failure\r\n *      RT_ERR_VLAN_VID            -  Invalid vid\r\n *      RT_ERR_INPUT                 -  Invalid input parameter \r\n *      RT_ERR_TBL_FULL            -  Input table full \r\n * Note:\r\n *     There are 16 VLAN entry supported. User could configure the member set and untag set\r\n *     for specified vid through this API. The portmask's bit N means port N.\r\n *     For example, mbrmask 23=0x17=010111 means port 0,1,2,4 in the member set.\r\n *     FID is for SVL\/IVL usage, and the range is 0~4095, rtl8306E only supports SVL, \r\n *     so fid is no useage.\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_set(rtk_vlan_t vid, rtk_portmask_t mbrmsk, rtk_portmask_t untagmsk, rtk_fid_t fid);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_get\r\n * Description:\r\n *      Get a VLAN entry\r\n * Input:\r\n *      vid             - VLAN ID to configure\r\n * Output:\r\n *      pMbrmsk     - VLAN member set portmask\r\n *      pUntagmsk  - VLAN untag set portmask\r\n *      pFid           -  filtering database id\r\n * Return:\r\n *      RT_ERR_OK                                   -  Success\r\n *      RT_ERR_FAILED                              -  Failure\r\n *      RT_ERR_VLAN_VID                          -  Invalid vid\r\n *      RT_ERR_NULL_POINTER                    -  Input parameter is null pointer\r\n *      RT_ERR_VLAN_ENTRY_NOT_FOUND    -   Specified vlan entry not found\r\n * Note:\r\n *     There are 16 VLAN entry supported. User could configure the member set and untag set\r\n *     for specified vid through this API. The portmask's bit N means port N.\r\n *     For example, mbrmask 23=0x17=010111 means port 0,1,2,4 in the member set.\r\n *     FID is for SVL\/IVL usage, and the range is 0~4095, rtl8306E only supports SVL, \r\n *     so fid is no useage.\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_get(rtk_vlan_t vid, rtk_portmask_t *pMbrmsk, rtk_portmask_t *pUntagmsk, rtk_fid_t *pFid);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_destroy\r\n * Description:\r\n *      delete vid from vlan table\r\n * Input:\r\n *      vid             - VLAN ID to configure\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                                   -  Success\r\n *      RT_ERR_FAILED                              -  Failure\r\n *      RT_ERR_VLAN_VID                          -  Invalid vid\r\n *      RT_ERR_VLAN_ENTRY_NOT_FOUND    -  Specified vlan entry not found\r\n * Note:\r\n * \r\n *\/ \r\nextern rtk_api_ret_t rtk_vlan_destroy(rtk_vlan_t vid);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_portPvid_set\r\n * Description:\r\n *      Set port to specified VLAN ID(PVID)\r\n * Input:\r\n *      port             - Port id\r\n *      pvid             - Specified VLAN ID\r\n *      priority         - 802.1p priority for the PVID, 0~3 for RTL8306E \r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                                   -  Success\r\n *      RT_ERR_FAILED                              -  Failure\r\n *      RT_ERR_VLAN_VID                          -  Invalid vid\r\n *      RT_ERR_VLAN_PRIORITY                  -  Invalid 1p priority \r\n *      RT_ERR_VLAN_ENTRY_NOT_FOUND    -  Specified vlan entry not found\r\n * Note:\r\n *      The API is used for Port-based VLAN. The untagged frame received from the\r\n *      port will be classified to the specified VLAN and assigned to the specified priority.\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_portPvid_set(rtk_port_t port, rtk_vlan_t pvid, rtk_pri_t priority);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_portPvid_get\r\n * Description:\r\n *      Get VLAN ID(PVID) on specified port\r\n * Input:\r\n *      port             - Port id\r\n * Output:\r\n *      pPvid            - Specified VLAN ID\r\n *      pPriority        - 802.1p priority for the PVID\r\n * Return:\r\n *      RT_ERR_OK                                   - Success\r\n *      RT_ERR_FAILED                             -  Failure\r\n *      RT_ERR_PORT_ID                           -  Invalid port id\r\n *      RT_ERR_NULL_POINTER                   -  Input parameter is null pointer\r\n * Note:\r\n *    The API is used for Port-based VLAN. The untagged frame received from the\r\n *    port will be classified to the specified VLAN and assigned to the specified priority.\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_portPvid_get(rtk_port_t port, rtk_vlan_t *pPvid, rtk_pri_t *pPriority);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_portIgrFilterEnable_set\r\n * Description:\r\n *      Set VLAN ingress for each port\r\n * Input:\r\n *      port             - Port id\r\n *      igr_filter        - VLAN ingress function enable status\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                        - Success\r\n *      RT_ERR_FAILED                  -  Failure\r\n * Note:\r\n *      RTL8306E use one ingress filter for whole system, not for each port, so \r\n *      any port you set will affect all ports ingress filter setting.\r\n *      While VLAN function is enabled, ASIC will decide VLAN ID for each received frame \r\n *      and get belonged member ports from VLAN table. If received port is not belonged \r\n *      to VLAN member ports, ASIC will drop received frame if VLAN ingress function is enabled.\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_portIgrFilterEnable_set(rtk_port_t port, rtk_enable_t igr_filter);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_portIgrFilterEnable_get\r\n * Description:\r\n *      get VLAN ingress for each port\r\n * Input:\r\n *      port             - Port id\r\n * Output:\r\n *      pIgr_filter     - the pointer of VLAN ingress function enable status\r\n * Return:\r\n *      RT_ERR_OK                 - Success\r\n *      RT_ERR_FAILED           -  Failure\r\n * Note:\r\n *      RTL8306E use one ingress filter for whole system, not for each port, so \r\n *      any port you set will affect all ports ingress filter setting.\r\n *      While VLAN function is enabled, ASIC will decide VLAN ID for each received frame \r\n *      and get belonged member ports from VLAN table. If received port is not belonged \r\n *      to VLAN member ports, ASIC will drop received frame if VLAN ingress function is enabled.\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_portIgrFilterEnable_get(rtk_port_t port, rtk_enable_t *pIgr_filter);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_portAcceptFrameType_set\r\n * Description:\r\n *      Set VLAN support frame type\r\n * Input:\r\n *      port                                 - Port id\r\n *      accept_frame_type             - accept frame type\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                  - Success\r\n *      RT_ERR_FAILED            -  Failure\r\n *      RT_ERR_PORT_ID          -  Invalid port id\r\n * Note:\r\n *      The API is used for checking 802.1Q tagged frames.\r\n *      The accept frame type as following:\r\n *          - ACCEPT_FRAME_TYPE_ALL\r\n *          - ACCEPT_FRAME_TYPE_TAG_ONLY\r\n *          - ACCEPT_FRAME_TYPE_UNTAG_ONLY\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_portAcceptFrameType_set(rtk_port_t port, rtk_vlan_acceptFrameType_t accept_frame_type);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_portAcceptFrameType_get\r\n * Description:\r\n *      Get VLAN support frame type\r\n * Input:\r\n *      port                                 - Port id\r\n *      accept_frame_type             - accept frame type\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                                   - Success\r\n *      RT_ERR_FAILED                             -  Failure\r\n *      RT_ERR_PORT_ID                           -  Invalid port id\r\n *      RT_ERR_VLAN_ACCEPT_FRAME_TYPE -  Invalid accept frame type \r\n * Note:\r\n *    The API is used for checking 802.1Q tagged frames.\r\n *    The accept frame type as following:\r\n *    - ACCEPT_FRAME_TYPE_ALL\r\n *    - ACCEPT_FRAME_TYPE_TAG_ONLY\r\n *    - ACCEPT_FRAME_TYPE_UNTAG_ONLY\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_portAcceptFrameType_get(rtk_port_t port, rtk_vlan_acceptFrameType_t *pAccept_frame_type);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_vlanBasedPriority_set\r\n * Description:\r\n *      Set VLAN priority for each CVLAN\r\n * Input:\r\n *      vid                -Specified VLAN ID\r\n *      priority           -priority for the VID\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                                -  Success\r\n *      RT_ERR_FAILED                          -   Failure\r\n *      RT_ERR_VLAN_VID                       -  Invalid vid \r\n *      RT_ERR_VLAN_PRIORITY               -  Invalid 1p priority\r\n *      RT_ERR_VLAN_ENTRY_NOT_FOUND -  Specified vlan entry not found\r\n * Note:\r\n *      This API is used to set priority per VLAN.\r\n *\/ \r\nextern rtk_api_ret_t rtk_vlan_vlanBasedPriority_set(rtk_vlan_t vid, rtk_pri_t priority);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_vlanBasedPriority_get\r\n * Description:\r\n *      Get VLAN priority for each CVLAN\r\n * Input:\r\n *      vid                -Specified VLAN ID\r\n * Output:\r\n *      pPriority         -the pointer of priority for the VID\r\n * Return:\r\n *      RT_ERR_OK                                -  Success\r\n *      RT_ERR_FAILED                          -   Failure\r\n *      RT_ERR_VLAN_VID                       -  Invalid vid \r\n *      RT_ERR_NULL_POINTER                -   Input parameter is null pointer\r\n *      RT_ERR_VLAN_ENTRY_NOT_FOUND -   Specified vlan entry not found \r\n * Note:\r\n *      This API is used to set priority per VLAN.\r\n *\/ \r\nextern rtk_api_ret_t rtk_vlan_vlanBasedPriority_get(rtk_vlan_t vid, rtk_pri_t *pPriority);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_vidTranslation_set\r\n * Description:\r\n *      Set vid translated to new vid\r\n * Input:\r\n *      vid       -  old vid\r\n *      nvid     -   new vid\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                                -  Success\r\n *      RT_ERR_FAILED                          -   Failure\r\n *      RT_ERR_VLAN_VID                       -  Invalid vid \r\n *      RT_ERR_VLAN_ENTRY_NOT_FOUND -   Specified vlan entry not found \r\n * Note:\r\n *      This API is used to translate a vid to a new vid, the new vid could be \r\n *      used by Q-in-Q or vlan translation function.\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_vidTranslation_set(rtk_vlan_t vid, rtk_vlan_t nvid);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_vidTranslation_get\r\n * Description:\r\n *      Get vid translation new vid\r\n * Input:\r\n *      vid        -  old vid\r\n * Output:\r\n *      pNvid     -  the pointer of new vid\r\n * Return:\r\n *      RT_ERR_OK                                -  Success\r\n *      RT_ERR_FAILED                          -   Failure\r\n *      RT_ERR_VLAN_VID                       -  Invalid vid \r\n *      RT_ERR_NULL_POINTER                -   NULL pointer\r\n *      RT_ERR_VLAN_ENTRY_NOT_FOUND -   Specified vlan entry not found \r\n * Note:\r\n *      This API is used to translate a vid to a new vid, the new vid could be \r\n *      used by Q-in-Q or vlan translation function.\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_vidTranslation_get(rtk_vlan_t vid, rtk_vlan_t *pNvid);\r\n\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_vidTranslationEnable_set\r\n * Description:\r\n *      Set vlan translation function enabled or disabled \r\n * Input:\r\n *      enable        -  enable or disable\r\n *      nniMask      -   NNI port mask\r\n * Output:\r\n *      pNvid     -  the pointer of new vid\r\n * Return:\r\n *      RT_ERR_OK                                -  Success\r\n *      RT_ERR_FAILED                          -   Failure\r\n *      RT_ERR_PORT_MASK                   -   Error port mask\r\n * Note:\r\n *      VLAN translation only happens between UNI and NNI port, \r\n *      in nniMask, 1 means the port is NNI port, 0 means the port\r\n *      is UNI port\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_vidTranslationEnable_set(rtk_enable_t enable, rtk_portmask_t nniMask);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_vidTranslationEnable_get\r\n * Description:\r\n *      Get vlan translation function enabled or disabled \r\n * Input:\r\n * Output:\r\n *      pEnable      -   the pointer of enable or disable\r\n *      pNniMask    -   the pointer of NNI port mask\r\n * Return:\r\n *      RT_ERR_OK                                -  Success\r\n *      RT_ERR_FAILED                          -   Failure\r\n *      RT_ERR_NULL_POINTER                -   NULL pointer\r\n * Note:\r\n *      VLAN translation only happens between UNI and NNI port, \r\n *      in nniMask, 1 means the port is NNI port, 0 means the port\r\n *      is UNI port\r\n *\/\r\n\r\nextern rtk_api_ret_t rtk_vlan_vidTranslationEnable_get(rtk_enable_t *pEnable, rtk_portmask_t *pNniMask);\r\n\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_tagSrc_set\r\n * Description:\r\n *      Set tag vid and priority source for Q-in-Q and VLAN translation\r\n * Input:\r\n *      port          -    port id\r\n *      vidSrc       -    vid source\r\n *      priSrc        -    priority source\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                 -  Success\r\n *      RT_ERR_FAILED            -   Failure\r\n *      RT_ERR_PORT_ID          -   error port id\r\n * Note:\r\n *     Q-in-Q(SVLAN) and VLAN translation will modify tag, \r\n *      the API could set outer tag or translated VLAN tag\r\n *      vid\/priority source.\r\n *      - vidSrc: \r\n *                - RTL8306E_VIDSRC_POVID - port-based otag vid,     \r\n *                - RTL8306E_VIDSRC_NVID   - new vid(translated vid)\r\n *       - priSrc:\r\n *                - RTL8306E_PRISRC_PPRI    - port-based otag priority, \r\n *                - RTL8306E_PRISRC_1PRMK - 1p remarking priority\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_tagSrc_set(rtk_port_t port, rtk_vidSrc_t vidSrc, rtk_priSrc_t priSrc);\r\n\r\n\/* Function Name:\r\n *      rtk_vlan_tagSrc_get\r\n * Description:\r\n *      Get tag vid and priority source for Q-in-Q and VLAN translation\r\n * Input:\r\n *      port          -    port id\r\n * Output:\r\n *      pVidSrc     -    the pointer of vid source\r\n *      pPriSrc      -    the pointer of priority source\r\n * Return:\r\n *      RT_ERR_OK                 -  Success\r\n *      RT_ERR_FAILED            -   Failure\r\n *      RT_ERR_PORT_ID          -   error port id\r\n * Note:\r\n *      Q-in-Q(SVLAN) and VLAN translation will modify tag, \r\n *      the API could set outer tag or tranlated VLAN tag\r\n *      vid\/priority source.\r\n *      - vidSrc: \r\n *                - RTL8306E_VIDSRC_POVID - port-based otag vid,     \r\n *                - RTL8306E_VIDSRC_NVID   - new vid(translated vid)\r\n *       - priSrc:\r\n *                - RTL8306E_PRISRC_PPRI    - port-based otag priority, \r\n *                - RTL8306E_PRISRC_1PRMK - 1p remarking priority\r\n *\/\r\nextern rtk_api_ret_t rtk_vlan_tagSrc_get(rtk_port_t port, rtk_vidSrc_t *pVidSrc, rtk_priSrc_t *pPriSrc);    \r\n\r\n\r\n\r\n\/*Spanning Tree*\/\r\n\r\n\/* Function Name:\r\n *      rtk_stp_mstpState_set\r\n * Description:\r\n *      Configure spanning tree state per port\r\n * Input:\r\n *      msti              - Multiple spanning tree instance, no use for RTL8306E\r\n *      port              - Port id\r\n *      stp_state       - Spanning tree state\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -  Failure\r\n *      RT_ERR_PORT_ID              -  Invalid port id\r\n *      RT_ERR_MSTP_STATE        -  Invalid spanning tree status\r\n * Note:\r\n *      Because RTL8306E does not support multiple spanning tree, so msti is no use. \r\n *      There are four states supported by ASIC.\r\n *          - STP_STATE_DISABLED\r\n *          - STP_STATE_BLOCKING\r\n *          - STP_STATE_LEARNING\r\n *          - STP_STATE_FORWARDING\r\n *\/\r\nextern rtk_api_ret_t rtk_stp_mstpState_set(rtk_stp_msti_id_t msti, rtk_port_t port, rtk_stp_state_t stp_state);\r\n\r\n\/* Function Name:\r\n *      rtk_stp_mstpState_get\r\n * Description:\r\n *      Get Configuration of spanning tree state per port\r\n * Input:\r\n *      msti              - Multiple spanning tree instance, no use for RTL8306E\r\n *      port              - Port id\r\n * Output:\r\n *      pStp_state     - the pointer of Spanning tree state\r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -  Failure\r\n *      RT_ERR_PORT_ID              -  Invalid port id\r\n *      RT_ERR_NULL_POINTER      -  Input parameter is null pointer\r\n * Note:\r\n *      Because RTL8306E does not support multiple spanning tree, so msti is no use. \r\n *      There are four states supported by ASIC.\r\n *          - STP_STATE_DISABLED\r\n *          - STP_STATE_BLOCKING\r\n *          - STP_STATE_LEARNING\r\n *          - STP_STATE_FORWARDING\r\n *\/\r\nextern rtk_api_ret_t rtk_stp_mstpState_get(rtk_stp_msti_id_t msti, rtk_port_t port, rtk_stp_state_t *pStp_state);\r\n\r\n\/* LUT *\/\r\n\r\n\/* Function Name:\r\n *      rtk_l2_addr_add\r\n * Description:\r\n *      Set LUT unicast entry\r\n * Input:\r\n *      pMac               -   6 bytes unicast(I\/G bit is 0) mac address to be written into LUT\r\n *      pL2_data          -   the mac address attributes\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                       -  Success\r\n *      RT_ERR_FAILED                 -   Failure\r\n *      RT_ERR_INPUT                  -   Invalid input parameter\r\n *      RT_ERR_MAC                    -   Wrong mac address, must be unicast mac        \r\n *      RT_ERR_NULL_POINTER       -  Input parameter is null pointer    \r\n *      RT_ERR_L2_INDEXTBL_FULL -  The L2 index table is full\r\n * Note:\r\n *      If the unicast mac address already existed in LUT, it will udpate the status of the entry. \r\n *      Otherwise, it will find an empty or asic auto learned entry to write. If all the entries \r\n *      with the same hash value can't be replaced, ASIC will return a RT_ERR_L2_INDEXTBL_FULL error.\r\n *      for RTL8306E, pL2_data member fid and sa_block is no use, so it can be chosen any value.\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_addr_add(rtk_mac_t *pMac, rtk_l2_ucastAddr_t *pL2_data);\r\n\r\n\/* Function Name:\r\n *      rtk_l2_addr_get\r\n * Description:\r\n *      Get LUT unicast entry\r\n * Input:\r\n *      pMac               -   6 bytes unicast(I\/G bit is 0) mac address to be gotten\r\n *      fid                   -   filtering database id, could be any value for RTL8306E switch\r\n * Output:\r\n *      pL2_data          -   the mac address attributes\r\n * Return:\r\n *      RT_ERR_OK                               -  Success\r\n *      RT_ERR_FAILED                         -   Failure\r\n *      RT_ERR_INPUT                          -   Invalid input parameter\r\n *      RT_ERR_MAC                            -   Wrong mac address, must be unicast mac        \r\n *      RT_ERR_NULL_POINTER              -   Input parameter is null pointer    \r\n *      RT_ERR_L2_ENTRY_NOTFOUND    -   Specified entry not found\r\n * Note:\r\n *      If the unicast mac address existed in LUT, it will return the port where\r\n *      the mac is learned, 802.1x authorized status and dynamic\/static entry,\r\n *      Otherwise, it will return a RT_ERR_L2_ENTRY_NOTFOUND error.\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_addr_get(rtk_mac_t *pMac, rtk_fid_t fid, rtk_l2_ucastAddr_t *pL2_data);\r\n\r\n\/* Function Name:\r\n *      rtk_l2_addr_del\r\n * Description:\r\n *      Delete LUT unicast entry\r\n * Input:\r\n *      pMac               -   6 bytes unicast mac address to be deleted\r\n *      fid                   -   filtering database id, could be any value for RTL8306E switch\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                               -  Success\r\n *      RT_ERR_FAILED                         -   Failure\r\n *      RT_ERR_INPUT                          -   Invalid input parameter\r\n *      RT_ERR_MAC                            -   Wrong mac address, must be unicast mac        \r\n *      RT_ERR_NULL_POINTER              -   Input parameter is null pointer    \r\n *      RT_ERR_L2_ENTRY_NOTFOUND    -   Specified entry not found \r\n * Note:\r\n *      If the mac has existed in the LUT, it will be deleted.\r\n *      Otherwise, it will return RT_ERR_L2_ENTRY_NOTFOUND.\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_addr_del(rtk_mac_t *pMac, rtk_fid_t fid); \r\n\r\n\/* Function Name:\r\n *      rtk_l2_mcastAddr_add\r\n * Description:\r\n *      Add LUT multicast entry\r\n * Input:\r\n *      pMac               -   6 bytes unicast mac address to be deleted\r\n *      fid                   -   filtering database id, could be any value for RTL8306E switch\r\n *      portmask          -   Port mask to be forwarded to \r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                               -  Success\r\n *      RT_ERR_FAILED                         -   Failure\r\n *      RT_ERR_INPUT                          -   Invalid input parameter\r\n *      RT_ERR_PORT_MASK                  -   Invalid port mask\r\n *      RT_ERR_MAC                            -   Wrong mac address, must be unicast mac        \r\n *      RT_ERR_L2_INDEXTBL_FULL         -   Hashed index is full of entries\r\n * Note:\r\n *      If the multicast mac address already existed in the LUT, it will udpate the\r\n *      port mask of the entry. Otherwise, it will find an empty or asic auto learned\r\n *      entry to write. If all the entries with the same hash value can't be replaced, \r\n *      ASIC will return a RT_ERR_L2_INDEXTBL_FULL error.\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_mcastAddr_add(rtk_mac_t *pMac, rtk_fid_t fid, rtk_portmask_t portmask);\r\n\r\n\/* Function Name:\r\n *      rtk_l2_mcastAddr_get\r\n * Description:\r\n *      Get LUT multicast entry\r\n * Input:\r\n *      pMac               -   6 bytes multicast(I\/G bit is 0) mac address to be gotten\r\n *      fid                   -   filtering database id, could be any value for RTL8306E switch\r\n * Output:\r\n *      pPortmask         -   the pointer of port mask      \r\n * Return:\r\n *      RT_ERR_OK                               -  Success\r\n *      RT_ERR_FAILED                         -   Failure\r\n *      RT_ERR_INPUT                          -   Invalid input parameter\r\n *      RT_ERR_NULL_POINTER              -   Input parameter is null pointer    \r\n *      RT_ERR_MAC                            -   Wrong mac address, must be unicast mac        \r\n *      RT_ERR_L2_INDEXTBL_FULL         -   Hashed index is full of entries \r\n * Note:\r\n *      If the multicast mac address existed in LUT, it will return the port mask where\r\n *      the packet should be forwarded to, Otherwise, it will return a \r\n *      RT_ERR_L2_ENTRY_NOTFOUND error.\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_mcastAddr_get(rtk_mac_t *pMac, rtk_fid_t fid, rtk_portmask_t *pPortmask);\r\n\r\n\/* Function Name:\r\n *      rtk_l2_mcastAddr_del\r\n * Description:\r\n *      Delete LUT unicast entry\r\n * Input:\r\n *      pMac               -   6 bytes multicast(I\/G bit is 1) mac address to be gotten\r\n *      fid                   -   filtering database id, could be any value for RTL8306E switch\r\n * Output:\r\n*       none\r\n * Return:\r\n *      RT_ERR_OK                               -  Success\r\n *      RT_ERR_FAILED                         -   Failure\r\n *      RT_ERR_INPUT                          -   Invalid input parameter\r\n *      RT_ERR_MAC                            -   Wrong mac address, must be unicast mac        \r\n *      RT_ERR_L2_ENTRY_NOTFOUND     -   No such LUT entry\r\n * Note:\r\n *      If the mac has existed in the LUT, it will be deleted.\r\n *      Otherwise, it will return RT_ERR_L2_ENTRY_NOTFOUND.\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_mcastAddr_del(rtk_mac_t *pMac, rtk_fid_t fid);    \r\n\r\n\/* Function Name:\r\n *      rtk_l2_limitLearningCnt_set\r\n * Description:\r\n *      Set per-Port auto learning limit number\r\n * Input:\r\n *      port - Port id.\r\n *      mac_cnt - Auto learning entries limit number\r\n * Output:\r\n *      None\r\n * Return:\r\n *      RT_ERR_OK              - set shared meter successfully\r\n *      RT_ERR_FAILED          - FAILED to iset shared meter\r\n *      RT_ERR_PORT_ID - Invalid port number.\r\n *      RT_ERR_LIMITED_L2ENTRY_NUM - Invalid auto learning limit number\r\n * Note:\r\n *      (1)The API can set per-port ASIC auto learning limit number from 0(disable learning) \r\n *      to 0x1F(31). \r\n *      (2)If mac_cnt is set from 0 to 0x1F, per-port ASIC auto learning limit will be enabled;\r\n *      if mac_cnt is set 0xFF, per-port ASIC auto learning limit will be disabled.\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_limitLearningCnt_set(rtk_port_t port, rtk_mac_cnt_t mac_cnt);\r\n\r\n\/* Function Name:\r\n *      rtk_l2_limitLearningCnt_get\r\n * Description:\r\n *      Get per-Port auto learning limit number\r\n * Input:\r\n *      port - Port id.\r\n * Output:\r\n *      pMac_cnt - Auto learning entries limit number\r\n * Return:\r\n *      RT_ERR_OK              - Success\r\n *      RT_ERR_FAILED          - Failure \r\n *      RT_ERR_PORT_ID - Invalid port number. \r\n * Note:\r\n *      The API can get per-port ASIC auto learning limit number.\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_limitLearningCnt_get(rtk_port_t port, rtk_mac_cnt_t *pMac_cnt);\r\n\r\n\/* Function Name:\r\n *      rtk_l2_limitLearningCntAction_set\r\n * Description:\r\n *      Configure auto learn over limit number action.\r\n * Input:\r\n *      port - Port id (must be RTK_WHOLE_SYSTEM)\r\n *      action - Auto learning entries limit number\r\n * Output:\r\n *      None\r\n * Return:\r\n *      RT_ERR_OK              - Success\r\n *      RT_ERR_FAILED          - Failure \r\n *      RT_ERR_PORT_ID - Invalid port number.\r\n *      RT_ERR_NOT_ALLOWED - Invalid learn over action\r\n * Note:\r\n *      (1)The API can set SA unknown packet action while auto learn limit number is over. \r\n *      The action symbol as following:\r\n *      - LIMIT_LEARN_CNT_ACTION_DROP,\r\n *      - LIMIT_LEARN_CNT_ACTION_TO_CPU,\r\n *      (2)The action is global, so the port must be set as RTK_WHOLE_SYSTEM\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_limitLearningCntAction_set(rtk_port_t port, rtk_l2_limitLearnCntAction_t action);\r\n\r\n\/* Function Name:\r\n *      rtk_l2_limitLearningCntAction_get\r\n * Description:\r\n *      Get auto learn over limit number action.\r\n * Input:\r\n *      port - Port id (must be RTK_WHOLE_SYSTEM)\r\n * Output:\r\n *      pAction - Learn over action\r\n * Return:\r\n *      RT_ERR_OK              - Success\r\n *      RT_ERR_FAILED          - Failure \r\n *      RT_ERR_PORT_ID - Invalid port number. \r\n * Note:\r\n *      (1)The API can get SA unknown packet action while auto learn limit number is over. \r\n *      The action symbol as following:\r\n *      - LIMIT_LEARN_CNT_ACTION_DROP,\r\n *      - LIMIT_LEARN_CNT_ACTION_TO_CPU,\r\n *      (2)The action is global, so the port must be set as RTK_WHOLE_SYSTEM\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_limitLearningCntAction_get(rtk_port_t port, rtk_l2_limitLearnCntAction_t *pAction);\r\n\r\n\/* Function Name:\r\n *      rtk_l2_learningCnt_get\r\n * Description:\r\n *      Get per-Port current auto learning number\r\n * Input:\r\n *      port - Port id.\r\n * Output:\r\n *      pMac_cnt - ASIC auto learning entries number\r\n * Return:\r\n *      RT_ERR_OK              - Success\r\n *      RT_ERR_PORT_ID - Invalid port number. \r\n *      RT_ERR_NULL_POINTER   -   Input parameter is null pointer  \r\n * Note:\r\n *      The API can get per-port ASIC auto learning number\r\n *\/\r\nextern rtk_api_ret_t rtk_l2_learningCnt_get(rtk_port_t port, rtk_mac_cnt_t *pMac_cnt);\r\n\r\n\/* CPU Port *\/\r\n\r\n\/* Function Name:\r\n *      rtk_cpu_enable_set\r\n * Description:\r\n *      Set cpu port function enable or disable\r\n * Input:\r\n *      enable          - enable or disable\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                        -  Success\r\n *      RT_ERR_FAILED                  -   Failure\r\n * Note:\r\n *      The API can set CPU port function enable\/disable\r\n *      default port 4 is cpu port.\r\n *\/\r\nextern rtk_api_ret_t rtk_cpu_enable_set(rtk_enable_t enable);\r\n\r\n\/* Function Name:\r\n *      rtk_cpu_enable_get\r\n * Description:\r\n *      Get cpu port function enable or disable\r\n * Input:\r\n *      none\r\n * Output:\r\n *      pEnable          -  the pointer of enable or disable cpu port function\r\n * Return:\r\n *      RT_ERR_OK                   -  Success\r\n *      RT_ERR_FAILED             -   Failure\r\n * Note:\r\n *      The API can set CPU port function enable\/disable\r\n *\/\r\nextern rtk_api_ret_t rtk_cpu_enable_get(rtk_enable_t *pEnable);\r\n\r\n\/* Function Name:\r\n *      rtk_cpu_tagPort_set\r\n * Description:\r\n *      Set CPU port and CPU tag insert mode\r\n * Input:\r\n *      port          -  Port id\r\n *      mode        -  CPU tag insert for packets egress from CPU port\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                   -  Success\r\n *      RT_ERR_FAILED             -   Failure\r\n *      RT_ERR_PORT_ID           -   Invalid port id\r\n * Note:\r\n *      The API can set CPU port and inserting proprietary CPU tag mode (Length\/Type 0x8899)\r\n *      to the frame that transmitting to CPU port.\r\n *      The inset cpu tag mode is as following:\r\n *          - CPU_INSERT_TO_ALL\r\n *          - CPU_INSERT_TO_TRAPPING\r\n *          - CPU_INSERT_TO_NONE   \r\n *\/ \r\nextern rtk_api_ret_t rtk_cpu_tagPort_set(rtk_port_t port, rtk_cpu_insert_t mode);\r\n\r\n\/* Function Name:\r\n *      rtk_cpu_tagPort_get\r\n * Description:\r\n *      Get CPU port and CPU tag insert mode\r\n * Input:\r\n *      port          -  Port id\r\n * Output:\r\n *      pMode       -  the pointer of CPU tag insert for packets egress from CPU port\r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -   Failure\r\n *      RT_ERR_NULL_POINTER      -   Input parameter is null pointer\r\n * Note:\r\n *      The API can set CPU port and inserting proprietary CPU tag mode (Length\/Type 0x8899)\r\n *      to the frame that transmitting to CPU port.\r\n *      The inset cpu tag mode is as following:\r\n *          - CPU_INSERT_TO_ALL\r\n *          - CPU_INSERT_TO_TRAPPING\r\n *          - CPU_INSERT_TO_NONE    \r\n *\/\r\n\r\nextern rtk_api_ret_t rtk_cpu_tagPort_get(rtk_port_t *pPort, rtk_cpu_insert_t *pMode);\r\n\r\n\r\n\/*Port Mirror *\/\r\n\r\n\/* Function Name:\r\n *      rtk_mirror_portBased_set\r\n * Description:\r\n *      Set port mirror function\r\n * Input:\r\n *      mirroring_port                  - Monitor port, 7 means no monitor port\r\n *      pMirrored_rx_portmask      - the pointer of Rx mirror port mask\r\n *      pMirrored_tx_portmask      - the pointer of Tx mirror port mask\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -   Failure\r\n *      RT_ERR_PORT_MASK         -   Invalid port mask\r\n * Note:\r\n *      The API is to set mirror function of source port and mirror port. \r\n *\/\r\nextern rtk_api_ret_t rtk_mirror_portBased_set(rtk_port_t mirroring_port, rtk_portmask_t *pMirrored_rx_portmask, rtk_portmask_t *pMirrored_tx_portmask);\r\n\r\n\/* Function Name:\r\n *      rtk_mirror_portBased_get\r\n * Description:\r\n *      Get port mirror function\r\n * Input:\r\n *      none \r\n * Output:\r\n *      pMirroring_port             - the pointer Monitor port, 7 means no monitor port\r\n *      pMirrored_rx_portmask   - the pointer of Rx mirror port mask\r\n *      pMirrored_tx_portmask   - the pointer of Tx mirror port mask \r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -   Failure\r\n *      RT_ERR_PORT_MASK         -   Invalid port mask\r\n *      RT_ERR_NULL_POINTER      -   Input parameter is null pointer \r\n * Note:\r\n *      The API is to set mirror function of source port and mirror port. \r\n *\/\r\nextern rtk_api_ret_t rtk_mirror_portBased_get(rtk_port_t* pMirroring_port, rtk_portmask_t *pMirrored_rx_portmask, rtk_portmask_t *pMirrored_tx_portmask);\r\n\r\n\/* 802.1X *\/\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_unauthPacketOper_set\r\n * Description:\r\n *      Set 802.1x unauth action configuration\r\n * Input:\r\n *      port                 -   Port id, no use for RTL8306E switch\r\n *      unauth_action   -   802.1X unauth action    \r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n *      RT_ERR_DOT1X_PROC\r\n * Note:\r\n *      This API can set 802.1x unauth action configuration, \r\n *      for RTL8306E switch, the action is by whole system,\r\n *      so port could be any value of 0~6.\r\n *      The unauth action is as following:\r\n *          - DOT1X_ACTION_DROP\r\n *          - DOT1X_ACTION_TRAP2CPU\r\n *\/\r\n\r\nextern rtk_api_ret_t rtk_dot1x_unauthPacketOper_set(rtk_port_t port, rtk_dot1x_unauth_action_t unauth_action);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_unauthPacketOper_get\r\n * Description:\r\n *      Get 802.1x unauth action configuration\r\n * Input:\r\n *      port                  -   Port id, no use for RTL8306E switch\r\n * Output:\r\n *      pUnauth_action   -  the pointer of 802.1X unauth action    \r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -   Failure\r\n *      RT_ERR_NULL_POINTER      -   Input parameter is null pointer\r\n * Note:\r\n *      This API can set 802.1x unauth action configuration, \r\n *      for RTL8306E switch, the action is by whole system,\r\n *      so port could be any value of 0~6.\r\n *      The unauth action is as following:\r\n *          - DOT1X_ACTION_DROP\r\n *          - DOT1X_ACTION_TRAP2CPU\r\n *\/\r\nextern rtk_api_ret_t rtk_dot1x_unauthPacketOper_get(rtk_port_t port, rtk_dot1x_unauth_action_t *pUnauth_action);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_portBasedEnable_set\r\n * Description:\r\n *      Set 802.1x port-based enable configuration\r\n * Input:\r\n *      port                  -   Port id\r\n *      enable               -   enable or disable\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                      -  Success\r\n *      RT_ERR_FAILED                -   Failure\r\n *      RT_ERR_PORT_ID              -   Invalid port id\r\n * Note:\r\n *      The API can update the port-based port enable register content. If a port is 802.1x \r\n *      port based network access control \"enabled\", it should be authenticated so packets \r\n *      from that port won't be dropped or trapped to CPU. \r\n *      The status of 802.1x port-based network access control is as following:\r\n *          - DISABLED\r\n *          - ENABLED\r\n *\/    \r\nextern rtk_api_ret_t rtk_dot1x_portBasedEnable_set(rtk_port_t port, rtk_enable_t enable);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_portBasedEnable_get\r\n * Description:\r\n *      Get 802.1x port-based enable configuration\r\n * Input:\r\n *      port                  -   Port id\r\n * Output:\r\n *      pEnable             -   the pointer of enable or disable\r\n * Return:\r\n *      RT_ERR_OK                -  Success\r\n *      RT_ERR_FAILED          -   Failure\r\n *      RT_ERR_PORT_ID        -   Invalid port id\r\n * Note:\r\n *      The API can update the port-based port enable register content. If a port is 802.1x \r\n *      port based network access control \"enabled\", it should be authenticated so packets \r\n *      from that port won't be dropped or trapped to CPU. \r\n *      The status of 802.1x port-based network access control is as following:\r\n *          - DISABLED\r\n *          - ENABLED\r\n *\/    \r\nextern rtk_api_ret_t rtk_dot1x_portBasedEnable_get(rtk_port_t port, rtk_enable_t *pEnable);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_portBasedAuthStatus_set\r\n * Description:\r\n *      Set 802.1x port-based enable configuration\r\n * Input:\r\n *      port                  -   Port id\r\n *      port_auth          -  The status of 802.1x port\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                                    -  Success\r\n *      RT_ERR_FAILED                              -   Failure\r\n *      RT_ERR_PORT_ID                            -   Invalid port id\r\n *      RT_ERR_DOT1X_PORTBASEDAUTH      -   Port-based auth port error\r\n * Note:\r\n *      The authenticated status of 802.1x port-based network access control is as following:\r\n *          - UNAUTH\r\n *          - AUTH\r\n *\/    \r\nextern rtk_api_ret_t rtk_dot1x_portBasedAuthStatus_set(rtk_port_t port, rtk_dot1x_auth_status_t port_auth);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_portBasedAuthStatus_get\r\n * Description:\r\n *      Get 802.1x port-based enable configuration\r\n * Input:\r\n *      port                  -   Port id\r\n * Output:\r\n *      pPort_auth         -   the pointer of the status of 802.1x port\r\n * Return:\r\n *      RT_ERR_OK                          -  Success\r\n *      RT_ERR_FAILED                     -  Failure\r\n *      RT_ERR_PORT_ID                   -  Invalid port id\r\n *      RT_ERR_NULL_POINTER           -  Input parameter is null pointer\r\n * Note:\r\n *      The authenticated status of 802.1x port-based network access control is as following:\r\n *          - UNAUTH\r\n *          - AUTH\r\n *\/    \r\nextern rtk_api_ret_t rtk_dot1x_portBasedAuthStatus_get(rtk_port_t port, rtk_dot1x_auth_status_t *pPort_auth);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_portBasedDirection_set\r\n * Description:\r\n *      Set 802.1x port-based operational direction configuration\r\n * Input:\r\n *      port                  -   Port id\r\n *      port_direction     -   Operation direction\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                                 -  Success\r\n *      RT_ERR_FAILED                           -  Failure\r\n *      RT_ERR_PORT_ID                         -  Invalid port id\r\n *      RT_ERR_DOT1X_PORTBASEDOPDIR  -  Port-based opdir error\r\n * Note:\r\n *      The operate controlled direction of 802.1x port-based network access control is as following:\r\n *          - BOTH\r\n *          - IN\r\n *\/    \r\nextern rtk_api_ret_t rtk_dot1x_portBasedDirection_set(rtk_port_t port, rtk_dot1x_direction_t port_direction);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_portBasedDirection_get\r\n * Description:\r\n *      Get 802.1x port-based operational direction configuration\r\n * Input:\r\n *      port                  -   Port id\r\n * Output:\r\n *      pPort_direction    -   the pointer of Operation direction\r\n * Return:\r\n *      RT_ERR_OK                         -  Success\r\n *      RT_ERR_FAILED                    -  Failure\r\n *      RT_ERR_PORT_ID                  -  Invalid port id\r\n *      RT_ERR_NULL_POINTER          -  Input parameter is null pointer\r\n * Note:\r\n *      The operate controlled direction of 802.1x port-based network access control is as following:\r\n *          - BOTH\r\n *          - IN\r\n *\/    \r\nextern rtk_api_ret_t rtk_dot1x_portBasedDirection_get(rtk_port_t port, rtk_dot1x_direction_t *pPort_direction);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_macBasedEnable_set\r\n * Description:\r\n *      Set 802.1x mac-based port enable configuration\r\n * Input:\r\n *      port                  -   Port id\r\n *      enable               -   The status of 802.1x mac-base funtion\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                         -  Success\r\n *      RT_ERR_FAILED                    -  Failure\r\n *      RT_ERR_PORT_ID                  -  Invalid port id\r\n * Note:\r\n *     If a port is 802.1x MAC based network access control \"enabled\", the incoming packets should \r\n *     be authenticated so packets from that port won't be dropped or trapped to CPU.\r\n *     The status of 802.1x MAC-based network access control is as following:\r\n *         - DISABLED\r\n *         - ENABLED\r\n *\/    \r\nextern rtk_api_ret_t rtk_dot1x_macBasedEnable_set(rtk_port_t port, rtk_enable_t enable);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_macBasedEnable_get\r\n * Description:\r\n *      Get 802.1x mac-based port enable configuration\r\n * Input:\r\n *      port                  -   Port id\r\n * Output:\r\n *      pEnable             -   the pointer of the status of 802.1x mac-base funtion\r\n * Return:\r\n *      RT_ERR_OK               -  Success\r\n *      RT_ERR_FAILED         -   Failure\r\n * Note:\r\n *     If a port is 802.1x MAC based network access control \"enabled\", the incoming packets should \r\n *     be authenticated so packets from that port won't be dropped or trapped to CPU.\r\n *     The status of 802.1x MAC-based network access control is as following:\r\n *         - DISABLED\r\n *         - ENABLED\r\n *\/    \r\nextern rtk_api_ret_t rtk_dot1x_macBasedEnable_get(rtk_port_t port, rtk_enable_t *pEnable);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_macBasedDirection_set\r\n * Description:\r\n *      Set 802.1x mac-based operational direction configuration\r\n * Input:\r\n *      mac_direction    -   Operation direction\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                                    -  Success\r\n *      RT_ERR_FAILED                              -  Failure\r\n *      RT_ERR_DOT1X_MACBASEDOPDIR      -  MAC-based opdir error\r\n * Note:\r\n *      The operate controlled direction of 802.1x mac-based network access control is as following:\r\n *          - BOTH\r\n *          - IN\r\n *\/     \r\nextern rtk_api_ret_t rtk_dot1x_macBasedDirection_set(rtk_dot1x_direction_t mac_direction);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_macBasedDirection_get\r\n * Description:\r\n *      Get 802.1x mac-based operational direction configuration\r\n * Input:\r\n *      none\r\n * Output:\r\n *      pMac_direction    -   the pointer of Operation direction\r\n * Return:\r\n *      RT_ERR_OK                                    -  Success\r\n *      RT_ERR_FAILED                              -  Failure\r\n *      RT_ERR_NULL_POINTER                    -  Input parameter is null pointer\r\n * Note:\r\n *      The operate controlled direction of 802.1x mac-based network access control is as following:\r\n *          - BOTH\r\n *          - IN\r\n *\/  \r\nextern rtk_api_ret_t rtk_dot1x_macBasedDirection_get(rtk_dot1x_direction_t *pMac_direction);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_macBasedAuthMac_add\r\n * Description:\r\n *      Add an authenticated MAC to ASIC\r\n * Input:\r\n *      port            -  Port id\r\n *      pAuth_mac   - The authenticated MAC\r\n *      fid              -  no use for RTL8306E   \r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                                       - Success\r\n *      RT_ERR_FAILED                                 -  Failure\r\n *      RT_ERR_L2_ENTRY_NOTFOUND             -  Specified entry not found\r\n *      RT_ERR_DOT1X_MAC_PORT_MISMATCH  - Auth MAC and port mismatch eror \r\n * Note:\r\n *     The API can add a 802.1x authenticated MAC address to port. If the MAC does not exist in LUT, \r\n *     user can't add this MAC to auth status.\r\n *\/    \r\nextern rtk_api_ret_t rtk_dot1x_macBasedAuthMac_add(rtk_port_t port, rtk_mac_t *pAuth_mac, rtk_fid_t fid);\r\n\r\n\/* Function Name:\r\n *      rtk_dot1x_macBasedAuthMac_del\r\n * Description:\r\n *      Delete an authenticated MAC to ASIC\r\n * Input:\r\n *      port            -  Port id\r\n *      pAuth_mac   - The authenticated MAC\r\n *      fid              -  no use for RTL8306E   \r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK                                       - Success\r\n *      RT_ERR_FAILED                                 -  Failure\r\n *      RT_ERR_L2_ENTRY_NOTFOUND             -  Specified entry not found\r\n *      RT_ERR_DOT1X_MAC_PORT_MISMATCH  - Auth MAC and port mismatch eror \r\n * Note:\r\n *     The API can delete a 802.1x authenticated MAC address to port. It only change the auth status of\r\n *     the MAC and won't delete it from LUT.\r\n *\/    \r\nextern rtk_api_ret_t rtk_dot1x_macBasedAuthMac_del(rtk_port_t port, rtk_mac_t *pAuth_mac, rtk_fid_t fid);\r\n\r\n\r\n\/* Function Name:\r\n *      rtk_svlan_init\r\n * Description:\r\n *      Initialize SVLAN Configuration\r\n * Input:\r\n *      none\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n *      RT_ERR_SMI\r\n *      RT_ERR_INPUT\r\n * Note:\r\n *    Ether type of S-tag in 802.1ad is 0x88a8 and there are existed ether type \r\n *    0x9100 and 0x9200 for Q-in-Q SLAN design. User can set mathced ether \r\n *    type as service provider supported protocol. After call this API, all ports are \r\n *    set as CVLAN port. you can use rtk_svlan_servicePort_add to add SVLAN port. \r\n *\/\r\nextern rtk_api_ret_t rtk_svlan_init(void);\r\n\r\n\/* Function Name:\r\n *      rtk_svlan_servicePort_add\r\n * Description:\r\n *      Enable one service port in the specified device\r\n * Input:\r\n *      port     -  Port id\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n *      RT_ERR_SMI\r\n * Note:\r\n *    This API is setting which port is connected to provider switch. All frames receiving from this port\r\n *    will recognize Service Vlan Tag.\r\n *    \r\n *\/\r\nextern rtk_api_ret_t rtk_svlan_servicePort_add(rtk_port_t port);\r\n\r\n\r\n\/* Function Name:\r\n *      rtk_svlan_servicePort_del\r\n * Description:\r\n *      Disable one service port in the specified device\r\n * Input:\r\n *      none\r\n * Output:\r\n *      pSvlan_portmask  - svlan ports mask\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n *      RT_ERR_SMI\r\n * Note:\r\n *      Ether type of S-tag in 802.1ad is 0x88a8 and there are existed ether type\r\n *      0x9100 and 0x9200 for Q-in-Q SLAN design. User can set mathced ether type as service \r\n *      provider supported protocol. \r\n *\/\r\nextern rtk_api_ret_t rtk_svlan_servicePort_del(rtk_port_t port);\r\n\r\n\/* Function Name:\r\n *      rtk_svlan_servicePort_get\r\n * Description:\r\n *      Disable one service port in the specified device\r\n * Input:\r\n *      none\r\n * Output:\r\n *      pSvlan_portmask  - svlan ports mask\r\n * Return:\r\n *      RT_ERR_OK                 - success\r\n *      RT_ERR_FAILED            -  fail\r\n *      RT_ERR_NULL_POINTER  -  null pointer\r\n * Note:\r\n *      Ether type of S-tag in 802.1ad is 0x88a8 and there are existed ether type 0x9100 \r\n *      and 0x9200 for Q-in-Q SLAN design. User can set mathced ether type as service \r\n *      provider supported protocol. \r\n *\/\r\nextern rtk_api_ret_t rtk_svlan_servicePort_get(rtk_portmask_t *pSvlan_portmask);\r\n\r\n\/* Function Name:\r\n *      rtk_svlan_tpidEntry_set\r\n * Description:\r\n *      Configure accepted S-VLAN ether type. The default ether type of S-VLAN is 0x88a8\r\n * Input:\r\n *      svlan_tag_id  - Ether type of S-tag frame parsing in uplink ports\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n *      RT_ERR_SMI\r\n * Note:\r\n *      Ether type of S-tag in 802.1ad is 0x88a8 and there are existed ether type 0x9100 \r\n *      and 0x9200 for Q-in-Q SLAN design. User can set mathced ether type as service \r\n *      provider supported protocol. \r\n *\/\r\nextern rtk_api_ret_t rtk_svlan_tpidEntry_set(rtk_svlan_tpid_t svlan_tag_id);\r\n\r\n\r\n\/* Function Name:\r\n *      rtk_svlan_tpidEntry_get\r\n * Description:\r\n *      Get accepted S-VLAN ether type. The default ether type of S-VLAN is 0x88a8\r\n * Input:\r\n *      pSvlan_tag_id       - Ether type of S-tag frame parsing in uplink ports\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n * Note:\r\n *      Ether type of S-tag in 802.1ad is 0x88a8 and there are existed ether type 0x9100 \r\n *      and 0x9200 for Q-in-Q SLAN design. User can set mathced ether type as service \r\n *      provider supported protocol. \r\n *\/\r\nextern rtk_api_ret_t rtk_svlan_tpidEntry_get(rtk_svlan_tpid_t *pSvlan_tag_id);\r\n\r\n\r\n\/* Function Name:\r\n *      rtk_svlan_portPvid_set\r\n * Description:\r\n *      Set port to specified VLAN ID(PVID) for Service Provider Port\r\n * Input:\r\n *      port             - Port id\r\n *      pvid             - Specified Service VLAN ID\r\n *      priority         - 802.1p priority for the PVID\r\n *      dei               - Service VLAN tag DEI bit\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n *      RT_ERR_VLAN_VID\r\n *      RT_ERR_SMI \r\n *      RT_ERR_VLAN_PRIORITY \r\n *      RT_ERR_VLAN_ENTRY_NOT_FOUND\r\n * Note:\r\n *    The API is used for Port-based VLAN. The untagged frame received from the\r\n *    port will be classified to the specified VLAN and assigned to the specified priority.\r\n *\/\r\nextern rtk_api_ret_t rtk_svlan_portPvid_set(rtk_port_t port, rtk_vlan_t pvid, rtk_pri_t priority, rtk_dei_t dei);\r\n\r\n\/* Function Name:\r\n *      rtk_svlan_portPvid_get\r\n * Description:\r\n *      Get Service VLAN ID(PVID) on specified port\r\n * Input:\r\n *      port             - Port id\r\n *      pPvid            - Specified VLAN ID\r\n *      pPriority        - 802.1p priority for the PVID\r\n *      pDei             - DEI bit\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n *      RT_ERR_SMI\r\n *      RT_ERR_PORT_ID\r\n *      RT_ERR_NULL_POINTER \r\n * Note:\r\n *    The API is used for Port-based VLAN. The untagged frame received from the\r\n *    port will be classified to the specified VLAN and assigned to the specified priority.\r\n *\/\r\nextern rtk_api_ret_t rtk_svlan_portPvid_get(rtk_port_t port, rtk_vlan_t *pPvid, rtk_pri_t* pPriority, rtk_dei_t *pDei);\r\n\r\n\/* Function Name:\r\n *      rtk_filter_igrAcl_init\r\n * Description:\r\n *       Initialize ACL \r\n * Input:\r\n *      none\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n * Note:\r\n *      The API init ACL module.\r\n *\/\r\nextern rtk_api_ret_t rtk_filter_igrAcl_init(void);\r\n\r\n\/* Function Name:\r\n *      rtk_filter_igrAcl_rule_add\r\n * Description:\r\n *      Add an acl rule into acl table\r\n * Input:\r\n *      pRule    -  the pointer of rule structure\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n *      RT_ERR_TBL_FULL\r\n *      RT_ERR_NULL_POINTER\r\n * Note:\r\n *      The API add an  ACL rule. &lt;nl&gt;\r\n *      phyport could be  0~5: port number,  RTL8306_ACL_ANYPORT: any port;&lt;nl&gt;\r\n *      protocol could be RTL8306_ACL_ETHER(ether type), RTL8306_ACL_TCP(TCP), RTL8306_ACL_UDP(UDP), RTL8306_ACL_TCPUDP(TCP or UDP);&lt;nl&gt;\r\n *      prority could be RTL8306_PRIO0~RTL8306_PRIO3;&lt;nl&gt;\r\n *      action could be RTL8306_ACT_DROP\/RTL8306_ACT_PERMIT\/RTL8306_ACT_TRAPCPU\/RTL8306_ACT_MIRROR;&lt;nl&gt;\r\n *\/\r\n\r\nextern rtk_api_ret_t rtk_filter_igrAcl_rule_add(rtk_filter_rule_t *pRule);\r\n\r\n\/* Function Name:\r\n *      rtk_filter_igrAcl_rule_get\r\n * Description:\r\n *      Get ACL rule priority and action \r\n * Input:\r\n *      pRule    -  the pointer of rule structure\r\n * Output:\r\n *      pRule    -  the pointer of rule structure\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n * Note:\r\n *      The API add an  ACL rule. &lt;nl&gt;\r\n *      phyport could be  0~5: port number,  RTL8306_ACL_ANYPORT: any port;&lt;nl&gt;\r\n *      protocol could be RTL8306_ACL_ETHER(ether type), RTL8306_ACL_TCP(TCP), RTL8306_ACL_UDP(UDP), RTL8306_ACL_TCPUDP(TCP or UDP);&lt;nl&gt;\r\n *      prority could be RTL8306_PRIO0~RTL8306_PRIO3;&lt;nl&gt;\r\n *      action could be RTL8306_ACT_DROP\/RTL8306_ACT_PERMIT\/RTL8306_ACT_TRAPCPU\/RTL8306_ACT_MIRROR;&lt;nl&gt;\r\n *\/\r\nextern rtk_api_ret_t rtk_filter_igrAcl_rule_get(rtk_filter_rule_t *pRule);\r\n\r\n\r\n\r\n\/* Function Name:\r\n *      rtk_filter_igrAcl_rule_del\r\n * Description:\r\n *      Delete an acl rule into acl table\r\n * Input:\r\n *      pRule    -  the pointer of rule structure\r\n * Output:\r\n *      none\r\n * Return:\r\n *      RT_ERR_OK\r\n *      RT_ERR_FAILED\r\n *      RT_ERR_INPUT\r\n *      RT_ERR_NULL_POINTER\r\n * Note:\r\n *      The API delete an  ACL rule. &lt;nl&gt;\r\n *      only phyport\/protocol\/data field in pRule needs to be specified.\r\n *\/\r\nextern rtk_api_ret_t rtk_filter_igrAcl_rule_del(rtk_filter_rule_t *pRule);\r\n\r\n\r\n\r\n\r\n#endif   \/*__RTK_API_EXT_H__*\/<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/github.com\/Undrizzle\/apps\/blob\/58b712ebf8055266 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/posts\/921"}],"collection":[{"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=921"}],"version-history":[{"count":1,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/posts\/921\/revisions"}],"predecessor-version":[{"id":922,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/posts\/921\/revisions\/922"}],"wp:attachment":[{"href":"https:\/\/blog.iotot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}