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 * Description: hmac_dfr.c 的结构体在HMAC的头文件 15 * Date: 2021-04-13 16 */ 17 18 #ifndef __HMAC_DFR_H__ 19 #define __HMAC_DFR_H__ 20 21 /***************************************************************************** 22 1 其他头文件包含 23 *****************************************************************************/ 24 #include "hmac_vap.h" 25 26 #ifdef __cplusplus 27 #if __cplusplus 28 extern "C" { 29 #endif 30 #endif 31 32 #undef THIS_FILE_ID 33 #define THIS_FILE_ID OAM_FILE_ID_HMAC_DFR_H 34 35 #define MAX_TID_ERROR_NUM 2 36 37 #ifdef _PRE_WLAN_FEATURE_DFR 38 extern hmac_dfr_info_stru g_dfr_recovery_info; 39 extern hmac_ap_dfr_recovery_info g_dfr_ap_info; 40 #endif 41 42 typedef enum { 43 HMAC_DFR_EVENT_NULL = 0, 44 HMAC_DFR_TID_QUEUE_HALT_SET = 0x0001 << 0, 45 HMAC_DFR_TID_QUEUE_BUSY_SET = 0x0001 << 1, 46 HMAC_DFR_TX_DSCR_QUEUE_HALT_SET = 0x001 << 2, 47 HMAC_DFR_TX_DSCR_QUEUE_FAIL_SET = 0x001 << 3, 48 HMAC_DFR_RX_DSCR_QUEUE_HALT_SET = 0x0001 << 4, 49 HMAC_DFR_RX_DSCR_QUEUE_FAIL_SET = 0x0001 << 5, 50 HMAC_DFR_FRW_QUEUE_HALT_SET = 0x0001 << 6, 51 HMAC_DFR_FRW_QUEUE_FAIL_SET = 0x0001 << 7, 52 HMAC_DFR_MEM_POOL_FAIL_SET = 0x0001 << 8, 53 HMAC_DFR_MEM_POOL_NO_FREE_SET = 0x0001 << 9 54 } hmac_dfr_event_set_enum; 55 56 typedef struct { 57 osal_u16 event_type; /* 上报异常类型 */ 58 osal_u8 tx_dscr_content; /* 上报发送描述符队列异常内容 */ 59 osal_u8 rx_dscr_content; /* 上报接收描述符队列异常内容 */ 60 osal_u8 mempool_content; /* 上报内存池异常内容 */ 61 osal_u8 hmac_dfr_event_reserve; /* 4字节对齐保留 */ 62 /* 上报事件队列队列异常内容,WLAN_FRW_MAX_NUM_CORES定义为1 */ 63 osal_u16 frw_content[WLAN_FRW_MAX_NUM_CORES]; 64 osal_u8 tid_content[MAC_RES_MAX_USER_LIMIT][MAX_TID_ERROR_NUM]; 65 osal_u32 hmac_user_id_info; /* TID的USER_ID的信息 */ 66 } hmac_dfr_event; 67 68 typedef enum { 69 HMAC_DFR_TID_REPORT = 0, 70 HMAC_DFR_TX_REPORT = 1, 71 HMAC_DFR_RX_REPORT = 2, 72 HMAC_DFR_FRW_REPORT = 3, 73 HMAC_DFR_MEM_POOL_REPORT = 4, 74 HMAC_DFR_MAX_NUM = 5, 75 } hmac_dfr_report_enum; 76 77 typedef struct { 78 osal_u32 enqueue_total_cnt; 79 osal_u32 dequeue_total_cnt; 80 osal_u32 queue_fail_cnt; 81 } hmac_dfr_queue_statistics; 82 83 typedef struct { 84 osal_u32 alloc_total_cnt; 85 osal_u32 free_total_cnt; 86 osal_u32 fail_cnt; 87 } hmac_dfr_mempool_statistics; 88 89 /* 查询tid时,返回的结果的信息 */ 90 typedef struct { 91 osal_u32 is_paused; /* TID被暂停调度 */ 92 osal_u32 in_num; /* 进入队列的包的个数 */ 93 osal_u32 out_num; /* 出队列的包的个数 */ 94 osal_u32 dispatch_num; /* 发生tid队列调度的次数 */ 95 } hmac_dfr_tid_report_info; 96 97 /* ccpriv命令设置下来的参数的信息 */ 98 typedef struct { 99 osal_u32 switch_enable; /* 使能的开关 */ 100 osal_u32 timeout; /* 周期性任务的时间 */ 101 osal_u32 cnt_period; /* 上报或者显示打印的周期间隔 */ 102 } period_check_cfg; 103 104 /* ccpriv命令获取信息时的参数信息 */ 105 typedef struct { 106 osal_u32 switch_type; /* 获取哪种类型的信息(TID TX RX FRW等) */ 107 osal_u32 param1; 108 osal_u32 param2; 109 } period_get_param; 110 111 /* 查询时的,tid队列的信息 */ 112 typedef struct { 113 osal_u16 tid_user_id; 114 osal_u16 tid_index; 115 } hmac_dfr_tid_event_info; 116 117 typedef struct { 118 osal_u16 core_id; 119 osal_u16 event_index; 120 } hmac_dfr_frw_info; 121 122 /* 查询用到的结构体 */ 123 typedef struct { 124 osal_u32 event_type; /* 决定查询TID还是FRW等 */ 125 union { 126 osal_u32 tx_dscr_index; 127 osal_u32 rx_dscr_index; 128 osal_u32 mem_pool_index; 129 hmac_dfr_frw_info frw_index; 130 hmac_dfr_tid_event_info tid_content; 131 } hmac_dfr_check_info; 132 } hmac_dfr_info; 133 134 /* 返回到HMAC的查询结果 */ 135 typedef struct { 136 osal_u32 event_type; 137 union { 138 hmac_dfr_queue_statistics tx_dscr_statistics_value; 139 osal_u32 rx_dscr_statistics_value; 140 hmac_dfr_queue_statistics frw_statistics_value; 141 hmac_dfr_tid_report_info tid_content; 142 hmac_dfr_mempool_statistics mem_pool_statistics_value; 143 } hmac_dfr_check_report_value; 144 } hmac_dfr_check_report; 145 146 typedef struct { 147 osal_u8 tid_halt_cur[MAC_RES_MAX_USER_LIMIT][WLAN_TID_MAX_NUM]; 148 osal_u8 tid_busy_cur[MAC_RES_MAX_USER_LIMIT][WLAN_TID_MAX_NUM]; 149 osal_u8 tx_halt_cur[HAL_TX_QUEUE_NUM]; 150 osal_u8 rx_halt_cur[HAL_RX_QUEUE_NUM]; 151 osal_u8 frw_halt_cur[WLAN_FRW_MAX_NUM_CORES][FRW_POST_PRI_NUM]; 152 osal_u8 frw_fail_cur[WLAN_FRW_MAX_NUM_CORES][FRW_POST_PRI_NUM]; 153 osal_u8 mem_fail_cur[OAL_MEM_POOL_ID_BUTT]; 154 osal_u8 mem_no_free_cur[OAL_MEM_POOL_ID_BUTT]; 155 osal_u16 hmac_dfr_reserve; /* 4字节对齐保留 */ 156 } hmac_dfr_error_time; 157 158 typedef struct { 159 osal_u32 module_set; 160 osal_void (*check_exception_func)(hmac_vap_stru *hmac_vap, hmac_dfr_event *dfr_event); 161 } hmac_dfr_check_module_exception_stru; 162 163 typedef struct { 164 osal_u32 module_set; 165 osal_u32 (*query_module_func)(const hmac_dfr_info *index_info, hmac_dfr_check_report *check_info); 166 } hmac_dfr_query_module_statistics_stru; 167 168 #ifdef _PRE_WLAN_FEATURE_DFR 169 osal_void hmac_dfr_fill_ap_recovery_info(osal_u16 cfg_id, void *data, hmac_vap_stru *hmac_vap); 170 osal_u8 hmac_dfr_get_recovery_flag(osal_void); 171 #endif 172 osal_void hmac_dfr_record_ap_follow_channel(osal_u8 channel, wlan_channel_bandwidth_enum_uint8 bandwidth); 173 osal_u8 hmac_dfr_get_reset_process_flag(osal_void); 174 175 osal_s32 hmac_get_check_info(hmac_vap_stru *hmac_vap, frw_msg *msg); 176 osal_s32 hmac_config_set_period_task(hmac_vap_stru *hmac_vap, frw_msg *msg); 177 #ifdef _PRE_WLAN_DFR_STAT 178 osal_s32 hmac_get_dfr_info(hmac_vap_stru *hmac_vap, frw_msg *msg); 179 #endif 180 181 #ifdef __cplusplus 182 #if __cplusplus 183 } 184 #endif 185 #endif 186 187 #endif /* end of hmac_dft.h */ 188