1 #ifndef __INC_QOS_TYPE_H
2 #define __INC_QOS_TYPE_H
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
38 #define MAX_WMMELE_LENGTH 64
42 // enum 0, 1, 2, 4: since we can use the OR(|) operation.
44 // QOS_MODE is redefined for enum can't be ++, | under C++ compiler, 2006.05.17, by rcnjko.
45 //typedef enum _QOS_MODE{
50 //}QOS_MODE,*PQOS_MODE;
52 typedef u32 QOS_MODE
, *PQOS_MODE
;
58 #define QOS_WMM_UAPSD 16 //WMM Power Save, 2006-06-14 Isaiah
60 #define AC_PARAM_SIZE 4
61 #define WMM_PARAM_ELE_BODY_LEN 18
64 // QoS ACK Policy Field Values
65 // Ref: WMM spec 2.1.6: QoS Control Field, p.10.
67 typedef enum _ACK_POLICY
{
69 eAckPlc1_NoACK
= 0x01,
70 }ACK_POLICY
,*PACK_POLICY
;
72 #define WMM_PARAM_ELEMENT_SIZE (8+(4*AC_PARAM_SIZE))
77 // 1. WMM spec 2.1.6: QoS Control Field, p.9.
78 // 2. 802.11e/D13.0 7.1.3.5, p.26.
80 typedef union _QOS_CTRL_FIELD
{
95 // 802.11e: QoS data type frame sent by non-AP QSTAs.
99 u8 bIsQsize
:1;// 0: BIT[8:15] is TXOP Duration Requested, 1: BIT[8:15] is Queue Size.
102 u8 TxopOrQsize
; // (BIT4=0)TXOP Duration Requested or (BIT4=1)Queue Size.
105 // 802.11e: QoS data, QoS Null, and QoS Data+CF-Ack frames sent by HC.
112 u8 PSBufState
; // QAP PS Buffer State.
115 // 802.11e: QoS (+) CF-Poll frames sent by HC.
122 u8 TxopLimit
; // TXOP Limit.
125 }QOS_CTRL_FIELD
, *PQOS_CTRL_FIELD
;
131 // 1. WMM spec 2.2.1: WME Information Element, p.11.
132 // 2. 8185 QoS code: QOS_INFO [def. in QoS_mp.h]
134 typedef union _QOS_INFO_FIELD
{
139 u8 ucParameterSetCount
:4;
145 //Ref WMM_Specification_1-1.pdf, 2006-06-13 Isaiah
158 //Ref WMM_Specification_1-1.pdf, 2006-06-13 Isaiah
159 u8 ucParameterSetCount
:4;
177 u8 ucParameterSetCount
:4;
214 u8 ucParameterSetCount
:4;
221 }QOS_INFO_FIELD
, *PQOS_INFO_FIELD
;
226 // Ref: WMM spec 2.2.2: WME Parameter Element, p.13.
228 // AC_CODING is redefined for enum can't be ++, | under C++ compiler, 2006.05.17, by rcnjko.
229 //typedef enum _AC_CODING{
230 // AC0_BE = 0, // ACI: 0x00 // Best Effort
231 // AC1_BK = 1, // ACI: 0x01 // Background
232 // AC2_VI = 2, // ACI: 0x10 // Video
233 // AC3_VO = 3, // ACI: 0x11 // Voice
234 // AC_MAX = 4, // Max: define total number; Should not to be used as a real enum.
235 //}AC_CODING,*PAC_CODING;
237 typedef u32 AC_CODING
;
238 #define AC0_BE 0 // ACI: 0x00 // Best Effort
239 #define AC1_BK 1 // ACI: 0x01 // Background
240 #define AC2_VI 2 // ACI: 0x10 // Video
241 #define AC3_VO 3 // ACI: 0x11 // Voice
242 #define AC_MAX 4 // Max: define total number; Should not to be used as a real enum.
246 // Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
248 typedef union _ACI_AIFSN
{
258 }ACI_AIFSN
, *PACI_AIFSN
;
261 // ECWmin/ECWmax field.
262 // Ref: WMM spec 2.2.2: WME Parameter Element, p.13.
274 // AC Parameters Record Format.
275 // Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
277 typedef union _AC_PARAM
{
287 }AC_PARAM
, *PAC_PARAM
;
292 // QoS element subtype
294 typedef enum _QOS_ELE_SUBTYPE
{
295 QOSELE_TYPE_INFO
= 0x00, // 0x00: Information element
296 QOSELE_TYPE_PARAM
= 0x01, // 0x01: parameter element
297 }QOS_ELE_SUBTYPE
,*PQOS_ELE_SUBTYPE
;
301 // Direction Field Values.
302 // Ref: WMM spec 2.2.11: WME TSPEC Element, p.18.
304 typedef enum _DIRECTION_VALUE
{
305 DIR_UP
= 0, // 0x00 // UpLink
306 DIR_DOWN
= 1, // 0x01 // DownLink
307 DIR_DIRECT
= 2, // 0x10 // DirectLink
308 DIR_BI_DIR
= 3, // 0x11 // Bi-Direction
309 }DIRECTION_VALUE
,*PDIRECTION_VALUE
;
313 // TS Info field in WMM TSPEC Element.
315 // 1. WMM spec 2.2.11: WME TSPEC Element, p.18.
316 // 2. 8185 QoS code: QOS_TSINFO [def. in QoS_mp.h]
318 typedef union _QOS_TSINFO
{
321 u8 ucTrafficType
:1; //WMM is reserved
324 u8 ucAccessPolicy
:2; //WMM: bit8=0, bit7=1
325 u8 ucAggregation
:1; //WMM is reserved
326 u8 ucPSB
:1; //WMMSA is APSD
328 u8 ucTSInfoAckPolicy
:2; //WMM is reserved
329 u8 ucSchedule
:1; //WMM is reserved
332 }QOS_TSINFO
, *PQOS_TSINFO
;
336 // Ref: WMM spec 2.2.11: WME TSPEC Element, p.16.
338 typedef union _TSPEC_BODY
{
343 QOS_TSINFO TSInfo
; //u8 TSInfo[3];
350 u32 ServiceStartTime
;
357 u16 SurplusBandwidthAllowance
;
360 }TSPEC_BODY
, *PTSPEC_BODY
;
364 // WMM TSPEC Element.
365 // Ref: WMM spec 2.2.11: WME TSPEC Element, p.16.
367 typedef struct _WMM_TSPEC
{
375 } WMM_TSPEC
, *PWMM_TSPEC
;
378 // ACM implementation method.
379 // Annie, 2005-12-13.
381 typedef enum _ACM_METHOD
{
382 eAcmWay0_SwAndHw
= 0, // By SW and HW.
383 eAcmWay1_HW
= 1, // By HW.
384 eAcmWay2_SW
= 2, // By SW.
385 }ACM_METHOD
,*PACM_METHOD
;
392 u8 HwAcmCtl
; // TRUE: UsedTime exceed => Do NOT USE this AC. It wll be written to ACM_CONTROL(0xBF BIT 0/1/2 in 8185B).
395 typedef u8 AC_UAPSD
, *PAC_UAPSD
;
397 #define GET_VO_UAPSD(_apsd) ((_apsd) & BIT0)
398 #define SET_VO_UAPSD(_apsd) ((_apsd) |= BIT0)
400 #define GET_VI_UAPSD(_apsd) ((_apsd) & BIT1)
401 #define SET_VI_UAPSD(_apsd) ((_apsd) |= BIT1)
403 #define GET_BK_UAPSD(_apsd) ((_apsd) & BIT2)
404 #define SET_BK_UAPSD(_apsd) ((_apsd) |= BIT2)
406 #define GET_BE_UAPSD(_apsd) ((_apsd) & BIT3)
407 #define SET_BE_UAPSD(_apsd) ((_apsd) |= BIT3)
410 //typedef struct _TCLASS{
412 //} TCLASS, *PTCLASS;
413 typedef union _QOS_TCLAS
{
415 struct _TYPE_GENERAL
{
462 } QOS_TCLAS
, *PQOS_TCLAS
;
464 //typedef struct _WMM_TSTREAM{
467 //- AC (which to mapping)
468 //} WMM_TSTREAM, *PWMM_TSTREAM;
469 typedef struct _QOS_TSTREAM
{
473 } QOS_TSTREAM
, *PQOS_TSTREAM
;
475 //typedef struct _U_APSD{
476 //- TriggerEnable [4]
478 //- HighestAcBuffered
479 //} U_APSD, *PU_APSD;
482 // UAPSD function should be implemented by 2 data structure
483 // "Qos control field" and "Qos info field"
484 //typedef struct _QOS_UAPSD{
485 // u8 bTriggerEnable[4];
488 //} QOS_UAPSD, *PQOS_APSD;
490 //----------------------------------------------------------------------------
491 // 802.11 Management frame Status Code field
492 //----------------------------------------------------------------------------
493 typedef struct _OCTET_STRING
{
496 }OCTET_STRING
, *POCTET_STRING
;
499 // Ref: DOT11_QOS in 8185 code. [def. in QoS_mp.h]
501 typedef struct _STA_QOS
{
502 //DECLARE_RT_OBJECT(STA_QOS);
503 u8 WMMIEBuf
[MAX_WMMELE_LENGTH
];
506 // Part 1. Self QoS Mode.
507 QOS_MODE QosCapability
; //QoS Capability, 2006-06-14 Isaiah
508 QOS_MODE CurrentQosMode
;
510 // For WMM Power Save Mode :
511 // ACs are trigger/delivery enabled or legacy power save enabled. 2006-06-13 Isaiah
512 AC_UAPSD b4ac_Uapsd
; //VoUapsd(bit0), ViUapsd(bit1), BkUapsd(bit2), BeUapsd(bit3),
513 AC_UAPSD Curr4acUapsd
;
516 int NumBcnBeforeTrigger
;
518 // Part 2. EDCA Parameter (perAC)
520 u8 WMMParamEle
[WMM_PARAM_ELEMENT_SIZE
];
524 //2 ToDo: remove the Qos Info Field and replace it by the above WMM Info element.
525 // By Bruce, 2008-01-30.
526 // Part 2. EDCA Parameter (perAC)
527 QOS_INFO_FIELD QosInfoField_STA
; // Maintained by STA
528 QOS_INFO_FIELD QosInfoField_AP
; // Retrieved from AP
530 AC_PARAM CurAcParameters
[4];
534 ACM_METHOD AcmMethod
;
536 // Part 4. Per TID (Part 5: TCLASS will be described by TStream)
537 QOS_TSTREAM TStream
[16];
540 u32 QBssWirelessMode
;
545 // Enable/Disable Rx immediate BA capability.
552 // Ref: BssDscr in 8185 code. [def. in BssDscr.h]
554 typedef struct _BSS_QOS
{
557 u8 bdWMMIEBuf
[MAX_WMMELE_LENGTH
];
560 QOS_ELE_SUBTYPE EleSubType
;
565 QOS_INFO_FIELD QosInfoField
;
566 AC_PARAM AcParameter
[4];
571 // Ref: sQoSCtlLng and QoSCtl definition in 8185 QoS code.
572 //#define QoSCtl (( (Adapter->bRegQoS) && (Adapter->dot11QoS.QoSMode &(QOS_EDCA|QOS_HCCA)) ) ?sQoSCtlLng:0)
575 #define QOS_CTRL_LEN(_QosMode) ((_QosMode > QOS_DISABLE)? sQoSCtlLng : 0)
579 //UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP
580 //#define UP2AC(up) ((up<3)?((up==0)?1:0):(up>>1))
581 #define IsACValid(ac) ((ac<=7 )?true:false )
583 #endif // #ifndef __INC_QOS_TYPE_H