xref: /linux/drivers/net/wireless/nxp/nxpwifi/11ax.h (revision 91ec2035134982b98fab0609a9fd8480e8217dc1)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * nxpwifi: 802.11ax support
4  *
5  * Copyright 2011-2024 NXP
6  */
7 
8 #ifndef _NXPWIFI_11AX_H_
9 #define _NXPWIFI_11AX_H_
10 
11 /* device support 2.4G 40MHZ */
12 #define AX_2G_40MHZ_SUPPORT BIT(1)
13 /* device support 2.4G 242 tone RUs */
14 #define AX_2G_20MHZ_SUPPORT BIT(5)
15 
16 /* Get HE MCS map code for n spatial streams (0..3). */
17 static inline u16
nxpwifi_get_he_nss_mcs(__le16 mcs_map_set,int nss)18 nxpwifi_get_he_nss_mcs(__le16 mcs_map_set, int nss) {
19 	return ((le16_to_cpu(mcs_map_set) >> (2 * (nss - 1))) & 0x3);
20 }
21 
22 static inline void
nxpwifi_set_he_nss_mcs(__le16 * mcs_map_set,int nss,int value)23 nxpwifi_set_he_nss_mcs(__le16 *mcs_map_set, int nss, int value) {
24 	u16 temp;
25 
26 	temp = le16_to_cpu(*mcs_map_set);
27 	temp |= ((value & 0x3) << (2 * (nss - 1)));
28 	*mcs_map_set = cpu_to_le16(temp);
29 }
30 
31 bool nxpwifi_is_11ax_twt_supported(struct nxpwifi_private *priv,
32 				   struct  nxpwifi_bssdescriptor *bss_desc);
33 
34 void nxpwifi_update_11ax_cap(struct nxpwifi_adapter *adapter,
35 			     struct hw_spec_extension *hw_he_cap);
36 
37 bool nxpwifi_11ax_bandconfig_allowed(struct nxpwifi_private *priv,
38 				     struct nxpwifi_bssdescriptor *bss_desc);
39 
40 int nxpwifi_cmd_append_11ax_tlv(struct nxpwifi_private *priv,
41 				struct nxpwifi_bssdescriptor *bss_desc,
42 				u8 **buffer);
43 
44 int nxpwifi_fill_he_cap_tlv(struct nxpwifi_private *priv,
45 			    struct nxpwifi_ie_types_he_cap *he_cap,
46 			    u16 bands);
47 int nxpwifi_cmd_11ax_cfg(struct nxpwifi_private *priv,
48 			 struct host_cmd_ds_command *cmd, u16 cmd_action,
49 			 struct nxpwifi_11ax_he_cfg *ax_cfg);
50 
51 int nxpwifi_ret_11ax_cfg(struct nxpwifi_private *priv,
52 			 struct host_cmd_ds_command *resp,
53 			 struct nxpwifi_11ax_he_cfg *ax_cfg);
54 
55 int nxpwifi_cmd_11ax_cmd(struct nxpwifi_private *priv,
56 			 struct host_cmd_ds_command *cmd, u16 cmd_action,
57 			 struct nxpwifi_11ax_cmd_cfg *ax_cmd);
58 
59 int nxpwifi_ret_11ax_cmd(struct nxpwifi_private *priv,
60 			 struct host_cmd_ds_command *resp,
61 			 struct nxpwifi_11ax_cmd_cfg *ax_cmd);
62 
63 int nxpwifi_cmd_twt_cfg(struct nxpwifi_private *priv,
64 			struct host_cmd_ds_command *cmd, u16 cmd_action,
65 			struct nxpwifi_twt_cfg *twt_cfg);
66 
67 int nxpwifi_ret_twt_cfg(struct nxpwifi_private *priv,
68 			struct host_cmd_ds_command *resp,
69 			struct nxpwifi_twt_cfg *twt_cfg);
70 
71 u8 nxpwifi_is_sta_11ax_twt_req_supported(struct nxpwifi_private *priv);
72 
73 #endif /* _NXPWIFI_11AX_H_ */
74