WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
hmac_blockack.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2013-2023. All rights reserved.
3 文 件 名 : hmac_blockack.h
4 生成日期 : 2013年4月8日
5 功能描述 : hmac_blockack.c 的头文件
6 */
7
8#ifndef HMAC_BLOCKACK_H
9#define HMAC_BLOCKACK_H
10
11/*****************************************************************************
12 1 其他头文件包含
13*****************************************************************************/
14#include "hmac_user.h"
15#include "hmac_main.h"
16#include "hmac_rx_data.h"
17#include "hmac_vap.h"
18#include "hmac_tx_mgmt.h"
19
20#ifdef __cplusplus
21#if __cplusplus
22extern "C" {
23#endif
24#endif
25
26
27#undef THIS_FILE_ID
28#define THIS_FILE_ID OAM_FILE_ID_HMAC_BLOCKACK_H
29
30/*****************************************************************************
31 2 宏定义
32*****************************************************************************/
33
34#define HMAC_TX_BUF_BITMAP_LOG2_WORD_SIZE 5 /* log2(32) == 5 */
35/* 发送BA窗口记录seq number的bitmap所使用的类型长度 */
36#define HMAC_TX_BUF_BITMAP_WORD_SIZE 32
37
38#define HMAC_TX_BUF_BITMAP_WORD_MASK (HMAC_TX_BUF_BITMAP_WORD_SIZE - 1)
39
40/* 重排序队列保留bitmap用于缓存乱序帧 */
41#define HMAC_BA_BMP_SIZE 64
42
43/* 判断index为n 在bitmap中的bit位是否是1 */
44#define hmac_ba_bit_isset(_bm, _n) (((_n) < (HMAC_BA_BMP_SIZE)) && \
45 (((_bm)[(_n) >> 5] & (1 << ((_n) & 31))) != 0))
46
47/* 判断一个seq num是否在发送窗口内 */
48#define hmac_baw_within(_start, _bawsz, _seqno) \
49 ((((osal_u32)((_seqno) - (_start))) & 4095) < (_bawsz))
50
51/* Default values for receive timeout */
52#define HMAC_BA_RX_VO_TIMEOUT 40 /* 40 milliseconds */
53#define HMAC_BA_RX_VI_TIMEOUT 100 /* 100 milliseconds */
54#define HMAC_BA_RX_BE_TIMEOUT 60 /* 100 milliseconds */
55#define HMAC_BA_RX_BK_TIMEOUT 100 /* 100 milliseconds */
56
57#define HMAC_BA_SEQNO_MASK 0x0FFF /* max sequece number */
58#define hmac_ba_seqno_sub(_seq1, _seq2) ((osal_u32)((_seq1) - (_seq2)) & HMAC_BA_SEQNO_MASK)
59#define hmac_ba_seqno_add(_seq1, _seq2) ((osal_u32)((_seq1) + (_seq2)) & HMAC_BA_SEQNO_MASK)
60
61#define WLAN_RX_RESET_BA_THREHOLD 32 /* BA会话未建立收到一定聚合帧发送DELBA */
62
63/*****************************************************************************
64 3 枚举定义
65*****************************************************************************/
66
67
68/*****************************************************************************
69 4 全局变量声明
70*****************************************************************************/
71
72/*****************************************************************************
73 5 消息头定义
74*****************************************************************************/
75
76
77/*****************************************************************************
78 6 消息定义
79*****************************************************************************/
80
81
82/*****************************************************************************
83 7 STRUCT定义
84*****************************************************************************/
85
86/*****************************************************************************
87 8 UNION定义
88*****************************************************************************/
89
90
91/*****************************************************************************
92 9 OTHERS定义
93*****************************************************************************/
94
95
96/*****************************************************************************
97 10 inline函数定义
98*****************************************************************************/
99/*****************************************************************************
100 函 数 名 : hmac_ba_rx_seqno_lt
101 功能描述 : 判断seq1是否小于seq2
102 输入参数 : 无
103 输出参数 : 无
104*****************************************************************************/
106{
107 if (((seq1 < seq2) && ((seq2 - seq1) < HMAC_BA_MAX_SEQNO_BY_TWO)) ||
108 ((seq1 > seq2) && ((seq1 - seq2) > HMAC_BA_MAX_SEQNO_BY_TWO))) {
109 return OAL_TRUE;
110 }
111
112 return OAL_FALSE;
113}
114
115/*****************************************************************************
116 函 数 名 : hmac_ba_rx_seqno_gt
117 功能描述 : 判断seq1是否大于seq2
118 输入参数 : 无
119 输出参数 : 无
120*****************************************************************************/
125
126/*****************************************************************************
127 函 数 名 : hmac_ba_seqno_lt
128 功能描述 : 判断seq1是否小于seq2
129 输入参数 : 无
130 输出参数 : 无
131*****************************************************************************/
133{
134 if (((seq1 < seq2) && ((seq2 - seq1) < HMAC_BA_MAX_SEQNO_BY_TWO)) ||
135 ((seq1 > seq2) && ((seq1 - seq2) > HMAC_BA_MAX_SEQNO_BY_TWO))) {
136 return OAL_TRUE;
137 }
138
139 return OAL_FALSE;
140}
141
142/*****************************************************************************
143 函 数 名 : hmac_ba_seqno_gt
144 输入参数 : 无
145 输出参数 : 无
146*****************************************************************************/
151
152/*****************************************************************************
153 函 数 名 : hmac_ba_rx_seqno_leq
154 功能描述 : 判断seq1是否小于或等于seq2
155 输入参数 : 无
156 输出参数 : 无
157*****************************************************************************/
159{
160 if (((seq1 <= seq2) && ((seq2 - seq1) < HMAC_BA_MAX_SEQNO_BY_TWO)) ||
161 ((seq1 > seq2) && ((seq1 - seq2) > HMAC_BA_MAX_SEQNO_BY_TWO))) {
162 return OAL_TRUE;
163 }
164
165 return OAL_FALSE;
166}
167
168/*****************************************************************************
169 函 数 名 : hmac_ba_rx_seqno_geq
170 功能描述 : 判断seq1是否大于或等于seq2
171 输入参数 : 无
172 输出参数 : 无
173*****************************************************************************/
178
179/*****************************************************************************
180 函 数 名 : hmac_ba_isset
181 输入参数 : 无
182 输出参数 : 无
183*****************************************************************************/
185{
186 osal_u16 us_index;
187
188 if (hmac_baw_within(ba_rx_hdl->baw_head, HMAC_BA_BMP_SIZE, seqno) == OSAL_TRUE) {
189 us_index = seqno & (HMAC_BA_BMP_SIZE - 1);
190
191 if (hmac_ba_bit_isset(ba_rx_hdl->rx_buf_bitmap, us_index) == OSAL_TRUE) {
192 return OAL_TRUE;
193 }
194 }
195
196 return OAL_FALSE;
197}
198
199/*****************************************************************************
200 函 数 名 : hmac_ba_addto_rx_bitmap
201 输入参数 : 无
202 输出参数 : 无
203*****************************************************************************/
205{
206 osal_u16 us_index;
207
208 if (hmac_baw_within(ba_rx_hdl->baw_head, HMAC_BA_BMP_SIZE, seqno) == OSAL_TRUE) {
209 us_index = seqno & (HMAC_BA_BMP_SIZE - 1);
210 ba_rx_hdl->rx_buf_bitmap[us_index >> HMAC_TX_BUF_BITMAP_LOG2_WORD_SIZE] |=
211 (1 << (us_index & HMAC_TX_BUF_BITMAP_WORD_MASK));
212 }
213}
214
215/*****************************************************************************
216 函 数 名 : hmac_ba_clear_rx_bitmap
217 输入参数 : 无
218 输出参数 : 无
219*****************************************************************************/
221{
222 osal_u16 us_index;
223
224 us_index = ((osal_u16)hmac_ba_seqno_sub(ba_rx_hdl->baw_head, 1)) & (osal_u16)(HMAC_BA_BMP_SIZE - 1);
225 ba_rx_hdl->rx_buf_bitmap[us_index >> HMAC_TX_BUF_BITMAP_LOG2_WORD_SIZE] &=
226 ~((osal_u32)(1 << (us_index & HMAC_TX_BUF_BITMAP_WORD_MASK)));
227}
228
229/*****************************************************************************
230 函 数 名 : hmac_ba_update_rx_bitmap
231 输入参数 : 无
232 输出参数 : 无
233*****************************************************************************/
235 mac_ieee80211_frame_stru *frame_hdr)
236{
237 oal_bool_enum_uint8 is_4addr;
238 osal_u8 is_tods;
239 osal_u8 is_from_ds;
240 osal_u8 tid;
241 hmac_ba_rx_stru *ba_rx_hdl;
242
243 /* 考虑四地址情况获取报文的tid */
244 is_tods = mac_hdr_get_to_ds((osal_u8 *)frame_hdr);
245 is_from_ds = mac_hdr_get_from_ds((osal_u8 *)frame_hdr);
246 is_4addr = (is_tods != OSAL_FALSE) && (is_from_ds != OSAL_FALSE);
247 tid = mac_get_tid_value((osal_u8 *)frame_hdr, is_4addr);
248
249 ba_rx_hdl = hmac_user->tx_tid_queue[tid].ba_rx_info;
250 if (ba_rx_hdl == OAL_PTR_NULL) {
251 return;
252 }
253 if (ba_rx_hdl->ba_status != HMAC_BA_COMPLETE) {
254 return;
255 }
256
257 osal_spin_lock(&ba_rx_hdl->ba_lock);
258
259 while (hmac_ba_seqno_lt(ba_rx_hdl->baw_head,
261 ba_rx_hdl->baw_head = (osal_u16)hmac_ba_seqno_add(ba_rx_hdl->baw_head, 1);
262 hmac_ba_clear_rx_bitmap(ba_rx_hdl);
263 }
264
265 hmac_ba_addto_rx_bitmap(ba_rx_hdl, mac_get_seq_num((osal_u8 *)frame_hdr));
266 osal_spin_unlock(&ba_rx_hdl->ba_lock);
267
268 return;
269}
270
271/*****************************************************************************
272 函 数 名 : hmac_ba_seqno_bound_chk
273 功能描述 : This function compares the given sequence number with the specified
274 upper and lower bounds and returns its position relative to them.
275 输入参数 : 无
276 输出参数 : 无
277*****************************************************************************/
279{
280 oal_bool_enum_uint8 lo_chk;
281 oal_bool_enum_uint8 hi_chk;
282 osal_u8 chk_res = 0;
283
284 lo_chk = hmac_ba_rx_seqno_leq(seq_lo, seq);
285 hi_chk = hmac_ba_rx_seqno_leq(seq, seq_hi);
286 if ((lo_chk == OSAL_TRUE) && (hi_chk == OSAL_TRUE)) {
288 } else if (hi_chk == OSAL_FALSE) {
290 }
291
292 return chk_res;
293}
294
295/* This function reads out the TX-Dscr indexed by the specified sequence number in */
296/* the Retry-Q Ring-Buffer. */
297/*****************************************************************************
298 函 数 名 : hmac_remove_frame_from_reorder_q
299 功能描述 :This function reads out the TX-Dscr indexed by the specified sequence number in
300 the Retry-Q Ring-Buffer.
301 输入参数 : 无
302 输出参数 : 无
303*****************************************************************************/
306{
307 osal_u16 idx;
308 hmac_rx_buf_stru *rx_buff;
309
310 idx = (seq_num & (WLAN_AMPDU_RX_BUFFER_SIZE - 1));
311
312 rx_buff = &(ba_rx_hdl->re_order_list[idx]);
313
314 osal_spin_lock(&ba_rx_hdl->ba_lock);
315
316 if ((rx_buff->in_use == 0) || (rx_buff->seq_num != seq_num)) {
317 osal_spin_unlock(&ba_rx_hdl->ba_lock);
318 return OAL_PTR_NULL;
319 }
320
321 rx_buff->in_use = 0;
322
323 osal_spin_unlock(&ba_rx_hdl->ba_lock);
324
325 return rx_buff;
326}
327
328/*****************************************************************************
329 函 数 名 : hmac_get_frame_from_reorder_q
330 功能描述 :This function reads out the TX-Dscr indexed by the specified sequence number in
331 the Retry-Q Ring-Buffer.
332 输入参数 : 无
333 输出参数 : 无
334*****************************************************************************/
337{
338 osal_u16 idx;
339 hmac_rx_buf_stru *rx_buff;
340
341 idx = (seq_num & (WLAN_AMPDU_RX_BUFFER_SIZE - 1));
342
343 rx_buff = &(ba_rx_hdl->re_order_list[idx]);
344
345 if ((rx_buff->in_use == 0) || (rx_buff->seq_num != seq_num)) {
346 return OAL_PTR_NULL;
347 }
348
349 return rx_buff;
350}
351
352
354 osal_u16 stop)
355{
356 return oal_get_lut_index(ba_lut_index_table, MAC_RX_BA_LUT_BMAP_LEN, HAL_MAX_RX_BA_LUT_SIZE, start, stop);
357}
358
360{
361 oal_del_lut_index(ba_lut_index_table, lut_index);
362}
363
364/*****************************************************************************
365 10 函数声明
366*****************************************************************************/
368 mac_rx_ctl_stru *cb_ctrl, oal_netbuf_head_stru *netbuf_header, oal_bool_enum_uint8 *is_ba_buf);
369
370
372
374 hmac_ba_rx_stru *ba_rx_info, hmac_device_stru *hmac_device, hmac_tid_stru *tid_info);
375
377 hmac_vap_stru *hmac_vap);
379 osal_u8 tid, oal_bool_enum_uint8 is_aging);
381 oal_netbuf_stru *netbuf);
382
384 const mac_ieee80211_frame_stru *frame_hdr, hmac_ba_rx_stru **ba_rx_hdl);
389#ifdef _PRE_WLAN_FEATURE_AMPDU_TX_HW
390osal_u32 hmac_ba_tx_ampdu_switch(const hmac_vap_stru *hmac_vap, const mac_cfg_ampdu_tx_on_param_stru *ampdu_tx_on);
391#endif
392
393#ifdef __cplusplus
394#if __cplusplus
395}
396#endif
397#endif
398
399#endif /* end of hmac_blockack.h */
#define HMAC_BA_MAX_SEQNO_BY_TWO
Definition dmac_ext_if_hcm.h:53
#define HMAC_BA_BETWEEN_SEQLO_SEQHI
Definition dmac_ext_if_hcm.h:58
#define HMAC_BA_GREATER_THAN_SEQHI
Definition dmac_ext_if_hcm.h:57
#define OAL_INLINE
Definition driver_soc_common.h:47
void osal_spin_lock(osal_spinlock *lock)
Lock the spinlock.
Definition osal_spinlock.c:38
void osal_spin_unlock(osal_spinlock *lock)
release the spin_lock.
Definition osal_spinlock.c:66
OAL_STATIC OAL_INLINE oal_bool_enum_uint8 hmac_ba_seqno_gt(osal_u16 seq1, osal_u16 seq2)
Definition hmac_blockack.h:147
OAL_STATIC OAL_INLINE oal_bool_enum_uint8 hmac_ba_rx_seqno_lt(osal_u16 seq1, osal_u16 seq2)
Definition hmac_blockack.h:105
osal_void hmac_reorder_ba_rx_buffer_bar_etc(hmac_ba_rx_stru *rx_ba, osal_u16 start_seq_num, hmac_vap_stru *hmac_vap)
OAL_STATIC OAL_INLINE osal_void hmac_ba_update_rx_bitmap(hmac_user_stru *hmac_user, mac_ieee80211_frame_stru *frame_hdr)
Definition hmac_blockack.h:234
osal_u32 hmac_ba_filter_serv_etc(hmac_vap_stru *hmac_vap, hmac_user_stru *hmac_user, mac_rx_ctl_stru *cb_ctrl, oal_netbuf_head_stru *netbuf_header, oal_bool_enum_uint8 *is_ba_buf)
OAL_STATIC OAL_INLINE oal_bool_enum_uint8 hmac_ba_seqno_lt(osal_u16 seq1, osal_u16 seq2)
Definition hmac_blockack.h:132
osal_u32 hmac_ba_filter_serv(hmac_vap_stru *hmac_vap, hmac_user_stru *hmac_user, const dmac_rx_ctl_stru *cb_ctrl, const mac_ieee80211_frame_stru *frame_hdr, hmac_ba_rx_stru **ba_rx_hdl)
osal_u8 hmac_mgmt_check_set_rx_ba_ok_etc(hmac_vap_stru *hmac_vap, hmac_user_stru *hmac_user, hmac_ba_rx_stru *ba_rx_info, hmac_device_stru *hmac_device, hmac_tid_stru *tid_info)
#define hmac_ba_seqno_sub(_seq1, _seq2)
Definition hmac_blockack.h:58
osal_u32 hmac_ba_reset_rx_handle_etc(hmac_device_stru *hmac_device, hmac_user_stru *hmac_user, osal_u8 tid, oal_bool_enum_uint8 is_aging)
osal_u32 hmac_ba_timeout_fn_etc(osal_void *p_arg)
OAL_STATIC OAL_INLINE hmac_rx_buf_stru * hmac_remove_frame_from_reorder_q(hmac_ba_rx_stru *ba_rx_hdl, osal_u16 seq_num)
Definition hmac_blockack.h:304
OAL_STATIC OAL_INLINE osal_u8 hmac_ba_get_lut_index(osal_u8 *ba_lut_index_table, osal_u16 start, osal_u16 stop)
Definition hmac_blockack.h:353
OAL_STATIC OAL_INLINE osal_void hmac_ba_clear_rx_bitmap(hmac_ba_rx_stru *ba_rx_hdl)
Definition hmac_blockack.h:220
#define hmac_baw_within(_start, _bawsz, _seqno)
Definition hmac_blockack.h:48
#define HMAC_TX_BUF_BITMAP_WORD_MASK
Definition hmac_blockack.h:38
OAL_STATIC OAL_INLINE oal_bool_enum_uint8 hmac_ba_rx_seqno_leq(osal_u16 seq1, osal_u16 seq2)
Definition hmac_blockack.h:158
OAL_STATIC OAL_INLINE osal_u8 hmac_ba_seqno_bound_chk(osal_u16 seq_lo, osal_u16 seq_hi, osal_u16 seq)
Definition hmac_blockack.h:278
#define hmac_ba_bit_isset(_bm, _n)
Definition hmac_blockack.h:44
#define HMAC_TX_BUF_BITMAP_LOG2_WORD_SIZE
Definition hmac_blockack.h:34
OAL_STATIC OAL_INLINE oal_bool_enum_uint8 hmac_ba_rx_seqno_geq(osal_u16 seq1, osal_u16 seq2)
Definition hmac_blockack.h:174
OAL_STATIC OAL_INLINE osal_void hmac_ba_addto_rx_bitmap(hmac_ba_rx_stru *ba_rx_hdl, osal_u16 seqno)
Definition hmac_blockack.h:204
osal_void hmac_up_rx_bar_etc(hmac_vap_stru *hmac_vap, dmac_rx_ctl_stru *rx_ctl, oal_netbuf_stru *netbuf)
#define hmac_ba_seqno_add(_seq1, _seq2)
Definition hmac_blockack.h:59
OAL_STATIC OAL_INLINE oal_bool_enum_uint8 hmac_ba_rx_seqno_gt(osal_u16 seq1, osal_u16 seq2)
Definition hmac_blockack.h:121
OAL_STATIC OAL_INLINE oal_bool_enum_uint8 hmac_ba_isset(hmac_ba_rx_stru *ba_rx_hdl, osal_u16 seqno)
Definition hmac_blockack.h:184
#define HMAC_BA_BMP_SIZE
Definition hmac_blockack.h:41
osal_void hmac_clear_tx_nonqos_seq_num(const hmac_vap_stru *hmac_vap)
osal_void hmac_ba_reset_tx_handle(hmac_vap_stru *hmac_vap, osal_u16 user_id, osal_u8 tid)
osal_u32 hmac_ba_check_rx_aggr(const hmac_vap_stru *hmac_vap, const mac_ieee80211_frame_stru *frame_hdr)
OAL_STATIC OAL_INLINE hmac_rx_buf_stru * hmac_get_frame_from_reorder_q(hmac_ba_rx_stru *ba_rx_hdl, osal_u16 seq_num)
Definition hmac_blockack.h:335
OAL_STATIC OAL_INLINE osal_void hmac_ba_del_lut_index(osal_u8 *ba_lut_index_table, osal_u8 lut_index)
Definition hmac_blockack.h:359
osal_void hmac_clear_tx_qos_seq_num(const hmac_user_stru *hmac_user)
osal_u16 seq_num
Definition mac_frame_rom.h:7
@ HMAC_BA_COMPLETE
Definition mac_user_ext.h:85
osal_u8 oal_bool_enum_uint8
Definition oal_types_device_rom.h:45
@ OAL_FALSE
Definition oal_types_device_rom.h:41
@ OAL_TRUE
Definition oal_types_device_rom.h:42
#define OAL_PTR_NULL
Definition oal_types_device_rom.h:30
unsigned char osal_u8
Definition osal_types.h:11
#define OSAL_FALSE
Definition osal_types.h:56
void osal_void
Definition osal_types.h:29
#define OSAL_TRUE
Definition osal_types.h:57
unsigned int osal_u32
Definition osal_types.h:13
unsigned short osal_u16
Definition osal_types.h:12
#define OAL_STATIC
Definition soc_wifi_service_api.c:30
Definition dmac_ext_if_device_rom.h:81
Definition mac_user_ext.h:433
osal_u32 rx_buf_bitmap[2]
Definition mac_user_ext.h:450
osal_spinlock ba_lock
Definition mac_user_ext.h:434
osal_u16 ba_status
Definition mac_user_ext.h:441
hmac_rx_buf_stru re_order_list[WLAN_AMPDU_RX_BUFFER_SIZE]
Definition mac_user_ext.h:458
osal_u16 baw_start
Definition mac_user_ext.h:435
osal_u16 baw_head
Definition mac_user_ext.h:452
Definition mac_device_ext.h:856
Definition mac_user_ext.h:388
osal_u16 seq_num
Definition mac_user_ext.h:391
oal_bool_enum_uint8 in_use
Definition mac_user_ext.h:389
Definition mac_user_ext.h:463
hmac_ba_rx_stru * ba_rx_info
Definition mac_user_ext.h:487
Definition mac_user_ext.h:519
hmac_tid_stru tx_tid_queue[WLAN_TID_MAX_NUM]
Definition mac_user_ext.h:657
Definition mac_vap_ext.h:2019
Definition hal_common_ops_device_rom.h:1104
Definition mac_frame_common_rom.h:575
Definition hal_common_ops_device_rom.h:978
Definition oal_skbuff.h:73
Definition oal_skbuff.h:82
#define MAC_RX_BA_LUT_BMAP_LEN
Definition wlan_spec_hh503.h:197
#define WLAN_AMPDU_RX_BUFFER_SIZE
Definition wlan_spec_hh503.h:193
#define HAL_MAX_RX_BA_LUT_SIZE
Definition wlan_spec_hh503_rom.h:81
osal_u8 oal_get_lut_index(osal_u8 *lut_index_table, osal_u8 bmap_len, osal_u16 max_lut_size, osal_u16 start, osal_u16 stop)