/* * Copyright (C) 2013 Realtek Semiconductor Corp. * All Rights Reserved. * * This program is the proprietary software of Realtek Semiconductor * Corporation and/or its licensors, and only be used, duplicated, * modified or distributed under the authorized license from Realtek. * * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. * * $Revision$ * $Date$ * * Purpose : RTK switch high-level API for RTL8367/RTL8367C * Feature : Here is a list of all functions and variables in MIB module. * */ #include #include #include #include #include #define MIB_NOT_SUPPORT (0xFFFF) /* Function Name: * rtk_stat_global_reset * Description: * Reset global MIB counter. * Input: * None * Output: * None * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_SMI - SMI access error * Note: * Reset MIB counter of ports. API will use global reset while port mask is all-ports. */ rtk_api_ret_t rtk_stat_global_reset(void) { rtk_api_ret_t retVal; if (NULL == RT_MAPPER->stat_global_reset) return RT_ERR_DRIVER_NOT_FOUND; RTK_API_LOCK(); retVal = RT_MAPPER->stat_global_reset(); RTK_API_UNLOCK(); return retVal; } /* Function Name: * rtk_stat_port_reset * Description: * Reset per port MIB counter by port. * Input: * port - port id. * Output: * None * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_SMI - SMI access error * Note: * */ rtk_api_ret_t rtk_stat_port_reset(rtk_port_t port) { rtk_api_ret_t retVal; if (NULL == RT_MAPPER->stat_port_reset) return RT_ERR_DRIVER_NOT_FOUND; RTK_API_LOCK(); retVal = RT_MAPPER->stat_port_reset(port); RTK_API_UNLOCK(); return retVal; } /* Function Name: * rtk_stat_port_get * Description: * Get per port MIB counter by index * Input: * port - port id. * cntr_idx - port counter index. * Output: * pCntr - MIB retrived counter. * Return: * RT_ERR_OK - OK * RT_ERR_FAILED - Failed * RT_ERR_SMI - SMI access error * Note: * Get per port MIB counter by index definition. */ rtk_api_ret_t rtk_stat_port_get(rtk_port_t port, rtk_stat_port_type_t cntr_idx, rtk_stat_counter_t *pCntr) { rtk_api_ret_t retVal; if (NULL == RT_MAPPER->stat_port_get) return RT_ERR_DRIVER_NOT_FOUND; RTK_API_LOCK(); retVal = RT_MAPPER->stat_port_get(port, cntr_idx, pCntr); RTK_API_UNLOCK(); return retVal; } /* Function Name: * rtk_stat_lengthMode_set * Description: * Set Legnth mode. * Input: * txMode - The length counting mode * rxMode - The length counting mode * Output: * None. * Return: * RT_ERR_OK - OK * RT_ERR_INPUT - Out of range. * RT_ERR_FAILED - Failed * RT_ERR_SMI - SMI access error * Note: * */ rtk_api_ret_t rtk_stat_lengthMode_set(rtk_stat_lengthMode_t txMode, rtk_stat_lengthMode_t rxMode) { rtk_api_ret_t retVal; if (NULL == RT_MAPPER->stat_lengthMode_set) return RT_ERR_DRIVER_NOT_FOUND; RTK_API_LOCK(); retVal = RT_MAPPER->stat_lengthMode_set(txMode, rxMode); RTK_API_UNLOCK(); return retVal; } /* Function Name: * rtk_stat_lengthMode_get * Description: * Get Legnth mode. * Input: * None. * Output: * pTxMode - The length counting mode * pRxMode - The length counting mode * Return: * RT_ERR_OK - OK * RT_ERR_INPUT - Out of range. * RT_ERR_FAILED - Failed * RT_ERR_SMI - SMI access error * Note: */ rtk_api_ret_t rtk_stat_lengthMode_get(rtk_stat_lengthMode_t *pTxMode, rtk_stat_lengthMode_t *pRxMode) { rtk_api_ret_t retVal; if (NULL == RT_MAPPER->stat_lengthMode_get) return RT_ERR_DRIVER_NOT_FOUND; RTK_API_LOCK(); retVal = RT_MAPPER->stat_lengthMode_get(pTxMode, pRxMode); RTK_API_UNLOCK(); return retVal; }