Merge branches 'armv7', 'at91', 'misc' and 'omap' into devel
[linux-2.6] / drivers / net / wireless / prism54 / isl_oid.h
1 /*
2  *  Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
3  *  Copyright (C) 2004 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
4  *  Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21 #if !defined(_ISL_OID_H)
22 #define _ISL_OID_H
23
24 /*
25  * MIB related constant and structure definitions for communicating
26  * with the device firmware
27  */
28
29 struct obj_ssid {
30         u8 length;
31         char octets[33];
32 } __attribute__ ((packed));
33
34 struct obj_key {
35         u8 type;                /* dot11_priv_t */
36         u8 length;
37         char key[32];
38 } __attribute__ ((packed));
39
40 struct obj_mlme {
41         u8 address[6];
42         u16 id;
43         u16 state;
44         u16 code;
45 } __attribute__ ((packed));
46
47 struct obj_mlmeex {
48         u8 address[6];
49         u16 id;
50         u16 state;
51         u16 code;
52         u16 size;
53         u8 data[0];
54 } __attribute__ ((packed));
55
56 struct obj_buffer {
57         u32 size;
58         u32 addr;               /* 32bit bus address */
59 } __attribute__ ((packed));
60
61 struct obj_bss {
62         u8 address[6];
63         int:16;                 /* padding */
64
65         char state;
66         char reserved;
67         short age;
68
69         char quality;
70         char rssi;
71
72         struct obj_ssid ssid;
73         short channel;
74         char beacon_period;
75         char dtim_period;
76         short capinfo;
77         short rates;
78         short basic_rates;
79         int:16;                 /* padding */
80 } __attribute__ ((packed));
81
82 struct obj_bsslist {
83         u32 nr;
84         struct obj_bss bsslist[0];
85 } __attribute__ ((packed));
86
87 struct obj_frequencies {
88         u16 nr;
89         u16 mhz[0];
90 } __attribute__ ((packed));
91
92 struct obj_attachment {
93         char type;
94         char reserved;
95         short id;
96         short size;
97         char data[0];
98 } __attribute__((packed));
99
100 /*
101  * in case everything's ok, the inlined function below will be
102  * optimized away by the compiler...
103  */
104 static inline void
105 __bug_on_wrong_struct_sizes(void)
106 {
107         BUILD_BUG_ON(sizeof (struct obj_ssid) != 34);
108         BUILD_BUG_ON(sizeof (struct obj_key) != 34);
109         BUILD_BUG_ON(sizeof (struct obj_mlme) != 12);
110         BUILD_BUG_ON(sizeof (struct obj_mlmeex) != 14);
111         BUILD_BUG_ON(sizeof (struct obj_buffer) != 8);
112         BUILD_BUG_ON(sizeof (struct obj_bss) != 60);
113         BUILD_BUG_ON(sizeof (struct obj_bsslist) != 4);
114         BUILD_BUG_ON(sizeof (struct obj_frequencies) != 2);
115 }
116
117 enum dot11_state_t {
118         DOT11_STATE_NONE = 0,
119         DOT11_STATE_AUTHING = 1,
120         DOT11_STATE_AUTH = 2,
121         DOT11_STATE_ASSOCING = 3,
122
123         DOT11_STATE_ASSOC = 5,
124         DOT11_STATE_IBSS = 6,
125         DOT11_STATE_WDS = 7
126 };
127
128 enum dot11_bsstype_t {
129         DOT11_BSSTYPE_NONE = 0,
130         DOT11_BSSTYPE_INFRA = 1,
131         DOT11_BSSTYPE_IBSS = 2,
132         DOT11_BSSTYPE_ANY = 3
133 };
134
135 enum dot11_auth_t {
136         DOT11_AUTH_NONE = 0,
137         DOT11_AUTH_OS = 1,
138         DOT11_AUTH_SK = 2,
139         DOT11_AUTH_BOTH = 3
140 };
141
142 enum dot11_mlme_t {
143         DOT11_MLME_AUTO = 0,
144         DOT11_MLME_INTERMEDIATE = 1,
145         DOT11_MLME_EXTENDED = 2
146 };
147
148 enum dot11_priv_t {
149         DOT11_PRIV_WEP = 0,
150         DOT11_PRIV_TKIP = 1
151 };
152
153 /* Prism "Nitro" / Frameburst / "Packet Frame Grouping"
154  * Value is in microseconds. Represents the # microseconds
155  * the firmware will take to group frames before sending out then out
156  * together with a CSMA contention. Without this all frames are
157  * sent with a CSMA contention.
158  * Bibliography:
159  * http://www.hpl.hp.com/personal/Jean_Tourrilhes/Papers/Packet.Frame.Grouping.html
160  */
161 enum dot11_maxframeburst_t {
162         /* Values for DOT11_OID_MAXFRAMEBURST */
163         DOT11_MAXFRAMEBURST_OFF = 0, /* Card firmware default */
164         DOT11_MAXFRAMEBURST_MIXED_SAFE = 650, /* 802.11 a,b,g safe */
165         DOT11_MAXFRAMEBURST_IDEAL = 1300, /* Theoretical ideal level */
166         DOT11_MAXFRAMEBURST_MAX = 5000, /* Use this as max,
167                 * Note: firmware allows for greater values. This is a
168                 * recommended max. I'll update this as I find
169                 * out what the real MAX is. Also note that you don't necessarily
170                 * get better results with a greater value here.
171                 */
172 };
173
174 /* Support for 802.11 long and short frame preambles.
175  * Long  preamble uses 128-bit sync field, 8-bit  CRC
176  * Short preamble uses 56-bit  sync field, 16-bit CRC
177  *
178  * 802.11a -- not sure, both optionally ?
179  * 802.11b supports long and optionally short
180  * 802.11g supports both */
181 enum dot11_preamblesettings_t {
182         DOT11_PREAMBLESETTING_LONG = 0,
183                 /* Allows *only* long 802.11 preambles */
184         DOT11_PREAMBLESETTING_SHORT = 1,
185                 /* Allows *only* short 802.11 preambles */
186         DOT11_PREAMBLESETTING_DYNAMIC = 2
187                 /* AutomatiGically set */
188 };
189
190 /* Support for 802.11 slot timing (time between packets).
191  *
192  * Long uses 802.11a slot timing  (9 usec ?)
193  * Short uses 802.11b slot timing (20 use ?) */
194 enum dot11_slotsettings_t {
195         DOT11_SLOTSETTINGS_LONG = 0,
196                 /* Allows *only* long 802.11b slot timing */
197         DOT11_SLOTSETTINGS_SHORT = 1,
198                 /* Allows *only* long 802.11a slot timing */
199         DOT11_SLOTSETTINGS_DYNAMIC = 2
200                 /* AutomatiGically set */
201 };
202
203 /* All you need to know, ERP is "Extended Rate PHY".
204  * An Extended Rate PHY (ERP) STA or AP shall support three different
205  * preamble and header formats:
206  * Long  preamble (refer to above)
207  * Short preamble (refer to above)
208  * OFDM  preamble ( ? )
209  *
210  * I'm assuming here Protection tells the AP
211  * to be careful, a STA which cannot handle the long pre-amble
212  * has joined.
213  */
214 enum do11_nonerpstatus_t {
215         DOT11_ERPSTAT_NONEPRESENT = 0,
216         DOT11_ERPSTAT_USEPROTECTION = 1
217 };
218
219 /* (ERP is "Extended Rate PHY") Way to read NONERP is NON-ERP-*
220  * The key here is DOT11 NON ERP NEVER protects against
221  * NON ERP STA's. You *don't* want this unless
222  * you know what you are doing. It means you will only
223  * get Extended Rate capabilities */
224 enum dot11_nonerpprotection_t {
225         DOT11_NONERP_NEVER = 0,
226         DOT11_NONERP_ALWAYS = 1,
227         DOT11_NONERP_DYNAMIC = 2
228 };
229
230 /* Preset OID configuration for 802.11 modes
231  * Note: DOT11_OID_CW[MIN|MAX] hold the values of the
232  * DCS MIN|MAX backoff used */
233 enum dot11_profile_t { /* And set/allowed values */
234         /* Allowed values for DOT11_OID_PROFILES */
235         DOT11_PROFILE_B_ONLY = 0,
236                 /* DOT11_OID_RATES: 1, 2, 5.5, 11Mbps
237                  * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_DYNAMIC
238                  * DOT11_OID_CWMIN: 31
239                  * DOT11_OID_NONEPROTECTION: DOT11_NOERP_DYNAMIC
240                  * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_LONG
241                  */
242         DOT11_PROFILE_MIXED_G_WIFI = 1,
243                 /* DOT11_OID_RATES: 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54Mbs
244                  * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_DYNAMIC
245                  * DOT11_OID_CWMIN: 15
246                  * DOT11_OID_NONEPROTECTION: DOT11_NOERP_DYNAMIC
247                  * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_DYNAMIC
248                  */
249         DOT11_PROFILE_MIXED_LONG = 2, /* "Long range" */
250                 /* Same as Profile MIXED_G_WIFI */
251         DOT11_PROFILE_G_ONLY = 3,
252                 /* Same as Profile MIXED_G_WIFI */
253         DOT11_PROFILE_TEST = 4,
254                 /* Same as Profile MIXED_G_WIFI except:
255                  * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_SHORT
256                  * DOT11_OID_NONEPROTECTION: DOT11_NOERP_NEVER
257                  * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_SHORT
258                  */
259         DOT11_PROFILE_B_WIFI = 5,
260                 /* Same as Profile B_ONLY */
261         DOT11_PROFILE_A_ONLY = 6,
262                 /* Same as Profile MIXED_G_WIFI except:
263                  * DOT11_OID_RATES: 6, 9, 12, 18, 24, 36, 48, 54Mbs
264                  */
265         DOT11_PROFILE_MIXED_SHORT = 7
266                 /* Same as MIXED_G_WIFI */
267 };
268
269
270 /* The dot11d conformance level configures the 802.11d conformance levels.
271  * The following conformance levels exist:*/
272 enum oid_inl_conformance_t {
273         OID_INL_CONFORMANCE_NONE = 0,   /* Perform active scanning */
274         OID_INL_CONFORMANCE_STRICT = 1, /* Strictly adhere to 802.11d */
275         OID_INL_CONFORMANCE_FLEXIBLE = 2,       /* Use passed 802.11d info to
276                 * determine channel AND/OR just make assumption that active
277                 * channels are valid  channels */
278 };
279
280 enum oid_inl_mode_t {
281         INL_MODE_NONE = -1,
282         INL_MODE_PROMISCUOUS = 0,
283         INL_MODE_CLIENT = 1,
284         INL_MODE_AP = 2,
285         INL_MODE_SNIFFER = 3
286 };
287
288 enum oid_inl_config_t {
289         INL_CONFIG_NOTHING = 0x00,
290         INL_CONFIG_MANUALRUN = 0x01,
291         INL_CONFIG_FRAMETRAP = 0x02,
292         INL_CONFIG_RXANNEX = 0x04,
293         INL_CONFIG_TXANNEX = 0x08,
294         INL_CONFIG_WDS = 0x10
295 };
296
297 enum oid_inl_phycap_t {
298         INL_PHYCAP_2400MHZ = 1,
299         INL_PHYCAP_5000MHZ = 2,
300         INL_PHYCAP_FAA = 0x80000000,    /* Means card supports the FAA switch */
301 };
302
303
304 enum oid_num_t {
305         GEN_OID_MACADDRESS = 0,
306         GEN_OID_LINKSTATE,
307         GEN_OID_WATCHDOG,
308         GEN_OID_MIBOP,
309         GEN_OID_OPTIONS,
310         GEN_OID_LEDCONFIG,
311
312         /* 802.11 */
313         DOT11_OID_BSSTYPE,
314         DOT11_OID_BSSID,
315         DOT11_OID_SSID,
316         DOT11_OID_STATE,
317         DOT11_OID_AID,
318         DOT11_OID_COUNTRYSTRING,
319         DOT11_OID_SSIDOVERRIDE,
320
321         DOT11_OID_MEDIUMLIMIT,
322         DOT11_OID_BEACONPERIOD,
323         DOT11_OID_DTIMPERIOD,
324         DOT11_OID_ATIMWINDOW,
325         DOT11_OID_LISTENINTERVAL,
326         DOT11_OID_CFPPERIOD,
327         DOT11_OID_CFPDURATION,
328
329         DOT11_OID_AUTHENABLE,
330         DOT11_OID_PRIVACYINVOKED,
331         DOT11_OID_EXUNENCRYPTED,
332         DOT11_OID_DEFKEYID,
333         DOT11_OID_DEFKEYX,      /* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */
334         DOT11_OID_STAKEY,
335         DOT11_OID_REKEYTHRESHOLD,
336         DOT11_OID_STASC,
337
338         DOT11_OID_PRIVTXREJECTED,
339         DOT11_OID_PRIVRXPLAIN,
340         DOT11_OID_PRIVRXFAILED,
341         DOT11_OID_PRIVRXNOKEY,
342
343         DOT11_OID_RTSTHRESH,
344         DOT11_OID_FRAGTHRESH,
345         DOT11_OID_SHORTRETRIES,
346         DOT11_OID_LONGRETRIES,
347         DOT11_OID_MAXTXLIFETIME,
348         DOT11_OID_MAXRXLIFETIME,
349         DOT11_OID_AUTHRESPTIMEOUT,
350         DOT11_OID_ASSOCRESPTIMEOUT,
351
352         DOT11_OID_ALOFT_TABLE,
353         DOT11_OID_ALOFT_CTRL_TABLE,
354         DOT11_OID_ALOFT_RETREAT,
355         DOT11_OID_ALOFT_PROGRESS,
356         DOT11_OID_ALOFT_FIXEDRATE,
357         DOT11_OID_ALOFT_RSSIGRAPH,
358         DOT11_OID_ALOFT_CONFIG,
359
360         DOT11_OID_VDCFX,
361         DOT11_OID_MAXFRAMEBURST,
362
363         DOT11_OID_PSM,
364         DOT11_OID_CAMTIMEOUT,
365         DOT11_OID_RECEIVEDTIMS,
366         DOT11_OID_ROAMPREFERENCE,
367
368         DOT11_OID_BRIDGELOCAL,
369         DOT11_OID_CLIENTS,
370         DOT11_OID_CLIENTSASSOCIATED,
371         DOT11_OID_CLIENTX,      /* DOT11_OID_CLIENTX,...DOT11_OID_CLIENT2007 */
372
373         DOT11_OID_CLIENTFIND,
374         DOT11_OID_WDSLINKADD,
375         DOT11_OID_WDSLINKREMOVE,
376         DOT11_OID_EAPAUTHSTA,
377         DOT11_OID_EAPUNAUTHSTA,
378         DOT11_OID_DOT1XENABLE,
379         DOT11_OID_MICFAILURE,
380         DOT11_OID_REKEYINDICATE,
381
382         DOT11_OID_MPDUTXSUCCESSFUL,
383         DOT11_OID_MPDUTXONERETRY,
384         DOT11_OID_MPDUTXMULTIPLERETRIES,
385         DOT11_OID_MPDUTXFAILED,
386         DOT11_OID_MPDURXSUCCESSFUL,
387         DOT11_OID_MPDURXDUPS,
388         DOT11_OID_RTSSUCCESSFUL,
389         DOT11_OID_RTSFAILED,
390         DOT11_OID_ACKFAILED,
391         DOT11_OID_FRAMERECEIVES,
392         DOT11_OID_FRAMEERRORS,
393         DOT11_OID_FRAMEABORTS,
394         DOT11_OID_FRAMEABORTSPHY,
395
396         DOT11_OID_SLOTTIME,
397         DOT11_OID_CWMIN, /* MIN DCS backoff */
398         DOT11_OID_CWMAX, /* MAX DCS backoff */
399         DOT11_OID_ACKWINDOW,
400         DOT11_OID_ANTENNARX,
401         DOT11_OID_ANTENNATX,
402         DOT11_OID_ANTENNADIVERSITY,
403         DOT11_OID_CHANNEL,
404         DOT11_OID_EDTHRESHOLD,
405         DOT11_OID_PREAMBLESETTINGS,
406         DOT11_OID_RATES,
407         DOT11_OID_CCAMODESUPPORTED,
408         DOT11_OID_CCAMODE,
409         DOT11_OID_RSSIVECTOR,
410         DOT11_OID_OUTPUTPOWERTABLE,
411         DOT11_OID_OUTPUTPOWER,
412         DOT11_OID_SUPPORTEDRATES,
413         DOT11_OID_FREQUENCY,
414         DOT11_OID_SUPPORTEDFREQUENCIES,
415         DOT11_OID_NOISEFLOOR,
416         DOT11_OID_FREQUENCYACTIVITY,
417         DOT11_OID_IQCALIBRATIONTABLE,
418         DOT11_OID_NONERPPROTECTION,
419         DOT11_OID_SLOTSETTINGS,
420         DOT11_OID_NONERPTIMEOUT,
421         DOT11_OID_PROFILES,
422         DOT11_OID_EXTENDEDRATES,
423
424         DOT11_OID_DEAUTHENTICATE,
425         DOT11_OID_AUTHENTICATE,
426         DOT11_OID_DISASSOCIATE,
427         DOT11_OID_ASSOCIATE,
428         DOT11_OID_SCAN,
429         DOT11_OID_BEACON,
430         DOT11_OID_PROBE,
431         DOT11_OID_DEAUTHENTICATEEX,
432         DOT11_OID_AUTHENTICATEEX,
433         DOT11_OID_DISASSOCIATEEX,
434         DOT11_OID_ASSOCIATEEX,
435         DOT11_OID_REASSOCIATE,
436         DOT11_OID_REASSOCIATEEX,
437
438         DOT11_OID_NONERPSTATUS,
439
440         DOT11_OID_STATIMEOUT,
441         DOT11_OID_MLMEAUTOLEVEL,
442         DOT11_OID_BSSTIMEOUT,
443         DOT11_OID_ATTACHMENT,
444         DOT11_OID_PSMBUFFER,
445
446         DOT11_OID_BSSS,
447         DOT11_OID_BSSX,         /*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */
448         DOT11_OID_BSSFIND,
449         DOT11_OID_BSSLIST,
450
451         OID_INL_TUNNEL,
452         OID_INL_MEMADDR,
453         OID_INL_MEMORY,
454         OID_INL_MODE,
455         OID_INL_COMPONENT_NR,
456         OID_INL_VERSION,
457         OID_INL_INTERFACE_ID,
458         OID_INL_COMPONENT_ID,
459         OID_INL_CONFIG,
460         OID_INL_DOT11D_CONFORMANCE,
461         OID_INL_PHYCAPABILITIES,
462         OID_INL_OUTPUTPOWER,
463
464         OID_NUM_LAST
465 };
466
467 #define OID_FLAG_CACHED         0x80
468 #define OID_FLAG_TYPE           0x7f
469
470 #define OID_TYPE_U32            0x01
471 #define OID_TYPE_SSID           0x02
472 #define OID_TYPE_KEY            0x03
473 #define OID_TYPE_BUFFER         0x04
474 #define OID_TYPE_BSS            0x05
475 #define OID_TYPE_BSSLIST        0x06
476 #define OID_TYPE_FREQUENCIES    0x07
477 #define OID_TYPE_MLME           0x08
478 #define OID_TYPE_MLMEEX         0x09
479 #define OID_TYPE_ADDR           0x0A
480 #define OID_TYPE_RAW            0x0B
481 #define OID_TYPE_ATTACH         0x0C
482
483 /* OID_TYPE_MLMEEX is special because of a variable size field when sending.
484  * Not yet implemented (not used in driver anyway).
485  */
486
487 struct oid_t {
488         enum oid_num_t oid;
489         short range;            /* to define a range of oid */
490         short size;             /* max size of the associated data */
491         char flags;
492 };
493
494 union oid_res_t {
495         void *ptr;
496         u32 u;
497 };
498
499 #define IWMAX_BITRATES  20
500 #define IWMAX_BSS       24
501 #define IWMAX_FREQ      30
502 #define PRIV_STR_SIZE   1024
503
504 #endif                          /* !defined(_ISL_OID_H) */
505 /* EOF */