fw.h 43.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
/*
 * Marvell Wireless LAN device driver: Firmware specific macros & structures
 *
 * Copyright (C) 2011, Marvell International Ltd.
 *
 * This software file (the "File") is distributed by Marvell International
 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
 * (the "License").  You may use, redistribute and/or modify this File in
 * accordance with the terms and conditions of the License, a copy of which
 * is available by writing to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
 *
 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
 * this warranty disclaimer.
 */

#ifndef _MWIFIEX_FW_H_
#define _MWIFIEX_FW_H_

#include <linux/if_ether.h>


#define INTF_HEADER_LEN     4

struct rfc_1042_hdr {
	u8 llc_dsap;
	u8 llc_ssap;
	u8 llc_ctrl;
	u8 snap_oui[3];
	u16 snap_type;
};

struct rx_packet_hdr {
	struct ethhdr eth803_hdr;
	struct rfc_1042_hdr rfc1042_hdr;
};

struct tx_packet_hdr {
	struct ethhdr eth803_hdr;
	struct rfc_1042_hdr rfc1042_hdr;
};

#define B_SUPPORTED_RATES               5
#define G_SUPPORTED_RATES               9
#define BG_SUPPORTED_RATES              13
#define A_SUPPORTED_RATES               9
#define HOSTCMD_SUPPORTED_RATES         14
#define N_SUPPORTED_RATES               3
52 53
#define ALL_802_11_BANDS           (BAND_A | BAND_B | BAND_G | BAND_GN | \
				    BAND_AN | BAND_GAC | BAND_AAC)
54

55 56
#define FW_MULTI_BANDS_SUPPORT  (BIT(8) | BIT(9) | BIT(10) | BIT(11) | \
				 BIT(12) | BIT(13))
57 58
#define IS_SUPPORT_MULTI_BANDS(adapter)        \
	(adapter->fw_cap_info & FW_MULTI_BANDS_SUPPORT)
59 60 61 62 63 64

/* shift bit 12 and bit 13 in fw_cap_info from the firmware to bit 13 and 14
 * for 11ac so that bit 11 is for GN, bit 12 for AN, bit 13 for GAC, and bit
 * bit 14 for AAC, in order to be compatible with the band capability
 * defined in the driver after right shift of 8 bits.
 */
65
#define GET_FW_DEFAULT_BANDS(adapter)  \
66 67 68
	    (((((adapter->fw_cap_info & 0x3000) << 1) | \
	       (adapter->fw_cap_info & ~0xF000)) >> 8) & \
	     ALL_802_11_BANDS)
69 70 71 72 73 74 75 76 77

#define HostCmd_WEP_KEY_INDEX_MASK              0x3fff

#define KEY_INFO_ENABLED        0x01
enum KEY_TYPE_ID {
	KEY_TYPE_ID_WEP = 0,
	KEY_TYPE_ID_TKIP,
	KEY_TYPE_ID_AES,
	KEY_TYPE_ID_WAPI,
78
	KEY_TYPE_ID_AES_CMAC,
79
};
80 81 82
#define KEY_MCAST	BIT(0)
#define KEY_UNICAST	BIT(1)
#define KEY_ENABLED	BIT(2)
83
#define KEY_IGTK	BIT(10)
84 85 86 87 88 89

#define WAPI_KEY_LEN			50

#define MAX_POLL_TRIES			100
#define MAX_FIRMWARE_POLL_TRIES			100

90 91
#define FIRMWARE_READY_SDIO				0xfedc
#define FIRMWARE_READY_PCIE				0xfedcba00
92

93 94 95 96 97
enum mwifiex_usb_ep {
	MWIFIEX_USB_EP_CMD_EVENT = 1,
	MWIFIEX_USB_EP_DATA = 2,
};

98 99 100 101 102 103
enum MWIFIEX_802_11_PRIVACY_FILTER {
	MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL,
	MWIFIEX_802_11_PRIV_FILTER_8021X_WEP
};

#define CAL_SNR(RSSI, NF)		((s16)((s16)(RSSI)-(s16)(NF)))
104
#define CAL_RSSI(SNR, NF)		((s16)((s16)(SNR)+(s16)(NF)))
105

106
#define UAP_BSS_PARAMS_I			0
A
Avinash Patil 已提交
107 108 109
#define UAP_CUSTOM_IE_I				1
#define MWIFIEX_AUTO_IDX_MASK			0xffff
#define MWIFIEX_DELETE_MASK			0x0000
110 111 112 113 114 115 116
#define MGMT_MASK_ASSOC_REQ			0x01
#define MGMT_MASK_REASSOC_REQ			0x04
#define MGMT_MASK_ASSOC_RESP			0x02
#define MGMT_MASK_REASSOC_RESP			0x08
#define MGMT_MASK_PROBE_REQ			0x10
#define MGMT_MASK_PROBE_RESP			0x20
#define MGMT_MASK_BEACON			0x100
117

118
#define TLV_TYPE_UAP_SSID			0x0000
A
Avinash Patil 已提交
119
#define TLV_TYPE_UAP_RATES			0x0001
120

121 122 123 124
#define PROPRIETARY_TLV_BASE_ID                 0x0100
#define TLV_TYPE_KEY_MATERIAL       (PROPRIETARY_TLV_BASE_ID + 0)
#define TLV_TYPE_CHANLIST           (PROPRIETARY_TLV_BASE_ID + 1)
#define TLV_TYPE_NUMPROBES          (PROPRIETARY_TLV_BASE_ID + 2)
125
#define TLV_TYPE_RSSI_LOW           (PROPRIETARY_TLV_BASE_ID + 4)
126 127 128 129
#define TLV_TYPE_PASSTHROUGH        (PROPRIETARY_TLV_BASE_ID + 10)
#define TLV_TYPE_WMMQSTATUS         (PROPRIETARY_TLV_BASE_ID + 16)
#define TLV_TYPE_WILDCARDSSID       (PROPRIETARY_TLV_BASE_ID + 18)
#define TLV_TYPE_TSFTIMESTAMP       (PROPRIETARY_TLV_BASE_ID + 19)
130
#define TLV_TYPE_RSSI_HIGH          (PROPRIETARY_TLV_BASE_ID + 22)
131
#define TLV_TYPE_AUTH_TYPE          (PROPRIETARY_TLV_BASE_ID + 31)
132
#define TLV_TYPE_STA_MAC_ADDR       (PROPRIETARY_TLV_BASE_ID + 32)
133
#define TLV_TYPE_CHANNELBANDLIST    (PROPRIETARY_TLV_BASE_ID + 42)
134 135
#define TLV_TYPE_UAP_BEACON_PERIOD  (PROPRIETARY_TLV_BASE_ID + 44)
#define TLV_TYPE_UAP_DTIM_PERIOD    (PROPRIETARY_TLV_BASE_ID + 45)
136
#define TLV_TYPE_UAP_BCAST_SSID     (PROPRIETARY_TLV_BASE_ID + 48)
137
#define TLV_TYPE_UAP_RTS_THRESHOLD  (PROPRIETARY_TLV_BASE_ID + 51)
138
#define TLV_TYPE_UAP_AO_TIMER       (PROPRIETARY_TLV_BASE_ID + 57)
139
#define TLV_TYPE_UAP_WEP_KEY        (PROPRIETARY_TLV_BASE_ID + 59)
A
Avinash Patil 已提交
140 141 142
#define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 60)
#define TLV_TYPE_UAP_ENCRY_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 64)
#define TLV_TYPE_UAP_AKMP           (PROPRIETARY_TLV_BASE_ID + 65)
143
#define TLV_TYPE_UAP_FRAG_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 70)
144 145 146
#define TLV_TYPE_RATE_DROP_CONTROL  (PROPRIETARY_TLV_BASE_ID + 82)
#define TLV_TYPE_RATE_SCOPE         (PROPRIETARY_TLV_BASE_ID + 83)
#define TLV_TYPE_POWER_GROUP        (PROPRIETARY_TLV_BASE_ID + 84)
147
#define TLV_TYPE_UAP_RETRY_LIMIT    (PROPRIETARY_TLV_BASE_ID + 93)
148
#define TLV_TYPE_WAPI_IE            (PROPRIETARY_TLV_BASE_ID + 94)
149
#define TLV_TYPE_UAP_MGMT_FRAME     (PROPRIETARY_TLV_BASE_ID + 104)
A
Avinash Patil 已提交
150
#define TLV_TYPE_MGMT_IE            (PROPRIETARY_TLV_BASE_ID + 105)
151 152
#define TLV_TYPE_AUTO_DS_PARAM      (PROPRIETARY_TLV_BASE_ID + 113)
#define TLV_TYPE_PS_PARAM           (PROPRIETARY_TLV_BASE_ID + 114)
153
#define TLV_TYPE_UAP_PS_AO_TIMER    (PROPRIETARY_TLV_BASE_ID + 123)
A
Avinash Patil 已提交
154 155
#define TLV_TYPE_PWK_CIPHER         (PROPRIETARY_TLV_BASE_ID + 145)
#define TLV_TYPE_GWK_CIPHER         (PROPRIETARY_TLV_BASE_ID + 146)
156
#define TLV_TYPE_COALESCE_RULE      (PROPRIETARY_TLV_BASE_ID + 154)
157 158 159 160 161 162 163 164 165 166 167 168 169

