aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8192su/ieee80211/rtl819x_Qos.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/rtl8192su/ieee80211/rtl819x_Qos.h')
-rw-r--r--drivers/staging/rtl8192su/ieee80211/rtl819x_Qos.h749
1 files changed, 749 insertions, 0 deletions
diff --git a/drivers/staging/rtl8192su/ieee80211/rtl819x_Qos.h b/drivers/staging/rtl8192su/ieee80211/rtl819x_Qos.h
new file mode 100644
index 00000000000..f7b882b99d1
--- /dev/null
+++ b/drivers/staging/rtl8192su/ieee80211/rtl819x_Qos.h
@@ -0,0 +1,749 @@
1#ifndef __INC_QOS_TYPE_H
2#define __INC_QOS_TYPE_H
3
4//#include "EndianFree.h"
5#define BIT0 0x00000001
6#define BIT1 0x00000002
7#define BIT2 0x00000004
8#define BIT3 0x00000008
9#define BIT4 0x00000010
10#define BIT5 0x00000020
11#define BIT6 0x00000040
12#define BIT7 0x00000080
13#define BIT8 0x00000100
14#define BIT9 0x00000200
15#define BIT10 0x00000400
16#define BIT11 0x00000800
17#define BIT12 0x00001000
18#define BIT13 0x00002000
19#define BIT14 0x00004000
20#define BIT15 0x00008000
21#define BIT16 0x00010000
22#define BIT17 0x00020000
23#define BIT18 0x00040000
24#define BIT19 0x00080000
25#define BIT20 0x00100000
26#define BIT21 0x00200000
27#define BIT22 0x00400000
28#define BIT23 0x00800000
29#define BIT24 0x01000000
30#define BIT25 0x02000000
31#define BIT26 0x04000000
32#define BIT27 0x08000000
33#define BIT28 0x10000000
34#define BIT29 0x20000000
35#define BIT30 0x40000000
36#define BIT31 0x80000000
37
38#define MAX_WMMELE_LENGTH 64
39
40//
41// QoS mode.
42// enum 0, 1, 2, 4: since we can use the OR(|) operation.
43//
44// QOS_MODE is redefined for enum can't be ++, | under C++ compiler, 2006.05.17, by rcnjko.
45//typedef enum _QOS_MODE{
46// QOS_DISABLE = 0,
47// QOS_WMM = 1,
48// QOS_EDCA = 2,
49// QOS_HCCA = 4,
50//}QOS_MODE,*PQOS_MODE;
51//
52typedef u32 QOS_MODE, *PQOS_MODE;
53#define QOS_DISABLE 0
54#define QOS_WMM 1
55#define QOS_WMMSA 2
56#define QOS_EDCA 4
57#define QOS_HCCA 8
58#define QOS_WMM_UAPSD 16 //WMM Power Save, 2006-06-14 Isaiah
59
60#define AC_PARAM_SIZE 4
61#define WMM_PARAM_ELE_BODY_LEN 18
62
63//
64// QoS ACK Policy Field Values
65// Ref: WMM spec 2.1.6: QoS Control Field, p.10.
66//
67typedef enum _ACK_POLICY{
68 eAckPlc0_ACK = 0x00,
69 eAckPlc1_NoACK = 0x01,
70}ACK_POLICY,*PACK_POLICY;
71
72#define WMM_PARAM_ELEMENT_SIZE (8+(4*AC_PARAM_SIZE))
73#if 0
74#define GET_QOS_CTRL(_pStart) ReadEF2Byte((u8 *)(_pStart) + 24)
75#define SET_QOS_CTRL(_pStart, _value) WriteEF2Byte((u8 *)(_pStart) + 24, _value)
76
77// WMM control field.
78#define GET_QOS_CTRL_WMM_UP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 3))
79#define SET_QOS_CTRL_WMM_UP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 3, (u8)(_value))
80
81#define GET_QOS_CTRL_WMM_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1))
82#define SET_QOS_CTRL_WMM_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value))
83
84#define GET_QOS_CTRL_WMM_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2))
85#define SET_QOS_CTRL_WMM_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value))
86
87// 802.11e control field (by STA, data)
88#define GET_QOS_CTRL_STA_DATA_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4))
89#define SET_QOS_CTRL_STA_DATA_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value))
90
91#define GET_QOS_CTRL_STA_DATA_QSIZE_FLAG(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1))
92#define SET_QOS_CTRL_STA_DATA_QSIZE_FLAG(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value))
93
94#define GET_QOS_CTRL_STA_DATA_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2))
95#define SET_QOS_CTRL_STA_DATA_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value))
96
97#define GET_QOS_CTRL_STA_DATA_TXOP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8))
98#define SET_QOS_CTRL_STA_DATA_TXOP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value))
99
100#define GET_QOS_CTRL_STA_DATA_QSIZE(_pStart) GET_QOS_CTRL_STA_DATA_TXOP(_pStart)
101#define SET_QOS_CTRL_STA_DATA_QSIZE(_pStart, _value) SET_QOS_CTRL_STA_DATA_TXOP(_pStart)
102
103// 802.11e control field (by HC, data)
104#define GET_QOS_CTRL_HC_DATA_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4))
105#define SET_QOS_CTRL_HC_DATA_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value))
106
107#define GET_QOS_CTRL_HC_DATA_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1))
108#define SET_QOS_CTRL_HC_DATA_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value))
109
110#define GET_QOS_CTRL_HC_DATA_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2))
111#define SET_QOS_CTRL_HC_DATA_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value))
112
113#define GET_QOS_CTRL_HC_DATA_PS_BUFSTATE(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8))
114#define SET_QOS_CTRL_HC_DATA_PS_BUFSTATE(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value))
115
116// 802.11e control field (by HC, CFP)
117#define GET_QOS_CTRL_HC_CFP_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4))
118#define SET_QOS_CTRL_HC_CFP_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value))
119
120#define GET_QOS_CTRL_HC_CFP_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1))
121#define SET_QOS_CTRL_HC_CFP_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value))
122
123#define GET_QOS_CTRL_HC_CFP_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2))
124#define SET_QOS_CTRL_HC_CFP_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value))
125
126#define GET_QOS_CTRL_HC_CFP_TXOP_LIMIT(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8))
127#define SET_QOS_CTRL_HC_CFP_TXOP_LIMIT(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value))
128
129#define SET_WMM_QOS_INFO_FIELD(_pStart, _val) WriteEF1Byte(_pStart, _val)
130
131#define GET_WMM_QOS_INFO_FIELD_PARAMETERSET_COUNT(_pStart) LE_BITS_TO_1BYTE(_pStart, 0, 4)
132#define SET_WMM_QOS_INFO_FIELD_PARAMETERSET_COUNT(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 0, 4, _val)
133
134#define GET_WMM_QOS_INFO_FIELD_AP_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 7, 1)
135#define SET_WMM_QOS_INFO_FIELD_AP_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 7, 1, _val)
136
137#define GET_WMM_QOS_INFO_FIELD_STA_AC_VO_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 0, 1)
138#define SET_WMM_QOS_INFO_FIELD_STA_AC_VO_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 0, 1, _val)
139
140#define GET_WMM_QOS_INFO_FIELD_STA_AC_VI_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 1, 1)
141#define SET_WMM_QOS_INFO_FIELD_STA_AC_VI_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 1, 1, _val)
142
143#define GET_WMM_QOS_INFO_FIELD_STA_AC_BE_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 2, 1)
144#define SET_WMM_QOS_INFO_FIELD_STA_AC_BE_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 2, 1, _val)
145
146#define GET_WMM_QOS_INFO_FIELD_STA_AC_BK_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 3, 1)
147#define SET_WMM_QOS_INFO_FIELD_STA_AC_BK_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 3, 1, _val)
148
149#define GET_WMM_QOS_INFO_FIELD_STA_MAX_SP_LEN(_pStart) LE_BITS_TO_1BYTE(_pStart, 5, 2)
150#define SET_WMM_QOS_INFO_FIELD_STA_MAX_SP_LEN(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 5, 2, _val)
151
152
153#define WMM_INFO_ELEMENT_SIZE 7
154
155#define GET_WMM_INFO_ELE_OUI(_pStart) ((u8 *)(_pStart))
156#define SET_WMM_INFO_ELE_OUI(_pStart, _pVal) PlatformMoveMemory(_pStart, _pVal, 3);
157
158#define GET_WMM_INFO_ELE_OUI_TYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+3) ) )
159#define SET_WMM_INFO_ELE_OUI_TYPE(_pStart, _val) ( *((u8 *)(_pStart)+3) = EF1Byte(_val) )
160
161#define GET_WMM_INFO_ELE_OUI_SUBTYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+4) ) )
162#define SET_WMM_INFO_ELE_OUI_SUBTYPE(_pStart, _val) ( *((u8 *)(_pStart)+4) = EF1Byte(_val) )
163
164#define GET_WMM_INFO_ELE_VERSION(_pStart) ( EF1Byte( *((u8 *)(_pStart)+5) ) )
165#define SET_WMM_INFO_ELE_VERSION(_pStart, _val) ( *((u8 *)(_pStart)+5) = EF1Byte(_val) )
166
167#define GET_WMM_INFO_ELE_QOS_INFO_FIELD(_pStart) ( EF1Byte( *((u8 *)(_pStart)+6) ) )
168#define SET_WMM_INFO_ELE_QOS_INFO_FIELD(_pStart, _val) ( *((u8 *)(_pStart)+6) = EF1Byte(_val) )
169
170
171
172#define GET_WMM_AC_PARAM_AIFSN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 0, 4) )
173#define SET_WMM_AC_PARAM_AIFSN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 0, 4, _val)
174
175#define GET_WMM_AC_PARAM_ACM(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 4, 1) )
176#define SET_WMM_AC_PARAM_ACM(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 4, 1, _val)
177
178#define GET_WMM_AC_PARAM_ACI(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 5, 2) )
179#define SET_WMM_AC_PARAM_ACI(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 5, 2, _val)
180
181#define GET_WMM_AC_PARAM_ACI_AIFSN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 0, 8) )
182#define SET_WMM_AC_PARAM_ACI_AIFSN(_pStart, _val) SET_BTIS_TO_LE_4BYTE(_pStart, 0, 8, _val)
183
184#define GET_WMM_AC_PARAM_ECWMIN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 8, 4) )
185#define SET_WMM_AC_PARAM_ECWMIN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 8, 4, _val)
186
187#define GET_WMM_AC_PARAM_ECWMAX(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 12, 4) )
188#define SET_WMM_AC_PARAM_ECWMAX(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 12, 4, _val)
189
190#define GET_WMM_AC_PARAM_TXOP_LIMIT(_pStart) ( (u16)LE_BITS_TO_4BYTE(_pStart, 16, 16) )
191#define SET_WMM_AC_PARAM_TXOP_LIMIT(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 16, 16, _val)
192
193
194
195
196#define GET_WMM_PARAM_ELE_OUI(_pStart) ((u8 *)(_pStart))
197#define SET_WMM_PARAM_ELE_OUI(_pStart, _pVal) PlatformMoveMemory(_pStart, _pVal, 3)
198
199#define GET_WMM_PARAM_ELE_OUI_TYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+3) ) )
200#define SET_WMM_PARAM_ELE_OUI_TYPE(_pStart, _val) ( *((u8 *)(_pStart)+3) = EF1Byte(_val) )
201
202#define GET_WMM_PARAM_ELE_OUI_SUBTYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+4) ) )
203#define SET_WMM_PARAM_ELE_OUI_SUBTYPE(_pStart, _val) ( *((u8 *)(_pStart)+4) = EF1Byte(_val) )
204
205#define GET_WMM_PARAM_ELE_VERSION(_pStart) ( EF1Byte( *((u8 *)(_pStart)+5) ) )
206#define SET_WMM_PARAM_ELE_VERSION(_pStart, _val) ( *((u8 *)(_pStart)+5) = EF1Byte(_val) )
207
208#define GET_WMM_PARAM_ELE_QOS_INFO_FIELD(_pStart) ( EF1Byte( *((u8 *)(_pStart)+6) ) )
209#define SET_WMM_PARAM_ELE_QOS_INFO_FIELD(_pStart, _val) ( *((u8 *)(_pStart)+6) = EF1Byte(_val) )
210
211#define GET_WMM_PARAM_ELE_AC_PARAM(_pStart) ( (u8 *)(_pStart)+8 )
212#define SET_WMM_PARAM_ELE_AC_PARAM(_pStart, _pVal) PlatformMoveMemory((_pStart)+8, _pVal, 16)
213#endif
214
215//
216// QoS Control Field
217// Ref:
218// 1. WMM spec 2.1.6: QoS Control Field, p.9.
219// 2. 802.11e/D13.0 7.1.3.5, p.26.
220//
221typedef union _QOS_CTRL_FIELD{
222 u8 charData[2];
223 u16 shortData;
224
225 // WMM spec
226 struct
227 {
228 u8 UP:3;
229 u8 usRsvd1:1;
230 u8 EOSP:1;
231 u8 AckPolicy:2;
232 u8 usRsvd2:1;
233 u8 ucRsvdByte;
234 }WMM;
235
236 // 802.11e: QoS data type frame sent by non-AP QSTAs.
237 struct
238 {
239 u8 TID:4;
240 u8 bIsQsize:1;// 0: BIT[8:15] is TXOP Duration Requested, 1: BIT[8:15] is Queue Size.
241 u8 AckPolicy:2;
242 u8 usRsvd:1;
243 u8 TxopOrQsize; // (BIT4=0)TXOP Duration Requested or (BIT4=1)Queue Size.
244 }BySta;
245
246 // 802.11e: QoS data, QoS Null, and QoS Data+CF-Ack frames sent by HC.
247 struct
248 {
249 u8 TID:4;
250 u8 EOSP:1;
251 u8 AckPolicy:2;
252 u8 usRsvd:1;
253 u8 PSBufState; // QAP PS Buffer State.
254 }ByHc_Data;
255
256 // 802.11e: QoS (+) CF-Poll frames sent by HC.
257 struct
258 {
259 u8 TID:4;
260 u8 EOSP:1;
261 u8 AckPolicy:2;
262 u8 usRsvd:1;
263 u8 TxopLimit; // TXOP Limit.
264 }ByHc_CFP;
265
266}QOS_CTRL_FIELD, *PQOS_CTRL_FIELD;
267
268
269//
270// QoS Info Field
271// Ref:
272// 1. WMM spec 2.2.1: WME Information Element, p.11.
273// 2. 8185 QoS code: QOS_INFO [def. in QoS_mp.h]
274//
275typedef union _QOS_INFO_FIELD{
276 u8 charData;
277
278 struct
279 {
280 u8 ucParameterSetCount:4;
281 u8 ucReserved:4;
282 }WMM;
283
284 struct
285 {
286 //Ref WMM_Specification_1-1.pdf, 2006-06-13 Isaiah
287 u8 ucAC_VO_UAPSD:1;
288 u8 ucAC_VI_UAPSD:1;
289 u8 ucAC_BE_UAPSD:1;
290 u8 ucAC_BK_UAPSD:1;
291 u8 ucReserved1:1;
292 u8 ucMaxSPLen:2;
293 u8 ucReserved2:1;
294
295 }ByWmmPsSta;
296
297 struct
298 {
299 //Ref WMM_Specification_1-1.pdf, 2006-06-13 Isaiah
300 u8 ucParameterSetCount:4;
301 u8 ucReserved:3;
302 u8 ucApUapsd:1;
303 }ByWmmPsAp;
304
305 struct
306 {
307 u8 ucAC3_UAPSD:1;
308 u8 ucAC2_UAPSD:1;
309 u8 ucAC1_UAPSD:1;
310 u8 ucAC0_UAPSD:1;
311 u8 ucQAck:1;
312 u8 ucMaxSPLen:2;
313 u8 ucMoreDataAck:1;
314 } By11eSta;
315
316 struct
317 {
318 u8 ucParameterSetCount:4;
319 u8 ucQAck:1;
320 u8 ucQueueReq:1;
321 u8 ucTXOPReq:1;
322 u8 ucReserved:1;
323 } By11eAp;
324
325 struct
326 {
327 u8 ucReserved1:4;
328 u8 ucQAck:1;
329 u8 ucReserved2:2;
330 u8 ucMoreDataAck:1;
331 } ByWmmsaSta;
332
333 struct
334 {
335 u8 ucReserved1:4;
336 u8 ucQAck:1;
337 u8 ucQueueReq:1;
338 u8 ucTXOPReq:1;
339 u8 ucReserved2:1;
340 } ByWmmsaAp;
341
342 struct
343 {
344 u8 ucAC3_UAPSD:1;
345 u8 ucAC2_UAPSD:1;
346 u8 ucAC1_UAPSD:1;
347 u8 ucAC0_UAPSD:1;
348 u8 ucQAck:1;
349 u8 ucMaxSPLen:2;
350 u8 ucMoreDataAck:1;
351 } ByAllSta;
352
353 struct
354 {
355 u8 ucParameterSetCount:4;
356 u8 ucQAck:1;
357 u8 ucQueueReq:1;
358 u8 ucTXOPReq:1;
359 u8 ucApUapsd:1;
360 } ByAllAp;
361
362}QOS_INFO_FIELD, *PQOS_INFO_FIELD;
363
364#if 0
365//
366// WMM Information Element
367// Ref: WMM spec 2.2.1: WME Information Element, p.10.
368//
369typedef struct _WMM_INFO_ELEMENT{
370// u8 ElementID;
371// u8 Length;
372 u8 OUI[3];
373 u8 OUI_Type;
374 u8 OUI_SubType;
375 u8 Version;
376 QOS_INFO_FIELD QosInfo;
377}WMM_INFO_ELEMENT, *PWMM_INFO_ELEMENT;
378#endif
379
380//
381// ACI to AC coding.
382// Ref: WMM spec 2.2.2: WME Parameter Element, p.13.
383//
384// AC_CODING is redefined for enum can't be ++, | under C++ compiler, 2006.05.17, by rcnjko.
385//typedef enum _AC_CODING{
386// AC0_BE = 0, // ACI: 0x00 // Best Effort
387// AC1_BK = 1, // ACI: 0x01 // Background
388// AC2_VI = 2, // ACI: 0x10 // Video
389// AC3_VO = 3, // ACI: 0x11 // Voice
390// AC_MAX = 4, // Max: define total number; Should not to be used as a real enum.
391//}AC_CODING,*PAC_CODING;
392//
393typedef u32 AC_CODING;
394#define AC0_BE 0 // ACI: 0x00 // Best Effort
395#define AC1_BK 1 // ACI: 0x01 // Background
396#define AC2_VI 2 // ACI: 0x10 // Video
397#define AC3_VO 3 // ACI: 0x11 // Voice
398#define AC_MAX 4 // Max: define total number; Should not to be used as a real enum.
399
400//
401// ACI/AIFSN Field.
402// Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
403//
404typedef union _ACI_AIFSN{
405 u8 charData;
406
407 struct
408 {
409 u8 AIFSN:4;
410 u8 ACM:1;
411 u8 ACI:2;
412 u8 Reserved:1;
413 }f; // Field
414}ACI_AIFSN, *PACI_AIFSN;
415
416//
417// ECWmin/ECWmax field.
418// Ref: WMM spec 2.2.2: WME Parameter Element, p.13.
419//
420typedef union _ECW{
421 u8 charData;
422 struct
423 {
424 u8 ECWmin:4;
425 u8 ECWmax:4;
426 }f; // Field
427}ECW, *PECW;
428
429//
430// AC Parameters Record Format.
431// Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
432//
433typedef union _AC_PARAM{
434 u32 longData;
435 u8 charData[4];
436
437 struct
438 {
439 ACI_AIFSN AciAifsn;
440 ECW Ecw;
441 u16 TXOPLimit;
442 }f; // Field
443}AC_PARAM, *PAC_PARAM;
444
445
446
447//
448// QoS element subtype
449//
450typedef enum _QOS_ELE_SUBTYPE{
451 QOSELE_TYPE_INFO = 0x00, // 0x00: Information element
452 QOSELE_TYPE_PARAM = 0x01, // 0x01: parameter element
453}QOS_ELE_SUBTYPE,*PQOS_ELE_SUBTYPE;
454
455
456//
457// Direction Field Values.
458// Ref: WMM spec 2.2.11: WME TSPEC Element, p.18.
459//
460typedef enum _DIRECTION_VALUE{
461 DIR_UP = 0, // 0x00 // UpLink
462 DIR_DOWN = 1, // 0x01 // DownLink
463 DIR_DIRECT = 2, // 0x10 // DirectLink
464 DIR_BI_DIR = 3, // 0x11 // Bi-Direction
465}DIRECTION_VALUE,*PDIRECTION_VALUE;
466
467
468//
469// TS Info field in WMM TSPEC Element.
470// Ref:
471// 1. WMM spec 2.2.11: WME TSPEC Element, p.18.
472// 2. 8185 QoS code: QOS_TSINFO [def. in QoS_mp.h]
473//
474typedef union _QOS_TSINFO{
475 u8 charData[3];
476 struct {
477 u8 ucTrafficType:1; //WMM is reserved
478 u8 ucTSID:4;
479 u8 ucDirection:2;
480 u8 ucAccessPolicy:2; //WMM: bit8=0, bit7=1
481 u8 ucAggregation:1; //WMM is reserved
482 u8 ucPSB:1; //WMMSA is APSD
483 u8 ucUP:3;
484 u8 ucTSInfoAckPolicy:2; //WMM is reserved
485 u8 ucSchedule:1; //WMM is reserved
486 u8 ucReserved:7;
487 }field;
488}QOS_TSINFO, *PQOS_TSINFO;
489
490//
491// WMM TSPEC Body.
492// Ref: WMM spec 2.2.11: WME TSPEC Element, p.16.
493//
494typedef union _TSPEC_BODY{
495 u8 charData[55];
496
497 struct
498 {
499 QOS_TSINFO TSInfo; //u8 TSInfo[3];
500 u16 NominalMSDUsize;
501 u16 MaxMSDUsize;
502 u32 MinServiceItv;
503 u32 MaxServiceItv;
504 u32 InactivityItv;
505 u32 SuspenItv;
506 u32 ServiceStartTime;
507 u32 MinDataRate;
508 u32 MeanDataRate;
509 u32 PeakDataRate;
510 u32 MaxBurstSize;
511 u32 DelayBound;
512 u32 MinPhyRate;
513 u16 SurplusBandwidthAllowance;
514 u16 MediumTime;
515 } f; // Field
516}TSPEC_BODY, *PTSPEC_BODY;
517
518
519//
520// WMM TSPEC Element.
521// Ref: WMM spec 2.2.11: WME TSPEC Element, p.16.
522//
523typedef struct _WMM_TSPEC{
524 u8 ID;
525 u8 Length;
526 u8 OUI[3];
527 u8 OUI_Type;
528 u8 OUI_SubType;
529 u8 Version;
530 TSPEC_BODY Body;
531} WMM_TSPEC, *PWMM_TSPEC;
532
533//
534// ACM implementation method.
535// Annie, 2005-12-13.
536//
537typedef enum _ACM_METHOD{
538 eAcmWay0_SwAndHw = 0, // By SW and HW.
539 eAcmWay1_HW = 1, // By HW.
540 eAcmWay2_SW = 2, // By SW.
541}ACM_METHOD,*PACM_METHOD;
542
543
544typedef struct _ACM{
545// u8 RegEnableACM;
546 u64 UsedTime;
547 u64 MediumTime;
548 u8 HwAcmCtl; // TRUE: UsedTime exceed => Do NOT USE this AC. It wll be written to ACM_CONTROL(0xBF BIT 0/1/2 in 8185B).
549}ACM, *PACM;
550
551typedef u8 AC_UAPSD, *PAC_UAPSD;
552
553#define GET_VO_UAPSD(_apsd) ((_apsd) & BIT0)
554#define SET_VO_UAPSD(_apsd) ((_apsd) |= BIT0)
555
556#define GET_VI_UAPSD(_apsd) ((_apsd) & BIT1)
557#define SET_VI_UAPSD(_apsd) ((_apsd) |= BIT1)
558
559#define GET_BK_UAPSD(_apsd) ((_apsd) & BIT2)
560#define SET_BK_UAPSD(_apsd) ((_apsd) |= BIT2)
561
562#define GET_BE_UAPSD(_apsd) ((_apsd) & BIT3)
563#define SET_BE_UAPSD(_apsd) ((_apsd) |= BIT3)
564
565
566//typedef struct _TCLASS{
567// TODO
568//} TCLASS, *PTCLASS;
569typedef union _QOS_TCLAS{
570
571 struct _TYPE_GENERAL{
572 u8 Priority;
573 u8 ClassifierType;
574 u8 Mask;
575 } TYPE_GENERAL;
576
577 struct _TYPE0_ETH{
578 u8 Priority;
579 u8 ClassifierType;
580 u8 Mask;
581 u8 SrcAddr[6];
582 u8 DstAddr[6];
583 u16 Type;
584 } TYPE0_ETH;
585
586 struct _TYPE1_IPV4{
587 u8 Priority;
588 u8 ClassifierType;
589 u8 Mask;
590 u8 Version;
591 u8 SrcIP[4];
592 u8 DstIP[4];
593 u16 SrcPort;
594 u16 DstPort;
595 u8 DSCP;
596 u8 Protocol;
597 u8 Reserved;
598 } TYPE1_IPV4;
599
600 struct _TYPE1_IPV6{
601 u8 Priority;
602 u8 ClassifierType;
603 u8 Mask;
604 u8 Version;
605 u8 SrcIP[16];
606 u8 DstIP[16];
607 u16 SrcPort;
608 u16 DstPort;
609 u8 FlowLabel[3];
610 } TYPE1_IPV6;
611
612 struct _TYPE2_8021Q{
613 u8 Priority;
614 u8 ClassifierType;
615 u8 Mask;
616 u16 TagType;
617 } TYPE2_8021Q;
618} QOS_TCLAS, *PQOS_TCLAS;
619
620//typedef struct _WMM_TSTREAM{
621//
622//- TSPEC
623//- AC (which to mapping)
624//} WMM_TSTREAM, *PWMM_TSTREAM;
625typedef struct _QOS_TSTREAM{
626 u8 AC;
627 WMM_TSPEC TSpec;
628 QOS_TCLAS TClass;
629} QOS_TSTREAM, *PQOS_TSTREAM;
630
631//typedef struct _U_APSD{
632//- TriggerEnable [4]
633//- MaxSPLength
634//- HighestAcBuffered
635//} U_APSD, *PU_APSD;
636
637//joseph TODO:
638// UAPSD function should be implemented by 2 data structure
639// "Qos control field" and "Qos info field"
640//typedef struct _QOS_UAPSD{
641// u8 bTriggerEnable[4];
642// u8 MaxSPLength;
643// u8 HighestBufAC;
644//} QOS_UAPSD, *PQOS_APSD;
645
646//----------------------------------------------------------------------------
647// 802.11 Management frame Status Code field
648//----------------------------------------------------------------------------
649typedef struct _OCTET_STRING{
650 u8 *Octet;
651 u16 Length;
652}OCTET_STRING, *POCTET_STRING;
653#if 0
654#define FillOctetString(_os,_octet,_len) \
655 (_os).Octet=(u8 *)(_octet); \
656 (_os).Length=(_len);
657
658#define WMM_ELEM_HDR_LEN 6
659#define WMMElemSkipHdr(_osWMMElem) \
660 (_osWMMElem).Octet += WMM_ELEM_HDR_LEN; \
661 (_osWMMElem).Length -= WMM_ELEM_HDR_LEN;
662#endif
663//
664// STA QoS data.
665// Ref: DOT11_QOS in 8185 code. [def. in QoS_mp.h]
666//
667typedef struct _STA_QOS{
668 //DECLARE_RT_OBJECT(STA_QOS);
669 u8 WMMIEBuf[MAX_WMMELE_LENGTH];
670 u8* WMMIE;
671
672 // Part 1. Self QoS Mode.
673 QOS_MODE QosCapability; //QoS Capability, 2006-06-14 Isaiah
674 QOS_MODE CurrentQosMode;
675
676 // For WMM Power Save Mode :
677 // ACs are trigger/delivery enabled or legacy power save enabled. 2006-06-13 Isaiah
678 AC_UAPSD b4ac_Uapsd; //VoUapsd(bit0), ViUapsd(bit1), BkUapsd(bit2), BeUapsd(bit3),
679 AC_UAPSD Curr4acUapsd;
680 u8 bInServicePeriod;
681 u8 MaxSPLength;
682 int NumBcnBeforeTrigger;
683
684 // Part 2. EDCA Parameter (perAC)
685 u8 * pWMMInfoEle;
686 u8 WMMParamEle[WMM_PARAM_ELEMENT_SIZE];
687 u8 WMMPELength;
688
689 // <Bruce_Note>
690 //2 ToDo: remove the Qos Info Field and replace it by the above WMM Info element.
691 // By Bruce, 2008-01-30.
692 // Part 2. EDCA Parameter (perAC)
693 QOS_INFO_FIELD QosInfoField_STA; // Maintained by STA
694 QOS_INFO_FIELD QosInfoField_AP; // Retrieved from AP
695
696 AC_PARAM CurAcParameters[4];
697
698 // Part 3. ACM
699 ACM acm[4];
700 ACM_METHOD AcmMethod;
701
702 // Part 4. Per TID (Part 5: TCLASS will be described by TStream)
703 QOS_TSTREAM TStream[16];
704 WMM_TSPEC TSpec;
705
706 u32 QBssWirelessMode;
707
708 // No Ack Setting
709 u8 bNoAck;
710
711 // Enable/Disable Rx immediate BA capability.
712 u8 bEnableRxImmBA;
713
714}STA_QOS, *PSTA_QOS;
715
716//
717// BSS QOS data.
718// Ref: BssDscr in 8185 code. [def. in BssDscr.h]
719//
720typedef struct _BSS_QOS{
721 QOS_MODE bdQoSMode;
722
723 u8 bdWMMIEBuf[MAX_WMMELE_LENGTH];
724 u8* bdWMMIE;
725
726 QOS_ELE_SUBTYPE EleSubType;
727
728 u8 * pWMMInfoEle;
729 u8 * pWMMParamEle;
730
731 QOS_INFO_FIELD QosInfoField;
732 AC_PARAM AcParameter[4];
733}BSS_QOS, *PBSS_QOS;
734
735
736//
737// Ref: sQoSCtlLng and QoSCtl definition in 8185 QoS code.
738//#define QoSCtl (( (Adapter->bRegQoS) && (Adapter->dot11QoS.QoSMode &(QOS_EDCA|QOS_HCCA)) ) ?sQoSCtlLng:0)
739//
740#define sQoSCtlLng 2
741#define QOS_CTRL_LEN(_QosMode) ((_QosMode > QOS_DISABLE)? sQoSCtlLng : 0)
742
743
744//Added by joseph
745//UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP
746//#define UP2AC(up) ((up<3)?((up==0)?1:0):(up>>1))
747#define IsACValid(ac) ((ac<=7 )?true:false )
748
749#endif // #ifndef __INC_QOS_TYPE_H