nic_tx.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. /*
  2. ** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/nic_tx.h#1
  3. */
  4. /*! \file nic_tx.h
  5. \brief Functions that provide TX operation in NIC's point of view.
  6. This file provides TX functions which are responsible for both Hardware and
  7. Software Resource Management and keep their Synchronization.
  8. */
  9. /*
  10. ** Log: nic_tx.h
  11. *
  12. * 11 18 2011 eddie.chen
  13. * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
  14. * Add log counter for tx
  15. *
  16. * 11 10 2011 eddie.chen
  17. * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
  18. * Add TX_DONE status detail information.
  19. *
  20. * 08 15 2011 cp.wu
  21. * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree
  22. * add MT6628-specific definitions.
  23. *
  24. * 04 12 2011 cp.wu
  25. * [WCXRP00000631] [MT6620 Wi-Fi][Driver] Add an API for QM to retrieve current TC counter value and processing
  26. * frame dropping cases for TC4 path
  27. * 1. add nicTxGetResource() API for QM to make decisions.
  28. * 2. if management frames is decided by QM for dropping, the call back is invoked to indicate such a case.
  29. *
  30. * 03 21 2011 cp.wu
  31. * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer
  32. * portability improvement
  33. *
  34. * 02 16 2011 cp.wu
  35. * [WCXRP00000449] [MT6620 Wi-Fi][Driver] Refine CMD queue handling by adding an extra API for checking
  36. * available count and modify behavior
  37. * 1. add new API: nicTxGetFreeCmdCount()
  38. * 2. when there is insufficient command descriptor, nicTxEnqueueMsdu() will drop command packets directly
  39. *
  40. * 01 24 2011 cp.wu
  41. * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving
  42. * 1. add an extra counter for tracking pending forward frames.
  43. * 2. notify TX service thread as well when there is pending forward frame
  44. * 3. correct build errors leaded by introduction of Wi-Fi direct separation module
  45. *
  46. * 12 15 2010 yuche.tsai
  47. * NULL
  48. * Update SLT Descriptor number configure in driver.
  49. *
  50. * 11 16 2010 yarco.yang
  51. * [WCXRP00000177] [MT5931 F/W] Performance tuning for 1st connection
  52. * Update TX buffer count
  53. *
  54. * 11 03 2010 cp.wu
  55. * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection
  56. * 1) use 8 buffers for MT5931 which is equipped with less memory
  57. * 2) modify MT5931 debug level to TRACE when download is successful
  58. *
  59. * 10 18 2010 cp.wu
  60. * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore
  61. * 1. when wlanAdapterStop() failed to send POWER CTRL command to firmware, do not poll for ready bit dis-assertion
  62. * 2. shorten polling count for shorter response time
  63. * 3. if bad I/O operation is detected during TX resource polling, then further operation is aborted as well
  64. *
  65. * 10 06 2010 cp.wu
  66. * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
  67. * code reorganization to improve isolation between GLUE and CORE layers.
  68. *
  69. * 09 03 2010 kevin.huang
  70. * NULL
  71. * Refine #include sequence and solve recursive/nested #include issue
  72. *
  73. * 08 30 2010 cp.wu
  74. * NULL
  75. * API added: nicTxPendingPackets(), for simplifying porting layer
  76. *
  77. * 07 26 2010 cp.wu
  78. *
  79. * change TC4 initial value from 2 to 4.
  80. *
  81. * 07 13 2010 cp.wu
  82. *
  83. * 1) MMPDUs are now sent to MT6620 by CMD queue for keeping strict order of 1X/MMPDU/CMD packets
  84. * 2) integrate with qmGetFrameAction() for deciding which MMPDU/1X could pass checking for sending
  85. * 2) enhance CMD_INFO_T descriptor number from 10 to 32 to avoid descriptor underflow under
  86. * concurrent network operation
  87. *
  88. * 07 08 2010 cp.wu
  89. *
  90. * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
  91. *
  92. * 07 06 2010 yarco.yang
  93. * [WPD00003837][MT6620]Data Path Refine
  94. * Add MGMT Packet type for HIF_TX_HEADER
  95. *
  96. * 06 23 2010 cp.wu
  97. * [WPD00003833][MT6620 and MT5931] Driver migration
  98. * integrate .
  99. *
  100. * 06 21 2010 cp.wu
  101. * [WPD00003833][MT6620 and MT5931] Driver migration
  102. * refine TX-DONE callback.
  103. *
  104. * 06 21 2010 cp.wu
  105. * [WPD00003833][MT6620 and MT5931] Driver migration
  106. * TX descriptors are now allocated once for reducing allocation overhead
  107. *
  108. * 06 21 2010 cp.wu
  109. * [WPD00003833][MT6620 and MT5931] Driver migration
  110. * specify correct value for management frames.
  111. *
  112. * 06 11 2010 cp.wu
  113. * [WPD00003833][MT6620 and MT5931] Driver migration
  114. * 1) migrate assoc.c.
  115. * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness
  116. * 3) add configuration options for CNM_MEM and RSN modules
  117. * 4) add data path for management frames
  118. * 5) eliminate rPacketInfo of MSDU_INFO_T
  119. *
  120. * 06 10 2010 cp.wu
  121. * [WPD00003833][MT6620 and MT5931] Driver migration
  122. * 1) add flag on MSDU_INFO_T for indicating BIP frame and forceBasicRate
  123. * 2) add packet type for indicating management frames
  124. *
  125. * 06 09 2010 cp.wu
  126. * [WPD00003833][MT6620 and MT5931] Driver migration
  127. * add necessary changes to driver data paths.
  128. *
  129. * 06 09 2010 cp.wu
  130. * [WPD00003833][MT6620 and MT5931] Driver migration
  131. * add TX_PACKET_MGMT to indicate the frame is coming from management modules
  132. *
  133. * 06 07 2010 cp.wu
  134. * [WPD00003833][MT6620 and MT5931] Driver migration
  135. * merge wlan_def.h.
  136. *
  137. * 06 06 2010 kevin.huang
  138. * [WPD00003832][MT6620 5931] Create driver base
  139. * [MT6620 5931] Create driver base
  140. *
  141. * 03 30 2010 cp.wu
  142. * [WPD00001943]Create WiFi test driver framework on WinXP
  143. * remove driver-land statistics.
  144. *
  145. * 03 24 2010 cp.wu
  146. * [WPD00001943]Create WiFi test driver framework on WinXP
  147. * generate information for OID_GEN_RCV_OK & OID_GEN_XMIT_OK
  148. * * *
  149. *
  150. * 03 10 2010 cp.wu
  151. * [WPD00001943]Create WiFi test driver framework on WinXP
  152. * code clean: removing unused variables and structure definitions
  153. *
  154. * 03 02 2010 tehuang.liu
  155. * [WPD00001943]Create WiFi test driver framework on WinXP
  156. * Redistributed the initial TC resources for normal operation
  157. *
  158. * 03 02 2010 cp.wu
  159. * [WPD00001943]Create WiFi test driver framework on WinXP
  160. * add mutex to avoid multiple access to qmTxQueue simultaneously.
  161. *
  162. * 02 23 2010 cp.wu
  163. * [WPD00001943]Create WiFi test driver framework on WinXP
  164. * add new API: wlanProcessQueuedPackets()
  165. *
  166. * 02 10 2010 cp.wu
  167. * [WPD00001943]Create WiFi test driver framework on WinXP
  168. * 1) remove unused function in nic_rx.c [which has been handled in que_mgt.c]
  169. * * * 2) firmware image length is now retrieved via NdisFileOpen
  170. * * * 3) firmware image is not structured by (P_IMG_SEC_HDR_T) anymore
  171. * * * 4) nicRxWaitResponse() revised
  172. * * * 5) another set of TQ counter default value is added for fw-download state
  173. * * * 6) Wi-Fi load address is now retrieved from registry too
  174. *
  175. * 02 09 2010 cp.wu
  176. * [WPD00001943]Create WiFi test driver framework on WinXP
  177. * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address
  178. * * * * 2. follow MSDN defined behavior when associates to another AP
  179. * * * * 3. for firmware download, packet size could be up to 2048 bytes
  180. *
  181. * 01 27 2010 cp.wu
  182. * [WPD00001943]Create WiFi test driver framework on WinXP
  183. * 1. eliminate improper variable in rHifInfo
  184. * * * * * 2. block TX/ordinary OID when RF test mode is engaged
  185. * * * * * 3. wait until firmware finish operation when entering into and leaving from RF test mode
  186. * * * * * 4. correct some HAL implementation
  187. *
  188. * 01 13 2010 tehuang.liu
  189. * [WPD00001943]Create WiFi test driver framework on WinXP
  190. * Enabled the Burst_End Indication mechanism
  191. *
  192. * 12 30 2009 cp.wu
  193. * [WPD00001943]Create WiFi test driver framework on WinXP
  194. * 1) According to CMD/EVENT documentation v0.8,
  195. * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used,
  196. * * * * * and result is retrieved by get ATInfo instead
  197. * * * * * 2) add 4 counter for recording aggregation statistics
  198. ** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-12-10 16:53:28 GMT mtk02752
  199. ** remove unused API
  200. ** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-11-27 11:08:00 GMT mtk02752
  201. ** add flush for reset
  202. ** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-11-24 19:56:49 GMT mtk02752
  203. ** remove redundant eTC
  204. ** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-11-23 22:01:08 GMT mtk02468
  205. ** Added MSDU_INFO fields for composing HIF TX header
  206. ** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-11-17 22:40:51 GMT mtk01084
  207. ** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-11-17 17:35:05 GMT mtk02752
  208. ** + nicTxMsduInfoList() for sending MsduInfoList
  209. ** + NIC_TX_BUFF_COUNT_TC[0~5]
  210. ** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-11-17 11:07:00 GMT mtk02752
  211. ** add nicTxAdjustTcq() API
  212. ** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-11-16 22:28:30 GMT mtk02752
  213. ** move aucFreeBufferCount/aucMaxNumOfBuffer into another structure
  214. ** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-11-16 21:44:50 GMT mtk02752
  215. ** + nicTxReturnMsduInfo()
  216. ** + nicTxFillMsduInfo()
  217. ** + rFreeMsduInfoList field in TX_CTRL
  218. ** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-11-16 18:00:43 GMT mtk02752
  219. ** use P_PACKET_INFO_T for prPacket to avoid inventing another new structure for packet
  220. ** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-11-16 15:28:49 GMT mtk02752
  221. ** add ucQueuedPacketNum for indicating how many packets are queued by per STA/AC queue
  222. ** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-11-16 10:52:01 GMT mtk02752
  223. ** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-11-14 23:39:24 GMT mtk02752
  224. ** interface structure redefine
  225. ** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-11-13 21:17:03 GMT mtk02752
  226. ** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-10-29 19:53:10 GMT mtk01084
  227. ** remove strange code by Frog
  228. ** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-10-13 21:59:04 GMT mtk01084
  229. ** update for new HW architecture design
  230. ** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-10-02 13:53:03 GMT mtk01725
  231. ** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-28 10:36:50 GMT mtk01461
  232. ** Add declaration of nicTxReleaseResource()
  233. ** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-17 19:58:39 GMT mtk01461
  234. ** Move CMD_INFO_T related define and function to cmd_buf.h
  235. ** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-01 10:53:53 GMT mtk01461
  236. ** Add function for SDIO_TX_ENHANCE
  237. ** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-23 00:33:27 GMT mtk01461
  238. ** Define constants for TX PATH and add nicTxPollingResource
  239. ** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-16 09:09:32 GMT mtk01461
  240. ** Update TX PATH API
  241. ** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:38 GMT mtk01426
  242. ** Init for develop
  243. **
  244. */
  245. #ifndef _NIC_TX_H
  246. #define _NIC_TX_H
  247. /*******************************************************************************
  248. * C O M P I L E R F L A G S
  249. ********************************************************************************
  250. */
  251. /*******************************************************************************
  252. * E X T E R N A L R E F E R E N C E S
  253. ********************************************************************************
  254. */
  255. /*******************************************************************************
  256. * C O N S T A N T S
  257. ********************************************************************************
  258. */
  259. #define NIC_TX_RESOURCE_POLLING_TIMEOUT 256
  260. #define NIC_TX_RESOURCE_POLLING_DELAY_MSEC 50
  261. /* Maximum buffer count for individual HIF TCQ */
  262. #if defined(MT6620)
  263. #if CFG_SLT_SUPPORT
  264. /* 20101215 mtk01725 Redistributed the initial TC resources for SLT operation */
  265. #define NIC_TX_BUFF_COUNT_TC0 0 /* First connection: 0 */
  266. #define NIC_TX_BUFF_COUNT_TC1 16 /* First connection: 32 */
  267. #define NIC_TX_BUFF_COUNT_TC2 0 /* First connection: 0 */
  268. #define NIC_TX_BUFF_COUNT_TC3 0 /* First connection: 0 */
  269. #define NIC_TX_BUFF_COUNT_TC4 4 /* First connection: 2 */
  270. #define NIC_TX_BUFF_COUNT_TC5 0 /* First connection: 0 */
  271. #else
  272. /* 20100302 mtk02468 Redistributed the initial TC resources for normal operation */
  273. #define NIC_TX_BUFF_COUNT_TC0 6 /* First connection: 0 */
  274. #define NIC_TX_BUFF_COUNT_TC1 8 /* First connection: 32 */
  275. #define NIC_TX_BUFF_COUNT_TC2 8 /* First connection: 0 */
  276. #define NIC_TX_BUFF_COUNT_TC3 8 /* First connection: 0 */
  277. #define NIC_TX_BUFF_COUNT_TC4 4 /* First connection: 2 */
  278. #define NIC_TX_BUFF_COUNT_TC5 2 /* First connection: 0 */
  279. #endif
  280. #elif defined(MT6628)
  281. #if (CFG_SRAM_SIZE_OPTION == 0)
  282. #define NIC_TX_BUFF_COUNT_TC0 1 /* First connection: 0 */
  283. #define NIC_TX_BUFF_COUNT_TC1 20 /* First connection: 32 */
  284. #define NIC_TX_BUFF_COUNT_TC2 1 /* First connection: 0 */
  285. #define NIC_TX_BUFF_COUNT_TC3 1 /* First connection: 0 */
  286. #define NIC_TX_BUFF_COUNT_TC4 4 /* First connection: 2 */
  287. #define NIC_TX_BUFF_COUNT_TC5 1 /* First connection: 0 */
  288. #elif (CFG_SRAM_SIZE_OPTION == 1)
  289. #define NIC_TX_BUFF_COUNT_TC0 1 /* First connection: 0 */
  290. #define NIC_TX_BUFF_COUNT_TC1 36 /* First connection: 32 */
  291. #define NIC_TX_BUFF_COUNT_TC2 1 /* First connection: 0 */
  292. #define NIC_TX_BUFF_COUNT_TC3 1 /* First connection: 0 */
  293. #define NIC_TX_BUFF_COUNT_TC4 4 /* First connection: 2 */
  294. #define NIC_TX_BUFF_COUNT_TC5 1 /* First connection: 0 */
  295. #elif (CFG_SRAM_SIZE_OPTION == 2)
  296. #define NIC_TX_BUFF_COUNT_TC0 1 /* First connection: 0 */
  297. #define NIC_TX_BUFF_COUNT_TC1 20 /* First connection: 32 */
  298. #define NIC_TX_BUFF_COUNT_TC2 1 /* First connection: 0 */
  299. #define NIC_TX_BUFF_COUNT_TC3 1 /* First connection: 0 */
  300. #define NIC_TX_BUFF_COUNT_TC4 4 /* First connection: 2 */
  301. #define NIC_TX_BUFF_COUNT_TC5 1 /* First connection: 0 */
  302. #else
  303. #error "> Set TX_BUFF_COUNT_TC error!"
  304. #endif
  305. #endif
  306. #define NIC_TX_BUFF_SUM (NIC_TX_BUFF_COUNT_TC0 + \
  307. NIC_TX_BUFF_COUNT_TC1 + \
  308. NIC_TX_BUFF_COUNT_TC2 + \
  309. NIC_TX_BUFF_COUNT_TC3 + \
  310. NIC_TX_BUFF_COUNT_TC4 + \
  311. NIC_TX_BUFF_COUNT_TC5)
  312. #if CFG_ENABLE_FW_DOWNLOAD
  313. #define NIC_TX_INIT_BUFF_COUNT_TC0 8
  314. #define NIC_TX_INIT_BUFF_COUNT_TC1 0
  315. #define NIC_TX_INIT_BUFF_COUNT_TC2 0
  316. #define NIC_TX_INIT_BUFF_COUNT_TC3 0
  317. #define NIC_TX_INIT_BUFF_COUNT_TC4 0
  318. #define NIC_TX_INIT_BUFF_COUNT_TC5 0
  319. #define NIC_TX_INIT_BUFF_SUM (NIC_TX_INIT_BUFF_COUNT_TC0 + \
  320. NIC_TX_INIT_BUFF_COUNT_TC1 + \
  321. NIC_TX_INIT_BUFF_COUNT_TC2 + \
  322. NIC_TX_INIT_BUFF_COUNT_TC3 + \
  323. NIC_TX_INIT_BUFF_COUNT_TC4 + \
  324. NIC_TX_INIT_BUFF_COUNT_TC5)
  325. #endif
  326. #if CFG_ENABLE_PKT_LIFETIME_PROFILE
  327. #define NIC_TX_TIME_THRESHOLD 100 /* in unit of ms */
  328. #endif
  329. /*******************************************************************************
  330. * D A T A T Y P E S
  331. ********************************************************************************
  332. */
  333. /* 3 Session for TX QUEUES */
  334. /* The definition in this ENUM is used to categorize packet's Traffic Class according
  335. * to the their TID(User Priority).
  336. * In order to achieve QoS goal, a particular TC should not block the process of
  337. * another packet with different TC.
  338. * In current design we will have 5 categories(TCs) of SW resource.
  339. */
  340. typedef enum _ENUM_TRAFFIC_CLASS_INDEX_T {
  341. TC0_INDEX = 0, /* HIF TX0: AC0 packets */
  342. TC1_INDEX, /* HIF TX0: AC1 packets & non-QoS packets */
  343. TC2_INDEX, /* HIF TX0: AC2 packets */
  344. TC3_INDEX, /* HIF TX0: AC3 packets */
  345. TC4_INDEX, /* HIF TX1: Command packets or 802.1x packets */
  346. TC5_INDEX, /* HIF TX0: BMCAST packets */
  347. TC_NUM /* Maximum number of Traffic Classes. */
  348. } ENUM_TRAFFIC_CLASS_INDEX_T;
  349. typedef enum _ENUM_TX_STATISTIC_COUNTER_T {
  350. TX_MPDU_TOTAL_COUNT = 0,
  351. TX_INACTIVE_BSS_DROP,
  352. TX_INACTIVE_STA_DROP,
  353. TX_FORWARD_OVERFLOW_DROP,
  354. TX_AP_BORADCAST_DROP,
  355. TX_STATISTIC_COUNTER_NUM
  356. } ENUM_TX_STATISTIC_COUNTER_T;
  357. typedef struct _TX_TCQ_STATUS_T {
  358. UINT_8 aucFreeBufferCount[TC_NUM];
  359. UINT_8 aucMaxNumOfBuffer[TC_NUM];
  360. } TX_TCQ_STATUS_T, *P_TX_TCQ_STATUS_T;
  361. typedef struct _TX_TCQ_ADJUST_T {
  362. INT_8 acVariation[TC_NUM];
  363. } TX_TCQ_ADJUST_T, *P_TX_TCQ_ADJUST_T;
  364. typedef struct _TX_CTRL_T {
  365. UINT_32 u4TxCachedSize;
  366. PUINT_8 pucTxCached;
  367. /* Elements below is classified according to TC (Traffic Class) value. */
  368. TX_TCQ_STATUS_T rTc;
  369. PUINT_8 pucTxCoalescingBufPtr;
  370. QUE_T rFreeMsduInfoList;
  371. /* Management Frame Tracking */
  372. /* number of management frames to be sent */
  373. INT_32 i4TxMgmtPendingNum;
  374. /* to tracking management frames need TX done callback */
  375. QUE_T rTxMgmtTxingQueue;
  376. #if CFG_HIF_STATISTICS
  377. UINT_32 u4TotalTxAccessNum;
  378. UINT_32 u4TotalTxPacketNum;
  379. #endif
  380. UINT_32 au4Statistics[TX_STATISTIC_COUNTER_NUM];
  381. /* Number to track forwarding frames */
  382. INT_32 i4PendingFwdFrameCount;
  383. } TX_CTRL_T, *P_TX_CTRL_T;
  384. typedef enum _ENUM_TX_PACKET_SRC_T {
  385. TX_PACKET_OS,
  386. TX_PACKET_OS_OID,
  387. TX_PACKET_FORWARDING,
  388. TX_PACKET_MGMT,
  389. TX_PACKET_NUM
  390. } ENUM_TX_PACKET_SRC_T;
  391. typedef enum _ENUM_HIF_TX_PACKET_TYPE_T {
  392. HIF_TX_PACKET_TYPE_DATA = 0,
  393. HIF_TX_PACKET_TYPE_COMMAND,
  394. HIF_TX_PACKET_TYPE_HIF_LB,
  395. HIF_TX_PACKET_TYPE_MGMT
  396. } ENUM_HIF_TX_PACKET_TYPE_T, *P_ENUM_HIF_TX_PACKET_TYPE_T;
  397. typedef enum _ENUM_TX_RESULT_CODE_T {
  398. TX_RESULT_SUCCESS = 0,
  399. TX_RESULT_LIFE_TIMEOUT,
  400. TX_RESULT_RTS_ERROR,
  401. TX_RESULT_MPDU_ERROR,
  402. TX_RESULT_AGING_TIMEOUT,
  403. TX_RESULT_FLUSHED,
  404. TX_RESULT_DROPPED_IN_DRIVER = 32,
  405. TX_RESULT_NUM
  406. } ENUM_TX_RESULT_CODE_T, *P_ENUM_TX_RESULT_CODE_T;
  407. struct _WLAN_CFG_ENTRY_T {
  408. UINT_8 aucKey[WLAN_CFG_KEY_LEN_MAX];
  409. UINT_8 aucValue[WLAN_CFG_VALUE_LEN_MAX];
  410. WLAN_CFG_SET_CB pfSetCb;
  411. PVOID pPrivate;
  412. UINT_32 u4Flags;
  413. };
  414. struct _WLAN_CFG_T {
  415. UINT_32 u4WlanCfgEntryNumMax;
  416. UINT_32 u4WlanCfgKeyLenMax;
  417. UINT_32 u4WlanCfgValueLenMax;
  418. WLAN_CFG_ENTRY_T arWlanCfgBuf[WLAN_CFG_ENTRY_NUM_MAX];
  419. };
  420. /* TX Call Back Function */
  421. typedef WLAN_STATUS(*PFN_TX_DONE_HANDLER) (IN P_ADAPTER_T prAdapter,
  422. IN P_MSDU_INFO_T prMsduInfo, IN ENUM_TX_RESULT_CODE_T rTxDoneStatus);
  423. #if CFG_ENABLE_PKT_LIFETIME_PROFILE
  424. typedef struct _PKT_PROFILE_T {
  425. BOOLEAN fgIsValid;
  426. #if CFG_PRINT_RTP_PROFILE
  427. BOOLEAN fgIsPrinted;
  428. UINT_16 u2IpSn;
  429. UINT_16 u2RtpSn;
  430. UINT_8 ucTcxFreeCount;
  431. #endif
  432. OS_SYSTIME rHardXmitArrivalTimestamp;
  433. OS_SYSTIME rEnqueueTimestamp;
  434. OS_SYSTIME rDequeueTimestamp;
  435. OS_SYSTIME rHifTxDoneTimestamp;
  436. } PKT_PROFILE_T, *P_PKT_PROFILE_T;
  437. #endif
  438. /* TX transactions could be divided into 4 kinds:
  439. *
  440. * 1) 802.1X / Bluetooth-over-Wi-Fi Security Frames
  441. * [CMD_INFO_T] - [prPacket] - in skb or NDIS_PACKET form
  442. *
  443. * 2) MMPDU
  444. * [CMD_INFO_T] - [prPacket] - [MSDU_INFO_T] - [prPacket] - direct buffer for frame body
  445. *
  446. * 3) Command Packets
  447. * [CMD_INFO_T] - [pucInfoBuffer] - direct buffer for content of command packet
  448. *
  449. * 4) Normal data frame
  450. * [MSDU_INFO_T] - [prPacket] - in skb or NDIS_PACKET form
  451. */
  452. /* PS_FORWARDING_TYPE_NON_PS means that the receiving STA is in Active Mode
  453. * from the perspective of host driver (maybe not synchronized with FW --> SN is needed)
  454. */
  455. struct _MSDU_INFO_T {
  456. QUE_ENTRY_T rQueEntry;
  457. P_NATIVE_PACKET prPacket;
  458. ENUM_TX_PACKET_SRC_T eSrc; /* specify OS/FORWARD packet */
  459. UINT_8 ucUserPriority;
  460. /* For composing HIF TX header */
  461. UINT_8 ucTC; /* Traffic Class: 0~4 (HIF TX0), 5 (HIF TX1) */
  462. UINT_8 ucPacketType; /* 0: Data, 1: Command, 2: HIF Loopback 3: Management Frame */
  463. UINT_8 ucStaRecIndex;
  464. UINT_8 ucNetworkType; /* See ENUM_NETWORK_TYPE_T */
  465. UINT_8 ucFormatID; /* 0: MAUI, Linux, Windows NDIS 5.1 */
  466. BOOLEAN fgIs802_1x; /* TRUE: 802.1x frame */
  467. BOOLEAN fgIs802_11; /* TRUE: 802.11 header is present */
  468. UINT_16 u2PalLLH; /* PAL Logical Link Header (for BOW network) */
  469. UINT_16 u2AclSN; /* ACL Sequence Number (for BOW network) */
  470. UINT_8 ucPsForwardingType; /* See ENUM_PS_FORWARDING_TYPE_T */
  471. UINT_8 ucPsSessionID; /* PS Session ID specified by the FW for the STA */
  472. BOOLEAN fgIsBurstEnd; /* TRUE means this is the last packet of the burst for (STA, TID) */
  473. BOOLEAN fgIsBIP; /* Management Frame Protection */
  474. BOOLEAN fgIsBasicRate; /* Force Basic Rate Transmission */
  475. /* flattened from PACKET_INFO_T */
  476. UINT_8 ucMacHeaderLength;
  477. UINT_8 ucLlcLength; /* w/o EtherType */
  478. UINT_16 u2FrameLength;
  479. UINT_8 aucEthDestAddr[MAC_ADDR_LEN]; /* Ethernet Destination Address */
  480. /* for TX done tracking */
  481. UINT_8 ucTxSeqNum;
  482. PFN_TX_DONE_HANDLER pfTxDoneHandler;
  483. BOOLEAN fgNeedTxDoneStatus;
  484. #if CFG_ENABLE_PKT_LIFETIME_PROFILE
  485. PKT_PROFILE_T rPktProfile;
  486. #endif
  487. COMMAND_TYPE eCmdType;
  488. UINT_8 ucCID;
  489. UINT_32 u4InqueTime;
  490. };
  491. /*******************************************************************************
  492. * P U B L I C D A T A
  493. ********************************************************************************
  494. */
  495. /*******************************************************************************
  496. * P R I V A T E D A T A
  497. ********************************************************************************
  498. */
  499. /*******************************************************************************
  500. * M A C R O S
  501. ********************************************************************************
  502. */
  503. #define TX_INC_CNT(prTxCtrl, eCounter) \
  504. {((P_TX_CTRL_T)prTxCtrl)->au4Statistics[eCounter]++; }
  505. #define TX_ADD_CNT(prTxCtrl, eCounter, u8Amount) \
  506. {((P_TX_CTRL_T)prTxCtrl)->au4Statistics[eCounter] += (UINT_32)u8Amount; }
  507. #define TX_GET_CNT(prTxCtrl, eCounter) \
  508. (((P_TX_CTRL_T)prTxCtrl)->au4Statistics[eCounter])
  509. #define TX_RESET_ALL_CNTS(prTxCtrl) \
  510. {kalMemZero(&prTxCtrl->au4Statistics[0], sizeof(prTxCtrl->au4Statistics)); }
  511. #if CFG_ENABLE_PKT_LIFETIME_PROFILE
  512. #define PRINT_PKT_PROFILE(_pkt_profile, _note) \
  513. { \
  514. if (!(_pkt_profile)->fgIsPrinted) { \
  515. DBGLOG(TX, TRACE, "X[%u] E[%u] D[%u] HD[%u] B[%d] RTP[%d] %s\n", \
  516. (UINT_32)((_pkt_profile)->rHardXmitArrivalTimestamp), \
  517. (UINT_32)((_pkt_profile)->rEnqueueTimestamp), \
  518. (UINT_32)((_pkt_profile)->rDequeueTimestamp), \
  519. (UINT_32)((_pkt_profile)->rHifTxDoneTimestamp), \
  520. (UINT_8)((_pkt_profile)->ucTcxFreeCount), \
  521. (UINT_16)((_pkt_profile)->u2RtpSn), \
  522. (_note)); \
  523. (_pkt_profile)->fgIsPrinted = TRUE; \
  524. } \
  525. }
  526. #define CHK_PROFILES_DELTA(_pkt1, _pkt2, _delta) \
  527. (CHECK_FOR_TIMEOUT((_pkt1)->rHardXmitArrivalTimestamp, (_pkt2)->rHardXmitArrivalTimestamp, (_delta)) || \
  528. CHECK_FOR_TIMEOUT((_pkt1)->rEnqueueTimestamp, (_pkt2)->rEnqueueTimestamp, (_delta)) || \
  529. CHECK_FOR_TIMEOUT((_pkt1)->rDequeueTimestamp, (_pkt2)->rDequeueTimestamp, (_delta)) || \
  530. CHECK_FOR_TIMEOUT((_pkt1)->rHifTxDoneTimestamp, (_pkt2)->rHifTxDoneTimestamp, (_delta)))
  531. #define CHK_PROFILE_DELTA(_pkt, _delta) \
  532. (CHECK_FOR_TIMEOUT((_pkt)->rEnqueueTimestamp, (_pkt)->rHardXmitArrivalTimestamp, (_delta)) || \
  533. CHECK_FOR_TIMEOUT((_pkt)->rDequeueTimestamp, (_pkt)->rEnqueueTimestamp, (_delta)) || \
  534. CHECK_FOR_TIMEOUT((_pkt)->rHifTxDoneTimestamp, (_pkt)->rDequeueTimestamp, (_delta)))
  535. #endif
  536. /*******************************************************************************
  537. * F U N C T I O N D E C L A R A T I O N S
  538. ********************************************************************************
  539. */
  540. VOID nicTxInitialize(IN P_ADAPTER_T prAdapter);
  541. WLAN_STATUS nicTxAcquireResource(IN P_ADAPTER_T prAdapter, IN UINT_8 ucTC, IN BOOLEAN pfgIsSecOrMgmt);
  542. WLAN_STATUS nicTxPollingResource(IN P_ADAPTER_T prAdapter, IN UINT_8 ucTC);
  543. BOOLEAN nicTxReleaseResource(IN P_ADAPTER_T prAdapter, IN UINT_8 *aucTxRlsCnt);
  544. WLAN_STATUS nicTxResetResource(IN P_ADAPTER_T prAdapter);
  545. UINT_8 nicTxGetResource(IN P_ADAPTER_T prAdapter, IN UINT_8 ucTC);
  546. WLAN_STATUS nicTxMsduInfoList(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfoListHead);
  547. WLAN_STATUS nicTxMsduQueue(IN P_ADAPTER_T prAdapter, UINT_8 ucPortIdx, P_QUE_T prQue);
  548. WLAN_STATUS nicTxCmd(IN P_ADAPTER_T prAdapter, IN P_CMD_INFO_T prCmdInfo, IN UINT_8 ucTC);
  549. VOID nicTxRelease(IN P_ADAPTER_T prAdapter);
  550. VOID nicProcessTxInterrupt(IN P_ADAPTER_T prAdapter);
  551. VOID nicTxFreeMsduInfoPacket(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfoListHead);
  552. VOID nicTxReturnMsduInfo(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfoListHead);
  553. BOOLEAN nicTxFillMsduInfo(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo, IN P_NATIVE_PACKET prNdisPacket);
  554. WLAN_STATUS nicTxAdjustTcq(IN P_ADAPTER_T prAdapter);
  555. WLAN_STATUS nicTxFlush(IN P_ADAPTER_T prAdapter);
  556. #if CFG_ENABLE_FW_DOWNLOAD
  557. WLAN_STATUS nicTxInitCmd(IN P_ADAPTER_T prAdapter, IN P_CMD_INFO_T prCmdInfo, IN UINT_8 ucTC);
  558. WLAN_STATUS nicTxInitResetResource(IN P_ADAPTER_T prAdapter);
  559. #endif
  560. WLAN_STATUS nicTxEnqueueMsdu(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo);
  561. UINT_32 nicTxGetFreeCmdCount(IN P_ADAPTER_T prAdapter);
  562. /*******************************************************************************
  563. * F U N C T I O N S
  564. ********************************************************************************
  565. */
  566. #endif /* _NIC_TX_H */