]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/net/wireless/mwifiex/fw.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide
[karo-tx-linux.git] / drivers / net / wireless / mwifiex / fw.h
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         20
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_result {
1096         u8 pad[3];
1097         u8 bssid[ETH_ALEN];
1098 } __packed;
1099
1100 struct adhoc_bss_desc {
1101         u8 bssid[ETH_ALEN];
1102         u8 ssid[IEEE80211_MAX_SSID_LEN];
1103         u8 bss_mode;
1104         __le16 beacon_period;
1105         u8 dtim_period;
1106         u8 time_stamp[8];
1107         u8 local_time[8];
1108         union ieee_types_phy_param_set phy_param_set;
1109         union ieee_types_ss_param_set ss_param_set;
1110         __le16 cap_info_bitmap;
1111         u8 data_rates[HOSTCMD_SUPPORTED_RATES];
1112
1113         /*
1114          *  DO NOT ADD ANY FIELDS TO THIS STRUCTURE.
1115          *  It is used in the Adhoc join command and will cause a
1116          *  binary layout mismatch with the firmware
1117          */
1118 } __packed;
1119
1120 struct host_cmd_ds_802_11_ad_hoc_join {
1121         struct adhoc_bss_desc bss_descriptor;
1122         u16 reserved1;
1123         u16 reserved2;
1124 } __packed;
1125
1126 struct host_cmd_ds_802_11_get_log {
1127         __le32 mcast_tx_frame;
1128         __le32 failed;
1129         __le32 retry;
1130         __le32 multi_retry;
1131         __le32 frame_dup;
1132         __le32 rts_success;
1133         __le32 rts_failure;
1134         __le32 ack_failure;
1135         __le32 rx_frag;
1136         __le32 mcast_rx_frame;
1137         __le32 fcs_error;
1138         __le32 tx_frame;
1139         __le32 reserved;
1140         __le32 wep_icv_err_cnt[4];
1141         __le32 bcn_rcv_cnt;
1142         __le32 bcn_miss_cnt;
1143 };
1144
1145 /* Enumeration for rate format */
1146 enum _mwifiex_rate_format {
1147         MWIFIEX_RATE_FORMAT_LG = 0,
1148         MWIFIEX_RATE_FORMAT_HT,
1149         MWIFIEX_RATE_FORMAT_VHT,
1150         MWIFIEX_RATE_FORMAT_AUTO = 0xFF,
1151 };
1152
1153 struct host_cmd_ds_tx_rate_query {
1154         u8 tx_rate;
1155         /* Tx Rate Info: For 802.11 AC cards
1156          *
1157          * [Bit 0-1] tx rate formate: LG = 0, HT = 1, VHT = 2
1158          * [Bit 2-3] HT/VHT Bandwidth: BW20 = 0, BW40 = 1, BW80 = 2, BW160 = 3
1159          * [Bit 4]   HT/VHT Guard Interval: LGI = 0, SGI = 1
1160          *
1161          * For non-802.11 AC cards
1162          * Ht Info [Bit 0] RxRate format: LG=0, HT=1
1163          * [Bit 1]  HT Bandwidth: BW20 = 0, BW40 = 1
1164          * [Bit 2]  HT Guard Interval: LGI = 0, SGI = 1
1165          */
1166         u8 ht_info;
1167 } __packed;
1168
1169 struct mwifiex_tx_pause_tlv {
1170         struct mwifiex_ie_types_header header;
1171         u8 peermac[ETH_ALEN];
1172         u8 tx_pause;
1173         u8 pkt_cnt;
1174 } __packed;
1175
1176 enum Host_Sleep_Action {
1177         HS_CONFIGURE = 0x0001,
1178         HS_ACTIVATE  = 0x0002,
1179 };
1180
1181 struct mwifiex_hs_config_param {
1182         __le32 conditions;
1183         u8 gpio;
1184         u8 gap;
1185 } __packed;
1186
1187 struct hs_activate_param {
1188         __le16 resp_ctrl;
1189 } __packed;
1190
1191 struct host_cmd_ds_802_11_hs_cfg_enh {
1192         __le16 action;
1193
1194         union {
1195                 struct mwifiex_hs_config_param hs_config;
1196                 struct hs_activate_param hs_activate;
1197         } params;
1198 } __packed;
1199
1200 enum SNMP_MIB_INDEX {
1201         OP_RATE_SET_I = 1,
1202         DTIM_PERIOD_I = 3,
1203         RTS_THRESH_I = 5,
1204         SHORT_RETRY_LIM_I = 6,
1205         LONG_RETRY_LIM_I = 7,
1206         FRAG_THRESH_I = 8,
1207         DOT11D_I = 9,
1208         DOT11H_I = 10,
1209 };
1210
1211 enum mwifiex_assocmd_failurepoint {
1212         MWIFIEX_ASSOC_CMD_SUCCESS = 0,
1213         MWIFIEX_ASSOC_CMD_FAILURE_ASSOC,
1214         MWIFIEX_ASSOC_CMD_FAILURE_AUTH,
1215         MWIFIEX_ASSOC_CMD_FAILURE_JOIN
1216 };
1217
1218 #define MAX_SNMP_BUF_SIZE   128
1219
1220 struct host_cmd_ds_802_11_snmp_mib {
1221         __le16 query_type;
1222         __le16 oid;
1223         __le16 buf_size;
1224         u8 value[1];
1225 } __packed;
1226
1227 struct mwifiex_rate_scope {
1228         __le16 type;
1229         __le16 length;
1230         __le16 hr_dsss_rate_bitmap;
1231         __le16 ofdm_rate_bitmap;
1232         __le16 ht_mcs_rate_bitmap[8];
1233         __le16 vht_mcs_rate_bitmap[8];
1234 } __packed;
1235
1236 struct mwifiex_rate_drop_pattern {
1237         __le16 type;
1238         __le16 length;
1239         __le32 rate_drop_mode;
1240 } __packed;
1241
1242 struct host_cmd_ds_tx_rate_cfg {
1243         __le16 action;
1244         __le16 cfg_index;
1245 } __packed;
1246
1247 struct mwifiex_power_group {
1248         u8 modulation_class;
1249         u8 first_rate_code;
1250         u8 last_rate_code;
1251         s8 power_step;
1252         s8 power_min;
1253         s8 power_max;
1254         u8 ht_bandwidth;
1255         u8 reserved;
1256 } __packed;
1257
1258 struct mwifiex_types_power_group {
1259         __le16 type;
1260         __le16 length;
1261 } __packed;
1262
1263 struct host_cmd_ds_txpwr_cfg {
1264         __le16 action;
1265         __le16 cfg_index;
1266         __le32 mode;
1267 } __packed;
1268
1269 struct host_cmd_ds_rf_tx_pwr {
1270         __le16 action;
1271         __le16 cur_level;
1272         u8 max_power;
1273         u8 min_power;
1274 } __packed;
1275
1276 struct host_cmd_ds_rf_ant_mimo {
1277         __le16 action_tx;
1278         __le16 tx_ant_mode;
1279         __le16 action_rx;
1280         __le16 rx_ant_mode;
1281 };
1282
1283 struct host_cmd_ds_rf_ant_siso {
1284         __le16 action;
1285         __le16 ant_mode;
1286 };
1287
1288 struct host_cmd_ds_tdls_oper {
1289         __le16 tdls_action;
1290         __le16 reason;
1291         u8 peer_mac[ETH_ALEN];
1292 } __packed;
1293
1294 struct mwifiex_tdls_config {
1295         __le16 enable;
1296 };
1297
1298 struct mwifiex_tdls_config_cs_params {
1299         u8 unit_time;
1300         u8 thr_otherlink;
1301         u8 thr_directlink;
1302 };
1303
1304 struct mwifiex_tdls_init_cs_params {
1305         u8 peer_mac[ETH_ALEN];
1306         u8 primary_chan;
1307         u8 second_chan_offset;
1308         u8 band;
1309         __le16 switch_time;
1310         __le16 switch_timeout;
1311         u8 reg_class;
1312         u8 periodicity;
1313 } __packed;
1314
1315 struct mwifiex_tdls_stop_cs_params {
1316         u8 peer_mac[ETH_ALEN];
1317 };
1318
1319 struct host_cmd_ds_tdls_config {
1320         __le16 tdls_action;
1321         u8 tdls_data[1];
1322 } __packed;
1323
1324 struct mwifiex_chan_desc {
1325         __le16 start_freq;
1326         u8 chan_width;
1327         u8 chan_num;
1328 } __packed;
1329
1330 struct host_cmd_ds_chan_rpt_req {
1331         struct mwifiex_chan_desc chan_desc;
1332         __le32 msec_dwell_time;
1333 } __packed;
1334
1335 struct host_cmd_ds_chan_rpt_event {
1336         __le32 result;
1337         __le64 start_tsf;
1338         __le32 duration;
1339         u8 tlvbuf[0];
1340 } __packed;
1341
1342 struct host_cmd_sdio_sp_rx_aggr_cfg {
1343         u8 action;
1344         u8 enable;
1345         __le16 block_size;
1346 } __packed;
1347
1348 struct mwifiex_fixed_bcn_param {
1349         __le64 timestamp;
1350         __le16 beacon_period;
1351         __le16 cap_info_bitmap;
1352 } __packed;
1353
1354 struct mwifiex_event_scan_result {
1355         __le16 event_id;
1356         u8 bss_index;
1357         u8 bss_type;
1358         u8 more_event;
1359         u8 reserved[3];
1360         __le16 buf_size;
1361         u8 num_of_set;
1362 } __packed;
1363
1364 struct tx_status_event {
1365         u8 packet_type;
1366         u8 tx_token_id;
1367         u8 status;
1368 } __packed;
1369
1370 #define MWIFIEX_USER_SCAN_CHAN_MAX             50
1371
1372 #define MWIFIEX_MAX_SSID_LIST_LENGTH         10
1373
1374 struct mwifiex_scan_cmd_config {
1375         /*
1376          *  BSS mode to be sent in the firmware command
1377          */
1378         u8 bss_mode;
1379
1380         /* Specific BSSID used to filter scan results in the firmware */
1381         u8 specific_bssid[ETH_ALEN];
1382
1383         /* Length of TLVs sent in command starting at tlvBuffer */
1384         u32 tlv_buf_len;
1385
1386         /*
1387          *  SSID TLV(s) and ChanList TLVs to be sent in the firmware command
1388          *
1389          *  TLV_TYPE_CHANLIST, mwifiex_ie_types_chan_list_param_set
1390          *  WLAN_EID_SSID, mwifiex_ie_types_ssid_param_set
1391          */
1392         u8 tlv_buf[1];  /* SSID TLV(s) and ChanList TLVs are stored
1393                                    here */
1394 } __packed;
1395
1396 struct mwifiex_user_scan_chan {
1397         u8 chan_number;
1398         u8 radio_type;
1399         u8 scan_type;
1400         u8 reserved;
1401         u32 scan_time;
1402 } __packed;
1403
1404 struct mwifiex_user_scan_cfg {
1405         /*
1406          *  BSS mode to be sent in the firmware command
1407          */
1408         u8 bss_mode;
1409         /* Configure the number of probe requests for active chan scans */
1410         u8 num_probes;
1411         u8 reserved;
1412         /* BSSID filter sent in the firmware command to limit the results */
1413         u8 specific_bssid[ETH_ALEN];
1414         /* SSID filter list used in the firmware to limit the scan results */
1415         struct cfg80211_ssid *ssid_list;
1416         u8 num_ssids;
1417         /* Variable number (fixed maximum) of channels to scan up */
1418         struct mwifiex_user_scan_chan chan_list[MWIFIEX_USER_SCAN_CHAN_MAX];
1419         u16 scan_chan_gap;
1420 } __packed;
1421
1422 struct ie_body {
1423         u8 grp_key_oui[4];
1424         u8 ptk_cnt[2];
1425         u8 ptk_body[4];
1426 } __packed;
1427
1428 struct host_cmd_ds_802_11_scan {
1429         u8 bss_mode;
1430         u8 bssid[ETH_ALEN];
1431         u8 tlv_buffer[1];
1432 } __packed;
1433
1434 struct host_cmd_ds_802_11_scan_rsp {
1435         __le16 bss_descript_size;
1436         u8 number_of_sets;
1437         u8 bss_desc_and_tlv_buffer[1];
1438 } __packed;
1439
1440 struct host_cmd_ds_802_11_scan_ext {
1441         u32   reserved;
1442         u8    tlv_buffer[1];
1443 } __packed;
1444
1445 struct mwifiex_ie_types_bss_mode {
1446         struct mwifiex_ie_types_header  header;
1447         u8 bss_mode;
1448 } __packed;
1449
1450 struct mwifiex_ie_types_bss_scan_rsp {
1451         struct mwifiex_ie_types_header header;
1452         u8 bssid[ETH_ALEN];
1453         u8 frame_body[1];
1454 } __packed;
1455
1456 struct mwifiex_ie_types_bss_scan_info {
1457         struct mwifiex_ie_types_header header;
1458         __le16 rssi;
1459         __le16 anpi;
1460         u8 cca_busy_fraction;
1461         u8 radio_type;
1462         u8 channel;
1463         u8 reserved;
1464         __le64 tsf;
1465 } __packed;
1466
1467 struct host_cmd_ds_802_11_bg_scan_query {
1468         u8 flush;
1469 } __packed;
1470
1471 struct host_cmd_ds_802_11_bg_scan_query_rsp {
1472         __le32 report_condition;
1473         struct host_cmd_ds_802_11_scan_rsp scan_resp;
1474 } __packed;
1475
1476 struct mwifiex_ietypes_domain_param_set {
1477         struct mwifiex_ie_types_header header;
1478         u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
1479         struct ieee80211_country_ie_triplet triplet[1];
1480 } __packed;
1481
1482 struct host_cmd_ds_802_11d_domain_info {
1483         __le16 action;
1484         struct mwifiex_ietypes_domain_param_set domain;
1485 } __packed;
1486
1487 struct host_cmd_ds_802_11d_domain_info_rsp {
1488         __le16 action;
1489         struct mwifiex_ietypes_domain_param_set domain;
1490 } __packed;
1491
1492 struct host_cmd_ds_11n_addba_req {
1493         u8 add_req_result;
1494         u8 peer_mac_addr[ETH_ALEN];
1495         u8 dialog_token;
1496         __le16 block_ack_param_set;
1497         __le16 block_ack_tmo;
1498         __le16 ssn;
1499 } __packed;
1500
1501 struct host_cmd_ds_11n_addba_rsp {
1502         u8 add_rsp_result;
1503         u8 peer_mac_addr[ETH_ALEN];
1504         u8 dialog_token;
1505         __le16 status_code;
1506         __le16 block_ack_param_set;
1507         __le16 block_ack_tmo;
1508         __le16 ssn;
1509 } __packed;
1510
1511 struct host_cmd_ds_11n_delba {
1512         u8 del_result;
1513         u8 peer_mac_addr[ETH_ALEN];
1514         __le16 del_ba_param_set;
1515         __le16 reason_code;
1516         u8 reserved;
1517 } __packed;
1518
1519 struct host_cmd_ds_11n_batimeout {
1520         u8 tid;
1521         u8 peer_mac_addr[ETH_ALEN];
1522         u8 origninator;
1523 } __packed;
1524
1525 struct host_cmd_ds_11n_cfg {
1526         __le16 action;
1527         __le16 ht_tx_cap;
1528         __le16 ht_tx_info;
1529         __le16 misc_config;     /* Needed for 802.11AC cards only */
1530 } __packed;
1531
1532 struct host_cmd_ds_txbuf_cfg {
1533         __le16 action;
1534         __le16 buff_size;
1535         __le16 mp_end_port;     /* SDIO only, reserved for other interfacces */
1536         __le16 reserved3;
1537 } __packed;
1538
1539 struct host_cmd_ds_amsdu_aggr_ctrl {
1540         __le16 action;
1541         __le16 enable;
1542         __le16 curr_buf_size;
1543 } __packed;
1544
1545 struct host_cmd_ds_sta_deauth {
1546         u8 mac[ETH_ALEN];
1547         __le16 reason;
1548 } __packed;
1549
1550 struct mwifiex_ie_types_sta_info {
1551         struct mwifiex_ie_types_header header;
1552         u8 mac[ETH_ALEN];
1553         u8 power_mfg_status;
1554         s8 rssi;
1555 };
1556
1557 struct host_cmd_ds_sta_list {
1558         u16 sta_count;
1559         u8 tlv[0];
1560 } __packed;
1561
1562 struct mwifiex_ie_types_pwr_capability {
1563         struct mwifiex_ie_types_header header;
1564         s8 min_pwr;
1565         s8 max_pwr;
1566 };
1567
1568 struct mwifiex_ie_types_local_pwr_constraint {
1569         struct mwifiex_ie_types_header header;
1570         u8 chan;
1571         u8 constraint;
1572 };
1573
1574 struct mwifiex_ie_types_wmm_param_set {
1575         struct mwifiex_ie_types_header header;
1576         u8 wmm_ie[1];
1577 };
1578
1579 struct mwifiex_ie_types_wmm_queue_status {
1580         struct mwifiex_ie_types_header header;
1581         u8 queue_index;
1582         u8 disabled;
1583         __le16 medium_time;
1584         u8 flow_required;
1585         u8 flow_created;
1586         u32 reserved;
1587 };
1588
1589 struct ieee_types_vendor_header {
1590         u8 element_id;
1591         u8 len;
1592         u8 oui[4];      /* 0~2: oui, 3: oui_type */
1593         u8 oui_subtype;
1594         u8 version;
1595 } __packed;
1596
1597 struct ieee_types_wmm_parameter {
1598         /*
1599          * WMM Parameter IE - Vendor Specific Header:
1600          *   element_id  [221/0xdd]
1601          *   Len         [24]
1602          *   Oui         [00:50:f2]
1603          *   OuiType     [2]
1604          *   OuiSubType  [1]
1605          *   Version     [1]
1606          */
1607         struct ieee_types_vendor_header vend_hdr;
1608         u8 qos_info_bitmap;
1609         u8 reserved;
1610         struct ieee_types_wmm_ac_parameters ac_params[IEEE80211_NUM_ACS];
1611 } __packed;
1612
1613 struct ieee_types_wmm_info {
1614
1615         /*
1616          * WMM Info IE - Vendor Specific Header:
1617          *   element_id  [221/0xdd]
1618          *   Len         [7]
1619          *   Oui         [00:50:f2]
1620          *   OuiType     [2]
1621          *   OuiSubType  [0]
1622          *   Version     [1]
1623          */
1624         struct ieee_types_vendor_header vend_hdr;
1625
1626         u8 qos_info_bitmap;
1627 } __packed;
1628
1629 struct host_cmd_ds_wmm_get_status {
1630         u8 queue_status_tlv[sizeof(struct mwifiex_ie_types_wmm_queue_status) *
1631                               IEEE80211_NUM_ACS];
1632         u8 wmm_param_tlv[sizeof(struct ieee_types_wmm_parameter) + 2];
1633 } __packed;
1634
1635 struct mwifiex_wmm_ac_status {
1636         u8 disabled;
1637         u8 flow_required;
1638         u8 flow_created;
1639 };
1640
1641 struct mwifiex_ie_types_htcap {
1642         struct mwifiex_ie_types_header header;
1643         struct ieee80211_ht_cap ht_cap;
1644 } __packed;
1645
1646 struct mwifiex_ie_types_vhtcap {
1647         struct mwifiex_ie_types_header header;
1648         struct ieee80211_vht_cap vht_cap;
1649 } __packed;
1650
1651 struct mwifiex_ie_types_aid {
1652         struct mwifiex_ie_types_header header;
1653         __le16 aid;
1654 } __packed;
1655
1656 struct mwifiex_ie_types_oper_mode_ntf {
1657         struct mwifiex_ie_types_header header;
1658         u8 oper_mode;
1659 } __packed;
1660
1661 /* VHT Operations IE */
1662 struct mwifiex_ie_types_vht_oper {
1663         struct mwifiex_ie_types_header header;
1664         u8 chan_width;
1665         u8 chan_center_freq_1;
1666         u8 chan_center_freq_2;
1667         /* Basic MCS set map, each 2 bits stands for a NSS */
1668         __le16 basic_mcs_map;
1669 } __packed;
1670
1671 struct mwifiex_ie_types_wmmcap {
1672         struct mwifiex_ie_types_header header;
1673         struct mwifiex_types_wmm_info wmm_info;
1674 } __packed;
1675
1676 struct mwifiex_ie_types_htinfo {
1677         struct mwifiex_ie_types_header header;
1678         struct ieee80211_ht_operation ht_oper;
1679 } __packed;
1680
1681 struct mwifiex_ie_types_2040bssco {
1682         struct mwifiex_ie_types_header header;
1683         u8 bss_co_2040;
1684 } __packed;
1685
1686 struct mwifiex_ie_types_extcap {
1687         struct mwifiex_ie_types_header header;
1688         u8 ext_capab[0];
1689 } __packed;
1690
1691 struct host_cmd_ds_mem_access {
1692         __le16 action;
1693         __le16 reserved;
1694         __le32 addr;
1695         __le32 value;
1696 };
1697
1698 struct mwifiex_ie_types_qos_info {
1699         struct mwifiex_ie_types_header header;
1700         u8 qos_info;
1701 } __packed;
1702
1703 struct host_cmd_ds_mac_reg_access {
1704         __le16 action;
1705         __le16 offset;
1706         __le32 value;
1707 } __packed;
1708
1709 struct host_cmd_ds_bbp_reg_access {
1710         __le16 action;
1711         __le16 offset;
1712         u8 value;
1713         u8 reserved[3];
1714 } __packed;
1715
1716 struct host_cmd_ds_rf_reg_access {
1717         __le16 action;
1718         __le16 offset;
1719         u8 value;
1720         u8 reserved[3];
1721 } __packed;
1722
1723 struct host_cmd_ds_pmic_reg_access {
1724         __le16 action;
1725         __le16 offset;
1726         u8 value;
1727         u8 reserved[3];
1728 } __packed;
1729
1730 struct host_cmd_ds_802_11_eeprom_access {
1731         __le16 action;
1732
1733         __le16 offset;
1734         __le16 byte_count;
1735         u8 value;
1736 } __packed;
1737
1738 struct mwifiex_assoc_event {
1739         u8 sta_addr[ETH_ALEN];
1740         __le16 type;
1741         __le16 len;
1742         __le16 frame_control;
1743         __le16 cap_info;
1744         __le16 listen_interval;
1745         u8 data[0];
1746 } __packed;
1747
1748 struct host_cmd_ds_sys_config {
1749         __le16 action;
1750         u8 tlv[0];
1751 };
1752
1753 struct host_cmd_11ac_vht_cfg {
1754         __le16 action;
1755         u8 band_config;
1756         u8 misc_config;
1757         __le32 cap_info;
1758         __le32 mcs_tx_set;
1759         __le32 mcs_rx_set;
1760 } __packed;
1761
1762 struct host_cmd_tlv_akmp {
1763         struct mwifiex_ie_types_header header;
1764         __le16 key_mgmt;
1765         __le16 key_mgmt_operation;
1766 } __packed;
1767
1768 struct host_cmd_tlv_pwk_cipher {
1769         struct mwifiex_ie_types_header header;
1770         __le16 proto;
1771         u8 cipher;
1772         u8 reserved;
1773 } __packed;
1774
1775 struct host_cmd_tlv_gwk_cipher {
1776         struct mwifiex_ie_types_header header;
1777         u8 cipher;
1778         u8 reserved;
1779 } __packed;
1780
1781 struct host_cmd_tlv_passphrase {
1782         struct mwifiex_ie_types_header header;
1783         u8 passphrase[0];
1784 } __packed;
1785
1786 struct host_cmd_tlv_wep_key {
1787         struct mwifiex_ie_types_header header;
1788         u8 key_index;
1789         u8 is_default;
1790         u8 key[1];
1791 };
1792
1793 struct host_cmd_tlv_auth_type {
1794         struct mwifiex_ie_types_header header;
1795         u8 auth_type;
1796 } __packed;
1797
1798 struct host_cmd_tlv_encrypt_protocol {
1799         struct mwifiex_ie_types_header header;
1800         __le16 proto;
1801 } __packed;
1802
1803 struct host_cmd_tlv_ssid {
1804         struct mwifiex_ie_types_header header;
1805         u8 ssid[0];
1806 } __packed;
1807
1808 struct host_cmd_tlv_rates {
1809         struct mwifiex_ie_types_header header;
1810         u8 rates[0];
1811 } __packed;
1812
1813 struct mwifiex_ie_types_bssid_list {
1814         struct mwifiex_ie_types_header header;
1815         u8 bssid[ETH_ALEN];
1816 } __packed;
1817
1818 struct host_cmd_tlv_bcast_ssid {
1819         struct mwifiex_ie_types_header header;
1820         u8 bcast_ctl;
1821 } __packed;
1822
1823 struct host_cmd_tlv_beacon_period {
1824         struct mwifiex_ie_types_header header;
1825         __le16 period;
1826 } __packed;
1827
1828 struct host_cmd_tlv_dtim_period {
1829         struct mwifiex_ie_types_header header;
1830         u8 period;
1831 } __packed;
1832
1833 struct host_cmd_tlv_frag_threshold {
1834         struct mwifiex_ie_types_header header;
1835         __le16 frag_thr;
1836 } __packed;
1837
1838 struct host_cmd_tlv_rts_threshold {
1839         struct mwifiex_ie_types_header header;
1840         __le16 rts_thr;
1841 } __packed;
1842
1843 struct host_cmd_tlv_retry_limit {
1844         struct mwifiex_ie_types_header header;
1845         u8 limit;
1846 } __packed;
1847
1848 struct host_cmd_tlv_mac_addr {
1849         struct mwifiex_ie_types_header header;
1850         u8 mac_addr[ETH_ALEN];
1851 } __packed;
1852
1853 struct host_cmd_tlv_channel_band {
1854         struct mwifiex_ie_types_header header;
1855         u8 band_config;
1856         u8 channel;
1857 } __packed;
1858
1859 struct host_cmd_tlv_ageout_timer {
1860         struct mwifiex_ie_types_header header;
1861         __le32 sta_ao_timer;
1862 } __packed;
1863
1864 struct host_cmd_tlv_power_constraint {
1865         struct mwifiex_ie_types_header header;
1866         u8 constraint;
1867 } __packed;
1868
1869 struct mwifiex_ie_types_btcoex_scan_time {
1870         struct mwifiex_ie_types_header header;
1871         u8 coex_scan;
1872         u8 reserved;
1873         u16 min_scan_time;
1874         u16 max_scan_time;
1875 } __packed;
1876
1877 struct mwifiex_ie_types_btcoex_aggr_win_size {
1878         struct mwifiex_ie_types_header header;
1879         u8 coex_win_size;
1880         u8 tx_win_size;
1881         u8 rx_win_size;
1882         u8 reserved;
1883 } __packed;
1884
1885 struct mwifiex_ie_types_robust_coex {
1886         struct mwifiex_ie_types_header header;
1887         __le32 mode;
1888 } __packed;
1889
1890 struct host_cmd_ds_version_ext {
1891         u8 version_str_sel;
1892         char version_str[128];
1893 } __packed;
1894
1895 struct host_cmd_ds_mgmt_frame_reg {
1896         __le16 action;
1897         __le32 mask;
1898 } __packed;
1899
1900 struct host_cmd_ds_p2p_mode_cfg {
1901         __le16 action;
1902         __le16 mode;
1903 } __packed;
1904
1905 struct host_cmd_ds_remain_on_chan {
1906         __le16 action;
1907         u8 status;
1908         u8 reserved;
1909         u8 band_cfg;
1910         u8 channel;
1911         __le32 duration;
1912 } __packed;
1913
1914 struct host_cmd_ds_802_11_ibss_status {
1915         __le16 action;
1916         __le16 enable;
1917         u8 bssid[ETH_ALEN];
1918         __le16 beacon_interval;
1919         __le16 atim_window;
1920         __le16 use_g_rate_protect;
1921 } __packed;
1922
1923 struct mwifiex_fw_mef_entry {
1924         u8 mode;
1925         u8 action;
1926         __le16 exprsize;
1927         u8 expr[0];
1928 } __packed;
1929
1930 struct host_cmd_ds_mef_cfg {
1931         __le32 criteria;
1932         __le16 num_entries;
1933         struct mwifiex_fw_mef_entry mef_entry[0];
1934 } __packed;
1935
1936 #define CONNECTION_TYPE_INFRA   0
1937 #define CONNECTION_TYPE_ADHOC   1
1938 #define CONNECTION_TYPE_AP      2
1939
1940 struct host_cmd_ds_set_bss_mode {
1941         u8 con_type;
1942 } __packed;
1943
1944 struct host_cmd_ds_pcie_details {
1945         /* TX buffer descriptor ring address */
1946         u32 txbd_addr_lo;
1947         u32 txbd_addr_hi;
1948         /* TX buffer descriptor ring count */
1949         u32 txbd_count;
1950
1951         /* RX buffer descriptor ring address */
1952         u32 rxbd_addr_lo;
1953         u32 rxbd_addr_hi;
1954         /* RX buffer descriptor ring count */
1955         u32 rxbd_count;
1956
1957         /* Event buffer descriptor ring address */
1958         u32 evtbd_addr_lo;
1959         u32 evtbd_addr_hi;
1960         /* Event buffer descriptor ring count */
1961         u32 evtbd_count;
1962
1963         /* Sleep cookie buffer physical address */
1964         u32 sleep_cookie_addr_lo;
1965         u32 sleep_cookie_addr_hi;
1966 } __packed;
1967
1968 struct mwifiex_ie_types_rssi_threshold {
1969         struct mwifiex_ie_types_header header;
1970         u8 abs_value;
1971         u8 evt_freq;
1972 } __packed;
1973
1974 #define MWIFIEX_DFS_REC_HDR_LEN         8
1975 #define MWIFIEX_DFS_REC_HDR_NUM         10
1976 #define MWIFIEX_BIN_COUNTER_LEN         7
1977
1978 struct mwifiex_radar_det_event {
1979         __le32 detect_count;
1980         u8 reg_domain;  /*1=fcc, 2=etsi, 3=mic*/
1981         u8 det_type;  /*0=none, 1=pw(chirp), 2=pri(radar)*/
1982         __le16 pw_chirp_type;
1983         u8 pw_chirp_idx;
1984         u8 pw_value;
1985         u8 pri_radar_type;
1986         u8 pri_bincnt;
1987         u8 bin_counter[MWIFIEX_BIN_COUNTER_LEN];
1988         u8 num_dfs_records;
1989         u8 dfs_record_hdr[MWIFIEX_DFS_REC_HDR_NUM][MWIFIEX_DFS_REC_HDR_LEN];
1990         __le32 passed;
1991 } __packed;
1992
1993 struct mwifiex_ie_types_multi_chan_info {
1994         struct mwifiex_ie_types_header header;
1995         __le16 status;
1996         u8 tlv_buffer[0];
1997 } __packed;
1998
1999 struct mwifiex_ie_types_mc_group_info {
2000         struct mwifiex_ie_types_header header;
2001         u8 chan_group_id;
2002         u8 chan_buf_weight;
2003         u8 band_config;
2004         u8 chan_num;
2005         u32 chan_time;
2006         u32 reserved;
2007         union {
2008                 u8 sdio_func_num;
2009                 u8 usb_ep_num;
2010         } hid_num;
2011         u8 intf_num;
2012         u8 bss_type_numlist[0];
2013 } __packed;
2014
2015 struct meas_rpt_map {
2016         u8 rssi:3;
2017         u8 unmeasured:1;
2018         u8 radar:1;
2019         u8 unidentified_sig:1;
2020         u8 ofdm_preamble:1;
2021         u8 bss:1;
2022 } __packed;
2023
2024 struct mwifiex_ie_types_chan_rpt_data {
2025         struct mwifiex_ie_types_header header;
2026         struct meas_rpt_map map;
2027 } __packed;
2028
2029 struct host_cmd_ds_802_11_subsc_evt {
2030         __le16 action;
2031         __le16 events;
2032 } __packed;
2033
2034 struct chan_switch_result {
2035         u8 cur_chan;
2036         u8 status;
2037         u8 reason;
2038 } __packed;
2039
2040 struct mwifiex_tdls_generic_event {
2041         __le16 type;
2042         u8 peer_mac[ETH_ALEN];
2043         union {
2044                 struct chan_switch_result switch_result;
2045                 u8 cs_stop_reason;
2046                 __le16 reason_code;
2047                 __le16 reserved;
2048         } u;
2049 } __packed;
2050
2051 struct mwifiex_ie {
2052         __le16 ie_index;
2053         __le16 mgmt_subtype_mask;
2054         __le16 ie_length;
2055         u8 ie_buffer[IEEE_MAX_IE_SIZE];
2056 } __packed;
2057
2058 #define MAX_MGMT_IE_INDEX       16
2059 struct mwifiex_ie_list {
2060         __le16 type;
2061         __le16 len;
2062         struct mwifiex_ie ie_list[MAX_MGMT_IE_INDEX];
2063 } __packed;
2064
2065 struct coalesce_filt_field_param {
2066         u8 operation;
2067         u8 operand_len;
2068         __le16 offset;
2069         u8 operand_byte_stream[4];
2070 };
2071
2072 struct coalesce_receive_filt_rule {
2073         struct mwifiex_ie_types_header header;
2074         u8 num_of_fields;
2075         u8 pkt_type;
2076         __le16 max_coalescing_delay;
2077         struct coalesce_filt_field_param params[0];
2078 } __packed;
2079
2080 struct host_cmd_ds_coalesce_cfg {
2081         __le16 action;
2082         __le16 num_of_rules;
2083         struct coalesce_receive_filt_rule rule[0];
2084 } __packed;
2085
2086 struct host_cmd_ds_multi_chan_policy {
2087         __le16 action;
2088         __le16 policy;
2089 } __packed;
2090
2091 struct host_cmd_ds_robust_coex {
2092         __le16 action;
2093         __le16 reserved;
2094 } __packed;
2095
2096 struct host_cmd_ds_command {
2097         __le16 command;
2098         __le16 size;
2099         __le16 seq_num;
2100         __le16 result;
2101         union {
2102                 struct host_cmd_ds_get_hw_spec hw_spec;
2103                 struct host_cmd_ds_mac_control mac_ctrl;
2104                 struct host_cmd_ds_802_11_mac_address mac_addr;
2105                 struct host_cmd_ds_mac_multicast_adr mc_addr;
2106                 struct host_cmd_ds_802_11_get_log get_log;
2107                 struct host_cmd_ds_802_11_rssi_info rssi_info;
2108                 struct host_cmd_ds_802_11_rssi_info_rsp rssi_info_rsp;
2109                 struct host_cmd_ds_802_11_snmp_mib smib;
2110                 struct host_cmd_ds_tx_rate_query tx_rate;
2111                 struct host_cmd_ds_tx_rate_cfg tx_rate_cfg;
2112                 struct host_cmd_ds_txpwr_cfg txp_cfg;
2113                 struct host_cmd_ds_rf_tx_pwr txp;
2114                 struct host_cmd_ds_rf_ant_mimo ant_mimo;
2115                 struct host_cmd_ds_rf_ant_siso ant_siso;
2116                 struct host_cmd_ds_802_11_ps_mode_enh psmode_enh;
2117                 struct host_cmd_ds_802_11_hs_cfg_enh opt_hs_cfg;
2118                 struct host_cmd_ds_802_11_scan scan;
2119                 struct host_cmd_ds_802_11_scan_ext ext_scan;
2120                 struct host_cmd_ds_802_11_scan_rsp scan_resp;
2121                 struct host_cmd_ds_802_11_bg_scan_query bg_scan_query;
2122                 struct host_cmd_ds_802_11_bg_scan_query_rsp bg_scan_query_resp;
2123                 struct host_cmd_ds_802_11_associate associate;
2124                 struct host_cmd_ds_802_11_associate_rsp associate_rsp;
2125                 struct host_cmd_ds_802_11_deauthenticate deauth;
2126                 struct host_cmd_ds_802_11_ad_hoc_start adhoc_start;
2127                 struct host_cmd_ds_802_11_ad_hoc_result adhoc_result;
2128                 struct host_cmd_ds_802_11_ad_hoc_join adhoc_join;
2129                 struct host_cmd_ds_802_11d_domain_info domain_info;
2130                 struct host_cmd_ds_802_11d_domain_info_rsp domain_info_resp;
2131                 struct host_cmd_ds_11n_addba_req add_ba_req;
2132                 struct host_cmd_ds_11n_addba_rsp add_ba_rsp;
2133                 struct host_cmd_ds_11n_delba del_ba;
2134                 struct host_cmd_ds_txbuf_cfg tx_buf;
2135                 struct host_cmd_ds_amsdu_aggr_ctrl amsdu_aggr_ctrl;
2136                 struct host_cmd_ds_11n_cfg htcfg;
2137                 struct host_cmd_ds_wmm_get_status get_wmm_status;
2138                 struct host_cmd_ds_802_11_key_material key_material;
2139                 struct host_cmd_ds_802_11_key_material_v2 key_material_v2;
2140                 struct host_cmd_ds_version_ext verext;
2141                 struct host_cmd_ds_mgmt_frame_reg reg_mask;
2142                 struct host_cmd_ds_remain_on_chan roc_cfg;
2143                 struct host_cmd_ds_p2p_mode_cfg mode_cfg;
2144                 struct host_cmd_ds_802_11_ibss_status ibss_coalescing;
2145                 struct host_cmd_ds_mef_cfg mef_cfg;
2146                 struct host_cmd_ds_mem_access mem;
2147                 struct host_cmd_ds_mac_reg_access mac_reg;
2148                 struct host_cmd_ds_bbp_reg_access bbp_reg;
2149                 struct host_cmd_ds_rf_reg_access rf_reg;
2150                 struct host_cmd_ds_pmic_reg_access pmic_reg;
2151                 struct host_cmd_ds_set_bss_mode bss_mode;
2152                 struct host_cmd_ds_pcie_details pcie_host_spec;
2153                 struct host_cmd_ds_802_11_eeprom_access eeprom;
2154                 struct host_cmd_ds_802_11_subsc_evt subsc_evt;
2155                 struct host_cmd_ds_sys_config uap_sys_config;
2156                 struct host_cmd_ds_sta_deauth sta_deauth;
2157                 struct host_cmd_ds_sta_list sta_list;
2158                 struct host_cmd_11ac_vht_cfg vht_cfg;
2159                 struct host_cmd_ds_coalesce_cfg coalesce_cfg;
2160                 struct host_cmd_ds_tdls_config tdls_config;
2161                 struct host_cmd_ds_tdls_oper tdls_oper;
2162                 struct host_cmd_ds_chan_rpt_req chan_rpt_req;
2163                 struct host_cmd_sdio_sp_rx_aggr_cfg sdio_rx_aggr_cfg;
2164                 struct host_cmd_ds_multi_chan_policy mc_policy;
2165                 struct host_cmd_ds_robust_coex coex;
2166         } params;
2167 } __packed;
2168
2169 struct mwifiex_opt_sleep_confirm {
2170         __le16 command;
2171         __le16 size;
2172         __le16 seq_num;
2173         __le16 result;
2174         __le16 action;
2175         __le16 resp_ctrl;
2176 } __packed;
2177 #endif /* !_MWIFIEX_FW_H_ */