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