#define MWIFIEX_TX_DATA_BUF_SIZE_2K        2048

#define SSN_MASK         0xfff0

#define BA_RESULT_SUCCESS        0x0
#define BA_RESULT_TIMEOUT        0x2

#define IS_BASTREAM_SETUP(ptr)  (ptr->ba_status)

#define BA_STREAM_NOT_ALLOWED   0xff

#define IS_11N_ENABLED(priv) ((priv->adapter->config_bands & BAND_GN || \
170 171
			priv->adapter->config_bands & BAND_AN) && \
			priv->curr_bss_params.bss_descriptor.bcn_ht_cap)
172 173 174 175 176 177 178
#define INITIATOR_BIT(DelBAParamSet) (((DelBAParamSet) &\
			BIT(DELBA_INITIATOR_POS)) >> DELBA_INITIATOR_POS)

#define MWIFIEX_TX_DATA_BUF_SIZE_4K        4096
#define MWIFIEX_TX_DATA_BUF_SIZE_8K        8192

#define ISSUPP_11NENABLED(FwCapInfo) (FwCapInfo & BIT(11))
179

180 181 182 183 184 185
#define MWIFIEX_DEF_HT_CAP	(IEEE80211_HT_CAP_DSSSCCK40 | \
				 (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT) | \
				 IEEE80211_HT_CAP_SM_PS)

#define MWIFIEX_DEF_AMPDU	IEEE80211_HT_AMPDU_PARM_FACTOR

186 187 188 189 190 191 192 193 194 195 196 197 198
/* dev_cap bitmap
 * BIT
 * 0-16		reserved
 * 17		IEEE80211_HT_CAP_SUP_WIDTH_20_40
 * 18-22	reserved
 * 23		IEEE80211_HT_CAP_SGI_20
 * 24		IEEE80211_HT_CAP_SGI_40
 * 25		IEEE80211_HT_CAP_TX_STBC
 * 26		IEEE80211_HT_CAP_RX_STBC
 * 27-28	reserved
 * 29		IEEE80211_HT_CAP_GRN_FLD
 * 30-31	reserved
 */
199
#define ISSUPP_CHANWIDTH40(Dot11nDevCap) (Dot11nDevCap & BIT(17))
200 201 202 203 204
#define ISSUPP_SHORTGI20(Dot11nDevCap) (Dot11nDevCap & BIT(23))
#define ISSUPP_SHORTGI40(Dot11nDevCap) (Dot11nDevCap & BIT(24))
#define ISSUPP_TXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(25))
#define ISSUPP_RXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(26))
#define ISSUPP_GREENFIELD(Dot11nDevCap) (Dot11nDevCap & BIT(29))
205 206
#define ISENABLED_40MHZ_INTOLERANT(Dot11nDevCap) (Dot11nDevCap & BIT(8))
#define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22))
207

208 209 210 211 212 213 214 215 216 217 218
/* httxcfg bitmap
 * 0		reserved
 * 1		20/40 Mhz enable(1)/disable(0)
 * 2-3		reserved
 * 4		green field enable(1)/disable(0)
 * 5		short GI in 20 Mhz enable(1)/disable(0)
 * 6		short GI in 40 Mhz enable(1)/disable(0)
 * 7-15		reserved
 */
#define MWIFIEX_FW_DEF_HTTXCFG (BIT(1) | BIT(4) | BIT(5) | BIT(6))

219 220
#define GET_RXMCSSUPP(DevMCSSupported) (DevMCSSupported & 0x0f)
#define SETHT_MCS32(x) (x[4] |= 1)
221
#define HT_STREAM_2X2	0x22
222

223 224 225 226
#define SET_SECONDARYCHAN(RadioType, SECCHAN) (RadioType |= (SECCHAN << 4))

#define LLC_SNAP_LEN    8

227 228 229 230 231 232 233 234 235 236 237 238 239
/* HW_SPEC fw_cap_info */

#define ISSUPP_11ACENABLED(fw_cap_info) (fw_cap_info & (BIT(13)|BIT(14)))

#define GET_VHTCAP_CHWDSET(vht_cap_info)    ((vht_cap_info >> 2) & 0x3)
#define GET_VHTNSSMCS(mcs_mapset, nss) ((mcs_mapset >> (2 * (nss - 1))) & 0x3)
#define SET_VHTNSSMCS(mcs_mapset, nss, value) (mcs_mapset |= (value & 0x3) << \
					      (2 * (nss - 1)))
#define NO_NSS_SUPPORT		0x3

#define GET_DEVTXMCSMAP(dev_mcs_map)      (dev_mcs_map >> 16)
#define GET_DEVRXMCSMAP(dev_mcs_map)      (dev_mcs_map & 0xFFFF)

240 241 242 243 244 245
#define MOD_CLASS_HR_DSSS       0x03
#define MOD_CLASS_OFDM          0x07
#define MOD_CLASS_HT            0x08
#define HT_BW_20    0
#define HT_BW_40    1

246 247
#define DFS_CHAN_MOVE_TIME      10000

248 249 250 251 252 253 254 255 256 257 258
#define HostCmd_CMD_GET_HW_SPEC                       0x0003
#define HostCmd_CMD_802_11_SCAN                       0x0006
#define HostCmd_CMD_802_11_GET_LOG                    0x000b
#define HostCmd_CMD_MAC_MULTICAST_ADR                 0x0010
#define HostCmd_CMD_802_11_EEPROM_ACCESS              0x0059
#define HostCmd_CMD_802_11_ASSOCIATE                  0x0012
#define HostCmd_CMD_802_11_SNMP_MIB                   0x0016
#define HostCmd_CMD_MAC_REG_ACCESS                    0x0019
#define HostCmd_CMD_BBP_REG_ACCESS                    0x001a
#define HostCmd_CMD_RF_REG_ACCESS                     0x001b
#define HostCmd_CMD_PMIC_REG_ACCESS                   0x00ad
259
#define HostCmd_CMD_RF_TX_PWR                         0x001e
260
#define HostCmd_CMD_RF_ANTENNA                        0x0020
261 262 263 264 265 266 267 268 269 270
#define HostCmd_CMD_802_11_DEAUTHENTICATE             0x0024
#define HostCmd_CMD_MAC_CONTROL                       0x0028
#define HostCmd_CMD_802_11_AD_HOC_START               0x002b
#define HostCmd_CMD_802_11_AD_HOC_JOIN                0x002c
#define HostCmd_CMD_802_11_AD_HOC_STOP                0x0040
#define HostCmd_CMD_802_11_MAC_ADDRESS                0x004D
#define HostCmd_CMD_802_11D_DOMAIN_INFO               0x005b
#define HostCmd_CMD_802_11_KEY_MATERIAL               0x005e
#define HostCmd_CMD_802_11_BG_SCAN_QUERY              0x006c
#define HostCmd_CMD_WMM_GET_STATUS                    0x0071
271
#define HostCmd_CMD_802_11_SUBSCRIBE_EVENT            0x0075
272 273
#define HostCmd_CMD_802_11_TX_RATE_QUERY              0x007f
#define HostCmd_CMD_802_11_IBSS_COALESCING_STATUS     0x0083
274
#define HostCmd_CMD_CFG_DATA                          0x008f
275
#define HostCmd_CMD_VERSION_EXT                       0x0097
A
Amitkumar Karwar 已提交
276
#define HostCmd_CMD_MEF_CFG                           0x009a
277 278 279
#define HostCmd_CMD_RSSI_INFO                         0x00a4
#define HostCmd_CMD_FUNC_INIT                         0x00a9
#define HostCmd_CMD_FUNC_SHUTDOWN                     0x00aa
280 281 282
#define HostCmd_CMD_UAP_SYS_CONFIG                    0x00b0
#define HostCmd_CMD_UAP_BSS_START                     0x00b1
#define HostCmd_CMD_UAP_BSS_STOP                      0x00b2
A
Avinash Patil 已提交
283
#define HostCmd_CMD_UAP_STA_DEAUTH                    0x00b5
284 285 286 287 288 289 290 291 292 293
#define HostCmd_CMD_11N_CFG                           0x00cd
#define HostCmd_CMD_11N_ADDBA_REQ                     0x00ce
#define HostCmd_CMD_11N_ADDBA_RSP                     0x00cf
#define HostCmd_CMD_11N_DELBA                         0x00d0
#define HostCmd_CMD_RECONFIGURE_TX_BUFF               0x00d9
#define HostCmd_CMD_AMSDU_AGGR_CTRL                   0x00df
#define HostCmd_CMD_TXPWR_CFG                         0x00d1
#define HostCmd_CMD_TX_RATE_CFG                       0x00d6
#define HostCmd_CMD_802_11_PS_MODE_ENH                0x00e4
#define HostCmd_CMD_802_11_HS_CFG_ENH                 0x00e5
294
#define HostCmd_CMD_P2P_MODE_CFG                      0x00eb
295 296
#define HostCmd_CMD_CAU_REG_ACCESS                    0x00ed
#define HostCmd_CMD_SET_BSS_MODE                      0x00f7
297
#define HostCmd_CMD_PCIE_DESC_DETAILS                 0x00fa
298
#define HostCmd_CMD_COALESCE_CFG                      0x010a
299
#define HostCmd_CMD_MGMT_FRAME_REG                    0x010c
300
#define HostCmd_CMD_REMAIN_ON_CHAN                    0x010d
301
#define HostCmd_CMD_11AC_CFG			      0x0112
302

