1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * NXP Wireless LAN device driver: 802.11n RX Re-ordering
4  *
5  * Copyright 2011-2020 NXP
6  */
7 
8 #ifndef _MWIFIEX_11N_RXREORDER_H_
9 #define _MWIFIEX_11N_RXREORDER_H_
10 
11 #define MIN_FLUSH_TIMER_MS		50
12 #define MIN_FLUSH_TIMER_15_MS		15
13 #define MWIFIEX_BA_WIN_SIZE_32		32
14 
15 #define PKT_TYPE_BAR 0xE7
16 #define MAX_TID_VALUE			(2 << 11)
17 #define TWOPOW11			(2 << 10)
18 
19 #define BLOCKACKPARAM_TID_POS		2
20 #define BLOCKACKPARAM_AMSDU_SUPP_MASK	0x1
21 #define BLOCKACKPARAM_WINSIZE_POS	6
22 #define DELBA_TID_POS			12
23 #define DELBA_INITIATOR_POS		11
24 #define TYPE_DELBA_SENT			1
25 #define TYPE_DELBA_RECEIVE		2
26 #define IMMEDIATE_BLOCK_ACK		0x2
27 
28 #define ADDBA_RSP_STATUS_ACCEPT 0
29 
30 #define MWIFIEX_DEF_11N_RX_SEQ_NUM	0xffff
31 #define BA_SETUP_MAX_PACKET_THRESHOLD	16
32 #define BA_SETUP_PACKET_OFFSET		16
33 
34 enum mwifiex_rxreor_flags {
35 	RXREOR_FORCE_NO_DROP		= 1<<0,
36 	RXREOR_INIT_WINDOW_SHIFT	= 1<<1,
37 };
38 
39 static inline void mwifiex_reset_11n_rx_seq_num(struct mwifiex_private *priv)
40 {
41 	memset(priv->rx_seq, 0xff, sizeof(priv->rx_seq));
42 }
43 
44 int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *,
45 			       u16 seqNum,
46 			       u16 tid, u8 *ta,
47 			       u8 pkttype, void *payload);
48 void mwifiex_del_ba_tbl(struct mwifiex_private *priv, int Tid,
49 			u8 *PeerMACAddr, u8 type, int initiator);
50 void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv,
51 				   struct host_cmd_ds_11n_batimeout *event);
52 int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
53 			       struct host_cmd_ds_command
54 			       *resp);
55 int mwifiex_cmd_11n_delba(struct host_cmd_ds_command *cmd,
56 			  void *data_buf);
57 int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
58 				  struct host_cmd_ds_command *cmd,
59 				  struct host_cmd_ds_11n_addba_req
60 				  *cmd_addba_req);
61 int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd,
62 			      void *data_buf);
63 void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv);
64 struct mwifiex_rx_reorder_tbl *mwifiex_11n_get_rxreorder_tbl(struct
65 							   mwifiex_private
66 							   *priv, int tid,
67 							   u8 *ta);
68 struct mwifiex_rx_reorder_tbl *
69 mwifiex_11n_get_rx_reorder_tbl(struct mwifiex_private *priv, int tid, u8 *ta);
70 void mwifiex_11n_del_rx_reorder_tbl_by_ta(struct mwifiex_private *priv, u8 *ta);
71 void mwifiex_update_rxreor_flags(struct mwifiex_adapter *adapter, u8 flags);
72 void mwifiex_11n_rxba_sync_event(struct mwifiex_private *priv,
73 				 u8 *event_buf, u16 len);
74 #endif /* _MWIFIEX_11N_RXREORDER_H_ */
75