1 /******************************************************************************
2 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
4 * This program is distributed in the hope that it will be useful, but WITHOUT
5 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
9 * You should have received a copy of the GNU General Public License along with
10 * this program; if not, write to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
13 * The full GNU General Public License is included in this distribution in the
14 * file called LICENSE.
16 * Contact Information:
17 * wlanfae <wlanfae@realtek.com>
18 ******************************************************************************/
19 #ifndef __INC_QOS_TYPE_H
20 #define __INC_QOS_TYPE_H
22 #define BIT0 0x00000001
23 #define BIT1 0x00000002
24 #define BIT2 0x00000004
25 #define BIT3 0x00000008
26 #define BIT4 0x00000010
27 #define BIT5 0x00000020
28 #define BIT6 0x00000040
29 #define BIT7 0x00000080
30 #define BIT8 0x00000100
31 #define BIT9 0x00000200
32 #define BIT10 0x00000400
33 #define BIT11 0x00000800
34 #define BIT12 0x00001000
35 #define BIT13 0x00002000
36 #define BIT14 0x00004000
37 #define BIT15 0x00008000
38 #define BIT16 0x00010000
39 #define BIT17 0x00020000
40 #define BIT18 0x00040000
41 #define BIT19 0x00080000
42 #define BIT20 0x00100000
43 #define BIT21 0x00200000
44 #define BIT22 0x00400000
45 #define BIT23 0x00800000
46 #define BIT24 0x01000000
47 #define BIT25 0x02000000
48 #define BIT26 0x04000000
49 #define BIT27 0x08000000
50 #define BIT28 0x10000000
51 #define BIT29 0x20000000
52 #define BIT30 0x40000000
53 #define BIT31 0x80000000
55 #define MAX_WMMELE_LENGTH 64
57 typedef u32 QOS_MODE, *PQOS_MODE;
63 #define QOS_WMM_UAPSD 16 //WMM Power Save, 2006-06-14 Isaiah
65 #define AC_PARAM_SIZE 4
66 #define WMM_PARAM_ELE_BODY_LEN 18
69 // QoS ACK Policy Field Values
70 // Ref: WMM spec 2.1.6: QoS Control Field, p.10.
72 typedef enum _ACK_POLICY{
74 eAckPlc1_NoACK = 0x01,
75 }ACK_POLICY,*PACK_POLICY;
77 #define WMM_PARAM_ELEMENT_SIZE (8+(4*AC_PARAM_SIZE))
82 // 1. WMM spec 2.1.6: QoS Control Field, p.9.
83 // 2. 802.11e/D13.0 7.1.3.5, p.26.
85 typedef union _QOS_CTRL_FIELD{
100 // 802.11e: QoS data type frame sent by non-AP QSTAs.
104 u8 bIsQsize:1;// 0: BIT[8:15] is TXOP Duration Requested, 1: BIT[8:15] is Queue Size.
107 u8 TxopOrQsize; // (BIT4=0)TXOP Duration Requested or (BIT4=1)Queue Size.
110 // 802.11e: QoS data, QoS Null, and QoS Data+CF-Ack frames sent by HC.
117 u8 PSBufState; // QAP PS Buffer State.
120 // 802.11e: QoS (+) CF-Poll frames sent by HC.
127 u8 TxopLimit; // TXOP Limit.
130 }QOS_CTRL_FIELD, *PQOS_CTRL_FIELD;
136 // 1. WMM spec 2.2.1: WME Information Element, p.11.
137 // 2. 8185 QoS code: QOS_INFO [def. in QoS_mp.h]
139 typedef union _QOS_INFO_FIELD{
144 u8 ucParameterSetCount:4;
150 //Ref WMM_Specification_1-1.pdf, 2006-06-13 Isaiah
163 //Ref WMM_Specification_1-1.pdf, 2006-06-13 Isaiah
164 u8 ucParameterSetCount:4;
182 u8 ucParameterSetCount:4;
219 u8 ucParameterSetCount:4;
226 }QOS_INFO_FIELD, *PQOS_INFO_FIELD;
228 typedef u32 AC_CODING;
229 #define AC0_BE 0 // ACI: 0x00 // Best Effort
230 #define AC1_BK 1 // ACI: 0x01 // Background
231 #define AC2_VI 2 // ACI: 0x10 // Video
232 #define AC3_VO 3 // ACI: 0x11 // Voice
233 #define AC_MAX 4 // Max: define total number; Should not to be used as a real enum.
237 // Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
239 typedef union _ACI_AIFSN{
249 }ACI_AIFSN, *PACI_AIFSN;
252 // ECWmin/ECWmax field.
253 // Ref: WMM spec 2.2.2: WME Parameter Element, p.13.
265 // AC Parameters Record Format.
266 // Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
268 typedef union _AC_PARAM{
278 }AC_PARAM, *PAC_PARAM;
283 // QoS element subtype
285 typedef enum _QOS_ELE_SUBTYPE{
286 QOSELE_TYPE_INFO = 0x00, // 0x00: Information element
287 QOSELE_TYPE_PARAM = 0x01, // 0x01: parameter element
288 }QOS_ELE_SUBTYPE,*PQOS_ELE_SUBTYPE;
292 // Direction Field Values.
293 // Ref: WMM spec 2.2.11: WME TSPEC Element, p.18.
295 typedef enum _DIRECTION_VALUE{
296 DIR_UP = 0, // 0x00 // UpLink
297 DIR_DOWN = 1, // 0x01 // DownLink
298 DIR_DIRECT = 2, // 0x10 // DirectLink
299 DIR_BI_DIR = 3, // 0x11 // Bi-Direction
300 }DIRECTION_VALUE,*PDIRECTION_VALUE;
304 // TS Info field in WMM TSPEC Element.
306 // 1. WMM spec 2.2.11: WME TSPEC Element, p.18.
307 // 2. 8185 QoS code: QOS_TSINFO [def. in QoS_mp.h]
309 typedef union _QOS_TSINFO{
312 u8 ucTrafficType:1; //WMM is reserved
315 u8 ucAccessPolicy:2; //WMM: bit8=0, bit7=1
316 u8 ucAggregation:1; //WMM is reserved
317 u8 ucPSB:1; //WMMSA is APSD
319 u8 ucTSInfoAckPolicy:2; //WMM is reserved
320 u8 ucSchedule:1; //WMM is reserved
323 }QOS_TSINFO, *PQOS_TSINFO;
327 // Ref: WMM spec 2.2.11: WME TSPEC Element, p.16.
329 typedef union _TSPEC_BODY{
334 QOS_TSINFO TSInfo; //u8 TSInfo[3];
341 u32 ServiceStartTime;
348 u16 SurplusBandwidthAllowance;
351 }TSPEC_BODY, *PTSPEC_BODY;
355 // WMM TSPEC Element.
356 // Ref: WMM spec 2.2.11: WME TSPEC Element, p.16.
358 typedef struct _WMM_TSPEC{
366 } WMM_TSPEC, *PWMM_TSPEC;
369 // ACM implementation method.
370 // Annie, 2005-12-13.
372 typedef enum _ACM_METHOD{
373 eAcmWay0_SwAndHw = 0, // By SW and HW.
374 eAcmWay1_HW = 1, // By HW.
375 eAcmWay2_SW = 2, // By SW.
376 }ACM_METHOD,*PACM_METHOD;
382 u8 HwAcmCtl; // TRUE: UsedTime exceed => Do NOT USE this AC. It wll be written to ACM_CONTROL(0xBF BIT 0/1/2 in 8185B).
385 typedef u8 AC_UAPSD, *PAC_UAPSD;
387 #define GET_VO_UAPSD(_apsd) ((_apsd) & BIT0)
388 #define SET_VO_UAPSD(_apsd) ((_apsd) |= BIT0)
390 #define GET_VI_UAPSD(_apsd) ((_apsd) & BIT1)
391 #define SET_VI_UAPSD(_apsd) ((_apsd) |= BIT1)
393 #define GET_BK_UAPSD(_apsd) ((_apsd) & BIT2)
394 #define SET_BK_UAPSD(_apsd) ((_apsd) |= BIT2)
396 #define GET_BE_UAPSD(_apsd) ((_apsd) & BIT3)
397 #define SET_BE_UAPSD(_apsd) ((_apsd) |= BIT3)
399 typedef union _QOS_TCLAS{
401 struct _TYPE_GENERAL{
448 } QOS_TCLAS, *PQOS_TCLAS;
450 typedef struct _QOS_TSTREAM{
454 } QOS_TSTREAM, *PQOS_TSTREAM;
456 //----------------------------------------------------------------------------
457 // 802.11 Management frame Status Code field
458 //----------------------------------------------------------------------------
459 typedef struct _OCTET_STRING{
462 }OCTET_STRING, *POCTET_STRING;
466 // Ref: DOT11_QOS in 8185 code. [def. in QoS_mp.h]
468 typedef struct _STA_QOS{
469 u8 WMMIEBuf[MAX_WMMELE_LENGTH];
472 // Part 1. Self QoS Mode.
473 QOS_MODE QosCapability; //QoS Capability, 2006-06-14 Isaiah
474 QOS_MODE CurrentQosMode;
476 // For WMM Power Save Mode :
477 // ACs are trigger/delivery enabled or legacy power save enabled. 2006-06-13 Isaiah
478 AC_UAPSD b4ac_Uapsd; //VoUapsd(bit0), ViUapsd(bit1), BkUapsd(bit2), BeUapsd(bit3),
479 AC_UAPSD Curr4acUapsd;
482 int NumBcnBeforeTrigger;
484 // Part 2. EDCA Parameter (perAC)
486 u8 WMMParamEle[WMM_PARAM_ELEMENT_SIZE];
490 //2 ToDo: remove the Qos Info Field and replace it by the above WMM Info element.
491 // By Bruce, 2008-01-30.
492 // Part 2. EDCA Parameter (perAC)
493 QOS_INFO_FIELD QosInfoField_STA; // Maintained by STA
494 QOS_INFO_FIELD QosInfoField_AP; // Retrieved from AP
496 AC_PARAM CurAcParameters[4];
500 ACM_METHOD AcmMethod;
502 // Part 4. Per TID (Part 5: TCLASS will be described by TStream)
503 QOS_TSTREAM TStream[16];
506 u32 QBssWirelessMode;
511 // Enable/Disable Rx immediate BA capability.
518 // Ref: BssDscr in 8185 code. [def. in BssDscr.h]
520 typedef struct _BSS_QOS{
523 u8 bdWMMIEBuf[MAX_WMMELE_LENGTH];
526 QOS_ELE_SUBTYPE EleSubType;
531 QOS_INFO_FIELD QosInfoField;
532 AC_PARAM AcParameter[4];
536 #define QOS_CTRL_LEN(_QosMode) ((_QosMode > QOS_DISABLE)? sQoSCtlLng : 0)
538 #define IsACValid(ac) ((ac<=7 )?true:false )