cnm_mem.h 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336
  1. /*
  2. ** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/cnm_mem.h#1
  3. */
  4. /*! \file "cnm_mem.h"
  5. \brief In this file we define the structure of the control unit of
  6. packet buffer and MGT/MSG Memory Buffer.
  7. */
  8. /*
  9. ** Log: cnm_mem.h
  10. **
  11. ** 01 15 2014 eason.tsai
  12. ** [ALPS01070904] [Need Patch] [Volunteer Patch][MT6630][Driver]MT6630 Wi-Fi Patch
  13. ** Merging
  14. **
  15. ** //ALPS_SW/DEV/ALPS.JB2.MT6630.DEV/alps/mediatek/kernel/drivers/combo/drv_wlan/mt6630/wlan/...@2327720
  16. **
  17. ** to //ALPS_SW/TRUNK/KK/alps/mediatek/kernel/drivers/combo/drv_wlan/mt6630/wlan/...
  18. **
  19. ** 01 09 2014 eason.tsai
  20. ** [ALPS01070904] [Need Patch] [Volunteer Patch][MT6630][Driver]MT6630 Wi-Fi Patch
  21. ** fix turn off AC definition build error
  22. **
  23. ** 08 19 2013 terry.wu
  24. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  25. ** 1. Enable TC resource adjust feature
  26. ** 2. Set Non-QoS data frame to TC5
  27. **
  28. ** 08 05 2013 terry.wu
  29. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  30. ** 1. Add SW rate definition
  31. ** 2. Add HW default rate selection logic from FW
  32. **
  33. ** 07 26 2013 terry.wu
  34. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  35. ** 1. Reduce extra Tx frame header parsing
  36. ** 2. Add TX port control
  37. ** 3. Add net interface to BSS binding
  38. **
  39. ** 07 12 2013 terry.wu
  40. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  41. ** 1. Update VHT IE composing function
  42. ** 2. disable bow
  43. ** 3. Exchange bss/sta rec update sequence for temp solution
  44. **
  45. ** 07 02 2013 wh.su
  46. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  47. ** Refine security BMC wlan index assign
  48. ** Fix some compiling warning
  49. **
  50. ** 06 14 2013 eddie.chen
  51. ** [BORA00002450] [WIFISYS][MT6630] New design for mt6630
  52. ** Add full mcsset. Add more vht info in sta update
  53. **
  54. ** 03 20 2013 tsaiyuan.hsu
  55. ** [BORA00002222] MT6630 unified MAC RXM
  56. ** add rx duplicate check.
  57. **
  58. ** 03 20 2013 wh.su
  59. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  60. ** Add the security code for wlan table assign operation
  61. **
  62. ** 03 08 2013 wh.su
  63. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  64. ** Modify code for security design
  65. **
  66. ** 03 06 2013 wh.su
  67. ** [BORA00002446] [MT6630] [Wi-Fi] [Driver] Update the security function code
  68. ** submit some code related with security.
  69. **
  70. ** 02 18 2013 cm.chang
  71. ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
  72. ** New feature to remove all sta records by BssIndex
  73. **
  74. ** 01 17 2013 cm.chang
  75. ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
  76. ** Use ucBssIndex to replace eNetworkTypeIndex
  77. **
  78. ** 12 21 2012 terry.wu
  79. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  80. ** Update TxD template feature.
  81. **
  82. ** 12 19 2012 terry.wu
  83. ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
  84. ** Add Tx desc composing function
  85. **
  86. ** 11 06 2012 eason.tsai
  87. ** [BORA00002255] [MT6630 Wi-Fi][Driver] develop
  88. ** .
  89. **
  90. ** 09 17 2012 cm.chang
  91. ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
  92. ** Duplicate source from MT6620 v2.3 driver branch
  93. ** (Davinci label: MT6620_WIFI_Driver_V2_3_120913_1942_As_MT6630_Base)
  94. *
  95. * 03 02 2012 terry.wu
  96. * NULL
  97. * Snc CFG80211 modification for ICS migration from branch 2.2.
  98. *
  99. * 01 05 2012 tsaiyuan.hsu
  100. * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v
  101. * add timing measurement support for 802.11v.
  102. *
  103. * 03 17 2011 yuche.tsai
  104. * NULL
  105. * Resize the Secondary Device Type array when WiFi Direct is enabled.
  106. *
  107. * 03 16 2011 wh.su
  108. * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done
  109. * enable the protected while at P2P start GO, and skip some security check .
  110. *
  111. * 01 26 2011 cm.chang
  112. * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
  113. * .
  114. *
  115. * 01 11 2011 eddie.chen
  116. * [WCXRP00000322] Add WMM IE in beacon,
  117. Add per station flow control when STA is in PS
  118. * Add per STA flow control when STA is in PS mode
  119. *
  120. * 12 29 2010 eddie.chen
  121. * [WCXRP00000322] Add WMM IE in beacon,
  122. Add per station flow control when STA is in PS
  123. * 1) PS flow control event
  124. *
  125. * 2) WMM IE in beacon, assoc resp, probe resp
  126. *
  127. * 12 23 2010 george.huang
  128. * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function
  129. * 1. update WMM IE parsing, with ASSOC REQ handling
  130. * 2. extend U-APSD parameter passing from driver to FW
  131. *
  132. * 12 07 2010 cm.chang
  133. * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
  134. * 1. BSSINFO include RLM parameter
  135. * 2. free all sta records when network is disconnected
  136. *
  137. * 11 29 2010 cm.chang
  138. * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for
  139. * initial TX rate selection of auto-rate algorithm
  140. * Sync RCPI of STA_REC to FW as reference of initial TX rate
  141. *
  142. * 10 18 2010 cp.wu
  143. * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD
  144. * when entering RF test with AIS associated
  145. * 1. remove redundant variables in STA_REC structure
  146. * 2. add STA-REC uninitialization routine for clearing pending events
  147. *
  148. * 09 21 2010 kevin.huang
  149. * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
  150. * Eliminate Linux Compile Warning
  151. *
  152. * 09 03 2010 kevin.huang
  153. * NULL
  154. * Refine #include sequence and solve recursive/nested #include issue
  155. *
  156. * 07 12 2010 cp.wu
  157. *
  158. * SAA will take a record for tracking request sequence number.
  159. *
  160. * 07 08 2010 cp.wu
  161. *
  162. * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
  163. *
  164. * 07 07 2010 cm.chang
  165. * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
  166. * Support state of STA record change from 1 to 1
  167. *
  168. * 07 01 2010 cm.chang
  169. * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
  170. * Support sync command of STA_REC
  171. *
  172. * 06 21 2010 wh.su
  173. * [WPD00003840][MT6620 5931] Security migration
  174. * modify some code for concurrent network.
  175. *
  176. * 06 21 2010 yuche.tsai
  177. * [WPD00003839][MT6620 5931][P2P] Feature migration
  178. * Fix compile error for P2P related defination.
  179. *
  180. * 06 18 2010 cm.chang
  181. * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
  182. * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf
  183. *
  184. * 06 17 2010 yuche.tsai
  185. * [WPD00003839][MT6620 5931][P2P] Feature migration
  186. * Add P2P related fields.
  187. *
  188. * 06 14 2010 cp.wu
  189. * [WPD00003833][MT6620 and MT5931] Driver migration
  190. * saa_fsm.c is migrated.
  191. *
  192. * 06 14 2010 cp.wu
  193. * [WPD00003833][MT6620 and MT5931] Driver migration
  194. * restore utility function invoking via hem_mbox to direct calls
  195. *
  196. * 06 10 2010 cp.wu
  197. * [WPD00003833][MT6620 and MT5931] Driver migration
  198. * add buildable & linkable ais_fsm.c
  199. *
  200. * related reference are still waiting to be resolved
  201. *
  202. * 06 08 2010 cp.wu
  203. * [WPD00003833][MT6620 and MT5931] Driver migration
  204. * hem_mbox is migrated.
  205. *
  206. * 06 08 2010 cp.wu
  207. * [WPD00003833][MT6620 and MT5931] Driver migration
  208. * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration
  209. *
  210. * 06 04 2010 george.huang
  211. * [BORA00000678][MT6620]WiFi LP integration
  212. * [BORA00000678] [MT6620]WiFi LP integration
  213. * 1. add u8TimeStamp in MSDU_INFO
  214. * 2. move fgIsRxTSFUpdated/fgIsTxTSFUpdated from static to BSS_INFO
  215. * 3. add new member for supporting PM in STA_RECORD, which is for AP PS mode
  216. *
  217. * 05 31 2010 yarco.yang
  218. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  219. * Add RX TSF Log Feature and ADDBA Rsp with DECLINE handling
  220. *
  221. * 05 28 2010 cm.chang
  222. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  223. * Support checking of duplicated buffer free
  224. *
  225. * 05 28 2010 kevin.huang
  226. * [BORA00000794][WIFISYS][New Feature]Power Management Support
  227. * Move define of STA_REC_NUM to config.h and rename to CFG_STA_REC_NUM
  228. *
  229. * 05 21 2010 kevin.huang
  230. * [BORA00000794][WIFISYS][New Feature]Power Management Support
  231. * Refine txmInitWtblTxRateTable() - set TX initial rate according to AP's operation rate set
  232. *
  233. * 05 19 2010 yarco.yang
  234. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  235. * Fixed MAC RX Desc be overwritten issue
  236. *
  237. * 05 12 2010 kevin.huang
  238. * [BORA00000794][WIFISYS][New Feature]Power Management Support
  239. * Add Power Management - Legacy PS-POLL support.
  240. *
  241. * 05 10 2010 yarco.yang
  242. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  243. * Support Rx header translation for A-MSDU subframe
  244. *
  245. * 05 07 2010 george.huang
  246. * [BORA00000678][MT6620]WiFi LP integration
  247. * add more sanity check about setting timer
  248. *
  249. * 04 29 2010 george.huang
  250. * [BORA00000678][MT6620]WiFi LP integration
  251. * modify the compiling flag for RAM usage
  252. *
  253. * 04 28 2010 tehuang.liu
  254. * [BORA00000605][WIFISYS] Phase3 Integration
  255. * Modified some MQM-related data structures (SN counter, TX/RX BA table)
  256. *
  257. * 04 27 2010 tehuang.liu
  258. * [BORA00000605][WIFISYS] Phase3 Integration
  259. * Added new TX/RX BA tables in STA_REC
  260. *
  261. * 04 19 2010 kevin.huang
  262. * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support
  263. * Add Beacon Timeout Support and will send Null frame to diagnose connection
  264. *
  265. * 04 09 2010 tehuang.liu
  266. * [BORA00000605][WIFISYS] Phase3 Integration
  267. * [BORA00000644] WiFi phase 4 integration
  268. * Added per-TID SN cache in STA_REC
  269. *
  270. * 03 24 2010 cm.chang
  271. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  272. * Support power control
  273. *
  274. * 03 16 2010 kevin.huang
  275. * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
  276. * Add AdHoc Mode
  277. *
  278. * 03 11 2010 yuche.tsai
  279. * [BORA00000343][MT6620] Emulation For TX
  280. * .
  281. *
  282. * 03 05 2010 yarco.yang
  283. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  284. * Remove Emulation definition
  285. *
  286. * 03 04 2010 cp.wu
  287. * [BORA00000368]Integrate HIF part into BORA
  288. * eliminate HIF_EMULATION in cnm_mem.h
  289. *
  290. * 03 04 2010 kevin.huang
  291. * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
  292. * Add cnmStaRecChangeState() declaration.
  293. *
  294. * 03 03 2010 cm.chang
  295. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  296. * Remove compiling warning for some emulation flags
  297. *
  298. * 03 03 2010 wh.su
  299. * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
  300. * move the AIS specific variable for security to AIS specific structure.
  301. *
  302. * 03 03 2010 wh.su
  303. * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize
  304. * Fixed the pre-authentication timer not correctly init issue,
  305. * and modify the security related callback function prototype.
  306. *
  307. * 03 01 2010 tehuang.liu
  308. * [BORA00000569][WIFISYS] Phase 2 Integration Test
  309. * To store field AMPDU Parameters in STA_REC
  310. *
  311. * 02 26 2010 tehuang.liu
  312. * [BORA00000569][WIFISYS] Phase 2 Integration Test
  313. * Added fgIsWmmSupported in STA_RECORD_T.
  314. *
  315. * 02 26 2010 tehuang.liu
  316. * [BORA00000569][WIFISYS] Phase 2 Integration Test
  317. * Added fgIsUapsdSupported in STA_RECORD_T
  318. *
  319. * 02 13 2010 tehuang.liu
  320. * [BORA00000569][WIFISYS] Phase 2 Integration Test
  321. * Added arTspecTable in STA_REC for TSPEC management
  322. *
  323. * 02 12 2010 cm.chang
  324. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  325. * Enable mgmt buffer debug by default
  326. *
  327. * 02 12 2010 tehuang.liu
  328. * [BORA00000569][WIFISYS] Phase 2 Integration Test
  329. * Added BUFFER_SOURCE_BCN
  330. *
  331. * 02 10 2010 tehuang.liu
  332. * [BORA00000569][WIFISYS] Phase 2 Integration Test
  333. * Renamed MSDU_INFO.ucFixedRateIndex as MSDU_INFO.ucFixedRateCode
  334. *
  335. * 02 04 2010 kevin.huang
  336. * [BORA00000603][WIFISYS] [New Feature] AAA Module Support
  337. * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup
  338. *
  339. * 02 02 2010 tehuang.liu
  340. * [BORA00000569][WIFISYS] Phase 2 Integration Test
  341. * Added SN info in MSDU_INFO_T
  342. *
  343. * 01 27 2010 wh.su
  344. * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code
  345. * add and fixed some security function.
  346. *
  347. * 01 11 2010 kevin.huang
  348. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  349. * Add Deauth and Disassoc Handler
  350. *
  351. * 01 08 2010 cp.wu
  352. * [BORA00000368]Integrate HIF part into BORA
  353. * 1) separate wifi_var_emu.c/.h from wifi_var.c/.h
  354. * 2) eliminate HIF_EMULATION code sections appeared in wifi_var/cnm_mem
  355. * 3) use cnmMemAlloc() instead to allocate SRAM buffer
  356. *
  357. * 12 31 2009 cp.wu
  358. * [BORA00000368]Integrate HIF part into BORA
  359. * 1) surpress debug message emitted from hal_hif.c
  360. * 2) add two set of field for recording buffer process time
  361. *
  362. * 12 31 2009 cp.wu
  363. * [BORA00000368]Integrate HIF part into BORA
  364. * 1. move wifi task initialization from wifi_task.c(rom) to wifi_init.c (TCM) for integrating F/W download later
  365. * * * * * 2. WIFI_Event_Dispatcher() prototype changed to return to suspend mode from normal operation mode
  366. * * * * * 2. HIF emulation logic revised
  367. *
  368. * 12 29 2009 yuche.tsai
  369. * [BORA00000343][MT6620] Emulation For TX
  370. * .Using global buffer declaring by SD1 instead of using another one.
  371. *
  372. * 12 25 2009 tehuang.liu
  373. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  374. * Integrated modifications for 1st connection (mainly on FW modules MQM, TXM, and RXM)
  375. * * MQM: BA handling
  376. * * TXM: Macros updates
  377. * * RXM: Macros/Duplicate Removal updates
  378. *
  379. * 12 24 2009 yarco.yang
  380. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  381. * .
  382. *
  383. * 12 23 2009 cp.wu
  384. * [BORA00000368]Integrate HIF part into BORA
  385. * allocating SRAM for emulation purpose by ruducing MEM_BANK3_BUF_SZ
  386. *
  387. * 12 21 2009 cm.chang
  388. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  389. * Remove individual DATA_BUF_BLOCK_NUM definition for emulation compiling flagsu1rwduu`wvpghlqg|fh+fmdkb
  390. *
  391. * 12 21 2009 cm.chang
  392. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  393. * Support several data buffer banks.
  394. *
  395. * 12 18 2009 cm.chang
  396. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  397. * .For new FPGA memory size
  398. *
  399. * 12 18 2009 cm.chang
  400. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  401. * .
  402. *
  403. * 12 17 2009 george.huang
  404. * [BORA00000018]Integrate WIFI part into BORA for the 1st time
  405. * .
  406. *
  407. * Dec 17 2009 MTK02468
  408. * [BORA00000337] To check in codes for FPGA emulation
  409. * Modified the DATA_BLOCK_SIZE from 1620 to 2048
  410. *
  411. * Dec 16 2009 mtk01426
  412. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  413. * Add CFG_TEST_SEC_EMULATION flag
  414. *
  415. * Dec 9 2009 mtk01104
  416. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  417. * Add HT cap to sta record
  418. *
  419. * Dec 9 2009 mtk02752
  420. * [BORA00000368] Integrate HIF part into BORA
  421. * add cnmDataPktFree() for emulation loopback purpose
  422. *
  423. * Dec 8 2009 mtk01088
  424. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  425. * add the buffer for key handshake 1x and cmd key order issue
  426. *
  427. * Dec 7 2009 mtk01088
  428. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  429. * move the tx call back function proto type to typedef.h
  430. *
  431. * Dec 3 2009 mtk01461
  432. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  433. * Add cnmGetStaRecByAddress() and modify variable in STA_RECORD_T
  434. *
  435. * Dec 1 2009 mtk01088
  436. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  437. * rename the port block flag
  438. *
  439. * Nov 23 2009 mtk01461
  440. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  441. * Add variables to STA_RECORD_T for assoc/auth
  442. *
  443. * Nov 23 2009 mtk02468
  444. * [BORA00000337] To check in codes for FPGA emulation
  445. * Fixed the value of STA_WAIT_QUEUE_NUM (from 7 to 5)
  446. *
  447. * Nov 20 2009 mtk02468
  448. * [BORA00000337] To check in codes for FPGA emulation
  449. * Removed u2FrameLength from SW_RFB
  450. *
  451. * Nov 20 2009 mtk02468
  452. * [BORA00000337] To check in codes for FPGA emulation
  453. * Fixed indenting
  454. *
  455. * Nov 20 2009 mtk02468
  456. * [BORA00000337] To check in codes for FPGA emulation
  457. * Updated MSDU_INFO and SW_RFB
  458. *
  459. * Nov 19 2009 mtk01088
  460. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  461. * update the variable for security
  462. *
  463. * Nov 18 2009 mtk01088
  464. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  465. * remove the variable to make the compiler ok
  466. *
  467. * Nov 18 2009 mtk01088
  468. * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code
  469. * add the variable for security module
  470. *
  471. * Nov 16 2009 mtk01461
  472. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  473. * Fix typo in define of MSG_BUF_BLOCK_SIZE
  474. *
  475. * Nov 13 2009 mtk02468
  476. * [BORA00000337] To check in codes for FPGA emulation
  477. * Let typedef STA_REC_T precede typedef MSDU_INFO_T and SW_RFB_T
  478. *
  479. * Nov 13 2009 mtk02468
  480. * [BORA00000337] To check in codes for FPGA emulation
  481. * Modified MSDU_INFO and STA_REC for TXM and MQM
  482. *
  483. * Nov 12 2009 mtk01104
  484. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  485. * Rename STA_REC_T to STA_RECORD_T and add ucIndex member
  486. *
  487. * Nov 9 2009 mtk01104
  488. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  489. * Make sure ucBufferSource the same offset in MSDU_INFO and SW_RFB
  490. *
  491. * Nov 6 2009 mtk01426
  492. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  493. *
  494. *
  495. * Nov 5 2009 mtk01426
  496. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  497. *
  498. *
  499. * Nov 5 2009 mtk01461
  500. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  501. * Update comment
  502. *
  503. * Oct 30 2009 mtk01461
  504. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  505. * Add draft content of MSDU_INFO_T and SW_RFB_T
  506. *
  507. * Oct 30 2009 mtk01084
  508. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  509. *
  510. *
  511. * Oct 28 2009 mtk01104
  512. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  513. *
  514. *
  515. * Oct 23 2009 mtk01461
  516. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  517. * Fix lint warning
  518. *
  519. * Oct 21 2009 mtk01426
  520. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  521. * Add CFG_TEST_RX_EMULATION flag
  522. *
  523. * Oct 20 2009 mtk01426
  524. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  525. *
  526. *
  527. * Oct 9 2009 mtk02468
  528. * [BORA00000337] To check in codes for FPGA emulation
  529. * Added field ucTC to MSDU_INFO_T and field pucHifRxPacket to SW_RFB_T
  530. *
  531. * Oct 8 2009 mtk01104
  532. * [BORA00000018] Integrate WIFI part into BORA for the 1st time
  533. *
  534. **
  535. */
  536. #ifndef _CNM_MEM_H
  537. #define _CNM_MEM_H
  538. /*******************************************************************************
  539. * C O M P I L E R F L A G S
  540. ********************************************************************************
  541. */
  542. /*******************************************************************************
  543. * E X T E R N A L R E F E R E N C E S
  544. ********************************************************************************
  545. */
  546. /*******************************************************************************
  547. * C O N S T A N T S
  548. ********************************************************************************
  549. */
  550. #ifndef POWER_OF_2
  551. #define POWER_OF_2(n) BIT(n)
  552. #endif
  553. /* Size of a basic management buffer block in power of 2 */
  554. #define MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2 7 /* 7 to the power of 2 = 128 */
  555. #define MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2 5 /* 5 to the power of 2 = 32 */
  556. /* Size of a basic management buffer block */
  557. #define MGT_BUF_BLOCK_SIZE POWER_OF_2(MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2)
  558. #define MSG_BUF_BLOCK_SIZE POWER_OF_2(MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2)
  559. /* Total size of (n) basic management buffer blocks */
  560. #define MGT_BUF_BLOCKS_SIZE(n) ((UINT_32)(n) << MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2)
  561. #define MSG_BUF_BLOCKS_SIZE(n) ((UINT_32)(n) << MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2)
  562. /* Number of management buffer block */
  563. #define MAX_NUM_OF_BUF_BLOCKS 32 /* Range: 1~32 */
  564. /* Size of overall management frame buffer */
  565. #define MGT_BUFFER_SIZE (MAX_NUM_OF_BUF_BLOCKS * MGT_BUF_BLOCK_SIZE)
  566. #define MSG_BUFFER_SIZE (MAX_NUM_OF_BUF_BLOCKS * MSG_BUF_BLOCK_SIZE)
  567. /* STA_REC related definitions */
  568. #define STA_REC_INDEX_BMCAST 0xFF
  569. #define STA_REC_INDEX_NOT_FOUND 0xFE
  570. #define STA_WAIT_QUEUE_NUM 5 /* Number of SW queues in each STA_REC: AC0~AC4 */
  571. #define SC_CACHE_INDEX_NUM 5 /* Number of SC caches in each STA_REC: AC0~AC4 */
  572. /* P2P related definitions */
  573. #ifdef CFG_ENABLE_WIFI_DIRECT
  574. /* Moved from p2p_fsm.h */
  575. #define WPS_ATTRI_MAX_LEN_DEVICE_NAME 32 /* 0x1011 */
  576. #define P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT 8 /* NOTE(Kevin): Shall <= 16 */
  577. #endif
  578. /* Define the argument of cnmStaFreeAllStaByNetwork when all station records
  579. * will be free. No one will be free
  580. */
  581. #define STA_REC_EXCLUDE_NONE CFG_STA_REC_NUM
  582. /*******************************************************************************
  583. * D A T A T Y P E S
  584. ********************************************************************************
  585. */
  586. #if ((MAX_NUM_OF_BUF_BLOCKS > 32) || (MAX_NUM_OF_BUF_BLOCKS <= 0))
  587. #error > #define MAX_NUM_OF_MGT_BUF_BLOCKS : Out of boundary !
  588. #elif MAX_NUM_OF_BUF_BLOCKS > 16
  589. typedef UINT_32 BUF_BITMAP;
  590. #elif MAX_NUM_OF_BUF_BLOCKS > 8
  591. typedef UINT_16 BUF_BITMAP;
  592. #else
  593. typedef UINT_8 BUF_BITMAP;
  594. #endif /* MAX_NUM_OF_MGT_BUF_BLOCKS */
  595. /* Control variable of TX management memory pool */
  596. typedef struct _BUF_INFO_T {
  597. PUINT_8 pucBuf;
  598. #if CFG_DBG_MGT_BUF
  599. UINT_32 u4AllocCount;
  600. UINT_32 u4FreeCount;
  601. UINT_32 u4AllocNullCount;
  602. #endif /* CFG_DBG_MGT_BUF */
  603. BUF_BITMAP rFreeBlocksBitmap;
  604. UINT_8 aucAllocatedBlockNum[MAX_NUM_OF_BUF_BLOCKS];
  605. } BUF_INFO_T, *P_BUF_INFO_T;
  606. /* Wi-Fi divides RAM into three types
  607. * MSG: Mailbox message (Small size)
  608. * BUF: HW DMA buffers (HIF/MAC)
  609. */
  610. typedef enum _ENUM_RAM_TYPE_T {
  611. RAM_TYPE_MSG = 0,
  612. RAM_TYPE_BUF
  613. } ENUM_RAM_TYPE_T, P_ENUM_RAM_TYPE_T;
  614. typedef enum _ENUM_BUFFER_SOURCE_T {
  615. BUFFER_SOURCE_HIF_TX0 = 0,
  616. BUFFER_SOURCE_HIF_TX1,
  617. BUFFER_SOURCE_MAC_RX,
  618. BUFFER_SOURCE_MNG,
  619. BUFFER_SOURCE_BCN,
  620. BUFFER_SOURCE_NUM
  621. } ENUM_BUFFER_SOURCE_T, *P_ENUM_BUFFER_SOURCE_T;
  622. typedef enum _ENUM_SEC_STATE_T {
  623. SEC_STATE_INIT,
  624. SEC_STATE_INITIATOR_PORT_BLOCKED,
  625. SEC_STATE_RESPONDER_PORT_BLOCKED,
  626. SEC_STATE_CHECK_OK,
  627. SEC_STATE_SEND_EAPOL,
  628. SEC_STATE_SEND_DEAUTH,
  629. SEC_STATE_COUNTERMEASURE,
  630. SEC_STATE_NUM
  631. } ENUM_SEC_STATE_T;
  632. typedef struct _TSPEC_ENTRY_T {
  633. UINT_8 ucStatus;
  634. UINT_8 ucToken; /* Dialog Token in ADDTS_REQ or ADDTS_RSP */
  635. UINT_16 u2MediumTime;
  636. UINT_32 u4TsInfo;
  637. /* PARAM_QOS_TS_INFO rParamTsInfo; */
  638. /* Add other retained QoS parameters below */
  639. } TSPEC_ENTRY_T, *P_TSPEC_ENTRY_T, TSPEC_TABLE_ENTRY_T, *P_TSPEC_TABLE_ENTRY_T;
  640. #if 0
  641. typedef struct _SEC_INFO_T {
  642. ENUM_SEC_STATE_T ePreviousState;
  643. ENUM_SEC_STATE_T eCurrentState;
  644. BOOL fg2nd1xSend;
  645. BOOL fgKeyStored;
  646. UINT_8 aucStoredKey[64];
  647. BOOL fgAllowOnly1x;
  648. } SEC_INFO_T, *P_SEC_INFO_T;
  649. #endif
  650. #define MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS 3
  651. #define UPDATE_BSS_RSSI_INTERVAL_SEC 3 /* Seconds */
  652. /* Fragment information structure */
  653. typedef struct _FRAG_INFO_T {
  654. UINT_16 u2NextFragSeqCtrl;
  655. PUINT_8 pucNextFragStart;
  656. P_SW_RFB_T pr1stFrag;
  657. OS_SYSTIME rReceiveLifetimeLimit; /* The receive time of 1st fragment */
  658. } FRAG_INFO_T, *P_FRAG_INFO_T;
  659. /* Define STA record structure */
  660. struct _STA_RECORD_T {
  661. LINK_ENTRY_T rLinkEntry;
  662. UINT_8 ucIndex; /* Not modify it except initializing */
  663. UINT_8 ucWlanIndex; /* WLAN table index */
  664. UINT_8 ucBMCWlanIndex; /* The BSS STA Rx WLAN index, IBSS Rx BC WLAN table index, work at IBSS Open and WEP */
  665. BOOLEAN fgIsInUse; /* Indicate if this entry is in use or not */
  666. UINT_8 aucMacAddr[MAC_ADDR_LEN]; /* MAC address */
  667. /* SAA/AAA */
  668. ENUM_AA_STATE_T eAuthAssocState; /* Store STATE Value used in SAA/AAA */
  669. UINT_8 ucAuthAssocReqSeqNum;
  670. ENUM_STA_TYPE_T eStaType; /* Indicate the role of this STA in
  671. * the network (for example, P2P GO)
  672. */
  673. UINT_8 ucBssIndex; /* BSS_INFO_I index */
  674. UINT_8 ucStaState; /* STATE_1,2,3 */
  675. UINT_8 ucPhyTypeSet; /* Available PHY Type Set of this peer
  676. * (may deduced from received BSS_DESC_T)
  677. */
  678. UINT_8 ucDesiredPhyTypeSet; /* The match result by AND operation of peer's
  679. * PhyTypeSet and ours.
  680. */
  681. BOOLEAN fgHasBasicPhyType; /* A flag to indicate a Basic Phy Type which
  682. * is used to generate some Phy Attribute IE
  683. * (e.g. capability, MIB) during association.
  684. */
  685. UINT_8 ucNonHTBasicPhyType; /* The Basic Phy Type chosen among the
  686. * ucDesiredPhyTypeSet.
  687. */
  688. UINT_16 u2HwDefaultFixedRateCode;
  689. UINT_16 u2CapInfo; /* For Infra Mode, to store Capability Info. from Association Resp(SAA).
  690. * For AP Mode, to store Capability Info. from Association Req(AAA).
  691. */
  692. UINT_16 u2AssocId; /* For Infra Mode, to store AID from Association Resp(SAA).
  693. * For AP Mode, to store the Assigned AID(AAA).
  694. */
  695. UINT_16 u2ListenInterval; /* Listen Interval from STA(AAA) */
  696. UINT_16 u2DesiredNonHTRateSet; /* Our Current Desired Rate Set after
  697. * match with STA's Operational Rate Set
  698. */
  699. UINT_16 u2OperationalRateSet; /* Operational Rate Set of peer BSS */
  700. UINT_16 u2BSSBasicRateSet; /* Basic Rate Set of peer BSS */
  701. BOOLEAN fgIsMerging; /* For IBSS Mode, to indicate that Merge is ongoing */
  702. BOOLEAN fgDiagnoseConnection; /* For Infra/AP Mode, to diagnose the Connection with
  703. * this peer by sending ProbeReq/Null frame */
  704. /*------------------------------------------------------------------------------------------*/
  705. /* 802.11n HT capabilities when (prStaRec->ucPhyTypeSet & PHY_TYPE_BIT_HT) is true */
  706. /* They have the same definition with fields of information element */
  707. /*------------------------------------------------------------------------------------------*/
  708. UINT_8 ucMcsSet; /* MCS0~7 rate set of peer BSS */
  709. BOOLEAN fgSupMcs32; /* MCS32 is supported by peer BSS */
  710. UINT_8 aucRxMcsBitmask[SUP_MCS_RX_BITMASK_OCTET_NUM];
  711. UINT_16 u2RxHighestSupportedRate;
  712. UINT_32 u4TxRateInfo;
  713. UINT_16 u2HtCapInfo; /* HT cap info field by HT cap IE */
  714. UINT_8 ucAmpduParam; /* Field A-MPDU Parameters in HT cap IE */
  715. UINT_16 u2HtExtendedCap; /* HT extended cap field by HT cap IE */
  716. UINT_32 u4TxBeamformingCap; /* TX beamforming cap field by HT cap IE */
  717. UINT_8 ucAselCap; /* ASEL cap field by HT cap IE */
  718. #if 1 /* CFG_SUPPORT_802_11AC */
  719. /*------------------------------------------------------------------------------------------*/
  720. /* 802.11ac VHT capabilities when (prStaRec->ucPhyTypeSet & PHY_TYPE_BIT_VHT) is true */
  721. /* They have the same definition with fields of information element */
  722. /*------------------------------------------------------------------------------------------*/
  723. UINT_32 u4VhtCapInfo;
  724. UINT_16 u2VhtRxMcsMap;
  725. UINT_16 u2VhtRxHighestSupportedDataRate;
  726. UINT_16 u2VhtTxMcsMap;
  727. UINT_16 u2VhtTxHighestSupportedDataRate;
  728. #endif
  729. UINT_8 ucRCPI; /* RCPI of peer */
  730. UINT_8 ucDTIMPeriod; /* Target BSS's DTIM Period, we use this
  731. * value for setup Listen Interval
  732. * TODO(Kevin): TBD
  733. */
  734. UINT_8 ucAuthAlgNum; /* For Infra/AP Mode, the Auth Algorithm Num used in Authentication(SAA/AAA) */
  735. BOOLEAN fgIsReAssoc; /* For Infra/AP Mode, to indicate ReAssoc Frame was in used(SAA/AAA) */
  736. UINT_8 ucTxAuthAssocRetryCount; /* For Infra Mode, the Retry Count of TX Auth/Assod Frame(SAA) */
  737. UINT_8 ucTxAuthAssocRetryLimit; /* For Infra Mode, the Retry Limit of TX Auth/Assod Frame(SAA) */
  738. UINT_16 u2StatusCode; /* Status of Auth/Assoc Req */
  739. UINT_16 u2ReasonCode; /* Reason that been Deauth/Disassoc */
  740. P_IE_CHALLENGE_TEXT_T prChallengeText; /* Point to an allocated buffer for storing Challenge
  741. * Text for Shared Key Authentication */
  742. TIMER_T rTxReqDoneOrRxRespTimer; /* For Infra Mode, a timer used to send a timeout event
  743. * while waiting for TX request done or RX response.
  744. */
  745. /*------------------------------------------------------------------------------------------*/
  746. /* Power Management related fields (for STA/ AP/ P2P/ BOW power saving mode) */
  747. /*------------------------------------------------------------------------------------------*/
  748. BOOLEAN fgSetPwrMgtBit; /* For Infra Mode, to indicate that outgoing frame need toggle
  749. * the Pwr Mgt Bit in its Frame Control Field.
  750. */
  751. BOOLEAN fgIsInPS; /* For AP Mode, to indicate the client PS state(PM).
  752. * TRUE: In PS Mode; FALSE: In Active Mode. */
  753. BOOLEAN fgIsInPsPollSP; /* For Infra Mode, to indicate we've sent a PS POLL to AP and start
  754. * the PS_POLL Service Period(LP)
  755. */
  756. BOOLEAN fgIsInTriggerSP; /* For Infra Mode, to indicate we've sent a Trigger Frame to AP and start
  757. * the Delivery Service Period(LP)
  758. */
  759. UINT_8 ucBmpDeliveryAC; /* 0: AC0, 1: AC1, 2: AC2, 3: AC3 */
  760. UINT_8 ucBmpTriggerAC; /* 0: AC0, 1: AC1, 2: AC2, 3: AC3 */
  761. UINT_8 ucUapsdSp; /* Max SP length */
  762. /*------------------------------------------------------------------------------------------*/
  763. BOOLEAN fgIsRtsEnabled;
  764. OS_SYSTIME rUpdateTime; /* (4) System Timestamp of Successful TX and RX */
  765. OS_SYSTIME rLastJoinTime; /* (4) System Timestamp of latest JOIN process */
  766. UINT_8 ucJoinFailureCount; /* Retry Count of JOIN process */
  767. LINK_T arStaWaitQueue[STA_WAIT_QUEUE_NUM]; /* For TXM to defer pkt forwarding to MAC TX DMA */
  768. UINT_16 au2CachedSeqCtrl[TID_NUM + 1]; /* Duplicate removal for HT STA on a
  769. * per-TID basis ("+1" is for MMPDU and non-QoS) */
  770. BOOLEAN afgIsIgnoreAmsduDuplicate[TID_NUM + 1];
  771. #if 0
  772. /* RXM */
  773. P_RX_BA_ENTRY_T aprRxBaTable[TID_NUM];
  774. /* TXM */
  775. P_TX_BA_ENTRY_T aprTxBaTable[TID_NUM];
  776. #endif
  777. FRAG_INFO_T rFragInfo[MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS];
  778. /* SEC_INFO_T rSecInfo; *//* The security state machine */
  779. #if CFG_SUPPORT_ADHOC
  780. BOOLEAN fgAdhocRsnBcKeyExist[2]; /* Ad-hoc RSN Rx BC key exist flag,
  781. * only reserved two entry for each peer */
  782. UINT_8 ucAdhocRsnBcWlanIndex[2]; /* Ad-hoc RSN Rx BC wlan index */
  783. #endif
  784. BOOLEAN fgPortBlock; /* The 802.1x Port Control flag */
  785. BOOLEAN fgTransmitKeyExist; /* Unicast key exist for this STA */
  786. UINT_8 ucCurrentGtkId; /* The Current Group key ID */
  787. BOOLEAN fgTxAmpduEn; /* Enable TX AMPDU for this Peer */
  788. BOOLEAN fgRxAmpduEn; /* Enable RX AMPDU for this Peer */
  789. PUINT_8 pucAssocReqIe;
  790. UINT_16 u2AssocReqIeLen;
  791. WIFI_WMM_AC_STAT_T arLinkStatistics[WMM_AC_INDEX_NUM]; /*link layer satatistics */
  792. /*------------------------------------------------------------------------------------------*/
  793. /* WMM/QoS related fields */
  794. /*------------------------------------------------------------------------------------------*/
  795. BOOLEAN fgIsQoS; /* If the STA is associated as a QSTA or QAP (for TX/RX) */
  796. BOOLEAN fgIsWmmSupported; /* If the peer supports WMM, set to TRUE (for association) */
  797. BOOLEAN fgIsUapsdSupported; /* Set according to the scan result (for association) */
  798. /*------------------------------------------------------------------------------------------*/
  799. /* P2P related fields */
  800. /*------------------------------------------------------------------------------------------*/
  801. #if CFG_ENABLE_WIFI_DIRECT
  802. UINT_8 u2DevNameLen;
  803. UINT_8 aucDevName[WPS_ATTRI_MAX_LEN_DEVICE_NAME];
  804. UINT_8 aucDevAddr[MAC_ADDR_LEN]; /* P2P Device Address */
  805. UINT_16 u2ConfigMethods;
  806. UINT_8 ucDeviceCap;
  807. UINT_8 ucSecondaryDevTypeCount;
  808. DEVICE_TYPE_T rPrimaryDevTypeBE;
  809. DEVICE_TYPE_T arSecondaryDevTypeBE[P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT];
  810. #endif /* CFG_SUPPORT_P2P */
  811. /*------------------------------------------------------------------------------------------*/
  812. /* QM related fields */
  813. /*------------------------------------------------------------------------------------------*/
  814. UINT_8 ucFreeQuota; /* Per Sta flow controal. Valid when fgIsInPS is TRUE.
  815. Change it for per Queue flow control */
  816. /* UINT_8 aucFreeQuotaPerQueue[NUM_OF_PER_STA_TX_QUEUES]; *//* used in future */
  817. UINT_8 ucFreeQuotaForDelivery;
  818. UINT_8 ucFreeQuotaForNonDelivery;
  819. /*------------------------------------------------------------------------------------------*/
  820. /* TXM related fields */
  821. /*------------------------------------------------------------------------------------------*/
  822. PVOID aprTxDescTemplate[TX_DESC_TID_NUM];
  823. #if CFG_ENABLE_PKT_LIFETIME_PROFILE && CFG_ENABLE_PER_STA_STATISTICS
  824. UINT_32 u4TotalTxPktsNumber;
  825. UINT_32 u4TotalTxPktsTime;
  826. UINT_32 u4TotalRxPktsNumber;
  827. UINT_32 u4MaxTxPktsTime;
  828. UINT_32 u4ThresholdCounter;
  829. #endif
  830. #if 1
  831. /*------------------------------------------------------------------------------------------*/
  832. /* To be removed, this is to make que_mgt compilation success only */
  833. /*------------------------------------------------------------------------------------------*/
  834. /* When this STA_REC is in use, set to TRUE. */
  835. BOOLEAN fgIsValid;
  836. /* TX key is ready */
  837. BOOLEAN fgIsTxKeyReady;
  838. /* When the STA is connected or TX key is ready */
  839. BOOLEAN fgIsTxAllowed;
  840. /* Per-STA Queues: [0] AC0, [1] AC1, [2] AC2, [3] AC3, [4] MGMT, [5] non-QoS */
  841. QUE_T arTxQueue[NUM_OF_PER_STA_TX_QUEUES];
  842. /* Reorder Parameter reference table */
  843. P_RX_BA_ENTRY_T aprRxReorderParamRefTbl[CFG_RX_MAX_BA_TID_NUM];
  844. #endif
  845. #if CFG_SUPPORT_802_11V_TIMING_MEASUREMENT
  846. TIMINGMSMT_PARAM_T rWNMTimingMsmt;
  847. #endif
  848. UINT_8 ucTrafficDataType; /* 0: auto 1: data 2: video 3: voice */
  849. UINT_8 ucTxGfMode; /* 0: auto 1:Force enable 2: Force disable 3: enable by peer */
  850. UINT_8 ucTxSgiMode; /* 0: auto 1:Force enable 2: Force disable 3: enable by peer */
  851. UINT_8 ucTxStbcMode; /* 0: auto 1:Force enable 2: Force disable 3: enable by peer */
  852. UINT_32 u4FixedPhyRate; /* */
  853. UINT_16 u2MaxLinkSpeed; /* unit is 0.5 Mbps */
  854. UINT_16 u2MinLinkSpeed;
  855. UINT_32 u4Flags; /* reserved for MTK Synergies */
  856. #if CFG_SUPPORT_TDLS
  857. BOOLEAN fgTdlsIsProhibited; /* TRUE: AP prohibits TDLS links */
  858. BOOLEAN fgTdlsIsChSwProhibited; /* TRUE: AP prohibits TDLS chan switch */
  859. BOOLEAN flgTdlsIsInitiator; /* TRUE: the peer is the initiator */
  860. IE_HT_CAP_T rTdlsHtCap; /* temp to queue HT capability element */
  861. PARAM_KEY_T rTdlsKeyTemp; /* temp to queue the key information */
  862. UINT_8 ucTdlsIndex;
  863. #endif /* CFG_SUPPORT_TDLS */
  864. };
  865. #if 0
  866. /* use nic_tx.h instead */
  867. /* MSDU_INFO and SW_RFB structure */
  868. typedef struct _MSDU_INFO_T {
  869. /* 4 ----------------MSDU_INFO and SW_RFB Common Fields------------------ */
  870. LINK_ENTRY_T rLinkEntry;
  871. PUINT_8 pucBuffer; /* Pointer to the associated buffer */
  872. UINT_8 ucBufferSource; /* HIF TX0, HIF TX1, MAC RX, or MNG Pool */
  873. UINT_8 ucNetworkTypeIndex; /* Network type index that this TX packet is assocaited with */
  874. UINT_8 ucTC; /* 0 to 5 (used by HIF TX to increment the corresponding TC counter) */
  875. UINT_8 ucTID; /* Traffic Identification */
  876. BOOLEAN fgIs802_11Frame; /* Set to TRUE for 802.11 frame */
  877. UINT_8 ucMacHeaderLength;
  878. UINT_16 u2PayloadLength;
  879. PUINT_8 pucMacHeader; /* 802.11 header */
  880. PUINT_8 pucPayload; /* 802.11 payload */
  881. OS_SYSTIME rArrivalTime; /* System Timestamp (4) */
  882. P_STA_RECORD_T prStaRec;
  883. #if CFG_PROFILE_BUFFER_TRACING
  884. ENUM_BUFFER_ACTIVITY_TYPE_T eActivity[2];
  885. UINT_32 rActivityTime[2];
  886. #endif
  887. #if DBG && CFG_BUFFER_FREE_CHK
  888. BOOLEAN fgBufferInSource;
  889. #endif
  890. UINT_8 ucControlFlag; /* For specify some Control Flags, e.g. Basic Rate */
  891. /* 4 -----------------------Non-Common ------------------------- */
  892. /* TODO: move flags to ucControlFlag */
  893. BOOLEAN fgIs1xFrame; /* Set to TRUE for 802.1x frame */
  894. /* TXM: For TX Done handling, callback function & parameter (5) */
  895. BOOLEAN fgIsTxFailed; /* Set to TRUE if transmission failure */
  896. PFN_TX_DONE_HANDLER pfTxDoneHandler;
  897. UINT_64 u8TimeStamp; /* record the TX timestamp */
  898. /* TXM: For PS forwarding control (per-STA flow control) */
  899. UINT_8 ucPsForwardingType; /* Delivery-enabled, non-delivery-enabled, non-PS */
  900. UINT_8 ucPsSessionID; /* The Power Save session id for PS forwarding control */
  901. /* TXM: For MAC TX DMA operations */
  902. UINT_8 ucMacTxQueIdx; /* MAC TX queue: AC0-AC6, BCM, or BCN */
  903. BOOLEAN fgNoAck; /* Set to true if Ack is not required for this packet */
  904. BOOLEAN fgBIP; /* Set to true if BIP is used for this packet */
  905. UINT_8 ucFragTotalCount;
  906. UINT_8 ucFragFinishedCount;
  907. UINT_16 u2FragThreshold; /* Fragmentation threshold without WLAN Header & FCS */
  908. BOOLEAN fgFixedRate; /* If a fixed rate is used, set to TRUE. */
  909. UINT_8 ucFixedRateCode; /* The rate code copied to MAC TX Desc */
  910. UINT_8 ucFixedRateRetryLimit; /* The retry limit when a fixed rate is used */
  911. BOOLEAN fgIsBmcQueueEnd; /* Set to true if this packet is the end of BMC */
  912. /* TXM: For flushing ACL frames */
  913. UINT_16 u2PalLLH; /* 802.11 PAL LLH */
  914. /* UINT_16 u2LLH; */
  915. UINT_16 u2ACLSeq; /* u2LLH+u2ACLSeq for AM HCI flush ACL frame */
  916. /* TXM for retransmitting a flushed packet */
  917. BOOLEAN fgIsSnAssigned;
  918. UINT_16 u2SequenceNumber; /* To remember the Sequence Control field of this MPDU */
  919. } MSDU_INFO_T, *P_MSDU_INFO_T;
  920. #endif
  921. #if 0
  922. /* nic_rx.h */
  923. typedef struct _SW_RFB_T {
  924. /* 4 ----------------MSDU_INFO and SW_RFB Common Fields------------------ */
  925. LINK_ENTRY_T rLinkEntry;
  926. PUINT_8 pucBuffer; /* Pointer to the associated buffer */
  927. UINT_8 ucBufferSource; /* HIF TX0, HIF TX1, MAC RX, or MNG Pool */
  928. UINT_8 ucNetworkTypeIndex; /* Network type index that this TX packet is assocaited with */
  929. UINT_8 ucTC; /* 0 to 5 (used by HIF TX to increment the corresponding TC counter) */
  930. UINT_8 ucTID; /* Traffic Identification */
  931. BOOLEAN fgIs802_11Frame; /* Set to TRUE for 802.11 frame */
  932. UINT_8 ucMacHeaderLength;
  933. UINT_16 u2PayloadLength;
  934. PUINT_8 pucMacHeader; /* 802.11 header */
  935. PUINT_8 pucPayload; /* 802.11 payload */
  936. OS_SYSTIME rArrivalTime; /* System Timestamp (4) */
  937. P_STA_RECORD_T prStaRec;
  938. #if CFG_PROFILE_BUFFER_TRACING
  939. ENUM_BUFFER_ACTIVITY_TYPE_T eActivity[2];
  940. UINT_32 rActivityTime[2];
  941. #endif
  942. #if DBG && CFG_BUFFER_FREE_CHK
  943. BOOLEAN fgBufferInSource;
  944. #endif
  945. UINT_8 ucControlFlag; /* For specify some Control Flags, e.g. Basic Rate */
  946. /* 4 -----------------------Non-Common ------------------------- */
  947. /* For composing the HIF RX Header (TODO: move flags to ucControlFlag) */
  948. PUINT_8 pucHifRxPacket; /* Pointer to the Response packet to HIF RX0 or RX1 */
  949. UINT_16 u2HifRxPacketLength;
  950. UINT_8 ucHeaderOffset;
  951. UINT_8 ucHifRxPortIndex;
  952. UINT_16 u2SequenceControl;
  953. BOOLEAN fgIsA4Frame; /* (For MAC RX packet parsing) set to TRUE if 4 addresses are present */
  954. BOOLEAN fgIsBAR;
  955. BOOLEAN fgIsQoSData;
  956. BOOLEAN fgIsAmsduSubframe; /* Set to TRUE for A-MSDU Subframe */
  957. /* For HIF RX DMA Desc */
  958. BOOLEAN fgTUChecksumCheckRequired;
  959. BOOLEAN fgIPChecksumCheckRequired;
  960. UINT_8 ucEtherTypeOffset;
  961. } SW_RFB_T, *P_SW_RFB_T;
  962. #endif
  963. typedef enum _ENUM_STA_REC_CMD_ACTION_T {
  964. STA_REC_CMD_ACTION_STA = 0,
  965. STA_REC_CMD_ACTION_BSS = 1,
  966. STA_REC_CMD_ACTION_BSS_EXCLUDE_STA = 2
  967. } ENUM_STA_REC_CMD_ACTION_T, *P_ENUM_STA_REC_CMD_ACTION_T;
  968. #if CFG_SUPPORT_TDLS
  969. /* TDLS FSM */
  970. typedef struct _CMD_PEER_ADD_T {
  971. UINT_8 aucPeerMac[6];
  972. ENUM_STA_TYPE_T eStaType;
  973. } CMD_PEER_ADD_T;
  974. typedef struct _CMD_PEER_UPDATE_HT_CAP_MCS_INFO_T {
  975. UINT_8 arRxMask[SUP_MCS_RX_BITMASK_OCTET_NUM];
  976. UINT_16 u2RxHighest;
  977. UINT_8 ucTxParams;
  978. UINT_8 Reserved[3];
  979. } CMD_PEER_UPDATE_HT_CAP_MCS_INFO_T;
  980. typedef struct _CMD_PEER_UPDATE_VHT_CAP_MCS_INFO_T {
  981. UINT_8 arRxMask[SUP_MCS_RX_BITMASK_OCTET_NUM];
  982. } CMD_PEER_UPDATE_VHT_CAP_MCS_INFO_T;
  983. typedef struct _CMD_PEER_UPDATE_HT_CAP_T {
  984. UINT_16 u2CapInfo;
  985. UINT_8 ucAmpduParamsInfo;
  986. /* 16 bytes MCS information */
  987. CMD_PEER_UPDATE_HT_CAP_MCS_INFO_T rMCS;
  988. UINT_16 u2ExtHtCapInfo;
  989. UINT_32 u4TxBfCapInfo;
  990. UINT_8 ucAntennaSelInfo;
  991. } CMD_PEER_UPDATE_HT_CAP_T;
  992. typedef struct _CMD_PEER_UPDATE_VHT_CAP_T {
  993. UINT_16 u2CapInfo;
  994. /* 16 bytes MCS information */
  995. CMD_PEER_UPDATE_VHT_CAP_MCS_INFO_T rVMCS;
  996. } CMD_PEER_UPDATE_VHT_CAP_T;
  997. typedef struct _CMD_PEER_UPDATE_T {
  998. UINT_8 aucPeerMac[6];
  999. #define CMD_PEER_UPDATE_SUP_CHAN_MAX 50
  1000. UINT_8 aucSupChan[CMD_PEER_UPDATE_SUP_CHAN_MAX];
  1001. UINT_16 u2StatusCode;
  1002. #define CMD_PEER_UPDATE_SUP_RATE_MAX 50
  1003. UINT_8 aucSupRate[CMD_PEER_UPDATE_SUP_RATE_MAX];
  1004. UINT_16 u2SupRateLen;
  1005. UINT_8 UapsdBitmap;
  1006. UINT_8 UapsdMaxSp; /* MAX_SP */
  1007. UINT_16 u2Capability;
  1008. #define CMD_PEER_UPDATE_EXT_CAP_MAXLEN 5
  1009. UINT_8 aucExtCap[CMD_PEER_UPDATE_EXT_CAP_MAXLEN];
  1010. UINT_16 u2ExtCapLen;
  1011. CMD_PEER_UPDATE_HT_CAP_T rHtCap;
  1012. CMD_PEER_UPDATE_VHT_CAP_T rVHtCap;
  1013. BOOLEAN fgIsSupHt;
  1014. ENUM_STA_TYPE_T eStaType;
  1015. /* TODO */
  1016. /* So far, TDLS only a few of the parameters, the rest will be added in the future requiements */
  1017. /* kernel 3.10 station paramenters */
  1018. /*struct station_parameters {
  1019. const u8 *supported_rates;
  1020. struct net_device *vlan;
  1021. u32 sta_flags_mask, sta_flags_set;
  1022. u32 sta_modify_mask;
  1023. int listen_interval;
  1024. u16 aid;
  1025. u8 supported_rates_len;
  1026. u8 plink_action;
  1027. u8 plink_state;
  1028. const struct ieee80211_ht_cap *ht_capa;
  1029. const struct ieee80211_vht_cap *vht_capa;
  1030. u8 uapsd_queues;
  1031. u8 max_sp;
  1032. enum nl80211_mesh_power_mode local_pm;
  1033. u16 capability;
  1034. const u8 *ext_capab;
  1035. u8 ext_capab_len;
  1036. const u8 *supported_channels;
  1037. u8 supported_channels_len;
  1038. const u8 *supported_oper_classes;
  1039. u8 supported_oper_classes_len;
  1040. };
  1041. */
  1042. } CMD_PEER_UPDATE_T;
  1043. #endif
  1044. /*******************************************************************************
  1045. * P U B L I C D A T A
  1046. ********************************************************************************
  1047. */
  1048. /*******************************************************************************
  1049. * P R I V A T E D A T A
  1050. ********************************************************************************
  1051. */
  1052. /*******************************************************************************
  1053. * M A C R O S
  1054. ********************************************************************************
  1055. */
  1056. #if CFG_DBG_MGT_BUF
  1057. #define cnmMgtPktAlloc(_prAdapter, _u4Length) \
  1058. cnmPktAllocWrapper((_prAdapter), (_u4Length), (PUINT_8)__func__)
  1059. #define cnmMgtPktFree(_prAdapter, _prMsduInfo) \
  1060. cnmPktFreeWrapper((_prAdapter), (_prMsduInfo), (PUINT_8)__func__)
  1061. #else
  1062. #define cnmMgtPktAlloc cnmPktAlloc
  1063. #define cnmMgtPktFree cnmPktFree
  1064. #endif
  1065. /*******************************************************************************
  1066. * F U N C T I O N D E C L A R A T I O N S
  1067. ********************************************************************************
  1068. */
  1069. P_MSDU_INFO_T cnmPktAllocWrapper(IN P_ADAPTER_T prAdapter, IN UINT_32 u4Length, IN PUINT_8 pucStr);
  1070. VOID cnmPktFreeWrapper(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo, IN PUINT_8 pucStr);
  1071. P_MSDU_INFO_T cnmPktAlloc(IN P_ADAPTER_T prAdapter, IN UINT_32 u4Length);
  1072. VOID cnmPktFree(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo);
  1073. VOID cnmMemInit(IN P_ADAPTER_T prAdapter);
  1074. PVOID cnmMemAlloc(IN P_ADAPTER_T prAdapter, IN ENUM_RAM_TYPE_T eRamType, IN UINT_32 u4Length);
  1075. VOID cnmMemFree(IN P_ADAPTER_T prAdapter, IN PVOID pvMemory);
  1076. VOID cnmStaRecInit(IN P_ADAPTER_T prAdapter);
  1077. P_STA_RECORD_T
  1078. cnmStaRecAlloc(IN P_ADAPTER_T prAdapter, IN ENUM_STA_TYPE_T eStaType, IN UINT_8 ucBssIndex, IN PUINT_8 pucMacAddr);
  1079. VOID cnmStaRecFree(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prStaRec);
  1080. VOID cnmStaFreeAllStaByNetwork(P_ADAPTER_T prAdapter, UINT_8 ucBssIndex, UINT_8 ucStaRecIndexExcluded);
  1081. P_STA_RECORD_T cnmGetStaRecByIndex(IN P_ADAPTER_T prAdapter, IN UINT_8 ucIndex);
  1082. P_STA_RECORD_T cnmGetStaRecByAddress(P_ADAPTER_T prAdapter, UINT_8 ucBssIndex, UINT_8 aucPeerMACAddress[]);
  1083. VOID cnmStaRecChangeState(IN P_ADAPTER_T prAdapter, IN OUT P_STA_RECORD_T prStaRec, IN UINT_8 ucNewState);
  1084. VOID cnmDumpStaRec(IN P_ADAPTER_T prAdapter, IN UINT_8 ucStaRecIdx);
  1085. VOID cnmDumpMemoryStatus(IN P_ADAPTER_T prAdapter);
  1086. #if CFG_SUPPORT_TDLS
  1087. WLAN_STATUS /* TDLS_STATUS */
  1088. cnmPeerAdd(P_ADAPTER_T prAdapter, PVOID pvSetBuffer, UINT_32 u4SetBufferLen, PUINT_32 pu4SetInfoLen);
  1089. WLAN_STATUS /* TDLS_STATUS */
  1090. cnmPeerUpdate(P_ADAPTER_T prAdapter, PVOID pvSetBuffer, UINT_32 u4SetBufferLen, PUINT_32 pu4SetInfoLen);
  1091. P_STA_RECORD_T cnmGetTdlsPeerByAddress(P_ADAPTER_T prAdapter, UINT_8 ucBssIndex, UINT_8 aucPeerMACAddress[]);
  1092. #endif
  1093. /*******************************************************************************
  1094. * F U N C T I O N S
  1095. ********************************************************************************
  1096. */
  1097. #ifndef _lint
  1098. /* Kevin: we don't have to call following function to inspect the data structure.
  1099. * It will check automatically while at compile time.
  1100. * We'll need this for porting driver to different RTOS.
  1101. */
  1102. static __KAL_INLINE__ VOID cnmMemDataTypeCheck(VOID)
  1103. {
  1104. #if 0
  1105. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, rLinkEntry) == 0);
  1106. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, rLinkEntry) == OFFSET_OF(SW_RFB_T, rLinkEntry));
  1107. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, pucBuffer) == OFFSET_OF(SW_RFB_T, pucBuffer));
  1108. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, ucBufferSource) == OFFSET_OF(SW_RFB_T, ucBufferSource));
  1109. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, pucMacHeader) == OFFSET_OF(SW_RFB_T, pucMacHeader));
  1110. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, ucMacHeaderLength) ==
  1111. OFFSET_OF(SW_RFB_T, ucMacHeaderLength));
  1112. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, pucPayload) == OFFSET_OF(SW_RFB_T, pucPayload));
  1113. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, u2PayloadLength) == OFFSET_OF(SW_RFB_T, u2PayloadLength));
  1114. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, prStaRec) == OFFSET_OF(SW_RFB_T, prStaRec));
  1115. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, ucNetworkTypeIndex) ==
  1116. OFFSET_OF(SW_RFB_T, ucNetworkTypeIndex));
  1117. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, ucTID) == OFFSET_OF(SW_RFB_T, ucTID));
  1118. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, fgIs802_11Frame) == OFFSET_OF(SW_RFB_T, fgIs802_11Frame));
  1119. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, ucControlFlag) == OFFSET_OF(SW_RFB_T, ucControlFlag));
  1120. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, rArrivalTime) == OFFSET_OF(SW_RFB_T, rArrivalTime));
  1121. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, ucTC) == OFFSET_OF(SW_RFB_T, ucTC));
  1122. #if CFG_PROFILE_BUFFER_TRACING
  1123. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, eActivity[0]) == OFFSET_OF(SW_RFB_T, eActivity[0]));
  1124. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, rActivityTime[0]) == OFFSET_OF(SW_RFB_T,
  1125. rActivityTime[0]));
  1126. #endif
  1127. #if DBG && CFG_BUFFER_FREE_CHK
  1128. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(MSDU_INFO_T, fgBufferInSource) == OFFSET_OF(SW_RFB_T,
  1129. fgBufferInSource));
  1130. #endif
  1131. DATA_STRUCT_INSPECTING_ASSERT(OFFSET_OF(STA_RECORD_T, rLinkEntry) == 0);
  1132. return;
  1133. #endif
  1134. }
  1135. #endif /* _lint */
  1136. #endif /* _CNM_MEM_H */