A
Avinash Patil 已提交
303 304 305 306 307 308 309 310 311 312 313 314 315
#define PROTOCOL_NO_SECURITY        0x01
#define PROTOCOL_STATIC_WEP         0x02
#define PROTOCOL_WPA                0x08
#define PROTOCOL_WPA2               0x20
#define PROTOCOL_WPA2_MIXED         0x28
#define PROTOCOL_EAP                0x40
#define KEY_MGMT_NONE               0x04
#define KEY_MGMT_PSK                0x02
#define KEY_MGMT_EAP                0x01
#define CIPHER_TKIP                 0x04
#define CIPHER_AES_CCMP             0x08
#define VALID_CIPHER_BITMAP         0x0c

316 317 318 319 320 321 322 323 324 325 326
enum ENH_PS_MODES {
	EN_PS = 1,
	DIS_PS = 2,
	EN_AUTO_DS = 3,
	DIS_AUTO_DS = 4,
	SLEEP_CONFIRM = 5,
	GET_PS = 0,
	EN_AUTO_PS = 0xff,
	DIS_AUTO_PS = 0xfe,
};

327 328 329 330 331 332 333
enum P2P_MODES {
	P2P_MODE_DISABLE = 0,
	P2P_MODE_DEVICE = 1,
	P2P_MODE_GO = 2,
	P2P_MODE_CLIENT = 3,
};

334 335 336
#define HostCmd_RET_BIT                       0x8000
#define HostCmd_ACT_GEN_GET                   0x0000
#define HostCmd_ACT_GEN_SET                   0x0001
337
#define HostCmd_ACT_GEN_REMOVE                0x0004
338 339
#define HostCmd_ACT_BITWISE_SET               0x0002
#define HostCmd_ACT_BITWISE_CLR               0x0003
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
#define HostCmd_RESULT_OK                     0x0000

#define HostCmd_ACT_MAC_RX_ON                 0x0001
#define HostCmd_ACT_MAC_TX_ON                 0x0002
#define HostCmd_ACT_MAC_WEP_ENABLE            0x0008
#define HostCmd_ACT_MAC_ETHERNETII_ENABLE     0x0010
#define HostCmd_ACT_MAC_PROMISCUOUS_ENABLE    0x0080
#define HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE  0x0100
#define HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON     0x2000

#define HostCmd_BSS_MODE_IBSS               0x0002
#define HostCmd_BSS_MODE_ANY                0x0003

#define HostCmd_SCAN_RADIO_TYPE_BG          0
#define HostCmd_SCAN_RADIO_TYPE_A           1

356 357 358 359
#define HS_CFG_CANCEL			0xffffffff
#define HS_CFG_COND_DEF			0x00000000
#define HS_CFG_GPIO_DEF			0xff
#define HS_CFG_GAP_DEF			0
360 361 362 363
#define HS_CFG_COND_BROADCAST_DATA	0x00000001
#define HS_CFG_COND_UNICAST_DATA	0x00000002
#define HS_CFG_COND_MAC_EVENT		0x00000004
#define HS_CFG_COND_MULTICAST_DATA	0x00000008
364

365 366 367
#define MWIFIEX_TIMEOUT_FOR_AP_RESP		0xfffc
#define MWIFIEX_STATUS_CODE_AUTH_TIMEOUT	2

368 369 370 371 372 373 374 375 376 377 378
#define CMD_F_HOSTCMD           (1 << 0)
#define CMD_F_CANCELED          (1 << 1)

#define HostCmd_CMD_ID_MASK             0x0fff

#define HostCmd_SEQ_NUM_MASK            0x00ff

#define HostCmd_BSS_NUM_MASK            0x0f00

#define HostCmd_BSS_TYPE_MASK           0xf000

379 380 381 382 383 384
#define HostCmd_ACT_SET_RX              0x0001
#define HostCmd_ACT_SET_TX              0x0002
#define HostCmd_ACT_SET_BOTH            0x0003

#define RF_ANTENNA_AUTO                 0xFFFF

385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
#define HostCmd_SET_SEQ_NO_BSS_INFO(seq, num, type) {   \
	(((seq) & 0x00ff) |                             \
	 (((num) & 0x000f) << 8)) |                     \
	(((type) & 0x000f) << 12);                  }

#define HostCmd_GET_SEQ_NO(seq)       \
	((seq) & HostCmd_SEQ_NUM_MASK)

#define HostCmd_GET_BSS_NO(seq)         \
	(((seq) & HostCmd_BSS_NUM_MASK) >> 8)

#define HostCmd_GET_BSS_TYPE(seq)       \
	(((seq) & HostCmd_BSS_TYPE_MASK) >> 12)

#define EVENT_DUMMY_HOST_WAKEUP_SIGNAL  0x00000001
#define EVENT_LINK_LOST                 0x00000003
#define EVENT_LINK_SENSED               0x00000004
#define EVENT_MIB_CHANGED               0x00000006
#define EVENT_INIT_DONE                 0x00000007
#define EVENT_DEAUTHENTICATED           0x00000008
#define EVENT_DISASSOCIATED             0x00000009
#define EVENT_PS_AWAKE                  0x0000000a
#define EVENT_PS_SLEEP                  0x0000000b
#define EVENT_MIC_ERR_MULTICAST         0x0000000d
#define EVENT_MIC_ERR_UNICAST           0x0000000e
#define EVENT_DEEP_SLEEP_AWAKE          0x00000010
#define EVENT_ADHOC_BCN_LOST            0x00000011

#define EVENT_WMM_STATUS_CHANGE         0x00000017
#define EVENT_BG_SCAN_REPORT            0x00000018
#define EVENT_RSSI_LOW                  0x00000019
#define EVENT_SNR_LOW                   0x0000001a
#define EVENT_MAX_FAIL                  0x0000001b
#define EVENT_RSSI_HIGH                 0x0000001c
#define EVENT_SNR_HIGH                  0x0000001d
#define EVENT_IBSS_COALESCED            0x0000001e
#define EVENT_DATA_RSSI_LOW             0x00000024
#define EVENT_DATA_SNR_LOW              0x00000025
#define EVENT_DATA_RSSI_HIGH            0x00000026
#define EVENT_DATA_SNR_HIGH             0x00000027
#define EVENT_LINK_QUALITY              0x00000028
#define EVENT_PORT_RELEASE              0x0000002b
427 428 429
#define EVENT_UAP_STA_DEAUTH            0x0000002c
#define EVENT_UAP_STA_ASSOC             0x0000002d
#define EVENT_UAP_BSS_START             0x0000002e
430 431 432 433 434
#define EVENT_PRE_BEACON_LOST           0x00000031
#define EVENT_ADDBA                     0x00000033
#define EVENT_DELBA                     0x00000034
#define EVENT_BA_STREAM_TIEMOUT         0x00000037
#define EVENT_AMSDU_AGGR_CTRL           0x00000042
435 436
#define EVENT_UAP_BSS_IDLE              0x00000043
#define EVENT_UAP_BSS_ACTIVE            0x00000044
437 438 439
#define EVENT_WEP_ICV_ERR               0x00000046
#define EVENT_HS_ACT_REQ                0x00000047
#define EVENT_BW_CHANGE                 0x00000048
440
#define EVENT_UAP_MIC_COUNTERMEASURES   0x0000004c
441
#define EVENT_HOSTWAKE_STAIE		0x0000004d
442
#define EVENT_CHANNEL_SWITCH_ANN        0x00000050
443
#define EVENT_REMAIN_ON_CHAN_EXPIRED    0x0000005f
444 445 446 447 448 449 450 451 452 453

