Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6] / drivers / staging / rt3070 / aironet.h
1 /*
2  *************************************************************************
3  * Ralink Tech Inc.
4  * 5F., No.36, Taiyuan St., Jhubei City,
5  * Hsinchu County 302,
6  * Taiwan, R.O.C.
7  *
8  * (c) Copyright 2002-2007, Ralink Technology, Inc.
9  *
10  * This program is free software; you can redistribute it and/or modify  *
11  * it under the terms of the GNU General Public License as published by  *
12  * the Free Software Foundation; either version 2 of the License, or     *
13  * (at your option) any later version.                                   *
14  *                                                                       *
15  * This program is distributed in the hope that it will be useful,       *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
18  * GNU General Public License for more details.                          *
19  *                                                                       *
20  * You should have received a copy of the GNU General Public License     *
21  * along with this program; if not, write to the                         *
22  * Free Software Foundation, Inc.,                                       *
23  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
24  *                                                                       *
25  *************************************************************************
26
27         Module Name:
28         aironet.h
29
30         Abstract:
31
32         Revision History:
33         Who                     When                    What
34         --------        ----------              ----------------------------------------------
35         Name            Date                    Modification logs
36         Paul Lin        04-06-15                Initial
37 */
38
39 #ifndef __AIRONET_H__
40 #define __AIRONET_H__
41
42 // Measurement Type definition
43 #define MSRN_TYPE_UNUSED                                0
44 #define MSRN_TYPE_CHANNEL_LOAD_REQ              1
45 #define MSRN_TYPE_NOISE_HIST_REQ                2
46 #define MSRN_TYPE_BEACON_REQ                    3
47 #define MSRN_TYPE_FRAME_REQ                             4
48
49 // Scan Mode in Beacon Request
50 #define MSRN_SCAN_MODE_PASSIVE                  0
51 #define MSRN_SCAN_MODE_ACTIVE                   1
52 #define MSRN_SCAN_MODE_BEACON_TABLE             2
53
54 // PHY type definition for Aironet beacon report, CCX 2 table 36-9
55 #define PHY_FH                                                  1
56 #define PHY_DSS                                                 2
57 #define PHY_UNUSED                                              3
58 #define PHY_OFDM                                                4
59 #define PHY_HR_DSS                                              5
60 #define PHY_ERP                                                 6
61
62 // RPI table in dBm
63 #define RPI_0                   0                       //      Power <= -87
64 #define RPI_1                   1                       //      -87 < Power <= -82
65 #define RPI_2                   2                       //      -82 < Power <= -77
66 #define RPI_3                   3                       //      -77 < Power <= -72
67 #define RPI_4                   4                       //      -72 < Power <= -67
68 #define RPI_5                   5                       //      -67 < Power <= -62
69 #define RPI_6                   6                       //      -62 < Power <= -57
70 #define RPI_7                   7                       //      -57 < Power
71
72 // Cisco Aironet IAPP definetions
73 #define AIRONET_IAPP_TYPE                                       0x32
74 #define AIRONET_IAPP_SUBTYPE_REQUEST            0x01
75 #define AIRONET_IAPP_SUBTYPE_REPORT                     0x81
76
77 // Measurement Request detail format
78 typedef struct  _MEASUREMENT_REQUEST    {
79         UCHAR   Channel;
80         UCHAR   ScanMode;                       // Use only in beacon request, other requests did not use this field
81         USHORT  Duration;
82 }       MEASUREMENT_REQUEST, *PMEASUREMENT_REQUEST;
83
84 // Beacon Measurement Report
85 // All these field might change to UCHAR, because we didn't do anything to these report.
86 // We copy all these beacons and report to CCX 2 AP.
87 typedef struct  _BEACON_REPORT  {
88         UCHAR   Channel;
89         UCHAR   Spare;
90         USHORT  Duration;
91         UCHAR   PhyType;                        // Definiation is listed above table 36-9
92         UCHAR   RxPower;
93         UCHAR   BSSID[6];
94         UCHAR   ParentTSF[4];
95         UCHAR   TargetTSF[8];
96         USHORT  BeaconInterval;
97         USHORT  CapabilityInfo;
98 }       BEACON_REPORT, *PBEACON_REPORT;
99
100 // Frame Measurement Report (Optional)
101 typedef struct  _FRAME_REPORT   {
102         UCHAR   Channel;
103         UCHAR   Spare;
104         USHORT  Duration;
105         UCHAR   TA;
106         UCHAR   BSSID[6];
107         UCHAR   RSSI;
108         UCHAR   Count;
109 }       FRAME_REPORT, *PFRAME_REPORT;
110
111 #pragma pack(1)
112 // Channel Load Report
113 typedef struct  _CHANNEL_LOAD_REPORT    {
114         UCHAR   Channel;
115         UCHAR   Spare;
116         USHORT  Duration;
117         UCHAR   CCABusy;
118 }       CHANNEL_LOAD_REPORT, *PCHANNEL_LOAD_REPORT;
119 #pragma pack()
120
121 // Nosie Histogram Report
122 typedef struct  _NOISE_HIST_REPORT      {
123         UCHAR   Channel;
124         UCHAR   Spare;
125         USHORT  Duration;
126         UCHAR   Density[8];
127 }       NOISE_HIST_REPORT, *PNOISE_HIST_REPORT;
128
129 // Radio Management Capability element
130 typedef struct  _RADIO_MANAGEMENT_CAPABILITY    {
131         UCHAR   Eid;                            // TODO: Why the Eid is 1 byte, not normal 2 bytes???
132         UCHAR   Length;
133         UCHAR   AironetOui[3];          // AIronet OUI (00 40 96)
134         UCHAR   Type;                           // Type / Version
135         USHORT  Status;                         // swap16 required
136 }       RADIO_MANAGEMENT_CAPABILITY, *PRADIO_MANAGEMENT_CAPABILITY;
137
138 // Measurement Mode Bit definition
139 typedef struct  _MEASUREMENT_MODE       {
140         UCHAR   Rsvd:4;
141         UCHAR   Report:1;
142         UCHAR   NotUsed:1;
143         UCHAR   Enable:1;
144         UCHAR   Parallel:1;
145 }       MEASUREMENT_MODE, *PMEASUREMENT_MODE;
146
147 // Measurement Request element, This is little endian mode
148 typedef struct  _MEASUREMENT_REQUEST_ELEMENT    {
149         USHORT                          Eid;
150         USHORT                          Length;                         // swap16 required
151         USHORT                          Token;                          // non-zero unique token
152         UCHAR                           Mode;                           // Measurement Mode
153         UCHAR                           Type;                           // Measurement type
154 }       MEASUREMENT_REQUEST_ELEMENT, *PMEASUREMENT_REQUEST_ELEMENT;
155
156 // Measurement Report element, This is little endian mode
157 typedef struct  _MEASUREMENT_REPORT_ELEMENT     {
158         USHORT                          Eid;
159         USHORT                          Length;                         // swap16 required
160         USHORT                          Token;                          // non-zero unique token
161         UCHAR                           Mode;                           // Measurement Mode
162         UCHAR                           Type;                           // Measurement type
163 }       MEASUREMENT_REPORT_ELEMENT, *PMEASUREMENT_REPORT_ELEMENT;
164
165 // Cisco Aironet IAPP Frame Header, Network byte order used
166 typedef struct  _AIRONET_IAPP_HEADER {
167         UCHAR   CiscoSnapHeader[8];     // 8 bytes Cisco snap header
168         USHORT  Length;                         // IAPP ID & length, remember to swap16 in LE system
169         UCHAR   Type;                           // IAPP type
170         UCHAR   SubType;                        // IAPP subtype
171         UCHAR   DA[6];                          // Destination MAC address
172         UCHAR   SA[6];                          // Source MAC address
173         USHORT  Token;                          // Dialog token, no need to swap16 since it is for yoken usage only
174 }       AIRONET_IAPP_HEADER, *PAIRONET_IAPP_HEADER;
175
176 // Radio Measurement Request frame
177 typedef struct  _AIRONET_RM_REQUEST_FRAME       {
178     AIRONET_IAPP_HEADER IAPP;                   // Common header
179         UCHAR                           Delay;                  // Activation Delay
180         UCHAR                           Offset;                 // Measurement offset
181 }       AIRONET_RM_REQUEST_FRAME, *PAIRONET_RM_REQUEST_FRAME;
182
183 // Radio Measurement Report frame
184 typedef struct  _AIRONET_RM_REPORT_FRAME        {
185     AIRONET_IAPP_HEADER IAPP;                   // Common header
186 }       AIRONET_RM_REPORT_FRAME, *PAIRONET_RM_REPORT_FRAME;
187
188 // Saved element request actions which will saved in StaCfg.
189 typedef struct  _RM_REQUEST_ACTION      {
190         MEASUREMENT_REQUEST_ELEMENT     ReqElem;                // Saved request element
191         MEASUREMENT_REQUEST                     Measurement;    // Saved measurement within the request element
192 }       RM_REQUEST_ACTION, *PRM_REQUEST_ACTION;
193
194 // CCX administration control
195 typedef union   _CCX_CONTROL    {
196         struct  {
197                 UINT32          Enable:1;                       // Enable CCX2
198                 UINT32          LeapEnable:1;           // Enable LEAP at CCX2
199                 UINT32          RMEnable:1;                     // Radio Measurement Enable
200                 UINT32          DCRMEnable:1;           // Non serving channel Radio Measurement enable
201                 UINT32          QOSEnable:1;            // Enable QOS for CCX 2.0 support
202                 UINT32          FastRoamEnable:1;       // Enable fast roaming
203                 UINT32          Rsvd:2;                         // Not used
204                 UINT32          dBmToRoam:8;            // the condition to roam when receiving Rssi less than this value. It's negative value.
205                 UINT32          TuLimit:16;                     // Limit for different channel scan
206         }       field;
207         UINT32                  word;
208 }       CCX_CONTROL, *PCCX_CONTROL;
209
210 #endif  // __AIRONET_H__