• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * txDataQueue.h
3  *
4  * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  *  * Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *  * Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *  * Neither the name Texas Instruments nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 
35 /***************************************************************************/
36 /*																		   */
37 /*	  MODULE:	TxDataQueue.h										       */
38 /*    PURPOSE:	Tx Data Queue module Header file						   */
39 /*																		   */
40 /***************************************************************************/
41 #ifndef _TX_DATA_QUEUE_H_
42 #define _TX_DATA_QUEUE_H_
43 
44 
45 #include "TWDriver.h"
46 #include "DataCtrl_Api.h"
47 
48 
49 #define TX_SEND_PACE_TIMEOUT_MSEC   1
50 
51 /* Max number of packets in each queue */
52 #define DATA_QUEUE_DEPTH_BE  60
53 #define DATA_QUEUE_DEPTH_BK  10
54 #define DATA_QUEUE_DEPTH_VI  32
55 #define DATA_QUEUE_DEPTH_VO  10
56 #define DATA_QUEUE_DEPTH_TOTAL  (DATA_QUEUE_DEPTH_BE + DATA_QUEUE_DEPTH_BK + DATA_QUEUE_DEPTH_VI + DATA_QUEUE_DEPTH_VO)
57 
58 /* Verify that there are enough TxCtrlBlks for all users that are queueing packets (driver + FW) */
59 #if ((DATA_QUEUE_DEPTH_TOTAL + (MGMT_QUEUES_DEPTH * 2) + NUM_TX_DESCRIPTORS) > (CTRL_BLK_ENTRIES_NUM - 2))
60     #error  Not enough TxCtrlBlks for all users !!
61 #endif
62 
63 /* Tx packets handling statistics */
64 typedef struct
65 {
66 	TI_UINT32 uEnqueuePacket;
67 	TI_UINT32 uDequeuePacket;
68 	TI_UINT32 uRequeuePacket;
69 	TI_UINT32 uXmittedPacket;
70 	TI_UINT32 uDroppedPacket;
71 } TTxDataQueueDebugCnt;
72 
73 /* The module's object */
74 typedef struct
75 {
76 	TI_HANDLE            hContext;
77 	TI_HANDLE            hTxCtrl;
78 	TI_HANDLE            hOs;
79 	TI_HANDLE            hReport;
80 	TI_HANDLE            hTxMgmtQ;
81 	TI_HANDLE            hTWD;
82 
83 	TClsfrParams		 tClsfrParams;  /* The classifier sub-module parameters */
84 
85 	TI_BOOL              bDataPortEnable; /* Data port open or not */
86     TI_UINT32            uContextId;  /* ID allocated to this module on registration to context module */
87     TI_HANDLE            hTxSendPaceTimer; /* If queued packets number doesn't reach threshold within timeout, Tx handling is started */
88 
89 	/* Tx aQueues */
90 	TI_UINT32            uNumQueues; /* Indicates the number of allocated aQueues */
91 	TI_UINT32            aQueueMaxSize[MAX_NUM_OF_AC]; /* indicates the max size of each Data queue */
92 	TI_UINT32            aTxSendPaceThresh[MAX_NUM_OF_AC]; /* Number of packets to queue before scheduling Tx handling */
93 	TI_HANDLE            aQueues[MAX_NUM_OF_AC];  /* The Tx aQueues handles */
94     TI_BOOL	             aQueueBusy[MAX_NUM_OF_AC]; /* per queue busy indication */
95 	TI_UINT32            uLastQueId; /* the last queue processed by the scheduler */
96 	TI_BOOL				 aNetStackQueueStopped[MAX_NUM_OF_AC];/*indicate if the current queue was full and caused Tx network stack stop*/
97 	TI_BOOL				 bStopNetStackTx;/*Flag to enable/disable Tx stop*/
98 
99 	/* Counters */
100 	TTxDataQueueDebugCnt aQueueCounters[MAX_NUM_OF_AC]; /* Save Tx statistics per Tx-queue. */
101 	TI_UINT32			 uClsfrMismatchCount;
102 	TI_UINT32			 uTxSendPaceTimeoutsCount;
103 
104 } TTxDataQ;
105 
106 
107 /* TIDs Mapping to Queues */
108 static const TI_UINT32 aTidToQueueTable[MAX_NUM_OF_802_1d_TAGS] = {0, 1, 1, 0, 2, 2, 3, 3};
109 
110 
111 #endif /* _TX_DATA_QUEUE_H_ */
112