#define EVENT_ID_MASK                   0xffff
#define BSS_NUM_MASK                    0xf

#define EVENT_GET_BSS_NUM(event_cause)          \
	(((event_cause) >> 16) & BSS_NUM_MASK)

#define EVENT_GET_BSS_TYPE(event_cause)         \
	(((event_cause) >> 24) & 0x00ff)

A
Amitkumar Karwar 已提交
454
#define MWIFIEX_MAX_PATTERN_LEN		20
455
#define MWIFIEX_MAX_OFFSET_LEN		100
A
Amitkumar Karwar 已提交
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470
#define STACK_NBYTES			100
#define TYPE_DNUM			1
#define TYPE_BYTESEQ			2
#define MAX_OPERAND			0x40
#define TYPE_EQ				(MAX_OPERAND+1)
#define TYPE_EQ_DNUM			(MAX_OPERAND+2)
#define TYPE_EQ_BIT			(MAX_OPERAND+3)
#define TYPE_AND			(MAX_OPERAND+4)
#define TYPE_OR				(MAX_OPERAND+5)
#define MEF_MODE_HOST_SLEEP			1
#define MEF_ACTION_ALLOW_AND_WAKEUP_HOST	3
#define MWIFIEX_CRITERIA_BROADCAST	BIT(0)
#define MWIFIEX_CRITERIA_UNICAST	BIT(1)
#define MWIFIEX_CRITERIA_MULTICAST	BIT(3)

471 472
#define CFG_DATA_TYPE_CAL		2

473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
struct mwifiex_ie_types_header {
	__le16 type;
	__le16 len;
} __packed;

struct mwifiex_ie_types_data {
	struct mwifiex_ie_types_header header;
	u8 data[1];
} __packed;

#define MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET 0x01
#define MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET 0x08

struct txpd {
	u8 bss_type;
	u8 bss_num;
	__le16 tx_pkt_length;
	__le16 tx_pkt_offset;
	__le16 tx_pkt_type;
	__le32 tx_control;
	u8 priority;
	u8 flags;
	u8 pkt_delay_2ms;
	u8 reserved1;
} __packed;

struct rxpd {
	u8 bss_type;
	u8 bss_num;
502 503 504 505
	__le16 rx_pkt_length;
	__le16 rx_pkt_offset;
	__le16 rx_pkt_type;
	__le16 seq_num;
506 507 508 509
	u8 priority;
	u8 rx_rate;
	s8 snr;
	s8 nf;
510 511 512 513

	/* For: Non-802.11 AC cards
	 *
	 * Ht Info [Bit 0] RxRate format: LG=0, HT=1
514
	 * [Bit 1]  HT Bandwidth: BW20 = 0, BW40 = 1
515 516 517 518 519 520 521 522 523 524 525
	 * [Bit 2]  HT Guard Interval: LGI = 0, SGI = 1
	 *
	 * For: 802.11 AC cards
	 * [Bit 1] [Bit 0] RxRate format: legacy rate = 00 HT = 01 VHT = 10
	 * [Bit 3] [Bit 2] HT/VHT Bandwidth BW20 = 00 BW40 = 01
	 *						BW80 = 10  BW160 = 11
	 * [Bit 4] HT/VHT Guard interval LGI = 0 SGI = 1
	 * [Bit 5] STBC support Enabled = 1
	 * [Bit 6] LDPC support Enabled = 1
	 * [Bit 7] Reserved
	 */
526 527 528 529
	u8 ht_info;
	u8 reserved;
} __packed;

A
Avinash Patil 已提交
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554
struct uap_txpd {
	u8 bss_type;
	u8 bss_num;
	__le16 tx_pkt_length;
	__le16 tx_pkt_offset;
	__le16 tx_pkt_type;
	__le32 tx_control;
	u8 priority;
	u8 flags;
	u8 pkt_delay_2ms;
	u8 reserved1;
	__le32 reserved2;
};

struct uap_rxpd {
	u8 bss_type;
	u8 bss_num;
	__le16 rx_pkt_length;
	__le16 rx_pkt_offset;
	__le16 rx_pkt_type;
	__le16 seq_num;
	u8 priority;
	u8 reserved1;
};

555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612
enum mwifiex_chan_scan_mode_bitmasks {
	MWIFIEX_PASSIVE_SCAN = BIT(0),
	MWIFIEX_DISABLE_CHAN_FILT = BIT(1),
};

struct mwifiex_chan_scan_param_set {
	u8 radio_type;
	u8 chan_number;
	u8 chan_scan_mode_bitmap;
	__le16 min_scan_time;
	__le16 max_scan_time;
} __packed;

struct mwifiex_ie_types_chan_list_param_set {
	struct mwifiex_ie_types_header header;
	struct mwifiex_chan_scan_param_set chan_scan_param[1];
} __packed;

struct chan_band_param_set {
	u8 radio_type;
	u8 chan_number;
};

struct mwifiex_ie_types_chan_band_list_param_set {
	struct mwifiex_ie_types_header header;
	struct chan_band_param_set chan_band_param[1];
} __packed;

struct mwifiex_ie_types_rates_param_set {
	struct mwifiex_ie_types_header header;
	u8 rates[1];
} __packed;

struct mwifiex_ie_types_ssid_param_set {
	struct mwifiex_ie_types_header header;
	u8 ssid[1];
} __packed;

struct mwifiex_ie_types_num_probes {
	struct mwifiex_ie_types_header header;
	__le16 num_probes;
} __packed;

struct mwifiex_ie_types_wildcard_ssid_params {
	struct mwifiex_ie_types_header header;
	u8 max_ssid_length;
	u8 ssid[1];
} __packed;

#define TSF_DATA_SIZE            8
struct mwifiex_ie_types_tsf_timestamp {
	struct mwifiex_ie_types_header header;
	u8 tsf_data[1];
} __packed;

struct mwifiex_cf_param_set {
	u8 cfp_cnt;
	u8 cfp_period;
613 614
	__le16 cfp_max_duration;
	__le16 cfp_duration_remaining;
615 616 617
} __packed;

struct mwifiex_ibss_param_set {
618
	__le16 atim_window;
619 620 621 622 623 624 625 626 627 628 629
} __packed;

struct mwifiex_ie_types_ss_param_set {
	struct mwifiex_ie_types_header header;
	union {
		struct mwifiex_cf_param_set cf_param_set[1];
		struct mwifiex_ibss_param_set ibss_param_set[1];
	} cf_ibss;
} __packed;

struct mwifiex_fh_param_set {
630
	__le16 dwell_time;
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
	u8 hop_set;
	u8 hop_pattern;
	u8 hop_index;
} __packed;

struct mwifiex_ds_param_set {
	u8 current_chan;
} __packed;

struct mwifiex_ie_types_phy_param_set {
	struct mwifiex_ie_types_header header;
	union {
		struct mwifiex_fh_param_set fh_param_set[1];
		struct mwifiex_ds_param_set ds_param_set[1];
	} fh_ds;
} __packed;

struct mwifiex_ie_types_auth_type {
	struct mwifiex_ie_types_header header;
	__le16 auth_type;
} __packed;

struct mwifiex_ie_types_vendor_param_set {
	struct mwifiex_ie_types_header header;
	u8 ie[MWIFIEX_MAX_VSIE_LEN];
};

struct mwifiex_ie_types_rsn_param_set {
	struct mwifiex_ie_types_header header;
	u8 rsn_ie[1];
} __packed;

#define KEYPARAMSET_FIXED_LEN 6

struct mwifiex_ie_type_key_param_set {
	__le16 type;
	__le16 length;
	__le16 key_type_id;
	__le16 key_info;
	__le16 key_len;
	u8 key[50];
} __packed;
673 674 675 676 677 678 679

#define IGTK_PN_LEN		8

struct mwifiex_cmac_param {
	u8 ipn[IGTK_PN_LEN];
	u8 key[WLAN_KEY_LEN_AES_CMAC];
} __packed;
680 681 682 683 684 685 686

struct host_cmd_ds_802_11_key_material {
	__le16 action;
	struct mwifiex_ie_type_key_param_set key_param_set;
} __packed;

