xref: /linux/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.h (revision 26fbb4c8c7c3ee9a4c3b4de555a8587b5a19154e)
1 /*
2  * NXP Wireless LAN device driver: 802.11n RX Re-ordering
3  *
4  * Copyright 2011-2020 NXP
5  *
6  * This software file (the "File") is distributed by NXP
7  * under the terms of the GNU General Public License Version 2, June 1991
8  * (the "License").  You may use, redistribute and/or modify this File in
9  * accordance with the terms and conditions of the License, a copy of which
10  * is available by writing to the Free Software Foundation, Inc.,
11  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12  * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13  *
14  * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16  * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
17  * this warranty disclaimer.
18  */
19 
20 #ifndef _MWIFIEX_11N_RXREORDER_H_
21 #define _MWIFIEX_11N_RXREORDER_H_
22 
23 #define MIN_FLUSH_TIMER_MS		50
24 #define MIN_FLUSH_TIMER_15_MS		15
25 #define MWIFIEX_BA_WIN_SIZE_32		32
26 
27 #define PKT_TYPE_BAR 0xE7
28 #define MAX_TID_VALUE			(2 << 11)
29 #define TWOPOW11			(2 << 10)
30 
31 #define BLOCKACKPARAM_TID_POS		2
32 #define BLOCKACKPARAM_AMSDU_SUPP_MASK	0x1
33 #define BLOCKACKPARAM_WINSIZE_POS	6
34 #define DELBA_TID_POS			12
35 #define DELBA_INITIATOR_POS		11
36 #define TYPE_DELBA_SENT			1
37 #define TYPE_DELBA_RECEIVE		2
38 #define IMMEDIATE_BLOCK_ACK		0x2
39 
40 #define ADDBA_RSP_STATUS_ACCEPT 0
41 
42 #define MWIFIEX_DEF_11N_RX_SEQ_NUM	0xffff
43 #define BA_SETUP_MAX_PACKET_THRESHOLD	16
44 #define BA_SETUP_PACKET_OFFSET		16
45 
46 enum mwifiex_rxreor_flags {
47 	RXREOR_FORCE_NO_DROP		= 1<<0,
48 	RXREOR_INIT_WINDOW_SHIFT	= 1<<1,
49 };
50 
51 static inline void mwifiex_reset_11n_rx_seq_num(struct mwifiex_private *priv)
52 {
53 	memset(priv->rx_seq, 0xff, sizeof(priv->rx_seq));
54 }
55 
56 int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *,
57 			       u16 seqNum,
58 			       u16 tid, u8 *ta,
59 			       u8 pkttype, void *payload);
60 void mwifiex_del_ba_tbl(struct mwifiex_private *priv, int Tid,
61 			u8 *PeerMACAddr, u8 type, int initiator);
62 void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv,
63 				   struct host_cmd_ds_11n_batimeout *event);
64 int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
65 			       struct host_cmd_ds_command
66 			       *resp);
67 int mwifiex_cmd_11n_delba(struct host_cmd_ds_command *cmd,
68 			  void *data_buf);
69 int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
70 				  struct host_cmd_ds_command *cmd,
71 				  struct host_cmd_ds_11n_addba_req
72 				  *cmd_addba_req);
73 int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd,
74 			      void *data_buf);
75 void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv);
76 struct mwifiex_rx_reorder_tbl *mwifiex_11n_get_rxreorder_tbl(struct
77 							   mwifiex_private
78 							   *priv, int tid,
79 							   u8 *ta);
80 struct mwifiex_rx_reorder_tbl *
81 mwifiex_11n_get_rx_reorder_tbl(struct mwifiex_private *priv, int tid, u8 *ta);
82 void mwifiex_11n_del_rx_reorder_tbl_by_ta(struct mwifiex_private *priv, u8 *ta);
83 void mwifiex_update_rxreor_flags(struct mwifiex_adapter *adapter, u8 flags);
84 void mwifiex_11n_rxba_sync_event(struct mwifiex_private *priv,
85 				 u8 *event_buf, u16 len);
86 #endif /* _MWIFIEX_11N_RXREORDER_H_ */
87