wlan_def.h 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010
  1. /*
  2. ** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/wlan_def.h#1
  3. */
  4. /*! \file "wlan_def.h"
  5. \brief This file includes the basic definition of WLAN
  6. */
  7. /*
  8. ** Log: wlan_def.h
  9. **
  10. ** 09 02 2013 cp.wu
  11. ** add path to handle reassociation request
  12. *
  13. * 12 05 2011 cp.wu
  14. * [WCXRP00001131] [MT6620 Wi-Fi][Driver][AIS] Implement connect-by-BSSID path
  15. * add CONNECT_BY_BSSID policy
  16. *
  17. * 10 12 2011 wh.su
  18. * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP
  19. * adding the 802.11w related function and define .
  20. *
  21. * 06 22 2011 wh.su
  22. * [WCXRP00000806] [MT6620 Wi-Fi][Driver] Move the WPA/RSN IE and WAPI IE structure to mac.h and let the sw
  23. * structure not align at byte
  24. * Move the WAPI/RSN IE to mac.h and SW structure not align to byte,
  25. * Notice needed update P2P.ko.
  26. *
  27. * 04 08 2011 eddie.chen
  28. * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma
  29. * Fix for sigma
  30. *
  31. * 03 17 2011 yuche.tsai
  32. * NULL
  33. * Resize the Secondary Device Type array when WiFi Direct is enabled.
  34. *
  35. * 01 25 2011 yuche.tsai
  36. * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
  37. * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role.
  38. *
  39. * 01 25 2011 yuche.tsai
  40. * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
  41. * Add new station type MACRO.
  42. *
  43. * 12 07 2010 cm.chang
  44. * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant
  45. * 1. Country code is from NVRAM or supplicant
  46. * 2. Change band definition in CMD/EVENT.
  47. *
  48. * 10 11 2010 kevin.huang
  49. * [WCXRP00000068] [MT6620 Wi-Fi][Driver][FW] Fix STA RECORD sync issue and remove unused code
  50. * Update ENUM_STA_ROLE_INDEX_T by using a fixed base value
  51. *
  52. * 10 04 2010 cp.wu
  53. * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by
  54. * ENUM_NETWORK_TYPE_INDEX_T only
  55. * remove ENUM_NETWORK_TYPE_T definitions
  56. *
  57. * 09 14 2010 chinghwa.yu
  58. * NULL
  59. * Update OP_MODE_BOW and include bow_fsm.h.
  60. *
  61. * 09 03 2010 kevin.huang
  62. * NULL
  63. * Refine #include sequence and solve recursive/nested #include issue
  64. *
  65. * 08 31 2010 kevin.huang
  66. * NULL
  67. * Use LINK LIST operation to process SCAN result
  68. *
  69. * 08 29 2010 yuche.tsai
  70. * NULL
  71. * Change P2P Descriptor List to a pointer and allocate it dynamically to avoid structure corrupt by BssDescriptor free.
  72. *
  73. * 08 16 2010 kevin.huang
  74. * NULL
  75. * Refine AAA functions
  76. *
  77. * 08 12 2010 kevin.huang
  78. * NULL
  79. * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse()
  80. *
  81. * 08 12 2010 yuche.tsai
  82. * NULL
  83. * Add a pointer in BSS Descriptor for P2P Descriptor.
  84. *
  85. * 08 11 2010 yuche.tsai
  86. * NULL
  87. * Add an Interface in BSS Descriptor.
  88. *
  89. * 08 05 2010 yuche.tsai
  90. * NULL
  91. * Modify data structure for P2P Scan result.
  92. *
  93. * 07 26 2010 yuche.tsai
  94. *
  95. * Add an operation mode for P2P device.
  96. *
  97. * 07 23 2010 cp.wu
  98. *
  99. * P2P/RSN/WAPI IEs need to be declared with compact structure.
  100. *
  101. * 07 21 2010 yuche.tsai
  102. *
  103. * Add for P2P Scan Result Parsing & Saving.
  104. *
  105. * 07 20 2010 wh.su
  106. *
  107. * adding the wapi code.
  108. *
  109. * 07 09 2010 cp.wu
  110. *
  111. * 1) separate AIS_FSM state for two kinds of scanning. (OID triggered scan, and scan-for-connection)
  112. * 2) eliminate PRE_BSS_DESC_T, Beacon/PrebResp is now parsed in single pass
  113. * 3) implment DRV-SCN module, currently only accepts single scan request, other request will be directly
  114. * dropped by returning BUSY
  115. *
  116. * 07 08 2010 cp.wu
  117. *
  118. * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
  119. *
  120. * 06 28 2010 cm.chang
  121. * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
  122. * 1st draft code for RLM module
  123. *
  124. * 06 25 2010 cp.wu
  125. * [WPD00003833][MT6620 and MT5931] Driver migration
  126. * modify Beacon/ProbeResp to complete parsing,
  127. * because host software has looser memory usage restriction
  128. *
  129. * 06 21 2010 yuche.tsai
  130. * [WPD00003839][MT6620 5931][P2P] Feature migration
  131. * Add P2P present boolean flag in BSS & Pre-BSS descriptor.
  132. *
  133. * 06 18 2010 wh.su
  134. * [WPD00003840][MT6620 5931] Security migration
  135. * migration the security related function from firmware.
  136. *
  137. * 06 11 2010 cp.wu
  138. * [WPD00003833][MT6620 and MT5931] Driver migration
  139. * auth.c is migrated.
  140. *
  141. * 06 11 2010 cp.wu
  142. * [WPD00003833][MT6620 and MT5931] Driver migration
  143. * 1) migrate assoc.c.
  144. * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness
  145. * 3) add configuration options for CNM_MEM and RSN modules
  146. * 4) add data path for management frames
  147. * 5) eliminate rPacketInfo of MSDU_INFO_T
  148. *
  149. * 06 10 2010 cp.wu
  150. * [WPD00003833][MT6620 and MT5931] Driver migration
  151. * add buildable & linkable ais_fsm.c
  152. *
  153. * related reference are still waiting to be resolved
  154. *
  155. * 06 09 2010 cp.wu
  156. * [WPD00003833][MT6620 and MT5931] Driver migration
  157. * add definitions for module migration.
  158. *
  159. * 06 07 2010 cp.wu
  160. * [WPD00003833][MT6620 and MT5931] Driver migration
  161. * move bss related data types to wlan_def.h to avoid recursive dependency.
  162. *
  163. * 06 07 2010 cp.wu
  164. * [WPD00003833][MT6620 and MT5931] Driver migration
  165. * merge wlan_def.h.
  166. *
  167. * 06 07 2010 cp.wu
  168. * [WPD00003833][MT6620 and MT5931] Driver migration
  169. * merge cnm_scan.h and hem_mbox.h
  170. *
  171. * 06 07 2010 cp.wu
  172. * [WPD00003833][MT6620 and MT5931] Driver migration
  173. * merge wifi_var.h, precomp.h, cnm_timer.h (data type only)
  174. *
  175. * 06 06 2010 kevin.huang
  176. * [WPD00003832][MT6620 5931] Create driver base
  177. * [MT6620 5931] Create driver base
  178. ** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:40 GMT mtk01426
  179. ** Init for develop
  180. **
  181. */
  182. #ifndef _WLAN_DEF_H
  183. #define _WLAN_DEF_H
  184. /*******************************************************************************
  185. * C O M P I L E R F L A G S
  186. ********************************************************************************
  187. */
  188. /*******************************************************************************
  189. * E X T E R N A L R E F E R E N C E S
  190. ********************************************************************************
  191. */
  192. /*******************************************************************************
  193. * C O N S T A N T S
  194. ********************************************************************************
  195. */
  196. /* disconnect reason */
  197. #define DISCONNECT_REASON_CODE_RESERVED 0
  198. #define DISCONNECT_REASON_CODE_RADIO_LOST 1
  199. #define DISCONNECT_REASON_CODE_DEAUTHENTICATED 2
  200. #define DISCONNECT_REASON_CODE_DISASSOCIATED 3
  201. #define DISCONNECT_REASON_CODE_NEW_CONNECTION 4
  202. #define DISCONNECT_REASON_CODE_REASSOCIATION 5
  203. #define DISCONNECT_REASON_CODE_ROAMING 6
  204. /* The rate definitions */
  205. #define TX_MODE_CCK 0x00
  206. #define TX_MODE_OFDM 0x40
  207. #define TX_MODE_HT_MM 0x80
  208. #define TX_MODE_HT_GF 0xC0
  209. #define RATE_CCK_SHORT_PREAMBLE 0x10
  210. #define RATE_OFDM 0x20
  211. #define PHY_RATE_1M 0x0
  212. #define PHY_RATE_2M 0x1
  213. #define PHY_RATE_5_5M 0x2
  214. #define PHY_RATE_11M 0x3
  215. #define PHY_RATE_6M 0xB
  216. #define PHY_RATE_9M 0xF
  217. #define PHY_RATE_12M 0xA
  218. #define PHY_RATE_18M 0xE
  219. #define PHY_RATE_24M 0x9
  220. #define PHY_RATE_36M 0xD
  221. #define PHY_RATE_48M 0x8
  222. #define PHY_RATE_54M 0xC
  223. #define PHY_RATE_MCS0 0x0
  224. #define PHY_RATE_MCS1 0x1
  225. #define PHY_RATE_MCS2 0x2
  226. #define PHY_RATE_MCS3 0x3
  227. #define PHY_RATE_MCS4 0x4
  228. #define PHY_RATE_MCS5 0x5
  229. #define PHY_RATE_MCS6 0x6
  230. #define PHY_RATE_MCS7 0x7
  231. #define PHY_RATE_MCS32 0x20
  232. #define RATE_CCK_1M_LONG (TX_MODE_CCK | PHY_RATE_1M)
  233. #define RATE_CCK_2M_LONG (TX_MODE_CCK | PHY_RATE_2M)
  234. #define RATE_CCK_5_5M_LONG (TX_MODE_CCK | PHY_RATE_5_5M)
  235. #define RATE_CCK_11M_LONG (TX_MODE_CCK | PHY_RATE_11M)
  236. #define RATE_CCK_2M_SHORT (TX_MODE_CCK | PHY_RATE_2M | RATE_CCK_SHORT_PREAMBLE)
  237. #define RATE_CCK_5_5M_SHORT (TX_MODE_CCK | PHY_RATE_5_5M | RATE_CCK_SHORT_PREAMBLE)
  238. #define RATE_CCK_11M_SHORT (TX_MODE_CCK | PHY_RATE_11M | RATE_CCK_SHORT_PREAMBLE)
  239. #define RATE_OFDM_6M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_6M)
  240. #define RATE_OFDM_9M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_9M)
  241. #define RATE_OFDM_12M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_12M)
  242. #define RATE_OFDM_18M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_18M)
  243. #define RATE_OFDM_24M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_24M)
  244. #define RATE_OFDM_36M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_36M)
  245. #define RATE_OFDM_48M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_48M)
  246. #define RATE_OFDM_54M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_54M)
  247. #define RATE_MM_MCS_0 (TX_MODE_HT_MM | PHY_RATE_MCS0)
  248. #define RATE_MM_MCS_1 (TX_MODE_HT_MM | PHY_RATE_MCS1)
  249. #define RATE_MM_MCS_2 (TX_MODE_HT_MM | PHY_RATE_MCS2)
  250. #define RATE_MM_MCS_3 (TX_MODE_HT_MM | PHY_RATE_MCS3)
  251. #define RATE_MM_MCS_4 (TX_MODE_HT_MM | PHY_RATE_MCS4)
  252. #define RATE_MM_MCS_5 (TX_MODE_HT_MM | PHY_RATE_MCS5)
  253. #define RATE_MM_MCS_6 (TX_MODE_HT_MM | PHY_RATE_MCS6)
  254. #define RATE_MM_MCS_7 (TX_MODE_HT_MM | PHY_RATE_MCS7)
  255. #define RATE_MM_MCS_32 (TX_MODE_HT_MM | PHY_RATE_MCS32)
  256. #define RATE_GF_MCS_0 (TX_MODE_HT_GF | PHY_RATE_MCS0)
  257. #define RATE_GF_MCS_1 (TX_MODE_HT_GF | PHY_RATE_MCS1)
  258. #define RATE_GF_MCS_2 (TX_MODE_HT_GF | PHY_RATE_MCS2)
  259. #define RATE_GF_MCS_3 (TX_MODE_HT_GF | PHY_RATE_MCS3)
  260. #define RATE_GF_MCS_4 (TX_MODE_HT_GF | PHY_RATE_MCS4)
  261. #define RATE_GF_MCS_5 (TX_MODE_HT_GF | PHY_RATE_MCS5)
  262. #define RATE_GF_MCS_6 (TX_MODE_HT_GF | PHY_RATE_MCS6)
  263. #define RATE_GF_MCS_7 (TX_MODE_HT_GF | PHY_RATE_MCS7)
  264. #define RATE_GF_MCS_32 (TX_MODE_HT_GF | PHY_RATE_MCS32)
  265. #define RATE_TX_MODE_MASK BITS(6, 7)
  266. #define RATE_TX_MODE_OFFSET 6
  267. #define RATE_CODE_GET_TX_MODE(_ucRateCode) ((_ucRateCode & RATE_TX_MODE_MASK) >> RATE_TX_MODE_OFFSET)
  268. #define RATE_PHY_RATE_MASK BITS(0, 5)
  269. #define RATE_PHY_RATE_OFFSET 0
  270. #define RATE_CODE_GET_PHY_RATE(_ucRateCode) ((_ucRateCode & RATE_PHY_RATE_MASK) >> RATE_PHY_RATE_OFFSET)
  271. #define RATE_PHY_RATE_SHORT_PREAMBLE BIT(4)
  272. #define RATE_CODE_IS_SHORT_PREAMBLE(_ucRateCode) ((_ucRateCode & RATE_PHY_RATE_SHORT_PREAMBLE)?TRUE:FALSE)
  273. #define CHNL_LIST_SZ_2G 14
  274. #define CHNL_LIST_SZ_5G 14
  275. /*! CNM(STA_RECORD_T) related definition */
  276. #define CFG_STA_REC_NUM 20
  277. /* PHY TYPE bit definitions */
  278. #define PHY_TYPE_BIT_HR_DSSS BIT(PHY_TYPE_HR_DSSS_INDEX) /* HR/DSSS PHY (clause 18) */
  279. #define PHY_TYPE_BIT_ERP BIT(PHY_TYPE_ERP_INDEX) /* ERP PHY (clause 19) */
  280. #define PHY_TYPE_BIT_OFDM BIT(PHY_TYPE_OFDM_INDEX) /* OFDM 5 GHz PHY (clause 17) */
  281. #define PHY_TYPE_BIT_HT BIT(PHY_TYPE_HT_INDEX) /* HT PHY (clause 20) */
  282. /* PHY TYPE set definitions */
  283. #define PHY_TYPE_SET_802_11ABGN (PHY_TYPE_BIT_OFDM | \
  284. PHY_TYPE_BIT_HR_DSSS | \
  285. PHY_TYPE_BIT_ERP | \
  286. PHY_TYPE_BIT_HT)
  287. #define PHY_TYPE_SET_802_11BGN (PHY_TYPE_BIT_HR_DSSS | \
  288. PHY_TYPE_BIT_ERP | \
  289. PHY_TYPE_BIT_HT)
  290. #define PHY_TYPE_SET_802_11GN (PHY_TYPE_BIT_ERP | \
  291. PHY_TYPE_BIT_HT)
  292. #define PHY_TYPE_SET_802_11AN (PHY_TYPE_BIT_OFDM | \
  293. PHY_TYPE_BIT_HT)
  294. #define PHY_TYPE_SET_802_11ABG (PHY_TYPE_BIT_OFDM | \
  295. PHY_TYPE_BIT_HR_DSSS | \
  296. PHY_TYPE_BIT_ERP)
  297. #define PHY_TYPE_SET_802_11BG (PHY_TYPE_BIT_HR_DSSS | \
  298. PHY_TYPE_BIT_ERP)
  299. #define PHY_TYPE_SET_802_11A (PHY_TYPE_BIT_OFDM)
  300. #define PHY_TYPE_SET_802_11G (PHY_TYPE_BIT_ERP)
  301. #define PHY_TYPE_SET_802_11B (PHY_TYPE_BIT_HR_DSSS)
  302. #define PHY_TYPE_SET_802_11N (PHY_TYPE_BIT_HT)
  303. /* Rate set bit definitions */
  304. #define RATE_SET_BIT_1M BIT(RATE_1M_INDEX) /* Bit 0: 1M */
  305. #define RATE_SET_BIT_2M BIT(RATE_2M_INDEX) /* Bit 1: 2M */
  306. #define RATE_SET_BIT_5_5M BIT(RATE_5_5M_INDEX) /* Bit 2: 5.5M */
  307. #define RATE_SET_BIT_11M BIT(RATE_11M_INDEX) /* Bit 3: 11M */
  308. #define RATE_SET_BIT_22M BIT(RATE_22M_INDEX) /* Bit 4: 22M */
  309. #define RATE_SET_BIT_33M BIT(RATE_33M_INDEX) /* Bit 5: 33M */
  310. #define RATE_SET_BIT_6M BIT(RATE_6M_INDEX) /* Bit 6: 6M */
  311. #define RATE_SET_BIT_9M BIT(RATE_9M_INDEX) /* Bit 7: 9M */
  312. #define RATE_SET_BIT_12M BIT(RATE_12M_INDEX) /* Bit 8: 12M */
  313. #define RATE_SET_BIT_18M BIT(RATE_18M_INDEX) /* Bit 9: 18M */
  314. #define RATE_SET_BIT_24M BIT(RATE_24M_INDEX) /* Bit 10: 24M */
  315. #define RATE_SET_BIT_36M BIT(RATE_36M_INDEX) /* Bit 11: 36M */
  316. #define RATE_SET_BIT_48M BIT(RATE_48M_INDEX) /* Bit 12: 48M */
  317. #define RATE_SET_BIT_54M BIT(RATE_54M_INDEX) /* Bit 13: 54M */
  318. #define RATE_SET_BIT_HT_PHY BIT(RATE_HT_PHY_INDEX) /* Bit 14: BSS Selector */
  319. /* Rate set definitions */
  320. #define RATE_SET_HR_DSSS (RATE_SET_BIT_1M | \
  321. RATE_SET_BIT_2M | \
  322. RATE_SET_BIT_5_5M | \
  323. RATE_SET_BIT_11M)
  324. #define RATE_SET_ERP (RATE_SET_BIT_1M | \
  325. RATE_SET_BIT_2M | \
  326. RATE_SET_BIT_5_5M | \
  327. RATE_SET_BIT_11M | \
  328. RATE_SET_BIT_6M | \
  329. RATE_SET_BIT_9M | \
  330. RATE_SET_BIT_12M | \
  331. RATE_SET_BIT_18M | \
  332. RATE_SET_BIT_24M | \
  333. RATE_SET_BIT_36M | \
  334. RATE_SET_BIT_48M | \
  335. RATE_SET_BIT_54M)
  336. #define RATE_SET_ERP_P2P (RATE_SET_BIT_6M | \
  337. RATE_SET_BIT_9M | \
  338. RATE_SET_BIT_12M | \
  339. RATE_SET_BIT_18M | \
  340. RATE_SET_BIT_24M | \
  341. RATE_SET_BIT_36M | \
  342. RATE_SET_BIT_48M | \
  343. RATE_SET_BIT_54M)
  344. #define RATE_SET_OFDM (RATE_SET_BIT_6M | \
  345. RATE_SET_BIT_9M | \
  346. RATE_SET_BIT_12M | \
  347. RATE_SET_BIT_18M | \
  348. RATE_SET_BIT_24M | \
  349. RATE_SET_BIT_36M | \
  350. RATE_SET_BIT_48M | \
  351. RATE_SET_BIT_54M)
  352. #define RATE_SET_HT (RATE_SET_ERP)
  353. /* #define RATE_SET_HT (RATE_SET_ERP | RATE_SET_BIT_HT_PHY) *//* NOTE(Kevin): TBD */
  354. #define RATE_SET_ALL_ABG RATE_SET_ERP
  355. #define BASIC_RATE_SET_HR_DSSS (RATE_SET_BIT_1M | \
  356. RATE_SET_BIT_2M)
  357. #define BASIC_RATE_SET_HR_DSSS_ERP (RATE_SET_BIT_1M | \
  358. RATE_SET_BIT_2M | \
  359. RATE_SET_BIT_5_5M | \
  360. RATE_SET_BIT_11M)
  361. #define BASIC_RATE_SET_ERP (RATE_SET_BIT_1M | \
  362. RATE_SET_BIT_2M | \
  363. RATE_SET_BIT_5_5M | \
  364. RATE_SET_BIT_11M | \
  365. RATE_SET_BIT_6M | \
  366. RATE_SET_BIT_12M | \
  367. RATE_SET_BIT_24M)
  368. #define BASIC_RATE_SET_OFDM (RATE_SET_BIT_6M | \
  369. RATE_SET_BIT_12M | \
  370. RATE_SET_BIT_24M)
  371. #define BASIC_RATE_SET_ERP_P2P (RATE_SET_BIT_6M | \
  372. RATE_SET_BIT_12M | \
  373. RATE_SET_BIT_24M)
  374. #define INITIAL_RATE_SET_RCPI_100 RATE_SET_ALL_ABG
  375. #define INITIAL_RATE_SET_RCPI_80 (RATE_SET_BIT_1M | \
  376. RATE_SET_BIT_2M | \
  377. RATE_SET_BIT_5_5M | \
  378. RATE_SET_BIT_11M | \
  379. RATE_SET_BIT_6M | \
  380. RATE_SET_BIT_9M | \
  381. RATE_SET_BIT_12M | \
  382. RATE_SET_BIT_24M)
  383. #define INITIAL_RATE_SET_RCPI_60 (RATE_SET_BIT_1M | \
  384. RATE_SET_BIT_2M | \
  385. RATE_SET_BIT_5_5M | \
  386. RATE_SET_BIT_11M | \
  387. RATE_SET_BIT_6M)
  388. #define INITIAL_RATE_SET(_rcpi) (INITIAL_RATE_SET_ ## _rcpi)
  389. #define RCPI_100 100 /* -60 dBm */
  390. #define RCPI_80 80 /* -70 dBm */
  391. #define RCPI_60 60 /* -80 dBm */
  392. /* The number of RCPI records used to calculate their average value */
  393. #define MAX_NUM_RCPI_RECORDS 10
  394. /* The number of RCPI records used to calculate their average value */
  395. #define NO_RCPI_RECORDS -128
  396. #define MAX_RCPI_DBM 0
  397. #define MIN_RCPI_DBM -100
  398. #define MAC_TX_RESERVED_FIELD 0 /* NOTE(Kevin): Should defined in tx.h */
  399. #define MAX_ASSOC_ID (CFG_STA_REC_NUM) /* Available AID: 1 ~ 20(STA_REC_NUM) */
  400. #define MAX_DEAUTH_INFO_COUNT 4 /* NOTE(Kevin): Used in auth.c */
  401. #define MIN_DEAUTH_INTERVAL_MSEC 500 /* The minimum interval if continuously send Deauth Frame */
  402. /* Authentication Type */
  403. #define AUTH_TYPE_OPEN_SYSTEM BIT(AUTH_ALGORITHM_NUM_OPEN_SYSTEM)
  404. #define AUTH_TYPE_SHARED_KEY BIT(AUTH_ALGORITHM_NUM_SHARED_KEY)
  405. #define AUTH_TYPE_FAST_BSS_TRANSITION BIT(AUTH_ALGORITHM_NUM_FAST_BSS_TRANSITION)
  406. /* Authentication Retry Limit */
  407. #define TX_AUTH_ASSOCI_RETRY_LIMIT 2
  408. #define TX_AUTH_ASSOCI_RETRY_LIMIT_FOR_ROAMING 1
  409. /* WMM-2.2.1 WMM Information Element */
  410. #define ELEM_MAX_LEN_WMM_INFO 7
  411. /*******************************************************************************
  412. * D A T A T Y P E S
  413. ********************************************************************************
  414. */
  415. typedef UINT_16 PHY_TYPE, *P_PHY_TYPE;
  416. typedef UINT_8 RCPI, *P_RCPI;
  417. typedef UINT_8 ALC_VAL, *P_ALC_VAL;
  418. typedef enum _ENUM_HW_BSSID_T {
  419. BSSID_0 = 0,
  420. BSSID_1,
  421. BSSID_NUM
  422. } ENUM_HW_BSSID_T;
  423. typedef enum _ENUM_HW_MAC_ADDR_T {
  424. MAC_ADDR_0 = 0,
  425. MAC_ADDR_1,
  426. MAC_ADDR_NUM
  427. } ENUM_HW_MAC_ADDR_T;
  428. typedef enum _ENUM_HW_OP_MODE_T {
  429. HW_OP_MODE_STA = 0,
  430. HW_OP_MODE_AP,
  431. HW_OP_MODE_ADHOC,
  432. HW_OP_MODE_NUM
  433. } ENUM_HW_OP_MODE_T;
  434. typedef enum _ENUM_TSF_T {
  435. ENUM_LOCAL_TSF_0,
  436. ENUM_LOCAL_TSF_1,
  437. ENUM_LOCAL_TSF_NUM
  438. } ENUM_LOCAL_TSF_T, *P_ENUM_LOCAL_TSF_T;
  439. typedef enum _HAL_TS_HW_UPDATE_MODE {
  440. HAL_TSF_HW_UPDATE_BY_TICK_AND_RECEIVED_FRAME,
  441. HAL_TSF_HW_UPDATE_BY_TICK_ONLY,
  442. HAL_TSF_HW_UPDATE_BY_RECEIVED_FRAME_ONLY,
  443. HAL_TSF_HW_UPDATE_BY_TICK_AND_RECEIVED_FRAME_AD_HOC
  444. } HAL_TSF_HW_UPDATE_MODE;
  445. typedef enum _ENUM_AC_T {
  446. AC0 = 0,
  447. AC1,
  448. AC2,
  449. AC3,
  450. AC_NUM
  451. } ENUM_AC_T, *P_ENUM_AC_T;
  452. /* The Type of Network been activated */
  453. typedef enum _ENUM_NETWORK_TYPE_INDEX_T {
  454. NETWORK_TYPE_AIS_INDEX = 0,
  455. NETWORK_TYPE_P2P_INDEX,
  456. NETWORK_TYPE_BOW_INDEX,
  457. NETWORK_TYPE_INDEX_NUM
  458. } ENUM_NETWORK_TYPE_INDEX_T;
  459. /* The Type of STA Type. */
  460. typedef enum _ENUM_STA_TYPE_INDEX_T {
  461. STA_TYPE_LEGACY_INDEX = 0,
  462. STA_TYPE_P2P_INDEX,
  463. STA_TYPE_BOW_INDEX,
  464. STA_TYPE_INDEX_NUM
  465. } ENUM_STA_TYPE_INDEX_T;
  466. #define STA_ROLE_BASE_INDEX 4
  467. typedef enum _ENUM_STA_ROLE_INDEX_T {
  468. STA_ROLE_ADHOC_INDEX = STA_ROLE_BASE_INDEX, /* 4 */
  469. STA_ROLE_CLIENT_INDEX,
  470. STA_ROLE_AP_INDEX,
  471. STA_ROLE_TDLS_INDEX,
  472. STA_ROLE_DLS_INDEX /* Note: need to extend P_CMD_UPDATE_STA_RECORD_T */
  473. } ENUM_STA_ROLE_INDEX_T;
  474. /* The Power State of a specific Network */
  475. typedef enum _ENUM_PWR_STATE_T {
  476. PWR_STATE_IDLE = 0,
  477. PWR_STATE_ACTIVE,
  478. PWR_STATE_PS,
  479. PWR_STATE_NUM
  480. } ENUM_PWR_STATE_T;
  481. typedef enum _ENUM_PHY_TYPE_INDEX_T {
  482. /* PHY_TYPE_DSSS_INDEX, *//* DSSS PHY (clause 15) -- Not used anymore */
  483. PHY_TYPE_HR_DSSS_INDEX = 0, /* HR/DSSS PHY (clause 18) */
  484. PHY_TYPE_ERP_INDEX, /* ERP PHY (clause 19) */
  485. PHY_TYPE_ERP_P2P_INDEX, /* ERP PHY (clause 19) w/o HR/DSSS */
  486. PHY_TYPE_OFDM_INDEX, /* OFDM 5 GHz PHY (clause 17) */
  487. PHY_TYPE_HT_INDEX, /* HT PHY (clause 20) */
  488. PHY_TYPE_INDEX_NUM /* 5 */
  489. } ENUM_PHY_TYPE_INDEX_T, *P_ENUM_PHY_TYPE_INDEX_T;
  490. typedef enum _ENUM_ACPI_STATE_T {
  491. ACPI_STATE_D0 = 0,
  492. ACPI_STATE_D1,
  493. ACPI_STATE_D2,
  494. ACPI_STATE_D3
  495. } ENUM_ACPI_STATE_T;
  496. /* The operation mode of a specific Network */
  497. typedef enum _ENUM_OP_MODE_T {
  498. OP_MODE_INFRASTRUCTURE = 0, /* Infrastructure/GC */
  499. OP_MODE_IBSS, /* AdHoc */
  500. OP_MODE_ACCESS_POINT, /* For GO */
  501. OP_MODE_P2P_DEVICE, /* P2P Device */
  502. OP_MODE_BOW,
  503. OP_MODE_NUM
  504. } ENUM_OP_MODE_T, *P_ENUM_OP_MODE_T;
  505. typedef enum _ENUM_CHNL_EXT_T {
  506. CHNL_EXT_SCN = 0,
  507. CHNL_EXT_SCA = 1,
  508. CHNL_EXT_RES = 2,
  509. CHNL_EXT_SCB = 3
  510. } ENUM_CHNL_EXT_T, *P_ENUM_CHNL_EXT_T;
  511. /* This starting freq of the band is unit of kHz */
  512. typedef enum _ENUM_BAND_T {
  513. BAND_NULL,
  514. BAND_2G4,
  515. BAND_5G,
  516. BAND_NUM
  517. } ENUM_BAND_T, *P_ENUM_BAND_T;
  518. /* Provide supported channel list to other components in array format */
  519. typedef struct _RF_CHANNEL_INFO_T {
  520. ENUM_BAND_T eBand;
  521. UINT_8 ucChannelNum;
  522. } RF_CHANNEL_INFO_T, *P_RF_CHANNEL_INFO_T;
  523. typedef enum _ENUM_RATE_INDEX_T {
  524. RATE_1M_INDEX = 0, /* 1M */
  525. RATE_2M_INDEX, /* 2M */
  526. RATE_5_5M_INDEX, /* 5.5M */
  527. RATE_11M_INDEX, /* 11M */
  528. RATE_22M_INDEX, /* 22M */
  529. RATE_33M_INDEX, /* 33M */
  530. RATE_6M_INDEX, /* 6M */
  531. RATE_9M_INDEX, /* 9M */
  532. RATE_12M_INDEX, /* 12M */
  533. RATE_18M_INDEX, /* 18M */
  534. RATE_24M_INDEX, /* 24M */
  535. RATE_36M_INDEX, /* 36M */
  536. RATE_48M_INDEX, /* 48M */
  537. RATE_54M_INDEX, /* 54M */
  538. RATE_HT_PHY_INDEX, /* BSS Selector - HT PHY */
  539. RATE_NUM /* 15 */
  540. } ENUM_RATE_INDEX_T, *P_ENUM_RATE_INDEX_T;
  541. typedef enum _ENUM_HT_RATE_INDEX_T {
  542. HT_RATE_MCS0_INDEX = 0,
  543. HT_RATE_MCS1_INDEX,
  544. HT_RATE_MCS2_INDEX,
  545. HT_RATE_MCS3_INDEX,
  546. HT_RATE_MCS4_INDEX,
  547. HT_RATE_MCS5_INDEX,
  548. HT_RATE_MCS6_INDEX,
  549. HT_RATE_MCS7_INDEX,
  550. HT_RATE_MCS32_INDEX,
  551. HT_RATE_NUM /* 9 */
  552. } ENUM_HT_RATE_INDEX_T, *P_ENUM_HT_RATE_INDEX_T;
  553. typedef enum _ENUM_PREMABLE_OPTION_T {
  554. PREAMBLE_DEFAULT_LONG_NONE = 0, /* LONG for PHY_TYPE_HR_DSSS, NONE for PHY_TYPE_OFDM */
  555. PREAMBLE_OPTION_SHORT, /* SHORT mandatory for PHY_TYPE_ERP, SHORT option for PHY_TYPE_HR_DSSS */
  556. PREAMBLE_HT_MIXED_MODE,
  557. PREAMBLE_HT_GREEN_FIELD,
  558. PREAMBLE_OPTION_NUM
  559. } ENUM_PREMABLE_OPTION_T, *P_ENUM_PREMABLE_OPTION_T;
  560. typedef enum _ENUM_CHANNEL_WIDTH_T {
  561. CW_20_40MHZ = 0,
  562. CW_80MHZ = 1,
  563. CW_160MHZ = 2,
  564. CW_80P80MHZ = 3
  565. } ENUM_CHANNEL_WIDTH_T, *P_ENUM_CHANNEL_WIDTH_P;
  566. typedef enum _ENUM_MODULATION_SYSTEM_T {
  567. MODULATION_SYSTEM_CCK = 0,
  568. MODULATION_SYSTEM_OFDM,
  569. MODULATION_SYSTEM_HT20,
  570. MODULATION_SYSTEM_HT40,
  571. MODULATION_SYSTEM_NUM
  572. } ENUM_MODULATION_SYSTEM_T, *P_ENUM_MODULATION_SYSTEM_T;
  573. typedef enum _ENUM_MODULATION_TYPE_T {
  574. MODULATION_TYPE_CCK_BPSK = 0,
  575. MODULATION_TYPE_QPSK,
  576. MODULATION_TYPE_16QAM,
  577. MODULATION_TYPE_64QAM,
  578. MODULATION_TYPE_NUM
  579. } ENUM_MODULATION_TYPE_T, *P_ENUM_MODULATION_TYPE_T;
  580. typedef enum _ENUM_PS_FORWARDING_TYPE_T {
  581. PS_FORWARDING_TYPE_NON_PS = 0,
  582. PS_FORWARDING_TYPE_DELIVERY_ENABLED,
  583. PS_FORWARDING_TYPE_NON_DELIVERY_ENABLED,
  584. PS_FORWARDING_MORE_DATA_ENABLED,
  585. PS_FORWARDING_TYPE_NUM
  586. } ENUM_PS_FORWARDING_TYPE_T, *P_ENUM_PS_FORWARDING_TYPE_T;
  587. typedef struct _DEAUTH_INFO_T {
  588. UINT_8 aucRxAddr[MAC_ADDR_LEN];
  589. OS_SYSTIME rLastSendTime;
  590. } DEAUTH_INFO_T, *P_DEAUTH_INFO_T;
  591. /*----------------------------------------------------------------------------*/
  592. /* Information Element (IE) handlers */
  593. /*----------------------------------------------------------------------------*/
  594. typedef VOID(*PFN_APPEND_IE_FUNC) (P_ADAPTER_T, P_MSDU_INFO_T);
  595. typedef VOID(*PFN_HANDLE_IE_FUNC) (P_ADAPTER_T, P_SW_RFB_T, P_IE_HDR_T);
  596. typedef VOID(*PFN_VERIFY_IE_FUNC) (P_ADAPTER_T, P_SW_RFB_T, P_IE_HDR_T, PUINT_16);
  597. typedef UINT_32(*PFN_CALCULATE_VAR_IE_LEN_FUNC) (P_ADAPTER_T, ENUM_NETWORK_TYPE_INDEX_T, P_STA_RECORD_T);
  598. typedef struct _APPEND_IE_ENTRY_T {
  599. UINT_16 u2EstimatedIELen;
  600. PFN_APPEND_IE_FUNC pfnAppendIE;
  601. } APPEND_IE_ENTRY_T, *P_APPEND_IE_ENTRY_T;
  602. typedef struct _APPEND_VAR_IE_ENTRY_T {
  603. UINT_16 u2EstimatedFixedIELen; /* For Fixed Length */
  604. PFN_CALCULATE_VAR_IE_LEN_FUNC pfnCalculateVariableIELen;
  605. PFN_APPEND_IE_FUNC pfnAppendIE;
  606. } APPEND_VAR_IE_ENTRY_T, *P_APPEND_VAR_IE_ENTRY_T;
  607. typedef struct _HANDLE_IE_ENTRY_T {
  608. UINT_8 ucElemID;
  609. PFN_HANDLE_IE_FUNC pfnHandleIE;
  610. } HANDLE_IE_ENTRY_T, *P_HANDLE_IE_ENTRY_T;
  611. typedef struct _VERIFY_IE_ENTRY_T {
  612. UINT_8 ucElemID;
  613. PFN_VERIFY_IE_FUNC pfnVarifyIE;
  614. } VERIFY_IE_ENTRY_T, *P_VERIFY_IE_ENTRY_T;
  615. /*----------------------------------------------------------------------------*/
  616. /* Parameters of User Configuration */
  617. /*----------------------------------------------------------------------------*/
  618. typedef enum _ENUM_PARAM_CONNECTION_POLICY_T {
  619. CONNECT_BY_SSID_BEST_RSSI = 0,
  620. CONNECT_BY_SSID_GOOD_RSSI_MIN_CH_LOAD,
  621. CONNECT_BY_SSID_ANY, /* NOTE(Kevin): Needed by WHQL */
  622. CONNECT_BY_BSSID,
  623. CONNECT_BY_CUSTOMIZED_RULE /* NOTE(Kevin): TBD */
  624. } ENUM_PARAM_CONNECTION_POLICY_T, *P_ENUM_PARAM_CONNECTION_POLICY_T;
  625. typedef enum _ENUM_PARAM_PREAMBLE_TYPE_T {
  626. PREAMBLE_TYPE_LONG = 0,
  627. PREAMBLE_TYPE_SHORT,
  628. PREAMBLE_TYPE_AUTO /*!< Try preamble short first, if fail tray preamble long. */
  629. } ENUM_PARAM_PREAMBLE_TYPE_T, *P_ENUM_PARAM_PREAMBLE_TYPE_T;
  630. /* This is enum defined for user to select a phy config listed in combo box */
  631. typedef enum _ENUM_PARAM_PHY_CONFIG_T {
  632. /*!< Can associated with 802.11abg AP but without n capability, Scan dual band. */
  633. PHY_CONFIG_802_11ABG = 0,
  634. PHY_CONFIG_802_11BG, /*!< Can associated with 802_11bg AP, Scan single band and not report 5G BSSs. */
  635. PHY_CONFIG_802_11G, /*!< Can associated with 802_11g only AP, Scan single band and not report 5G BSSs. */
  636. PHY_CONFIG_802_11A, /*!< Can associated with 802_11a only AP, Scan single band and not report 2.4G BSSs. */
  637. PHY_CONFIG_802_11B, /*!< Can associated with 802_11b only AP, Scan single band and not report 5G BSSs. */
  638. PHY_CONFIG_802_11ABGN, /*!< Can associated with 802.11abgn AP, Scan dual band. */
  639. PHY_CONFIG_802_11BGN, /*!< Can associated with 802_11bgn AP, Scan single band and not report 5G BSSs. */
  640. PHY_CONFIG_802_11AN, /*!< Can associated with 802_11an AP, Scan single band and not report 2.4G BSSs. */
  641. PHY_CONFIG_802_11GN, /*!< Can associated with 802_11gn AP, Scan single band and not report 5G BSSs. */
  642. PHY_CONFIG_NUM /* 9 */
  643. } ENUM_PARAM_PHY_CONFIG_T, *P_ENUM_PARAM_PHY_CONFIG_T;
  644. /* This is enum defined for user to select an AP Mode */
  645. typedef enum _ENUM_PARAM_AP_MODE_T {
  646. AP_MODE_11B = 0, /*!< Create 11b BSS if we support 802.11abg/802.11bg. */
  647. AP_MODE_MIXED_11BG, /*!< Create 11bg mixed BSS if we support 802.11abg/802.11bg/802.11g. */
  648. AP_MODE_11G, /*!< Create 11g only BSS if we support 802.11abg/802.11bg/802.11g. */
  649. AP_MODE_11G_P2P, /*!< Create 11g only BSS for P2P if we support 802.11abg/802.11bg/802.11g. */
  650. AP_MODE_11A, /*!< Create 11a only BSS if we support 802.11abg. */
  651. AP_MODE_NUM /* 4 */
  652. } ENUM_PARAM_AP_MODE_T, *P_ENUM_PARAM_AP_MODE_T;
  653. /* Masks for determining the Network Type or the Station Role, given the ENUM_STA_TYPE_T */
  654. #define NETWORK_TYPE_AIS_MASK BIT(NETWORK_TYPE_AIS_INDEX)
  655. #define NETWORK_TYPE_P2P_MASK BIT(NETWORK_TYPE_P2P_INDEX)
  656. #define NETWORK_TYPE_BOW_MASK BIT(NETWORK_TYPE_BOW_INDEX)
  657. #define STA_TYPE_LEGACY_MASK BIT(STA_TYPE_LEGACY_INDEX)
  658. #define STA_TYPE_P2P_MASK BIT(STA_TYPE_P2P_INDEX)
  659. #define STA_TYPE_BOW_MASK BIT(STA_TYPE_BOW_INDEX)
  660. #define STA_TYPE_ADHOC_MASK BIT(STA_ROLE_ADHOC_INDEX)
  661. #define STA_TYPE_CLIENT_MASK BIT(STA_ROLE_CLIENT_INDEX)
  662. #define STA_TYPE_AP_MASK BIT(STA_ROLE_AP_INDEX)
  663. #define STA_TYPE_DLS_MASK BIT(STA_ROLE_DLS_INDEX)
  664. #define STA_TYPE_TDLS_MASK BIT(STA_ROLE_TDLS_INDEX)
  665. /* Macros for obtaining the Network Type or the Station Role, given the ENUM_STA_TYPE_T */
  666. #define IS_STA_IN_AIS(_prStaRec) ((_prStaRec)->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX)
  667. #define IS_STA_IN_P2P(_prStaRec) ((_prStaRec)->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX)
  668. #define IS_STA_IN_BOW(_prStaRec) ((_prStaRec)->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX)
  669. #define IS_STA_LEGACY_TYPE(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_LEGACY_MASK)
  670. #define IS_STA_P2P_TYPE(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_P2P_MASK)
  671. #define IS_STA_BOW_TYPE(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_BOW_MASK)
  672. #define IS_ADHOC_STA(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_ADHOC_MASK)
  673. #define IS_CLIENT_STA(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_CLIENT_MASK)
  674. #define IS_AP_STA(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_AP_MASK)
  675. #define IS_DLS_STA(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_DLS_MASK)
  676. #define IS_TDLS_STA(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_TDLS_MASK)
  677. /* The ENUM_STA_TYPE_T accounts for ENUM_NETWORK_TYPE_T and ENUM_STA_ROLE_INDEX_T.
  678. * * It is a merged version of Network Type and STA Role.
  679. * */
  680. typedef enum _ENUM_STA_TYPE_T {
  681. STA_TYPE_LEGACY_AP = (STA_TYPE_LEGACY_MASK | STA_TYPE_AP_MASK),
  682. STA_TYPE_LEGACY_CLIENT = (STA_TYPE_LEGACY_MASK | STA_TYPE_CLIENT_MASK),
  683. STA_TYPE_ADHOC_PEER = (STA_TYPE_LEGACY_MASK | STA_TYPE_ADHOC_MASK),
  684. #if CFG_ENABLE_WIFI_DIRECT
  685. STA_TYPE_P2P_GO = (STA_TYPE_P2P_MASK | STA_TYPE_AP_MASK),
  686. STA_TYPE_P2P_GC = (STA_TYPE_P2P_MASK | STA_TYPE_CLIENT_MASK),
  687. #endif
  688. #if CFG_ENABLE_BT_OVER_WIFI
  689. STA_TYPE_BOW_AP = (STA_TYPE_BOW_MASK | STA_TYPE_AP_MASK),
  690. STA_TYPE_BOW_CLIENT = (STA_TYPE_BOW_MASK | STA_TYPE_CLIENT_MASK),
  691. #endif
  692. STA_TYPE_DLS_PEER = (STA_TYPE_LEGACY_MASK | STA_TYPE_DLS_MASK),
  693. STA_TYPE_TDLS_PEER = (STA_TYPE_LEGACY_MASK | STA_TYPE_TDLS_MASK)
  694. } ENUM_STA_TYPE_T, *P_ENUM_STA_TYPE_T;
  695. /* The type of BSS we discovered */
  696. typedef enum _ENUM_BSS_TYPE_T {
  697. BSS_TYPE_INFRASTRUCTURE = 1,
  698. BSS_TYPE_IBSS,
  699. BSS_TYPE_P2P_DEVICE,
  700. BSS_TYPE_BOW_DEVICE,
  701. BSS_TYPE_NUM
  702. } ENUM_BSS_TYPE_T, *P_ENUM_BSS_TYPE_T;
  703. /*----------------------------------------------------------------------------*/
  704. /* RSN structures */
  705. /*----------------------------------------------------------------------------*/
  706. /* #if defined(WINDOWS_DDK) || defined(WINDOWS_CE) */
  707. /* #pragma pack(1) */
  708. /* #endif */
  709. #define MAX_NUM_SUPPORTED_CIPHER_SUITES 8 /* max number of supported cipher suites */
  710. #if CFG_SUPPORT_802_11W
  711. #define MAX_NUM_SUPPORTED_AKM_SUITES 8 /* max number of supported AKM suites */
  712. #else
  713. #define MAX_NUM_SUPPORTED_AKM_SUITES 6 /* max number of supported AKM suites */
  714. #endif
  715. /* Structure of RSN Information */
  716. typedef struct _RSN_INFO_T {
  717. UINT_8 ucElemId;
  718. UINT_16 u2Version;
  719. UINT_32 u4GroupKeyCipherSuite;
  720. UINT_32 u4PairwiseKeyCipherSuiteCount;
  721. UINT_32 au4PairwiseKeyCipherSuite[MAX_NUM_SUPPORTED_CIPHER_SUITES];
  722. UINT_32 u4AuthKeyMgtSuiteCount;
  723. UINT_32 au4AuthKeyMgtSuite[MAX_NUM_SUPPORTED_AKM_SUITES];
  724. UINT_16 u2RsnCap;
  725. BOOLEAN fgRsnCapPresent;
  726. } /*__KAL_ATTRIB_PACKED__*/ RSN_INFO_T, *P_RSN_INFO_T;
  727. #define MAX_NUM_SUPPORTED_WAPI_AKM_SUITES 1 /* max number of supported AKM suites */
  728. #define MAX_NUM_SUPPORTED_WAPI_CIPHER_SUITES 1 /* max number of supported cipher suites */
  729. /* Structure of WAPI Information */
  730. typedef struct _WAPI_INFO_T {
  731. UINT_8 ucElemId;
  732. UCHAR ucLength;
  733. UINT_16 u2Version;
  734. UINT_32 u4AuthKeyMgtSuiteCount;
  735. UINT_32 au4AuthKeyMgtSuite[MAX_NUM_SUPPORTED_WAPI_AKM_SUITES];
  736. UINT_32 u4PairwiseKeyCipherSuiteCount;
  737. UINT_32 au4PairwiseKeyCipherSuite[MAX_NUM_SUPPORTED_WAPI_CIPHER_SUITES];
  738. UINT_32 u4GroupKeyCipherSuite;
  739. UINT_16 u2WapiCap;
  740. UINT_16 u2Bkid;
  741. UINT_8 aucBkid[1][16];
  742. } /* __KAL_ATTRIB_PACKED__ */ WAPI_INFO_T, *P_WAPI_INFO_T;
  743. /* #if defined(WINDOWS_DDK) || defined(WINDOWS_CE) */
  744. /* #pragma pack() */
  745. /* #endif */
  746. #if CFG_ENABLE_WIFI_DIRECT
  747. typedef struct _P2P_DEVICE_TYPE_T {
  748. UINT_16 u2CategoryID;
  749. UINT_16 u2SubCategoryID;
  750. } P2P_DEVICE_TYPE_T, *P_P2P_DEVICE_TYPE_T;
  751. typedef struct _P2P_DEVICE_DESC_T {
  752. LINK_ENTRY_T rLinkEntry;
  753. BOOLEAN fgDevInfoValid;
  754. UINT_8 aucDeviceAddr[MAC_ADDR_LEN]; /* Device Address. */
  755. UINT_8 aucInterfaceAddr[MAC_ADDR_LEN]; /* Interface Address. */
  756. UINT_8 ucDeviceCapabilityBitmap;
  757. UINT_8 ucGroupCapabilityBitmap;
  758. UINT_16 u2ConfigMethod; /* Configure Method support. */
  759. P2P_DEVICE_TYPE_T rPriDevType;
  760. UINT_8 ucSecDevTypeNum;
  761. P2P_DEVICE_TYPE_T arSecDevType[8]; /* Reference to P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT */
  762. UINT_16 u2NameLength;
  763. UINT_8 aucName[32]; /* Reference to WPS_ATTRI_MAX_LEN_DEVICE_NAME */
  764. /* TODO: Service Information or PasswordID valid? */
  765. } P2P_DEVICE_DESC_T, *P_P2P_DEVICE_DESC_T;
  766. #endif
  767. /*******************************************************************************
  768. * P U B L I C D A T A
  769. ********************************************************************************
  770. */
  771. /*******************************************************************************
  772. * P R I V A T E D A T A
  773. ********************************************************************************
  774. */
  775. static const UINT_8 aucRateIndex2RateCode[PREAMBLE_OPTION_NUM][RATE_NUM] = {
  776. { /* Long Preamble */
  777. RATE_CCK_1M_LONG, /* RATE_1M_INDEX = 0 */
  778. RATE_CCK_2M_LONG, /* RATE_2M_INDEX */
  779. RATE_CCK_5_5M_LONG, /* RATE_5_5M_INDEX */
  780. RATE_CCK_11M_LONG, /* RATE_11M_INDEX */
  781. RATE_CCK_1M_LONG, /* RATE_22M_INDEX - Not supported */
  782. RATE_CCK_1M_LONG, /* RATE_33M_INDEX - Not supported */
  783. RATE_OFDM_6M, /* RATE_6M_INDEX */
  784. RATE_OFDM_9M, /* RATE_9M_INDEX */
  785. RATE_OFDM_12M, /* RATE_12M_INDEX */
  786. RATE_OFDM_18M, /* RATE_18M_INDEX */
  787. RATE_OFDM_24M, /* RATE_24M_INDEX */
  788. RATE_OFDM_36M, /* RATE_36M_INDEX */
  789. RATE_OFDM_48M, /* RATE_48M_INDEX */
  790. RATE_OFDM_54M, /* RATE_54M_INDEX */
  791. },
  792. { /* Short Preamble */
  793. RATE_CCK_1M_LONG, /* RATE_1M_INDEX = 0 */
  794. RATE_CCK_2M_SHORT, /* RATE_2M_INDEX */
  795. RATE_CCK_5_5M_SHORT, /* RATE_5_5M_INDEX */
  796. RATE_CCK_11M_SHORT, /* RATE_11M_INDEX */
  797. RATE_CCK_1M_LONG, /* RATE_22M_INDEX - Not supported */
  798. RATE_CCK_1M_LONG, /* RATE_33M_INDEX - Not supported */
  799. RATE_OFDM_6M, /* RATE_6M_INDEX */
  800. RATE_OFDM_9M, /* RATE_9M_INDEX */
  801. RATE_OFDM_12M, /* RATE_12M_INDEX */
  802. RATE_OFDM_18M, /* RATE_18M_INDEX */
  803. RATE_OFDM_24M, /* RATE_24M_INDEX */
  804. RATE_OFDM_36M, /* RATE_36M_INDEX */
  805. RATE_OFDM_48M, /* RATE_48M_INDEX */
  806. RATE_OFDM_54M, /* RATE_54M_INDEX */
  807. },
  808. { /* Mixed Mode(Option) */
  809. RATE_MM_MCS_0, /* RATE_MCS0_INDEX, */
  810. RATE_MM_MCS_1, /* RATE_MCS1_INDEX, */
  811. RATE_MM_MCS_2, /* RATE_MCS2_INDEX, */
  812. RATE_MM_MCS_3, /* RATE_MCS3_INDEX, */
  813. RATE_MM_MCS_4, /* RATE_MCS4_INDEX, */
  814. RATE_MM_MCS_5, /* RATE_MCS5_INDEX, */
  815. RATE_MM_MCS_6, /* RATE_MCS6_INDEX, */
  816. RATE_MM_MCS_7, /* RATE_MCS7_INDEX, */
  817. RATE_MM_MCS_32 /* RATE_MCS32_INDEX, */
  818. },
  819. { /* Green Field(Option) */
  820. RATE_GF_MCS_0, /* RATE_MCS0_INDEX, */
  821. RATE_GF_MCS_1, /* RATE_MCS1_INDEX, */
  822. RATE_GF_MCS_2, /* RATE_MCS2_INDEX, */
  823. RATE_GF_MCS_3, /* RATE_MCS3_INDEX, */
  824. RATE_GF_MCS_4, /* RATE_MCS4_INDEX, */
  825. RATE_GF_MCS_5, /* RATE_MCS5_INDEX, */
  826. RATE_GF_MCS_6, /* RATE_MCS6_INDEX, */
  827. RATE_GF_MCS_7, /* RATE_MCS7_INDEX, */
  828. RATE_GF_MCS_32 /* RATE_MCS32_INDEX, */
  829. }
  830. };
  831. static const UINT_8 aucRateTableSize[PREAMBLE_OPTION_NUM] = {
  832. RATE_HT_PHY_INDEX,
  833. RATE_HT_PHY_INDEX,
  834. HT_RATE_NUM,
  835. HT_RATE_NUM
  836. };
  837. /*******************************************************************************
  838. * M A C R O S
  839. ********************************************************************************
  840. */
  841. /* Macros to get and set the wireless LAN frame fields those are 16/32 bits in
  842. length. */
  843. #define WLAN_GET_FIELD_16(_memAddr_p, _value_p) \
  844. { \
  845. PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
  846. *(PUINT_16)(_value_p) = ((UINT_16) __cp[0]) | ((UINT_16) __cp[1] << 8); \
  847. }
  848. #define WLAN_GET_FIELD_BE16(_memAddr_p, _value_p) \
  849. { \
  850. PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
  851. *(PUINT_16)(_value_p) = ((UINT_16) __cp[0] << 8) | ((UINT_16) __cp[1]); \
  852. }
  853. #define WLAN_GET_FIELD_32(_memAddr_p, _value_p) \
  854. { \
  855. PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
  856. *(PUINT_32)(_value_p) = ((UINT_32) __cp[0]) | ((UINT_32) __cp[1] << 8) | \
  857. ((UINT_32) __cp[2] << 16) | ((UINT_32) __cp[3] << 24); \
  858. }
  859. #define WLAN_GET_FIELD_64(_memAddr_p, _value_p) \
  860. { \
  861. PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
  862. *(PUINT_64)(_value_p) = \
  863. ((UINT_64) __cp[0]) | ((UINT_64) __cp[1] << 8) | \
  864. ((UINT_64) __cp[2] << 16) | ((UINT_64) __cp[3] << 24) | \
  865. ((UINT_64) __cp[4] << 32) | ((UINT_64) __cp[5] << 40) | \
  866. ((UINT_64) __cp[6] << 48) | ((UINT_64) __cp[7] << 56); \
  867. }
  868. #define WLAN_SET_FIELD_16(_memAddr_p, _value) \
  869. { \
  870. PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
  871. __cp[0] = (UINT_8) (_value); \
  872. __cp[1] = (UINT_8) ((_value) >> 8); \
  873. }
  874. #define WLAN_SET_FIELD_BE16(_memAddr_p, _value) \
  875. { \
  876. PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
  877. __cp[0] = (UINT_8) ((_value) >> 8); \
  878. __cp[1] = (UINT_8) (_value); \
  879. }
  880. #define WLAN_SET_FIELD_32(_memAddr_p, _value) \
  881. { \
  882. PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
  883. __cp[0] = (UINT_8) (_value); \
  884. __cp[1] = (UINT_8) ((_value) >> 8); \
  885. __cp[2] = (UINT_8) ((_value) >> 16); \
  886. __cp[3] = (UINT_8) ((_value) >> 24); \
  887. }
  888. /*******************************************************************************
  889. * F U N C T I O N D E C L A R A T I O N S
  890. ********************************************************************************
  891. */
  892. /*******************************************************************************
  893. * F U N C T I O N S
  894. ********************************************************************************
  895. */
  896. #endif /* _WLAN_DEF_H */