1 /*
2  * Marvell Wireless LAN device driver: Firmware specific macros & structures
3  *
4  * Copyright (C) 2011-2014, Marvell International Ltd.
5  *
6  * This software file (the "File") is distributed by Marvell International
7  * Ltd. 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_FW_H_
21 #define _MWIFIEX_FW_H_
22 
23 #include <linux/if_ether.h>
24 
25 
26 #define INTF_HEADER_LEN     4
27 
28 struct rfc_1042_hdr {
29 	u8 llc_dsap;
30 	u8 llc_ssap;
31 	u8 llc_ctrl;
32 	u8 snap_oui[3];
33 	__be16 snap_type;
34 };
35 
36 struct rx_packet_hdr {
37 	struct ethhdr eth803_hdr;
38 	struct rfc_1042_hdr rfc1042_hdr;
39 };
40 
41 struct tx_packet_hdr {
42 	struct ethhdr eth803_hdr;
43 	struct rfc_1042_hdr rfc1042_hdr;
44 };
45 
46 #define B_SUPPORTED_RATES               5
47 #define G_SUPPORTED_RATES               9
48 #define BG_SUPPORTED_RATES              13
49 #define A_SUPPORTED_RATES               9
50 #define HOSTCMD_SUPPORTED_RATES         14
51 #define N_SUPPORTED_RATES               3
52 #define ALL_802_11_BANDS           (BAND_A | BAND_B | BAND_G | BAND_GN | \
53 				    BAND_AN | BAND_AAC)
54 
55 #define FW_MULTI_BANDS_SUPPORT  (BIT(8) | BIT(9) | BIT(10) | BIT(11) | \
56 				 BIT(13))
57 #define IS_SUPPORT_MULTI_BANDS(adapter)        \
58 	(adapter->fw_cap_info & FW_MULTI_BANDS_SUPPORT)
59 
60 /* bit 13: 11ac BAND_AAC
61  * bit 12: reserved for lab testing, will be reused for BAND_AN
62  * bit 11: 11n  BAND_GN
63  * bit 10: 11a  BAND_A
64  * bit 9: 11g   BAND_G
65  * bit 8: 11b   BAND_B
66  * Map these bits to band capability by right shifting 8 bits.
67  */
68 #define GET_FW_DEFAULT_BANDS(adapter)  \
69 	    (((adapter->fw_cap_info & 0x2f00) >> 8) & \
70 	     ALL_802_11_BANDS)
71 
72 #define HostCmd_WEP_KEY_INDEX_MASK              0x3fff
73 
74 #define KEY_INFO_ENABLED        0x01
75 enum KEY_TYPE_ID {
76 	KEY_TYPE_ID_WEP = 0,
77 	KEY_TYPE_ID_TKIP,
78 	KEY_TYPE_ID_AES,
79 	KEY_TYPE_ID_WAPI,
80 	KEY_TYPE_ID_AES_CMAC,
81 };
82 
83 #define WPA_PN_SIZE		8
84 #define KEY_PARAMS_FIXED_LEN	10
85 #define KEY_INDEX_MASK		0xf
86 #define KEY_API_VER_MAJOR_V2	2
87 
88 #define KEY_MCAST	BIT(0)
89 #define KEY_UNICAST	BIT(1)
90 #define KEY_ENABLED	BIT(2)
91 #define KEY_DEFAULT	BIT(3)
92 #define KEY_TX_KEY	BIT(4)
93 #define KEY_RX_KEY	BIT(5)
94 #define KEY_IGTK	BIT(10)
95 
96 #define WAPI_KEY_LEN			(WLAN_KEY_LEN_SMS4 + PN_LEN + 2)
97 
98 #define MAX_POLL_TRIES			100
99 #define MAX_FIRMWARE_POLL_TRIES			100
100 
101 #define FIRMWARE_READY_SDIO				0xfedc
102 #define FIRMWARE_READY_PCIE				0xfedcba00
103 
104 #define MWIFIEX_COEX_MODE_TIMESHARE			0x01
105 #define MWIFIEX_COEX_MODE_SPATIAL			0x82
106 
107 enum mwifiex_usb_ep {
108 	MWIFIEX_USB_EP_CMD_EVENT = 1,
109 	MWIFIEX_USB_EP_DATA = 2,
110 	MWIFIEX_USB_EP_DATA_CH2 = 3,
111 };
112 
113 enum MWIFIEX_802_11_PRIVACY_FILTER {
114 	MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL,
115 	MWIFIEX_802_11_PRIV_FILTER_8021X_WEP
116 };
117 
118 #define CAL_SNR(RSSI, NF)		((s16)((s16)(RSSI)-(s16)(NF)))
119 #define CAL_RSSI(SNR, NF)		((s16)((s16)(SNR)+(s16)(NF)))
120 
121 #define UAP_BSS_PARAMS_I			0
122 #define UAP_CUSTOM_IE_I				1
123 #define MWIFIEX_AUTO_IDX_MASK			0xffff
124 #define MWIFIEX_DELETE_MASK			0x0000
125 #define MGMT_MASK_ASSOC_REQ			0x01
126 #define MGMT_MASK_REASSOC_REQ			0x04
127 #define MGMT_MASK_ASSOC_RESP			0x02
128 #define MGMT_MASK_REASSOC_RESP			0x08
129 #define MGMT_MASK_PROBE_REQ			0x10
130 #define MGMT_MASK_PROBE_RESP			0x20
131 #define MGMT_MASK_BEACON			0x100
132 
133 #define TLV_TYPE_UAP_SSID			0x0000
134 #define TLV_TYPE_UAP_RATES			0x0001
135 #define TLV_TYPE_PWR_CONSTRAINT			0x0020
136 
137 #define PROPRIETARY_TLV_BASE_ID                 0x0100
138 #define TLV_TYPE_KEY_MATERIAL       (PROPRIETARY_TLV_BASE_ID + 0)
139 #define TLV_TYPE_CHANLIST           (PROPRIETARY_TLV_BASE_ID + 1)
140 #define TLV_TYPE_NUMPROBES          (PROPRIETARY_TLV_BASE_ID + 2)
141 #define TLV_TYPE_RSSI_LOW           (PROPRIETARY_TLV_BASE_ID + 4)
142 #define TLV_TYPE_PASSTHROUGH        (PROPRIETARY_TLV_BASE_ID + 10)
143 #define TLV_TYPE_WMMQSTATUS         (PROPRIETARY_TLV_BASE_ID + 16)
144 #define TLV_TYPE_WILDCARDSSID       (PROPRIETARY_TLV_BASE_ID + 18)
145 #define TLV_TYPE_TSFTIMESTAMP       (PROPRIETARY_TLV_BASE_ID + 19)
146 #define TLV_TYPE_RSSI_HIGH          (PROPRIETARY_TLV_BASE_ID + 22)
147 #define TLV_TYPE_AUTH_TYPE          (PROPRIETARY_TLV_BASE_ID + 31)
148 #define TLV_TYPE_STA_MAC_ADDR       (PROPRIETARY_TLV_BASE_ID + 32)
149 #define TLV_TYPE_BSSID              (PROPRIETARY_TLV_BASE_ID + 35)
150 #define TLV_TYPE_CHANNELBANDLIST    (PROPRIETARY_TLV_BASE_ID + 42)
151 #define TLV_TYPE_UAP_BEACON_PERIOD  (PROPRIETARY_TLV_BASE_ID + 44)
152 #define TLV_TYPE_UAP_DTIM_PERIOD    (PROPRIETARY_TLV_BASE_ID + 45)
153 #define TLV_TYPE_UAP_BCAST_SSID     (PROPRIETARY_TLV_BASE_ID + 48)
154 #define TLV_TYPE_UAP_RTS_THRESHOLD  (PROPRIETARY_TLV_BASE_ID + 51)
155 #define TLV_TYPE_UAP_AO_TIMER       (PROPRIETARY_TLV_BASE_ID + 57)
156 #define TLV_TYPE_UAP_WEP_KEY        (PROPRIETARY_TLV_BASE_ID + 59)
157 #define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 60)
158 #define TLV_TYPE_UAP_ENCRY_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 64)
159 #define TLV_TYPE_UAP_AKMP           (PROPRIETARY_TLV_BASE_ID + 65)
160 #define TLV_TYPE_UAP_FRAG_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 70)
161 #define TLV_TYPE_RATE_DROP_CONTROL  (PROPRIETARY_TLV_BASE_ID + 82)
162 #define TLV_TYPE_RATE_SCOPE         (PROPRIETARY_TLV_BASE_ID + 83)
163 #define TLV_TYPE_POWER_GROUP        (PROPRIETARY_TLV_BASE_ID + 84)
164 #define TLV_TYPE_BSS_SCAN_RSP       (PROPRIETARY_TLV_BASE_ID + 86)
165 #define TLV_TYPE_BSS_SCAN_INFO      (PROPRIETARY_TLV_BASE_ID + 87)
166 #define TLV_TYPE_CHANRPT_11H_BASIC  (PROPRIETARY_TLV_BASE_ID + 91)
167 #define TLV_TYPE_UAP_RETRY_LIMIT    (PROPRIETARY_TLV_BASE_ID + 93)
168 #define TLV_TYPE_WAPI_IE            (PROPRIETARY_TLV_BASE_ID + 94)
169 #define TLV_TYPE_ROBUST_COEX        (PROPRIETARY_TLV_BASE_ID + 96)
170 #define TLV_TYPE_UAP_MGMT_FRAME     (PROPRIETARY_TLV_BASE_ID + 104)
171 #define TLV_TYPE_MGMT_IE            (PROPRIETARY_TLV_BASE_ID + 105)
172 #define TLV_TYPE_AUTO_DS_PARAM      (PROPRIETARY_TLV_BASE_ID + 113)
173 #define TLV_TYPE_PS_PARAM           (PROPRIETARY_TLV_BASE_ID + 114)
174 #define TLV_TYPE_UAP_PS_AO_TIMER    (PROPRIETARY_TLV_BASE_ID + 123)
175 #define TLV_TYPE_PWK_CIPHER         (PROPRIETARY_TLV_BASE_ID + 145)
176 #define TLV_TYPE_GWK_CIPHER         (PROPRIETARY_TLV_BASE_ID + 146)
177 #define TLV_TYPE_TX_PAUSE           (PROPRIETARY_TLV_BASE_ID + 148)
178 #define TLV_TYPE_COALESCE_RULE      (PROPRIETARY_TLV_BASE_ID + 154)
179 #define TLV_TYPE_KEY_PARAM_V2       (PROPRIETARY_TLV_BASE_ID + 156)
180 #define TLV_TYPE_MULTI_CHAN_INFO    (PROPRIETARY_TLV_BASE_ID + 183)
181 #define TLV_TYPE_MC_GROUP_INFO      (PROPRIETARY_TLV_BASE_ID + 184)
182 #define TLV_TYPE_TDLS_IDLE_TIMEOUT  (PROPRIETARY_TLV_BASE_ID + 194)
183 #define TLV_TYPE_SCAN_CHANNEL_GAP   (PROPRIETARY_TLV_BASE_ID + 197)
184 #define TLV_TYPE_API_REV            (PROPRIETARY_TLV_BASE_ID + 199)
185 #define TLV_TYPE_CHANNEL_STATS      (PROPRIETARY_TLV_BASE_ID + 198)
186 #define TLV_BTCOEX_WL_AGGR_WINSIZE  (PROPRIETARY_TLV_BASE_ID + 202)
187 #define TLV_BTCOEX_WL_SCANTIME      (PROPRIETARY_TLV_BASE_ID + 203)
188 #define TLV_TYPE_BSS_MODE           (PROPRIETARY_TLV_BASE_ID + 206)
189 
190 #define MWIFIEX_TX_DATA_BUF_SIZE_2K        2048
191 
192 #define SSN_MASK         0xfff0
193 
194 #define BA_RESULT_SUCCESS        0x0
195 #define BA_RESULT_TIMEOUT        0x2
196 
197 #define IS_BASTREAM_SETUP(ptr)  (ptr->ba_status)
198 
199 #define BA_STREAM_NOT_ALLOWED   0xff
200 
201 #define IS_11N_ENABLED(priv) ((priv->adapter->config_bands & BAND_GN || \
202 			priv->adapter->config_bands & BAND_AN) && \
203 			priv->curr_bss_params.bss_descriptor.bcn_ht_cap)
204 #define INITIATOR_BIT(DelBAParamSet) (((DelBAParamSet) &\
205 			BIT(DELBA_INITIATOR_POS)) >> DELBA_INITIATOR_POS)
206 
207 #define MWIFIEX_TX_DATA_BUF_SIZE_4K        4096
208 #define MWIFIEX_TX_DATA_BUF_SIZE_8K        8192
209 
210 #define ISSUPP_11NENABLED(FwCapInfo) (FwCapInfo & BIT(11))
211 #define ISSUPP_TDLS_ENABLED(FwCapInfo) (FwCapInfo & BIT(14))
212 #define ISSUPP_DRCS_ENABLED(FwCapInfo) (FwCapInfo & BIT(15))
213 #define ISSUPP_SDIO_SPA_ENABLED(FwCapInfo) (FwCapInfo & BIT(16))
214 
215 #define MWIFIEX_DEF_HT_CAP	(IEEE80211_HT_CAP_DSSSCCK40 | \
216 				 (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT) | \
217 				 IEEE80211_HT_CAP_SM_PS)
218 
219 #define MWIFIEX_DEF_11N_TX_BF_CAP	0x09E1E008
220 
221 #define MWIFIEX_DEF_AMPDU	IEEE80211_HT_AMPDU_PARM_FACTOR
222 
223 #define GET_RXSTBC(x) (x & IEEE80211_HT_CAP_RX_STBC)
224 #define MWIFIEX_RX_STBC1	0x0100
225 #define MWIFIEX_RX_STBC12	0x0200
226 #define MWIFIEX_RX_STBC123	0x0300
227 
228 /* dev_cap bitmap
229  * BIT
230  * 0-16		reserved
231  * 17		IEEE80211_HT_CAP_SUP_WIDTH_20_40
232  * 18-22	reserved
233  * 23		IEEE80211_HT_CAP_SGI_20
234  * 24		IEEE80211_HT_CAP_SGI_40
235  * 25		IEEE80211_HT_CAP_TX_STBC
236  * 26		IEEE80211_HT_CAP_RX_STBC
237  * 27-28	reserved
238  * 29		IEEE80211_HT_CAP_GRN_FLD
239  * 30-31	reserved
240  */
241 #define ISSUPP_CHANWIDTH40(Dot11nDevCap) (Dot11nDevCap & BIT(17))
242 #define ISSUPP_SHORTGI20(Dot11nDevCap) (Dot11nDevCap & BIT(23))
243 #define ISSUPP_SHORTGI40(Dot11nDevCap) (Dot11nDevCap & BIT(24))
244 #define ISSUPP_TXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(25))
245 #define ISSUPP_RXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(26))
246 #define ISSUPP_GREENFIELD(Dot11nDevCap) (Dot11nDevCap & BIT(29))
247 #define ISENABLED_40MHZ_INTOLERANT(Dot11nDevCap) (Dot11nDevCap & BIT(8))
248 #define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22))
249 #define ISSUPP_BEAMFORMING(Dot11nDevCap) (Dot11nDevCap & BIT(30))
250 #define ISALLOWED_CHANWIDTH40(ht_param) (ht_param & BIT(2))
251 #define GETSUPP_TXBASTREAMS(Dot11nDevCap) ((Dot11nDevCap >> 18) & 0xF)
252 
253 /* httxcfg bitmap
254  * 0		reserved
255  * 1		20/40 Mhz enable(1)/disable(0)
256  * 2-3		reserved
257  * 4		green field enable(1)/disable(0)
258  * 5		short GI in 20 Mhz enable(1)/disable(0)
259  * 6		short GI in 40 Mhz enable(1)/disable(0)
260  * 7-15		reserved
261  */
262 #define MWIFIEX_FW_DEF_HTTXCFG (BIT(1) | BIT(4) | BIT(5) | BIT(6))
263 
264 /* 11AC Tx and Rx MCS map for 1x1 mode:
265  * IEEE80211_VHT_MCS_SUPPORT_0_9 for stream 1
266  * IEEE80211_VHT_MCS_NOT_SUPPORTED for remaining 7 streams
267  */
268 #define MWIFIEX_11AC_MCS_MAP_1X1	0xfffefffe
269 
270 /* 11AC Tx and Rx MCS map for 2x2 mode:
271  * IEEE80211_VHT_MCS_SUPPORT_0_9 for stream 1 and 2
272  * IEEE80211_VHT_MCS_NOT_SUPPORTED for remaining 6 streams
273  */
274 #define MWIFIEX_11AC_MCS_MAP_2X2	0xfffafffa
275 
276 #define GET_RXMCSSUPP(DevMCSSupported) (DevMCSSupported & 0x0f)
277 #define SETHT_MCS32(x) (x[4] |= 1)
278 #define HT_STREAM_1X1	0x11
279 #define HT_STREAM_2X2	0x22
280 
281 #define SET_SECONDARYCHAN(RadioType, SECCHAN) (RadioType |= (SECCHAN << 4))
282 
283 #define LLC_SNAP_LEN    8
284 
285 /* HW_SPEC fw_cap_info */
286 
287 #define ISSUPP_11ACENABLED(fw_cap_info) (fw_cap_info & BIT(13))
288 
289 #define GET_VHTCAP_CHWDSET(vht_cap_info)    ((vht_cap_info >> 2) & 0x3)
290 #define GET_VHTNSSMCS(mcs_mapset, nss) ((mcs_mapset >> (2 * (nss - 1))) & 0x3)
291 #define SET_VHTNSSMCS(mcs_mapset, nss, value) (mcs_mapset |= (value & 0x3) << \
292 					      (2 * (nss - 1)))
293 #define GET_DEVTXMCSMAP(dev_mcs_map)      (dev_mcs_map >> 16)
294 #define GET_DEVRXMCSMAP(dev_mcs_map)      (dev_mcs_map & 0xFFFF)
295 
296 /* Clear SU Beanformer, MU beanformer, MU beanformee and
297  * sounding dimensions bits
298  */
299 #define MWIFIEX_DEF_11AC_CAP_BF_RESET_MASK \
300 			(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | \
301 			 IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE | \
302 			 IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE | \
303 			 IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK)
304 
305 #define MOD_CLASS_HR_DSSS       0x03
306 #define MOD_CLASS_OFDM          0x07
307 #define MOD_CLASS_HT            0x08
308 #define HT_BW_20    0
309 #define HT_BW_40    1
310 
311 #define DFS_CHAN_MOVE_TIME      10000
312 
313 #define HostCmd_CMD_GET_HW_SPEC                       0x0003
314 #define HostCmd_CMD_802_11_SCAN                       0x0006
315 #define HostCmd_CMD_802_11_GET_LOG                    0x000b
316 #define HostCmd_CMD_MAC_MULTICAST_ADR                 0x0010
317 #define HostCmd_CMD_802_11_EEPROM_ACCESS              0x0059
318 #define HostCmd_CMD_802_11_ASSOCIATE                  0x0012
319 #define HostCmd_CMD_802_11_SNMP_MIB                   0x0016
320 #define HostCmd_CMD_MAC_REG_ACCESS                    0x0019
321 #define HostCmd_CMD_BBP_REG_ACCESS                    0x001a
322 #define HostCmd_CMD_RF_REG_ACCESS                     0x001b
323 #define HostCmd_CMD_PMIC_REG_ACCESS                   0x00ad
324 #define HostCmd_CMD_RF_TX_PWR                         0x001e
325 #define HostCmd_CMD_RF_ANTENNA                        0x0020
326 #define HostCmd_CMD_802_11_DEAUTHENTICATE             0x0024
327 #define HostCmd_CMD_MAC_CONTROL                       0x0028
328 #define HostCmd_CMD_802_11_AD_HOC_START               0x002b
329 #define HostCmd_CMD_802_11_AD_HOC_JOIN                0x002c
330 #define HostCmd_CMD_802_11_AD_HOC_STOP                0x0040
331 #define HostCmd_CMD_802_11_MAC_ADDRESS                0x004D
332 #define HostCmd_CMD_802_11D_DOMAIN_INFO               0x005b
333 #define HostCmd_CMD_802_11_KEY_MATERIAL               0x005e
334 #define HostCmd_CMD_802_11_BG_SCAN_QUERY              0x006c
335 #define HostCmd_CMD_WMM_GET_STATUS                    0x0071
336 #define HostCmd_CMD_802_11_SUBSCRIBE_EVENT            0x0075
337 #define HostCmd_CMD_802_11_TX_RATE_QUERY              0x007f
338 #define HostCmd_CMD_802_11_IBSS_COALESCING_STATUS     0x0083
339 #define HostCmd_CMD_MEM_ACCESS                        0x0086
340 #define HostCmd_CMD_CFG_DATA                          0x008f
341 #define HostCmd_CMD_VERSION_EXT                       0x0097
342 #define HostCmd_CMD_MEF_CFG                           0x009a
343 #define HostCmd_CMD_RSSI_INFO                         0x00a4
344 #define HostCmd_CMD_FUNC_INIT                         0x00a9
345 #define HostCmd_CMD_FUNC_SHUTDOWN                     0x00aa
346 #define HOST_CMD_APCMD_SYS_RESET                      0x00af
347 #define HostCmd_CMD_UAP_SYS_CONFIG                    0x00b0
348 #define HostCmd_CMD_UAP_BSS_START                     0x00b1
349 #define HostCmd_CMD_UAP_BSS_STOP                      0x00b2
350 #define HOST_CMD_APCMD_STA_LIST                       0x00b3
351 #define HostCmd_CMD_UAP_STA_DEAUTH                    0x00b5
352 #define HostCmd_CMD_11N_CFG                           0x00cd
353 #define HostCmd_CMD_11N_ADDBA_REQ                     0x00ce
354 #define HostCmd_CMD_11N_ADDBA_RSP                     0x00cf
355 #define HostCmd_CMD_11N_DELBA                         0x00d0
356 #define HostCmd_CMD_RECONFIGURE_TX_BUFF               0x00d9
357 #define HostCmd_CMD_CHAN_REPORT_REQUEST               0x00dd
358 #define HostCmd_CMD_AMSDU_AGGR_CTRL                   0x00df
359 #define HostCmd_CMD_TXPWR_CFG                         0x00d1
360 #define HostCmd_CMD_TX_RATE_CFG                       0x00d6
361 #define HostCmd_CMD_ROBUST_COEX                       0x00e0
362 #define HostCmd_CMD_802_11_PS_MODE_ENH                0x00e4
363 #define HostCmd_CMD_802_11_HS_CFG_ENH                 0x00e5
364 #define HostCmd_CMD_P2P_MODE_CFG                      0x00eb
365 #define HostCmd_CMD_CAU_REG_ACCESS                    0x00ed
366 #define HostCmd_CMD_SET_BSS_MODE                      0x00f7
367 #define HostCmd_CMD_PCIE_DESC_DETAILS                 0x00fa
368 #define HostCmd_CMD_802_11_SCAN_EXT                   0x0107
369 #define HostCmd_CMD_COALESCE_CFG                      0x010a
370 #define HostCmd_CMD_MGMT_FRAME_REG                    0x010c
371 #define HostCmd_CMD_REMAIN_ON_CHAN                    0x010d
372 #define HostCmd_CMD_11AC_CFG			      0x0112
373 #define HostCmd_CMD_TDLS_CONFIG                       0x0100
374 #define HostCmd_CMD_MC_POLICY                         0x0121
375 #define HostCmd_CMD_TDLS_OPER                         0x0122
376 #define HostCmd_CMD_SDIO_SP_RX_AGGR_CFG               0x0223
377 
378 #define PROTOCOL_NO_SECURITY        0x01
379 #define PROTOCOL_STATIC_WEP         0x02
380 #define PROTOCOL_WPA                0x08
381 #define PROTOCOL_WPA2               0x20
382 #define PROTOCOL_WPA2_MIXED         0x28
383 #define PROTOCOL_EAP                0x40
384 #define KEY_MGMT_NONE               0x04
385 #define KEY_MGMT_PSK                0x02
386 #define KEY_MGMT_EAP                0x01
387 #define CIPHER_TKIP                 0x04
388 #define CIPHER_AES_CCMP             0x08
389 #define VALID_CIPHER_BITMAP         0x0c
390 
391 enum ENH_PS_MODES {
392 	EN_PS = 1,
393 	DIS_PS = 2,
394 	EN_AUTO_DS = 3,
395 	DIS_AUTO_DS = 4,
396 	SLEEP_CONFIRM = 5,
397 	GET_PS = 0,
398 	EN_AUTO_PS = 0xff,
399 	DIS_AUTO_PS = 0xfe,
400 };
401 
402 enum P2P_MODES {
403 	P2P_MODE_DISABLE = 0,
404 	P2P_MODE_DEVICE = 1,
405 	P2P_MODE_GO = 2,
406 	P2P_MODE_CLIENT = 3,
407 };
408 
409 #define HostCmd_RET_BIT                       0x8000
410 #define HostCmd_ACT_GEN_GET                   0x0000
411 #define HostCmd_ACT_GEN_SET                   0x0001
412 #define HostCmd_ACT_GEN_REMOVE                0x0004
413 #define HostCmd_ACT_BITWISE_SET               0x0002
414 #define HostCmd_ACT_BITWISE_CLR               0x0003
415 #define HostCmd_RESULT_OK                     0x0000
416 
417 #define HostCmd_ACT_MAC_RX_ON                 0x0001
418 #define HostCmd_ACT_MAC_TX_ON                 0x0002
419 #define HostCmd_ACT_MAC_WEP_ENABLE            0x0008
420 #define HostCmd_ACT_MAC_ETHERNETII_ENABLE     0x0010
421 #define HostCmd_ACT_MAC_PROMISCUOUS_ENABLE    0x0080
422 #define HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE  0x0100
423 #define HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON     0x2000
424 
425 #define HostCmd_BSS_MODE_IBSS               0x0002
426 #define HostCmd_BSS_MODE_ANY                0x0003
427 
428 #define HostCmd_SCAN_RADIO_TYPE_BG          0
429 #define HostCmd_SCAN_RADIO_TYPE_A           1
430 
431 #define HS_CFG_CANCEL			0xffffffff
432 #define HS_CFG_COND_DEF			0x00000000
433 #define HS_CFG_GPIO_DEF			0xff
434 #define HS_CFG_GAP_DEF			0xff
435 #define HS_CFG_COND_BROADCAST_DATA	0x00000001
436 #define HS_CFG_COND_UNICAST_DATA	0x00000002
437 #define HS_CFG_COND_MAC_EVENT		0x00000004
438 #define HS_CFG_COND_MULTICAST_DATA	0x00000008
439 
440 #define CONNECT_ERR_AUTH_ERR_STA_FAILURE	0xFFFB
441 #define CONNECT_ERR_ASSOC_ERR_TIMEOUT		0xFFFC
442 #define CONNECT_ERR_ASSOC_ERR_AUTH_REFUSED	0xFFFD
443 #define CONNECT_ERR_AUTH_MSG_UNHANDLED		0xFFFE
444 #define CONNECT_ERR_STA_FAILURE			0xFFFF
445 
446 
447 #define CMD_F_HOSTCMD           (1 << 0)
448 
449 #define HostCmd_CMD_ID_MASK             0x0fff
450 
451 #define HostCmd_SEQ_NUM_MASK            0x00ff
452 
453 #define HostCmd_BSS_NUM_MASK            0x0f00
454 
455 #define HostCmd_BSS_TYPE_MASK           0xf000
456 
457 #define HostCmd_ACT_SET_RX              0x0001
458 #define HostCmd_ACT_SET_TX              0x0002
459 #define HostCmd_ACT_SET_BOTH            0x0003
460 
461 #define RF_ANTENNA_AUTO                 0xFFFF
462 
463 #define HostCmd_SET_SEQ_NO_BSS_INFO(seq, num, type) {   \
464 	(((seq) & 0x00ff) |                             \
465 	 (((num) & 0x000f) << 8)) |                     \
466 	(((type) & 0x000f) << 12);                  }
467 
468 #define HostCmd_GET_SEQ_NO(seq)       \
469 	((seq) & HostCmd_SEQ_NUM_MASK)
470 
471 #define HostCmd_GET_BSS_NO(seq)         \
472 	(((seq) & HostCmd_BSS_NUM_MASK) >> 8)
473 
474 #define HostCmd_GET_BSS_TYPE(seq)       \
475 	(((seq) & HostCmd_BSS_TYPE_MASK) >> 12)
476 
477 #define EVENT_DUMMY_HOST_WAKEUP_SIGNAL  0x00000001
478 #define EVENT_LINK_LOST                 0x00000003
479 #define EVENT_LINK_SENSED               0x00000004
480 #define EVENT_MIB_CHANGED               0x00000006
481 #define EVENT_INIT_DONE                 0x00000007
482 #define EVENT_DEAUTHENTICATED           0x00000008
483 #define EVENT_DISASSOCIATED             0x00000009
484 #define EVENT_PS_AWAKE                  0x0000000a
485 #define EVENT_PS_SLEEP                  0x0000000b
486 #define EVENT_MIC_ERR_MULTICAST         0x0000000d
487 #define EVENT_MIC_ERR_UNICAST           0x0000000e
488 #define EVENT_DEEP_SLEEP_AWAKE          0x00000010
489 #define EVENT_ADHOC_BCN_LOST            0x00000011
490 
491 #define EVENT_WMM_STATUS_CHANGE         0x00000017
492 #define EVENT_BG_SCAN_REPORT            0x00000018
493 #define EVENT_RSSI_LOW                  0x00000019
494 #define EVENT_SNR_LOW                   0x0000001a
495 #define EVENT_MAX_FAIL                  0x0000001b
496 #define EVENT_RSSI_HIGH                 0x0000001c
497 #define EVENT_SNR_HIGH                  0x0000001d
498 #define EVENT_IBSS_COALESCED            0x0000001e
499 #define EVENT_DATA_RSSI_LOW             0x00000024
500 #define EVENT_DATA_SNR_LOW              0x00000025
501 #define EVENT_DATA_RSSI_HIGH            0x00000026
502 #define EVENT_DATA_SNR_HIGH             0x00000027
503 #define EVENT_LINK_QUALITY              0x00000028
504 #define EVENT_PORT_RELEASE              0x0000002b
505 #define EVENT_UAP_STA_DEAUTH            0x0000002c
506 #define EVENT_UAP_STA_ASSOC             0x0000002d
507 #define EVENT_UAP_BSS_START             0x0000002e
508 #define EVENT_PRE_BEACON_LOST           0x00000031
509 #define EVENT_ADDBA                     0x00000033
510 #define EVENT_DELBA                     0x00000034
511 #define EVENT_BA_STREAM_TIEMOUT         0x00000037
512 #define EVENT_AMSDU_AGGR_CTRL           0x00000042
513 #define EVENT_UAP_BSS_IDLE              0x00000043
514 #define EVENT_UAP_BSS_ACTIVE            0x00000044
515 #define EVENT_WEP_ICV_ERR               0x00000046
516 #define EVENT_HS_ACT_REQ                0x00000047
517 #define EVENT_BW_CHANGE                 0x00000048
518 #define EVENT_UAP_MIC_COUNTERMEASURES   0x0000004c
519 #define EVENT_HOSTWAKE_STAIE		0x0000004d
520 #define EVENT_CHANNEL_SWITCH_ANN        0x00000050
521 #define EVENT_TDLS_GENERIC_EVENT        0x00000052
522 #define EVENT_RADAR_DETECTED		0x00000053
523 #define EVENT_CHANNEL_REPORT_RDY        0x00000054
524 #define EVENT_TX_DATA_PAUSE             0x00000055
525 #define EVENT_EXT_SCAN_REPORT           0x00000058
526 #define EVENT_REMAIN_ON_CHAN_EXPIRED    0x0000005f
527 #define EVENT_MULTI_CHAN_INFO           0x0000006a
528 #define EVENT_TX_STATUS_REPORT		0x00000074
529 #define EVENT_BT_COEX_WLAN_PARA_CHANGE	0X00000076
530 
531 #define EVENT_ID_MASK                   0xffff
532 #define BSS_NUM_MASK                    0xf
533 
534 #define EVENT_GET_BSS_NUM(event_cause)          \
535 	(((event_cause) >> 16) & BSS_NUM_MASK)
536 
537 #define EVENT_GET_BSS_TYPE(event_cause)         \
538 	(((event_cause) >> 24) & 0x00ff)
539 
540 #define MWIFIEX_MAX_PATTERN_LEN		40
541 #define MWIFIEX_MAX_OFFSET_LEN		100
542 #define STACK_NBYTES			100
543 #define TYPE_DNUM			1
544 #define TYPE_BYTESEQ			2
545 #define MAX_OPERAND			0x40
546 #define TYPE_EQ				(MAX_OPERAND+1)
547 #define TYPE_EQ_DNUM			(MAX_OPERAND+2)
548 #define TYPE_EQ_BIT			(MAX_OPERAND+3)
549 #define TYPE_AND			(MAX_OPERAND+4)
550 #define TYPE_OR				(MAX_OPERAND+5)
551 #define MEF_MODE_HOST_SLEEP			1
552 #define MEF_ACTION_ALLOW_AND_WAKEUP_HOST	3
553 #define MEF_ACTION_AUTO_ARP                    0x10
554 #define MWIFIEX_CRITERIA_BROADCAST	BIT(0)
555 #define MWIFIEX_CRITERIA_UNICAST	BIT(1)
556 #define MWIFIEX_CRITERIA_MULTICAST	BIT(3)
557 #define MWIFIEX_MAX_SUPPORTED_IPADDR              4
558 
559 #define ACT_TDLS_DELETE            0x00
560 #define ACT_TDLS_CREATE            0x01
561 #define ACT_TDLS_CONFIG            0x02
562 
563 #define TDLS_EVENT_LINK_TEAR_DOWN      3
564 #define TDLS_EVENT_CHAN_SWITCH_RESULT  7
565 #define TDLS_EVENT_START_CHAN_SWITCH   8
566 #define TDLS_EVENT_CHAN_SWITCH_STOPPED 9
567 
568 #define TDLS_BASE_CHANNEL	       0
569 #define TDLS_OFF_CHANNEL	       1
570 
571 #define ACT_TDLS_CS_ENABLE_CONFIG 0x00
572 #define ACT_TDLS_CS_INIT	  0x06
573 #define ACT_TDLS_CS_STOP	  0x07
574 #define ACT_TDLS_CS_PARAMS	  0x08
575 
576 #define MWIFIEX_DEF_CS_UNIT_TIME	2
577 #define MWIFIEX_DEF_CS_THR_OTHERLINK	10
578 #define MWIFIEX_DEF_THR_DIRECTLINK	0
579 #define MWIFIEX_DEF_CS_TIME		10
580 #define MWIFIEX_DEF_CS_TIMEOUT		16
581 #define MWIFIEX_DEF_CS_REG_CLASS	12
582 #define MWIFIEX_DEF_CS_PERIODICITY	1
583 
584 #define MWIFIEX_FW_V15		   15
585 
586 #define MWIFIEX_MASTER_RADAR_DET_MASK BIT(1)
587 
588 struct mwifiex_ie_types_header {
589 	__le16 type;
590 	__le16 len;
591 } __packed;
592 
593 struct mwifiex_ie_types_data {
594 	struct mwifiex_ie_types_header header;
595 	u8 data[1];
596 } __packed;
597 
598 #define MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET 0x01
599 #define MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET 0x08
600 #define MWIFIEX_TXPD_FLAGS_TDLS_PACKET      0x10
601 #define MWIFIEX_RXPD_FLAGS_TDLS_PACKET      0x01
602 #define MWIFIEX_TXPD_FLAGS_REQ_TX_STATUS    0x20
603 
604 struct txpd {
605 	u8 bss_type;
606 	u8 bss_num;
607 	__le16 tx_pkt_length;
608 	__le16 tx_pkt_offset;
609 	__le16 tx_pkt_type;
610 	__le32 tx_control;
611 	u8 priority;
612 	u8 flags;
613 	u8 pkt_delay_2ms;
614 	u8 reserved1[2];
615 	u8 tx_token_id;
616 	u8 reserved[2];
617 } __packed;
618 
619 struct rxpd {
620 	u8 bss_type;
621 	u8 bss_num;
622 	__le16 rx_pkt_length;
623 	__le16 rx_pkt_offset;
624 	__le16 rx_pkt_type;
625 	__le16 seq_num;
626 	u8 priority;
627 	u8 rx_rate;
628 	s8 snr;
629 	s8 nf;
630 
631 	/* For: Non-802.11 AC cards
632 	 *
633 	 * Ht Info [Bit 0] RxRate format: LG=0, HT=1
634 	 * [Bit 1]  HT Bandwidth: BW20 = 0, BW40 = 1
635 	 * [Bit 2]  HT Guard Interval: LGI = 0, SGI = 1
636 	 *
637 	 * For: 802.11 AC cards
638 	 * [Bit 1] [Bit 0] RxRate format: legacy rate = 00 HT = 01 VHT = 10
639 	 * [Bit 3] [Bit 2] HT/VHT Bandwidth BW20 = 00 BW40 = 01
640 	 *						BW80 = 10  BW160 = 11
641 	 * [Bit 4] HT/VHT Guard interval LGI = 0 SGI = 1
642 	 * [Bit 5] STBC support Enabled = 1
643 	 * [Bit 6] LDPC support Enabled = 1
644 	 * [Bit 7] Reserved
645 	 */
646 	u8 ht_info;
647 	u8 reserved[3];
648 	u8 flags;
649 } __packed;
650 
651 struct uap_txpd {
652 	u8 bss_type;
653 	u8 bss_num;
654 	__le16 tx_pkt_length;
655 	__le16 tx_pkt_offset;
656 	__le16 tx_pkt_type;
657 	__le32 tx_control;
658 	u8 priority;
659 	u8 flags;
660 	u8 pkt_delay_2ms;
661 	u8 reserved1[2];
662 	u8 tx_token_id;
663 	u8 reserved[2];
664 };
665 
666 struct uap_rxpd {
667 	u8 bss_type;
668 	u8 bss_num;
669 	__le16 rx_pkt_length;
670 	__le16 rx_pkt_offset;
671 	__le16 rx_pkt_type;
672 	__le16 seq_num;
673 	u8 priority;
674 	u8 rx_rate;
675 	s8 snr;
676 	s8 nf;
677 	u8 ht_info;
678 	u8 reserved[3];
679 	u8 flags;
680 };
681 
682 struct mwifiex_fw_chan_stats {
683 	u8 chan_num;
684 	u8 bandcfg;
685 	u8 flags;
686 	s8 noise;
687 	__le16 total_bss;
688 	__le16 cca_scan_dur;
689 	__le16 cca_busy_dur;
690 } __packed;
691 
692 enum mwifiex_chan_scan_mode_bitmasks {
693 	MWIFIEX_PASSIVE_SCAN = BIT(0),
694 	MWIFIEX_DISABLE_CHAN_FILT = BIT(1),
695 	MWIFIEX_HIDDEN_SSID_REPORT = BIT(4),
696 };
697 
698 struct mwifiex_chan_scan_param_set {
699 	u8 radio_type;
700 	u8 chan_number;
701 	u8 chan_scan_mode_bitmap;
702 	__le16 min_scan_time;
703 	__le16 max_scan_time;
704 } __packed;
705 
706 struct mwifiex_ie_types_chan_list_param_set {
707 	struct mwifiex_ie_types_header header;
708 	struct mwifiex_chan_scan_param_set chan_scan_param[1];
709 } __packed;
710 
711 struct chan_band_param_set {
712 	u8 radio_type;
713 	u8 chan_number;
714 };
715 
716 struct mwifiex_ie_types_chan_band_list_param_set {
717 	struct mwifiex_ie_types_header header;
718 	struct chan_band_param_set chan_band_param[1];
719 } __packed;
720 
721 struct mwifiex_ie_types_rates_param_set {
722 	struct mwifiex_ie_types_header header;
723 	u8 rates[1];
724 } __packed;
725 
726 struct mwifiex_ie_types_ssid_param_set {
727 	struct mwifiex_ie_types_header header;
728 	u8 ssid[1];
729 } __packed;
730 
731 struct mwifiex_ie_types_num_probes {
732 	struct mwifiex_ie_types_header header;
733 	__le16 num_probes;
734 } __packed;
735 
736 struct mwifiex_ie_types_scan_chan_gap {
737 	struct mwifiex_ie_types_header header;
738 	/* time gap in TUs to be used between two consecutive channels scan */
739 	__le16 chan_gap;
740 } __packed;
741 
742 struct mwifiex_ietypes_chanstats {
743 	struct mwifiex_ie_types_header header;
744 	struct mwifiex_fw_chan_stats chanstats[0];
745 } __packed;
746 
747 struct mwifiex_ie_types_wildcard_ssid_params {
748 	struct mwifiex_ie_types_header header;
749 	u8 max_ssid_length;
750 	u8 ssid[1];
751 } __packed;
752 
753 #define TSF_DATA_SIZE            8
754 struct mwifiex_ie_types_tsf_timestamp {
755 	struct mwifiex_ie_types_header header;
756 	u8 tsf_data[1];
757 } __packed;
758 
759 struct mwifiex_cf_param_set {
760 	u8 cfp_cnt;
761 	u8 cfp_period;
762 	__le16 cfp_max_duration;
763 	__le16 cfp_duration_remaining;
764 } __packed;
765 
766 struct mwifiex_ibss_param_set {
767 	__le16 atim_window;
768 } __packed;
769 
770 struct mwifiex_ie_types_ss_param_set {
771 	struct mwifiex_ie_types_header header;
772 	union {
773 		struct mwifiex_cf_param_set cf_param_set[1];
774 		struct mwifiex_ibss_param_set ibss_param_set[1];
775 	} cf_ibss;
776 } __packed;
777 
778 struct mwifiex_fh_param_set {
779 	__le16 dwell_time;
780 	u8 hop_set;
781 	u8 hop_pattern;
782 	u8 hop_index;
783 } __packed;
784 
785 struct mwifiex_ds_param_set {
786 	u8 current_chan;
787 } __packed;
788 
789 struct mwifiex_ie_types_phy_param_set {
790 	struct mwifiex_ie_types_header header;
791 	union {
792 		struct mwifiex_fh_param_set fh_param_set[1];
793 		struct mwifiex_ds_param_set ds_param_set[1];
794 	} fh_ds;
795 } __packed;
796 
797 struct mwifiex_ie_types_auth_type {
798 	struct mwifiex_ie_types_header header;
799 	__le16 auth_type;
800 } __packed;
801 
802 struct mwifiex_ie_types_vendor_param_set {
803 	struct mwifiex_ie_types_header header;
804 	u8 ie[MWIFIEX_MAX_VSIE_LEN];
805 };
806 
807 #define MWIFIEX_TDLS_IDLE_TIMEOUT_IN_SEC	60
808 
809 struct mwifiex_ie_types_tdls_idle_timeout {
810 	struct mwifiex_ie_types_header header;
811 	__le16 value;
812 } __packed;
813 
814 struct mwifiex_ie_types_rsn_param_set {
815 	struct mwifiex_ie_types_header header;
816 	u8 rsn_ie[1];
817 } __packed;
818 
819 #define KEYPARAMSET_FIXED_LEN 6
820 
821 struct mwifiex_ie_type_key_param_set {
822 	__le16 type;
823 	__le16 length;
824 	__le16 key_type_id;
825 	__le16 key_info;
826 	__le16 key_len;
827 	u8 key[50];
828 } __packed;
829 
830 #define IGTK_PN_LEN		8
831 
832 struct mwifiex_cmac_param {
833 	u8 ipn[IGTK_PN_LEN];
834 	u8 key[WLAN_KEY_LEN_AES_CMAC];
835 } __packed;
836 
837 struct mwifiex_wep_param {
838 	__le16 key_len;
839 	u8 key[WLAN_KEY_LEN_WEP104];
840 } __packed;
841 
842 struct mwifiex_tkip_param {
843 	u8 pn[WPA_PN_SIZE];
844 	__le16 key_len;
845 	u8 key[WLAN_KEY_LEN_TKIP];
846 } __packed;
847 
848 struct mwifiex_aes_param {
849 	u8 pn[WPA_PN_SIZE];
850 	__le16 key_len;
851 	u8 key[WLAN_KEY_LEN_CCMP];
852 } __packed;
853 
854 struct mwifiex_wapi_param {
855 	u8 pn[PN_LEN];
856 	__le16 key_len;
857 	u8 key[WLAN_KEY_LEN_SMS4];
858 } __packed;
859 
860 struct mwifiex_cmac_aes_param {
861 	u8 ipn[IGTK_PN_LEN];
862 	__le16 key_len;
863 	u8 key[WLAN_KEY_LEN_AES_CMAC];
864 } __packed;
865 
866 struct mwifiex_ie_type_key_param_set_v2 {
867 	__le16 type;
868 	__le16 len;
869 	u8 mac_addr[ETH_ALEN];
870 	u8 key_idx;
871 	u8 key_type;
872 	__le16 key_info;
873 	union {
874 		struct mwifiex_wep_param wep;
875 		struct mwifiex_tkip_param tkip;
876 		struct mwifiex_aes_param aes;
877 		struct mwifiex_wapi_param wapi;
878 		struct mwifiex_cmac_aes_param cmac_aes;
879 	} key_params;
880 } __packed;
881 
882 struct host_cmd_ds_802_11_key_material_v2 {
883 	__le16 action;
884 	struct mwifiex_ie_type_key_param_set_v2 key_param_set;
885 } __packed;
886 
887 struct host_cmd_ds_802_11_key_material {
888 	__le16 action;
889 	struct mwifiex_ie_type_key_param_set key_param_set;
890 } __packed;
891 
892 struct host_cmd_ds_gen {
893 	__le16 command;
894 	__le16 size;
895 	__le16 seq_num;
896 	__le16 result;
897 };
898 
899 #define S_DS_GEN        sizeof(struct host_cmd_ds_gen)
900 
901 enum sleep_resp_ctrl {
902 	RESP_NOT_NEEDED = 0,
903 	RESP_NEEDED,
904 };
905 
906 struct mwifiex_ps_param {
907 	__le16 null_pkt_interval;
908 	__le16 multiple_dtims;
909 	__le16 bcn_miss_timeout;
910 	__le16 local_listen_interval;
911 	__le16 adhoc_wake_period;
912 	__le16 mode;
913 	__le16 delay_to_ps;
914 };
915 
916 #define BITMAP_AUTO_DS         0x01
917 #define BITMAP_STA_PS          0x10
918 
919 struct mwifiex_ie_types_auto_ds_param {
920 	struct mwifiex_ie_types_header header;
921 	__le16 deep_sleep_timeout;
922 } __packed;
923 
924 struct mwifiex_ie_types_ps_param {
925 	struct mwifiex_ie_types_header header;
926 	struct mwifiex_ps_param param;
927 } __packed;
928 
929 struct host_cmd_ds_802_11_ps_mode_enh {
930 	__le16 action;
931 
932 	union {
933 		struct mwifiex_ps_param opt_ps;
934 		__le16 ps_bitmap;
935 	} params;
936 } __packed;
937 
938 enum API_VER_ID {
939 	KEY_API_VER_ID = 1,
940 	FW_API_VER_ID = 2,
941 };
942 
943 struct hw_spec_api_rev {
944 	struct mwifiex_ie_types_header header;
945 	__le16 api_id;
946 	u8 major_ver;
947 	u8 minor_ver;
948 } __packed;
949 
950 struct host_cmd_ds_get_hw_spec {
951 	__le16 hw_if_version;
952 	__le16 version;
953 	__le16 reserved;
954 	__le16 num_of_mcast_adr;
955 	u8 permanent_addr[ETH_ALEN];
956 	__le16 region_code;
957 	__le16 number_of_antenna;
958 	__le32 fw_release_number;
959 	__le32 reserved_1;
960 	__le32 reserved_2;
961 	__le32 reserved_3;
962 	__le32 fw_cap_info;
963 	__le32 dot_11n_dev_cap;
964 	u8 dev_mcs_support;
965 	__le16 mp_end_port;	/* SDIO only, reserved for other interfacces */
966 	__le16 mgmt_buf_count;	/* mgmt IE buffer count */
967 	__le32 reserved_5;
968 	__le32 reserved_6;
969 	__le32 dot_11ac_dev_cap;
970 	__le32 dot_11ac_mcs_support;
971 	u8 tlvs[0];
972 } __packed;
973 
974 struct host_cmd_ds_802_11_rssi_info {
975 	__le16 action;
976 	__le16 ndata;
977 	__le16 nbcn;
978 	__le16 reserved[9];
979 	long long reserved_1;
980 };
981 
982 struct host_cmd_ds_802_11_rssi_info_rsp {
983 	__le16 action;
984 	__le16 ndata;
985 	__le16 nbcn;
986 	__le16 data_rssi_last;
987 	__le16 data_nf_last;
988 	__le16 data_rssi_avg;
989 	__le16 data_nf_avg;
990 	__le16 bcn_rssi_last;
991 	__le16 bcn_nf_last;
992 	__le16 bcn_rssi_avg;
993 	__le16 bcn_nf_avg;
994 	long long tsf_bcn;
995 };
996 
997 struct host_cmd_ds_802_11_mac_address {
998 	__le16 action;
999 	u8 mac_addr[ETH_ALEN];
1000 };
1001 
1002 struct host_cmd_ds_mac_control {
1003 	__le16 action;
1004 	__le16 reserved;
1005 };
1006 
1007 struct host_cmd_ds_mac_multicast_adr {
1008 	__le16 action;
1009 	__le16 num_of_adrs;
1010 	u8 mac_list[MWIFIEX_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
1011 } __packed;
1012 
1013 struct host_cmd_ds_802_11_deauthenticate {
1014 	u8 mac_addr[ETH_ALEN];
1015 	__le16 reason_code;
1016 } __packed;
1017 
1018 struct host_cmd_ds_802_11_associate {
1019 	u8 peer_sta_addr[ETH_ALEN];
1020 	__le16 cap_info_bitmap;
1021 	__le16 listen_interval;
1022 	__le16 beacon_period;
1023 	u8 dtim_period;
1024 } __packed;
1025 
1026 struct ieee_types_assoc_rsp {
1027 	__le16 cap_info_bitmap;
1028 	__le16 status_code;
1029 	__le16 a_id;
1030 	u8 ie_buffer[1];
1031 } __packed;
1032 
1033 struct host_cmd_ds_802_11_associate_rsp {
1034 	struct ieee_types_assoc_rsp assoc_rsp;
1035 } __packed;
1036 
1037 struct ieee_types_cf_param_set {
1038 	u8 element_id;
1039 	u8 len;
1040 	u8 cfp_cnt;
1041 	u8 cfp_period;
1042 	__le16 cfp_max_duration;
1043 	__le16 cfp_duration_remaining;
1044 } __packed;
1045 
1046 struct ieee_types_ibss_param_set {
1047 	u8 element_id;
1048 	u8 len;
1049 	__le16 atim_window;
1050 } __packed;
1051 
1052 union ieee_types_ss_param_set {
1053 	struct ieee_types_cf_param_set cf_param_set;
1054 	struct ieee_types_ibss_param_set ibss_param_set;
1055 } __packed;
1056 
1057 struct ieee_types_fh_param_set {
1058 	u8 element_id;
1059 	u8 len;
1060 	__le16 dwell_time;
1061 	u8 hop_set;
1062 	u8 hop_pattern;
1063 	u8 hop_index;
1064 } __packed;
1065 
1066 struct ieee_types_ds_param_set {
1067 	u8 element_id;
1068 	u8 len;
1069 	u8 current_chan;
1070 } __packed;
1071 
1072 union ieee_types_phy_param_set {
1073 	struct ieee_types_fh_param_set fh_param_set;
1074 	struct ieee_types_ds_param_set ds_param_set;
1075 } __packed;
1076 
1077 struct ieee_types_oper_mode_ntf {
1078 	u8 element_id;
1079 	u8 len;
1080 	u8 oper_mode;
1081 } __packed;
1082 
1083 struct host_cmd_ds_802_11_ad_hoc_start {
1084 	u8 ssid[IEEE80211_MAX_SSID_LEN];
1085 	u8 bss_mode;
1086 	__le16 beacon_period;
1087 	u8 dtim_period;
1088 	union ieee_types_ss_param_set ss_param_set;
1089 	union ieee_types_phy_param_set phy_param_set;
1090 	u16 reserved1;
1091 	__le16 cap_info_bitmap;
1092 	u8 data_rate[HOSTCMD_SUPPORTED_RATES];
1093 } __packed;
1094 
1095 struct host_cmd_ds_802_11_ad_hoc_start_result {
1096 	u8 pad[3];
1097 	u8 bssid[ETH_ALEN];
1098 	u8 pad2[2];
1099 	u8 result;
1100 } __packed;
1101 
1102 struct host_cmd_ds_802_11_ad_hoc_join_result {
1103 	u8 result;
1104 } __packed;
1105 
1106 struct adhoc_bss_desc {
1107 	u8 bssid[ETH_ALEN];
1108 	u8 ssid[IEEE80211_MAX_SSID_LEN];
1109 	u8 bss_mode;
1110 	__le16 beacon_period;
1111 	u8 dtim_period;
1112 	u8 time_stamp[8];
1113 	u8 local_time[8];
1114 	union ieee_types_phy_param_set phy_param_set;
1115 	union ieee_types_ss_param_set ss_param_set;
1116 	__le16 cap_info_bitmap;
1117 	u8 data_rates[HOSTCMD_SUPPORTED_RATES];
1118 
1119 	/*
1120 	 *  DO NOT ADD ANY FIELDS TO THIS STRUCTURE.
1121 	 *  It is used in the Adhoc join command and will cause a
1122 	 *  binary layout mismatch with the firmware
1123 	 */
1124 } __packed;
1125 
1126 struct host_cmd_ds_802_11_ad_hoc_join {
1127 	struct adhoc_bss_desc bss_descriptor;
1128 	u16 reserved1;
1129 	u16 reserved2;
1130 } __packed;
1131 
1132 struct host_cmd_ds_802_11_get_log {
1133 	__le32 mcast_tx_frame;
1134 	__le32 failed;
1135 	__le32 retry;
1136 	__le32 multi_retry;
1137 	__le32 frame_dup;
1138 	__le32 rts_success;
1139 	__le32 rts_failure;
1140 	__le32 ack_failure;
1141 	__le32 rx_frag;
1142 	__le32 mcast_rx_frame;
1143 	__le32 fcs_error;
1144 	__le32 tx_frame;
1145 	__le32 reserved;
1146 	__le32 wep_icv_err_cnt[4];
1147 	__le32 bcn_rcv_cnt;
1148 	__le32 bcn_miss_cnt;
1149 };
1150 
1151 /* Enumeration for rate format */
1152 enum _mwifiex_rate_format {
1153 	MWIFIEX_RATE_FORMAT_LG = 0,
1154 	MWIFIEX_RATE_FORMAT_HT,
1155 	MWIFIEX_RATE_FORMAT_VHT,
1156 	MWIFIEX_RATE_FORMAT_AUTO = 0xFF,
1157 };
1158 
1159 struct host_cmd_ds_tx_rate_query {
1160 	u8 tx_rate;
1161 	/* Tx Rate Info: For 802.11 AC cards
1162 	 *
1163 	 * [Bit 0-1] tx rate formate: LG = 0, HT = 1, VHT = 2
1164 	 * [Bit 2-3] HT/VHT Bandwidth: BW20 = 0, BW40 = 1, BW80 = 2, BW160 = 3
1165 	 * [Bit 4]   HT/VHT Guard Interval: LGI = 0, SGI = 1
1166 	 *
1167 	 * For non-802.11 AC cards
1168 	 * Ht Info [Bit 0] RxRate format: LG=0, HT=1
1169 	 * [Bit 1]  HT Bandwidth: BW20 = 0, BW40 = 1
1170 	 * [Bit 2]  HT Guard Interval: LGI = 0, SGI = 1
1171 	 */
1172 	u8 ht_info;
1173 } __packed;
1174 
1175 struct mwifiex_tx_pause_tlv {
1176 	struct mwifiex_ie_types_header header;
1177 	u8 peermac[ETH_ALEN];
1178 	u8 tx_pause;
1179 	u8 pkt_cnt;
1180 } __packed;
1181 
1182 enum Host_Sleep_Action {
1183 	HS_CONFIGURE = 0x0001,
1184 	HS_ACTIVATE  = 0x0002,
1185 };
1186 
1187 struct mwifiex_hs_config_param {
1188 	__le32 conditions;
1189 	u8 gpio;
1190 	u8 gap;
1191 } __packed;
1192 
1193 struct hs_activate_param {
1194 	__le16 resp_ctrl;
1195 } __packed;
1196 
1197 struct host_cmd_ds_802_11_hs_cfg_enh {
1198 	__le16 action;
1199 
1200 	union {
1201 		struct mwifiex_hs_config_param hs_config;
1202 		struct hs_activate_param hs_activate;
1203 	} params;
1204 } __packed;
1205 
1206 enum SNMP_MIB_INDEX {
1207 	OP_RATE_SET_I = 1,
1208 	DTIM_PERIOD_I = 3,
1209 	RTS_THRESH_I = 5,
1210 	SHORT_RETRY_LIM_I = 6,
1211 	LONG_RETRY_LIM_I = 7,
1212 	FRAG_THRESH_I = 8,
1213 	DOT11D_I = 9,
1214 	DOT11H_I = 10,
1215 };
1216 
1217 enum mwifiex_assocmd_failurepoint {
1218 	MWIFIEX_ASSOC_CMD_SUCCESS = 0,
1219 	MWIFIEX_ASSOC_CMD_FAILURE_ASSOC,
1220 	MWIFIEX_ASSOC_CMD_FAILURE_AUTH,
1221 	MWIFIEX_ASSOC_CMD_FAILURE_JOIN
1222 };
1223 
1224 #define MAX_SNMP_BUF_SIZE   128
1225 
1226 struct host_cmd_ds_802_11_snmp_mib {
1227 	__le16 query_type;
1228 	__le16 oid;
1229 	__le16 buf_size;
1230 	u8 value[1];
1231 } __packed;
1232 
1233 struct mwifiex_rate_scope {
1234 	__le16 type;
1235 	__le16 length;
1236 	__le16 hr_dsss_rate_bitmap;
1237 	__le16 ofdm_rate_bitmap;
1238 	__le16 ht_mcs_rate_bitmap[8];
1239 	__le16 vht_mcs_rate_bitmap[8];
1240 } __packed;
1241 
1242 struct mwifiex_rate_drop_pattern {
1243 	__le16 type;
1244 	__le16 length;
1245 	__le32 rate_drop_mode;
1246 } __packed;
1247 
1248 struct host_cmd_ds_tx_rate_cfg {
1249 	__le16 action;
1250 	__le16 cfg_index;
1251 } __packed;
1252 
1253 struct mwifiex_power_group {
1254 	u8 modulation_class;
1255 	u8 first_rate_code;
1256 	u8 last_rate_code;
1257 	s8 power_step;
1258 	s8 power_min;
1259 	s8 power_max;
1260 	u8 ht_bandwidth;
1261 	u8 reserved;
1262 } __packed;
1263 
1264 struct mwifiex_types_power_group {
1265 	__le16 type;
1266 	__le16 length;
1267 } __packed;
1268 
1269 struct host_cmd_ds_txpwr_cfg {
1270 	__le16 action;
1271 	__le16 cfg_index;
1272 	__le32 mode;
1273 } __packed;
1274 
1275 struct host_cmd_ds_rf_tx_pwr {
1276 	__le16 action;
1277 	__le16 cur_level;
1278 	u8 max_power;
1279 	u8 min_power;
1280 } __packed;
1281 
1282 struct host_cmd_ds_rf_ant_mimo {
1283 	__le16 action_tx;
1284 	__le16 tx_ant_mode;
1285 	__le16 action_rx;
1286 	__le16 rx_ant_mode;
1287 };
1288 
1289 struct host_cmd_ds_rf_ant_siso {
1290 	__le16 action;
1291 	__le16 ant_mode;
1292 };
1293 
1294 struct host_cmd_ds_tdls_oper {
1295 	__le16 tdls_action;
1296 	__le16 reason;
1297 	u8 peer_mac[ETH_ALEN];
1298 } __packed;
1299 
1300 struct mwifiex_tdls_config {
1301 	__le16 enable;
1302 };
1303 
1304 struct mwifiex_tdls_config_cs_params {
1305 	u8 unit_time;
1306 	u8 thr_otherlink;
1307 	u8 thr_directlink;
1308 };
1309 
1310 struct mwifiex_tdls_init_cs_params {
1311 	u8 peer_mac[ETH_ALEN];
1312 	u8 primary_chan;
1313 	u8 second_chan_offset;
1314 	u8 band;
1315 	__le16 switch_time;
1316 	__le16 switch_timeout;
1317 	u8 reg_class;
1318 	u8 periodicity;
1319 } __packed;
1320 
1321 struct mwifiex_tdls_stop_cs_params {
1322 	u8 peer_mac[ETH_ALEN];
1323 };
1324 
1325 struct host_cmd_ds_tdls_config {
1326 	__le16 tdls_action;
1327 	u8 tdls_data[1];
1328 } __packed;
1329 
1330 struct mwifiex_chan_desc {
1331 	__le16 start_freq;
1332 	u8 chan_width;
1333 	u8 chan_num;
1334 } __packed;
1335 
1336 struct host_cmd_ds_chan_rpt_req {
1337 	struct mwifiex_chan_desc chan_desc;
1338 	__le32 msec_dwell_time;
1339 } __packed;
1340 
1341 struct host_cmd_ds_chan_rpt_event {
1342 	__le32 result;
1343 	__le64 start_tsf;
1344 	__le32 duration;
1345 	u8 tlvbuf[0];
1346 } __packed;
1347 
1348 struct host_cmd_sdio_sp_rx_aggr_cfg {
1349 	u8 action;
1350 	u8 enable;
1351 	__le16 block_size;
1352 } __packed;
1353 
1354 struct mwifiex_fixed_bcn_param {
1355 	__le64 timestamp;
1356 	__le16 beacon_period;
1357 	__le16 cap_info_bitmap;
1358 } __packed;
1359 
1360 struct mwifiex_event_scan_result {
1361 	__le16 event_id;
1362 	u8 bss_index;
1363 	u8 bss_type;
1364 	u8 more_event;
1365 	u8 reserved[3];
1366 	__le16 buf_size;
1367 	u8 num_of_set;
1368 } __packed;
1369 
1370 struct tx_status_event {
1371 	u8 packet_type;
1372 	u8 tx_token_id;
1373 	u8 status;
1374 } __packed;
1375 
1376 #define MWIFIEX_USER_SCAN_CHAN_MAX             50
1377 
1378 #define MWIFIEX_MAX_SSID_LIST_LENGTH         10
1379 
1380 struct mwifiex_scan_cmd_config {
1381 	/*
1382 	 *  BSS mode to be sent in the firmware command
1383 	 */
1384 	u8 bss_mode;
1385 
1386 	/* Specific BSSID used to filter scan results in the firmware */
1387 	u8 specific_bssid[ETH_ALEN];
1388 
1389 	/* Length of TLVs sent in command starting at tlvBuffer */
1390 	u32 tlv_buf_len;
1391 
1392 	/*
1393 	 *  SSID TLV(s) and ChanList TLVs to be sent in the firmware command
1394 	 *
1395 	 *  TLV_TYPE_CHANLIST, mwifiex_ie_types_chan_list_param_set
1396 	 *  WLAN_EID_SSID, mwifiex_ie_types_ssid_param_set
1397 	 */
1398 	u8 tlv_buf[1];	/* SSID TLV(s) and ChanList TLVs are stored
1399 				   here */
1400 } __packed;
1401 
1402 struct mwifiex_user_scan_chan {
1403 	u8 chan_number;
1404 	u8 radio_type;
1405 	u8 scan_type;
1406 	u8 reserved;
1407 	u32 scan_time;
1408 } __packed;
1409 
1410 struct mwifiex_user_scan_cfg {
1411 	/*
1412 	 *  BSS mode to be sent in the firmware command
1413 	 */
1414 	u8 bss_mode;
1415 	/* Configure the number of probe requests for active chan scans */
1416 	u8 num_probes;
1417 	u8 reserved;
1418 	/* BSSID filter sent in the firmware command to limit the results */
1419 	u8 specific_bssid[ETH_ALEN];
1420 	/* SSID filter list used in the firmware to limit the scan results */
1421 	struct cfg80211_ssid *ssid_list;
1422 	u8 num_ssids;
1423 	/* Variable number (fixed maximum) of channels to scan up */
1424 	struct mwifiex_user_scan_chan chan_list[MWIFIEX_USER_SCAN_CHAN_MAX];
1425 	u16 scan_chan_gap;
1426 } __packed;
1427 
1428 struct ie_body {
1429 	u8 grp_key_oui[4];
1430 	u8 ptk_cnt[2];
1431 	u8 ptk_body[4];
1432 } __packed;
1433 
1434 struct host_cmd_ds_802_11_scan {
1435 	u8 bss_mode;
1436 	u8 bssid[ETH_ALEN];
1437 	u8 tlv_buffer[1];
1438 } __packed;
1439 
1440 struct host_cmd_ds_802_11_scan_rsp {
1441 	__le16 bss_descript_size;
1442 	u8 number_of_sets;
1443 	u8 bss_desc_and_tlv_buffer[1];
1444 } __packed;
1445 
1446 struct host_cmd_ds_802_11_scan_ext {
1447 	u32   reserved;
1448 	u8    tlv_buffer[1];
1449 } __packed;
1450 
1451 struct mwifiex_ie_types_bss_mode {
1452 	struct mwifiex_ie_types_header  header;
1453 	u8 bss_mode;
1454 } __packed;
1455 
1456 struct mwifiex_ie_types_bss_scan_rsp {
1457 	struct mwifiex_ie_types_header header;
1458 	u8 bssid[ETH_ALEN];
1459 	u8 frame_body[1];
1460 } __packed;
1461 
1462 struct mwifiex_ie_types_bss_scan_info {
1463 	struct mwifiex_ie_types_header header;
1464 	__le16 rssi;
1465 	__le16 anpi;
1466 	u8 cca_busy_fraction;
1467 	u8 radio_type;
1468 	u8 channel;
1469 	u8 reserved;
1470 	__le64 tsf;
1471 } __packed;
1472 
1473 struct host_cmd_ds_802_11_bg_scan_query {
1474 	u8 flush;
1475 } __packed;
1476 
1477 struct host_cmd_ds_802_11_bg_scan_query_rsp {
1478 	__le32 report_condition;
1479 	struct host_cmd_ds_802_11_scan_rsp scan_resp;
1480 } __packed;
1481 
1482 struct mwifiex_ietypes_domain_param_set {
1483 	struct mwifiex_ie_types_header header;
1484 	u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
1485 	struct ieee80211_country_ie_triplet triplet[1];
1486 } __packed;
1487 
1488 struct host_cmd_ds_802_11d_domain_info {
1489 	__le16 action;
1490 	struct mwifiex_ietypes_domain_param_set domain;
1491 } __packed;
1492 
1493 struct host_cmd_ds_802_11d_domain_info_rsp {
1494 	__le16 action;
1495 	struct mwifiex_ietypes_domain_param_set domain;
1496 } __packed;
1497 
1498 struct host_cmd_ds_11n_addba_req {
1499 	u8 add_req_result;
1500 	u8 peer_mac_addr[ETH_ALEN];
1501 	u8 dialog_token;
1502 	__le16 block_ack_param_set;
1503 	__le16 block_ack_tmo;
1504 	__le16 ssn;
1505 } __packed;
1506 
1507 struct host_cmd_ds_11n_addba_rsp {
1508 	u8 add_rsp_result;
1509 	u8 peer_mac_addr[ETH_ALEN];
1510 	u8 dialog_token;
1511 	__le16 status_code;
1512 	__le16 block_ack_param_set;
1513 	__le16 block_ack_tmo;
1514 	__le16 ssn;
1515 } __packed;
1516 
1517 struct host_cmd_ds_11n_delba {
1518 	u8 del_result;
1519 	u8 peer_mac_addr[ETH_ALEN];
1520 	__le16 del_ba_param_set;
1521 	__le16 reason_code;
1522 	u8 reserved;
1523 } __packed;
1524 
1525 struct host_cmd_ds_11n_batimeout {
1526 	u8 tid;
1527 	u8 peer_mac_addr[ETH_ALEN];
1528 	u8 origninator;
1529 } __packed;
1530 
1531 struct host_cmd_ds_11n_cfg {
1532 	__le16 action;
1533 	__le16 ht_tx_cap;
1534 	__le16 ht_tx_info;
1535 	__le16 misc_config;	/* Needed for 802.11AC cards only */
1536 } __packed;
1537 
1538 struct host_cmd_ds_txbuf_cfg {
1539 	__le16 action;
1540 	__le16 buff_size;
1541 	__le16 mp_end_port;	/* SDIO only, reserved for other interfacces */
1542 	__le16 reserved3;
1543 } __packed;
1544 
1545 struct host_cmd_ds_amsdu_aggr_ctrl {
1546 	__le16 action;
1547 	__le16 enable;
1548 	__le16 curr_buf_size;
1549 } __packed;
1550 
1551 struct host_cmd_ds_sta_deauth {
1552 	u8 mac[ETH_ALEN];
1553 	__le16 reason;
1554 } __packed;
1555 
1556 struct mwifiex_ie_types_sta_info {
1557 	struct mwifiex_ie_types_header header;
1558 	u8 mac[ETH_ALEN];
1559 	u8 power_mfg_status;
1560 	s8 rssi;
1561 };
1562 
1563 struct host_cmd_ds_sta_list {
1564 	u16 sta_count;
1565 	u8 tlv[0];
1566 } __packed;
1567 
1568 struct mwifiex_ie_types_pwr_capability {
1569 	struct mwifiex_ie_types_header header;
1570 	s8 min_pwr;
1571 	s8 max_pwr;
1572 };
1573 
1574 struct mwifiex_ie_types_local_pwr_constraint {
1575 	struct mwifiex_ie_types_header header;
1576 	u8 chan;
1577 	u8 constraint;
1578 };
1579 
1580 struct mwifiex_ie_types_wmm_param_set {
1581 	struct mwifiex_ie_types_header header;
1582 	u8 wmm_ie[1];
1583 };
1584 
1585 struct mwifiex_ie_types_wmm_queue_status {
1586 	struct mwifiex_ie_types_header header;
1587 	u8 queue_index;
1588 	u8 disabled;
1589 	__le16 medium_time;
1590 	u8 flow_required;
1591 	u8 flow_created;
1592 	u32 reserved;
1593 };
1594 
1595 struct ieee_types_vendor_header {
1596 	u8 element_id;
1597 	u8 len;
1598 	u8 oui[4];	/* 0~2: oui, 3: oui_type */
1599 	u8 oui_subtype;
1600 	u8 version;
1601 } __packed;
1602 
1603 struct ieee_types_wmm_parameter {
1604 	/*
1605 	 * WMM Parameter IE - Vendor Specific Header:
1606 	 *   element_id  [221/0xdd]
1607 	 *   Len         [24]
1608 	 *   Oui         [00:50:f2]
1609 	 *   OuiType     [2]
1610 	 *   OuiSubType  [1]
1611 	 *   Version     [1]
1612 	 */
1613 	struct ieee_types_vendor_header vend_hdr;
1614 	u8 qos_info_bitmap;
1615 	u8 reserved;
1616 	struct ieee_types_wmm_ac_parameters ac_params[IEEE80211_NUM_ACS];
1617 } __packed;
1618 
1619 struct ieee_types_wmm_info {
1620 
1621 	/*
1622 	 * WMM Info IE - Vendor Specific Header:
1623 	 *   element_id  [221/0xdd]
1624 	 *   Len         [7]
1625 	 *   Oui         [00:50:f2]
1626 	 *   OuiType     [2]
1627 	 *   OuiSubType  [0]
1628 	 *   Version     [1]
1629 	 */
1630 	struct ieee_types_vendor_header vend_hdr;
1631 
1632 	u8 qos_info_bitmap;
1633 } __packed;
1634 
1635 struct host_cmd_ds_wmm_get_status {
1636 	u8 queue_status_tlv[sizeof(struct mwifiex_ie_types_wmm_queue_status) *
1637 			      IEEE80211_NUM_ACS];
1638 	u8 wmm_param_tlv[sizeof(struct ieee_types_wmm_parameter) + 2];
1639 } __packed;
1640 
1641 struct mwifiex_wmm_ac_status {
1642 	u8 disabled;
1643 	u8 flow_required;
1644 	u8 flow_created;
1645 };
1646 
1647 struct mwifiex_ie_types_htcap {
1648 	struct mwifiex_ie_types_header header;
1649 	struct ieee80211_ht_cap ht_cap;
1650 } __packed;
1651 
1652 struct mwifiex_ie_types_vhtcap {
1653 	struct mwifiex_ie_types_header header;
1654 	struct ieee80211_vht_cap vht_cap;
1655 } __packed;
1656 
1657 struct mwifiex_ie_types_aid {
1658 	struct mwifiex_ie_types_header header;
1659 	__le16 aid;
1660 } __packed;
1661 
1662 struct mwifiex_ie_types_oper_mode_ntf {
1663 	struct mwifiex_ie_types_header header;
1664 	u8 oper_mode;
1665 } __packed;
1666 
1667 /* VHT Operations IE */
1668 struct mwifiex_ie_types_vht_oper {
1669 	struct mwifiex_ie_types_header header;
1670 	u8 chan_width;
1671 	u8 chan_center_freq_1;
1672 	u8 chan_center_freq_2;
1673 	/* Basic MCS set map, each 2 bits stands for a NSS */
1674 	__le16 basic_mcs_map;
1675 } __packed;
1676 
1677 struct mwifiex_ie_types_wmmcap {
1678 	struct mwifiex_ie_types_header header;
1679 	struct mwifiex_types_wmm_info wmm_info;
1680 } __packed;
1681 
1682 struct mwifiex_ie_types_htinfo {
1683 	struct mwifiex_ie_types_header header;
1684 	struct ieee80211_ht_operation ht_oper;
1685 } __packed;
1686 
1687 struct mwifiex_ie_types_2040bssco {
1688 	struct mwifiex_ie_types_header header;
1689 	u8 bss_co_2040;
1690 } __packed;
1691 
1692 struct mwifiex_ie_types_extcap {
1693 	struct mwifiex_ie_types_header header;
1694 	u8 ext_capab[0];
1695 } __packed;
1696 
1697 struct host_cmd_ds_mem_access {
1698 	__le16 action;
1699 	__le16 reserved;
1700 	__le32 addr;
1701 	__le32 value;
1702 };
1703 
1704 struct mwifiex_ie_types_qos_info {
1705 	struct mwifiex_ie_types_header header;
1706 	u8 qos_info;
1707 } __packed;
1708 
1709 struct host_cmd_ds_mac_reg_access {
1710 	__le16 action;
1711 	__le16 offset;
1712 	__le32 value;
1713 } __packed;
1714 
1715 struct host_cmd_ds_bbp_reg_access {
1716 	__le16 action;
1717 	__le16 offset;
1718 	u8 value;
1719 	u8 reserved[3];
1720 } __packed;
1721 
1722 struct host_cmd_ds_rf_reg_access {
1723 	__le16 action;
1724 	__le16 offset;
1725 	u8 value;
1726 	u8 reserved[3];
1727 } __packed;
1728 
1729 struct host_cmd_ds_pmic_reg_access {
1730 	__le16 action;
1731 	__le16 offset;
1732 	u8 value;
1733 	u8 reserved[3];
1734 } __packed;
1735 
1736 struct host_cmd_ds_802_11_eeprom_access {
1737 	__le16 action;
1738 
1739 	__le16 offset;
1740 	__le16 byte_count;
1741 	u8 value;
1742 } __packed;
1743 
1744 struct mwifiex_assoc_event {
1745 	u8 sta_addr[ETH_ALEN];
1746 	__le16 type;
1747 	__le16 len;
1748 	__le16 frame_control;
1749 	__le16 cap_info;
1750 	__le16 listen_interval;
1751 	u8 data[0];
1752 } __packed;
1753 
1754 struct host_cmd_ds_sys_config {
1755 	__le16 action;
1756 	u8 tlv[0];
1757 };
1758 
1759 struct host_cmd_11ac_vht_cfg {
1760 	__le16 action;
1761 	u8 band_config;
1762 	u8 misc_config;
1763 	__le32 cap_info;
1764 	__le32 mcs_tx_set;
1765 	__le32 mcs_rx_set;
1766 } __packed;
1767 
1768 struct host_cmd_tlv_akmp {
1769 	struct mwifiex_ie_types_header header;
1770 	__le16 key_mgmt;
1771 	__le16 key_mgmt_operation;
1772 } __packed;
1773 
1774 struct host_cmd_tlv_pwk_cipher {
1775 	struct mwifiex_ie_types_header header;
1776 	__le16 proto;
1777 	u8 cipher;
1778 	u8 reserved;
1779 } __packed;
1780 
1781 struct host_cmd_tlv_gwk_cipher {
1782 	struct mwifiex_ie_types_header header;
1783 	u8 cipher;
1784 	u8 reserved;
1785 } __packed;
1786 
1787 struct host_cmd_tlv_passphrase {
1788 	struct mwifiex_ie_types_header header;
1789 	u8 passphrase[0];
1790 } __packed;
1791 
1792 struct host_cmd_tlv_wep_key {
1793 	struct mwifiex_ie_types_header header;
1794 	u8 key_index;
1795 	u8 is_default;
1796 	u8 key[1];
1797 };
1798 
1799 struct host_cmd_tlv_auth_type {
1800 	struct mwifiex_ie_types_header header;
1801 	u8 auth_type;
1802 } __packed;
1803 
1804 struct host_cmd_tlv_encrypt_protocol {
1805 	struct mwifiex_ie_types_header header;
1806 	__le16 proto;
1807 } __packed;
1808 
1809 struct host_cmd_tlv_ssid {
1810 	struct mwifiex_ie_types_header header;
1811 	u8 ssid[0];
1812 } __packed;
1813 
1814 struct host_cmd_tlv_rates {
1815 	struct mwifiex_ie_types_header header;
1816 	u8 rates[0];
1817 } __packed;
1818 
1819 struct mwifiex_ie_types_bssid_list {
1820 	struct mwifiex_ie_types_header header;
1821 	u8 bssid[ETH_ALEN];
1822 } __packed;
1823 
1824 struct host_cmd_tlv_bcast_ssid {
1825 	struct mwifiex_ie_types_header header;
1826 	u8 bcast_ctl;
1827 } __packed;
1828 
1829 struct host_cmd_tlv_beacon_period {
1830 	struct mwifiex_ie_types_header header;
1831 	__le16 period;
1832 } __packed;
1833 
1834 struct host_cmd_tlv_dtim_period {
1835 	struct mwifiex_ie_types_header header;
1836 	u8 period;
1837 } __packed;
1838 
1839 struct host_cmd_tlv_frag_threshold {
1840 	struct mwifiex_ie_types_header header;
1841 	__le16 frag_thr;
1842 } __packed;
1843 
1844 struct host_cmd_tlv_rts_threshold {
1845 	struct mwifiex_ie_types_header header;
1846 	__le16 rts_thr;
1847 } __packed;
1848 
1849 struct host_cmd_tlv_retry_limit {
1850 	struct mwifiex_ie_types_header header;
1851 	u8 limit;
1852 } __packed;
1853 
1854 struct host_cmd_tlv_mac_addr {
1855 	struct mwifiex_ie_types_header header;
1856 	u8 mac_addr[ETH_ALEN];
1857 } __packed;
1858 
1859 struct host_cmd_tlv_channel_band {
1860 	struct mwifiex_ie_types_header header;
1861 	u8 band_config;
1862 	u8 channel;
1863 } __packed;
1864 
1865 struct host_cmd_tlv_ageout_timer {
1866 	struct mwifiex_ie_types_header header;
1867 	__le32 sta_ao_timer;
1868 } __packed;
1869 
1870 struct host_cmd_tlv_power_constraint {
1871 	struct mwifiex_ie_types_header header;
1872 	u8 constraint;
1873 } __packed;
1874 
1875 struct mwifiex_ie_types_btcoex_scan_time {
1876 	struct mwifiex_ie_types_header header;
1877 	u8 coex_scan;
1878 	u8 reserved;
1879 	u16 min_scan_time;
1880 	u16 max_scan_time;
1881 } __packed;
1882 
1883 struct mwifiex_ie_types_btcoex_aggr_win_size {
1884 	struct mwifiex_ie_types_header header;
1885 	u8 coex_win_size;
1886 	u8 tx_win_size;
1887 	u8 rx_win_size;
1888 	u8 reserved;
1889 } __packed;
1890 
1891 struct mwifiex_ie_types_robust_coex {
1892 	struct mwifiex_ie_types_header header;
1893 	__le32 mode;
1894 } __packed;
1895 
1896 struct host_cmd_ds_version_ext {
1897 	u8 version_str_sel;
1898 	char version_str[128];
1899 } __packed;
1900 
1901 struct host_cmd_ds_mgmt_frame_reg {
1902 	__le16 action;
1903 	__le32 mask;
1904 } __packed;
1905 
1906 struct host_cmd_ds_p2p_mode_cfg {
1907 	__le16 action;
1908 	__le16 mode;
1909 } __packed;
1910 
1911 struct host_cmd_ds_remain_on_chan {
1912 	__le16 action;
1913 	u8 status;
1914 	u8 reserved;
1915 	u8 band_cfg;
1916 	u8 channel;
1917 	__le32 duration;
1918 } __packed;
1919 
1920 struct host_cmd_ds_802_11_ibss_status {
1921 	__le16 action;
1922 	__le16 enable;
1923 	u8 bssid[ETH_ALEN];
1924 	__le16 beacon_interval;
1925 	__le16 atim_window;
1926 	__le16 use_g_rate_protect;
1927 } __packed;
1928 
1929 struct mwifiex_fw_mef_entry {
1930 	u8 mode;
1931 	u8 action;
1932 	__le16 exprsize;
1933 	u8 expr[0];
1934 } __packed;
1935 
1936 struct host_cmd_ds_mef_cfg {
1937 	__le32 criteria;
1938 	__le16 num_entries;
1939 	struct mwifiex_fw_mef_entry mef_entry[0];
1940 } __packed;
1941 
1942 #define CONNECTION_TYPE_INFRA   0
1943 #define CONNECTION_TYPE_ADHOC   1
1944 #define CONNECTION_TYPE_AP      2
1945 
1946 struct host_cmd_ds_set_bss_mode {
1947 	u8 con_type;
1948 } __packed;
1949 
1950 struct host_cmd_ds_pcie_details {
1951 	/* TX buffer descriptor ring address */
1952 	u32 txbd_addr_lo;
1953 	u32 txbd_addr_hi;
1954 	/* TX buffer descriptor ring count */
1955 	u32 txbd_count;
1956 
1957 	/* RX buffer descriptor ring address */
1958 	u32 rxbd_addr_lo;
1959 	u32 rxbd_addr_hi;
1960 	/* RX buffer descriptor ring count */
1961 	u32 rxbd_count;
1962 
1963 	/* Event buffer descriptor ring address */
1964 	u32 evtbd_addr_lo;
1965 	u32 evtbd_addr_hi;
1966 	/* Event buffer descriptor ring count */
1967 	u32 evtbd_count;
1968 
1969 	/* Sleep cookie buffer physical address */
1970 	u32 sleep_cookie_addr_lo;
1971 	u32 sleep_cookie_addr_hi;
1972 } __packed;
1973 
1974 struct mwifiex_ie_types_rssi_threshold {
1975 	struct mwifiex_ie_types_header header;
1976 	u8 abs_value;
1977 	u8 evt_freq;
1978 } __packed;
1979 
1980 #define MWIFIEX_DFS_REC_HDR_LEN		8
1981 #define MWIFIEX_DFS_REC_HDR_NUM		10
1982 #define MWIFIEX_BIN_COUNTER_LEN		7
1983 
1984 struct mwifiex_radar_det_event {
1985 	__le32 detect_count;
1986 	u8 reg_domain;  /*1=fcc, 2=etsi, 3=mic*/
1987 	u8 det_type;  /*0=none, 1=pw(chirp), 2=pri(radar)*/
1988 	__le16 pw_chirp_type;
1989 	u8 pw_chirp_idx;
1990 	u8 pw_value;
1991 	u8 pri_radar_type;
1992 	u8 pri_bincnt;
1993 	u8 bin_counter[MWIFIEX_BIN_COUNTER_LEN];
1994 	u8 num_dfs_records;
1995 	u8 dfs_record_hdr[MWIFIEX_DFS_REC_HDR_NUM][MWIFIEX_DFS_REC_HDR_LEN];
1996 	__le32 passed;
1997 } __packed;
1998 
1999 struct mwifiex_ie_types_multi_chan_info {
2000 	struct mwifiex_ie_types_header header;
2001 	__le16 status;
2002 	u8 tlv_buffer[0];
2003 } __packed;
2004 
2005 struct mwifiex_ie_types_mc_group_info {
2006 	struct mwifiex_ie_types_header header;
2007 	u8 chan_group_id;
2008 	u8 chan_buf_weight;
2009 	u8 band_config;
2010 	u8 chan_num;
2011 	u32 chan_time;
2012 	u32 reserved;
2013 	union {
2014 		u8 sdio_func_num;
2015 		u8 usb_ep_num;
2016 	} hid_num;
2017 	u8 intf_num;
2018 	u8 bss_type_numlist[0];
2019 } __packed;
2020 
2021 struct meas_rpt_map {
2022 	u8 rssi:3;
2023 	u8 unmeasured:1;
2024 	u8 radar:1;
2025 	u8 unidentified_sig:1;
2026 	u8 ofdm_preamble:1;
2027 	u8 bss:1;
2028 } __packed;
2029 
2030 struct mwifiex_ie_types_chan_rpt_data {
2031 	struct mwifiex_ie_types_header header;
2032 	struct meas_rpt_map map;
2033 } __packed;
2034 
2035 struct host_cmd_ds_802_11_subsc_evt {
2036 	__le16 action;
2037 	__le16 events;
2038 } __packed;
2039 
2040 struct chan_switch_result {
2041 	u8 cur_chan;
2042 	u8 status;
2043 	u8 reason;
2044 } __packed;
2045 
2046 struct mwifiex_tdls_generic_event {
2047 	__le16 type;
2048 	u8 peer_mac[ETH_ALEN];
2049 	union {
2050 		struct chan_switch_result switch_result;
2051 		u8 cs_stop_reason;
2052 		__le16 reason_code;
2053 		__le16 reserved;
2054 	} u;
2055 } __packed;
2056 
2057 struct mwifiex_ie {
2058 	__le16 ie_index;
2059 	__le16 mgmt_subtype_mask;
2060 	__le16 ie_length;
2061 	u8 ie_buffer[IEEE_MAX_IE_SIZE];
2062 } __packed;
2063 
2064 #define MAX_MGMT_IE_INDEX	16
2065 struct mwifiex_ie_list {
2066 	__le16 type;
2067 	__le16 len;
2068 	struct mwifiex_ie ie_list[MAX_MGMT_IE_INDEX];
2069 } __packed;
2070 
2071 struct coalesce_filt_field_param {
2072 	u8 operation;
2073 	u8 operand_len;
2074 	__le16 offset;
2075 	u8 operand_byte_stream[4];
2076 };
2077 
2078 struct coalesce_receive_filt_rule {
2079 	struct mwifiex_ie_types_header header;
2080 	u8 num_of_fields;
2081 	u8 pkt_type;
2082 	__le16 max_coalescing_delay;
2083 	struct coalesce_filt_field_param params[0];
2084 } __packed;
2085 
2086 struct host_cmd_ds_coalesce_cfg {
2087 	__le16 action;
2088 	__le16 num_of_rules;
2089 	struct coalesce_receive_filt_rule rule[0];
2090 } __packed;
2091 
2092 struct host_cmd_ds_multi_chan_policy {
2093 	__le16 action;
2094 	__le16 policy;
2095 } __packed;
2096 
2097 struct host_cmd_ds_robust_coex {
2098 	__le16 action;
2099 	__le16 reserved;
2100 } __packed;
2101 
2102 struct host_cmd_ds_command {
2103 	__le16 command;
2104 	__le16 size;
2105 	__le16 seq_num;
2106 	__le16 result;
2107 	union {
2108 		struct host_cmd_ds_get_hw_spec hw_spec;
2109 		struct host_cmd_ds_mac_control mac_ctrl;
2110 		struct host_cmd_ds_802_11_mac_address mac_addr;
2111 		struct host_cmd_ds_mac_multicast_adr mc_addr;
2112 		struct host_cmd_ds_802_11_get_log get_log;
2113 		struct host_cmd_ds_802_11_rssi_info rssi_info;
2114 		struct host_cmd_ds_802_11_rssi_info_rsp rssi_info_rsp;
2115 		struct host_cmd_ds_802_11_snmp_mib smib;
2116 		struct host_cmd_ds_tx_rate_query tx_rate;
2117 		struct host_cmd_ds_tx_rate_cfg tx_rate_cfg;
2118 		struct host_cmd_ds_txpwr_cfg txp_cfg;
2119 		struct host_cmd_ds_rf_tx_pwr txp;
2120 		struct host_cmd_ds_rf_ant_mimo ant_mimo;
2121 		struct host_cmd_ds_rf_ant_siso ant_siso;
2122 		struct host_cmd_ds_802_11_ps_mode_enh psmode_enh;
2123 		struct host_cmd_ds_802_11_hs_cfg_enh opt_hs_cfg;
2124 		struct host_cmd_ds_802_11_scan scan;
2125 		struct host_cmd_ds_802_11_scan_ext ext_scan;
2126 		struct host_cmd_ds_802_11_scan_rsp scan_resp;
2127 		struct host_cmd_ds_802_11_bg_scan_query bg_scan_query;
2128 		struct host_cmd_ds_802_11_bg_scan_query_rsp bg_scan_query_resp;
2129 		struct host_cmd_ds_802_11_associate associate;
2130 		struct host_cmd_ds_802_11_associate_rsp associate_rsp;
2131 		struct host_cmd_ds_802_11_deauthenticate deauth;
2132 		struct host_cmd_ds_802_11_ad_hoc_start adhoc_start;
2133 		struct host_cmd_ds_802_11_ad_hoc_start_result start_result;
2134 		struct host_cmd_ds_802_11_ad_hoc_join_result join_result;
2135 		struct host_cmd_ds_802_11_ad_hoc_join adhoc_join;
2136 		struct host_cmd_ds_802_11d_domain_info domain_info;
2137 		struct host_cmd_ds_802_11d_domain_info_rsp domain_info_resp;
2138 		struct host_cmd_ds_11n_addba_req add_ba_req;
2139 		struct host_cmd_ds_11n_addba_rsp add_ba_rsp;
2140 		struct host_cmd_ds_11n_delba del_ba;
2141 		struct host_cmd_ds_txbuf_cfg tx_buf;
2142 		struct host_cmd_ds_amsdu_aggr_ctrl amsdu_aggr_ctrl;
2143 		struct host_cmd_ds_11n_cfg htcfg;
2144 		struct host_cmd_ds_wmm_get_status get_wmm_status;
2145 		struct host_cmd_ds_802_11_key_material key_material;
2146 		struct host_cmd_ds_802_11_key_material_v2 key_material_v2;
2147 		struct host_cmd_ds_version_ext verext;
2148 		struct host_cmd_ds_mgmt_frame_reg reg_mask;
2149 		struct host_cmd_ds_remain_on_chan roc_cfg;
2150 		struct host_cmd_ds_p2p_mode_cfg mode_cfg;
2151 		struct host_cmd_ds_802_11_ibss_status ibss_coalescing;
2152 		struct host_cmd_ds_mef_cfg mef_cfg;
2153 		struct host_cmd_ds_mem_access mem;
2154 		struct host_cmd_ds_mac_reg_access mac_reg;
2155 		struct host_cmd_ds_bbp_reg_access bbp_reg;
2156 		struct host_cmd_ds_rf_reg_access rf_reg;
2157 		struct host_cmd_ds_pmic_reg_access pmic_reg;
2158 		struct host_cmd_ds_set_bss_mode bss_mode;
2159 		struct host_cmd_ds_pcie_details pcie_host_spec;
2160 		struct host_cmd_ds_802_11_eeprom_access eeprom;
2161 		struct host_cmd_ds_802_11_subsc_evt subsc_evt;
2162 		struct host_cmd_ds_sys_config uap_sys_config;
2163 		struct host_cmd_ds_sta_deauth sta_deauth;
2164 		struct host_cmd_ds_sta_list sta_list;
2165 		struct host_cmd_11ac_vht_cfg vht_cfg;
2166 		struct host_cmd_ds_coalesce_cfg coalesce_cfg;
2167 		struct host_cmd_ds_tdls_config tdls_config;
2168 		struct host_cmd_ds_tdls_oper tdls_oper;
2169 		struct host_cmd_ds_chan_rpt_req chan_rpt_req;
2170 		struct host_cmd_sdio_sp_rx_aggr_cfg sdio_rx_aggr_cfg;
2171 		struct host_cmd_ds_multi_chan_policy mc_policy;
2172 		struct host_cmd_ds_robust_coex coex;
2173 	} params;
2174 } __packed;
2175 
2176 struct mwifiex_opt_sleep_confirm {
2177 	__le16 command;
2178 	__le16 size;
2179 	__le16 seq_num;
2180 	__le16 result;
2181 	__le16 action;
2182 	__le16 resp_ctrl;
2183 } __packed;
2184 #endif /* !_MWIFIEX_FW_H_ */
2185