1/*
2 * tiQosTypes.h
3 *
4 * Copyright(c) 1998 - 2010 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/* Module:      tiQosTypes.h*/
37/**/
38/* Purpose:     */
39/**/
40/*--------------------------------------------------------------------------*/
41
42#ifndef TI_QOS_TYPES_H
43#define TI_QOS_TYPES_H
44
45
46#define MAX_NUM_OF_802_1d_TAGS          8
47
48/*
49 * This enum defines the protocol modes of the QOS management object
50 */
51typedef enum
52{
53    QOS_WME,
54    QOS_NONE
55
56} EQosProtocol;
57
58
59/*
60 * This enum includes the header converting modes configured to dataCtrl object.
61 */
62typedef enum
63{
64    HDR_CONVERT_NONE,
65    HDR_CONVERT_QOS,
66    HDR_CONVERT_LEGACY
67
68} EHeaderConvertMode;
69
70
71typedef enum
72{
73    QOS_AC_BE = 0,
74    QOS_AC_BK,
75    QOS_AC_VI,
76    QOS_AC_VO,
77    QOS_HIGHEST_AC_INDEX = QOS_AC_VO
78
79} EAcTrfcType;
80
81
82#define FIRST_AC_INDEX                  QOS_AC_BE
83#define AC_PARAMS_MAX_TSID              15
84#define MAX_APSD_CONF                   0xffff
85
86
87typedef enum
88{
89    DROP_NEW_PACKET = 0,
90    DROP_OLD_PACKET
91
92} EQOverflowPolicy;
93
94
95typedef enum
96{
97    AC_NOT_ADMITTED,
98    AC_WAIT_ADMISSION,
99    AC_ADMITTED
100
101} ETrafficAdmState;
102
103
104/*
105 * This enum defines the admission state configured to dataCtrl object.
106 */
107typedef enum
108{
109    ADMISSION_NOT_REQUIRED,
110    ADMISSION_REQUIRED
111
112} EAdmissionState;
113
114
115typedef struct
116{
117    /* Power save mode */
118    TI_UINT8                PsMode;
119    TI_UINT16               TxQueueSize;
120    TI_UINT8                QueueIndex;
121    EQOverflowPolicy        QueueOvFlowPolicy;
122    TI_UINT8                ackPolicy;
123    TI_UINT32               MsduLifeTime;
124
125} TAcTrfcCtrl;
126
127typedef struct
128{
129    /* header converting mode */
130    EHeaderConvertMode      headerConverMode;
131    /* flag for converting zero tags */
132    TI_BOOL                 convertTagZeroFrames;
133    /* AC admission state */
134    ETrafficAdmState        admissionState;
135    /* AC admission is mandatory */
136    EAdmissionState         admissionRequired;
137    /* Tag to AC classification */
138    EAcTrfcType             tag_ToAcClsfrTable[MAX_NUM_OF_802_1d_TAGS];
139
140} TQosParams;
141
142
143typedef struct
144{
145    TAcTrfcCtrl             acTrfcCtrl;
146    TQosParams              qosParams;
147    TI_UINT8                *tsrsArr;
148    TI_UINT8                tsrsArrLen;
149    TI_UINT8                acID;
150
151} TTxDataQosParams;
152
153
154typedef struct _OS_802_11_QOS_PARAMS
155{
156    TI_UINT32               acID;
157    TI_UINT32               MaxLifeTime;
158    TI_UINT32               PSDeliveryProtocol;
159	TI_UINT32				VoiceDeliveryProtocol;
160
161} OS_802_11_QOS_PARAMS;
162
163
164typedef struct
165{
166    TI_UINT32               psPoll;
167    TI_UINT32               UPSD;
168
169} OS_802_11_QOS_RX_TIMEOUT_PARAMS;
170
171
172typedef struct _OS_802_11_AC_QOS_PARAMS
173{
174    TI_UINT32               uAC;
175    TI_UINT32               uAssocAdmissionCtrlFlag;
176    TI_UINT32               uAIFS;
177    TI_UINT32               uCwMin;
178    TI_UINT32               uCwMax;
179    TI_UINT32               uTXOPLimit;
180
181} OS_802_11_AC_QOS_PARAMS;
182
183
184typedef struct _OS_802_11_AP_QOS_CAPABILITIES_PARAMS
185{
186    TI_UINT32               uQOSFlag;
187    TI_UINT32               uAPSDFlag;
188
189} OS_802_11_AP_QOS_CAPABILITIES_PARAMS;
190
191
192typedef struct _OS_802_11_QOS_TSPEC_PARAMS
193{
194    TI_UINT32               uUserPriority;
195    TI_UINT32               uNominalMSDUsize; /* in bytes */
196    TI_UINT32               uMeanDataRate;        /* bits per second */
197    TI_UINT32               uMinimumPHYRate;  /* 1,2,5,6,9,11,12,18,......*/
198    TI_UINT32               uSurplusBandwidthAllowance;
199    TI_UINT32               uAPSDFlag;
200    TI_UINT32               uMediumTime;
201    TI_UINT32               uReasonCode;
202    TI_UINT32               uMinimumServiceInterval;
203    TI_UINT32               uMaximumServiceInterval;
204
205} OS_802_11_QOS_TSPEC_PARAMS;
206
207
208typedef struct _OS_802_11_QOS_DELETE_TSPEC_PARAMS
209{
210    TI_UINT32               uUserPriority;
211    TI_UINT32               uReasonCode;
212} OS_802_11_QOS_DELETE_TSPEC_PARAMS;
213
214
215typedef struct _OS_802_11_QOS_DESIRED_PS_MODE
216{
217    TI_UINT32               uDesiredPsMode;
218    TI_UINT32               uDesiredWmeAcPsMode[QOS_HIGHEST_AC_INDEX + 1];
219
220} OS_802_11_QOS_DESIRED_PS_MODE;
221
222
223/* When this value is added to reason code in TSPEC events, it indicates a TSPEC response which was unexpected at the time */
224/* For example, a TSPEC response arrives after a TSPEC timeout */
225#define TSPEC_RESPONSE_UNEXPECTED      0x1000
226
227
228typedef enum
229{
230    ADDTS_RESPONSE_ACCEPT = 0,
231    ADDTS_RESPONSE_REJECT = 3,
232    ADDTS_RESPONSE_AP_PARAM_INVALID = 253,
233    ADDTS_RESPONSE_TIMEOUT = 254,
234    TSPEC_DELETED_BY_AP = 255
235
236} ETspecStatus;
237
238
239typedef struct _OS_802_11_AC_UPSD_STATUS_PARAMS
240{
241   TI_UINT32                uAC;
242   TI_UINT32                uCurrentUAPSDStatus;
243   TI_UINT32                pCurrentAdmissionStatus;
244
245} OS_802_11_AC_UPSD_STATUS_PARAMS;
246
247
248typedef struct _OS_802_11_THRESHOLD_CROSS_PARAMS
249{
250    TI_UINT32               uAC;
251    TI_UINT32               uHighThreshold;
252    TI_UINT32               uLowThreshold;
253
254} OS_802_11_THRESHOLD_CROSS_PARAMS;
255
256
257typedef struct OS_802_11_THRESHOLD_CROSS_INDICATION_PARAMS
258{
259    TI_UINT32               uAC;
260    TI_UINT32               uHighOrLowThresholdFlag;  /* According to thresholdCross_e enum */
261    TI_UINT32               uAboveOrBelowFlag;        /* According to thresholdCrossDirection_e enum */
262
263} OS_802_11_THRESHOLD_CROSS_INDICATION_PARAMS;
264
265
266typedef enum
267{
268    HIGH_THRESHOLD_CROSS,
269    LOW_THRESHOLD_CROSS
270
271} EThresholdCross;
272
273
274typedef enum
275{
276    CROSS_ABOVE,
277    CROSS_BELOW
278
279} EThresholdCrossDirection;
280
281
282typedef struct
283{
284   TI_UINT32                dstIpAddress;
285   TI_UINT32                dstPort;
286   TI_UINT32                PktTag;
287   TI_UINT32                userPriority;
288
289} TStreamTrafficProperties;
290
291
292typedef enum
293{
294   UPLINK_DIRECTION = 0,
295   DOWNLINK_DIRECTION = 1,
296   RESERVED_DIRECTION = 2,
297   BI_DIRECTIONAL = 3
298
299} EStreamDirection;
300
301
302/* classification algorithms:
303  0) D-tag to D-tag
304  1) DSCP to D-tag
305  2) Destination port number to D-tag
306  3) Destination IP&Port to D-tag
307*/
308typedef enum
309{
310    D_TAG_CLSFR    = 0,
311    DSCP_CLSFR     = 1,
312    PORT_CLSFR     = 2,
313    IPPORT_CLSFR   = 3,
314    CLSFR_MAX_TYPE = IPPORT_CLSFR
315
316} EClsfrType;
317
318
319
320/*************************/
321/*   classifier params   */
322/*************************/
323
324/* Destination IP address and port number */
325typedef struct
326{
327    TI_UINT32               DstIPAddress;
328    TI_UINT16               DstPortNum;
329
330} TIpPort;
331
332/* Classification mapping table */
333typedef struct
334{
335    union
336    {
337        TIpPort             DstIPPort;  /* for destination IP&Port classifier*/
338        TI_UINT16           DstPortNum; /* for destination Port classifier*/
339        TI_UINT8            CodePoint;  /* for DSCP classifier*/
340    } Dscp;
341
342    TI_UINT8                DTag;
343
344} TClsfrTableEntry;
345
346/* number of classifier entries in the classification table */
347#define NUM_OF_CLSFR_TABLE_ENTRIES  16
348
349typedef struct
350{
351    EClsfrType              eClsfrType; /* The type of the classifier: D-tag, DSCP, Port or IP&Port */
352    TI_UINT32               uNumActiveEntries; /* The number of active entries in the classification table */
353    TClsfrTableEntry        ClsfrTable[NUM_OF_CLSFR_TABLE_ENTRIES]; /* Classification table - size changed from 15 to 16*/
354
355} TClsfrParams;
356
357typedef struct{
358	TI_UINT8                       voiceTspecConfigure;
359	TI_UINT8                       videoTspecConfigure;
360}TSpecConfigure;
361
362#endif /* TI_QOS_TYPES_H */
363
364