Merge branch 'drm-tda998x-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into...
[firefly-linux-kernel-4.4.55.git] / drivers / staging / rtl8192e / rtl819x_Qos.h
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 #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
54
55 union qos_tsinfo {
56         u8              charData[3];
57         struct {
58                 u8              ucTrafficType:1;
59                 u8              ucTSID:4;
60                 u8              ucDirection:2;
61                 u8              ucAccessPolicy:2;
62                 u8              ucAggregation:1;
63                 u8              ucPSB:1;
64                 u8              ucUP:3;
65                 u8              ucTSInfoAckPolicy:2;
66                 u8              ucSchedule:1;
67                 u8              ucReserved:7;
68         } field;
69 };
70
71 union tspec_body {
72         u8              charData[55];
73
74         struct {
75                 union qos_tsinfo TSInfo;
76                 u16     NominalMSDUsize;
77                 u16     MaxMSDUsize;
78                 u32     MinServiceItv;
79                 u32     MaxServiceItv;
80                 u32     InactivityItv;
81                 u32     SuspenItv;
82                 u32     ServiceStartTime;
83                 u32     MinDataRate;
84                 u32     MeanDataRate;
85                 u32     PeakDataRate;
86                 u32     MaxBurstSize;
87                 u32     DelayBound;
88                 u32     MinPhyRate;
89                 u16     SurplusBandwidthAllowance;
90                 u16     MediumTime;
91         } f;
92 };
93
94 struct octet_string {
95         u8 *Octet;
96         u16 Length;
97 };
98
99 #define AC0_BE  0
100 #define AC1_BK  1
101 #define AC2_VI  2
102 #define AC3_VO  3
103 #define AC_MAX  4
104
105 enum direction_value {
106         DIR_UP                  = 0,
107         DIR_DOWN                = 1,
108         DIR_DIRECT              = 2,
109         DIR_BI_DIR              = 3,
110 };
111
112 enum acm_method {
113         eAcmWay0_SwAndHw                = 0,
114         eAcmWay1_HW                     = 1,
115         eAcmWay2_SW                     = 2,
116 };
117
118
119 struct acm {
120         u64             UsedTime;
121         u64             MediumTime;
122         u8              HwAcmCtl;
123 };
124
125 union qos_tclas {
126
127         struct _TYPE_GENERAL {
128                 u8              Priority;
129                 u8              ClassifierType;
130                 u8              Mask;
131         } TYPE_GENERAL;
132
133         struct _TYPE0_ETH {
134                 u8              Priority;
135                 u8              ClassifierType;
136                 u8              Mask;
137                 u8              SrcAddr[ETH_ALEN];
138                 u8              DstAddr[ETH_ALEN];
139                 u16             Type;
140         } TYPE0_ETH;
141
142         struct _TYPE1_IPV4 {
143                 u8              Priority;
144                 u8              ClassifierType;
145                 u8              Mask;
146                 u8              Version;
147                 u8              SrcIP[4];
148                 u8              DstIP[4];
149                 u16             SrcPort;
150                 u16             DstPort;
151                 u8              DSCP;
152                 u8              Protocol;
153                 u8              Reserved;
154         } TYPE1_IPV4;
155
156         struct _TYPE1_IPV6 {
157                 u8              Priority;
158                 u8              ClassifierType;
159                 u8              Mask;
160                 u8              Version;
161                 u8              SrcIP[16];
162                 u8              DstIP[16];
163                 u16             SrcPort;
164                 u16             DstPort;
165                 u8              FlowLabel[3];
166         } TYPE1_IPV6;
167
168         struct _TYPE2_8021Q {
169                 u8              Priority;
170                 u8              ClassifierType;
171                 u8              Mask;
172                 u16             TagType;
173         } TYPE2_8021Q;
174 };
175
176 #define IsACValid(ac)           ((ac >= 0 && ac <= 7) ? true : false)
177
178
179 union aci_aifsn {
180         u8      charData;
181
182         struct {
183                 u8      AIFSN:4;
184                 u8      acm:1;
185                 u8      ACI:2;
186                 u8      Reserved:1;
187         } f;
188 };
189
190 #endif