struct host_cmd_ds_gen {
687 688 689 690
	__le16 command;
	__le16 size;
	__le16 seq_num;
	__le16 result;
691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
};

#define S_DS_GEN        sizeof(struct host_cmd_ds_gen)

enum sleep_resp_ctrl {
	RESP_NOT_NEEDED = 0,
	RESP_NEEDED,
};

struct mwifiex_ps_param {
	__le16 null_pkt_interval;
	__le16 multiple_dtims;
	__le16 bcn_miss_timeout;
	__le16 local_listen_interval;
	__le16 adhoc_wake_period;
	__le16 mode;
	__le16 delay_to_ps;
};

#define BITMAP_AUTO_DS         0x01
#define BITMAP_STA_PS          0x10

struct mwifiex_ie_types_auto_ds_param {
	struct mwifiex_ie_types_header header;
715
	__le16 deep_sleep_timeout;
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747
} __packed;

struct mwifiex_ie_types_ps_param {
	struct mwifiex_ie_types_header header;
	struct mwifiex_ps_param param;
} __packed;

struct host_cmd_ds_802_11_ps_mode_enh {
	__le16 action;

	union {
		struct mwifiex_ps_param opt_ps;
		__le16 ps_bitmap;
	} params;
} __packed;

struct host_cmd_ds_get_hw_spec {
	__le16 hw_if_version;
	__le16 version;
	__le16 reserved;
	__le16 num_of_mcast_adr;
	u8 permanent_addr[ETH_ALEN];
	__le16 region_code;
	__le16 number_of_antenna;
	__le32 fw_release_number;
	__le32 reserved_1;
	__le32 reserved_2;
	__le32 reserved_3;
	__le32 fw_cap_info;
	__le32 dot_11n_dev_cap;
	u8 dev_mcs_support;
	__le16 mp_end_port;	/* SDIO only, reserved for other interfacces */
748 749 750 751 752
	__le16 mgmt_buf_count;	/* mgmt IE buffer count */
	__le32 reserved_5;
	__le32 reserved_6;
	__le32 dot_11ac_dev_cap;
	__le32 dot_11ac_mcs_support;
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822
} __packed;

struct host_cmd_ds_802_11_rssi_info {
	__le16 action;
	__le16 ndata;
	__le16 nbcn;
	__le16 reserved[9];
	long long reserved_1;
};

struct host_cmd_ds_802_11_rssi_info_rsp {
	__le16 action;
	__le16 ndata;
	__le16 nbcn;
	__le16 data_rssi_last;
	__le16 data_nf_last;
	__le16 data_rssi_avg;
	__le16 data_nf_avg;
	__le16 bcn_rssi_last;
	__le16 bcn_nf_last;
	__le16 bcn_rssi_avg;
	__le16 bcn_nf_avg;
	long long tsf_bcn;
};

struct host_cmd_ds_802_11_mac_address {
	__le16 action;
	u8 mac_addr[ETH_ALEN];
};

struct host_cmd_ds_mac_control {
	__le16 action;
	__le16 reserved;
};

struct host_cmd_ds_mac_multicast_adr {
	__le16 action;
	__le16 num_of_adrs;
	u8 mac_list[MWIFIEX_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
} __packed;

struct host_cmd_ds_802_11_deauthenticate {
	u8 mac_addr[ETH_ALEN];
	__le16 reason_code;
} __packed;

struct host_cmd_ds_802_11_associate {
	u8 peer_sta_addr[ETH_ALEN];
	__le16 cap_info_bitmap;
	__le16 listen_interval;
	__le16 beacon_period;
	u8 dtim_period;
} __packed;

struct ieee_types_assoc_rsp {
	__le16 cap_info_bitmap;
	__le16 status_code;
	__le16 a_id;
	u8 ie_buffer[1];
} __packed;

struct host_cmd_ds_802_11_associate_rsp {
	struct ieee_types_assoc_rsp assoc_rsp;
} __packed;

struct ieee_types_cf_param_set {
	u8 element_id;
	u8 len;
	u8 cfp_cnt;
	u8 cfp_period;
823 824
	__le16 cfp_max_duration;
	__le16 cfp_duration_remaining;
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857
} __packed;

struct ieee_types_ibss_param_set {
	u8 element_id;
	u8 len;
	__le16 atim_window;
} __packed;

union ieee_types_ss_param_set {
	struct ieee_types_cf_param_set cf_param_set;
	struct ieee_types_ibss_param_set ibss_param_set;
} __packed;

struct ieee_types_fh_param_set {
	u8 element_id;
	u8 len;
	__le16 dwell_time;
	u8 hop_set;
	u8 hop_pattern;
	u8 hop_index;
} __packed;

struct ieee_types_ds_param_set {
	u8 element_id;
	u8 len;
	u8 current_chan;
} __packed;

union ieee_types_phy_param_set {
	struct ieee_types_fh_param_set fh_param_set;
	struct ieee_types_ds_param_set ds_param_set;
} __packed;

858 859 860 861 862 863
struct ieee_types_oper_mode_ntf {
	u8 element_id;
	u8 len;
	u8 oper_mode;
} __packed;

864 865 866 867 868 869 870 871 872
struct host_cmd_ds_802_11_ad_hoc_start {
	u8 ssid[IEEE80211_MAX_SSID_LEN];
	u8 bss_mode;
	__le16 beacon_period;
	u8 dtim_period;
	union ieee_types_ss_param_set ss_param_set;
	union ieee_types_phy_param_set phy_param_set;
	u16 reserved1;
	__le16 cap_info_bitmap;
Y
Yogesh Ashok Powar 已提交
873
	u8 data_rate[HOSTCMD_SUPPORTED_RATES];
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923
} __packed;

struct host_cmd_ds_802_11_ad_hoc_result {
	u8 pad[3];
	u8 bssid[ETH_ALEN];
} __packed;

struct adhoc_bss_desc {
	u8 bssid[ETH_ALEN];
	u8 ssid[IEEE80211_MAX_SSID_LEN];
	u8 bss_mode;
	__le16 beacon_period;
	u8 dtim_period;
	u8 time_stamp[8];
	u8 local_time[8];
	union ieee_types_phy_param_set phy_param_set;
	union ieee_types_ss_param_set ss_param_set;
	__le16 cap_info_bitmap;
	u8 data_rates[HOSTCMD_SUPPORTED_RATES];

	/*
	 *  DO NOT ADD ANY FIELDS TO THIS STRUCTURE.
	 *  It is used in the Adhoc join command and will cause a
	 *  binary layout mismatch with the firmware
	 */
} __packed;

struct host_cmd_ds_802_11_ad_hoc_join {
	struct adhoc_bss_desc bss_descriptor;
	u16 reserved1;
	u16 reserved2;
} __packed;

struct host_cmd_ds_802_11_get_log {
	__le32 mcast_tx_frame;
	__le32 failed;
	__le32 retry;
	__le32 multi_retry;
	__le32 frame_dup;
	__le32 rts_success;
	__le32 rts_failure;
	__le32 ack_failure;
	__le32 rx_frag;
	__le32 mcast_rx_frame;
	__le32 fcs_error;
	__le32 tx_frame;
	__le32 reserved;
	__le32 wep_icv_err_cnt[4];
};

924 925 926 927 928 929 930 931
/* Enumeration for rate format */
enum _mwifiex_rate_format {
	MWIFIEX_RATE_FORMAT_LG = 0,
	MWIFIEX_RATE_FORMAT_HT,
	MWIFIEX_RATE_FORMAT_VHT,
	MWIFIEX_RATE_FORMAT_AUTO = 0xFF,
};

932 933
struct host_cmd_ds_tx_rate_query {
	u8 tx_rate;
934 935 936 937 938 939 940 941
	/* Tx Rate Info: For 802.11 AC cards
	 *
	 * [Bit 0-1] tx rate formate: LG = 0, HT = 1, VHT = 2
	 * [Bit 2-3] HT/VHT Bandwidth: BW20 = 0, BW40 = 1, BW80 = 2, BW160 = 3
	 * [Bit 4]   HT/VHT Guard Interval: LGI = 0, SGI = 1
	 *
	 * For non-802.11 AC cards
	 * Ht Info [Bit 0] RxRate format: LG=0, HT=1
942
	 * [Bit 1]  HT Bandwidth: BW20 = 0, BW40 = 1
943 944
	 * [Bit 2]  HT Guard Interval: LGI = 0, SGI = 1
	 */
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959
	u8 ht_info;
} __packed;

enum Host_Sleep_Action {
	HS_CONFIGURE = 0x0001,
	HS_ACTIVATE  = 0x0002,
};

struct mwifiex_hs_config_param {
	__le32 conditions;
	u8 gpio;
	u8 gap;
} __packed;

struct hs_activate_param {
960
	__le16 resp_ctrl;
961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979
} __packed;

struct host_cmd_ds_802_11_hs_cfg_enh {
	__le16 action;

