cnm_mem.h 40 KB

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