fw.h 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634
  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. #ifndef _MWIFIEX_FW_H_
  20. #define _MWIFIEX_FW_H_
  21. #include <linux/if_ether.h>
  22. #define INTF_HEADER_LEN 4
  23. struct rfc_1042_hdr {
  24. u8 llc_dsap;
  25. u8 llc_ssap;
  26. u8 llc_ctrl;
  27. u8 snap_oui[3];
  28. u16 snap_type;
  29. };
  30. struct rx_packet_hdr {
  31. struct ethhdr eth803_hdr;
  32. struct rfc_1042_hdr rfc1042_hdr;
  33. };
  34. struct tx_packet_hdr {
  35. struct ethhdr eth803_hdr;
  36. struct rfc_1042_hdr rfc1042_hdr;
  37. };
  38. #define B_SUPPORTED_RATES 5
  39. #define G_SUPPORTED_RATES 9
  40. #define BG_SUPPORTED_RATES 13
  41. #define A_SUPPORTED_RATES 9
  42. #define HOSTCMD_SUPPORTED_RATES 14
  43. #define N_SUPPORTED_RATES 3
  44. #define ALL_802_11_BANDS (BAND_A | BAND_B | BAND_G | BAND_GN | \
  45. BAND_AN | BAND_GAC | BAND_AAC)
  46. #define FW_MULTI_BANDS_SUPPORT (BIT(8) | BIT(9) | BIT(10) | BIT(11) | \
  47. BIT(12) | BIT(13))
  48. #define IS_SUPPORT_MULTI_BANDS(adapter) \
  49. (adapter->fw_cap_info & FW_MULTI_BANDS_SUPPORT)
  50. /* shift bit 12 and bit 13 in fw_cap_info from the firmware to bit 13 and 14
  51. * for 11ac so that bit 11 is for GN, bit 12 for AN, bit 13 for GAC, and bit
  52. * bit 14 for AAC, in order to be compatible with the band capability
  53. * defined in the driver after right shift of 8 bits.
  54. */
  55. #define GET_FW_DEFAULT_BANDS(adapter) \
  56. (((((adapter->fw_cap_info & 0x3000) << 1) | \
  57. (adapter->fw_cap_info & ~0xF000)) >> 8) & \
  58. ALL_802_11_BANDS)
  59. #define HostCmd_WEP_KEY_INDEX_MASK 0x3fff
  60. #define KEY_INFO_ENABLED 0x01
  61. enum KEY_TYPE_ID {
  62. KEY_TYPE_ID_WEP = 0,
  63. KEY_TYPE_ID_TKIP,
  64. KEY_TYPE_ID_AES,
  65. KEY_TYPE_ID_WAPI,
  66. KEY_TYPE_ID_AES_CMAC,
  67. };
  68. #define KEY_MCAST BIT(0)
  69. #define KEY_UNICAST BIT(1)
  70. #define KEY_ENABLED BIT(2)
  71. #define KEY_IGTK BIT(10)
  72. #define WAPI_KEY_LEN 50
  73. #define MAX_POLL_TRIES 100
  74. #define MAX_MULTI_INTERFACE_POLL_TRIES 1000
  75. #define MAX_FIRMWARE_POLL_TRIES 100
  76. #define FIRMWARE_READY_SDIO 0xfedc
  77. #define FIRMWARE_READY_PCIE 0xfedcba00
  78. enum mwifiex_usb_ep {
  79. MWIFIEX_USB_EP_CMD_EVENT = 1,
  80. MWIFIEX_USB_EP_DATA = 2,
  81. };
  82. enum MWIFIEX_802_11_PRIVACY_FILTER {
  83. MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL,
  84. MWIFIEX_802_11_PRIV_FILTER_8021X_WEP
  85. };
  86. #define CAL_SNR(RSSI, NF) ((s16)((s16)(RSSI)-(s16)(NF)))
  87. #define CAL_RSSI(SNR, NF) ((s16)((s16)(SNR)+(s16)(NF)))
  88. #define UAP_BSS_PARAMS_I 0
  89. #define UAP_CUSTOM_IE_I 1
  90. #define MWIFIEX_AUTO_IDX_MASK 0xffff
  91. #define MWIFIEX_DELETE_MASK 0x0000
  92. #define MGMT_MASK_ASSOC_REQ 0x01
  93. #define MGMT_MASK_REASSOC_REQ 0x04
  94. #define MGMT_MASK_ASSOC_RESP 0x02
  95. #define MGMT_MASK_REASSOC_RESP 0x08
  96. #define MGMT_MASK_PROBE_REQ 0x10
  97. #define MGMT_MASK_PROBE_RESP 0x20
  98. #define MGMT_MASK_BEACON 0x100
  99. #define TLV_TYPE_UAP_SSID 0x0000
  100. #define TLV_TYPE_UAP_RATES 0x0001
  101. #define PROPRIETARY_TLV_BASE_ID 0x0100
  102. #define TLV_TYPE_KEY_MATERIAL (PROPRIETARY_TLV_BASE_ID + 0)
  103. #define TLV_TYPE_CHANLIST (PROPRIETARY_TLV_BASE_ID + 1)
  104. #define TLV_TYPE_NUMPROBES (PROPRIETARY_TLV_BASE_ID + 2)
  105. #define TLV_TYPE_RSSI_LOW (PROPRIETARY_TLV_BASE_ID + 4)
  106. #define TLV_TYPE_PASSTHROUGH (PROPRIETARY_TLV_BASE_ID + 10)
  107. #define TLV_TYPE_WMMQSTATUS (PROPRIETARY_TLV_BASE_ID + 16)
  108. #define TLV_TYPE_WILDCARDSSID (PROPRIETARY_TLV_BASE_ID + 18)
  109. #define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 19)
  110. #define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 22)
  111. #define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 31)
  112. #define TLV_TYPE_STA_MAC_ADDR (PROPRIETARY_TLV_BASE_ID + 32)
  113. #define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42)
  114. #define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 44)
  115. #define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45)
  116. #define TLV_TYPE_UAP_BCAST_SSID (PROPRIETARY_TLV_BASE_ID + 48)
  117. #define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 51)
  118. #define TLV_TYPE_UAP_AO_TIMER (PROPRIETARY_TLV_BASE_ID + 57)
  119. #define TLV_TYPE_UAP_WEP_KEY (PROPRIETARY_TLV_BASE_ID + 59)
  120. #define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 60)
  121. #define TLV_TYPE_UAP_ENCRY_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 64)
  122. #define TLV_TYPE_UAP_AKMP (PROPRIETARY_TLV_BASE_ID + 65)
  123. #define TLV_TYPE_UAP_FRAG_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 70)
  124. #define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 82)
  125. #define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 83)
  126. #define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 84)
  127. #define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 93)
  128. #define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 94)
  129. #define TLV_TYPE_UAP_MGMT_FRAME (PROPRIETARY_TLV_BASE_ID + 104)
  130. #define TLV_TYPE_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 105)
  131. #define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 113)
  132. #define TLV_TYPE_PS_PARAM (PROPRIETARY_TLV_BASE_ID + 114)
  133. #define TLV_TYPE_UAP_PS_AO_TIMER (PROPRIETARY_TLV_BASE_ID + 123)
  134. #define TLV_TYPE_PWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 145)
  135. #define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146)
  136. #define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048
  137. #define SSN_MASK 0xfff0
  138. #define BA_RESULT_SUCCESS 0x0
  139. #define BA_RESULT_TIMEOUT 0x2
  140. #define IS_BASTREAM_SETUP(ptr) (ptr->ba_status)
  141. #define BA_STREAM_NOT_ALLOWED 0xff
  142. #define IS_11N_ENABLED(priv) ((priv->adapter->config_bands & BAND_GN || \
  143. priv->adapter->config_bands & BAND_AN) && \
  144. priv->curr_bss_params.bss_descriptor.bcn_ht_cap)
  145. #define INITIATOR_BIT(DelBAParamSet) (((DelBAParamSet) &\
  146. BIT(DELBA_INITIATOR_POS)) >> DELBA_INITIATOR_POS)
  147. #define MWIFIEX_TX_DATA_BUF_SIZE_4K 4096
  148. #define MWIFIEX_TX_DATA_BUF_SIZE_8K 8192
  149. #define ISSUPP_11NENABLED(FwCapInfo) (FwCapInfo & BIT(11))
  150. #define MWIFIEX_DEF_HT_CAP (IEEE80211_HT_CAP_DSSSCCK40 | \
  151. (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT) | \
  152. IEEE80211_HT_CAP_SM_PS)
  153. #define MWIFIEX_DEF_AMPDU IEEE80211_HT_AMPDU_PARM_FACTOR
  154. /* dev_cap bitmap
  155. * BIT
  156. * 0-16 reserved
  157. * 17 IEEE80211_HT_CAP_SUP_WIDTH_20_40
  158. * 18-22 reserved
  159. * 23 IEEE80211_HT_CAP_SGI_20
  160. * 24 IEEE80211_HT_CAP_SGI_40
  161. * 25 IEEE80211_HT_CAP_TX_STBC
  162. * 26 IEEE80211_HT_CAP_RX_STBC
  163. * 27-28 reserved
  164. * 29 IEEE80211_HT_CAP_GRN_FLD
  165. * 30-31 reserved
  166. */
  167. #define ISSUPP_CHANWIDTH40(Dot11nDevCap) (Dot11nDevCap & BIT(17))
  168. #define ISSUPP_SHORTGI20(Dot11nDevCap) (Dot11nDevCap & BIT(23))
  169. #define ISSUPP_SHORTGI40(Dot11nDevCap) (Dot11nDevCap & BIT(24))
  170. #define ISSUPP_TXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(25))
  171. #define ISSUPP_RXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(26))
  172. #define ISSUPP_GREENFIELD(Dot11nDevCap) (Dot11nDevCap & BIT(29))
  173. #define ISENABLED_40MHZ_INTOLERANT(Dot11nDevCap) (Dot11nDevCap & BIT(8))
  174. #define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22))
  175. /* httxcfg bitmap
  176. * 0 reserved
  177. * 1 20/40 Mhz enable(1)/disable(0)
  178. * 2-3 reserved
  179. * 4 green field enable(1)/disable(0)
  180. * 5 short GI in 20 Mhz enable(1)/disable(0)
  181. * 6 short GI in 40 Mhz enable(1)/disable(0)
  182. * 7-15 reserved
  183. */
  184. #define MWIFIEX_FW_DEF_HTTXCFG (BIT(1) | BIT(4) | BIT(5) | BIT(6))
  185. #define GET_RXMCSSUPP(DevMCSSupported) (DevMCSSupported & 0x0f)
  186. #define SETHT_MCS32(x) (x[4] |= 1)
  187. #define HT_STREAM_2X2 0x22
  188. #define SET_SECONDARYCHAN(RadioType, SECCHAN) (RadioType |= (SECCHAN << 4))
  189. #define LLC_SNAP_LEN 8
  190. /* HW_SPEC fw_cap_info */
  191. #define ISSUPP_11ACENABLED(fw_cap_info) (fw_cap_info & (BIT(13)|BIT(14)))
  192. #define GET_VHTCAP_CHWDSET(vht_cap_info) ((vht_cap_info >> 2) & 0x3)
  193. #define GET_VHTNSSMCS(mcs_mapset, nss) ((mcs_mapset >> (2 * (nss - 1))) & 0x3)
  194. #define SET_VHTNSSMCS(mcs_mapset, nss, value) (mcs_mapset |= (value & 0x3) << \
  195. (2 * (nss - 1)))
  196. #define NO_NSS_SUPPORT 0x3
  197. #define GET_DEVTXMCSMAP(dev_mcs_map) (dev_mcs_map >> 16)
  198. #define GET_DEVRXMCSMAP(dev_mcs_map) (dev_mcs_map & 0xFFFF)
  199. #define MOD_CLASS_HR_DSSS 0x03
  200. #define MOD_CLASS_OFDM 0x07
  201. #define MOD_CLASS_HT 0x08
  202. #define HT_BW_20 0
  203. #define HT_BW_40 1
  204. #define HostCmd_CMD_GET_HW_SPEC 0x0003
  205. #define HostCmd_CMD_802_11_SCAN 0x0006
  206. #define HostCmd_CMD_802_11_GET_LOG 0x000b
  207. #define HostCmd_CMD_MAC_MULTICAST_ADR 0x0010
  208. #define HostCmd_CMD_802_11_EEPROM_ACCESS 0x0059
  209. #define HostCmd_CMD_802_11_ASSOCIATE 0x0012
  210. #define HostCmd_CMD_802_11_SNMP_MIB 0x0016
  211. #define HostCmd_CMD_MAC_REG_ACCESS 0x0019
  212. #define HostCmd_CMD_BBP_REG_ACCESS 0x001a
  213. #define HostCmd_CMD_RF_REG_ACCESS 0x001b
  214. #define HostCmd_CMD_PMIC_REG_ACCESS 0x00ad
  215. #define HostCmd_CMD_RF_TX_PWR 0x001e
  216. #define HostCmd_CMD_RF_ANTENNA 0x0020
  217. #define HostCmd_CMD_802_11_DEAUTHENTICATE 0x0024
  218. #define HostCmd_CMD_MAC_CONTROL 0x0028
  219. #define HostCmd_CMD_802_11_AD_HOC_START 0x002b
  220. #define HostCmd_CMD_802_11_AD_HOC_JOIN 0x002c
  221. #define HostCmd_CMD_802_11_AD_HOC_STOP 0x0040
  222. #define HostCmd_CMD_802_11_MAC_ADDRESS 0x004D
  223. #define HostCmd_CMD_802_11D_DOMAIN_INFO 0x005b
  224. #define HostCmd_CMD_802_11_KEY_MATERIAL 0x005e
  225. #define HostCmd_CMD_802_11_BG_SCAN_QUERY 0x006c
  226. #define HostCmd_CMD_WMM_GET_STATUS 0x0071
  227. #define HostCmd_CMD_802_11_SUBSCRIBE_EVENT 0x0075
  228. #define HostCmd_CMD_802_11_TX_RATE_QUERY 0x007f
  229. #define HostCmd_CMD_802_11_IBSS_COALESCING_STATUS 0x0083
  230. #define HostCmd_CMD_VERSION_EXT 0x0097
  231. #define HostCmd_CMD_MEF_CFG 0x009a
  232. #define HostCmd_CMD_RSSI_INFO 0x00a4
  233. #define HostCmd_CMD_FUNC_INIT 0x00a9
  234. #define HostCmd_CMD_FUNC_SHUTDOWN 0x00aa
  235. #define HostCmd_CMD_UAP_SYS_CONFIG 0x00b0
  236. #define HostCmd_CMD_UAP_BSS_START 0x00b1
  237. #define HostCmd_CMD_UAP_BSS_STOP 0x00b2
  238. #define HostCmd_CMD_11N_CFG 0x00cd
  239. #define HostCmd_CMD_11N_ADDBA_REQ 0x00ce
  240. #define HostCmd_CMD_11N_ADDBA_RSP 0x00cf
  241. #define HostCmd_CMD_11N_DELBA 0x00d0
  242. #define HostCmd_CMD_RECONFIGURE_TX_BUFF 0x00d9
  243. #define HostCmd_CMD_AMSDU_AGGR_CTRL 0x00df
  244. #define HostCmd_CMD_TXPWR_CFG 0x00d1
  245. #define HostCmd_CMD_TX_RATE_CFG 0x00d6
  246. #define HostCmd_CMD_802_11_PS_MODE_ENH 0x00e4
  247. #define HostCmd_CMD_802_11_HS_CFG_ENH 0x00e5
  248. #define HostCmd_CMD_P2P_MODE_CFG 0x00eb
  249. #define HostCmd_CMD_CAU_REG_ACCESS 0x00ed
  250. #define HostCmd_CMD_SET_BSS_MODE 0x00f7
  251. #define HostCmd_CMD_PCIE_DESC_DETAILS 0x00fa
  252. #define HostCmd_CMD_MGMT_FRAME_REG 0x010c
  253. #define HostCmd_CMD_REMAIN_ON_CHAN 0x010d
  254. #define PROTOCOL_NO_SECURITY 0x01
  255. #define PROTOCOL_STATIC_WEP 0x02
  256. #define PROTOCOL_WPA 0x08
  257. #define PROTOCOL_WPA2 0x20
  258. #define PROTOCOL_WPA2_MIXED 0x28
  259. #define PROTOCOL_EAP 0x40
  260. #define KEY_MGMT_NONE 0x04
  261. #define KEY_MGMT_PSK 0x02
  262. #define KEY_MGMT_EAP 0x01
  263. #define CIPHER_TKIP 0x04
  264. #define CIPHER_AES_CCMP 0x08
  265. #define VALID_CIPHER_BITMAP 0x0c
  266. enum ENH_PS_MODES {
  267. EN_PS = 1,
  268. DIS_PS = 2,
  269. EN_AUTO_DS = 3,
  270. DIS_AUTO_DS = 4,
  271. SLEEP_CONFIRM = 5,
  272. GET_PS = 0,
  273. EN_AUTO_PS = 0xff,
  274. DIS_AUTO_PS = 0xfe,
  275. };
  276. enum P2P_MODES {
  277. P2P_MODE_DISABLE = 0,
  278. P2P_MODE_DEVICE = 1,
  279. P2P_MODE_GO = 2,
  280. P2P_MODE_CLIENT = 3,
  281. };
  282. #define HostCmd_RET_BIT 0x8000
  283. #define HostCmd_ACT_GEN_GET 0x0000
  284. #define HostCmd_ACT_GEN_SET 0x0001
  285. #define HostCmd_ACT_GEN_REMOVE 0x0004
  286. #define HostCmd_ACT_BITWISE_SET 0x0002
  287. #define HostCmd_ACT_BITWISE_CLR 0x0003
  288. #define HostCmd_RESULT_OK 0x0000
  289. #define HostCmd_ACT_MAC_RX_ON 0x0001
  290. #define HostCmd_ACT_MAC_TX_ON 0x0002
  291. #define HostCmd_ACT_MAC_WEP_ENABLE 0x0008
  292. #define HostCmd_ACT_MAC_ETHERNETII_ENABLE 0x0010
  293. #define HostCmd_ACT_MAC_PROMISCUOUS_ENABLE 0x0080
  294. #define HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE 0x0100
  295. #define HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON 0x2000
  296. #define HostCmd_BSS_MODE_IBSS 0x0002
  297. #define HostCmd_BSS_MODE_ANY 0x0003
  298. #define HostCmd_SCAN_RADIO_TYPE_BG 0
  299. #define HostCmd_SCAN_RADIO_TYPE_A 1
  300. #define HS_CFG_CANCEL 0xffffffff
  301. #define HS_CFG_COND_DEF 0x00000000
  302. #define HS_CFG_GPIO_DEF 0xff
  303. #define HS_CFG_GAP_DEF 0
  304. #define HS_CFG_COND_BROADCAST_DATA 0x00000001
  305. #define HS_CFG_COND_UNICAST_DATA 0x00000002
  306. #define HS_CFG_COND_MAC_EVENT 0x00000004
  307. #define HS_CFG_COND_MULTICAST_DATA 0x00000008
  308. #define MWIFIEX_TIMEOUT_FOR_AP_RESP 0xfffc
  309. #define MWIFIEX_STATUS_CODE_AUTH_TIMEOUT 2
  310. #define CMD_F_HOSTCMD (1 << 0)
  311. #define CMD_F_CANCELED (1 << 1)
  312. #define HostCmd_CMD_ID_MASK 0x0fff
  313. #define HostCmd_SEQ_NUM_MASK 0x00ff
  314. #define HostCmd_BSS_NUM_MASK 0x0f00
  315. #define HostCmd_BSS_TYPE_MASK 0xf000
  316. #define HostCmd_ACT_SET_RX 0x0001
  317. #define HostCmd_ACT_SET_TX 0x0002
  318. #define HostCmd_ACT_SET_BOTH 0x0003
  319. #define RF_ANTENNA_AUTO 0xFFFF
  320. #define HostCmd_SET_SEQ_NO_BSS_INFO(seq, num, type) { \
  321. (((seq) & 0x00ff) | \
  322. (((num) & 0x000f) << 8)) | \
  323. (((type) & 0x000f) << 12); }
  324. #define HostCmd_GET_SEQ_NO(seq) \
  325. ((seq) & HostCmd_SEQ_NUM_MASK)
  326. #define HostCmd_GET_BSS_NO(seq) \
  327. (((seq) & HostCmd_BSS_NUM_MASK) >> 8)
  328. #define HostCmd_GET_BSS_TYPE(seq) \
  329. (((seq) & HostCmd_BSS_TYPE_MASK) >> 12)
  330. #define EVENT_DUMMY_HOST_WAKEUP_SIGNAL 0x00000001
  331. #define EVENT_LINK_LOST 0x00000003
  332. #define EVENT_LINK_SENSED 0x00000004
  333. #define EVENT_MIB_CHANGED 0x00000006
  334. #define EVENT_INIT_DONE 0x00000007
  335. #define EVENT_DEAUTHENTICATED 0x00000008
  336. #define EVENT_DISASSOCIATED 0x00000009
  337. #define EVENT_PS_AWAKE 0x0000000a
  338. #define EVENT_PS_SLEEP 0x0000000b
  339. #define EVENT_MIC_ERR_MULTICAST 0x0000000d
  340. #define EVENT_MIC_ERR_UNICAST 0x0000000e
  341. #define EVENT_DEEP_SLEEP_AWAKE 0x00000010
  342. #define EVENT_ADHOC_BCN_LOST 0x00000011
  343. #define EVENT_WMM_STATUS_CHANGE 0x00000017
  344. #define EVENT_BG_SCAN_REPORT 0x00000018
  345. #define EVENT_RSSI_LOW 0x00000019
  346. #define EVENT_SNR_LOW 0x0000001a
  347. #define EVENT_MAX_FAIL 0x0000001b
  348. #define EVENT_RSSI_HIGH 0x0000001c
  349. #define EVENT_SNR_HIGH 0x0000001d
  350. #define EVENT_IBSS_COALESCED 0x0000001e
  351. #define EVENT_DATA_RSSI_LOW 0x00000024
  352. #define EVENT_DATA_SNR_LOW 0x00000025
  353. #define EVENT_DATA_RSSI_HIGH 0x00000026
  354. #define EVENT_DATA_SNR_HIGH 0x00000027
  355. #define EVENT_LINK_QUALITY 0x00000028
  356. #define EVENT_PORT_RELEASE 0x0000002b
  357. #define EVENT_UAP_STA_DEAUTH 0x0000002c
  358. #define EVENT_UAP_STA_ASSOC 0x0000002d
  359. #define EVENT_UAP_BSS_START 0x0000002e
  360. #define EVENT_PRE_BEACON_LOST 0x00000031
  361. #define EVENT_ADDBA 0x00000033
  362. #define EVENT_DELBA 0x00000034
  363. #define EVENT_BA_STREAM_TIEMOUT 0x00000037
  364. #define EVENT_AMSDU_AGGR_CTRL 0x00000042
  365. #define EVENT_UAP_BSS_IDLE 0x00000043
  366. #define EVENT_UAP_BSS_ACTIVE 0x00000044
  367. #define EVENT_WEP_ICV_ERR 0x00000046
  368. #define EVENT_HS_ACT_REQ 0x00000047
  369. #define EVENT_BW_CHANGE 0x00000048
  370. #define EVENT_UAP_MIC_COUNTERMEASURES 0x0000004c
  371. #define EVENT_HOSTWAKE_STAIE 0x0000004d
  372. #define EVENT_REMAIN_ON_CHAN_EXPIRED 0x0000005f
  373. #define EVENT_ID_MASK 0xffff
  374. #define BSS_NUM_MASK 0xf
  375. #define EVENT_GET_BSS_NUM(event_cause) \
  376. (((event_cause) >> 16) & BSS_NUM_MASK)
  377. #define EVENT_GET_BSS_TYPE(event_cause) \
  378. (((event_cause) >> 24) & 0x00ff)
  379. #define MWIFIEX_MAX_PATTERN_LEN 20
  380. #define MWIFIEX_MAX_OFFSET_LEN 50
  381. #define STACK_NBYTES 100
  382. #define TYPE_DNUM 1
  383. #define TYPE_BYTESEQ 2
  384. #define MAX_OPERAND 0x40
  385. #define TYPE_EQ (MAX_OPERAND+1)
  386. #define TYPE_EQ_DNUM (MAX_OPERAND+2)
  387. #define TYPE_EQ_BIT (MAX_OPERAND+3)
  388. #define TYPE_AND (MAX_OPERAND+4)
  389. #define TYPE_OR (MAX_OPERAND+5)
  390. #define MEF_MODE_HOST_SLEEP 1
  391. #define MEF_ACTION_ALLOW_AND_WAKEUP_HOST 3
  392. #define MWIFIEX_CRITERIA_BROADCAST BIT(0)
  393. #define MWIFIEX_CRITERIA_UNICAST BIT(1)
  394. #define MWIFIEX_CRITERIA_MULTICAST BIT(3)
  395. struct mwifiex_ie_types_header {
  396. __le16 type;
  397. __le16 len;
  398. } __packed;
  399. struct mwifiex_ie_types_data {
  400. struct mwifiex_ie_types_header header;
  401. u8 data[1];
  402. } __packed;
  403. #define MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET 0x01
  404. #define MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET 0x08
  405. struct txpd {
  406. u8 bss_type;
  407. u8 bss_num;
  408. __le16 tx_pkt_length;
  409. __le16 tx_pkt_offset;
  410. __le16 tx_pkt_type;
  411. __le32 tx_control;
  412. u8 priority;
  413. u8 flags;
  414. u8 pkt_delay_2ms;
  415. u8 reserved1;
  416. } __packed;
  417. struct rxpd {
  418. u8 bss_type;
  419. u8 bss_num;
  420. __le16 rx_pkt_length;
  421. __le16 rx_pkt_offset;
  422. __le16 rx_pkt_type;
  423. __le16 seq_num;
  424. u8 priority;
  425. u8 rx_rate;
  426. s8 snr;
  427. s8 nf;
  428. /* For: Non-802.11 AC cards
  429. *
  430. * Ht Info [Bit 0] RxRate format: LG=0, HT=1
  431. * [Bit 1] HT Bandwidth: BW20 = 0, BW40 = 1
  432. * [Bit 2] HT Guard Interval: LGI = 0, SGI = 1
  433. *
  434. * For: 802.11 AC cards
  435. * [Bit 1] [Bit 0] RxRate format: legacy rate = 00 HT = 01 VHT = 10
  436. * [Bit 3] [Bit 2] HT/VHT Bandwidth BW20 = 00 BW40 = 01
  437. * BW80 = 10 BW160 = 11
  438. * [Bit 4] HT/VHT Guard interval LGI = 0 SGI = 1
  439. * [Bit 5] STBC support Enabled = 1
  440. * [Bit 6] LDPC support Enabled = 1
  441. * [Bit 7] Reserved
  442. */
  443. u8 ht_info;
  444. u8 reserved;
  445. } __packed;
  446. struct uap_txpd {
  447. u8 bss_type;
  448. u8 bss_num;
  449. __le16 tx_pkt_length;
  450. __le16 tx_pkt_offset;
  451. __le16 tx_pkt_type;
  452. __le32 tx_control;
  453. u8 priority;
  454. u8 flags;
  455. u8 pkt_delay_2ms;
  456. u8 reserved1;
  457. __le32 reserved2;
  458. };
  459. struct uap_rxpd {
  460. u8 bss_type;
  461. u8 bss_num;
  462. __le16 rx_pkt_length;
  463. __le16 rx_pkt_offset;
  464. __le16 rx_pkt_type;
  465. __le16 seq_num;
  466. u8 priority;
  467. u8 reserved1;
  468. };
  469. enum mwifiex_chan_scan_mode_bitmasks {
  470. MWIFIEX_PASSIVE_SCAN = BIT(0),
  471. MWIFIEX_DISABLE_CHAN_FILT = BIT(1),
  472. };
  473. struct mwifiex_chan_scan_param_set {
  474. u8 radio_type;
  475. u8 chan_number;
  476. u8 chan_scan_mode_bitmap;
  477. __le16 min_scan_time;
  478. __le16 max_scan_time;
  479. } __packed;
  480. struct mwifiex_ie_types_chan_list_param_set {
  481. struct mwifiex_ie_types_header header;
  482. struct mwifiex_chan_scan_param_set chan_scan_param[1];
  483. } __packed;
  484. struct chan_band_param_set {
  485. u8 radio_type;
  486. u8 chan_number;
  487. };
  488. struct mwifiex_ie_types_chan_band_list_param_set {
  489. struct mwifiex_ie_types_header header;
  490. struct chan_band_param_set chan_band_param[1];
  491. } __packed;
  492. struct mwifiex_ie_types_rates_param_set {
  493. struct mwifiex_ie_types_header header;
  494. u8 rates[1];
  495. } __packed;
  496. struct mwifiex_ie_types_ssid_param_set {
  497. struct mwifiex_ie_types_header header;
  498. u8 ssid[1];
  499. } __packed;
  500. struct mwifiex_ie_types_num_probes {
  501. struct mwifiex_ie_types_header header;
  502. __le16 num_probes;
  503. } __packed;
  504. struct mwifiex_ie_types_wildcard_ssid_params {
  505. struct mwifiex_ie_types_header header;
  506. u8 max_ssid_length;
  507. u8 ssid[1];
  508. } __packed;
  509. #define TSF_DATA_SIZE 8
  510. struct mwifiex_ie_types_tsf_timestamp {
  511. struct mwifiex_ie_types_header header;
  512. u8 tsf_data[1];
  513. } __packed;
  514. struct mwifiex_cf_param_set {
  515. u8 cfp_cnt;
  516. u8 cfp_period;
  517. u16 cfp_max_duration;
  518. u16 cfp_duration_remaining;
  519. } __packed;
  520. struct mwifiex_ibss_param_set {
  521. u16 atim_window;
  522. } __packed;
  523. struct mwifiex_ie_types_ss_param_set {
  524. struct mwifiex_ie_types_header header;
  525. union {
  526. struct mwifiex_cf_param_set cf_param_set[1];
  527. struct mwifiex_ibss_param_set ibss_param_set[1];
  528. } cf_ibss;
  529. } __packed;
  530. struct mwifiex_fh_param_set {
  531. u16 dwell_time;
  532. u8 hop_set;
  533. u8 hop_pattern;
  534. u8 hop_index;
  535. } __packed;
  536. struct mwifiex_ds_param_set {
  537. u8 current_chan;
  538. } __packed;
  539. struct mwifiex_ie_types_phy_param_set {
  540. struct mwifiex_ie_types_header header;
  541. union {
  542. struct mwifiex_fh_param_set fh_param_set[1];
  543. struct mwifiex_ds_param_set ds_param_set[1];
  544. } fh_ds;
  545. } __packed;
  546. struct mwifiex_ie_types_auth_type {
  547. struct mwifiex_ie_types_header header;
  548. __le16 auth_type;
  549. } __packed;
  550. struct mwifiex_ie_types_vendor_param_set {
  551. struct mwifiex_ie_types_header header;
  552. u8 ie[MWIFIEX_MAX_VSIE_LEN];
  553. };
  554. struct mwifiex_ie_types_rsn_param_set {
  555. struct mwifiex_ie_types_header header;
  556. u8 rsn_ie[1];
  557. } __packed;
  558. #define KEYPARAMSET_FIXED_LEN 6
  559. struct mwifiex_ie_type_key_param_set {
  560. __le16 type;
  561. __le16 length;
  562. __le16 key_type_id;
  563. __le16 key_info;
  564. __le16 key_len;
  565. u8 key[50];
  566. } __packed;
  567. #define IGTK_PN_LEN 8
  568. struct mwifiex_cmac_param {
  569. u8 ipn[IGTK_PN_LEN];
  570. u8 key[WLAN_KEY_LEN_AES_CMAC];
  571. } __packed;
  572. struct host_cmd_ds_802_11_key_material {
  573. __le16 action;
  574. struct mwifiex_ie_type_key_param_set key_param_set;
  575. } __packed;
  576. struct host_cmd_ds_gen {
  577. u16 command;
  578. u16 size;
  579. u16 seq_num;
  580. u16 result;
  581. };
  582. #define S_DS_GEN sizeof(struct host_cmd_ds_gen)
  583. enum sleep_resp_ctrl {
  584. RESP_NOT_NEEDED = 0,
  585. RESP_NEEDED,
  586. };
  587. struct mwifiex_ps_param {
  588. __le16 null_pkt_interval;
  589. __le16 multiple_dtims;
  590. __le16 bcn_miss_timeout;
  591. __le16 local_listen_interval;
  592. __le16 adhoc_wake_period;
  593. __le16 mode;
  594. __le16 delay_to_ps;
  595. };
  596. #define BITMAP_AUTO_DS 0x01
  597. #define BITMAP_STA_PS 0x10
  598. struct mwifiex_ie_types_auto_ds_param {
  599. struct mwifiex_ie_types_header header;
  600. __le16 deep_sleep_timeout;
  601. } __packed;
  602. struct mwifiex_ie_types_ps_param {
  603. struct mwifiex_ie_types_header header;
  604. struct mwifiex_ps_param param;
  605. } __packed;
  606. struct host_cmd_ds_802_11_ps_mode_enh {
  607. __le16 action;
  608. union {
  609. struct mwifiex_ps_param opt_ps;
  610. __le16 ps_bitmap;
  611. } params;
  612. } __packed;
  613. struct host_cmd_ds_get_hw_spec {
  614. __le16 hw_if_version;
  615. __le16 version;
  616. __le16 reserved;
  617. __le16 num_of_mcast_adr;
  618. u8 permanent_addr[ETH_ALEN];
  619. __le16 region_code;
  620. __le16 number_of_antenna;
  621. __le32 fw_release_number;
  622. __le32 reserved_1;
  623. __le32 reserved_2;
  624. __le32 reserved_3;
  625. __le32 fw_cap_info;
  626. __le32 dot_11n_dev_cap;
  627. u8 dev_mcs_support;
  628. __le16 mp_end_port; /* SDIO only, reserved for other interfacces */
  629. __le16 mgmt_buf_count; /* mgmt IE buffer count */
  630. __le32 reserved_5;
  631. __le32 reserved_6;
  632. __le32 dot_11ac_dev_cap;
  633. __le32 dot_11ac_mcs_support;
  634. } __packed;
  635. struct host_cmd_ds_802_11_rssi_info {
  636. __le16 action;
  637. __le16 ndata;
  638. __le16 nbcn;
  639. __le16 reserved[9];
  640. long long reserved_1;
  641. };
  642. struct host_cmd_ds_802_11_rssi_info_rsp {
  643. __le16 action;
  644. __le16 ndata;
  645. __le16 nbcn;
  646. __le16 data_rssi_last;
  647. __le16 data_nf_last;
  648. __le16 data_rssi_avg;
  649. __le16 data_nf_avg;
  650. __le16 bcn_rssi_last;
  651. __le16 bcn_nf_last;
  652. __le16 bcn_rssi_avg;
  653. __le16 bcn_nf_avg;
  654. long long tsf_bcn;
  655. };
  656. struct host_cmd_ds_802_11_mac_address {
  657. __le16 action;
  658. u8 mac_addr[ETH_ALEN];
  659. };
  660. struct host_cmd_ds_mac_control {
  661. __le16 action;
  662. __le16 reserved;
  663. };
  664. struct host_cmd_ds_mac_multicast_adr {
  665. __le16 action;
  666. __le16 num_of_adrs;
  667. u8 mac_list[MWIFIEX_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
  668. } __packed;
  669. struct host_cmd_ds_802_11_deauthenticate {
  670. u8 mac_addr[ETH_ALEN];
  671. __le16 reason_code;
  672. } __packed;
  673. struct host_cmd_ds_802_11_associate {
  674. u8 peer_sta_addr[ETH_ALEN];
  675. __le16 cap_info_bitmap;
  676. __le16 listen_interval;
  677. __le16 beacon_period;
  678. u8 dtim_period;
  679. } __packed;
  680. struct ieee_types_assoc_rsp {
  681. __le16 cap_info_bitmap;
  682. __le16 status_code;
  683. __le16 a_id;
  684. u8 ie_buffer[1];
  685. } __packed;
  686. struct host_cmd_ds_802_11_associate_rsp {
  687. struct ieee_types_assoc_rsp assoc_rsp;
  688. } __packed;
  689. struct ieee_types_cf_param_set {
  690. u8 element_id;
  691. u8 len;
  692. u8 cfp_cnt;
  693. u8 cfp_period;
  694. u16 cfp_max_duration;
  695. u16 cfp_duration_remaining;
  696. } __packed;
  697. struct ieee_types_ibss_param_set {
  698. u8 element_id;
  699. u8 len;
  700. __le16 atim_window;
  701. } __packed;
  702. union ieee_types_ss_param_set {
  703. struct ieee_types_cf_param_set cf_param_set;
  704. struct ieee_types_ibss_param_set ibss_param_set;
  705. } __packed;
  706. struct ieee_types_fh_param_set {
  707. u8 element_id;
  708. u8 len;
  709. __le16 dwell_time;
  710. u8 hop_set;
  711. u8 hop_pattern;
  712. u8 hop_index;
  713. } __packed;
  714. struct ieee_types_ds_param_set {
  715. u8 element_id;
  716. u8 len;
  717. u8 current_chan;
  718. } __packed;
  719. union ieee_types_phy_param_set {
  720. struct ieee_types_fh_param_set fh_param_set;
  721. struct ieee_types_ds_param_set ds_param_set;
  722. } __packed;
  723. struct ieee_types_oper_mode_ntf {
  724. u8 element_id;
  725. u8 len;
  726. u8 oper_mode;
  727. } __packed;
  728. struct host_cmd_ds_802_11_ad_hoc_start {
  729. u8 ssid[IEEE80211_MAX_SSID_LEN];
  730. u8 bss_mode;
  731. __le16 beacon_period;
  732. u8 dtim_period;
  733. union ieee_types_ss_param_set ss_param_set;
  734. union ieee_types_phy_param_set phy_param_set;
  735. u16 reserved1;
  736. __le16 cap_info_bitmap;
  737. u8 data_rate[HOSTCMD_SUPPORTED_RATES];
  738. } __packed;
  739. struct host_cmd_ds_802_11_ad_hoc_result {
  740. u8 pad[3];
  741. u8 bssid[ETH_ALEN];
  742. } __packed;
  743. struct adhoc_bss_desc {
  744. u8 bssid[ETH_ALEN];
  745. u8 ssid[IEEE80211_MAX_SSID_LEN];
  746. u8 bss_mode;
  747. __le16 beacon_period;
  748. u8 dtim_period;
  749. u8 time_stamp[8];
  750. u8 local_time[8];
  751. union ieee_types_phy_param_set phy_param_set;
  752. union ieee_types_ss_param_set ss_param_set;
  753. __le16 cap_info_bitmap;
  754. u8 data_rates[HOSTCMD_SUPPORTED_RATES];
  755. /*
  756. * DO NOT ADD ANY FIELDS TO THIS STRUCTURE.
  757. * It is used in the Adhoc join command and will cause a
  758. * binary layout mismatch with the firmware
  759. */
  760. } __packed;
  761. struct host_cmd_ds_802_11_ad_hoc_join {
  762. struct adhoc_bss_desc bss_descriptor;
  763. u16 reserved1;
  764. u16 reserved2;
  765. } __packed;
  766. struct host_cmd_ds_802_11_get_log {
  767. __le32 mcast_tx_frame;
  768. __le32 failed;
  769. __le32 retry;
  770. __le32 multi_retry;
  771. __le32 frame_dup;
  772. __le32 rts_success;
  773. __le32 rts_failure;
  774. __le32 ack_failure;
  775. __le32 rx_frag;
  776. __le32 mcast_rx_frame;
  777. __le32 fcs_error;
  778. __le32 tx_frame;
  779. __le32 reserved;
  780. __le32 wep_icv_err_cnt[4];
  781. };
  782. /* Enumeration for rate format */
  783. enum _mwifiex_rate_format {
  784. MWIFIEX_RATE_FORMAT_LG = 0,
  785. MWIFIEX_RATE_FORMAT_HT,
  786. MWIFIEX_RATE_FORMAT_VHT,
  787. MWIFIEX_RATE_FORMAT_AUTO = 0xFF,
  788. };
  789. struct host_cmd_ds_tx_rate_query {
  790. u8 tx_rate;
  791. /* Tx Rate Info: For 802.11 AC cards
  792. *
  793. * [Bit 0-1] tx rate formate: LG = 0, HT = 1, VHT = 2
  794. * [Bit 2-3] HT/VHT Bandwidth: BW20 = 0, BW40 = 1, BW80 = 2, BW160 = 3
  795. * [Bit 4] HT/VHT Guard Interval: LGI = 0, SGI = 1
  796. *
  797. * For non-802.11 AC cards
  798. * Ht Info [Bit 0] RxRate format: LG=0, HT=1
  799. * [Bit 1] HT Bandwidth: BW20 = 0, BW40 = 1
  800. * [Bit 2] HT Guard Interval: LGI = 0, SGI = 1
  801. */
  802. u8 ht_info;
  803. } __packed;
  804. enum Host_Sleep_Action {
  805. HS_CONFIGURE = 0x0001,
  806. HS_ACTIVATE = 0x0002,
  807. };
  808. struct mwifiex_hs_config_param {
  809. __le32 conditions;
  810. u8 gpio;
  811. u8 gap;
  812. } __packed;
  813. struct hs_activate_param {
  814. u16 resp_ctrl;
  815. } __packed;
  816. struct host_cmd_ds_802_11_hs_cfg_enh {
  817. __le16 action;
  818. union {
  819. struct mwifiex_hs_config_param hs_config;
  820. struct hs_activate_param hs_activate;
  821. } params;
  822. } __packed;
  823. enum SNMP_MIB_INDEX {
  824. OP_RATE_SET_I = 1,
  825. DTIM_PERIOD_I = 3,
  826. RTS_THRESH_I = 5,
  827. SHORT_RETRY_LIM_I = 6,
  828. LONG_RETRY_LIM_I = 7,
  829. FRAG_THRESH_I = 8,
  830. DOT11D_I = 9,
  831. };
  832. #define MAX_SNMP_BUF_SIZE 128
  833. struct host_cmd_ds_802_11_snmp_mib {
  834. __le16 query_type;
  835. __le16 oid;
  836. __le16 buf_size;
  837. u8 value[1];
  838. } __packed;
  839. struct mwifiex_rate_scope {
  840. __le16 type;
  841. __le16 length;
  842. __le16 hr_dsss_rate_bitmap;
  843. __le16 ofdm_rate_bitmap;
  844. __le16 ht_mcs_rate_bitmap[8];
  845. } __packed;
  846. struct mwifiex_rate_drop_pattern {
  847. __le16 type;
  848. __le16 length;
  849. __le32 rate_drop_mode;
  850. } __packed;
  851. struct host_cmd_ds_tx_rate_cfg {
  852. __le16 action;
  853. __le16 cfg_index;
  854. } __packed;
  855. struct mwifiex_power_group {
  856. u8 modulation_class;
  857. u8 first_rate_code;
  858. u8 last_rate_code;
  859. s8 power_step;
  860. s8 power_min;
  861. s8 power_max;
  862. u8 ht_bandwidth;
  863. u8 reserved;
  864. } __packed;
  865. struct mwifiex_types_power_group {
  866. u16 type;
  867. u16 length;
  868. } __packed;
  869. struct host_cmd_ds_txpwr_cfg {
  870. __le16 action;
  871. __le16 cfg_index;
  872. __le32 mode;
  873. } __packed;
  874. struct host_cmd_ds_rf_tx_pwr {
  875. __le16 action;
  876. __le16 cur_level;
  877. u8 max_power;
  878. u8 min_power;
  879. } __packed;
  880. struct host_cmd_ds_rf_ant_mimo {
  881. __le16 action_tx;
  882. __le16 tx_ant_mode;
  883. __le16 action_rx;
  884. __le16 rx_ant_mode;
  885. };
  886. struct host_cmd_ds_rf_ant_siso {
  887. __le16 action;
  888. __le16 ant_mode;
  889. };
  890. struct mwifiex_bcn_param {
  891. u8 bssid[ETH_ALEN];
  892. u8 rssi;
  893. __le64 timestamp;
  894. __le16 beacon_period;
  895. __le16 cap_info_bitmap;
  896. } __packed;
  897. #define MWIFIEX_USER_SCAN_CHAN_MAX 50
  898. #define MWIFIEX_MAX_SSID_LIST_LENGTH 10
  899. struct mwifiex_scan_cmd_config {
  900. /*
  901. * BSS mode to be sent in the firmware command
  902. */
  903. u8 bss_mode;
  904. /* Specific BSSID used to filter scan results in the firmware */
  905. u8 specific_bssid[ETH_ALEN];
  906. /* Length of TLVs sent in command starting at tlvBuffer */
  907. u32 tlv_buf_len;
  908. /*
  909. * SSID TLV(s) and ChanList TLVs to be sent in the firmware command
  910. *
  911. * TLV_TYPE_CHANLIST, mwifiex_ie_types_chan_list_param_set
  912. * WLAN_EID_SSID, mwifiex_ie_types_ssid_param_set
  913. */
  914. u8 tlv_buf[1]; /* SSID TLV(s) and ChanList TLVs are stored
  915. here */
  916. } __packed;
  917. struct mwifiex_user_scan_chan {
  918. u8 chan_number;
  919. u8 radio_type;
  920. u8 scan_type;
  921. u8 reserved;
  922. u32 scan_time;
  923. } __packed;
  924. struct mwifiex_user_scan_cfg {
  925. /*
  926. * BSS mode to be sent in the firmware command
  927. */
  928. u8 bss_mode;
  929. /* Configure the number of probe requests for active chan scans */
  930. u8 num_probes;
  931. u8 reserved;
  932. /* BSSID filter sent in the firmware command to limit the results */
  933. u8 specific_bssid[ETH_ALEN];
  934. /* SSID filter list used in the firmware to limit the scan results */
  935. struct cfg80211_ssid *ssid_list;
  936. u8 num_ssids;
  937. /* Variable number (fixed maximum) of channels to scan up */
  938. struct mwifiex_user_scan_chan chan_list[MWIFIEX_USER_SCAN_CHAN_MAX];
  939. } __packed;
  940. struct ie_body {
  941. u8 grp_key_oui[4];
  942. u8 ptk_cnt[2];
  943. u8 ptk_body[4];
  944. } __packed;
  945. struct host_cmd_ds_802_11_scan {
  946. u8 bss_mode;
  947. u8 bssid[ETH_ALEN];
  948. u8 tlv_buffer[1];
  949. } __packed;
  950. struct host_cmd_ds_802_11_scan_rsp {
  951. __le16 bss_descript_size;
  952. u8 number_of_sets;
  953. u8 bss_desc_and_tlv_buffer[1];
  954. } __packed;
  955. struct host_cmd_ds_802_11_bg_scan_query {
  956. u8 flush;
  957. } __packed;
  958. struct host_cmd_ds_802_11_bg_scan_query_rsp {
  959. u32 report_condition;
  960. struct host_cmd_ds_802_11_scan_rsp scan_resp;
  961. } __packed;
  962. struct mwifiex_ietypes_domain_param_set {
  963. struct mwifiex_ie_types_header header;
  964. u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
  965. struct ieee80211_country_ie_triplet triplet[1];
  966. } __packed;
  967. struct host_cmd_ds_802_11d_domain_info {
  968. __le16 action;
  969. struct mwifiex_ietypes_domain_param_set domain;
  970. } __packed;
  971. struct host_cmd_ds_802_11d_domain_info_rsp {
  972. __le16 action;
  973. struct mwifiex_ietypes_domain_param_set domain;
  974. } __packed;
  975. struct host_cmd_ds_11n_addba_req {
  976. u8 add_req_result;
  977. u8 peer_mac_addr[ETH_ALEN];
  978. u8 dialog_token;
  979. __le16 block_ack_param_set;
  980. __le16 block_ack_tmo;
  981. __le16 ssn;
  982. } __packed;
  983. struct host_cmd_ds_11n_addba_rsp {
  984. u8 add_rsp_result;
  985. u8 peer_mac_addr[ETH_ALEN];
  986. u8 dialog_token;
  987. __le16 status_code;
  988. __le16 block_ack_param_set;
  989. __le16 block_ack_tmo;
  990. __le16 ssn;
  991. } __packed;
  992. struct host_cmd_ds_11n_delba {
  993. u8 del_result;
  994. u8 peer_mac_addr[ETH_ALEN];
  995. __le16 del_ba_param_set;
  996. __le16 reason_code;
  997. u8 reserved;
  998. } __packed;
  999. struct host_cmd_ds_11n_batimeout {
  1000. u8 tid;
  1001. u8 peer_mac_addr[ETH_ALEN];
  1002. u8 origninator;
  1003. } __packed;
  1004. struct host_cmd_ds_11n_cfg {
  1005. __le16 action;
  1006. __le16 ht_tx_cap;
  1007. __le16 ht_tx_info;
  1008. __le16 misc_config; /* Needed for 802.11AC cards only */
  1009. } __packed;
  1010. struct host_cmd_ds_txbuf_cfg {
  1011. __le16 action;
  1012. __le16 buff_size;
  1013. __le16 mp_end_port; /* SDIO only, reserved for other interfacces */
  1014. __le16 reserved3;
  1015. } __packed;
  1016. struct host_cmd_ds_amsdu_aggr_ctrl {
  1017. __le16 action;
  1018. __le16 enable;
  1019. __le16 curr_buf_size;
  1020. } __packed;
  1021. struct mwifiex_ie_types_wmm_param_set {
  1022. struct mwifiex_ie_types_header header;
  1023. u8 wmm_ie[1];
  1024. };
  1025. struct mwifiex_ie_types_wmm_queue_status {
  1026. struct mwifiex_ie_types_header header;
  1027. u8 queue_index;
  1028. u8 disabled;
  1029. u16 medium_time;
  1030. u8 flow_required;
  1031. u8 flow_created;
  1032. u32 reserved;
  1033. };
  1034. struct ieee_types_vendor_header {
  1035. u8 element_id;
  1036. u8 len;
  1037. u8 oui[4]; /* 0~2: oui, 3: oui_type */
  1038. u8 oui_subtype;
  1039. u8 version;
  1040. } __packed;
  1041. struct ieee_types_wmm_parameter {
  1042. /*
  1043. * WMM Parameter IE - Vendor Specific Header:
  1044. * element_id [221/0xdd]
  1045. * Len [24]
  1046. * Oui [00:50:f2]
  1047. * OuiType [2]
  1048. * OuiSubType [1]
  1049. * Version [1]
  1050. */
  1051. struct ieee_types_vendor_header vend_hdr;
  1052. u8 qos_info_bitmap;
  1053. u8 reserved;
  1054. struct ieee_types_wmm_ac_parameters ac_params[IEEE80211_NUM_ACS];
  1055. } __packed;
  1056. struct ieee_types_wmm_info {
  1057. /*
  1058. * WMM Info IE - Vendor Specific Header:
  1059. * element_id [221/0xdd]
  1060. * Len [7]
  1061. * Oui [00:50:f2]
  1062. * OuiType [2]
  1063. * OuiSubType [0]
  1064. * Version [1]
  1065. */
  1066. struct ieee_types_vendor_header vend_hdr;
  1067. u8 qos_info_bitmap;
  1068. } __packed;
  1069. struct host_cmd_ds_wmm_get_status {
  1070. u8 queue_status_tlv[sizeof(struct mwifiex_ie_types_wmm_queue_status) *
  1071. IEEE80211_NUM_ACS];
  1072. u8 wmm_param_tlv[sizeof(struct ieee_types_wmm_parameter) + 2];
  1073. } __packed;
  1074. struct mwifiex_wmm_ac_status {
  1075. u8 disabled;
  1076. u8 flow_required;
  1077. u8 flow_created;
  1078. };
  1079. struct mwifiex_ie_types_htcap {
  1080. struct mwifiex_ie_types_header header;
  1081. struct ieee80211_ht_cap ht_cap;
  1082. } __packed;
  1083. struct mwifiex_ie_types_vhtcap {
  1084. struct mwifiex_ie_types_header header;
  1085. struct ieee80211_vht_cap vht_cap;
  1086. } __packed;
  1087. struct mwifiex_ie_types_oper_mode_ntf {
  1088. struct mwifiex_ie_types_header header;
  1089. u8 oper_mode;
  1090. } __packed;
  1091. /* VHT Operations IE */
  1092. struct mwifiex_ie_types_vht_oper {
  1093. struct mwifiex_ie_types_header header;
  1094. u8 chan_width;
  1095. u8 chan_center_freq_1;
  1096. u8 chan_center_freq_2;
  1097. /* Basic MCS set map, each 2 bits stands for a NSS */
  1098. u16 basic_mcs_map;
  1099. } __packed;
  1100. struct mwifiex_ie_types_wmmcap {
  1101. struct mwifiex_ie_types_header header;
  1102. struct mwifiex_types_wmm_info wmm_info;
  1103. } __packed;
  1104. struct mwifiex_ie_types_htinfo {
  1105. struct mwifiex_ie_types_header header;
  1106. struct ieee80211_ht_operation ht_oper;
  1107. } __packed;
  1108. struct mwifiex_ie_types_2040bssco {
  1109. struct mwifiex_ie_types_header header;
  1110. u8 bss_co_2040;
  1111. } __packed;
  1112. struct mwifiex_ie_types_extcap {
  1113. struct mwifiex_ie_types_header header;
  1114. u8 ext_cap;
  1115. } __packed;
  1116. struct host_cmd_ds_mac_reg_access {
  1117. __le16 action;
  1118. __le16 offset;
  1119. __le32 value;
  1120. } __packed;
  1121. struct host_cmd_ds_bbp_reg_access {
  1122. __le16 action;
  1123. __le16 offset;
  1124. u8 value;
  1125. u8 reserved[3];
  1126. } __packed;
  1127. struct host_cmd_ds_rf_reg_access {
  1128. __le16 action;
  1129. __le16 offset;
  1130. u8 value;
  1131. u8 reserved[3];
  1132. } __packed;
  1133. struct host_cmd_ds_pmic_reg_access {
  1134. __le16 action;
  1135. __le16 offset;
  1136. u8 value;
  1137. u8 reserved[3];
  1138. } __packed;
  1139. struct host_cmd_ds_802_11_eeprom_access {
  1140. __le16 action;
  1141. __le16 offset;
  1142. __le16 byte_count;
  1143. u8 value;
  1144. } __packed;
  1145. struct host_cmd_tlv {
  1146. __le16 type;
  1147. __le16 len;
  1148. } __packed;
  1149. struct mwifiex_assoc_event {
  1150. u8 sta_addr[ETH_ALEN];
  1151. __le16 type;
  1152. __le16 len;
  1153. __le16 frame_control;
  1154. __le16 cap_info;
  1155. __le16 listen_interval;
  1156. u8 data[0];
  1157. } __packed;
  1158. struct host_cmd_ds_sys_config {
  1159. __le16 action;
  1160. u8 tlv[0];
  1161. };
  1162. struct host_cmd_tlv_akmp {
  1163. struct host_cmd_tlv tlv;
  1164. __le16 key_mgmt;
  1165. __le16 key_mgmt_operation;
  1166. } __packed;
  1167. struct host_cmd_tlv_pwk_cipher {
  1168. struct host_cmd_tlv tlv;
  1169. __le16 proto;
  1170. u8 cipher;
  1171. u8 reserved;
  1172. } __packed;
  1173. struct host_cmd_tlv_gwk_cipher {
  1174. struct host_cmd_tlv tlv;
  1175. u8 cipher;
  1176. u8 reserved;
  1177. } __packed;
  1178. struct host_cmd_tlv_passphrase {
  1179. struct host_cmd_tlv tlv;
  1180. u8 passphrase[0];
  1181. } __packed;
  1182. struct host_cmd_tlv_wep_key {
  1183. struct host_cmd_tlv tlv;
  1184. u8 key_index;
  1185. u8 is_default;
  1186. u8 key[1];
  1187. };
  1188. struct host_cmd_tlv_auth_type {
  1189. struct host_cmd_tlv tlv;
  1190. u8 auth_type;
  1191. } __packed;
  1192. struct host_cmd_tlv_encrypt_protocol {
  1193. struct host_cmd_tlv tlv;
  1194. __le16 proto;
  1195. } __packed;
  1196. struct host_cmd_tlv_ssid {
  1197. struct host_cmd_tlv tlv;
  1198. u8 ssid[0];
  1199. } __packed;
  1200. struct host_cmd_tlv_rates {
  1201. struct host_cmd_tlv tlv;
  1202. u8 rates[0];
  1203. } __packed;
  1204. struct host_cmd_tlv_bcast_ssid {
  1205. struct host_cmd_tlv tlv;
  1206. u8 bcast_ctl;
  1207. } __packed;
  1208. struct host_cmd_tlv_beacon_period {
  1209. struct host_cmd_tlv tlv;
  1210. __le16 period;
  1211. } __packed;
  1212. struct host_cmd_tlv_dtim_period {
  1213. struct host_cmd_tlv tlv;
  1214. u8 period;
  1215. } __packed;
  1216. struct host_cmd_tlv_frag_threshold {
  1217. struct host_cmd_tlv tlv;
  1218. __le16 frag_thr;
  1219. } __packed;
  1220. struct host_cmd_tlv_rts_threshold {
  1221. struct host_cmd_tlv tlv;
  1222. __le16 rts_thr;
  1223. } __packed;
  1224. struct host_cmd_tlv_retry_limit {
  1225. struct host_cmd_tlv tlv;
  1226. u8 limit;
  1227. } __packed;
  1228. struct host_cmd_tlv_mac_addr {
  1229. struct host_cmd_tlv tlv;
  1230. u8 mac_addr[ETH_ALEN];
  1231. } __packed;
  1232. struct host_cmd_tlv_channel_band {
  1233. struct host_cmd_tlv tlv;
  1234. u8 band_config;
  1235. u8 channel;
  1236. } __packed;
  1237. struct host_cmd_tlv_ageout_timer {
  1238. struct host_cmd_tlv tlv;
  1239. __le32 sta_ao_timer;
  1240. } __packed;
  1241. struct host_cmd_ds_version_ext {
  1242. u8 version_str_sel;
  1243. char version_str[128];
  1244. } __packed;
  1245. struct host_cmd_ds_mgmt_frame_reg {
  1246. __le16 action;
  1247. __le32 mask;
  1248. } __packed;
  1249. struct host_cmd_ds_p2p_mode_cfg {
  1250. __le16 action;
  1251. __le16 mode;
  1252. } __packed;
  1253. struct host_cmd_ds_remain_on_chan {
  1254. __le16 action;
  1255. u8 status;
  1256. u8 reserved;
  1257. u8 band_cfg;
  1258. u8 channel;
  1259. __le32 duration;
  1260. } __packed;
  1261. struct host_cmd_ds_802_11_ibss_status {
  1262. __le16 action;
  1263. __le16 enable;
  1264. u8 bssid[ETH_ALEN];
  1265. __le16 beacon_interval;
  1266. __le16 atim_window;
  1267. __le16 use_g_rate_protect;
  1268. } __packed;
  1269. struct mwifiex_fw_mef_entry {
  1270. u8 mode;
  1271. u8 action;
  1272. __le16 exprsize;
  1273. u8 expr[0];
  1274. } __packed;
  1275. struct host_cmd_ds_mef_cfg {
  1276. __le32 criteria;
  1277. __le16 num_entries;
  1278. struct mwifiex_fw_mef_entry mef_entry[0];
  1279. } __packed;
  1280. #define CONNECTION_TYPE_INFRA 0
  1281. #define CONNECTION_TYPE_ADHOC 1
  1282. #define CONNECTION_TYPE_AP 2
  1283. struct host_cmd_ds_set_bss_mode {
  1284. u8 con_type;
  1285. } __packed;
  1286. struct host_cmd_ds_pcie_details {
  1287. /* TX buffer descriptor ring address */
  1288. u32 txbd_addr_lo;
  1289. u32 txbd_addr_hi;
  1290. /* TX buffer descriptor ring count */
  1291. u32 txbd_count;
  1292. /* RX buffer descriptor ring address */
  1293. u32 rxbd_addr_lo;
  1294. u32 rxbd_addr_hi;
  1295. /* RX buffer descriptor ring count */
  1296. u32 rxbd_count;
  1297. /* Event buffer descriptor ring address */
  1298. u32 evtbd_addr_lo;
  1299. u32 evtbd_addr_hi;
  1300. /* Event buffer descriptor ring count */
  1301. u32 evtbd_count;
  1302. /* Sleep cookie buffer physical address */
  1303. u32 sleep_cookie_addr_lo;
  1304. u32 sleep_cookie_addr_hi;
  1305. } __packed;
  1306. struct mwifiex_ie_types_rssi_threshold {
  1307. struct mwifiex_ie_types_header header;
  1308. u8 abs_value;
  1309. u8 evt_freq;
  1310. } __packed;
  1311. struct host_cmd_ds_802_11_subsc_evt {
  1312. __le16 action;
  1313. __le16 events;
  1314. } __packed;
  1315. struct mwifiex_ie {
  1316. __le16 ie_index;
  1317. __le16 mgmt_subtype_mask;
  1318. __le16 ie_length;
  1319. u8 ie_buffer[IEEE_MAX_IE_SIZE];
  1320. } __packed;
  1321. #define MAX_MGMT_IE_INDEX 16
  1322. struct mwifiex_ie_list {
  1323. __le16 type;
  1324. __le16 len;
  1325. struct mwifiex_ie ie_list[MAX_MGMT_IE_INDEX];
  1326. } __packed;
  1327. struct host_cmd_ds_command {
  1328. __le16 command;
  1329. __le16 size;
  1330. __le16 seq_num;
  1331. __le16 result;
  1332. union {
  1333. struct host_cmd_ds_get_hw_spec hw_spec;
  1334. struct host_cmd_ds_mac_control mac_ctrl;
  1335. struct host_cmd_ds_802_11_mac_address mac_addr;
  1336. struct host_cmd_ds_mac_multicast_adr mc_addr;
  1337. struct host_cmd_ds_802_11_get_log get_log;
  1338. struct host_cmd_ds_802_11_rssi_info rssi_info;
  1339. struct host_cmd_ds_802_11_rssi_info_rsp rssi_info_rsp;
  1340. struct host_cmd_ds_802_11_snmp_mib smib;
  1341. struct host_cmd_ds_tx_rate_query tx_rate;
  1342. struct host_cmd_ds_tx_rate_cfg tx_rate_cfg;
  1343. struct host_cmd_ds_txpwr_cfg txp_cfg;
  1344. struct host_cmd_ds_rf_tx_pwr txp;
  1345. struct host_cmd_ds_rf_ant_mimo ant_mimo;
  1346. struct host_cmd_ds_rf_ant_siso ant_siso;
  1347. struct host_cmd_ds_802_11_ps_mode_enh psmode_enh;
  1348. struct host_cmd_ds_802_11_hs_cfg_enh opt_hs_cfg;
  1349. struct host_cmd_ds_802_11_scan scan;
  1350. struct host_cmd_ds_802_11_scan_rsp scan_resp;
  1351. struct host_cmd_ds_802_11_bg_scan_query bg_scan_query;
  1352. struct host_cmd_ds_802_11_bg_scan_query_rsp bg_scan_query_resp;
  1353. struct host_cmd_ds_802_11_associate associate;
  1354. struct host_cmd_ds_802_11_associate_rsp associate_rsp;
  1355. struct host_cmd_ds_802_11_deauthenticate deauth;
  1356. struct host_cmd_ds_802_11_ad_hoc_start adhoc_start;
  1357. struct host_cmd_ds_802_11_ad_hoc_result adhoc_result;
  1358. struct host_cmd_ds_802_11_ad_hoc_join adhoc_join;
  1359. struct host_cmd_ds_802_11d_domain_info domain_info;
  1360. struct host_cmd_ds_802_11d_domain_info_rsp domain_info_resp;
  1361. struct host_cmd_ds_11n_addba_req add_ba_req;
  1362. struct host_cmd_ds_11n_addba_rsp add_ba_rsp;
  1363. struct host_cmd_ds_11n_delba del_ba;
  1364. struct host_cmd_ds_txbuf_cfg tx_buf;
  1365. struct host_cmd_ds_amsdu_aggr_ctrl amsdu_aggr_ctrl;
  1366. struct host_cmd_ds_11n_cfg htcfg;
  1367. struct host_cmd_ds_wmm_get_status get_wmm_status;
  1368. struct host_cmd_ds_802_11_key_material key_material;
  1369. struct host_cmd_ds_version_ext verext;
  1370. struct host_cmd_ds_mgmt_frame_reg reg_mask;
  1371. struct host_cmd_ds_remain_on_chan roc_cfg;
  1372. struct host_cmd_ds_p2p_mode_cfg mode_cfg;
  1373. struct host_cmd_ds_802_11_ibss_status ibss_coalescing;
  1374. struct host_cmd_ds_mef_cfg mef_cfg;
  1375. struct host_cmd_ds_mac_reg_access mac_reg;
  1376. struct host_cmd_ds_bbp_reg_access bbp_reg;
  1377. struct host_cmd_ds_rf_reg_access rf_reg;
  1378. struct host_cmd_ds_pmic_reg_access pmic_reg;
  1379. struct host_cmd_ds_set_bss_mode bss_mode;
  1380. struct host_cmd_ds_pcie_details pcie_host_spec;
  1381. struct host_cmd_ds_802_11_eeprom_access eeprom;
  1382. struct host_cmd_ds_802_11_subsc_evt subsc_evt;
  1383. struct host_cmd_ds_sys_config uap_sys_config;
  1384. } params;
  1385. } __packed;
  1386. struct mwifiex_opt_sleep_confirm {
  1387. __le16 command;
  1388. __le16 size;
  1389. __le16 seq_num;
  1390. __le16 result;
  1391. __le16 action;
  1392. __le16 resp_ctrl;
  1393. } __packed;
  1394. #endif /* !_MWIFIEX_FW_H_ */