	union {
		struct mwifiex_hs_config_param hs_config;
		struct hs_activate_param hs_activate;
	} params;
} __packed;

enum SNMP_MIB_INDEX {
	OP_RATE_SET_I = 1,
	DTIM_PERIOD_I = 3,
	RTS_THRESH_I = 5,
	SHORT_RETRY_LIM_I = 6,
	LONG_RETRY_LIM_I = 7,
	FRAG_THRESH_I = 8,
	DOT11D_I = 9,
980
	DOT11H_I = 10,
981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022
};

#define MAX_SNMP_BUF_SIZE   128

struct host_cmd_ds_802_11_snmp_mib {
	__le16 query_type;
	__le16 oid;
	__le16 buf_size;
	u8 value[1];
} __packed;

struct mwifiex_rate_scope {
	__le16 type;
	__le16 length;
	__le16 hr_dsss_rate_bitmap;
	__le16 ofdm_rate_bitmap;
	__le16 ht_mcs_rate_bitmap[8];
} __packed;

struct mwifiex_rate_drop_pattern {
	__le16 type;
	__le16 length;
	__le32 rate_drop_mode;
} __packed;

struct host_cmd_ds_tx_rate_cfg {
	__le16 action;
	__le16 cfg_index;
} __packed;

struct mwifiex_power_group {
	u8 modulation_class;
	u8 first_rate_code;
	u8 last_rate_code;
	s8 power_step;
	s8 power_min;
	s8 power_max;
	u8 ht_bandwidth;
	u8 reserved;
} __packed;

struct mwifiex_types_power_group {
1023 1024
	__le16 type;
	__le16 length;
1025 1026 1027 1028 1029 1030 1031 1032
} __packed;

struct host_cmd_ds_txpwr_cfg {
	__le16 action;
	__le16 cfg_index;
	__le32 mode;
} __packed;

1033 1034 1035 1036 1037 1038 1039
struct host_cmd_ds_rf_tx_pwr {
	__le16 action;
	__le16 cur_level;
	u8 max_power;
	u8 min_power;
} __packed;

1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
struct host_cmd_ds_rf_ant_mimo {
	__le16 action_tx;
	__le16 tx_ant_mode;
	__le16 action_rx;
	__le16 rx_ant_mode;
};

struct host_cmd_ds_rf_ant_siso {
	__le16 action;
	__le16 ant_mode;
};

1052 1053 1054
struct mwifiex_bcn_param {
	u8 bssid[ETH_ALEN];
	u8 rssi;
1055
	__le64 timestamp;
1056 1057 1058 1059
	__le16 beacon_period;
	__le16 cap_info_bitmap;
} __packed;

1060 1061 1062 1063 1064 1065
#define MWIFIEX_USER_SCAN_CHAN_MAX             50

#define MWIFIEX_MAX_SSID_LIST_LENGTH         10

struct mwifiex_scan_cmd_config {
	/*
B
Bing Zhao 已提交
1066
	 *  BSS mode to be sent in the firmware command
1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103
	 */
	u8 bss_mode;

	/* Specific BSSID used to filter scan results in the firmware */
	u8 specific_bssid[ETH_ALEN];

	/* Length of TLVs sent in command starting at tlvBuffer */
	u32 tlv_buf_len;

	/*
	 *  SSID TLV(s) and ChanList TLVs to be sent in the firmware command
	 *
	 *  TLV_TYPE_CHANLIST, mwifiex_ie_types_chan_list_param_set
	 *  WLAN_EID_SSID, mwifiex_ie_types_ssid_param_set
	 */
	u8 tlv_buf[1];	/* SSID TLV(s) and ChanList TLVs are stored
				   here */
} __packed;

struct mwifiex_user_scan_chan {
	u8 chan_number;
	u8 radio_type;
	u8 scan_type;
	u8 reserved;
	u32 scan_time;
} __packed;

struct mwifiex_user_scan_cfg {
	/*
	 *  BSS mode to be sent in the firmware command
	 */
	u8 bss_mode;
	/* Configure the number of probe requests for active chan scans */
	u8 num_probes;
	u8 reserved;
	/* BSSID filter sent in the firmware command to limit the results */
	u8 specific_bssid[ETH_ALEN];
1104 1105 1106
	/* SSID filter list used in the firmware to limit the scan results */
	struct cfg80211_ssid *ssid_list;
	u8 num_ssids;
1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133
	/* Variable number (fixed maximum) of channels to scan up */
	struct mwifiex_user_scan_chan chan_list[MWIFIEX_USER_SCAN_CHAN_MAX];
} __packed;

struct ie_body {
	u8 grp_key_oui[4];
	u8 ptk_cnt[2];
	u8 ptk_body[4];
} __packed;

struct host_cmd_ds_802_11_scan {
	u8 bss_mode;
	u8 bssid[ETH_ALEN];
	u8 tlv_buffer[1];
} __packed;

struct host_cmd_ds_802_11_scan_rsp {
	__le16 bss_descript_size;
	u8 number_of_sets;
	u8 bss_desc_and_tlv_buffer[1];
} __packed;

struct host_cmd_ds_802_11_bg_scan_query {
	u8 flush;
} __packed;

struct host_cmd_ds_802_11_bg_scan_query_rsp {
1134
	__le32 report_condition;
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190
	struct host_cmd_ds_802_11_scan_rsp scan_resp;
} __packed;

struct mwifiex_ietypes_domain_param_set {
	struct mwifiex_ie_types_header header;
	u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
	struct ieee80211_country_ie_triplet triplet[1];
} __packed;

struct host_cmd_ds_802_11d_domain_info {
	__le16 action;
	struct mwifiex_ietypes_domain_param_set domain;
} __packed;

struct host_cmd_ds_802_11d_domain_info_rsp {
	__le16 action;
	struct mwifiex_ietypes_domain_param_set domain;
} __packed;

struct host_cmd_ds_11n_addba_req {
	u8 add_req_result;
	u8 peer_mac_addr[ETH_ALEN];
	u8 dialog_token;
	__le16 block_ack_param_set;
	__le16 block_ack_tmo;
	__le16 ssn;
} __packed;

struct host_cmd_ds_11n_addba_rsp {
	u8 add_rsp_result;
	u8 peer_mac_addr[ETH_ALEN];
	u8 dialog_token;
	__le16 status_code;
	__le16 block_ack_param_set;
	__le16 block_ack_tmo;
	__le16 ssn;
} __packed;

struct host_cmd_ds_11n_delba {
	u8 del_result;
	u8 peer_mac_addr[ETH_ALEN];
	__le16 del_ba_param_set;
	__le16 reason_code;
	u8 reserved;
} __packed;

struct host_cmd_ds_11n_batimeout {
	u8 tid;
	u8 peer_mac_addr[ETH_ALEN];
	u8 origninator;
} __packed;

struct host_cmd_ds_11n_cfg {
	__le16 action;
	__le16 ht_tx_cap;
	__le16 ht_tx_info;
1191
	__le16 misc_config;	/* Needed for 802.11AC cards only */
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206
} __packed;

struct host_cmd_ds_txbuf_cfg {
	__le16 action;
	__le16 buff_size;
	__le16 mp_end_port;	/* SDIO only, reserved for other interfacces */
	__le16 reserved3;
} __packed;

struct host_cmd_ds_amsdu_aggr_ctrl {
	__le16 action;
	__le16 enable;
	__le16 curr_buf_size;
} __packed;

A
Avinash Patil 已提交
1207 1208 1209 1210 1211
struct host_cmd_ds_sta_deauth {
	u8 mac[ETH_ALEN];
	__le16 reason;
} __packed;

1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223
struct mwifiex_ie_types_pwr_capability {
	struct mwifiex_ie_types_header header;
	s8 min_pwr;
	s8 max_pwr;
};

struct mwifiex_ie_types_local_pwr_constraint {
	struct mwifiex_ie_types_header header;
	u8 chan;
	u8 constraint;
};

1224 1225 1226 1227 1228 1229 1230 1231 1232
struct mwifiex_ie_types_wmm_param_set {
	struct mwifiex_ie_types_header header;
	u8 wmm_ie[1];
};

struct mwifiex_ie_types_wmm_queue_status {
	struct mwifiex_ie_types_header header;
	u8 queue_index;
	u8 disabled;
1233
	__le16 medium_time;
1234 1235 1236 1237 1238 1239 1240 1241
	u8 flow_required;
	u8 flow_created;
	u32 reserved;
};

struct ieee_types_vendor_header {
	u8 element_id;
	u8 len;
1242
	u8 oui[4];	/* 0~2: oui, 3: oui_type */
1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259
	u8 oui_subtype;
	u8 version;
} __packed;

struct ieee_types_wmm_parameter {
	/*
	 * WMM Parameter IE - Vendor Specific Header:
	 *   element_id  [221/0xdd]
	 *   Len         [24]
	 *   Oui         [00:50:f2]
	 *   OuiType     [2]
	 *   OuiSubType  [1]
	 *   Version     [1]
	 */
	struct ieee_types_vendor_header vend_hdr;
	u8 qos_info_bitmap;
	u8 reserved;
1260
	struct ieee_types_wmm_ac_parameters ac_params[IEEE80211_NUM_ACS];
1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280
} __packed;

struct ieee_types_wmm_info {

