• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * txCtrl.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:   txCtrl.h                                                   */
38 /*    PURPOSE:  txCtrl module Header file                                  */
39 /*                                                                         */
40 /***************************************************************************/
41 #ifndef _TX_CTRL_H_
42 #define _TX_CTRL_H_
43 
44 
45 #include "paramOut.h"
46 #include "DataCtrl_Api.h"
47 
48 
49 extern void wlanDrvIf_FreeTxPacket (TI_HANDLE hOs, TTxCtrlBlk *pPktCtrlBlk, TI_STATUS eStatus);
50 
51 
52 #define DEF_TX_PORT_STATUS              CLOSE
53 #define DEF_CURRENT_PRIVACY_MODE        TI_FALSE
54 #define DEF_EAPOL_ENCRYPTION_STATUS     TI_FALSE
55 #define HEADER_PAD_SIZE                 2       /* 2-byte pad before header with QoS, for 4-byte alignment */
56 #define MGMT_PKT_LIFETIME_TU            2000    /* Mgmt pkts lifetime in TUs (1024 usec). */
57 
58 /* defined in qosMngr.c - standard WMM translation from TID to AC. */
59 extern int WMEQosTagToACTable[MAX_NUM_OF_802_1d_TAGS];
60 extern const TI_UINT8 WMEQosAcToTid[MAX_NUM_OF_AC];
61 
62 /* The TX delay histogram ranges start and end in uSec. */
63 static const TI_UINT32 txDelayRangeStart[TX_DELAY_RANGES_NUM] = {    0,  1000, 10000, 20000, 40000, 60000,  80000, 100000, 200000 };
64 static const TI_UINT32 txDelayRangeEnd  [TX_DELAY_RANGES_NUM] = { 1000, 10000, 20000, 40000, 60000, 80000, 100000, 200000, 0xFFFFFFFF };
65 
66 /* BE is ordered here above BK for priority sensitive functions (BE is 0 but has higher priority than BK). */
67 static const EAcTrfcType priorityOrderedAc[] = {QOS_AC_BK, QOS_AC_BE, QOS_AC_VI, QOS_AC_VO};
68 
69 typedef struct
70 {
71     TI_UINT32  dbgNumPktsSent[MAX_NUM_OF_AC];       /* Pkts sent by data-queue or mgmt-queue. */
72     TI_UINT32  dbgNumPktsBackpressure[MAX_NUM_OF_AC];/* Pkts for which backpressure was set by HW-Q */
73     TI_UINT32  dbgNumPktsBusy[MAX_NUM_OF_AC];      /* Pkts for which busy was received from HW-Q */
74     TI_UINT32  dbgNumPktsXfered[MAX_NUM_OF_AC];    /* Pkts sent to Xfer */
75     TI_UINT32  dbgNumPktsSuccess[MAX_NUM_OF_AC];   /* Pkts for which success was received from Xfer */
76     TI_UINT32  dbgNumPktsPending[MAX_NUM_OF_AC];   /* Pkts for which pending was received from Xfer */
77     TI_UINT32  dbgNumPktsError[MAX_NUM_OF_AC];     /* Pkts for which error was received from Xfer */
78     TI_UINT32  dbgNumTxCmplt[MAX_NUM_OF_AC];        /* Pkts that reached complete CB */
79     TI_UINT32  dbgNumTxCmpltOk[MAX_NUM_OF_AC];     /* Pkts that reached complete CB with status TI_OK */
80     TI_UINT32  dbgNumTxCmpltError[MAX_NUM_OF_AC];  /* Pkts that reached complete CB with status TI_NOK */
81     TI_UINT32  dbgNumTxCmpltOkBytes[MAX_NUM_OF_AC];/* Acknowledged bytes (complete status TI_OK) */
82     TI_UINT32  dbgNumXferCmplt;                    /* Number of Xfer-Complete events (after pending). */
83 } txDataDbgCounters_t;
84 
85 
86 
87 /*
88  *  Module object structure.
89  */
90 typedef struct
91 {
92     /* Handles */
93     TI_HANDLE           hOs;
94     TI_HANDLE           hReport;
95     TI_HANDLE           hCtrlData;
96     TI_HANDLE           hTWD;
97     TI_HANDLE           hTxDataQ;
98     TI_HANDLE           hTxMgmtQ;
99     TI_HANDLE           hEvHandler;
100     TI_HANDLE           TxEventDistributor;
101     TI_HANDLE           hHealthMonitor;
102     TI_HANDLE           hTimer;
103     TI_HANDLE           hStaCap;
104     TI_HANDLE           hXCCMngr;
105     TI_HANDLE           hQosMngr;
106     TI_HANDLE           hRxData;
107 
108     TI_HANDLE           hCreditTimer;   /* The medium-usage credit timer handle */
109 
110     /* External parameters */
111     EHeaderConvertMode  headerConverMode;  /* QoS header needed for data or not. */
112     TI_BOOL             currentPrivacyInvokedMode;
113     TI_BOOL             eapolEncryptionStatus;
114     TI_UINT8            encryptionFieldSize;  /* size to reserve in WLAN header for encryption */
115     ScanBssType_e       currBssType;
116     TMacAddr            currBssId;
117     TI_UINT16           aMsduLifeTimeTu[MAX_NUM_OF_AC];
118     AckPolicy_e         ackPolicy[MAX_NUM_OF_AC];
119     TtxCtrlHtControl    tTxCtrlHtControl;
120 	TI_UINT16           genericEthertype;
121 
122     /* ACs admission and busy mapping */
123     TI_UINT32           busyAcBitmap;   /* Current bitmap of busy ACs (in HW-Q backpressure format). */
124     TI_UINT32           busyTidBitmap;  /* Current bitmap of busy TIDs reflected from admitted ACs. */
125     TI_UINT32           admittedAcToTidMap[MAX_NUM_OF_AC]; /* From HW-AC to bitmap of TIDs that currently use it. */
126     EAcTrfcType         highestAdmittedAc[MAX_NUM_OF_AC]; /* Provide highest admitted AC equal or below given AC. */
127     ETrafficAdmState    admissionState[MAX_NUM_OF_AC];    /* AC is allowed to transmit or not. */
128     EAdmissionState     admissionRequired[MAX_NUM_OF_AC]; /* AC requires AP's admission or not. */
129 
130     /* Tx Attributes */
131     TI_UINT32           mgmtRatePolicy[MAX_NUM_OF_AC];  /* Current rate policy for mgmt packets per AC. */
132     TI_UINT32           dataRatePolicy[MAX_NUM_OF_AC];  /* Current rate policy for data packets per AC. */
133     TI_UINT16           txSessionCount;     /* Current Tx-Session index as configured to FW in last Join command. */
134     TI_UINT16           dataPktDescAttrib;  /* A prototype of Tx-desc attrib bitmap for data pkts. */
135     TI_UINT8            dbgPktSeqNum;       /* Increment every tx-pkt, insert in descriptor for debug. */
136 
137     /* Counters */
138     TTxDataCounters     txDataCounters[MAX_NUM_OF_AC]; /* Save Tx statistics per Tx-queue. */
139     TI_UINT32           SumTotalDelayUs[MAX_NUM_OF_AC]; /* Store pkt delay sum in Usecs to avoid divide per
140                                                             pkt, and covert to msec on user request. */
141     TI_UINT32           currentConsecutiveRetryFail; /* current consecutive number of tx failures due to max retry */
142     ERate               eCurrentTxRate;                 /* Save last data Tx rate for applications' query */
143 
144     /* credit calculation parameters */
145 	TI_BOOL				bCreditCalcTimerEnabled;        /* credit timer is enabled from registry */
146 	TI_BOOL				bCreditCalcTimerRunning;        /* credit calculation timer is running */
147     TI_UINT32           creditCalculationTimeout;
148     TI_INT32            lowMediumUsageThreshold[MAX_NUM_OF_AC];
149     TI_INT32            highMediumUsageThreshold[MAX_NUM_OF_AC];
150     TI_UINT32           lastCreditCalcTimeStamp[MAX_NUM_OF_AC];
151     TI_BOOL             useAdmissionAlgo[MAX_NUM_OF_AC];
152     TI_INT32            credit[MAX_NUM_OF_AC];
153     TI_UINT32           mediumTime[MAX_NUM_OF_AC];
154     TI_UINT32           totalUsedTime[MAX_NUM_OF_AC];
155 
156 #ifdef TI_DBG
157     txDataDbgCounters_t dbgCounters;    /* debug counters */
158 #endif
159 
160 } txCtrl_t;
161 
162 
163 
164 #endif  /* _TX_CTRL_H_ */
165