1 /*
2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #ifndef __DMAC_EXT_IF_H__
20 #define __DMAC_EXT_IF_H__
21 /* ****************************************************************************
22 1 其他头文件包含
23 **************************************************************************** */
24 #include "mac_device.h"
25 #include "frw_event.h"
26 #include "hcc_comm.h"
27
28 #ifdef __cplusplus
29 #if __cplusplus
30 extern "C" {
31 #endif
32 #endif
33
34 /* ****************************************************************************
35 2 宏定义
36 **************************************************************************** */
37 #define DMAC_UCAST_TX_COMP_TIMES 5 /* 建立BA会话前,需要产生单播帧的发送完成中断 */
38
39 #define DMAC_BA_SEQNO_MASK 0x0FFF /* max sequence number */
40 #define DMAC_BA_MAX_SEQNO_BY_TWO 2048
41 #define DMAC_BA_GREATER_THAN_SEQHI 1
42 #define DMAC_BA_BETWEEN_SEQLO_SEQHI 2
43 #define DMAC_BA_BMP_SIZE 64
44 #define dmac_ba_seq_add(_seq1, _seq2) (((_seq1) + (_seq2)) & DMAC_BA_SEQNO_MASK)
45 #define dmac_ba_seq_sub(_seq1, _seq2) (((_seq1) - (_seq2)) & DMAC_BA_SEQNO_MASK)
46 #define dmac_ba_seqno_add(_seq1, _seq2) (((_seq1) + (_seq2)) & DMAC_BA_SEQNO_MASK)
47 #define dmac_ba_seqno_sub(_seq1, _seq2) (((_seq1) - (_seq2)) & DMAC_BA_SEQNO_MASK)
48
49 #define DMAC_INVALID_BA_LUT_INDEX HAL_MAX_BA_LUT_SIZE
50 #define DMAC_TID_MAX_BUFS 128 /* 发送BA窗口记录seq number的最大个数,必须是2的整数次幂 */
51 #define DMAC_TX_BUF_BITMAP_WORD_SIZE 32 /* 发送BA窗口记录seq number的bitmap所使用的类型长度 */
52 /* 发送BA窗口记录seq number的bit map的长度 */
53 #define DMAC_TX_BUF_BITMAP_WORDS \
54 ((DMAC_TID_MAX_BUFS + DMAC_TX_BUF_BITMAP_WORD_SIZE - 1) / DMAC_TX_BUF_BITMAP_WORD_SIZE)
55 #define DMAC_WPA_802_11I BIT0 /* 安全加密 : bss_info 中记录AP 能力标识, WPA or WPA2 */
56 #define DMAC_RSNA_802_11I BIT1
57
58 #define DMAC_TX_MAX_RISF_NUM 6
59 #define DMAC_TX_QUEUE_AGGR_DEPTH 2
60 #define DMAX_TX_QUEUE_SINGLE_DEPTH 2
61 #define DMAC_TX_QEUEU_MAX_PPDU_NUM 2
62 #define DMAC_TX_QUEUE_UAPSD_DEPTH 5
63 #define DMAC_TX_QUEUE_FAIL_CHECK_NUM 1000
64 #define DMAC_PA_ERROR_OFFSET 3
65 /* ****************************************************************************
66 3 枚举定义
67 **************************************************************************** */
68 /* ****************************************************************************
69 枚举说明: DMAC模块ROM化预留回调接口类型定义
70 **************************************************************************** */
71 typedef enum {
72 DMAC_ROM_RESV_FUNC_FCS_START,
73 DMAC_ROM_RESV_FUNC_RX_FILTER_AP,
74 DMAC_ROM_RESV_FUNC_RX_FILTER_STA,
75 DMAC_ROM_RESV_FUNC_RX_PROCESS_CONTROL,
76 DMAC_ROM_RESV_FUNC_STA_UP_RX_BEACON,
77 DMAC_ROM_RESV_FUNC_SCAN_MGMT_FILER,
78 DMAC_ROM_RESV_FUNC_AP_UP_RX_OBSS_BEACON,
79 DMAC_ROM_RESV_FUNC_AP_UP_RX_PROBE_REQ,
80 DMAC_ROM_RESV_FUNC_MESH_CHECK_UNICAST_REPORT,
81 DMAC_ROM_RESV_FUNC_MAC_MBCA_IE,
82 DMAC_ROM_RESV_FUNC_TX_DEL_BA,
83 DMAC_ROM_RESV_FUNC_HANDLE_CHAN_MGMT_STA,
84 DMAC_ROM_RESV_FUNC_CHAN_SWITCH_SYNC,
85 DMAC_ROM_RESV_FUNC_PSM_ALARM_CALLBACK,
86 DMAC_ROM_RESV_FUNC_BCN_RX_ADJUST,
87 DMAC_ROM_RESV_FUNC_TBTT_EVENT_HANDLE,
88 DMAC_ROM_RESV_FUNC_BUTT
89 } dmac_rom_resv_func_enum;
90 typedef hi_u8 dmac_rom_resv_func_enum_uint8;
91 /* ****************************************************************************
92 枚举说明: HOST DRX事件子类型定义
93 **************************************************************************** */
94 typedef enum {
95 DMAC_TX_HOST_DRX = 0,
96
97 DMAC_TX_HOST_DRX_BUTT
98 } dmac_tx_host_drx_subtype_enum;
99 typedef hi_u8 dmac_tx_host_drx_subtype_enum_uint8;
100
101 /* ****************************************************************************
102 枚举说明: WLAN DTX事件子类型定义
103 **************************************************************************** */
104 typedef enum {
105 DMAC_TX_WLAN_DTX = 0,
106
107 DMAC_TX_WLAN_DTX_BUTT
108 } dmac_tx_wlan_dtx_subtype_enum;
109 typedef hi_u8 dmac_tx_wlan_dtx_subtype_enum_uint8;
110
111 /* ****************************************************************************
112 枚举说明: WLAN CTX事件子类型定义
113 **************************************************************************** */
114 typedef enum {
115 DMAC_WLAN_CTX_EVENT_SUB_TYPE_ACTION = 0,
116 DMAC_WLAN_CTX_EVENT_SUB_TYPE_ADD_USER,
117 DMAC_WLAN_CTX_EVENT_SUB_TYPE_NOTIFY_ALG_ADD_USER,
118 DMAC_WLAN_CTX_EVENT_SUB_TYPE_DEL_USER,
119 DMAC_WLAN_CTX_EVENT_SUB_TYPE_BA_SYNC, /* 收到wlan的Delba和addba rsp用于到dmac的同步 */
120 DMAC_WLAN_CTX_EVENT_SUB_TYPE_PRIV_REQ, /* 11N自定义的请求的事件类型 */
121 DMAC_WLAN_CTX_EVENT_SUB_TYPE_SCAN_REQ, /* 扫描请求 */
122 DMAC_WLAN_CTX_EVENT_SUB_TYPE_SCHED_SCAN_REQ, /* PNO调度扫描请求 */
123 DMAC_WLAN_CTX_EVENT_SUB_TYPE_MGMT, /* 管理帧处理 */
124 DMAC_WLAN_CTX_EVENT_SUB_TYPE_RESET_PSM, /* 收到认证请求 关联请求,复位用户的节能状态 */
125 DMAC_WLAN_CTX_EVENT_SUB_TYPE_JOIN_SET_REG,
126 DMAC_WLAN_CTX_EVENT_SUB_TYPE_JOIN_DTIM_TSF_REG,
127 DMAC_WLAN_CTX_EVENT_SUB_TYPE_CONN_RESULT, /* 关联结果 */
128 DMAC_WLAN_CTX_EVENT_SUB_TYPE_STA_SET_EDCA_REG, /* STA收到beacon和assoc rsp时,更新EDCA寄存器 */
129 DMAC_WLAN_CTX_EVENT_SUB_TYPE_SWITCH_TO_NEW_CHAN, /* 切换至新信道事件 */
130 DMAC_WALN_CTX_EVENT_SUB_TYPR_SELECT_CHAN, /* 设置信道事件 */
131 DMAC_WALN_CTX_EVENT_SUB_TYPR_DISABLE_TX, /* 禁止硬件发送 */
132 DMAC_WALN_CTX_EVENT_SUB_TYPR_ENABLE_TX, /* 恢复硬件发送 */
133 DMAC_WLAN_CTX_EVENT_SUB_TYPR_RESTART_NETWORK, /* 切换信道后,恢复BSS的运行 */
134 #ifdef _PRE_WLAN_FEATURE_OPMODE_NOTIFY
135 DMAC_WLAN_CTX_EVENT_SUB_TYPE_PSM_OPMODE_NOTIFY, /* AP侧opmode notify帧时判断节能信息 */
136 #endif
137 DMAC_WLAN_CTX_EVENT_SUB_TYPE_SET_RX_FILTER,
138 #ifdef _PRE_WLAN_FEATURE_EDCA_OPT_AP
139 DMAC_WLAN_CTX_EVENT_SUB_TYPR_EDCA_OPT, /* edca优化中业务识别通知事件 */
140 #endif
141 #ifdef _PRE_WLAN_RF_110X_CALI_DPD
142 DMAC_WLAN_CTX_EVENT_SUB_TYPE_DPD_DATA_PROCESSED,
143 #endif
144 DMAC_WLAN_CTX_EVENT_SUB_TYPE_CALI_HMAC2DMAC,
145 #ifdef _PRE_WLAN_FEATURE_PKT_MEM_OPT
146 DMAC_WLAN_CTX_EVENT_SUB_TYPE_DSCR_OPT,
147 #endif
148 #ifdef _PRE_WLAN_FEATURE_MESH
149 DMAC_WLAN_CTX_EVENT_SUB_TYPE_SET_MESH_USER_WHITELIST, /* 设置Mesh用户白名单接收指定的组播/广播数据帧 */
150 DMAC_WLAN_CTX_EVENT_SUB_TYPE_UNSET_MESH_USER_WHITELIST, /* 删除Mesh用户白名单中的某个地址 */
151 #endif
152 DMAC_WLAN_CTX_EVENT_SUB_TYPE_CONN_FAIL_SET_CHANNEL, /* 用于共存时关联失败恢复ap信道参数 */
153
154 DMAC_WLAN_CTX_EVENT_SUB_TYPE_BUTT
155 } dmac_wlan_ctx_event_sub_type_enum;
156 typedef hi_u8 dmac_wlan_ctx_event_sub_type_enum_uint8;
157
158 /* DMAC模块 WLAN_DRX子类型定义 */
159 typedef enum {
160 DMAC_WLAN_DRX_EVENT_SUB_TYPE_RX_AP, /* AP模式: DMAC WLAN DRX 流程 */
161 DMAC_WLAN_DRX_EVENT_SUB_TYPE_RX_STA, /* STA模式: DMAC WLAN DRX 流程 */
162 DMAC_WLAN_DRX_EVENT_SUB_TYPE_TKIP_MIC_FAILE, /* DMAC tkip mic faile 上报给HMAC */
163
164 DMAC_WLAN_DRX_EVENT_SUB_TYPE_BUTT
165 } dmac_wlan_drx_event_sub_type_enum;
166 typedef hi_u8 dmac_wlan_drx_event_sub_type_enum_uint8;
167
168 /* DMAC模块 WLAN_CRX子类型定义 */
169 typedef enum {
170 DMAC_WLAN_CRX_INIT, /* DMAC 给 HMAC的初始化参数 */
171 DMAC_WLAN_CRX_RX, /* DMAC WLAN CRX 流程 */
172 DMAC_WLAN_CRX_DELBA, /* DMAC自身产生的DELBA帧 */
173 DMAC_WLAN_CRX_SCAN_RESULT, /* 扫描到一个bss信息,上报结果 */
174 DMAC_WLAN_CRX_SCAN_COMP, /* DMAC扫描完成上报给HMAC */
175 DMAC_WLAN_CRX_OBSS_SCAN_COMP, /* DMAC OBSS扫描上报HMAC */
176 DMAC_WLAN_CRX_ACS_RESP, /* ACS */
177 #ifdef _PRE_WLAN_FEATURE_FLOWCTL
178 DMAC_WLAN_CRX_FLOWCTL_BACKP, /* dmac向hmac发送流控制反压信息 */
179 #endif
180 DMAC_WLAN_CRX_DISASSOC, /* DMAC上报去关联事件到HMAC, HMAC会删除用户 */
181 DMAC_WLAN_CRX_DEAUTH, /* DMAC上报去认证事件到HMAC */
182 DMAC_WLAN_CRX_CH_SWITCH_COMPLETE, /* 信道切换完成事件 */
183 DMAC_WLAN_CRX_DBAC, /* DBAC enable/disable事件 */
184 #ifdef _PRE_WLAN_RF_110X_CALI_DPD
185 DMAC_WLAN_CRX_DPD_DATA_SEND,
186 #endif
187 #ifdef _PRE_WLAN_FEATURE_WOW_ROM
188 DMAC_WLAN_CRX_DEV_SYNC_HOST,
189 #endif
190 DMAC_WLAN_CRX_SLEEP_REQ,
191 #ifdef _PRE_WLAN_FEATURE_CSI
192 DMAC_WLAN_CRX_CSI_REPORT, /* DMAC采集CSI数据抛事件给HMAC */
193 #endif
194 #ifdef _PRE_WLAN_FEATURE_MESH_ROM
195 DMAC_WLAN_CRX_NEW_PEER_REPORT, /* DMAC上报new peer beacon帧 */
196 #endif
197 #ifdef _PRE_WLAN_FEATURE_PROMIS
198 DMAC_WLAN_CRX_EVENT_PROMIS,
199 #endif
200 DMAC_WLAN_CRX_SUB_TYPE_BUTT
201 } dmac_wlan_crx_event_sub_type_enum;
202 typedef hi_u8 dmac_wlan_crx_event_sub_type_enum_uint8;
203
204 /* 发向HOST侧的配置事件 */
205 typedef enum {
206 DMAC_TO_HMAC_CREATE_BA,
207 DMAC_TO_HMAC_DEL_BA,
208 DMAC_TO_HMAC_SYN_CFG,
209 DMAC_TO_HMAC_ALG_INFO_SYN,
210 DMAC_TO_HMAC_VOICE_AGGR,
211 DMAC_TO_HMAC_PROTECTION_INFO_SYN,
212
213 DMAC_TO_HMAC_SYN_BUTT
214 } dmac_to_hmac_syn_type_enum;
215
216 /* MISC杂散事件 */
217 typedef enum {
218 DMAC_MISC_SUB_TYPE_DISASOC,
219 #ifdef _PRE_WLAN_FEATURE_WOW
220 DMAC_MISC_SUB_TYPE_DEV_READY_FOR_HOST_SLP,
221 #endif
222 DMAC_MISC_SUB_TYPE_BUTT
223 } dmac_misc_sub_type_enum;
224
225 typedef enum {
226 WAIT_ADD,
227 DMAC_HCC_RX_EVENT_SUB_TYPE_BUTT
228 } dmac_hcc_rx_event_sub_type_enum;
229
230 typedef enum {
231 DMAC_DISASOC_MISC_LINKLOSS = 0,
232 DMAC_DISASOC_MISC_KEEPALIVE = 1,
233 DMAC_DISASOC_MISC_CHANNEL_MISMATCH = 2,
234 DMAC_DISASOC_MISC_WOW_RX_DISASSOC = 3,
235 DMAC_DISASOC_MISC_WOW_RX_DEAUTH = 4,
236 DMAC_DISASOC_MISC_KICKUSER = 5,
237 DMAC_DISASOC_ROAM_HANDLE_FAIL = 6,
238 DMAC_DISASOC_SA_QUERY_DEL_USER = 7,
239
240 DMAC_DISASOC_MISC_BUTT
241 } dmac_disasoc_misc_reason_enum;
242 typedef hi_u16 dmac_disasoc_misc_reason_enum_uint16;
243
244 /* HMAC to DMAC同步类型 */
245 typedef enum {
246 HMAC_TO_DMAC_SYN_INIT,
247 HMAC_TO_DMAC_SYN_CREATE_CFG_VAP,
248 HMAC_TO_DMAC_SYN_CFG,
249 HMAC_TO_DMAC_SYN_ALG,
250
251 HMAC_TO_DMAC_SYN_BUTT
252 } hmac_to_dmac_syn_type_enum;
253 typedef hi_u8 hmac_to_dmac_syn_type_enum_uint8;
254
255 /* TXRX函数回调出参定义 */
256 typedef enum {
257 DMAC_TXRX_PASS = 0, /* 继续往下 */
258 DMAC_TXRX_DROP = 1, /* 需要丢包 */
259 DMAC_TXRX_SENT = 2, /* 已被发送 */
260 DMAC_TXRX_BUFF = 3, /* 已被缓存 */
261
262 DMAC_TXRX_BUTT
263 } dmac_txrx_output_type_enum;
264 typedef hi_u8 dmac_txrx_output_type_enum_uint8;
265
266 /* 天线训练状态 */
267 typedef enum {
268 DMAC_USER_SMARTANT_NON_TRAINING = 0,
269 DMAC_USER_SMARTANT_NULLDATA_TRAINING = 1,
270 DMAC_USER_SMARTANT_DATA_TRAINING = 2,
271
272 DMAC_USER_SMARTANT_TRAINING_BUTT
273 } dmac_user_smartant_training_enum;
274 typedef hi_u8 dmac_user_smartant_training_enum_uint8;
275
276 /* 算法的报文探测标志 (注:对于1102该枚举只允许使用3bit空间, 因此有效枚举值最大为7) */
277 typedef enum {
278 DMAC_USER_ALG_NON_PROBE = 0, /* 非探测报文 */
279 DMAC_USER_ALG_TXBF_SOUNDING = 1, /* TxBf sounding报文 */
280 DMAC_USER_ALG_AUOTRATE_PROBE = 2, /* Autorate探测报文 */
281 DMAC_USER_ALG_AGGR_PROBE = 3, /* 聚合探测报文 */
282 DMAC_USER_ALG_TPC_PROBE = 4, /* TPC探测报文 */
283 DMAC_USER_ALG_TX_MODE_PROBE = 5, /* 发送模式探测报文(TxBf, STBC, Chain) */
284 DMAC_USER_ALG_SMARTANT_NULLDATA_PROBE = 6, /* 智能天线NullData训练报文 */
285 DMAC_USER_ALG_SMARTANT_DATA_PROBE = 7, /* 智能天线Data训练报文 */
286
287 DMAC_USER_ALG_PROBE_BUTT
288 } dmac_user_alg_probe_enum;
289 typedef hi_u8 dmac_user_alg_probe_enum_uint8;
290
291 /* BA会话的状态枚举 */
292 typedef enum {
293 DMAC_BA_INIT = 0, /* BA会话未建立 */
294 DMAC_BA_INPROGRESS, /* BA会话建立过程中 */
295 DMAC_BA_COMPLETE, /* BA会话建立完成 */
296 DMAC_BA_HALTED, /* BA会话节能暂停 */
297 DMAC_BA_FAILED, /* BA会话建立失败 */
298
299 DMAC_BA_BUTT
300 } dmac_ba_conn_status_enum;
301 typedef hi_u8 dmac_ba_conn_status_enum_uint8;
302
303 /* Type of Tx Descriptor status */
304 typedef enum {
305 DMAC_TX_INVALID = 0, /* 无效 */
306 DMAC_TX_SUCC, /* 成功 */
307 DMAC_TX_FAIL, /* 发送失败(超过重传限制:接收响应帧超时) */
308 DMAC_TX_TIMEOUT, /* lifetime超时(没法送出去) */
309 DMAC_TX_RTS_FAIL, /* RTS 发送失败(超出重传限制:接收cts超时) */
310 DMAC_TX_NOT_COMPRASS_BA, /* 收到的BA是非压缩块确认 */
311 DMAC_TX_TID_MISMATCH, /* 收到的BA中TID与发送时填写在描述符中的TID不一致 */
312 DMAC_TX_KEY_SEARCH_FAIL, /* Key search failed */
313 DMAC_TX_AMPDU_MISMATCH, /* 描述符异常 */
314 DMAC_TX_PENDING, /* tx pending:mac发送过该帧,但是没有成功,等待重传 */
315 DMAC_TX_FAIL_ACK_ERROR, /* 发送失败(超过重传限制:接收到的响应帧错误) */
316 DMAC_TX_RTS_FAIL_CTS_ERROR, /* RTS发送失败(超出重传限制:接收到的CTS错误) */
317 DMAC_TX_FAIL_ABORT, /* 发送失败(因为abort) */
318 DMAC_TX_FAIL_STATEMACHINE_PHY_ERROR, /* MAC发送该帧异常结束(状态机超时、phy提前结束等原因) */
319 DMAC_TX_SOFT_PSM_BACK, /* 软件节能回退 */
320 DMAC_TX_SOFT_RESERVE, /* reserved */
321 } dmac_tx_dscr_status_enum;
322 typedef hi_u8 dmac_tx_dscr_status_enum_uint8;
323
324 typedef enum {
325 DMAC_TX_MODE_NORMAL = 0,
326 DMAC_TX_MODE_RIFS = 1,
327 DMAC_TX_MODE_AGGR = 2,
328 DMAC_TX_MODE_BUTT
329 } dmac_tx_mode_enum;
330 typedef hi_u8 dmac_tx_mode_enum_uint8;
331
332 /* mib index定义 */
333 typedef enum {
334 WLAN_MIB_INDEX_LSIG_TXOP_PROTECTION_OPTION_IMPLEMENTED,
335 WLAN_MIB_INDEX_HT_GREENFIELD_OPTION_IMPLEMENTED,
336 WLAN_MIB_INDEX_SPEC_MGMT_IMPLEMENT,
337 WLAN_MIB_INDEX_FORTY_MHZ_OPERN_IMPLEMENT,
338 WLAN_MIB_INDEX_2040_COEXT_MGMT_SUPPORT,
339 WLAN_MIB_INDEX_FORTY_MHZ_INTOL,
340 WLAN_MIB_INDEX_VHT_CHAN_WIDTH_OPTION_IMPLEMENT,
341 WLAN_MIB_INDEX_MINIMUM_MPDU_STARTING_SPACING,
342
343 WLAN_MIB_INDEX_OBSSSCAN_TRIGGER_INTERVAL, /* 8 */
344 WLAN_MIB_INDEX_OBSSSCAN_TRANSITION_DELAY_FACTOR,
345 WLAN_MIB_INDEX_OBSSSCAN_PASSIVE_DWELL,
346 WLAN_MIB_INDEX_OBSSSCAN_ACTIVE_DWELL,
347 WLAN_MIB_INDEX_OBSSSCAN_PASSIVE_TOTAL_PER_CHANNEL,
348 WLAN_MIB_INDEX_OBSSSCAN_ACTIVE_TOTAL_PER_CHANNEL,
349 WLAN_MIB_INDEX_OBSSSCAN_ACTIVITY_THRESHOLD, /* 14 */
350
351 #ifdef _PRE_WLAN_FEATURE_MESH_ROM
352 WLAN_MIB_INDEX_MESH_ACCEPTING_PEER,
353 WLAN_MIB_INDEX_MESH_SECURITY_ACTIVATED,
354 #endif
355 WLAN_MIB_INDEX_BUTT
356 } wlan_mib_index_enum;
357 typedef hi_u16 wlan_mib_index_enum_uint16;
358
359 typedef enum {
360 DMAC_TID_PAUSE_RESUME_TYPE_BA = 0,
361 DMAC_TID_PAUSE_RESUME_TYPE_PS = 1,
362 DMAC_TID_PAUSE_RESUME_TYPE_BUTT
363 } dmac_tid_pause_type_enum;
364 typedef hi_u8 dmac_tid_pause_type_enum_uint8;
365
366 /* ****************************************************************************
367 7 STRUCT定义
368 **************************************************************************** */
369 typedef struct {
370 dmac_disasoc_misc_reason_enum_uint16 disasoc_reason;
371 hi_u8 user_idx;
372 hi_u8 uc_resv;
373 } dmac_disasoc_misc_stru;
374
375 /* 接收帧的统计信息 */
376 typedef struct {
377 hi_u32 total_num; /* 总数 */
378 hi_u32 self_fcs_correct; /* 发给自己的FCS正确的单播帧 */
379 hi_u32 other_fcs_correct; /* 不是发给自己的FCS正确的单播帧 */
380 hi_u32 total_fcs_error; /* FCS错误的所有帧 */
381 } dmac_rx_fcs_statistic;
382
383 typedef struct {
384 hi_u8 tid_num; /* 需要发送的tid队列号 */
385 dmac_tx_mode_enum_uint8 tx_mode; /* 调度tid的发送模式 */
386 hi_u8 mpdu_num[DMAC_TX_QUEUE_AGGR_DEPTH]; /* 调度得到的需要发送的mpdu个数 */
387 hi_u8 user_idx; /* 要发送的tid队列隶属的user */
388 hi_u8 ba_is_jamed; /* 当前BA窗是否卡死的标志位 */
389 hi_u8 uc_resv[2]; /* 2 byte保留字段 */
390 } mac_tid_schedule_output_stru;
391
392 /* DMAC与HMAC模块共用的WLAN DRX事件结构体 */
393 typedef struct {
394 oal_dev_netbuf_stru *netbuf; /* netbuf链表一个元素 */
395 hi_u16 us_netbuf_num; /* netbuf链表的个数 */
396 hi_u8 auc_resv[2]; /* 字节对齐, 2 byte保留字段 */
397 } dmac_wlan_drx_event_stru;
398
399 /* DMAC与HMAC模块共用的WLAN CRX事件结构体 */
400 typedef struct {
401 oal_dev_netbuf_stru *netbuf; /* 指向管理帧对应的netbuf */
402 hi_u8 *puc_chtxt; /* Shared Key认证用的challenge text */
403 } dmac_wlan_crx_event_stru;
404
405 #ifdef _PRE_WLAN_FEATURE_BTCOEX
406 typedef struct {
407 hi_u8 need_delba;
408 hi_u8 ba_size;
409 hi_u8 auc_reserve[2]; /* 2 byte保留字段 */
410 } d2h_btcoex_delba_event_stru;
411 #endif
412
413 typedef struct {
414 hi_u8 user_index;
415 hi_u8 tid;
416 hi_u8 vap_id;
417 hi_u8 cur_protocol;
418 } dmac_to_hmac_ctx_event_stru;
419
420 typedef struct {
421 hi_u8 user_index;
422 hi_u8 cur_bandwidth;
423 hi_u8 cur_protocol;
424 hi_u8 uc_resv;
425 } dmac_to_hmac_syn_info_event_stru;
426
427 typedef struct {
428 hi_u8 vap_id;
429 hi_u8 voice_aggr; /* 是否支持Voice聚合 */
430 hi_u8 auc_resv[2]; /* 2 byte保留字段 */
431 } dmac_to_hmac_voice_aggr_event_stru;
432
433 /* mic攻击 */
434 typedef struct {
435 hi_u8 auc_user_mac[WLAN_MAC_ADDR_LEN];
436 hi_u8 auc_reserve[2]; /* 2 byte保留字段 */
437 oal_nl80211_key_type key_type;
438 hi_s32 l_key_id;
439 } dmac_to_hmac_mic_event_stru;
440
441 /* DMAC与HMAC模块共用的DTX事件结构体 */
442 typedef struct {
443 void *netbuf; /* netbuf链表一个元素 */
444 hi_u32 us_frame_len;
445 } dmac_tx_event_stru;
446
447 #ifdef _PRE_WLAN_RF_110X_CALI_DPD
448 typedef struct {
449 hi_u32 us_dpd_data[128]; /* dpd calibration data,128 byte */
450 hi_u16 us_data_len; /* data length */
451 hi_u8 reserve[2]; /* 2 byte保留字段 */
452 } dpd_cali_data_stru;
453 #endif
454
455 typedef struct {
456 mac_channel_stru channel;
457 mac_ch_switch_info_stru ch_switch_info;
458
459 hi_u8 switch_immediately; /* 1 - 马上切换 0 - 暂不切换, 推迟到tbtt中切换 */
460 hi_u8 check_cac;
461 hi_u8 auc_resv[2]; /* 2 byte保留字段 */
462 } dmac_set_chan_stru;
463
464 typedef struct {
465 wlan_ch_switch_status_enum_uint8 ch_switch_status; /* 信道切换状态 */
466 hi_u8 announced_channel; /* 新信道号 */
467 wlan_channel_bandwidth_enum_uint8 announced_bandwidth; /* 新带宽模式 */
468 hi_u8 ch_switch_cnt; /* 信道切换计数 */
469 hi_u8 csa_present_in_bcn; /* Beacon帧中是否包含CSA IE */
470 hi_u8 auc_reserve[3]; /* 3 byte保留字段 */
471 } dmac_set_ch_switch_info_stru;
472
473 /*
474 (1)DMAC与HMAC模块共用的CTX子类型ACTION对应的事件的结构体
475 (2)当DMAC自身产生DELBA帧时,使用该结构体向HMAC模块抛事件
476 */
477 typedef struct {
478 mac_category_enum_uint8 action_category; /* ACTION帧的类型 */
479 hi_u8 action; /* 不同ACTION类下的子帧类型 */
480 hi_u8 user_idx;
481 hi_u8 uc_resv;
482
483 hi_u32 us_frame_len; /* 帧长度 */
484
485 hi_u8 hdr_len; /* 帧头长度 */
486 hi_u8 tidno; /* tidno,部分action帧使用 */
487 hi_u8 initiator; /* 触发端方向 */
488 /* 以下为接收到req帧,发送rsp帧后,需要同步到dmac的内容 */
489 hi_u8 stauts; /* rsp帧中的状态 */
490
491 hi_u16 us_baw_start; /* 窗口开始序列号 */
492 hi_u16 us_baw_size; /* 窗口大小 */
493
494 hi_u8 ampdu_max_num; /* BA会话下的最多聚合的AMPDU的个数 */
495 hi_u8 amsdu_supp; /* 是否支持AMSDU */
496 hi_u16 us_ba_timeout; /* BA会话交互超时时间 */
497
498 mac_back_variant_enum_uint8 back_var; /* BA会话的变体 */
499 hi_u8 dialog_token; /* ADDBA交互帧的dialog token */
500 hi_u8 ba_policy; /* Immediate=1 Delayed=0 */
501 hi_u8 lut_index; /* LUT索引 */
502 hi_u8 auc_mac_addr[WLAN_MAC_ADDR_LEN]; /* 用于DELBA查找HMAC用户 */
503 hi_u8 resv[2]; /* 2 byte保留字段 */
504 } dmac_ctx_action_event_stru;
505
506 /* 添加用户事件payload结构体 */
507 typedef struct {
508 hi_u8 user_idx; /* 用户index */
509 hi_u8 uc_resv;
510 hi_u16 us_sta_aid;
511
512 hi_u8 auc_user_mac_addr[WLAN_MAC_ADDR_LEN];
513 hi_u8 auc_bssid[WLAN_MAC_ADDR_LEN];
514
515 mac_vht_hdl_stru vht_hdl;
516 mac_user_ht_hdl_stru ht_hdl;
517 mac_ap_type_enum_uint8 ap_type;
518 hi_u8 resv[3]; /* 3 byte保留字段 */
519 } dmac_ctx_add_user_stru;
520
521 /* 删除用户事件结构体 */
522 typedef dmac_ctx_add_user_stru dmac_ctx_del_user_stru;
523
524 /* 扫描请求事件payload结构体 */
525 typedef struct {
526 mac_scan_req_stru *scan_params; /* 将扫描参数传下去 */
527 } dmac_ctx_scan_req_stru;
528
529 typedef struct {
530 hi_u8 scan_idx;
531 hi_u8 auc_resv[3]; /* 3 byte保留字段 */
532 mac_scan_chan_stats_stru chan_result;
533 } dmac_crx_chan_result_stru;
534
535 /* Update join req 参数写寄存器的结构体定义 */
536 typedef struct {
537 hi_u8 auc_bssid[WLAN_MAC_ADDR_LEN]; /* 加入的AP的BSSID */
538 hi_u16 us_beacon_period;
539 mac_channel_stru current_channel; /* 要切换的信道信息 */
540 hi_u32 beacon_filter; /* 过滤beacon帧的滤波器开启标识位 */
541 hi_u32 non_frame_filter; /* 过滤no_frame帧的滤波器开启标识位 */
542 hi_char auc_ssid[WLAN_SSID_MAX_LEN]; /* 加入的AP的SSID */
543 hi_u8 dtim_period; /* dtim period */
544 hi_u8 dot11_forty_m_hz_operation_implemented;
545 hi_u8 auc_resv;
546 } dmac_ctx_join_req_set_reg_stru;
547
548 /* wait join写寄存器参数的结构体定义 */
549 typedef struct {
550 hi_u32 dtim_period; /* dtim period */
551 hi_u32 dtim_cnt; /* dtim count */
552 hi_u8 auc_bssid[WLAN_MAC_ADDR_LEN]; /* 加入的AP的BSSID */
553 hi_u16 us_tsf_bit0; /* tsf bit0 */
554 } dmac_ctx_set_dtim_tsf_reg_stru;
555
556 /* wait join misc写寄存器参数的结构体定义 */
557 typedef struct {
558 hi_u32 beacon_filter; /* 过滤beacon帧的滤波器开启标识位 */
559 } dmac_ctx_join_misc_set_reg_stru;
560
561 /* wait join写寄存器参数的结构体定义 */
562 typedef struct {
563 hi_u16 user_index; /* user index */
564 hi_u8 auc_resv[2]; /* 2 byte保留字段 */
565 } dmac_ctx_asoc_set_reg_stru;
566
567 /* sta更新edca参数寄存器的结构体定义 */
568 typedef struct {
569 hi_u8 vap_id;
570 mac_wmm_set_param_type_enum_uint8 set_param_type;
571 hi_u8 auc_resv[2]; /* 2 byte保留字段 */
572 wlan_mib_dot11_qapedca_entry_stru ast_wlan_mib_qap_edac[WLAN_WME_AC_BUTT];
573 } dmac_ctx_sta_asoc_set_edca_reg_stru;
574
575 #ifdef _PRE_WLAN_FEATURE_MESH
576 typedef struct {
577 hi_u8 auc_addr[WLAN_MAC_ADDR_LEN];
578 hi_u8 set; /* 0 - 删除某多播地址、1 - 设置某多播地址 */
579 hi_u8 rsv;
580 } dmac_ctx_mesh_mac_addr_whitelist_stru;
581 #endif
582
583 /* DMAC模块模块接收流程控制信息数据结构定义, 与hal_rx_ctl_stru结构体保持一致 */
584 typedef struct {
585 /* word 0 */
586 hi_u8 vap_id : 5;
587 hi_u8 amsdu_enable : 1;
588 hi_u8 is_first_buffer : 1;
589 hi_u8 is_fragmented : 1;
590 hi_u8 msdu_in_buffer;
591 hi_u8 da_user_idx : 4;
592 hi_u8 ta_user_idx : 4;
593 hi_u8 mac_header_len : 6; /* mac header帧头长度 */
594 hi_u8 is_beacon : 1;
595 hi_u8 reserved1 : 1;
596 /* word 1 */
597 hi_u16 us_frame_len; /* 帧头与帧体的总长度 */
598 hi_u8 mac_vap_id : 4;
599 hi_u8 buff_nums : 4; /* 每个MPDU占用的buf数 */
600 hi_u8 channel_number; /* 接收帧的信道 */
601 } dmac_rx_info_stru;
602
603 /* rx cb字段 20字节可用 不允许再增加字节! */
604 typedef struct {
605 hi_s8 rssi_dbm;
606 union {
607 struct {
608 hi_u8 bit_vht_mcs : 4;
609 hi_u8 bit_nss_mode : 2;
610 hi_u8 bit_protocol_mode : 2;
611 } st_vht_nss_mcs; /* 11ac的速率集定义 */
612 struct {
613 hi_u8 bit_ht_mcs : 6;
614 hi_u8 bit_protocol_mode : 2;
615 } st_ht_rate; /* 11n的速率集定义 */
616 struct {
617 hi_u8 bit_legacy_rate : 4;
618 hi_u8 bit_reserved1 : 2;
619 hi_u8 bit_protocol_mode : 2;
620 } st_legacy_rate; /* 11a/b/g的速率集定义 */
621 } un_nss_rate;
622
623 hi_u8 uc_short_gi;
624 hi_u8 uc_bandwidth;
625 } hal_rx_statistic_stru;
626
627 #pragma pack(push, 1)
628 typedef struct {
629 /* word 0 */
630 hi_u8 cipher_protocol_type : 3;
631 hi_u8 ampdu : 1;
632 hi_u8 dscr_status : 4;
633 hi_u8 stbc : 2;
634 hi_u8 gi : 1;
635 hi_u8 smoothing : 1;
636 hi_u8 preabmle : 1;
637 hi_u8 rsvd : 3;
638 hi_u8 auc_resv[2]; /* 2: 预留数组大小 */
639 } hal_rx_status_stru;
640 #pragma pack(pop)
641
642 typedef struct {
643 dmac_rx_info_stru rx_info; /* hal传给dmac的数据信息 */
644 hal_rx_status_stru rx_status; /* 保存加密类型及帧长信息 */
645 hal_rx_statistic_stru rx_statistic; /* 保存接收描述符的统计信息 */
646 } dmac_rx_ctl_stru;
647
648 /* hmac to dmac配置同步消息结构 */
649 typedef struct {
650 wlan_cfgid_enum_uint16 syn_id; /* 同步事件ID */
651 hi_u16 us_len; /* 事件payload长度 */
652 hi_u8 auc_msg_body[4]; /* 事件payload, 4byte */
653 } hmac_to_dmac_cfg_msg_stru;
654
655 typedef hmac_to_dmac_cfg_msg_stru dmac_to_hmac_cfg_msg_stru;
656
657 /* HMAC到DMAC配置同步操作 */
658 typedef struct {
659 wlan_cfgid_enum_uint16 cfgid;
660 hi_u8 auc_resv[2]; /* 2 byte保留字段 */
661 hi_u32(*set_func)(mac_vap_stru *mac_vap, hi_u8 uc_len, const hi_u8 *puc_param);
662 } dmac_config_syn_stru;
663
664 typedef dmac_config_syn_stru hmac_config_syn_stru;
665
666 /* tx cb字段 当前已用19字节,只有20字节可用 不允许再增加字节! */
667 struct dmac_tx_ctl {
668 /* ampdu中包含的MPDU个数,实际描述符填写的值为此值-1 */
669 hi_u8 mpdu_num : 7;
670 hi_u8 netbuf_num : 1; /* 每个MPDU占用的netbuf数目 */
671
672 hi_u8 frame_header_length : 6; /* 该MPDU的802.11头长度 */
673 hi_u8 is_first_msdu : 1; /* 是否是第一个子帧,HI_FALSE不是 HI_TRUE是 */
674 hi_u8 is_amsdu : 1; /* 是否AMSDU: HI_FALSE不是,HI_TRUE是 */
675
676 /* 取值:FRW_EVENT_TYPE_WLAN_DTX和FRW_EVENT_TYPE_HOST_DRX,作用:在释放时区分是内存池的netbuf还是原生态的 */
677 frw_event_type_enum_uint8 en_event_type : 6;
678 hi_u8 is_needretry : 1;
679 hi_u8 is_vipframe : 1; /* 该帧是否是EAPOL帧、DHCP帧 */
680
681 /* dmac tx 到 tx complete 传递的user结构体,目标用户地址 */
682 hi_u8 tx_user_idx : 4;
683 dmac_user_alg_probe_enum_uint8 is_probe_data : 3; /* 是否探测帧 */
684 /* 该MPDU是单播还是多播:HI_FALSE单播,HI_TRUE多播 */
685 hi_u8 ismcast : 1;
686
687 hi_u8 retried_num : 4;
688 hi_u8 need_rsp : 1; /* WPAS send mgmt,need dmac response tx status */
689 hi_u8 is_eapol : 1; /* 该帧是否是EAPOL帧 1102可以去掉 */
690 /* 节能特性用,标识一个MPDU是否从节能队列中取出来的 */
691 hi_u8 is_get_from_ps_queue : 1;
692 hi_u8 is_eapol_key_ptk : 1; /* 4 次握手过程中设置单播密钥EAPOL KEY 帧标识 */
693
694 hi_u8 tx_vap_index : 3;
695 hi_u8 mgmt_frame_id : 4; /* wpas 发送管理帧的frame id */
696 hi_u8 roam_data : 1;
697
698 hi_u8 ac : 3; /* ac */
699 wlan_tx_ack_policy_enum_uint8 ack_policy : 3; /* ACK 策略 */
700 hi_u8 is_any_frame : 1;
701 hi_u8 high_prio_sch : 1;
702
703 hi_u8 alg_pktno; /* 算法用到的字段,唯一标示该报文 */
704
705 hi_u8 timestamp_us[8]; /* 维测使用入TID队列时的时间戳 */
706
707 hi_u8 tid : 4;
708 hi_u8 tx_user_idx_bak : 4;
709 hi_u8 tsf;
710 /* mpdu字节数,维测用,不包括头尾,不包括snap,不包括padding */
711 hi_u16 us_mpdu_bytes;
712 } __OAL_DECLARE_PACKED;
713 typedef struct dmac_tx_ctl dmac_tx_ctl_stru;
714
715 typedef struct {
716 hi_u32 best_rate_goodput_kbps;
717 hi_u32 rate_kbps; /* 速率大小(单位:kbps) */
718 hi_u8 aggr_subfrm_size; /* 聚合子帧数门限值 */
719 hi_u8 per; /* 该速率的PER(单位:%) */
720 hi_u16 resv;
721 } dmac_tx_normal_rate_stats_stru;
722
723 typedef struct {
724 hi_void *ba;
725 hi_u8 tid;
726 mac_delba_initiator_enum_uint8 direction;
727 hi_u8 mac_user_idx;
728 hi_u8 vap_id;
729 hi_u16 us_timeout_times;
730 hi_u8 uc_resv[2]; /* 2 byte保留字段 */
731 } dmac_ba_alarm_stru;
732
733 /* 一个站点下的每一个TID下的聚合接收的状态信息 */
734 typedef struct {
735 hi_u16 us_baw_start; /* 第一个未收到的MPDU的序列号 */
736 hi_u8 is_ba; /* Session Valid Flag */
737 hi_u8 auc_resv;
738
739 /* 建立BA会话相关的信息 */
740 dmac_ba_conn_status_enum_uint8 ba_conn_status; /* BA会话的状态 */
741 mac_back_variant_enum_uint8 back_var; /* BA会话的变体 */
742 hi_u8 ba_policy; /* Immediate=1 Delayed=0 */
743 hi_u8 lut_index; /* 接收端Session H/w LUT Index */
744 hi_u8 *puc_transmit_addr; /* BA会话发送端地址 */
745 } dmac_ba_rx_stru;
746
747 typedef struct {
748 hi_u8 in_use;
749 hi_u8 uc_resv[1];
750 hi_u16 us_seq_num;
751 hi_void *tx_dscr;
752 } dmac_retry_queue_stru;
753
754 typedef struct {
755 hi_u16 us_baw_start; /* 第一个未确认的MPDU的序列号 */
756 hi_u16 us_last_seq_num; /* 最后一个发送的MPDU的序列号 */
757
758 hi_u16 us_baw_size; /* Block_Ack会话的buffer size大小 */
759 hi_u16 us_baw_head; /* bitmap中记录的第一个未确认的包的位置 */
760
761 hi_u16 us_baw_tail; /* bitmap中下一个未使用的位置 */
762 hi_u8 is_ba; /* Session Valid Flag */
763 dmac_ba_conn_status_enum_uint8 ba_conn_status; /* BA会话的状态 */
764
765 mac_back_variant_enum_uint8 back_var; /* BA会话的变体 */
766 hi_u8 dialog_token; /* ADDBA交互帧的dialog token */
767 hi_u8 ba_policy; /* Immediate=1 Delayed=0 */
768 hi_u8 amsdu_supp; /* BLOCK ACK支持AMSDU的标识 */
769
770 hi_u8 *puc_dst_addr; /* BA会话接收端地址 */
771 hi_u16 us_ba_timeout; /* BA会话交互超时时间 */
772 hi_u8 ampdu_max_num; /* BA会话下,能够聚合的最大的mpdu的个数 */
773 hi_u8 mac_user_idx;
774
775 hi_u16 us_pre_baw_start; /* 记录前一次判断ba窗是否卡死时的ssn */
776 hi_u16 us_pre_last_seq_num; /* 记录前一次判断ba窗是否卡死时的lsn */
777
778 hi_u16 ba_jamed_cnt; /* BA窗卡死统计次数 */
779 hi_u8 resv[2]; /* 2个保留对齐字段 */
780
781 hi_u32 aul_tx_buf_bitmap[DMAC_TX_BUF_BITMAP_WORDS];
782 } dmac_ba_tx_stru;
783
784 /* 11n下的参数,需要在关联时进行设置 */
785 typedef struct {
786 hi_u8 ampdu_max_num;
787 hi_u8 auc_reserve[1];
788 hi_u16 us_ampdu_max_size;
789 } dmac_ht_handle_stru;
790
791 #ifdef _PRE_DEBUG_MODE
792 typedef oam_stats_ampdu_stat_stru dmac_tid_ampdu_stat_stru;
793 #endif
794
795 typedef struct {
796 hi_u8 tid : 4, /* 通信标识符 */
797 is_paused : 2, /* TID被暂停调度 */
798 is_delba_ing : 1, /* 该tid是否正在发delba */
799 uc_resv : 1;
800 hi_u8 retry_num; /* tid队列中重传报文的个数 */
801 hi_u16 us_mpdu_num; /* MPDU个数 */
802
803 hi_u8 user_idx; /* 无效值为MAC_RES_MAC_USER_NUM */
804 hi_u8 vap_id;
805 dmac_tx_mode_enum_uint8 tx_mode; /* 发送模式: rifs,aggr,normal发送 */
806 hi_u8 rx_wrong_ampdu_num; /* 该tid未建立BA会话时收到的聚合子帧数(一般是DELBA失败) */
807
808 hi_list hdr; /* tid缓存队列头 */
809
810 hi_void *alg_priv; /* TID级别算法私有结构体 */
811 dmac_tx_normal_rate_stats_stru rate_stats; /* 速率算法在发送完成中统计出的信息 */
812 dmac_ba_tx_stru *ba_tx_hdl;
813 dmac_ba_rx_stru *ba_rx_hdl;
814 dmac_ht_handle_stru ht_tx_hdl;
815
816 #ifdef _PRE_DEBUG_MODE
817 dmac_tid_ampdu_stat_stru *tid_ampdu_stat; /* ampdu业务流程统计信息 */
818 #endif
819 } dmac_tid_stru;
820
821 /* 复位原因定义 */
822 typedef enum {
823 DMAC_RESET_REASON_SW_ERR = 0,
824 DMAC_RESET_REASON_HW_ERR,
825 DMAC_RESET_REASON_CONFIG,
826 DMAC_RETST_REASON_OVER_TEMP,
827
828 DMAC_RESET_REASON_BUTT
829 } dmac_reset_mac_submod_enum;
830 typedef hi_u8 dmac_reset_mac_submod_enum_uint8;
831
832 typedef struct {
833 hi_u8 reason;
834 hi_u8 event;
835 hi_u8 auc_des_addr[WLAN_MAC_ADDR_LEN];
836 } dmac_diasoc_deauth_event;
837
838 #define DMAC_QUERY_EVENT_LEN 48 /* 消息内容的长度 */
839 typedef enum {
840 OAL_QUERY_STATION_INFO_EVENT = 1,
841 OAL_ATCMDSRV_DBB_NUM_INFO_EVENT = 2,
842 OAL_ATCMDSRV_FEM_PA_INFO_EVENT = 3,
843 OAL_ATCMDSRV_GET_RX_PKCG = 4,
844 OAL_ATCMDSRV_LTE_GPIO_CHECK = 5,
845 OAL_QUERY_EVNET_BUTT
846 } oal_query_event_id_enum;
847
848 typedef struct {
849 hi_u8 query_event;
850 hi_u8 auc_query_sta_addr[WLAN_MAC_ADDR_LEN];
851 } dmac_query_request_event;
852
853 typedef struct {
854 hi_u8 query_event;
855 hi_s8 reserve[DMAC_QUERY_EVENT_LEN];
856 } dmac_query_response_event;
857
858 typedef struct {
859 hi_u8 query_event;
860 hi_u8 auc_query_sta_addr[WLAN_MAC_ADDR_LEN]; /* sta mac地址 */
861 } dmac_query_station_info_request_event;
862
863 typedef struct {
864 hi_s32 signal; /* 信号强度 */
865 hi_u32 rx_packets; /* total packets received */
866 hi_u32 tx_packets; /* total packets transmitted */
867 hi_u32 rx_bytes; /* total bytes received */
868 hi_u32 tx_bytes; /* total bytes transmitted */
869 hi_u32 tx_retries; /* 发送重传次数 */
870 hi_u32 rx_dropped_misc; /* 接收失败次数 */
871 hi_u32 tx_failed; /* 发送失败次数 */
872 /* word10 */
873 hi_u16 asoc_id; /* Association ID of the STA */
874 hi_s16 s_free_power; /* 底噪 */
875 /* word11 */
876 oal_rate_info_stru txrate; /* vap当前速率 */
877 hi_u8 query_event; /* 消息号 */
878 hi_u8 resv;
879 } dmac_query_station_info_response_event;
880
881 typedef struct {
882 hi_u32 cycles; /* 统计间隔时钟周期数 */
883 hi_u32 sw_tx_succ_num; /* 软件统计发送成功ppdu个数 */
884 hi_u32 sw_tx_fail_num; /* 软件统计发送失败ppdu个数 */
885 hi_u32 sw_rx_ampdu_succ_num; /* 软件统计接收成功的ampdu个数 */
886 hi_u32 sw_rx_mpdu_succ_num; /* 软件统计接收成功的mpdu个数 */
887 hi_u32 sw_rx_ppdu_fail_num; /* 软件统计接收失败的ppdu个数 */
888 hi_u32 hw_rx_ampdu_fcs_fail_num; /* 硬件统计接收ampdu fcs校验失败个数 */
889 hi_u32 hw_rx_mpdu_fcs_fail_num; /* 硬件统计接收mpdu fcs校验失败个数 */
890 } dmac_thruput_info_sync_stru;
891
892 typedef struct {
893 hi_u8 tx_status;
894 hi_u8 mgmt_frame_id;
895 hi_u8 user_idx;
896 hi_u8 uc_resv;
897 } dmac_crx_mgmt_tx_status_stru;
898
899 /* 函数执行控制枚举 */
900 typedef enum {
901 DMAC_RX_FRAME_CTRL_GOON, /* 本数据帧需要继续处理 */
902 DMAC_RX_FRAME_CTRL_DROP, /* 本数据帧需要丢弃 */
903 DMAC_RX_FRAME_CTRL_BA_BUF, /* 本数据帧被BA会话缓存 */
904
905 DMAC_RX_FRAME_CTRL_BUTT
906 } dmac_rx_frame_ctrl_enum;
907 typedef hi_u8 dmac_rx_frame_ctrl_enum_uint8;
908
909 #ifdef _PRE_WLAN_FEATURE_MESH_ROM
910 /* 单播数据帧发送信息上报lwip */
911 typedef struct {
912 /* Word1-2 */
913 hi_u8 auc_da[WLAN_MAC_ADDR_LEN]; /* MSDU发送的目的地址 */
914 hi_u16 us_length; /* 帧的长度(不包括802.11 头部) */
915 /* Word3 */
916 hi_u8 tx_count;
917 wlan_mesh_tx_status_enum_uint8 mesh_tx_status;
918 hi_u8 resv[2]; /* 2 byte保留字段 */
919 /* Word4-5 */
920 hi_u32 bw; /* 带宽 */
921 hi_u32 rate_kbps; /* 发送速率 */
922 } dmac_tx_info_report_stru;
923
924 typedef struct {
925 hi_u8 auc_da[WLAN_MAC_ADDR_LEN]; /* MSDU发送的目的地址 */
926 wlan_mesh_tx_status_enum_uint8 mesh_tx_status;
927 hi_u8 rsv;
928 } dmac_tx_info_sync_stru;
929 #endif
930
931 /* ****************************************************************************
932 9 OTHERS定义
933 **************************************************************************** */
934 /* 从hcc头里面解析mpdu len */
935 #define dmac_get_frame_subtype_by_txcb(_pst_tx_ctrl) \
936 (((mac_ieee80211_frame_stru *)((hi_u8 *)(_pst_tx_ctrl) + HI_MAX_DEV_CB_LEN))->frame_control.sub_type)
937 #ifdef HAVE_PCLINT_CHECK
938 #define dmac_get_mpdu_len_by_txcb(_pst_tx_ctrl) \
939 (((hcc_header_stru *)((hi_u8 *)(_pst_tx_ctrl) - (OAL_HCC_HDR_LEN)))->pay_len)
940 #else
941 #define dmac_get_mpdu_len_by_txcb(_pst_tx_ctrl) \
942 (((hcc_header_stru *)((hi_u8 *)(_pst_tx_ctrl) - (OAL_HCC_HDR_LEN + OAL_PAD_HDR_LEN)))->pay_len)
943 #endif
944 #define dmac_get_frame_type_by_txcb(_pst_tx_ctrl) \
945 (((mac_ieee80211_frame_stru *)((hi_u8 *)(_pst_tx_ctrl) + HI_MAX_DEV_CB_LEN))->frame_control.type)
946
947 /* ****************************************************************************
948 功能描述 : 获取seqnum的值
949 **************************************************************************** */
dmac_get_seqnum_by_txcb(const dmac_tx_ctl_stru * tx_ctrl)950 static inline hi_u16 dmac_get_seqnum_by_txcb(const dmac_tx_ctl_stru *tx_ctrl)
951 {
952 return ((mac_ieee80211_frame_stru *)((hi_u8 *)tx_ctrl + HI_MAX_DEV_CB_LEN))->seq_num;
953 }
954
955 /* ****************************************************************************
956 功能描述 : 通过cb字段获取mac头指针 CB字段后即为MAC头
957 **************************************************************************** */
dmac_get_mac_hdr_by_txcb(dmac_tx_ctl_stru * tx_ctrl)958 static inline mac_ieee80211_frame_stru *dmac_get_mac_hdr_by_txcb(dmac_tx_ctl_stru *tx_ctrl)
959 {
960 return (mac_ieee80211_frame_stru *)((hi_u8 *)tx_ctrl + HI_MAX_DEV_CB_LEN);
961 }
962
963 /* ****************************************************************************
964 功能描述 : device侧获取mac头的值
965 **************************************************************************** */
dmac_get_mac_hdr_by_rxcb(dmac_rx_info_stru * cb_ctrl)966 static inline hi_u32 *dmac_get_mac_hdr_by_rxcb(dmac_rx_info_stru *cb_ctrl)
967 {
968 return (hi_u32 *)((hi_u8 *)cb_ctrl + HI_MAX_DEV_CB_LEN);
969 }
970
971
972 /* ****************************************************************************
973 HOST侧 CB字段以及获取CB字段的宏定义 待hmac整改完成后移动到hmac
974 **************************************************************************** */
975 /* HMAC模块接收流程控制信息数据结构定义 只使用20bytes hal的维测信息hmac不需要 */
976 typedef struct {
977 /* word 0 */
978 hi_u8 vap_id : 5;
979 hi_u8 amsdu_enable : 1;
980 hi_u8 is_first_buffer : 1;
981 hi_u8 is_fragmented : 1;
982 hi_u8 msdu_in_buffer;
983 hi_u8 buff_nums : 4; /* 每个MPDU占用的buf数目 */
984 hi_u8 is_beacon : 1;
985 hi_u8 reserved1 : 3;
986 hi_u8 mac_header_len; /* mac header帧头长度 */
987 /* word 1 */
988 hi_u16 us_frame_len; /* 帧头与帧体的总长度 */
989 hi_u16 us_da_user_idx; /* 目的地址用户索引 */
990 /* word 2 */
991 hi_u32 *pul_mac_hdr_start_addr; /* 对应的帧的帧头地址,虚拟地址 */
992 /* word 3 */
993 hi_u8 us_ta_user_idx; /* 发送端地址用户索引 */
994 hi_u8 mac_vap_id;
995 hi_u8 channel_number; /* 接收帧的信道 */
996 /* word 4 */
997 hi_s8 rssi_dbm;
998 } hmac_rx_ctl_stru;
999
1000 /* host侧netbuf控制字段(CB),总长度为48字节 (目前已用42字节) */
1001 typedef struct {
1002 hi_u8 mpdu_num; /* ampdu中包含的MPDU个数,实际描述符填写的值为此值-1 */
1003 hi_u8 netbuf_num; /* 每个MPDU占用的netbuf数目 */
1004 hi_u8 resv[2]; /* 2 byte保留字段 */
1005 hi_u32 us_mpdu_len; /* 每个MPDU的长度不包括mac header length */
1006
1007 hi_u8 is_amsdu : 1; /* 是否AMSDU: HI_FALSE不是,HI_TRUE是 */
1008 /* 该MPDU是单播还是多播:HI_FALSE单播,HI_TRUE多播 */
1009 hi_u8 ismcast : 1;
1010 hi_u8 is_eapol : 1; /* 该帧是否是EAPOL帧 */
1011 hi_u8 use_4_addr : 1; /* 是否使用4地址,由WDS特性决定 */
1012 /* 节能特性用,标识一个MPDU是否从节能队列中取出来的 */
1013 hi_u8 is_get_from_ps_queue : 1;
1014 hi_u8 is_first_msdu : 1; /* 是否是第一个子帧,HI_FALSE不是 HI_TRUE是 */
1015 hi_u8 need_pause_tid : 1;
1016 hi_u8 is_bar : 1;
1017 hi_u8 frame_header_length; /* 该MPDU的802.11头长度 */
1018 hi_u8 is_qosdata : 1; /* 指示该帧是否是qos data */
1019 /* 0: 802.11 mac头不在skb中,另外申请了内存存放; 1: 802.11 mac头在skb中 */
1020 hi_u8 mac_head_type : 1;
1021 hi_u8 is_vipframe : 1; /* 该帧是否是EAPOL帧、DHCP帧 */
1022 hi_u8 is_needretry : 1;
1023 /* 该帧的SN号由软件维护,硬件禁止维护(目前仅用于非QOS分片帧 ) */
1024 hi_u8 seq_ctrl_bypass : 1;
1025 hi_u8 need_rsp : 1; /* WPAS send mgmt,need dmac response tx status */
1026 hi_u8 is_eapol_key_ptk : 1; /* 4 次握手过程中设置单播密钥EAPOL KEY 帧标识 */
1027 hi_u8 roam_data : 1;
1028
1029 wlan_frame_type_enum_uint8 frame_type; /* 帧类型:数据帧,管理帧... */
1030 mac_ieee80211_frame_stru *frame_header; /* 该MPDU的帧头指针 */
1031
1032 hi_u8 ac; /* ac */
1033 hi_u8 tid; /* tid */
1034 /* 取值:FRW_EVENT_TYPE_WLAN_DTX和FRW_EVENT_TYPE_HOST_DRX,作用:在释放时区分是内存池的netbuf还是原生态的 */
1035 frw_event_type_enum_uint8 event_type;
1036 hi_u8 event_sub_type; /* amsdu抛事件用的 */
1037 hi_u8 rsv[4]; /* 替换hal_tx_dscr_stru resv 4 byte */
1038 hi_u16 us_eapol_ts; /* eapol帧时间戳 */
1039 hi_u16 us_mpdu_bytes; /* mpdu字节数,维测用,不包括头尾,不包括snap,不包括padding */
1040 hi_u8 rsv1[8]; /* 维测使用入TID队列时的时间戳 */
1041
1042 hi_u32 alg_pktno; /* 算法用到的字段,唯一标示该报文 */
1043 hi_u16 us_seqnum; /* 记录软件分配的seqnum */
1044 wlan_tx_ack_policy_enum_uint8 ack_policy; /* ACK 策略 */
1045 hi_u8 tx_vap_index;
1046
1047 hi_u8 us_tx_user_idx; /* dmac tx 到 tx complete 传递的user结构体,目标用户地址 */
1048 hi_u8 retried_num;
1049 dmac_user_alg_probe_enum_uint8 is_probe_data; /* 是否是探测帧 */
1050 hi_u8 mgmt_frame_id : 4; /* wpas 发送管理帧的frame id */
1051 hi_u8 is_any_frame : 1;
1052 #ifdef _PRE_WLAN_FEATURE_MESH
1053 /* pbuf告知当前数据帧优先级的flags(用于ipv6包头压缩告知驱动优先级) */
1054 hi_u8 pbuf_flags : 2;
1055 #endif
1056 hi_u8 high_prio_sch : 1; /* 优先调度 */
1057 } hmac_tx_ctl_stru;
1058
1059 hi_u32 dmac_tid_pause(dmac_tid_stru *tid, hi_u8 type);
1060 hi_u32 dmac_from_hmac_rx_control_handle(frw_event_mem_stru *event_mem);
1061 hi_u32 dmac_from_hmac_rx_data_handle(frw_event_mem_stru *event_mem, oal_dev_netbuf_stru *dev_netbuf, hi_u16 netbuf_len);
1062 hi_u32 dmac_alg_get_qap_wme_info(const mac_vap_stru *mac_vap, hi_u8 wme_type, mac_wme_param_stru *wme_info);
1063 hi_void dmac_set_rom_resv_func(dmac_rom_resv_func_enum_uint8 func_id, hi_void *func);
1064 hi_void *dmac_get_rom_resv_func(dmac_rom_resv_func_enum_uint8 func_id);
1065
1066 #ifdef __cplusplus
1067 #if __cplusplus
1068 }
1069 #endif
1070 #endif
1071
1072 #endif /* end of dmac_ext_if.h */
1073