aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/leaky.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2020-10-24 21:15:20 +0200
committerDaniel Golle <daniel@makrotopia.org>2021-02-28 00:45:56 +0000
commitc46ccb69d17e584479df849a107423175a143c83 (patch)
tree10c0b329ba571cbdd366e48e61173a64e56c841d /target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/leaky.c
parent11425c9de29c8b9c5e4d7eec163a6afbb7fbdce2 (diff)
downloadupstream-c46ccb69d17e584479df849a107423175a143c83.tar.gz
upstream-c46ccb69d17e584479df849a107423175a143c83.tar.bz2
upstream-c46ccb69d17e584479df849a107423175a143c83.zip
mediatek: mt7622: add Linux 5.10 support
Switch mt7622 subtarget to Linux 5.10, it has been tested by many of us on several devices for a couple of weeks already. Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/leaky.c')
-rw-r--r--target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/leaky.c590
1 files changed, 590 insertions, 0 deletions
diff --git a/target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/leaky.c b/target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/leaky.c
new file mode 100644
index 0000000000..1b7d50a9e5
--- /dev/null
+++ b/target/linux/mediatek/files-5.10/drivers/net/phy/rtk/rtl8367c/leaky.c
@@ -0,0 +1,590 @@
+/*
+ * Copyright (C) 2013 Realtek Semiconductor Corp.
+ * All Rights Reserved.
+ *
+ * Unless you and Realtek execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2,
+ * available at https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+ *
+ * $Revision: 76306 $
+ * $Date: 2017-03-08 15:13:58 +0800 (週三, 08 三月 2017) $
+ *
+ * Purpose : RTK switch high-level API for RTL8367/RTL8367C
+ * Feature : Here is a list of all functions and variables in Leaky module.
+ *
+ */
+
+#include <rtk_switch.h>
+#include <rtk_error.h>
+#include <leaky.h>
+#include <string.h>
+
+#include <rtl8367c_asicdrv.h>
+#include <rtl8367c_asicdrv_portIsolation.h>
+#include <rtl8367c_asicdrv_rma.h>
+#include <rtl8367c_asicdrv_igmp.h>
+
+
+/* Function Name:
+ * rtk_leaky_vlan_set
+ * Description:
+ * Set VLAN leaky.
+ * Input:
+ * type - Packet type for VLAN leaky.
+ * enable - Leaky status.
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * RT_ERR_ENABLE - Invalid enable input
+ * Note:
+ * This API can set VLAN leaky for RMA ,IGMP/MLD, CDP, CSSTP, and LLDP packets.
+ * The leaky frame types are as following:
+ * - LEAKY_BRG_GROUP,
+ * - LEAKY_FD_PAUSE,
+ * - LEAKY_SP_MCAST,
+ * - LEAKY_1X_PAE,
+ * - LEAKY_UNDEF_BRG_04,
+ * - LEAKY_UNDEF_BRG_05,
+ * - LEAKY_UNDEF_BRG_06,
+ * - LEAKY_UNDEF_BRG_07,
+ * - LEAKY_PROVIDER_BRIDGE_GROUP_ADDRESS,
+ * - LEAKY_UNDEF_BRG_09,
+ * - LEAKY_UNDEF_BRG_0A,
+ * - LEAKY_UNDEF_BRG_0B,
+ * - LEAKY_UNDEF_BRG_0C,
+ * - LEAKY_PROVIDER_BRIDGE_GVRP_ADDRESS,
+ * - LEAKY_8021AB,
+ * - LEAKY_UNDEF_BRG_0F,
+ * - LEAKY_BRG_MNGEMENT,
+ * - LEAKY_UNDEFINED_11,
+ * - LEAKY_UNDEFINED_12,
+ * - LEAKY_UNDEFINED_13,
+ * - LEAKY_UNDEFINED_14,
+ * - LEAKY_UNDEFINED_15,
+ * - LEAKY_UNDEFINED_16,
+ * - LEAKY_UNDEFINED_17,
+ * - LEAKY_UNDEFINED_18,
+ * - LEAKY_UNDEFINED_19,
+ * - LEAKY_UNDEFINED_1A,
+ * - LEAKY_UNDEFINED_1B,
+ * - LEAKY_UNDEFINED_1C,
+ * - LEAKY_UNDEFINED_1D,
+ * - LEAKY_UNDEFINED_1E,
+ * - LEAKY_UNDEFINED_1F,
+ * - LEAKY_GMRP,
+ * - LEAKY_GVRP,
+ * - LEAKY_UNDEF_GARP_22,
+ * - LEAKY_UNDEF_GARP_23,
+ * - LEAKY_UNDEF_GARP_24,
+ * - LEAKY_UNDEF_GARP_25,
+ * - LEAKY_UNDEF_GARP_26,
+ * - LEAKY_UNDEF_GARP_27,
+ * - LEAKY_UNDEF_GARP_28,
+ * - LEAKY_UNDEF_GARP_29,
+ * - LEAKY_UNDEF_GARP_2A,
+ * - LEAKY_UNDEF_GARP_2B,
+ * - LEAKY_UNDEF_GARP_2C,
+ * - LEAKY_UNDEF_GARP_2D,
+ * - LEAKY_UNDEF_GARP_2E,
+ * - LEAKY_UNDEF_GARP_2F,
+ * - LEAKY_IGMP,
+ * - LEAKY_IPMULTICAST.
+ * - LEAKY_CDP,
+ * - LEAKY_CSSTP,
+ * - LEAKY_LLDP.
+ */
+rtk_api_ret_t rtk_leaky_vlan_set(rtk_leaky_type_t type, rtk_enable_t enable)
+{
+ rtk_api_ret_t retVal;
+ rtk_uint32 port;
+ rtl8367c_rma_t rmacfg;
+ rtk_uint32 tmp;
+
+ /* Check initialization state */
+ RTK_CHK_INIT_STATE();
+
+ if (type >= LEAKY_END)
+ return RT_ERR_INPUT;
+
+ if (enable >= RTK_ENABLE_END)
+ return RT_ERR_INPUT;
+
+ if (type >= 0 && type <= LEAKY_UNDEF_GARP_2F)
+ {
+ if ((retVal = rtl8367c_getAsicRma(type, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ rmacfg.vlan_leaky = enable;
+
+ if ((retVal = rtl8367c_setAsicRma(type, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+ }
+ else if (LEAKY_IPMULTICAST == type)
+ {
+ for (port = 0; port <= RTK_PORT_ID_MAX; port++)
+ {
+ if ((retVal = rtl8367c_setAsicIpMulticastVlanLeaky(port,enable)) != RT_ERR_OK)
+ return retVal;
+ }
+ }
+ else if (LEAKY_IGMP == type)
+ {
+ if ((retVal = rtl8367c_setAsicIGMPVLANLeaky(enable)) != RT_ERR_OK)
+ return retVal;
+ }
+ else if (LEAKY_CDP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaCdp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ rmacfg.vlan_leaky = enable;
+
+ if ((retVal = rtl8367c_setAsicRmaCdp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+ }
+ else if (LEAKY_CSSTP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaCsstp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ rmacfg.vlan_leaky = enable;
+
+ if ((retVal = rtl8367c_setAsicRmaCsstp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+ }
+ else if (LEAKY_LLDP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaLldp(&tmp,&rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ rmacfg.vlan_leaky = enable;
+
+ if ((retVal = rtl8367c_setAsicRmaLldp(tmp, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+ }
+
+ return RT_ERR_OK;
+}
+
+/* Function Name:
+ * rtk_leaky_vlan_get
+ * Description:
+ * Get VLAN leaky.
+ * Input:
+ * type - Packet type for VLAN leaky.
+ * Output:
+ * pEnable - Leaky status.
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * Note:
+ * This API can get VLAN leaky status for RMA ,IGMP/MLD, CDP, CSSTP, and LLDP packets.
+ * The leaky frame types are as following:
+ * - LEAKY_BRG_GROUP,
+ * - LEAKY_FD_PAUSE,
+ * - LEAKY_SP_MCAST,
+ * - LEAKY_1X_PAE,
+ * - LEAKY_UNDEF_BRG_04,
+ * - LEAKY_UNDEF_BRG_05,
+ * - LEAKY_UNDEF_BRG_06,
+ * - LEAKY_UNDEF_BRG_07,
+ * - LEAKY_PROVIDER_BRIDGE_GROUP_ADDRESS,
+ * - LEAKY_UNDEF_BRG_09,
+ * - LEAKY_UNDEF_BRG_0A,
+ * - LEAKY_UNDEF_BRG_0B,
+ * - LEAKY_UNDEF_BRG_0C,
+ * - LEAKY_PROVIDER_BRIDGE_GVRP_ADDRESS,
+ * - LEAKY_8021AB,
+ * - LEAKY_UNDEF_BRG_0F,
+ * - LEAKY_BRG_MNGEMENT,
+ * - LEAKY_UNDEFINED_11,
+ * - LEAKY_UNDEFINED_12,
+ * - LEAKY_UNDEFINED_13,
+ * - LEAKY_UNDEFINED_14,
+ * - LEAKY_UNDEFINED_15,
+ * - LEAKY_UNDEFINED_16,
+ * - LEAKY_UNDEFINED_17,
+ * - LEAKY_UNDEFINED_18,
+ * - LEAKY_UNDEFINED_19,
+ * - LEAKY_UNDEFINED_1A,
+ * - LEAKY_UNDEFINED_1B,
+ * - LEAKY_UNDEFINED_1C,
+ * - LEAKY_UNDEFINED_1D,
+ * - LEAKY_UNDEFINED_1E,
+ * - LEAKY_UNDEFINED_1F,
+ * - LEAKY_GMRP,
+ * - LEAKY_GVRP,
+ * - LEAKY_UNDEF_GARP_22,
+ * - LEAKY_UNDEF_GARP_23,
+ * - LEAKY_UNDEF_GARP_24,
+ * - LEAKY_UNDEF_GARP_25,
+ * - LEAKY_UNDEF_GARP_26,
+ * - LEAKY_UNDEF_GARP_27,
+ * - LEAKY_UNDEF_GARP_28,
+ * - LEAKY_UNDEF_GARP_29,
+ * - LEAKY_UNDEF_GARP_2A,
+ * - LEAKY_UNDEF_GARP_2B,
+ * - LEAKY_UNDEF_GARP_2C,
+ * - LEAKY_UNDEF_GARP_2D,
+ * - LEAKY_UNDEF_GARP_2E,
+ * - LEAKY_UNDEF_GARP_2F,
+ * - LEAKY_IGMP,
+ * - LEAKY_IPMULTICAST.
+ * - LEAKY_CDP,
+ * - LEAKY_CSSTP,
+ * - LEAKY_LLDP.
+ */
+rtk_api_ret_t rtk_leaky_vlan_get(rtk_leaky_type_t type, rtk_enable_t *pEnable)
+{
+ rtk_api_ret_t retVal;
+ rtk_uint32 port,tmp;
+ rtl8367c_rma_t rmacfg;
+
+ /* Check initialization state */
+ RTK_CHK_INIT_STATE();
+
+ if (type >= LEAKY_END)
+ return RT_ERR_INPUT;
+
+ if(NULL == pEnable)
+ return RT_ERR_NULL_POINTER;
+
+ if (type >= 0 && type <= LEAKY_UNDEF_GARP_2F)
+ {
+ if ((retVal = rtl8367c_getAsicRma(type, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ *pEnable = rmacfg.vlan_leaky;
+
+ }
+ else if (LEAKY_IPMULTICAST == type)
+ {
+ for (port = 0; port <= RTK_PORT_ID_MAX; port++)
+ {
+ if ((retVal = rtl8367c_getAsicIpMulticastVlanLeaky(port, &tmp)) != RT_ERR_OK)
+ return retVal;
+ if (port>0&&(tmp!=*pEnable))
+ return RT_ERR_FAILED;
+ *pEnable = tmp;
+ }
+ }
+ else if (LEAKY_IGMP == type)
+ {
+ if ((retVal = rtl8367c_getAsicIGMPVLANLeaky(&tmp)) != RT_ERR_OK)
+ return retVal;
+
+ *pEnable = tmp;
+ }
+ else if (LEAKY_CDP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaCdp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ *pEnable = rmacfg.vlan_leaky;
+ }
+ else if (LEAKY_CSSTP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaCsstp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ *pEnable = rmacfg.vlan_leaky;
+ }
+ else if (LEAKY_LLDP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaLldp(&tmp, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ *pEnable = rmacfg.vlan_leaky;
+ }
+
+ return RT_ERR_OK;
+}
+
+/* Function Name:
+ * rtk_leaky_portIsolation_set
+ * Description:
+ * Set port isolation leaky.
+ * Input:
+ * type - Packet type for port isolation leaky.
+ * enable - Leaky status.
+ * Output:
+ * None
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * RT_ERR_ENABLE - Invalid enable input
+ * Note:
+ * This API can set port isolation leaky for RMA ,IGMP/MLD, CDP, CSSTP, and LLDP packets.
+ * The leaky frame types are as following:
+ * - LEAKY_BRG_GROUP,
+ * - LEAKY_FD_PAUSE,
+ * - LEAKY_SP_MCAST,
+ * - LEAKY_1X_PAE,
+ * - LEAKY_UNDEF_BRG_04,
+ * - LEAKY_UNDEF_BRG_05,
+ * - LEAKY_UNDEF_BRG_06,
+ * - LEAKY_UNDEF_BRG_07,
+ * - LEAKY_PROVIDER_BRIDGE_GROUP_ADDRESS,
+ * - LEAKY_UNDEF_BRG_09,
+ * - LEAKY_UNDEF_BRG_0A,
+ * - LEAKY_UNDEF_BRG_0B,
+ * - LEAKY_UNDEF_BRG_0C,
+ * - LEAKY_PROVIDER_BRIDGE_GVRP_ADDRESS,
+ * - LEAKY_8021AB,
+ * - LEAKY_UNDEF_BRG_0F,
+ * - LEAKY_BRG_MNGEMENT,
+ * - LEAKY_UNDEFINED_11,
+ * - LEAKY_UNDEFINED_12,
+ * - LEAKY_UNDEFINED_13,
+ * - LEAKY_UNDEFINED_14,
+ * - LEAKY_UNDEFINED_15,
+ * - LEAKY_UNDEFINED_16,
+ * - LEAKY_UNDEFINED_17,
+ * - LEAKY_UNDEFINED_18,
+ * - LEAKY_UNDEFINED_19,
+ * - LEAKY_UNDEFINED_1A,
+ * - LEAKY_UNDEFINED_1B,
+ * - LEAKY_UNDEFINED_1C,
+ * - LEAKY_UNDEFINED_1D,
+ * - LEAKY_UNDEFINED_1E,
+ * - LEAKY_UNDEFINED_1F,
+ * - LEAKY_GMRP,
+ * - LEAKY_GVRP,
+ * - LEAKY_UNDEF_GARP_22,
+ * - LEAKY_UNDEF_GARP_23,
+ * - LEAKY_UNDEF_GARP_24,
+ * - LEAKY_UNDEF_GARP_25,
+ * - LEAKY_UNDEF_GARP_26,
+ * - LEAKY_UNDEF_GARP_27,
+ * - LEAKY_UNDEF_GARP_28,
+ * - LEAKY_UNDEF_GARP_29,
+ * - LEAKY_UNDEF_GARP_2A,
+ * - LEAKY_UNDEF_GARP_2B,
+ * - LEAKY_UNDEF_GARP_2C,
+ * - LEAKY_UNDEF_GARP_2D,
+ * - LEAKY_UNDEF_GARP_2E,
+ * - LEAKY_UNDEF_GARP_2F,
+ * - LEAKY_IGMP,
+ * - LEAKY_IPMULTICAST.
+ * - LEAKY_CDP,
+ * - LEAKY_CSSTP,
+ * - LEAKY_LLDP.
+ */
+rtk_api_ret_t rtk_leaky_portIsolation_set(rtk_leaky_type_t type, rtk_enable_t enable)
+{
+ rtk_api_ret_t retVal;
+ rtk_uint32 port;
+ rtl8367c_rma_t rmacfg;
+ rtk_uint32 tmp;
+
+ /* Check initialization state */
+ RTK_CHK_INIT_STATE();
+
+ if (type >= LEAKY_END)
+ return RT_ERR_INPUT;
+
+ if (enable >= RTK_ENABLE_END)
+ return RT_ERR_INPUT;
+
+ if (type >= 0 && type <= LEAKY_UNDEF_GARP_2F)
+ {
+ if ((retVal = rtl8367c_getAsicRma(type, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ rmacfg.portiso_leaky = enable;
+
+ if ((retVal = rtl8367c_setAsicRma(type, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+ }
+ else if (LEAKY_IPMULTICAST == type)
+ {
+ for (port = 0; port < RTK_MAX_NUM_OF_PORT; port++)
+ {
+ if ((retVal = rtl8367c_setAsicIpMulticastPortIsoLeaky(port,enable)) != RT_ERR_OK)
+ return retVal;
+ }
+ }
+ else if (LEAKY_IGMP == type)
+ {
+ if ((retVal = rtl8367c_setAsicIGMPIsoLeaky(enable)) != RT_ERR_OK)
+ return retVal;
+ }
+ else if (LEAKY_CDP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaCdp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ rmacfg.portiso_leaky = enable;
+
+ if ((retVal = rtl8367c_setAsicRmaCdp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+ }
+ else if (LEAKY_CSSTP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaCsstp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ rmacfg.portiso_leaky = enable;
+
+ if ((retVal = rtl8367c_setAsicRmaCsstp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+ }
+ else if (LEAKY_LLDP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaLldp(&tmp, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ rmacfg.portiso_leaky = enable;
+
+ if ((retVal = rtl8367c_setAsicRmaLldp(tmp, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+ }
+
+ return RT_ERR_OK;
+}
+
+/* Function Name:
+ * rtk_leaky_portIsolation_get
+ * Description:
+ * Get port isolation leaky.
+ * Input:
+ * type - Packet type for port isolation leaky.
+ * Output:
+ * pEnable - Leaky status.
+ * Return:
+ * RT_ERR_OK - OK
+ * RT_ERR_FAILED - Failed
+ * RT_ERR_SMI - SMI access error
+ * RT_ERR_INPUT - Invalid input parameters.
+ * Note:
+ * This API can get port isolation leaky status for RMA ,IGMP/MLD, CDP, CSSTP, and LLDP packets.
+ * The leaky frame types are as following:
+ * - LEAKY_BRG_GROUP,
+ * - LEAKY_FD_PAUSE,
+ * - LEAKY_SP_MCAST,
+ * - LEAKY_1X_PAE,
+ * - LEAKY_UNDEF_BRG_04,
+ * - LEAKY_UNDEF_BRG_05,
+ * - LEAKY_UNDEF_BRG_06,
+ * - LEAKY_UNDEF_BRG_07,
+ * - LEAKY_PROVIDER_BRIDGE_GROUP_ADDRESS,
+ * - LEAKY_UNDEF_BRG_09,
+ * - LEAKY_UNDEF_BRG_0A,
+ * - LEAKY_UNDEF_BRG_0B,
+ * - LEAKY_UNDEF_BRG_0C,
+ * - LEAKY_PROVIDER_BRIDGE_GVRP_ADDRESS,
+ * - LEAKY_8021AB,
+ * - LEAKY_UNDEF_BRG_0F,
+ * - LEAKY_BRG_MNGEMENT,
+ * - LEAKY_UNDEFINED_11,
+ * - LEAKY_UNDEFINED_12,
+ * - LEAKY_UNDEFINED_13,
+ * - LEAKY_UNDEFINED_14,
+ * - LEAKY_UNDEFINED_15,
+ * - LEAKY_UNDEFINED_16,
+ * - LEAKY_UNDEFINED_17,
+ * - LEAKY_UNDEFINED_18,
+ * - LEAKY_UNDEFINED_19,
+ * - LEAKY_UNDEFINED_1A,
+ * - LEAKY_UNDEFINED_1B,
+ * - LEAKY_UNDEFINED_1C,
+ * - LEAKY_UNDEFINED_1D,
+ * - LEAKY_UNDEFINED_1E,
+ * - LEAKY_UNDEFINED_1F,
+ * - LEAKY_GMRP,
+ * - LEAKY_GVRP,
+ * - LEAKY_UNDEF_GARP_22,
+ * - LEAKY_UNDEF_GARP_23,
+ * - LEAKY_UNDEF_GARP_24,
+ * - LEAKY_UNDEF_GARP_25,
+ * - LEAKY_UNDEF_GARP_26,
+ * - LEAKY_UNDEF_GARP_27,
+ * - LEAKY_UNDEF_GARP_28,
+ * - LEAKY_UNDEF_GARP_29,
+ * - LEAKY_UNDEF_GARP_2A,
+ * - LEAKY_UNDEF_GARP_2B,
+ * - LEAKY_UNDEF_GARP_2C,
+ * - LEAKY_UNDEF_GARP_2D,
+ * - LEAKY_UNDEF_GARP_2E,
+ * - LEAKY_UNDEF_GARP_2F,
+ * - LEAKY_IGMP,
+ * - LEAKY_IPMULTICAST.
+ * - LEAKY_CDP,
+ * - LEAKY_CSSTP,
+ * - LEAKY_LLDP.
+ */
+rtk_api_ret_t rtk_leaky_portIsolation_get(rtk_leaky_type_t type, rtk_enable_t *pEnable)
+{
+ rtk_api_ret_t retVal;
+ rtk_uint32 port, tmp;
+ rtl8367c_rma_t rmacfg;
+
+ /* Check initialization state */
+ RTK_CHK_INIT_STATE();
+
+ if (type >= LEAKY_END)
+ return RT_ERR_INPUT;
+
+ if(NULL == pEnable)
+ return RT_ERR_NULL_POINTER;
+
+ if (type >= 0 && type <= LEAKY_UNDEF_GARP_2F)
+ {
+ if ((retVal = rtl8367c_getAsicRma(type, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ *pEnable = rmacfg.portiso_leaky;
+
+ }
+ else if (LEAKY_IPMULTICAST == type)
+ {
+ for (port = 0; port < RTK_MAX_NUM_OF_PORT; port++)
+ {
+ if ((retVal = rtl8367c_getAsicIpMulticastPortIsoLeaky(port, &tmp)) != RT_ERR_OK)
+ return retVal;
+ if (port > 0 &&(tmp != *pEnable))
+ return RT_ERR_FAILED;
+ *pEnable = tmp;
+ }
+ }
+ else if (LEAKY_IGMP == type)
+ {
+ if ((retVal = rtl8367c_getAsicIGMPIsoLeaky(&tmp)) != RT_ERR_OK)
+ return retVal;
+
+ *pEnable = tmp;
+ }
+ else if (LEAKY_CDP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaCdp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ *pEnable = rmacfg.portiso_leaky;
+ }
+ else if (LEAKY_CSSTP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaCsstp(&rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ *pEnable = rmacfg.portiso_leaky;
+ }
+ else if (LEAKY_LLDP == type)
+ {
+ if ((retVal = rtl8367c_getAsicRmaLldp(&tmp, &rmacfg)) != RT_ERR_OK)
+ return retVal;
+
+ *pEnable = rmacfg.portiso_leaky;
+ }
+
+
+ return RT_ERR_OK;
+}