]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - drivers/staging/rtl8188eu/include/wlan_bssdef.h
pinctrl: sirf: move sgpio lock into state container
[mirror_ubuntu-zesty-kernel.git] / drivers / staging / rtl8188eu / include / wlan_bssdef.h
1 /******************************************************************************
2 *
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 *
19 ******************************************************************************/
20 #ifndef __WLAN_BSSDEF_H__
21 #define __WLAN_BSSDEF_H__
22
23
24 #define MAX_IE_SZ 768
25
26 #define NDIS_802_11_LENGTH_SSID 32
27 #define NDIS_802_11_LENGTH_RATES 8
28 #define NDIS_802_11_LENGTH_RATES_EX 16
29
30 #define NDIS_802_11_RSSI long /* in dBm */
31
32 struct ndis_802_11_ssid {
33 u32 SsidLength;
34 u8 Ssid[32];
35 };
36
37 enum NDIS_802_11_NETWORK_TYPE {
38 Ndis802_11FH,
39 Ndis802_11DS,
40 Ndis802_11OFDM5,
41 Ndis802_11OFDM24,
42 Ndis802_11NetworkTypeMax /* dummy upper bound */
43 };
44
45 struct ndis_802_11_config_fh {
46 u32 Length; /* Length of structure */
47 u32 HopPattern; /* As defined by 802.11, MSB set */
48 u32 HopSet; /* to one if non-802.11 */
49 u32 DwellTime; /* units are Kusec */
50 };
51
52 /*
53 * FW will only save the channel number in DSConfig.
54 * ODI Handler will convert the channel number to freq. number.
55 */
56 struct ndis_802_11_config {
57 u32 Length; /* Length of structure */
58 u32 BeaconPeriod; /* units are Kusec */
59 u32 ATIMWindow; /* units are Kusec */
60 u32 DSConfig; /* Frequency, units are kHz */
61 struct ndis_802_11_config_fh FHConfig;
62 };
63
64 enum ndis_802_11_network_infra {
65 Ndis802_11IBSS,
66 Ndis802_11Infrastructure,
67 Ndis802_11AutoUnknown,
68 Ndis802_11InfrastructureMax, /* dummy upper bound */
69 Ndis802_11APMode
70 };
71
72 struct ndis_802_11_fixed_ie {
73 u8 Timestamp[8];
74 u16 BeaconInterval;
75 u16 Capabilities;
76 };
77
78
79
80 struct ndis_802_11_var_ie {
81 u8 ElementID;
82 u8 Length;
83 u8 data[1];
84 };
85
86 /*
87 * Length is the 4 bytes multiples of the sume of
88 * [ETH_ALEN] + 2 + sizeof (struct ndis_802_11_ssid) + sizeof (u32)
89 * + sizeof (NDIS_802_11_RSSI) + sizeof (enum NDIS_802_11_NETWORK_TYPE)
90 * + sizeof (struct ndis_802_11_config)
91 * + NDIS_802_11_LENGTH_RATES_EX + IELength
92 *
93 * Except the IELength, all other fields are fixed length.
94 * Therefore, we can define a macro to represent the partial sum. */
95
96 enum ndis_802_11_auth_mode {
97 Ndis802_11AuthModeOpen,
98 Ndis802_11AuthModeShared,
99 Ndis802_11AuthModeAutoSwitch,
100 Ndis802_11AuthModeWPA,
101 Ndis802_11AuthModeWPAPSK,
102 Ndis802_11AuthModeWPANone,
103 Ndis802_11AuthModeWAPI,
104 Ndis802_11AuthModeMax /* Not a real mode, upper bound */
105 };
106
107 enum ndis_802_11_wep_status {
108 Ndis802_11WEPEnabled,
109 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
110 Ndis802_11WEPDisabled,
111 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
112 Ndis802_11WEPKeyAbsent,
113 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
114 Ndis802_11WEPNotSupported,
115 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
116 Ndis802_11Encryption2Enabled,
117 Ndis802_11Encryption2KeyAbsent,
118 Ndis802_11Encryption3Enabled,
119 Ndis802_11Encryption3KeyAbsent,
120 Ndis802_11_EncryptionWAPI
121 };
122
123 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1
124 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
125 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
126
127 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1
128 #define NDIS_802_11_AI_RESFI_STATUSCODE 2
129 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
130
131 struct ndis_802_11_ai_reqfi {
132 u16 Capabilities;
133 u16 ListenInterval;
134 unsigned char CurrentAPAddress[ETH_ALEN];
135 };
136
137 struct ndis_802_11_ai_resfi {
138 u16 Capabilities;
139 u16 StatusCode;
140 u16 AssociationId;
141 };
142
143 struct ndis_802_11_assoc_info {
144 u32 Length;
145 u16 AvailableRequestFixedIEs;
146 struct ndis_802_11_ai_reqfi RequestFixedIEs;
147 u32 RequestIELength;
148 u32 OffsetRequestIEs;
149 u16 AvailableResponseFixedIEs;
150 struct ndis_802_11_ai_resfi ResponseFixedIEs;
151 u32 ResponseIELength;
152 u32 OffsetResponseIEs;
153 };
154
155 enum ndis_802_11_reload_def {
156 Ndis802_11ReloadWEPKeys
157 };
158
159 /* Key mapping keys require a BSSID */
160 struct ndis_802_11_key {
161 u32 Length; /* Length of this structure */
162 u32 KeyIndex;
163 u32 KeyLength; /* length of key in bytes */
164 unsigned char BSSID[ETH_ALEN];
165 unsigned long long KeyRSC;
166 u8 KeyMaterial[32]; /* var len depending on above field */
167 };
168
169 struct ndis_802_11_remove_key {
170 u32 Length; /* Length */
171 u32 KeyIndex;
172 unsigned char BSSID[ETH_ALEN];
173 };
174
175 struct ndis_802_11_wep {
176 u32 Length; /* Length of this structure */
177 u32 KeyIndex; /* 0 is the per-client key,
178 * 1-N are the global keys */
179 u32 KeyLength; /* length of key in bytes */
180 u8 KeyMaterial[16];/* variable len depending on above field */
181 };
182
183 struct ndis_802_11_auth_req {
184 u32 Length; /* Length of structure */
185 unsigned char Bssid[ETH_ALEN];
186 u32 Flags;
187 };
188
189 enum ndis_802_11_status_type {
190 Ndis802_11StatusType_Authentication,
191 Ndis802_11StatusType_MediaStreamMode,
192 Ndis802_11StatusType_PMKID_CandidateList,
193 Ndis802_11StatusTypeMax /* not a real type, defined as
194 * an upper bound */
195 };
196
197 struct ndis_802_11_status_ind {
198 enum ndis_802_11_status_type StatusType;
199 };
200
201 /* mask for authentication/integrity fields */
202 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
203 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
204 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
205 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
206 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
207
208 /* MIC check time, 60 seconds. */
209 #define MIC_CHECK_TIME 60000000
210
211 struct ndis_802_11_auth_evt {
212 struct ndis_802_11_status_ind Status;
213 struct ndis_802_11_auth_req Request[1];
214 };
215
216 struct ndis_802_11_test {
217 u32 Length;
218 u32 Type;
219 union {
220 struct ndis_802_11_auth_evt AuthenticationEvent;
221 NDIS_802_11_RSSI RssiTrigger;
222 } tt;
223 };
224
225
226 #ifndef Ndis802_11APMode
227 #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
228 #endif
229
230 struct wlan_phy_info {
231 u8 SignalStrength;/* in percentage) */
232 u8 SignalQuality;/* in percentage) */
233 u8 Optimum_antenna; /* for Antenna diversity */
234 u8 Reserved_0;
235 };
236
237 struct wlan_bcn_info {
238 /* these infor get from rtw_get_encrypt_info when
239 * * translate scan to UI */
240 u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
241 int group_cipher; /* WPA/WPA2 group cipher */
242 int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
243 int is_8021x;
244
245 /* bwmode 20/40 and ch_offset UP/LOW */
246 unsigned short ht_cap_info;
247 unsigned char ht_info_infos_0;
248 };
249
250 /* temporally add #pragma pack for structure alignment issue of
251 * struct wlan_bssid_ex and get_struct wlan_bssid_ex_sz()
252 */
253 struct wlan_bssid_ex {
254 u32 Length;
255 unsigned char MacAddress[ETH_ALEN];
256 u8 Reserved[2];/* 0]: IS beacon frame */
257 struct ndis_802_11_ssid Ssid;
258 u32 Privacy;
259 NDIS_802_11_RSSI Rssi;/* in dBM,raw data ,get from PHY) */
260 enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
261 struct ndis_802_11_config Configuration;
262 enum ndis_802_11_network_infra InfrastructureMode;
263 unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
264 struct wlan_phy_info PhyInfo;
265 u32 IELength;
266 u8 IEs[MAX_IE_SZ]; /* timestamp, beacon interval, and
267 * capability information) */
268 } __packed;
269
270 static inline uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
271 {
272 return sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->IELength;
273 }
274
275 struct wlan_network {
276 struct list_head list;
277 int network_type; /* refer to ieee80211.h for WIRELESS_11A/B/G */
278 int fixed; /* set fixed when not to be removed
279 * in site-surveying */
280 unsigned long last_scanned; /* timestamp for the network */
281 int aid; /* will only be valid when a BSS is joinned. */
282 int join_res;
283 struct wlan_bssid_ex network; /* must be the last item */
284 struct wlan_bcn_info BcnInfo;
285 };
286
287 enum VRTL_CARRIER_SENSE {
288 DISABLE_VCS,
289 ENABLE_VCS,
290 AUTO_VCS
291 };
292
293 enum VCS_TYPE {
294 NONE_VCS,
295 RTS_CTS,
296 CTS_TO_SELF
297 };
298
299 #define PWR_CAM 0
300 #define PWR_MINPS 1
301 #define PWR_MAXPS 2
302 #define PWR_UAPSD 3
303 #define PWR_VOIP 4
304
305 enum UAPSD_MAX_SP {
306 NO_LIMIT,
307 TWO_MSDU,
308 FOUR_MSDU,
309 SIX_MSDU
310 };
311
312 #define NUM_PRE_AUTH_KEY 16
313 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
314
315 /*
316 * WPA2
317 */
318
319 struct pmkid_candidate {
320 unsigned char BSSID[ETH_ALEN];
321 u32 Flags;
322 };
323
324 struct ndis_802_11_pmkid_list {
325 u32 Version; /* Version of the structure */
326 u32 NumCandidates; /* No. of pmkid candidates */
327 struct pmkid_candidate CandidateList[1];
328 };
329
330 struct ndis_802_11_auth_encrypt {
331 enum ndis_802_11_auth_mode AuthModeSupported;
332 enum ndis_802_11_wep_status EncryptStatusSupported;
333 };
334
335 struct ndis_802_11_cap {
336 u32 Length;
337 u32 Version;
338 u32 NoOfPMKIDs;
339 u32 NoOfAuthEncryptPairsSupported;
340 struct ndis_802_11_auth_encrypt AuthenticationEncryptionSupported[1];
341 };
342
343 #endif /* ifndef WLAN_BSSDEF_H_ */