	/*
	 * WMM Info IE - Vendor Specific Header:
	 *   element_id  [221/0xdd]
	 *   Len         [7]
	 *   Oui         [00:50:f2]
	 *   OuiType     [2]
	 *   OuiSubType  [0]
	 *   Version     [1]
	 */
	struct ieee_types_vendor_header vend_hdr;

	u8 qos_info_bitmap;
} __packed;

struct host_cmd_ds_wmm_get_status {
	u8 queue_status_tlv[sizeof(struct mwifiex_ie_types_wmm_queue_status) *
1281
			      IEEE80211_NUM_ACS];
1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295
	u8 wmm_param_tlv[sizeof(struct ieee_types_wmm_parameter) + 2];
} __packed;

struct mwifiex_wmm_ac_status {
	u8 disabled;
	u8 flow_required;
	u8 flow_created;
};

struct mwifiex_ie_types_htcap {
	struct mwifiex_ie_types_header header;
	struct ieee80211_ht_cap ht_cap;
} __packed;

1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312
struct mwifiex_ie_types_vhtcap {
	struct mwifiex_ie_types_header header;
	struct ieee80211_vht_cap vht_cap;
} __packed;

struct mwifiex_ie_types_oper_mode_ntf {
	struct mwifiex_ie_types_header header;
	u8 oper_mode;
} __packed;

/* VHT Operations IE */
struct mwifiex_ie_types_vht_oper {
	struct mwifiex_ie_types_header header;
	u8 chan_width;
	u8 chan_center_freq_1;
	u8 chan_center_freq_2;
	/* Basic MCS set map, each 2 bits stands for a NSS */
1313
	__le16 basic_mcs_map;
1314 1315
} __packed;

1316 1317 1318 1319 1320
struct mwifiex_ie_types_wmmcap {
	struct mwifiex_ie_types_header header;
	struct mwifiex_types_wmm_info wmm_info;
} __packed;

1321 1322
struct mwifiex_ie_types_htinfo {
	struct mwifiex_ie_types_header header;
1323
	struct ieee80211_ht_operation ht_oper;
1324 1325 1326 1327 1328 1329 1330 1331 1332
} __packed;

struct mwifiex_ie_types_2040bssco {
	struct mwifiex_ie_types_header header;
	u8 bss_co_2040;
} __packed;

struct mwifiex_ie_types_extcap {
	struct mwifiex_ie_types_header header;
1333
	u8 ext_capab[0];
1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370
} __packed;

struct host_cmd_ds_mac_reg_access {
	__le16 action;
	__le16 offset;
	__le32 value;
} __packed;

struct host_cmd_ds_bbp_reg_access {
	__le16 action;
	__le16 offset;
	u8 value;
	u8 reserved[3];
} __packed;

struct host_cmd_ds_rf_reg_access {
	__le16 action;
	__le16 offset;
	u8 value;
	u8 reserved[3];
} __packed;

struct host_cmd_ds_pmic_reg_access {
	__le16 action;
	__le16 offset;
	u8 value;
	u8 reserved[3];
} __packed;

struct host_cmd_ds_802_11_eeprom_access {
	__le16 action;

	__le16 offset;
	__le16 byte_count;
	u8 value;
} __packed;

1371 1372 1373 1374 1375 1376 1377 1378 1379 1380
struct mwifiex_assoc_event {
	u8 sta_addr[ETH_ALEN];
	__le16 type;
	__le16 len;
	__le16 frame_control;
	__le16 cap_info;
	__le16 listen_interval;
	u8 data[0];
} __packed;

1381 1382 1383 1384
struct host_cmd_ds_sys_config {
	__le16 action;
	u8 tlv[0];
};
A
Avinash Patil 已提交
1385

1386 1387 1388 1389 1390 1391 1392 1393 1394
struct host_cmd_11ac_vht_cfg {
	__le16 action;
	u8 band_config;
	u8 misc_config;
	__le32 cap_info;
	__le32 mcs_tx_set;
	__le32 mcs_rx_set;
} __packed;

A
Avinash Patil 已提交
1395
struct host_cmd_tlv_akmp {
1396
	struct mwifiex_ie_types_header header;
A
Avinash Patil 已提交
1397 1398 1399 1400 1401
	__le16 key_mgmt;
	__le16 key_mgmt_operation;
} __packed;

struct host_cmd_tlv_pwk_cipher {
1402
	struct mwifiex_ie_types_header header;
A
Avinash Patil 已提交
1403 1404 1405 1406 1407 1408
	__le16 proto;
	u8 cipher;
	u8 reserved;
} __packed;

struct host_cmd_tlv_gwk_cipher {
1409
	struct mwifiex_ie_types_header header;
A
Avinash Patil 已提交
1410 1411 1412 1413 1414
	u8 cipher;
	u8 reserved;
} __packed;

struct host_cmd_tlv_passphrase {
1415
	struct mwifiex_ie_types_header header;
A
Avinash Patil 已提交
1416 1417 1418
	u8 passphrase[0];
} __packed;

1419
struct host_cmd_tlv_wep_key {
1420
	struct mwifiex_ie_types_header header;
1421 1422 1423 1424 1425
	u8 key_index;
	u8 is_default;
	u8 key[1];
};

A
Avinash Patil 已提交
1426
struct host_cmd_tlv_auth_type {
1427
	struct mwifiex_ie_types_header header;
A
Avinash Patil 已提交
1428 1429 1430 1431
	u8 auth_type;
} __packed;

struct host_cmd_tlv_encrypt_protocol {
1432
	struct mwifiex_ie_types_header header;
A
Avinash Patil 已提交
1433 1434 1435
	__le16 proto;
} __packed;

1436
struct host_cmd_tlv_ssid {
1437
	struct mwifiex_ie_types_header header;
1438 1439 1440
	u8 ssid[0];
} __packed;

A
Avinash Patil 已提交
1441
struct host_cmd_tlv_rates {
1442
	struct mwifiex_ie_types_header header;
A
Avinash Patil 已提交
1443 1444 1445
	u8 rates[0];
} __packed;

1446
struct host_cmd_tlv_bcast_ssid {
1447
	struct mwifiex_ie_types_header header;
1448 1449 1450
	u8 bcast_ctl;
} __packed;

1451
struct host_cmd_tlv_beacon_period {
1452
	struct mwifiex_ie_types_header header;
1453 1454 1455 1456
	__le16 period;
} __packed;

struct host_cmd_tlv_dtim_period {
1457
	struct mwifiex_ie_types_header header;
1458 1459
	u8 period;
} __packed;
1460

1461
struct host_cmd_tlv_frag_threshold {
1462
	struct mwifiex_ie_types_header header;
1463 1464 1465 1466
	__le16 frag_thr;
} __packed;

struct host_cmd_tlv_rts_threshold {
1467
	struct mwifiex_ie_types_header header;
1468 1469 1470 1471
	__le16 rts_thr;
} __packed;

struct host_cmd_tlv_retry_limit {
1472
	struct mwifiex_ie_types_header header;
1473 1474 1475
	u8 limit;
} __packed;

1476
struct host_cmd_tlv_mac_addr {
1477
	struct mwifiex_ie_types_header header;
1478 1479 1480
	u8 mac_addr[ETH_ALEN];
} __packed;

1481
struct host_cmd_tlv_channel_band {
1482
	struct mwifiex_ie_types_header header;
1483 1484 1485 1486
	u8 band_config;
	u8 channel;
} __packed;

1487
struct host_cmd_tlv_ageout_timer {
1488
	struct mwifiex_ie_types_header header;
1489 1490 1491
	__le32 sta_ao_timer;
} __packed;

1492 1493 1494 1495 1496
struct host_cmd_ds_version_ext {
	u8 version_str_sel;
	char version_str[128];
} __packed;

1497 1498 1499 1500 1501
struct host_cmd_ds_mgmt_frame_reg {
	__le16 action;
	__le32 mask;
} __packed;

1502 1503 1504 1505 1506
struct host_cmd_ds_p2p_mode_cfg {
	__le16 action;
	__le16 mode;
} __packed;

1507 1508 1509 1510 1511 1512 1513 1514 1515
struct host_cmd_ds_remain_on_chan {
	__le16 action;
	u8 status;
	u8 reserved;
	u8 band_cfg;
	u8 channel;
	__le32 duration;
} __packed;

1516 1517 1518 1519 1520 1521 1522 1523 1524
struct host_cmd_ds_802_11_ibss_status {
	__le16 action;
	__le16 enable;
	u8 bssid[ETH_ALEN];
	__le16 beacon_interval;
	__le16 atim_window;
	__le16 use_g_rate_protect;
} __packed;

A
Amitkumar Karwar 已提交
1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537
struct mwifiex_fw_mef_entry {
	u8 mode;
	u8 action;
	__le16 exprsize;
	u8 expr[0];
} __packed;

struct host_cmd_ds_mef_cfg {
	__le32 criteria;
	__le16 num_entries;
	struct mwifiex_fw_mef_entry mef_entry[0];
} __packed;

1538 1539
#define CONNECTION_TYPE_INFRA   0
#define CONNECTION_TYPE_ADHOC   1
1540
#define CONNECTION_TYPE_AP      2
1541 1542 1543 1544 1545

struct host_cmd_ds_set_bss_mode {
	u8 con_type;
} __packed;

1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569
struct host_cmd_ds_pcie_details {
	/* TX buffer descriptor ring address */
	u32 txbd_addr_lo;
	u32 txbd_addr_hi;
	/* TX buffer descriptor ring count */
	u32 txbd_count;

