staging: rtl8192e: Convert typedef QOS_ELE_SUBTYPE to enum qos_ele_subtype
[deliverable/linux.git] / drivers / staging / rtl8192e / rtl819x_Qos.h
CommitLineData
94a79942
LF
1/******************************************************************************
2 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
3 *
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
7 * more details.
8 *
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
12 *
13 * The full GNU General Public License is included in this distribution in the
14 * file called LICENSE.
15 *
16 * Contact Information:
17 * wlanfae <wlanfae@realtek.com>
18******************************************************************************/
19#ifndef __INC_QOS_TYPE_H
20#define __INC_QOS_TYPE_H
21
22#include "rtllib_endianfree.h"
23
24#define BIT0 0x00000001
25#define BIT1 0x00000002
26#define BIT2 0x00000004
27#define BIT3 0x00000008
28#define BIT4 0x00000010
29#define BIT5 0x00000020
30#define BIT6 0x00000040
31#define BIT7 0x00000080
32#define BIT8 0x00000100
33#define BIT9 0x00000200
34#define BIT10 0x00000400
35#define BIT11 0x00000800
36#define BIT12 0x00001000
37#define BIT13 0x00002000
38#define BIT14 0x00004000
39#define BIT15 0x00008000
40#define BIT16 0x00010000
41#define BIT17 0x00020000
42#define BIT18 0x00040000
43#define BIT19 0x00080000
44#define BIT20 0x00100000
45#define BIT21 0x00200000
46#define BIT22 0x00400000
47#define BIT23 0x00800000
48#define BIT24 0x01000000
49#define BIT25 0x02000000
50#define BIT26 0x04000000
51#define BIT27 0x08000000
52#define BIT28 0x10000000
53#define BIT29 0x20000000
54#define BIT30 0x40000000
55#define BIT31 0x80000000
56
42c53e7a 57union qos_tsinfo {
94a79942
LF
58 u8 charData[3];
59 struct {
60 u8 ucTrafficType:1;
61 u8 ucTSID:4;
62 u8 ucDirection:2;
63 u8 ucAccessPolicy:2;
64 u8 ucAggregation:1;
65 u8 ucPSB:1;
66 u8 ucUP:3;
67 u8 ucTSInfoAckPolicy:2;
68 u8 ucSchedule:1;
69 u8 ucReserved:7;
70 }field;
42c53e7a
LF
71};
72
ed306e48 73union tspec_body {
94a79942
LF
74 u8 charData[55];
75
76 struct
77 {
42c53e7a 78 union qos_tsinfo TSInfo;
94a79942
LF
79 u16 NominalMSDUsize;
80 u16 MaxMSDUsize;
81 u32 MinServiceItv;
82 u32 MaxServiceItv;
83 u32 InactivityItv;
84 u32 SuspenItv;
85 u32 ServiceStartTime;
86 u32 MinDataRate;
87 u32 MeanDataRate;
88 u32 PeakDataRate;
89 u32 MaxBurstSize;
90 u32 DelayBound;
91 u32 MinPhyRate;
92 u16 SurplusBandwidthAllowance;
93 u16 MediumTime;
94 } f;
ed306e48 95};
94a79942 96
95ce5fc9 97struct wmm_tspec {
94a79942
LF
98 u8 ID;
99 u8 Length;
100 u8 OUI[3];
101 u8 OUI_Type;
102 u8 OUI_SubType;
103 u8 Version;
ed306e48 104 union tspec_body Body;
95ce5fc9 105};
94a79942 106
8310b6c0 107struct octet_string {
94a79942
LF
108 u8 *Octet;
109 u16 Length;
d3b2c172 110};
94a79942
LF
111#define MAX_WMMELE_LENGTH 64
112
113typedef u32 QOS_MODE, *PQOS_MODE;
114#define QOS_DISABLE 0
115#define QOS_WMM 1
116#define QOS_WMMSA 2
117#define QOS_EDCA 4
118#define QOS_HCCA 8
119#define QOS_WMM_UAPSD 16
120
121#define WMM_PARAM_ELE_BODY_LEN 18
122
123#define MAX_STA_TS_COUNT 16
124#define MAX_AP_TS_COUNT 32
125#define QOS_TSTREAM_KEY_SIZE 13
126
127#define WMM_ACTION_CATEGORY_CODE 17
128#define WMM_PARAM_ELE_BODY_LEN 18
129
130#define MAX_TSPEC_TSID 15
131#define SESSION_REJECT_TSID 0xfe
132#define DEFAULT_TSID 0xff
133
134#define ADDTS_TIME_SLOT 100
135
136#define ACM_TIMEOUT 1000
137#define SESSION_REJECT_TIMEOUT 60000
138
4164e4de 139enum ack_policy {
94a79942
LF
140 eAckPlc0_ACK = 0x00,
141 eAckPlc1_NoACK = 0x01,
4164e4de 142};
94a79942
LF
143
144
145#define SET_WMM_QOS_INFO_FIELD(_pStart, _val) WriteEF1Byte(_pStart, _val)
146
147#define GET_WMM_QOS_INFO_FIELD_PARAMETERSET_COUNT(_pStart) LE_BITS_TO_1BYTE(_pStart, 0, 4)
148#define SET_WMM_QOS_INFO_FIELD_PARAMETERSET_COUNT(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 0, 4, _val)
149
150#define GET_WMM_QOS_INFO_FIELD_AP_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 7, 1)
151#define SET_WMM_QOS_INFO_FIELD_AP_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 7, 1, _val)
152
153#define GET_WMM_QOS_INFO_FIELD_STA_AC_VO_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 0, 1)
154#define SET_WMM_QOS_INFO_FIELD_STA_AC_VO_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 0, 1, _val)
155
156#define GET_WMM_QOS_INFO_FIELD_STA_AC_VI_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 1, 1)
157#define SET_WMM_QOS_INFO_FIELD_STA_AC_VI_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 1, 1, _val)
158
159#define GET_WMM_QOS_INFO_FIELD_STA_AC_BE_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 2, 1)
160#define SET_WMM_QOS_INFO_FIELD_STA_AC_BE_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 2, 1, _val)
161
162#define GET_WMM_QOS_INFO_FIELD_STA_AC_BK_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 3, 1)
163#define SET_WMM_QOS_INFO_FIELD_STA_AC_BK_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 3, 1, _val)
164
165#define GET_WMM_QOS_INFO_FIELD_STA_MAX_SP_LEN(_pStart) LE_BITS_TO_1BYTE(_pStart, 5, 2)
166#define SET_WMM_QOS_INFO_FIELD_STA_MAX_SP_LEN(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 5, 2, _val)
167
f58a1cd9 168enum qos_ie_source {
94a79942
LF
169 QOSIE_SRC_ADDTSREQ,
170 QOSIE_SRC_ADDTSRSP,
171 QOSIE_SRC_REASOCREQ,
172 QOSIE_SRC_REASOCRSP,
173 QOSIE_SRC_DELTS,
f58a1cd9 174};
94a79942
LF
175
176
177typedef u32 AC_CODING;
178#define AC0_BE 0
179#define AC1_BK 1
180#define AC2_VI 2
181#define AC3_VO 3
182#define AC_MAX 4
183
184
185#define AC_PARAM_SIZE 4
186
187#define GET_WMM_AC_PARAM_AIFSN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 0, 4) )
188#define SET_WMM_AC_PARAM_AIFSN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 0, 4, _val)
189
190#define GET_WMM_AC_PARAM_ACM(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 4, 1) )
191#define SET_WMM_AC_PARAM_ACM(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 4, 1, _val)
192
193#define GET_WMM_AC_PARAM_ACI(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 5, 2) )
194#define SET_WMM_AC_PARAM_ACI(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 5, 2, _val)
195
196#define GET_WMM_AC_PARAM_ACI_AIFSN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 0, 8) )
197#define SET_WMM_AC_PARAM_ACI_AIFSN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 0, 8, _val)
198
199#define GET_WMM_AC_PARAM_ECWMIN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 8, 4) )
200#define SET_WMM_AC_PARAM_ECWMIN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 8, 4, _val)
201
202#define GET_WMM_AC_PARAM_ECWMAX(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 12, 4) )
203#define SET_WMM_AC_PARAM_ECWMAX(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 12, 4, _val)
204
205#define GET_WMM_AC_PARAM_TXOP_LIMIT(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 16, 16) )
206#define SET_WMM_AC_PARAM_TXOP_LIMIT(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 16, 16, _val)
207
208
209
210#define WMM_PARAM_ELEMENT_SIZE (8+(4*AC_PARAM_SIZE))
211
f58a1cd9 212enum qos_ele_subtype {
94a79942
LF
213 QOSELE_TYPE_INFO = 0x00,
214 QOSELE_TYPE_PARAM = 0x01,
f58a1cd9 215};
94a79942
LF
216
217
218typedef enum _DIRECTION_VALUE{
219 DIR_UP = 0,
220 DIR_DOWN = 1,
221 DIR_DIRECT = 2,
222 DIR_BI_DIR = 3,
d3b2c172 223} DIRECTION_VALUE,*PDIRECTION_VALUE;
94a79942
LF
224
225typedef enum _ACM_METHOD{
226 eAcmWay0_SwAndHw = 0,
227 eAcmWay1_HW = 1,
228 eAcmWay2_SW = 2,
d3b2c172 229} ACM_METHOD,*PACM_METHOD;
94a79942
LF
230
231
b0d7de73 232struct acm {
94a79942
LF
233 u64 UsedTime;
234 u64 MediumTime;
235 u8 HwAcmCtl;
d3b2c172 236};
94a79942
LF
237
238
239
240typedef u8 AC_UAPSD, *PAC_UAPSD;
241
242#define GET_VO_UAPSD(_apsd) ((_apsd) & BIT0)
243#define SET_VO_UAPSD(_apsd) ((_apsd) |= BIT0)
244
245#define GET_VI_UAPSD(_apsd) ((_apsd) & BIT1)
246#define SET_VI_UAPSD(_apsd) ((_apsd) |= BIT1)
247
248#define GET_BK_UAPSD(_apsd) ((_apsd) & BIT2)
249#define SET_BK_UAPSD(_apsd) ((_apsd) |= BIT2)
250
251#define GET_BE_UAPSD(_apsd) ((_apsd) & BIT3)
252#define SET_BE_UAPSD(_apsd) ((_apsd) |= BIT3)
253
626f951d 254union qos_tclas {
94a79942
LF
255
256 struct _TYPE_GENERAL{
257 u8 Priority;
258 u8 ClassifierType;
259 u8 Mask;
260 } TYPE_GENERAL;
261
262 struct _TYPE0_ETH{
263 u8 Priority;
264 u8 ClassifierType;
265 u8 Mask;
266 u8 SrcAddr[6];
267 u8 DstAddr[6];
268 u16 Type;
269 } TYPE0_ETH;
270
271 struct _TYPE1_IPV4{
272 u8 Priority;
273 u8 ClassifierType;
274 u8 Mask;
275 u8 Version;
276 u8 SrcIP[4];
277 u8 DstIP[4];
278 u16 SrcPort;
279 u16 DstPort;
280 u8 DSCP;
281 u8 Protocol;
282 u8 Reserved;
283 } TYPE1_IPV4;
284
285 struct _TYPE1_IPV6{
286 u8 Priority;
287 u8 ClassifierType;
288 u8 Mask;
289 u8 Version;
290 u8 SrcIP[16];
291 u8 DstIP[16];
292 u16 SrcPort;
293 u16 DstPort;
294 u8 FlowLabel[3];
295 } TYPE1_IPV6;
296
297 struct _TYPE2_8021Q{
298 u8 Priority;
299 u8 ClassifierType;
300 u8 Mask;
301 u16 TagType;
302 } TYPE2_8021Q;
626f951d 303};
94a79942 304
1d2a55fb 305struct qos_tstream {
94a79942
LF
306
307 bool bUsed;
308 u16 MsduLifetime;
309 bool bEstablishing;
310 u8 TimeSlotCount;
311 u8 DialogToken;
95ce5fc9
LF
312 struct wmm_tspec TSpec;
313 struct wmm_tspec OutStandingTSpec;
94a79942 314 u8 NominalPhyRate;
1d2a55fb 315};
94a79942 316
0db42799 317struct sta_qos {
94a79942
LF
318 u8 WMMIEBuf[MAX_WMMELE_LENGTH];
319 u8* WMMIE;
320
321 QOS_MODE QosCapability;
322 QOS_MODE CurrentQosMode;
323
324 AC_UAPSD b4ac_Uapsd;
325 AC_UAPSD Curr4acUapsd;
326 u8 bInServicePeriod;
327 u8 MaxSPLength;
328 int NumBcnBeforeTrigger;
329
330 u8 * pWMMInfoEle;
331 u8 WMMParamEle[WMM_PARAM_ELEMENT_SIZE];
332
b0d7de73 333 struct acm acm[4];
94a79942
LF
334 ACM_METHOD AcmMethod;
335
1d2a55fb 336 struct qos_tstream StaTsArray[MAX_STA_TS_COUNT];
94a79942 337 u8 DialogToken;
95ce5fc9 338 struct wmm_tspec TSpec;
94a79942
LF
339
340 u8 QBssWirelessMode;
341
342 bool bNoAck;
343
344 bool bEnableRxImmBA;
345
d3b2c172 346};
94a79942
LF
347
348#define QBSS_LOAD_SIZE 5
349#define GET_QBSS_LOAD_STA_COUNT(__pStart) ReadEF2Byte(__pStart)
350#define SET_QBSS_LOAD_STA_COUNT(__pStart, __Value) WriteEF2Byte(__pStart, __Value)
351#define GET_QBSS_LOAD_CHNL_UTILIZATION(__pStart) ReadEF1Byte((u8*)(__pStart) + 2)
352#define SET_QBSS_LOAD_CHNL_UTILIZATION(__pStart, __Value) WriteEF1Byte((u8*)(__pStart) + 2, __Value)
353#define GET_QBSS_LOAD_AVAILABLE_CAPACITY(__pStart) ReadEF2Byte((u8*)(__pStart) + 3)
354#define SET_QBSS_LOAD_AVAILABLE_CAPACITY(__pStart, __Value) WriteEF2Byte((u8*)(__pStart) + 3, __Value)
355
0157d2e5 356struct bss_qos {
94a79942
LF
357
358 QOS_MODE bdQoSMode;
359 u8 bdWMMIEBuf[MAX_WMMELE_LENGTH];
8310b6c0 360 struct octet_string bdWMMIE;
94a79942 361
f58a1cd9 362 enum qos_ele_subtype EleSubType;
94a79942
LF
363
364 u8* pWMMInfoEle;
365 u8* pWMMParamEle;
366
367 u8 QBssLoad[QBSS_LOAD_SIZE];
368 bool bQBssLoadValid;
d3b2c172 369};
94a79942
LF
370
371#define sQoSCtlLng 2
372#define QOS_CTRL_LEN(_QosMode) ( (_QosMode > QOS_DISABLE)? sQoSCtlLng : 0 )
373
374
375#define IsACValid(ac) ( ( ac>=0 && ac<=7 )? true : false )
376
377
44a40046 378union aci_aifsn {
94a79942
LF
379 u8 charData;
380
381 struct
382 {
383 u8 AIFSN:4;
b0d7de73 384 u8 acm:1;
94a79942
LF
385 u8 ACI:2;
386 u8 Reserved:1;
387 }f;
44a40046 388};
94a79942 389
a33be1e8 390union ecw {
94a79942
LF
391 u8 charData;
392 struct
393 {
394 u8 ECWmin:4;
395 u8 ECWmax:4;
396 }f;
a33be1e8 397};
94a79942 398
eb85e468 399union ac_param {
94a79942
LF
400 u32 longData;
401 u8 charData[4];
402
403 struct
404 {
44a40046 405 union aci_aifsn AciAifsn;
a33be1e8 406 union ecw Ecw;
94a79942
LF
407 u16 TXOPLimit;
408 }f;
eb85e468 409};
94a79942
LF
410
411#endif
This page took 0.055156 seconds and 5 git commands to generate.