wireless: mwifiex: initial commit for Marvell mwifiex driver
[cascardo/linux.git] / drivers / net / wireless / mwifiex / fw.h
1 /*
2  * Marvell Wireless LAN device driver: Firmware specific macros & structures
3  *
4  * Copyright (C) 2011, 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         u16 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
54 #define FW_MULTI_BANDS_SUPPORT  (BIT(8) | BIT(9) | BIT(10) | BIT(11))
55 #define IS_SUPPORT_MULTI_BANDS(adapter)        \
56         (adapter->fw_cap_info & FW_MULTI_BANDS_SUPPORT)
57 #define GET_FW_DEFAULT_BANDS(adapter)  \
58         ((adapter->fw_cap_info >> 8) & ALL_802_11_BANDS)
59
60 #define SHORT_SLOT_TIME_DISABLED(CapInfo) (CapInfo &= ~BIT(10))
61 #define SHORT_SLOT_TIME_ENABLED(CapInfo)  (CapInfo |= BIT(10))
62
63 extern u8 supported_rates_b[B_SUPPORTED_RATES];
64 extern u8 supported_rates_g[G_SUPPORTED_RATES];
65 extern u8 supported_rates_bg[BG_SUPPORTED_RATES];
66 extern u8 supported_rates_a[A_SUPPORTED_RATES];
67 extern u8 supported_rates_n[N_SUPPORTED_RATES];
68
69 #define HostCmd_WEP_KEY_INDEX_MASK              0x3fff
70
71 #define KEY_INFO_ENABLED        0x01
72 enum KEY_TYPE_ID {
73         KEY_TYPE_ID_WEP = 0,
74         KEY_TYPE_ID_TKIP,
75         KEY_TYPE_ID_AES,
76         KEY_TYPE_ID_WAPI,
77 };
78
79 enum KEY_INFO_WEP {
80         KEY_INFO_WEP_MCAST = 0x01,
81         KEY_INFO_WEP_UNICAST = 0x02,
82         KEY_INFO_WEP_ENABLED = 0x04
83 };
84
85 enum KEY_INFO_TKIP {
86         KEY_INFO_TKIP_MCAST = 0x01,
87         KEY_INFO_TKIP_UNICAST = 0x02,
88         KEY_INFO_TKIP_ENABLED = 0x04
89 };
90
91 enum KEY_INFO_AES {
92         KEY_INFO_AES_MCAST = 0x01,
93         KEY_INFO_AES_UNICAST = 0x02,
94         KEY_INFO_AES_ENABLED = 0x04
95 };
96
97 #define WAPI_KEY_LEN                    50
98
99 enum KEY_INFO_WAPI {
100         KEY_INFO_WAPI_MCAST = 0x01,
101         KEY_INFO_WAPI_UNICAST = 0x02,
102         KEY_INFO_WAPI_ENABLED = 0x04
103 };
104
105 #define MAX_POLL_TRIES                  100
106
107 #define MAX_MULTI_INTERFACE_POLL_TRIES  1000
108
109 #define MAX_FIRMWARE_POLL_TRIES                 100
110
111 #define FIRMWARE_READY                          0xfedc
112
113 #define FIRMWARE_TRANSFER_NBLOCK                2
114
115 enum MWIFIEX_802_11_PRIVACY_FILTER {
116         MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL,
117         MWIFIEX_802_11_PRIV_FILTER_8021X_WEP
118 };
119
120 enum MWIFIEX_802_11_WEP_STATUS {
121         MWIFIEX_802_11_WEP_ENABLED,
122         MWIFIEX_802_11_WEP_DISABLED,
123 };
124
125 #define CAL_SNR(RSSI, NF)               ((s16)((s16)(RSSI)-(s16)(NF)))
126
127 #define PROPRIETARY_TLV_BASE_ID                 0x0100
128 #define TLV_TYPE_KEY_MATERIAL       (PROPRIETARY_TLV_BASE_ID + 0)
129 #define TLV_TYPE_CHANLIST           (PROPRIETARY_TLV_BASE_ID + 1)
130 #define TLV_TYPE_NUMPROBES          (PROPRIETARY_TLV_BASE_ID + 2)
131 #define TLV_TYPE_RSSI_LOW           (PROPRIETARY_TLV_BASE_ID + 4)
132 #define TLV_TYPE_SNR_LOW            (PROPRIETARY_TLV_BASE_ID + 5)
133 #define TLV_TYPE_FAILCOUNT          (PROPRIETARY_TLV_BASE_ID + 6)
134 #define TLV_TYPE_BCNMISS            (PROPRIETARY_TLV_BASE_ID + 7)
135 #define TLV_TYPE_LEDBEHAVIOR        (PROPRIETARY_TLV_BASE_ID + 9)
136 #define TLV_TYPE_PASSTHROUGH        (PROPRIETARY_TLV_BASE_ID + 10)
137 #define TLV_TYPE_POWER_TBL_2_4GHZ   (PROPRIETARY_TLV_BASE_ID + 12)
138 #define TLV_TYPE_POWER_TBL_5GHZ     (PROPRIETARY_TLV_BASE_ID + 13)
139 #define TLV_TYPE_WMMQSTATUS         (PROPRIETARY_TLV_BASE_ID + 16)
140 #define TLV_TYPE_WILDCARDSSID       (PROPRIETARY_TLV_BASE_ID + 18)
141 #define TLV_TYPE_TSFTIMESTAMP       (PROPRIETARY_TLV_BASE_ID + 19)
142 #define TLV_TYPE_RSSI_HIGH          (PROPRIETARY_TLV_BASE_ID + 22)
143 #define TLV_TYPE_SNR_HIGH           (PROPRIETARY_TLV_BASE_ID + 23)
144
145 #define TLV_TYPE_STARTBGSCANLATER   (PROPRIETARY_TLV_BASE_ID + 30)
146 #define TLV_TYPE_AUTH_TYPE          (PROPRIETARY_TLV_BASE_ID + 31)
147 #define TLV_TYPE_LINK_QUALITY       (PROPRIETARY_TLV_BASE_ID + 36)
148 #define TLV_TYPE_RSSI_LOW_DATA      (PROPRIETARY_TLV_BASE_ID + 38)
149 #define TLV_TYPE_SNR_LOW_DATA       (PROPRIETARY_TLV_BASE_ID + 39)
150 #define TLV_TYPE_RSSI_HIGH_DATA     (PROPRIETARY_TLV_BASE_ID + 40)
151 #define TLV_TYPE_SNR_HIGH_DATA      (PROPRIETARY_TLV_BASE_ID + 41)
152
153 #define TLV_TYPE_CHANNELBANDLIST    (PROPRIETARY_TLV_BASE_ID + 42)
154 #define TLV_TYPE_WAPI_IE            (PROPRIETARY_TLV_BASE_ID + 94)
155 #define TLV_TYPE_BSSID              (PROPRIETARY_TLV_BASE_ID + 35)
156
157 #define MWIFIEX_TX_DATA_BUF_SIZE_2K        2048
158
159 #define TLV_TYPE_HT_CAP                  (PROPRIETARY_TLV_BASE_ID + 74)
160 #define TLV_TYPE_HT_INFO                 (PROPRIETARY_TLV_BASE_ID + 75)
161 #define TLV_SECONDARY_CHANNEL_OFFSET     (PROPRIETARY_TLV_BASE_ID + 76)
162 #define TLV_TYPE_2040BSS_COEXISTENCE     (PROPRIETARY_TLV_BASE_ID + 77)
163 #define TLV_TYPE_OVERLAP_BSS_SCAN_PARAM  (PROPRIETARY_TLV_BASE_ID + 78)
164 #define TLV_TYPE_EXTCAP                  (PROPRIETARY_TLV_BASE_ID + 79)
165 #define TLV_TYPE_HT_OPERATIONAL_MCS_SET  (PROPRIETARY_TLV_BASE_ID + 80)
166
167 #define ADDBA_TID_MASK   (BIT(2) | BIT(3) | BIT(4) | BIT(5))
168 #define DELBA_TID_MASK   (BIT(12) | BIT(13) | BIT(14) | BIT(15))
169 #define SSN_MASK         0xfff0
170
171 #define BA_RESULT_SUCCESS        0x0
172 #define BA_RESULT_FAILURE        0x1
173 #define BA_RESULT_TIMEOUT        0x2
174 #define BA_RESULT_DATA_INVALID   0x3
175
176 #define IS_BASTREAM_SETUP(ptr)  (ptr->ba_status)
177
178 #define BA_STREAM_NOT_ALLOWED   0xff
179
180 #define IS_11N_ENABLED(priv) ((priv->adapter->config_bands & BAND_GN || \
181                         priv->adapter->config_bands & BAND_AN) \
182                         && priv->curr_bss_params.bss_descriptor.bcn_ht_cap)
183 #define INITIATOR_BIT(DelBAParamSet) (((DelBAParamSet) &\
184                         BIT(DELBA_INITIATOR_POS)) >> DELBA_INITIATOR_POS)
185
186 #define MWIFIEX_TX_DATA_BUF_SIZE_4K        4096
187 #define MWIFIEX_TX_DATA_BUF_SIZE_8K        8192
188 #define MAX_RX_AMPDU_SIZE_64K   0x03
189 #define NON_GREENFIELD_STAS     0x04
190
191 #define HWSPEC_GREENFIELD_SUPP   BIT(29)
192 #define HWSPEC_RXSTBC_SUPP       BIT(26)
193 #define HWSPEC_SHORTGI40_SUPP    BIT(24)
194 #define HWSPEC_SHORTGI20_SUPP    BIT(23)
195 #define HWSPEC_CHANBW40_SUPP     BIT(17)
196
197 #define DEFAULT_11N_CAP_MASK    (HWSPEC_SHORTGI20_SUPP | HWSPEC_RXSTBC_SUPP)
198 #define ISSUPP_11NENABLED(FwCapInfo) (FwCapInfo & BIT(11))
199 #define ISSUPP_MAXAMSDU(Dot11nDevCap) (Dot11nDevCap & BIT(31))
200 #define ISSUPP_BEAMFORMING(Dot11nDevCap) (Dot11nDevCap & BIT(30))
201 #define ISSUPP_GREENFIELD(Dot11nDevCap) (Dot11nDevCap & BIT(29))
202 #define ISSUPP_AMPDU(Dot11nDevCap) (Dot11nDevCap & BIT(28))
203 #define ISSUPP_MIMOPS(Dot11nDevCap) (Dot11nDevCap & BIT(27))
204 #define ISSUPP_RXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(26))
205 #define ISSUPP_TXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(25))
206 #define ISSUPP_SHORTGI40(Dot11nDevCap) (Dot11nDevCap & BIT(24))
207 #define ISSUPP_SHORTGI20(Dot11nDevCap) (Dot11nDevCap & BIT(23))
208 #define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22))
209 #define GET_DELAYEDBACK(Dot11nDevCap) (((Dot11nDevCap >> 20) & 0x03))
210 #define GET_IMMEDIATEBACK(Dot11nDevCap) (((Dot11nDevCap >> 18) & 0x03))
211 #define ISSUPP_CHANWIDTH40(Dot11nDevCap) (Dot11nDevCap & BIT(17))
212 #define ISSUPP_CHANWIDTH20(Dot11nDevCap) (Dot11nDevCap & BIT(16))
213 #define ISSUPP_CHANWIDTH10(Dot11nDevCap) (Dot11nDevCap & BIT(15))
214 #define ISENABLED_40MHZ_INTOLARENT(Dot11nDevCap) (Dot11nDevCap & BIT(8))
215 #define ISSUPP_RXANTENNAD(Dot11nDevCap) (Dot11nDevCap & BIT(7))
216 #define ISSUPP_RXANTENNAC(Dot11nDevCap) (Dot11nDevCap & BIT(6))
217 #define ISSUPP_RXANTENNAB(Dot11nDevCap) (Dot11nDevCap & BIT(5))
218 #define ISSUPP_RXANTENNAA(Dot11nDevCap) (Dot11nDevCap & BIT(4))
219 #define ISSUPP_TXANTENNAD(Dot11nDevCap) (Dot11nDevCap & BIT(3))
220 #define ISSUPP_TXANTENNAC(Dot11nDevCap) (Dot11nDevCap & BIT(2))
221 #define ISSUPP_TXANTENNAB(Dot11nDevCap) (Dot11nDevCap & BIT(1))
222 #define ISSUPP_TXANTENNAA(Dot11nDevCap) (Dot11nDevCap & BIT(0))
223 #define SETSUPP_CHANWIDTH40(Dot11nDevCap) (Dot11nDevCap |= BIT(17))
224 #define RESETSUPP_CHANWIDTH40(Dot11nDevCap) (Dot11nDevCap &= ~BIT(17))
225 #define GET_TXMCSSUPP(DevMCSSupported) (DevMCSSupported >> 4)
226 #define GET_RXMCSSUPP(DevMCSSupported) (DevMCSSupported & 0x0f)
227 #define GETHT_SUPPCHANWIDTH(HTCapInfo) (HTCapInfo & BIT(1))
228 #define GETHT_GREENFIELD(HTCapInfo) (HTCapInfo & BIT(4))
229 #define GETHT_SHORTGI20(HTCapInfo) (HTCapInfo & BIT(5))
230 #define GETHT_SHORTGI40(HTCapInfo) (HTCapInfo & BIT(6))
231 #define GETHT_TXSTBC(HTCapInfo) (HTCapInfo & BIT(7))
232 #define GETHT_RXSTBC(HTCapInfo) ((HTCapInfo >> 8) & 0x03)
233 #define GETHT_DELAYEDBACK(HTCapInfo) (HTCapInfo & BIT(10))
234 #define GETHT_MAXAMSDU(HTCapInfo) (HTCapInfo & BIT(11))
235 #define SETHT_SUPPCHANWIDTH(HTCapInfo) (HTCapInfo |= BIT(1))
236 #define SETHT_GREENFIELD(HTCapInfo) (HTCapInfo |= BIT(4))
237 #define SETHT_SHORTGI20(HTCapInfo) (HTCapInfo |= BIT(5))
238 #define SETHT_SHORTGI40(HTCapInfo) (HTCapInfo |= BIT(6))
239 #define SETHT_TXSTBC(HTCapInfo) (HTCapInfo |= BIT(7))
240 #define SETHT_RXSTBC(HTCapInfo, value) (HTCapInfo |= (value << 8))
241 #define SETHT_DELAYEDBACK(HTCapInfo) (HTCapInfo |= BIT(10))
242 #define SETHT_MAXAMSDU(HTCapInfo) (HTCapInfo |= BIT(11))
243 #define SETHT_DSSSCCK40(HTCapInfo) (HTCapInfo |= BIT(12))
244 #define SETHT_40MHZ_INTOLARANT(HTCapInfo) (HTCapInfo |= BIT(14))
245 #define RESETHT_SUPPCHANWIDTH(HTCapInfo) (HTCapInfo &= ~BIT(1))
246 #define RESETHT_GREENFIELD(HTCapInfo) (HTCapInfo &= ~BIT(4))
247 #define RESETHT_SHORTGI20(HTCapInfo) (HTCapInfo &= ~BIT(5))
248 #define RESETHT_SHORTGI40(HTCapInfo) (HTCapInfo &= ~BIT(6))
249 #define RESETHT_TXSTBC(HTCapInfo) (HTCapInfo &= ~BIT(7))
250 #define RESETHT_RXSTBC(HTCapInfo) (HTCapInfo &= ~(0x03 << 8))
251 #define RESETHT_DELAYEDBACK(HTCapInfo) (HTCapInfo &= ~BIT(10))
252 #define RESETHT_MAXAMSDU(HTCapInfo) (HTCapInfo &= ~BIT(11))
253 #define RESETHT_40MHZ_INTOLARANT(HTCapInfo) (HTCapInfo &= ~BIT(14))
254 #define RESETHT_EXTCAP_RDG(HTExtCap) (HTExtCap &= ~BIT(11))
255 #define SETHT_MCS32(x) (x[4] |= 1)
256 #define SETHT_MCS_SET_DEFINED(x) (x[12] |= 1)
257 #define SETHT_RX_HIGHEST_DT_SUPP(x, y) ((*(u16 *) (x + 10)) = y)
258 #define AMPDU_FACTOR_64K        0x03
259 #define SETAMPDU_SIZE(x, y) do { \
260         x = x & ~0x03; \
261         x |= y & 0x03; \
262 } while (0) \
263
264 #define SETAMPDU_SPACING(x, y) do { \
265         x = x & ~0x1c; \
266         x |= (y & 0x07) << 2; \
267 } while (0) \
268
269 #define ISSUPP_BANDA(FwCapInfo) (FwCapInfo & BIT(10))
270 #define ISALLOWED_CHANWIDTH40(Field2) (Field2 & BIT(2))
271 #define SET_CHANWIDTH40(Field2) (Field2 |= BIT(2))
272 #define RESET_CHANWIDTH40(Field2) (Field2 &= ~(BIT(0) | BIT(1) | BIT(2)))
273 #define GET_SECONDARYCHAN(Field2) (Field2 & (BIT(0) | BIT(1)))
274 #define SET_SECONDARYCHAN(RadioType, SECCHAN) (RadioType |= (SECCHAN << 4))
275
276 #define LLC_SNAP_LEN    8
277
278 #define TLV_TYPE_RATE_DROP_PATTERN  (PROPRIETARY_TLV_BASE_ID + 81)
279 #define TLV_TYPE_RATE_DROP_CONTROL  (PROPRIETARY_TLV_BASE_ID + 82)
280 #define TLV_TYPE_RATE_SCOPE         (PROPRIETARY_TLV_BASE_ID + 83)
281
282 #define TLV_TYPE_POWER_GROUP        (PROPRIETARY_TLV_BASE_ID + 84)
283
284 #define MOD_CLASS_HR_DSSS       0x03
285 #define MOD_CLASS_OFDM          0x07
286 #define MOD_CLASS_HT            0x08
287 #define HT_BW_20    0
288 #define HT_BW_40    1
289
290 #define HostCmd_CMD_GET_HW_SPEC                       0x0003
291 #define HostCmd_CMD_802_11_SCAN                       0x0006
292 #define HostCmd_CMD_802_11_GET_LOG                    0x000b
293 #define HostCmd_CMD_MAC_MULTICAST_ADR                 0x0010
294 #define HostCmd_CMD_802_11_EEPROM_ACCESS              0x0059
295 #define HostCmd_CMD_802_11_ASSOCIATE                  0x0012
296 #define HostCmd_CMD_802_11_SNMP_MIB                   0x0016
297 #define HostCmd_CMD_MAC_REG_ACCESS                    0x0019
298 #define HostCmd_CMD_BBP_REG_ACCESS                    0x001a
299 #define HostCmd_CMD_RF_REG_ACCESS                     0x001b
300 #define HostCmd_CMD_PMIC_REG_ACCESS                   0x00ad
301 #define HostCmd_CMD_802_11_RF_CHANNEL                 0x001d
302 #define HostCmd_CMD_802_11_DEAUTHENTICATE             0x0024
303 #define HostCmd_CMD_MAC_CONTROL                       0x0028
304 #define HostCmd_CMD_802_11_AD_HOC_START               0x002b
305 #define HostCmd_CMD_802_11_AD_HOC_JOIN                0x002c
306 #define HostCmd_CMD_802_11_AD_HOC_STOP                0x0040
307 #define HostCmd_CMD_802_11_MAC_ADDRESS                0x004D
308 #define HostCmd_CMD_802_11D_DOMAIN_INFO               0x005b
309 #define HostCmd_CMD_802_11_KEY_MATERIAL               0x005e
310 #define HostCmd_CMD_802_11_BG_SCAN_QUERY              0x006c
311 #define HostCmd_CMD_WMM_GET_STATUS                    0x0071
312 #define HostCmd_CMD_802_11_TX_RATE_QUERY              0x007f
313 #define HostCmd_CMD_802_11_IBSS_COALESCING_STATUS     0x0083
314 #define HostCmd_CMD_VERSION_EXT                       0x0097
315 #define HostCmd_CMD_RSSI_INFO                         0x00a4
316 #define HostCmd_CMD_FUNC_INIT                         0x00a9
317 #define HostCmd_CMD_FUNC_SHUTDOWN                     0x00aa
318 #define HostCmd_CMD_11N_CFG                           0x00cd
319 #define HostCmd_CMD_11N_ADDBA_REQ                     0x00ce
320 #define HostCmd_CMD_11N_ADDBA_RSP                     0x00cf
321 #define HostCmd_CMD_11N_DELBA                         0x00d0
322 #define HostCmd_CMD_RECONFIGURE_TX_BUFF               0x00d9
323 #define HostCmd_CMD_AMSDU_AGGR_CTRL                   0x00df
324 #define HostCmd_CMD_TXPWR_CFG                         0x00d1
325 #define HostCmd_CMD_TX_RATE_CFG                       0x00d6
326 #define HostCmd_CMD_802_11_PS_MODE_ENH                0x00e4
327 #define HostCmd_CMD_802_11_HS_CFG_ENH                 0x00e5
328 #define HostCmd_CMD_CAU_REG_ACCESS                    0x00ed
329 #define HostCmd_CMD_SET_BSS_MODE                      0x00f7
330
331
332 enum ENH_PS_MODES {
333         EN_PS = 1,
334         DIS_PS = 2,
335         EN_AUTO_DS = 3,
336         DIS_AUTO_DS = 4,
337         SLEEP_CONFIRM = 5,
338         GET_PS = 0,
339         EN_AUTO_PS = 0xff,
340         DIS_AUTO_PS = 0xfe,
341 };
342
343 #define HostCmd_RET_BIT                       0x8000
344 #define HostCmd_ACT_GEN_GET                   0x0000
345 #define HostCmd_ACT_GEN_SET                   0x0001
346 #define HostCmd_ACT_GEN_REMOVE                0x0004
347 #define HostCmd_ACT_SET_BOTH                  0x0003
348 #define HostCmd_ACT_GET_BOTH                  0x000c
349 #define HostCmd_RESULT_OK                     0x0000
350 #define HostCmd_RESULT_ERROR                  0x0001
351 #define HostCmd_RESULT_NOT_SUPPORT            0x0002
352 #define HostCmd_RESULT_PENDING                0x0003
353 #define HostCmd_RESULT_BUSY                   0x0004
354 #define HostCmd_RESULT_PARTIAL_DATA           0x0005
355
356 #define HostCmd_ACT_MAC_RX_ON                 0x0001
357 #define HostCmd_ACT_MAC_TX_ON                 0x0002
358 #define HostCmd_ACT_MAC_WEP_ENABLE            0x0008
359 #define HostCmd_ACT_MAC_ETHERNETII_ENABLE     0x0010
360 #define HostCmd_ACT_MAC_PROMISCUOUS_ENABLE    0x0080
361 #define HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE  0x0100
362 #define HostCmd_ACT_MAC_RTS_CTS_ENABLE        0x0200
363 #define HostCmd_ACT_MAC_STRICT_PROTECTION_ENABLE  0x0400
364 #define HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON     0x2000
365
366 #define HostCmd_BSS_MODE_BSS                0x0001
367 #define HostCmd_BSS_MODE_IBSS               0x0002
368 #define HostCmd_BSS_MODE_ANY                0x0003
369
370 #define HostCmd_SCAN_RADIO_TYPE_BG          0
371 #define HostCmd_SCAN_RADIO_TYPE_A           1
372
373 #define HOST_SLEEP_CFG_CANCEL           0xffffffff
374 #define HOST_SLEEP_CFG_COND_DEF         0x0000000f
375 #define HOST_SLEEP_CFG_GPIO_DEF         0xff
376 #define HOST_SLEEP_CFG_GAP_DEF          0
377
378 #define CMD_F_HOSTCMD           (1 << 0)
379 #define CMD_F_CANCELED          (1 << 1)
380
381 #define HostCmd_CMD_ID_MASK             0x0fff
382
383 #define HostCmd_SEQ_NUM_MASK            0x00ff
384
385 #define HostCmd_BSS_NUM_MASK            0x0f00
386
387 #define HostCmd_BSS_TYPE_MASK           0xf000
388
389 #define HostCmd_SET_SEQ_NO_BSS_INFO(seq, num, type) {   \
390         (((seq) & 0x00ff) |                             \
391          (((num) & 0x000f) << 8)) |                     \
392         (((type) & 0x000f) << 12);                  }
393
394 #define HostCmd_GET_SEQ_NO(seq)       \
395         ((seq) & HostCmd_SEQ_NUM_MASK)
396
397 #define HostCmd_GET_BSS_NO(seq)         \
398         (((seq) & HostCmd_BSS_NUM_MASK) >> 8)
399
400 #define HostCmd_GET_BSS_TYPE(seq)       \
401         (((seq) & HostCmd_BSS_TYPE_MASK) >> 12)
402
403 #define EVENT_DUMMY_HOST_WAKEUP_SIGNAL  0x00000001
404 #define EVENT_LINK_LOST                 0x00000003
405 #define EVENT_LINK_SENSED               0x00000004
406 #define EVENT_MIB_CHANGED               0x00000006
407 #define EVENT_INIT_DONE                 0x00000007
408 #define EVENT_DEAUTHENTICATED           0x00000008
409 #define EVENT_DISASSOCIATED             0x00000009
410 #define EVENT_PS_AWAKE                  0x0000000a
411 #define EVENT_PS_SLEEP                  0x0000000b
412 #define EVENT_MIC_ERR_MULTICAST         0x0000000d
413 #define EVENT_MIC_ERR_UNICAST           0x0000000e
414 #define EVENT_DEEP_SLEEP_AWAKE          0x00000010
415 #define EVENT_ADHOC_BCN_LOST            0x00000011
416
417 #define EVENT_WMM_STATUS_CHANGE         0x00000017
418 #define EVENT_BG_SCAN_REPORT            0x00000018
419 #define EVENT_RSSI_LOW                  0x00000019
420 #define EVENT_SNR_LOW                   0x0000001a
421 #define EVENT_MAX_FAIL                  0x0000001b
422 #define EVENT_RSSI_HIGH                 0x0000001c
423 #define EVENT_SNR_HIGH                  0x0000001d
424 #define EVENT_IBSS_COALESCED            0x0000001e
425 #define EVENT_DATA_RSSI_LOW             0x00000024
426 #define EVENT_DATA_SNR_LOW              0x00000025
427 #define EVENT_DATA_RSSI_HIGH            0x00000026
428 #define EVENT_DATA_SNR_HIGH             0x00000027
429 #define EVENT_LINK_QUALITY              0x00000028
430 #define EVENT_PORT_RELEASE              0x0000002b
431 #define EVENT_PRE_BEACON_LOST           0x00000031
432 #define EVENT_ADDBA                     0x00000033
433 #define EVENT_DELBA                     0x00000034
434 #define EVENT_BA_STREAM_TIEMOUT         0x00000037
435 #define EVENT_AMSDU_AGGR_CTRL           0x00000042
436 #define EVENT_WEP_ICV_ERR               0x00000046
437 #define EVENT_HS_ACT_REQ                0x00000047
438 #define EVENT_BW_CHANGE                 0x00000048
439
440 #define EVENT_HOSTWAKE_STAIE            0x0000004d
441
442 #define EVENT_ID_MASK                   0xffff
443 #define BSS_NUM_MASK                    0xf
444
445 #define EVENT_GET_BSS_NUM(event_cause)          \
446         (((event_cause) >> 16) & BSS_NUM_MASK)
447
448 #define EVENT_GET_BSS_TYPE(event_cause)         \
449         (((event_cause) >> 24) & 0x00ff)
450
451 struct mwifiex_event_wep_icv_err {
452         u16 reason_code;
453         u8 src_mac_addr[ETH_ALEN];
454         u8 wep_key_index;
455         u8 wep_key_length;
456         u8 key[WLAN_KEY_LEN_WEP104];
457 };
458
459 struct mwifiex_802_11_fixed_ies {
460         u8 time_stamp[8];
461         __le16 beacon_interval;
462         __le16 capabilities;
463 };
464
465 struct mwifiex_ie_types_header {
466         __le16 type;
467         __le16 len;
468 } __packed;
469
470 struct mwifiex_ie_types_data {
471         struct mwifiex_ie_types_header header;
472         u8 data[1];
473 } __packed;
474
475 #define MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET 0x01
476 #define MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET 0x08
477
478 struct txpd {
479         u8 bss_type;
480         u8 bss_num;
481         __le16 tx_pkt_length;
482         __le16 tx_pkt_offset;
483         __le16 tx_pkt_type;
484         __le32 tx_control;
485         u8 priority;
486         u8 flags;
487         u8 pkt_delay_2ms;
488         u8 reserved1;
489 } __packed;
490
491 struct rxpd {
492         u8 bss_type;
493         u8 bss_num;
494         u16 rx_pkt_length;
495         u16 rx_pkt_offset;
496         u16 rx_pkt_type;
497         u16 seq_num;
498         u8 priority;
499         u8 rx_rate;
500         s8 snr;
501         s8 nf;
502         /* Ht Info [Bit 0] RxRate format: LG=0, HT=1
503          * [Bit 1]  HT Bandwidth: BW20 = 0, BW40 = 1
504          * [Bit 2]  HT Guard Interval: LGI = 0, SGI = 1 */
505         u8 ht_info;
506         u8 reserved;
507 } __packed;
508
509 enum mwifiex_chan_scan_mode_bitmasks {
510         MWIFIEX_PASSIVE_SCAN = BIT(0),
511         MWIFIEX_DISABLE_CHAN_FILT = BIT(1),
512 };
513
514 #define SECOND_CHANNEL_BELOW    0x30
515 #define SECOND_CHANNEL_ABOVE    0x10
516 struct mwifiex_chan_scan_param_set {
517         u8 radio_type;
518         u8 chan_number;
519         u8 chan_scan_mode_bitmap;
520         __le16 min_scan_time;
521         __le16 max_scan_time;
522 } __packed;
523
524 struct mwifiex_ie_types_chan_list_param_set {
525         struct mwifiex_ie_types_header header;
526         struct mwifiex_chan_scan_param_set chan_scan_param[1];
527 } __packed;
528
529 struct chan_band_param_set {
530         u8 radio_type;
531         u8 chan_number;
532 };
533
534 struct mwifiex_ie_types_chan_band_list_param_set {
535         struct mwifiex_ie_types_header header;
536         struct chan_band_param_set chan_band_param[1];
537 } __packed;
538
539 struct mwifiex_ie_types_rates_param_set {
540         struct mwifiex_ie_types_header header;
541         u8 rates[1];
542 } __packed;
543
544 struct mwifiex_ie_types_ssid_param_set {
545         struct mwifiex_ie_types_header header;
546         u8 ssid[1];
547 } __packed;
548
549 struct mwifiex_ie_types_num_probes {
550         struct mwifiex_ie_types_header header;
551         __le16 num_probes;
552 } __packed;
553
554 struct mwifiex_ie_types_wildcard_ssid_params {
555         struct mwifiex_ie_types_header header;
556         u8 max_ssid_length;
557         u8 ssid[1];
558 } __packed;
559
560 #define TSF_DATA_SIZE            8
561 struct mwifiex_ie_types_tsf_timestamp {
562         struct mwifiex_ie_types_header header;
563         u8 tsf_data[1];
564 } __packed;
565
566 struct mwifiex_cf_param_set {
567         u8 cfp_cnt;
568         u8 cfp_period;
569         u16 cfp_max_duration;
570         u16 cfp_duration_remaining;
571 } __packed;
572
573 struct mwifiex_ibss_param_set {
574         u16 atim_window;
575 } __packed;
576
577 struct mwifiex_ie_types_ss_param_set {
578         struct mwifiex_ie_types_header header;
579         union {
580                 struct mwifiex_cf_param_set cf_param_set[1];
581                 struct mwifiex_ibss_param_set ibss_param_set[1];
582         } cf_ibss;
583 } __packed;
584
585 struct mwifiex_fh_param_set {
586         u16 dwell_time;
587         u8 hop_set;
588         u8 hop_pattern;
589         u8 hop_index;
590 } __packed;
591
592 struct mwifiex_ds_param_set {
593         u8 current_chan;
594 } __packed;
595
596 struct mwifiex_ie_types_phy_param_set {
597         struct mwifiex_ie_types_header header;
598         union {
599                 struct mwifiex_fh_param_set fh_param_set[1];
600                 struct mwifiex_ds_param_set ds_param_set[1];
601         } fh_ds;
602 } __packed;
603
604 struct mwifiex_ie_types_auth_type {
605         struct mwifiex_ie_types_header header;
606         __le16 auth_type;
607 } __packed;
608
609 struct mwifiex_ie_types_vendor_param_set {
610         struct mwifiex_ie_types_header header;
611         u8 ie[MWIFIEX_MAX_VSIE_LEN];
612 };
613
614 struct mwifiex_ie_types_rsn_param_set {
615         struct mwifiex_ie_types_header header;
616         u8 rsn_ie[1];
617 } __packed;
618
619 #define KEYPARAMSET_FIXED_LEN 6
620
621 struct mwifiex_ie_type_key_param_set {
622         __le16 type;
623         __le16 length;
624         __le16 key_type_id;
625         __le16 key_info;
626         __le16 key_len;
627         u8 key[50];
628 } __packed;
629
630 struct host_cmd_ds_802_11_key_material {
631         __le16 action;
632         struct mwifiex_ie_type_key_param_set key_param_set;
633 } __packed;
634
635 struct host_cmd_ds_gen {
636         u16 command;
637         u16 size;
638         u16 seq_num;
639         u16 result;
640 };
641
642 #define S_DS_GEN        sizeof(struct host_cmd_ds_gen)
643
644 enum sleep_resp_ctrl {
645         RESP_NOT_NEEDED = 0,
646         RESP_NEEDED,
647 };
648
649 struct mwifiex_ps_param {
650         __le16 null_pkt_interval;
651         __le16 multiple_dtims;
652         __le16 bcn_miss_timeout;
653         __le16 local_listen_interval;
654         __le16 adhoc_wake_period;
655         __le16 mode;
656         __le16 delay_to_ps;
657 };
658
659 struct mwifiex_auto_ds_param {
660         __le16 deep_sleep_timeout;
661 };
662
663 struct sleep_confirm_param {
664         __le16 resp_ctrl;
665 };
666
667 #define BITMAP_AUTO_DS         0x01
668 #define BITMAP_STA_PS          0x10
669 #define BITMAP_UAP_INACT_PS    0x100
670 #define BITMAP_UAP_DTIM_PS     0x200
671 struct auto_ps_param {
672         __le16 ps_bitmap;
673         /* auto deep sleep parameter,
674          * sta power save parameter
675          * uap inactivity parameter
676          * uap DTIM parameter */
677 };
678
679 #define AUTO_PS_FIX_SIZE    4
680
681 #define TLV_TYPE_AUTO_DS_PARAM        (PROPRIETARY_TLV_BASE_ID + 113)
682 #define TLV_TYPE_PS_PARAM             (PROPRIETARY_TLV_BASE_ID + 114)
683
684 struct mwifiex_ie_types_auto_ds_param {
685         struct mwifiex_ie_types_header header;
686         struct mwifiex_auto_ds_param param;
687 } __packed;
688
689 struct mwifiex_ie_types_ps_param {
690         struct mwifiex_ie_types_header header;
691         struct mwifiex_ps_param param;
692 } __packed;
693
694 struct host_cmd_ds_802_11_ps_mode_enh {
695         __le16 action;
696
697         union {
698                 struct mwifiex_ps_param opt_ps;
699                 struct mwifiex_auto_ds_param auto_ds;
700                 struct sleep_confirm_param sleep_cfm;
701                 __le16 ps_bitmap;
702                 struct auto_ps_param auto_ps;
703         } params;
704 } __packed;
705
706 struct host_cmd_ds_get_hw_spec {
707         __le16 hw_if_version;
708         __le16 version;
709         __le16 reserved;
710         __le16 num_of_mcast_adr;
711         u8 permanent_addr[ETH_ALEN];
712         __le16 region_code;
713         __le16 number_of_antenna;
714         __le32 fw_release_number;
715         __le32 reserved_1;
716         __le32 reserved_2;
717         __le32 reserved_3;
718         __le32 fw_cap_info;
719         __le32 dot_11n_dev_cap;
720         u8 dev_mcs_support;
721         __le16 mp_end_port;     /* SDIO only, reserved for other interfacces */
722         __le16 reserved_4;
723 } __packed;
724
725 struct host_cmd_ds_802_11_rssi_info {
726         __le16 action;
727         __le16 ndata;
728         __le16 nbcn;
729         __le16 reserved[9];
730         long long reserved_1;
731 };
732
733 struct host_cmd_ds_802_11_rssi_info_rsp {
734         __le16 action;
735         __le16 ndata;
736         __le16 nbcn;
737         __le16 data_rssi_last;
738         __le16 data_nf_last;
739         __le16 data_rssi_avg;
740         __le16 data_nf_avg;
741         __le16 bcn_rssi_last;
742         __le16 bcn_nf_last;
743         __le16 bcn_rssi_avg;
744         __le16 bcn_nf_avg;
745         long long tsf_bcn;
746 };
747
748 struct host_cmd_ds_802_11_mac_address {
749         __le16 action;
750         u8 mac_addr[ETH_ALEN];
751 };
752
753 struct host_cmd_ds_mac_control {
754         __le16 action;
755         __le16 reserved;
756 };
757
758 struct host_cmd_ds_mac_multicast_adr {
759         __le16 action;
760         __le16 num_of_adrs;
761         u8 mac_list[MWIFIEX_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
762 } __packed;
763
764 struct host_cmd_ds_802_11_deauthenticate {
765         u8 mac_addr[ETH_ALEN];
766         __le16 reason_code;
767 } __packed;
768
769 struct host_cmd_ds_802_11_associate {
770         u8 peer_sta_addr[ETH_ALEN];
771         __le16 cap_info_bitmap;
772         __le16 listen_interval;
773         __le16 beacon_period;
774         u8 dtim_period;
775 } __packed;
776
777 struct ieee_types_assoc_rsp {
778         __le16 cap_info_bitmap;
779         __le16 status_code;
780         __le16 a_id;
781         u8 ie_buffer[1];
782 } __packed;
783
784 struct host_cmd_ds_802_11_associate_rsp {
785         struct ieee_types_assoc_rsp assoc_rsp;
786 } __packed;
787
788 struct ieee_types_cf_param_set {
789         u8 element_id;
790         u8 len;
791         u8 cfp_cnt;
792         u8 cfp_period;
793         u16 cfp_max_duration;
794         u16 cfp_duration_remaining;
795 } __packed;
796
797 struct ieee_types_ibss_param_set {
798         u8 element_id;
799         u8 len;
800         __le16 atim_window;
801 } __packed;
802
803 union ieee_types_ss_param_set {
804         struct ieee_types_cf_param_set cf_param_set;
805         struct ieee_types_ibss_param_set ibss_param_set;
806 } __packed;
807
808 struct ieee_types_fh_param_set {
809         u8 element_id;
810         u8 len;
811         __le16 dwell_time;
812         u8 hop_set;
813         u8 hop_pattern;
814         u8 hop_index;
815 } __packed;
816
817 struct ieee_types_ds_param_set {
818         u8 element_id;
819         u8 len;
820         u8 current_chan;
821 } __packed;
822
823 union ieee_types_phy_param_set {
824         struct ieee_types_fh_param_set fh_param_set;
825         struct ieee_types_ds_param_set ds_param_set;
826 } __packed;
827
828 struct host_cmd_ds_802_11_ad_hoc_start {
829         u8 ssid[IEEE80211_MAX_SSID_LEN];
830         u8 bss_mode;
831         __le16 beacon_period;
832         u8 dtim_period;
833         union ieee_types_ss_param_set ss_param_set;
834         union ieee_types_phy_param_set phy_param_set;
835         u16 reserved1;
836         __le16 cap_info_bitmap;
837         u8 DataRate[HOSTCMD_SUPPORTED_RATES];
838 } __packed;
839
840 struct host_cmd_ds_802_11_ad_hoc_result {
841         u8 pad[3];
842         u8 bssid[ETH_ALEN];
843 } __packed;
844
845 struct adhoc_bss_desc {
846         u8 bssid[ETH_ALEN];
847         u8 ssid[IEEE80211_MAX_SSID_LEN];
848         u8 bss_mode;
849         __le16 beacon_period;
850         u8 dtim_period;
851         u8 time_stamp[8];
852         u8 local_time[8];
853         union ieee_types_phy_param_set phy_param_set;
854         union ieee_types_ss_param_set ss_param_set;
855         __le16 cap_info_bitmap;
856         u8 data_rates[HOSTCMD_SUPPORTED_RATES];
857
858         /*
859          *  DO NOT ADD ANY FIELDS TO THIS STRUCTURE.
860          *  It is used in the Adhoc join command and will cause a
861          *  binary layout mismatch with the firmware
862          */
863 } __packed;
864
865 struct host_cmd_ds_802_11_ad_hoc_join {
866         struct adhoc_bss_desc bss_descriptor;
867         u16 reserved1;
868         u16 reserved2;
869 } __packed;
870
871 struct host_cmd_ds_802_11_get_log {
872         __le32 mcast_tx_frame;
873         __le32 failed;
874         __le32 retry;
875         __le32 multi_retry;
876         __le32 frame_dup;
877         __le32 rts_success;
878         __le32 rts_failure;
879         __le32 ack_failure;
880         __le32 rx_frag;
881         __le32 mcast_rx_frame;
882         __le32 fcs_error;
883         __le32 tx_frame;
884         __le32 reserved;
885         __le32 wep_icv_err_cnt[4];
886 };
887
888 struct host_cmd_ds_tx_rate_query {
889         u8 tx_rate;
890         /* Ht Info [Bit 0] RxRate format: LG=0, HT=1
891          * [Bit 1]  HT Bandwidth: BW20 = 0, BW40 = 1
892          * [Bit 2]  HT Guard Interval: LGI = 0, SGI = 1 */
893         u8 ht_info;
894 } __packed;
895
896 enum Host_Sleep_Action {
897         HS_CONFIGURE = 0x0001,
898         HS_ACTIVATE  = 0x0002,
899 };
900
901 struct mwifiex_hs_config_param {
902         __le32 conditions;
903         u8 gpio;
904         u8 gap;
905 } __packed;
906
907 struct hs_activate_param {
908         u16 resp_ctrl;
909 } __packed;
910
911 struct host_cmd_ds_802_11_hs_cfg_enh {
912         __le16 action;
913
914         union {
915                 struct mwifiex_hs_config_param hs_config;
916                 struct hs_activate_param hs_activate;
917         } params;
918 } __packed;
919
920 enum SNMP_MIB_INDEX {
921         OP_RATE_SET_I = 1,
922         DTIM_PERIOD_I = 3,
923         RTS_THRESH_I = 5,
924         SHORT_RETRY_LIM_I = 6,
925         LONG_RETRY_LIM_I = 7,
926         FRAG_THRESH_I = 8,
927         DOT11D_I = 9,
928 };
929
930 #define MAX_SNMP_BUF_SIZE   128
931
932 struct host_cmd_ds_802_11_snmp_mib {
933         __le16 query_type;
934         __le16 oid;
935         __le16 buf_size;
936         u8 value[1];
937 } __packed;
938
939 #define RADIO_ON                                0x01
940 #define RADIO_OFF                               0x00
941
942 struct mwifiex_rate_scope {
943         __le16 type;
944         __le16 length;
945         __le16 hr_dsss_rate_bitmap;
946         __le16 ofdm_rate_bitmap;
947         __le16 ht_mcs_rate_bitmap[8];
948 } __packed;
949
950 struct mwifiex_rate_drop_pattern {
951         __le16 type;
952         __le16 length;
953         __le32 rate_drop_mode;
954 } __packed;
955
956 struct host_cmd_ds_tx_rate_cfg {
957         __le16 action;
958         __le16 cfg_index;
959 } __packed;
960
961 struct mwifiex_power_group {
962         u8 modulation_class;
963         u8 first_rate_code;
964         u8 last_rate_code;
965         s8 power_step;
966         s8 power_min;
967         s8 power_max;
968         u8 ht_bandwidth;
969         u8 reserved;
970 } __packed;
971
972 struct mwifiex_types_power_group {
973         u16 type;
974         u16 length;
975 } __packed;
976
977 struct host_cmd_ds_txpwr_cfg {
978         __le16 action;
979         __le16 cfg_index;
980         __le32 mode;
981 } __packed;
982
983 #define MWIFIEX_USER_SCAN_CHAN_MAX             50
984
985 #define MWIFIEX_MAX_SSID_LIST_LENGTH         10
986
987 struct mwifiex_scan_cmd_config {
988         /*
989          *  BSS Type to be sent in the firmware command
990          *
991          *  Field can be used to restrict the types of networks returned in the
992          *    scan.  Valid settings are:
993          *
994          *   - MWIFIEX_SCAN_MODE_BSS  (infrastructure)
995          *   - MWIFIEX_SCAN_MODE_IBSS (adhoc)
996          *   - MWIFIEX_SCAN_MODE_ANY  (unrestricted, adhoc and infrastructure)
997          */
998         u8 bss_mode;
999
1000         /* Specific BSSID used to filter scan results in the firmware */
1001         u8 specific_bssid[ETH_ALEN];
1002
1003         /* Length of TLVs sent in command starting at tlvBuffer */
1004         u32 tlv_buf_len;
1005
1006         /*
1007          *  SSID TLV(s) and ChanList TLVs to be sent in the firmware command
1008          *
1009          *  TLV_TYPE_CHANLIST, mwifiex_ie_types_chan_list_param_set
1010          *  WLAN_EID_SSID, mwifiex_ie_types_ssid_param_set
1011          */
1012         u8 tlv_buf[1];  /* SSID TLV(s) and ChanList TLVs are stored
1013                                    here */
1014 } __packed;
1015
1016 struct mwifiex_user_scan_chan {
1017         u8 chan_number;
1018         u8 radio_type;
1019         u8 scan_type;
1020         u8 reserved;
1021         u32 scan_time;
1022 } __packed;
1023
1024 struct mwifiex_user_scan_ssid {
1025         u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
1026         u8 max_len;
1027 } __packed;
1028
1029 struct mwifiex_user_scan_cfg {
1030         /*
1031          *  Flag set to keep the previous scan table intact
1032          *
1033          *  If set, the scan results will accumulate, replacing any previous
1034          *   matched entries for a BSS with the new scan data
1035          */
1036         u8 keep_previous_scan;
1037         /*
1038          *  BSS mode to be sent in the firmware command
1039          *
1040          *  Field can be used to restrict the types of networks returned in the
1041          *    scan.  Valid settings are:
1042          *
1043          *   - MWIFIEX_SCAN_MODE_BSS  (infrastructure)
1044          *   - MWIFIEX_SCAN_MODE_IBSS (adhoc)
1045          *   - MWIFIEX_SCAN_MODE_ANY  (unrestricted, adhoc and infrastructure)
1046          */
1047         u8 bss_mode;
1048         /* Configure the number of probe requests for active chan scans */
1049         u8 num_probes;
1050         u8 reserved;
1051         /* BSSID filter sent in the firmware command to limit the results */
1052         u8 specific_bssid[ETH_ALEN];
1053         /* SSID filter list used in the to limit the scan results */
1054         struct mwifiex_user_scan_ssid ssid_list[MWIFIEX_MAX_SSID_LIST_LENGTH];
1055         /* Variable number (fixed maximum) of channels to scan up */
1056         struct mwifiex_user_scan_chan chan_list[MWIFIEX_USER_SCAN_CHAN_MAX];
1057 } __packed;
1058
1059 struct ie_body {
1060         u8 grp_key_oui[4];
1061         u8 ptk_cnt[2];
1062         u8 ptk_body[4];
1063 } __packed;
1064
1065 struct host_cmd_ds_802_11_scan {
1066         u8 bss_mode;
1067         u8 bssid[ETH_ALEN];
1068         u8 tlv_buffer[1];
1069 } __packed;
1070
1071 struct host_cmd_ds_802_11_scan_rsp {
1072         __le16 bss_descript_size;
1073         u8 number_of_sets;
1074         u8 bss_desc_and_tlv_buffer[1];
1075 } __packed;
1076
1077 struct host_cmd_ds_802_11_bg_scan_query {
1078         u8 flush;
1079 } __packed;
1080
1081 struct host_cmd_ds_802_11_bg_scan_query_rsp {
1082         u32 report_condition;
1083         struct host_cmd_ds_802_11_scan_rsp scan_resp;
1084 } __packed;
1085
1086 struct mwifiex_ietypes_domain_param_set {
1087         struct mwifiex_ie_types_header header;
1088         u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
1089         struct ieee80211_country_ie_triplet triplet[1];
1090 } __packed;
1091
1092 struct host_cmd_ds_802_11d_domain_info {
1093         __le16 action;
1094         struct mwifiex_ietypes_domain_param_set domain;
1095 } __packed;
1096
1097 struct host_cmd_ds_802_11d_domain_info_rsp {
1098         __le16 action;
1099         struct mwifiex_ietypes_domain_param_set domain;
1100 } __packed;
1101
1102 struct host_cmd_ds_11n_addba_req {
1103         u8 add_req_result;
1104         u8 peer_mac_addr[ETH_ALEN];
1105         u8 dialog_token;
1106         __le16 block_ack_param_set;
1107         __le16 block_ack_tmo;
1108         __le16 ssn;
1109 } __packed;
1110
1111 struct host_cmd_ds_11n_addba_rsp {
1112         u8 add_rsp_result;
1113         u8 peer_mac_addr[ETH_ALEN];
1114         u8 dialog_token;
1115         __le16 status_code;
1116         __le16 block_ack_param_set;
1117         __le16 block_ack_tmo;
1118         __le16 ssn;
1119 } __packed;
1120
1121 struct host_cmd_ds_11n_delba {
1122         u8 del_result;
1123         u8 peer_mac_addr[ETH_ALEN];
1124         __le16 del_ba_param_set;
1125         __le16 reason_code;
1126         u8 reserved;
1127 } __packed;
1128
1129 struct host_cmd_ds_11n_batimeout {
1130         u8 tid;
1131         u8 peer_mac_addr[ETH_ALEN];
1132         u8 origninator;
1133 } __packed;
1134
1135 struct host_cmd_ds_11n_cfg {
1136         __le16 action;
1137         __le16 ht_tx_cap;
1138         __le16 ht_tx_info;
1139 } __packed;
1140
1141 struct host_cmd_ds_txbuf_cfg {
1142         __le16 action;
1143         __le16 buff_size;
1144         __le16 mp_end_port;     /* SDIO only, reserved for other interfacces */
1145         __le16 reserved3;
1146 } __packed;
1147
1148 struct host_cmd_ds_amsdu_aggr_ctrl {
1149         __le16 action;
1150         __le16 enable;
1151         __le16 curr_buf_size;
1152 } __packed;
1153
1154 struct mwifiex_ie_types_wmm_param_set {
1155         struct mwifiex_ie_types_header header;
1156         u8 wmm_ie[1];
1157 };
1158
1159 struct mwifiex_ie_types_wmm_queue_status {
1160         struct mwifiex_ie_types_header header;
1161         u8 queue_index;
1162         u8 disabled;
1163         u16 medium_time;
1164         u8 flow_required;
1165         u8 flow_created;
1166         u32 reserved;
1167 };
1168
1169 struct ieee_types_vendor_header {
1170         u8 element_id;
1171         u8 len;
1172         u8 oui[3];
1173         u8 oui_type;
1174         u8 oui_subtype;
1175         u8 version;
1176 } __packed;
1177
1178 struct ieee_types_wmm_ac_parameters {
1179         u8 aci_aifsn_bitmap;
1180         u8 ecw_bitmap;
1181         __le16 tx_op_limit;
1182 } __packed;
1183
1184 struct ieee_types_wmm_parameter {
1185         /*
1186          * WMM Parameter IE - Vendor Specific Header:
1187          *   element_id  [221/0xdd]
1188          *   Len         [24]
1189          *   Oui         [00:50:f2]
1190          *   OuiType     [2]
1191          *   OuiSubType  [1]
1192          *   Version     [1]
1193          */
1194         struct ieee_types_vendor_header vend_hdr;
1195         u8 qos_info_bitmap;
1196         u8 reserved;
1197         struct ieee_types_wmm_ac_parameters ac_params[IEEE80211_MAX_QUEUES];
1198 } __packed;
1199
1200 struct ieee_types_wmm_info {
1201
1202         /*
1203          * WMM Info IE - Vendor Specific Header:
1204          *   element_id  [221/0xdd]
1205          *   Len         [7]
1206          *   Oui         [00:50:f2]
1207          *   OuiType     [2]
1208          *   OuiSubType  [0]
1209          *   Version     [1]
1210          */
1211         struct ieee_types_vendor_header vend_hdr;
1212
1213         u8 qos_info_bitmap;
1214 } __packed;
1215
1216 struct host_cmd_ds_wmm_get_status {
1217         u8 queue_status_tlv[sizeof(struct mwifiex_ie_types_wmm_queue_status) *
1218                               IEEE80211_MAX_QUEUES];
1219         u8 wmm_param_tlv[sizeof(struct ieee_types_wmm_parameter) + 2];
1220 } __packed;
1221
1222 struct mwifiex_wmm_ac_status {
1223         u8 disabled;
1224         u8 flow_required;
1225         u8 flow_created;
1226 };
1227
1228 struct mwifiex_ie_types_htcap {
1229         struct mwifiex_ie_types_header header;
1230         struct ieee80211_ht_cap ht_cap;
1231 } __packed;
1232
1233 struct mwifiex_ie_types_htinfo {
1234         struct mwifiex_ie_types_header header;
1235         struct ieee80211_ht_info ht_info;
1236 } __packed;
1237
1238 struct mwifiex_ie_types_2040bssco {
1239         struct mwifiex_ie_types_header header;
1240         u8 bss_co_2040;
1241 } __packed;
1242
1243 struct mwifiex_ie_types_extcap {
1244         struct mwifiex_ie_types_header header;
1245         u8 ext_cap;
1246 } __packed;
1247
1248 struct host_cmd_ds_mac_reg_access {
1249         __le16 action;
1250         __le16 offset;
1251         __le32 value;
1252 } __packed;
1253
1254 struct host_cmd_ds_bbp_reg_access {
1255         __le16 action;
1256         __le16 offset;
1257         u8 value;
1258         u8 reserved[3];
1259 } __packed;
1260
1261 struct host_cmd_ds_rf_reg_access {
1262         __le16 action;
1263         __le16 offset;
1264         u8 value;
1265         u8 reserved[3];
1266 } __packed;
1267
1268 struct host_cmd_ds_pmic_reg_access {
1269         __le16 action;
1270         __le16 offset;
1271         u8 value;
1272         u8 reserved[3];
1273 } __packed;
1274
1275 struct host_cmd_ds_802_11_eeprom_access {
1276         __le16 action;
1277
1278         __le16 offset;
1279         __le16 byte_count;
1280         u8 value;
1281 } __packed;
1282
1283 struct host_cmd_ds_802_11_rf_channel {
1284         __le16 action;
1285         __le16 current_channel;
1286         __le16 rf_type;
1287         __le16 reserved;
1288         u8 reserved_1[32];
1289 } __packed;
1290
1291 struct host_cmd_ds_version_ext {
1292         u8 version_str_sel;
1293         char version_str[128];
1294 } __packed;
1295
1296 struct host_cmd_ds_802_11_ibss_status {
1297         __le16 action;
1298         __le16 enable;
1299         u8 bssid[ETH_ALEN];
1300         __le16 beacon_interval;
1301         __le16 atim_window;
1302         __le16 use_g_rate_protect;
1303 } __packed;
1304
1305 #define CONNECTION_TYPE_INFRA   0
1306 #define CONNECTION_TYPE_ADHOC   1
1307
1308 struct host_cmd_ds_set_bss_mode {
1309         u8 con_type;
1310 } __packed;
1311
1312 struct host_cmd_ds_command {
1313         __le16 command;
1314         __le16 size;
1315         __le16 seq_num;
1316         __le16 result;
1317         union {
1318                 struct host_cmd_ds_get_hw_spec hw_spec;
1319                 struct host_cmd_ds_mac_control mac_ctrl;
1320                 struct host_cmd_ds_802_11_mac_address mac_addr;
1321                 struct host_cmd_ds_mac_multicast_adr mc_addr;
1322                 struct host_cmd_ds_802_11_get_log get_log;
1323                 struct host_cmd_ds_802_11_rssi_info rssi_info;
1324                 struct host_cmd_ds_802_11_rssi_info_rsp rssi_info_rsp;
1325                 struct host_cmd_ds_802_11_snmp_mib smib;
1326                 struct host_cmd_ds_802_11_rf_channel rf_channel;
1327                 struct host_cmd_ds_tx_rate_query tx_rate;
1328                 struct host_cmd_ds_tx_rate_cfg tx_rate_cfg;
1329                 struct host_cmd_ds_txpwr_cfg txp_cfg;
1330                 struct host_cmd_ds_802_11_ps_mode_enh psmode_enh;
1331                 struct host_cmd_ds_802_11_hs_cfg_enh opt_hs_cfg;
1332                 struct host_cmd_ds_802_11_scan scan;
1333                 struct host_cmd_ds_802_11_scan_rsp scan_resp;
1334                 struct host_cmd_ds_802_11_bg_scan_query bg_scan_query;
1335                 struct host_cmd_ds_802_11_bg_scan_query_rsp bg_scan_query_resp;
1336                 struct host_cmd_ds_802_11_associate associate;
1337                 struct host_cmd_ds_802_11_associate_rsp associate_rsp;
1338                 struct host_cmd_ds_802_11_deauthenticate deauth;
1339                 struct host_cmd_ds_802_11_ad_hoc_start adhoc_start;
1340                 struct host_cmd_ds_802_11_ad_hoc_result adhoc_result;
1341                 struct host_cmd_ds_802_11_ad_hoc_join adhoc_join;
1342                 struct host_cmd_ds_802_11d_domain_info domain_info;
1343                 struct host_cmd_ds_802_11d_domain_info_rsp domain_info_resp;
1344                 struct host_cmd_ds_11n_addba_req add_ba_req;
1345                 struct host_cmd_ds_11n_addba_rsp add_ba_rsp;
1346                 struct host_cmd_ds_11n_delba del_ba;
1347                 struct host_cmd_ds_txbuf_cfg tx_buf;
1348                 struct host_cmd_ds_amsdu_aggr_ctrl amsdu_aggr_ctrl;
1349                 struct host_cmd_ds_11n_cfg htcfg;
1350                 struct host_cmd_ds_wmm_get_status get_wmm_status;
1351                 struct host_cmd_ds_802_11_key_material key_material;
1352                 struct host_cmd_ds_version_ext verext;
1353                 struct host_cmd_ds_802_11_ibss_status ibss_coalescing;
1354                 struct host_cmd_ds_mac_reg_access mac_reg;
1355                 struct host_cmd_ds_bbp_reg_access bbp_reg;
1356                 struct host_cmd_ds_rf_reg_access rf_reg;
1357                 struct host_cmd_ds_pmic_reg_access pmic_reg;
1358                 struct host_cmd_ds_set_bss_mode bss_mode;
1359                 struct host_cmd_ds_802_11_eeprom_access eeprom;
1360         } params;
1361 } __packed;
1362
1363 struct mwifiex_opt_sleep_confirm {
1364         __le16 command;
1365         __le16 size;
1366         __le16 seq_num;
1367         __le16 result;
1368         __le16 action;
1369         struct sleep_confirm_param sleep_cfm;
1370 } __packed;
1371
1372 struct mwifiex_opt_sleep_confirm_buffer {
1373         u8 hdr[4];
1374         struct mwifiex_opt_sleep_confirm ps_cfm_sleep;
1375 } __packed;
1376 #endif /* !_MWIFIEX_FW_H_ */