1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 文 件 名 : hmac_car.h 15 * 生成日期 : 2017年03月24日 16 * 功能描述 : 限速CAR(Committed Access Rate)功能 17 */ 18 19 20 #ifndef __HMAC_CAR_H__ 21 #define __HMAC_CAR_H__ 22 23 /***************************************************************************** 24 1 其他头文件包含 25 *****************************************************************************/ 26 #include "oal_ext_if.h" 27 #include "frw_ext_if.h" 28 #include "hmac_device.h" 29 30 #ifdef __cplusplus 31 #if __cplusplus 32 extern "C" { 33 #endif 34 #endif 35 36 #undef THIS_FILE_ID 37 #define THIS_FILE_ID OAM_FILE_ID_HMAC_CAR_H 38 /***************************************************************************** 39 2 宏定义 40 *****************************************************************************/ 41 #define HMAC_CAR_CYCLE_MS 100 // CAR默认定时器超时时间ms 42 #define HMAC_CAR_WIFI_ETH 20 // 上行需要减20个字节;wifi 34(26+8), eth 14(6+6+2); wifi-eth;用eth统计 43 #define HMAC_CAR_MULTICAST_PPS_NUM 0 // CAR组播默认pps的数目:0表示不使用pps限速,>0表示用pps限速的数值 44 45 46 /* 遍历VAP/USER操作封装 */ 47 #define hmac_device_foreach_vap(_hmac_vap, _pst_device, _uc_vap_index) \ 48 for ((_uc_vap_index) = 0, \ 49 (_hmac_vap) = ((_pst_device)->vap_num > 0)? \ 50 ((hmac_vap_stru *)mac_res_get_hmac_vap((_pst_device)->vap_id[0])) : OAL_PTR_NULL; \ 51 (_uc_vap_index) < (_pst_device)->vap_num; \ 52 (_uc_vap_index) ++, \ 53 (_hmac_vap) = ((_uc_vap_index) < (_pst_device)->vap_num)? \ 54 ((hmac_vap_stru *)mac_res_get_hmac_vap((_pst_device)->vap_id[_uc_vap_index])) : OAL_PTR_NULL) \ 55 if (OAL_PTR_NULL != (_hmac_vap)) 56 57 #define hmac_vap_foreach_user(_pst_user, _hmac_vap, _pst_list_pos) \ 58 for ((_pst_list_pos) = (_hmac_vap)->mac_user_list_head.next, \ 59 (_pst_user) = osal_list_entry((_pst_list_pos), hmac_user_stru, user_dlist); \ 60 (_pst_list_pos) != &((_hmac_vap)->mac_user_list_head); \ 61 (_pst_list_pos) = (_pst_list_pos)->next, \ 62 (_pst_user) = osal_list_entry((_pst_list_pos), hmac_user_stru, user_dlist)) \ 63 if (OAL_PTR_NULL != (_pst_user)) 64 65 /***************************************************************************** 66 3 枚举定义 67 *****************************************************************************/ 68 69 70 /***************************************************************************** 71 4 全局变量声明 72 *****************************************************************************/ 73 74 75 /***************************************************************************** 76 5 消息头定义 77 *****************************************************************************/ 78 79 80 /***************************************************************************** 81 6 消息定义 82 *****************************************************************************/ 83 84 85 /***************************************************************************** 86 7 STRUCT定义 87 *****************************************************************************/ 88 89 90 /***************************************************************************** 91 8 UNION定义 92 *****************************************************************************/ 93 94 /***************************************************************************** 95 9 OTHERS定义 96 *****************************************************************************/ 97 98 99 /***************************************************************************** 100 10 函数声明 101 *****************************************************************************/ 102 103 extern osal_u32 hmac_car_device_bw_limit(hmac_device_stru *hmac_device, mac_cfg_car_stru *car_cfg_param); 104 105 extern osal_u32 hmac_car_vap_bw_limit(hmac_vap_stru *hmac_vap, mac_cfg_car_stru *car_cfg_param); 106 extern osal_u32 hmac_car_user_bw_limit(hmac_vap_stru *hmac_vap, mac_cfg_car_stru *car_cfg_param); 107 extern osal_u32 hmac_car_device_multicast(hmac_device_stru *hmac_device, mac_cfg_car_stru *car_cfg_param); 108 extern osal_u32 hmac_car_device_timer_cycle_limit(hmac_device_stru *hmac_device, 109 mac_cfg_car_stru *car_cfg_param); 110 extern osal_u32 hmac_car_process(hmac_device_stru *hmac_device, hmac_vap_stru *hmac_vap, 111 hmac_user_stru *hmac_user, oal_netbuf_stru *buf, 112 hmac_car_up_down_type_enum_uint8 car_type); 113 extern osal_u32 hmac_car_process_uplink(osal_u16 ta_user_idx, hmac_vap_stru *hmac_vap, 114 oal_netbuf_stru *buf, hmac_car_up_down_type_enum_uint8 car_type); 115 extern osal_u32 hmac_car_enable_switch(hmac_device_stru *hmac_device, mac_cfg_car_stru *car_cfg_param); 116 extern osal_u32 hmac_car_show_info(hmac_device_stru *hmac_device); 117 extern osal_u32 hmac_car_multicast_process(hmac_device_stru *hmac_device, oal_netbuf_stru *buf); 118 extern osal_u32 hmac_car_device_multicast_pps_num(hmac_device_stru *hmac_device, 119 mac_cfg_car_stru *car_cfg_param); 120 extern osal_u32 hmac_car_init(hmac_device_stru *hmac_device); 121 extern osal_u32 hmac_car_exit(hmac_device_stru *hmac_device); 122 123 #ifdef __cplusplus 124 #if __cplusplus 125 } 126 #endif 127 #endif 128 129 #endif 130