	/* RX buffer descriptor ring address */
	u32 rxbd_addr_lo;
	u32 rxbd_addr_hi;
	/* RX buffer descriptor ring count */
	u32 rxbd_count;

	/* Event buffer descriptor ring address */
	u32 evtbd_addr_lo;
	u32 evtbd_addr_hi;
	/* Event buffer descriptor ring count */
	u32 evtbd_count;

	/* Sleep cookie buffer physical address */
	u32 sleep_cookie_addr_lo;
	u32 sleep_cookie_addr_hi;
} __packed;

1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580
struct mwifiex_ie_types_rssi_threshold {
	struct mwifiex_ie_types_header header;
	u8 abs_value;
	u8 evt_freq;
} __packed;

struct host_cmd_ds_802_11_subsc_evt {
	__le16 action;
	__le16 events;
} __packed;

A
Avinash Patil 已提交
1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594
struct mwifiex_ie {
	__le16 ie_index;
	__le16 mgmt_subtype_mask;
	__le16 ie_length;
	u8 ie_buffer[IEEE_MAX_IE_SIZE];
} __packed;

#define MAX_MGMT_IE_INDEX	16
struct mwifiex_ie_list {
	__le16 type;
	__le16 len;
	struct mwifiex_ie ie_list[MAX_MGMT_IE_INDEX];
} __packed;

1595 1596 1597 1598 1599 1600
struct host_cmd_ds_802_11_cfg_data {
	__le16 action;
	__le16 type;
	__le16 data_len;
} __packed;

1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621
struct coalesce_filt_field_param {
	u8 operation;
	u8 operand_len;
	__le16 offset;
	u8 operand_byte_stream[4];
};

struct coalesce_receive_filt_rule {
	struct mwifiex_ie_types_header header;
	u8 num_of_fields;
	u8 pkt_type;
	__le16 max_coalescing_delay;
	struct coalesce_filt_field_param params[0];
} __packed;

struct host_cmd_ds_coalesce_cfg {
	__le16 action;
	__le16 num_of_rules;
	struct coalesce_receive_filt_rule rule[0];
} __packed;

1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638
struct host_cmd_ds_command {
	__le16 command;
	__le16 size;
	__le16 seq_num;
	__le16 result;
	union {
		struct host_cmd_ds_get_hw_spec hw_spec;
		struct host_cmd_ds_mac_control mac_ctrl;
		struct host_cmd_ds_802_11_mac_address mac_addr;
		struct host_cmd_ds_mac_multicast_adr mc_addr;
		struct host_cmd_ds_802_11_get_log get_log;
		struct host_cmd_ds_802_11_rssi_info rssi_info;
		struct host_cmd_ds_802_11_rssi_info_rsp rssi_info_rsp;
		struct host_cmd_ds_802_11_snmp_mib smib;
		struct host_cmd_ds_tx_rate_query tx_rate;
		struct host_cmd_ds_tx_rate_cfg tx_rate_cfg;
		struct host_cmd_ds_txpwr_cfg txp_cfg;
1639
		struct host_cmd_ds_rf_tx_pwr txp;
1640 1641
		struct host_cmd_ds_rf_ant_mimo ant_mimo;
		struct host_cmd_ds_rf_ant_siso ant_siso;
1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664
		struct host_cmd_ds_802_11_ps_mode_enh psmode_enh;
		struct host_cmd_ds_802_11_hs_cfg_enh opt_hs_cfg;
		struct host_cmd_ds_802_11_scan scan;
		struct host_cmd_ds_802_11_scan_rsp scan_resp;
		struct host_cmd_ds_802_11_bg_scan_query bg_scan_query;
		struct host_cmd_ds_802_11_bg_scan_query_rsp bg_scan_query_resp;
		struct host_cmd_ds_802_11_associate associate;
		struct host_cmd_ds_802_11_associate_rsp associate_rsp;
		struct host_cmd_ds_802_11_deauthenticate deauth;
		struct host_cmd_ds_802_11_ad_hoc_start adhoc_start;
		struct host_cmd_ds_802_11_ad_hoc_result adhoc_result;
		struct host_cmd_ds_802_11_ad_hoc_join adhoc_join;
		struct host_cmd_ds_802_11d_domain_info domain_info;
		struct host_cmd_ds_802_11d_domain_info_rsp domain_info_resp;
		struct host_cmd_ds_11n_addba_req add_ba_req;
		struct host_cmd_ds_11n_addba_rsp add_ba_rsp;
		struct host_cmd_ds_11n_delba del_ba;
		struct host_cmd_ds_txbuf_cfg tx_buf;
		struct host_cmd_ds_amsdu_aggr_ctrl amsdu_aggr_ctrl;
		struct host_cmd_ds_11n_cfg htcfg;
		struct host_cmd_ds_wmm_get_status get_wmm_status;
		struct host_cmd_ds_802_11_key_material key_material;
		struct host_cmd_ds_version_ext verext;
1665
		struct host_cmd_ds_mgmt_frame_reg reg_mask;
1666
		struct host_cmd_ds_remain_on_chan roc_cfg;
1667
		struct host_cmd_ds_p2p_mode_cfg mode_cfg;
1668
		struct host_cmd_ds_802_11_ibss_status ibss_coalescing;
A
Amitkumar Karwar 已提交
1669
		struct host_cmd_ds_mef_cfg mef_cfg;
1670 1671 1672 1673 1674
		struct host_cmd_ds_mac_reg_access mac_reg;
		struct host_cmd_ds_bbp_reg_access bbp_reg;
		struct host_cmd_ds_rf_reg_access rf_reg;
		struct host_cmd_ds_pmic_reg_access pmic_reg;
		struct host_cmd_ds_set_bss_mode bss_mode;
1675
		struct host_cmd_ds_pcie_details pcie_host_spec;
1676
		struct host_cmd_ds_802_11_eeprom_access eeprom;
1677
		struct host_cmd_ds_802_11_subsc_evt subsc_evt;
1678
		struct host_cmd_ds_sys_config uap_sys_config;
A
Avinash Patil 已提交
1679
		struct host_cmd_ds_sta_deauth sta_deauth;
1680
		struct host_cmd_11ac_vht_cfg vht_cfg;
1681
		struct host_cmd_ds_802_11_cfg_data cfg_data;
1682
		struct host_cmd_ds_coalesce_cfg coalesce_cfg;
1683 1684 1685 1686 1687 1688 1689 1690 1691
	} params;
} __packed;

struct mwifiex_opt_sleep_confirm {
	__le16 command;
	__le16 size;
	__le16 seq_num;
	__le16 result;
	__le16 action;
1692
	__le16 resp_ctrl;
1693 1694
} __packed;
#endif /* !_MWIFIEX_FW_H_ */