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_BLOCKACK_H__ 20 #define __DMAC_BLOCKACK_H__ 21 22 /* **************************************************************************** 23 1 其他头文件包含 24 **************************************************************************** */ 25 #include "oal_ext_if.h" 26 #include "dmac_ext_if.h" 27 #include "hmac_ext_if.h" 28 #include "hmac_user.h" 29 #include "hmac_main.h" 30 #include "hmac_rx_data.h" 31 #include "hmac_vap.h" 32 33 #ifdef __cplusplus 34 #if __cplusplus 35 extern "C" { 36 #endif 37 #endif 38 39 /* **************************************************************************** 40 2 宏定义 41 **************************************************************************** */ 42 /* Default values for receive timeout */ 43 #define HMAC_BA_RX_VO_TIMEOUT 40 /* 40 milliseconds */ 44 #define HMAC_BA_RX_VI_TIMEOUT 100 /* 100 milliseconds */ 45 #define HMAC_BA_RX_BE_TIMEOUT 60 /* 100 milliseconds */ 46 #define HMAC_BA_RX_BK_TIMEOUT 100 /* 100 milliseconds */ 47 48 #define HMAC_BA_SEQNO_MASK 0x0FFF /* max sequece number */ 49 #define hmac_ba_seqno_sub(_seq1, _seq2) (((_seq1) - (_seq2)) & HMAC_BA_SEQNO_MASK) 50 #define hmac_ba_seqno_add(_seq1, _seq2) (((_seq1) + (_seq2)) & HMAC_BA_SEQNO_MASK) 51 52 #define HMAC_BA_LUT_IDX_BMAP_LEN ((HAL_MAX_BA_LUT_SIZE + 7) >> 3) 53 54 /* 计算seq num到ba窗start的偏移量 */ 55 #define hmac_ba_index(_st, _seq) (((_seq) - (_st)) & 4095) 56 57 #define HMAC_TX_BUF_BITMAP_LOG2_WORD_SIZE 5 /* log2(32)等于 5 */ 58 59 /* 发送BA窗口记录seq number的bitmap所使用的类型长度 */ 60 #define HMAC_TX_BUF_BITMAP_WORD_SIZE 32 61 62 #define HMAC_TX_BUF_BITMAP_WORD_MASK (HMAC_TX_BUF_BITMAP_WORD_SIZE - 1) 63 64 #define hmac_tx_buf_bitmap_set(_bitmap, _idx) \ 65 (_bitmap[_idx >> HMAC_TX_BUF_BITMAP_LOG2_WORD_SIZE] |= (1 << ((_idx) & HMAC_TX_BUF_BITMAP_WORD_MASK))) 66 67 #define hmac_tx_buf_bitmap_clr(_bitmap, _idx) \ 68 (_bitmap[_idx >> HMAC_TX_BUF_BITMAP_LOG2_WORD_SIZE] &= ~((hi_u32)(1 << ((_idx) & HMAC_TX_BUF_BITMAP_WORD_MASK)))) 69 70 #define HMAC_BA_BMP_SIZE 64 71 72 /* 判断index为n 在bitmap中的bit位是否是1 */ 73 #define hmac_ba_bit_isset(_bm, _n) (((_n) < HMAC_BA_BMP_SIZE) && ((_bm)[(_n) >> 5] & (1 << ((_n) & 31)))) 74 75 /* 判断一个seq num是否在发送窗口内 */ 76 #define hmac_baw_within(_start, _bawsz, _seqno) ((((_seqno) - (_start)) & 4095) < (_bawsz)) 77 78 79 typedef struct hmac_filter_serv_info_stru { 80 oal_netbuf_head_stru *netbuf_header; 81 hi_u8 *pen_is_ba_buf; 82 } hmac_filter_serv_info_stru; 83 84 /* **************************************************************************** 85 3 函数声明 86 **************************************************************************** */ 87 hi_u32 hmac_ba_filter_serv(const mac_vap_stru *mac_vap, const hmac_user_stru *hmac_user, 88 const hmac_rx_ctl_stru *cb_ctrl, const mac_ieee80211_frame_stru *frame_hdr, 89 const hmac_filter_serv_info_stru *filter_serv_info); 90 91 hi_u32 hmac_ba_timeout_fn(hi_void *arg); 92 hi_u8 hmac_mgmt_check_set_rx_ba_ok(const hmac_vap_stru *hmac_vap, hmac_ba_rx_stru *ba_rx_info, 93 hmac_device_stru *hmac_dev); 94 95 hi_void hmac_reorder_ba_rx_buffer_bar(hmac_vap_stru *hmac_vap, hmac_user_stru *hmac_user, hi_u8 tidno, 96 hi_u16 us_start_seq_num, hi_u8 *puc_sa_addr); 97 hi_void hmac_ba_reset_rx_handle(hmac_ba_rx_stru **rx_ba, hi_u8 tid); 98 hi_void hmac_ba_reset_tx_handle(hmac_ba_tx_stru **tx_ba); 99 hi_void hmac_up_rx_bar(hmac_vap_stru *hmac_vap, const hmac_rx_ctl_stru *rx_ctl); 100 hi_u8 hmac_is_device_ba_setup(hi_void); 101 102 hi_u32 hmac_create_ba_event(frw_event_mem_stru *event_mem); 103 hi_u32 hmac_del_ba_event(frw_event_mem_stru *event_mem); 104 hi_void hmac_ba_update_rx_bitmap(const hmac_user_stru *hmac_user, const mac_ieee80211_frame_stru *frame_hdr); 105 106 #ifdef __cplusplus 107 #if __cplusplus 108 } 109 #endif 110 #endif 111 112 #endif /* end of dmac_blockack.h */ 113