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