xref: /linux/drivers/net/wireless/nxp/nxpwifi/11n_rxreorder.h (revision 91ec2035134982b98fab0609a9fd8480e8217dc1)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * NXP Wireless LAN device driver: 802.11n RX Re-ordering
4  *
5  * Copyright 2011-2024 NXP
6  */
7 
8 #ifndef _NXPWIFI_11N_RXREORDER_H_
9 #define _NXPWIFI_11N_RXREORDER_H_
10 
11 #define MIN_FLUSH_TIMER_MS		50
12 #define MIN_FLUSH_TIMER_15_MS		15
13 #define NXPWIFI_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_WINSIZE_POS	6
21 #define DELBA_TID_POS			12
22 #define DELBA_INITIATOR_POS		11
23 #define TYPE_DELBA_SENT			1
24 #define TYPE_DELBA_RECEIVE		2
25 #define IMMEDIATE_BLOCK_ACK		0x2
26 
27 #define ADDBA_RSP_STATUS_ACCEPT 0
28 
29 #define NXPWIFI_DEF_11N_RX_SEQ_NUM	0xffff
30 #define BA_SETUP_MAX_PACKET_THRESHOLD	16
31 #define BA_SETUP_PACKET_OFFSET		16
32 
33 enum nxpwifi_rxreor_flags {
34 	RXREOR_FORCE_NO_DROP		= 1 << 0,
35 	RXREOR_INIT_WINDOW_SHIFT	= 1 << 1,
36 };
37 
nxpwifi_reset_11n_rx_seq_num(struct nxpwifi_private * priv)38 static inline void nxpwifi_reset_11n_rx_seq_num(struct nxpwifi_private *priv)
39 {
40 	memset(priv->rx_seq, 0xff, sizeof(priv->rx_seq));
41 }
42 
43 int nxpwifi_11n_rx_reorder_pkt(struct nxpwifi_private *priv,
44 			       u16 seq_num,
45 			       u16 tid, u8 *ta,
46 			       u8 pkttype, void *payload);
47 void nxpwifi_del_ba_tbl(struct nxpwifi_private *priv, int tid,
48 			u8 *peer_mac, u8 type, int initiator);
49 void nxpwifi_11n_ba_stream_timeout(struct nxpwifi_private *priv,
50 				   struct host_cmd_ds_11n_batimeout *event);
51 int nxpwifi_ret_11n_addba_resp(struct nxpwifi_private *priv,
52 			       struct host_cmd_ds_command
53 			       *resp);
54 int nxpwifi_cmd_11n_delba(struct host_cmd_ds_command *cmd,
55 			  void *data_buf);
56 int nxpwifi_cmd_11n_addba_rsp_gen(struct nxpwifi_private *priv,
57 				  struct host_cmd_ds_command *cmd,
58 				  struct host_cmd_ds_11n_addba_req
59 				  *cmd_addba_req);
60 int nxpwifi_cmd_11n_addba_req(struct host_cmd_ds_command *cmd,
61 			      void *data_buf);
62 void nxpwifi_11n_cleanup_reorder_tbl(struct nxpwifi_private *priv);
63 struct nxpwifi_rx_reorder_tbl *
64 nxpwifi_11n_get_rxreorder_tbl(struct nxpwifi_private *priv, int tid, u8 *ta);
65 struct nxpwifi_rx_reorder_tbl *
66 nxpwifi_11n_get_rx_reorder_tbl(struct nxpwifi_private *priv, int tid, u8 *ta);
67 void nxpwifi_11n_del_rx_reorder_tbl_by_ta(struct nxpwifi_private *priv, u8 *ta);
68 void nxpwifi_update_rxreor_flags(struct nxpwifi_adapter *adapter, u8 flags);
69 void nxpwifi_11n_rxba_sync_event(struct nxpwifi_private *priv,
70 				 u8 *event_buf, u16 len);
71 #endif /* _NXPWIFI_11N_RXREORDER_H_ */
72