Merge from vendor branch GROFF:
[dragonfly.git] / sys / dev / netif / ray / if_raymib.h
1 /*
2  * Copyright (C) 2000
3  * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk.
4  *
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the author nor the names of any co-contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY DUNCAN BARCLAY AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL DUNCAN BARCLAY OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  * $FreeBSD: src/sys/dev/ray/if_raymib.h,v 1.10.2.2 2001/08/14 22:54:07 dmlb Exp $
32  * $DragonFly: src/sys/dev/netif/ray/Attic/if_raymib.h,v 1.2 2003/06/17 04:28:29 dillon Exp $
33  *
34  */
35
36 /*
37  * Bit mask definitions for firmware versioning
38  */
39 #define RAY_V4  0x1
40 #define RAY_V5  0x2
41
42 /*
43  * MIB stuctures
44  */
45 struct ray_mib_common_head {                    /*Offset*/      /*Size*/
46     u_int8_t    mib_net_type;                   /*00*/ 
47     u_int8_t    mib_ap_status;                  /*01*/
48     u_int8_t    mib_ssid[IEEE80211_NWID_LEN];   /*02*/          /*20*/
49     u_int8_t    mib_scan_mode;                  /*22*/
50     u_int8_t    mib_apm_mode;                   /*23*/
51     u_int8_t    mib_mac_addr[ETHER_ADDR_LEN];   /*24*/          /*06*/
52     u_int8_t    mib_frag_thresh[2];             /*2a*/          /*02*/
53     u_int8_t    mib_dwell_time[2];              /*2c*/          /*02*/
54     u_int8_t    mib_beacon_period[2];           /*2e*/          /*02*/
55     u_int8_t    mib_dtim_interval;              /*30*/
56     u_int8_t    mib_max_retry;                  /*31*/
57     u_int8_t    mib_ack_timo;                   /*32*/
58     u_int8_t    mib_sifs;                       /*33*/
59     u_int8_t    mib_difs;                       /*34*/
60     u_int8_t    mib_pifs;                       /*35*/
61     u_int8_t    mib_rts_thresh[2];              /*36*/          /*02*/
62     u_int8_t    mib_scan_dwell[2];              /*38*/          /*02*/
63     u_int8_t    mib_scan_max_dwell[2];          /*3a*/          /*02*/
64     u_int8_t    mib_assoc_timo;                 /*3c*/
65     u_int8_t    mib_adhoc_scan_cycle;           /*3d*/
66     u_int8_t    mib_infra_scan_cycle;           /*3e*/
67     u_int8_t    mib_infra_super_scan_cycle;     /*3f*/
68     u_int8_t    mib_promisc;                    /*40*/
69     u_int8_t    mib_uniq_word[2];               /*41*/          /*02*/
70     u_int8_t    mib_slot_time;                  /*43*/
71     u_int8_t    mib_roam_low_snr_thresh;        /*44*/
72     u_int8_t    mib_low_snr_count;              /*45*/
73     u_int8_t    mib_infra_missed_beacon_count;  /*46*/
74     u_int8_t    mib_adhoc_missed_beacon_count;  /*47*/
75     u_int8_t    mib_country_code;               /*48*/
76     u_int8_t    mib_hop_seq;                    /*49*/
77     u_int8_t    mib_hop_seq_len;                /*4a*/
78 } __attribute__((__packed__));
79
80 struct ray_mib_common_tail {
81     u_int8_t    mib_noise_filter_gain;          /*00*/
82     u_int8_t    mib_noise_limit_offset;         /*01*/
83     u_int8_t    mib_rssi_thresh_offset;         /*02*/
84     u_int8_t    mib_busy_thresh_offset;         /*03*/
85     u_int8_t    mib_sync_thresh;                /*04*/
86     u_int8_t    mib_test_mode;                  /*05*/
87     u_int8_t    mib_test_min_chan;              /*06*/
88     u_int8_t    mib_test_max_chan;              /*07*/
89 } __attribute__((__packed__));
90
91 struct ray_mib_4 {
92     struct ray_mib_common_head  mib_head;       /*00*/
93     u_int8_t                    mib_cw_max;     /*4b*/
94     u_int8_t                    mib_cw_min;     /*4c*/
95     struct ray_mib_common_tail  mib_tail;       /*4d*/
96 } __attribute__((__packed__));
97
98 struct ray_mib_5 {
99     struct ray_mib_common_head  mib_head;               /*00*/
100     u_int8_t                    mib_cw_max[2];          /*4b*/          /*02*/
101     u_int8_t                    mib_cw_min[2];          /*4d*/          /*02*/
102     struct ray_mib_common_tail  mib_tail;               /*4f*/
103     u_int8_t                    mib_allow_probe_resp;   /*57*/
104     u_int8_t                    mib_privacy_must_start; /*58*/
105     u_int8_t                    mib_privacy_can_join;   /*59*/
106     u_int8_t                    mib_basic_rate_set[8];  /*5a*/          /*08*/
107 } __attribute__((__packed__));
108
109 #define mib_net_type            mib_head.mib_net_type
110 #define mib_ap_status           mib_head.mib_ap_status
111 #define mib_ssid                mib_head.mib_ssid
112 #define mib_scan_mode           mib_head.mib_scan_mode
113 #define mib_apm_mode            mib_head.mib_apm_mode
114 #define mib_mac_addr            mib_head.mib_mac_addr
115 #define mib_frag_thresh         mib_head.mib_frag_thresh
116 #define mib_dwell_time          mib_head.mib_dwell_time
117 #define mib_beacon_period       mib_head.mib_beacon_period
118 #define mib_dtim_interval       mib_head.mib_dtim_interval
119 #define mib_max_retry           mib_head.mib_max_retry
120 #define mib_ack_timo            mib_head.mib_ack_timo
121 #define mib_sifs                mib_head.mib_sifs
122 #define mib_difs                mib_head.mib_difs
123 #define mib_pifs                mib_head.mib_pifs
124 #define mib_rts_thresh          mib_head.mib_rts_thresh
125 #define mib_scan_dwell          mib_head.mib_scan_dwell
126 #define mib_scan_max_dwell      mib_head.mib_scan_max_dwell
127 #define mib_assoc_timo          mib_head.mib_assoc_timo
128 #define mib_adhoc_scan_cycle    mib_head.mib_adhoc_scan_cycle
129 #define mib_infra_scan_cycle    mib_head.mib_infra_scan_cycle
130 #define mib_infra_super_scan_cycle \
131                                 mib_head.mib_infra_super_scan_cycle
132 #define mib_promisc             mib_head.mib_promisc
133 #define mib_uniq_word           mib_head.mib_uniq_word
134 #define mib_slot_time           mib_head.mib_slot_time
135 #define mib_roam_low_snr_thresh mib_head.mib_roam_low_snr_thresh
136 #define mib_low_snr_count       mib_head.mib_low_snr_count
137 #define mib_infra_missed_beacon_count \
138                                 mib_head.mib_infra_missed_beacon_count
139 #define mib_adhoc_missed_beacon_count \
140                                 mib_head.mib_adhoc_missed_beacon_count
141 #define mib_country_code        mib_head.mib_country_code
142 #define mib_hop_seq             mib_head.mib_hop_seq
143 #define mib_hop_seq_len         mib_head.mib_hop_seq_len
144
145 #define mib_noise_filter_gain   mib_tail.mib_noise_filter_gain
146 #define mib_noise_limit_offset  mib_tail.mib_noise_limit_offset
147 #define mib_rssi_thresh_offset  mib_tail.mib_rssi_thresh_offset
148 #define mib_busy_thresh_offset  mib_tail.mib_busy_thresh_offset
149 #define mib_sync_thresh         mib_tail.mib_sync_thresh
150 #define mib_test_mode           mib_tail.mib_test_mode
151 #define mib_test_min_chan       mib_tail.mib_test_min_chan
152 #define mib_test_max_chan       mib_tail.mib_test_max_chan
153
154 /*
155  * MIB IDs for the update/report param commands
156  */
157 #define RAY_MIB_NET_TYPE                        0
158 #define RAY_MIB_AP_STATUS                       1
159 #define RAY_MIB_SSID                            2
160 #define RAY_MIB_SCAN_MODE                       3
161 #define RAY_MIB_APM_MODE                        4
162 #define RAY_MIB_MAC_ADDR                        5
163 #define RAY_MIB_FRAG_THRESH                     6
164 #define RAY_MIB_DWELL_TIME                      7
165 #define RAY_MIB_BEACON_PERIOD                   8
166 #define RAY_MIB_DTIM_INTERVAL                   9
167 #define RAY_MIB_MAX_RETRY                       10
168 #define RAY_MIB_ACK_TIMO                        11
169 #define RAY_MIB_SIFS                            12
170 #define RAY_MIB_DIFS                            13
171 #define RAY_MIB_PIFS                            14
172 #define RAY_MIB_RTS_THRESH                      15
173 #define RAY_MIB_SCAN_DWELL                      16
174 #define RAY_MIB_SCAN_MAX_DWELL                  17
175 #define RAY_MIB_ASSOC_TIMO                      18
176 #define RAY_MIB_ADHOC_SCAN_CYCLE                19
177 #define RAY_MIB_INFRA_SCAN_CYCLE                20
178 #define RAY_MIB_INFRA_SUPER_SCAN_CYCLE          21
179 #define RAY_MIB_PROMISC                         22
180 #define RAY_MIB_UNIQ_WORD                       23
181 #define RAY_MIB_SLOT_TIME                       24
182 #define RAY_MIB_ROAM_LOW_SNR_THRESH             25
183 #define RAY_MIB_LOW_SNR_COUNT                   26
184 #define RAY_MIB_INFRA_MISSED_BEACON_COUNT       27
185 #define RAY_MIB_ADHOC_MISSED_BEACON_COUNT       28
186 #define RAY_MIB_COUNTRY_CODE                    29
187 #define RAY_MIB_HOP_SEQ                         30
188 #define RAY_MIB_HOP_SEQ_LEN                     31
189 #define RAY_MIB_CW_MAX                          32
190 #define RAY_MIB_CW_MIN                          33
191 #define RAY_MIB_NOISE_FILTER_GAIN               34
192 #define RAY_MIB_NOISE_LIMIT_OFFSET              35
193 #define RAY_MIB_RSSI_THRESH_OFFSET              36
194 #define RAY_MIB_BUSY_THRESH_OFFSET              37
195 #define RAY_MIB_SYNC_THRESH                     38
196 #define RAY_MIB_TEST_MODE                       39
197 #define RAY_MIB_TEST_MIN_CHAN                   40
198 #define RAY_MIB_TEST_MAX_CHAN                   41
199 #define RAY_MIB_ALLOW_PROBE_RESP                42
200 #define RAY_MIB_PRIVACY_MUST_START              43
201 #define RAY_MIB_PRIVACY_CAN_JOIN                44
202 #define RAY_MIB_BASIC_RATE_SET                  45
203 #define RAY_MIB_VERSION                         46
204 #define RAY_MIB_CUR_BSSID                       47
205 #define RAY_MIB_CUR_INITED                      48
206 #define RAY_MIB_CUR_DEF_TXRATE                  49
207 #define RAY_MIB_CUR_ENCRYPT                     50
208 #define RAY_MIB_CUR_NET_TYPE                    51
209 #define RAY_MIB_CUR_SSID                        52
210 #define RAY_MIB_CUR_PRIV_START                  53
211 #define RAY_MIB_CUR_PRIV_JOIN                   54
212 #define RAY_MIB_DES_BSSID                       55
213 #define RAY_MIB_DES_INITED                      56
214 #define RAY_MIB_DES_DEF_TXRATE                  57
215 #define RAY_MIB_DES_ENCRYPT                     58
216 #define RAY_MIB_DES_NET_TYPE                    59
217 #define RAY_MIB_DES_SSID                        60
218 #define RAY_MIB_DES_PRIV_START                  61
219 #define RAY_MIB_DES_PRIV_JOIN                   62
220 #define RAY_MIB_CUR_AP_STATUS                   63
221 #define RAY_MIB_CUR_PROMISC                     64
222 #define RAY_MIB_DES_AP_STATUS                   65
223 #define RAY_MIB_DES_PROMISC                     66
224 #define RAY_MIB_CUR_FRAMING                     67
225 #define RAY_MIB_DES_FRAMING                     68
226
227 #define RAY_MIB_LASTUSER                        45
228 #define RAY_MIB_MAX                             68
229
230 /*
231  * Strings for the MIB
232  */
233 #define RAY_MIB_STRINGS {               \
234         "Network type",                 \
235         "AP status",                    \
236         "SSID",                         \
237         "Scan mode",                    \
238         "APM mode",                     \
239         "MAC address",                  \
240         "Fragmentation threshold",      \
241         "Dwell time",                   \
242         "Beacon period",                \
243         "DTIM_INTERVAL",                \
244         "MAX_RETRY",                    \
245         "ACK_TIMO",                     \
246         "SIFS",                         \
247         "DIFS",                         \
248         "PIFS",                         \
249         "RTS_THRESH",                   \
250         "SCAN_DWELL",                   \
251         "SCAN_MAX_DWELL",               \
252         "ASSOC_TIMO",                   \
253         "ADHOC_SCAN_CYCLE",             \
254         "INFRA_SCAN_CYCLE",             \
255         "INFRA_SUPER_SCAN_CYCLE",       \
256         "PROMISC",                      \
257         "UNIQ_WORD",                    \
258         "SLOT_TIME",                    \
259         "ROAM_LOW_SNR_THRESH",          \
260         "LOW_SNR_COUNT",                \
261         "INFRA_MISSED_BEACON_COUNT",    \
262         "ADHOC_MISSED_BEACON_COUNT",    \
263         "COUNTRY_CODE",                 \
264         "HOP_SEQ",                      \
265         "HOP_SEQ_LEN",                  \
266         "CW_MAX",                       \
267         "CW_MIN",                       \
268         "NOISE_FILTER_GAIN",            \
269         "NOISE_LIMIT_OFFSET",           \
270         "RSSI_THRESH_OFFSET",           \
271         "BUSY_THRESH_OFFSET",           \
272         "SYNC_THRESH",                  \
273         "TEST_MODE",                    \
274         "TEST_MIN_CHAN",                \
275         "TEST_MAX_CHAN",                \
276         "ALLOW_PROBE_RESP",             \
277         "PRIVACY_MUST_START",           \
278         "PRIVACY_CAN_JOIN",             \
279         "BASIC_RATE_SET",               \
280         "Firmware version",             \
281         "Current BSS Id",               \
282         "Current INITED",               \
283         "Current DEF_TXRATE",           \
284         "Current ENCRYPT",              \
285         "Current NET_TYPE",             \
286         "Current SSID",                 \
287         "Current PRIV_START",           \
288         "Current PRIV_JOIN",            \
289         "Desired BSSID",                \
290         "Desired INITED",               \
291         "Desired DEF_TXRATE",           \
292         "Desired ENCRYPT",              \
293         "Desired NET_TYPE",             \
294         "Desired SSID",                 \
295         "Desired PRIV_START",           \
296         "Desired PRIV_JOIN",            \
297         "Current AP_STATUS",            \
298         "Current PROMISC",              \
299         "Desired AP_STATUS",            \
300         "Desired PROMISC",              \
301         "Current FRAMING",              \
302         "Desired FRAMING"               \
303 }
304
305 #define RAY_MIB_HELP_STRINGS {                  \
306         "0 Ad hoc, 1 Infrastructure",           \
307         "0 Station, 1 Access Point",            \
308         "",                                     \
309         "0 Passive, 1 Active",                  \
310         "0 Off, 1 On",                          \
311         "",                                     \
312         "Bytes",                                \
313         "DWELL_TIME",                           \
314         "BEACON_PERIOD",                        \
315         "DTIM_INTERVAL",                        \
316         "MAX_RETRY",                            \
317         "ACK_TIMO",                             \
318         "SIFS",                                 \
319         "DIFS",                                 \
320         "PIFS",                                 \
321         "RTS_THRESH",                           \
322         "SCAN_DWELL",                           \
323         "SCAN_MAX_DWELL",                       \
324         "ASSOC_TIMO",                           \
325         "ADHOC_SCAN_CYCLE",                     \
326         "INFRA_SCAN_CYCLE",                     \
327         "INFRA_SUPER_SCAN_CYCLE",               \
328         "PROMISC",                              \
329         "UNIQ_WORD",                            \
330         "SLOT_TIME",                            \
331         "ROAM_LOW_SNR_THRESH",                  \
332         "LOW_SNR_COUNT",                        \
333         "INFRA_MISSED_BEACON_COUNT",            \
334         "ADHOC_MISSED_BEACON_COUNT",            \
335         "COUNTRY_CODE",                         \
336         "HOP_SEQ",                              \
337         "HOP_SEQ_LEN",                          \
338         "CW_MAX",                               \
339         "CW_MIN",                               \
340         "NOISE_FILTER_GAIN",                    \
341         "NOISE_LIMIT_OFFSET",                   \
342         "RSSI_THRESH_OFFSET",                   \
343         "BUSY_THRESH_OFFSET",                   \
344         "SYNC_THRESH",                          \
345         "TEST_MODE",                            \
346         "TEST_MIN_CHAN",                        \
347         "TEST_MAX_CHAN",                        \
348         "ALLOW_PROBE_RESP",                     \
349         "PRIVACY_MUST_START",                   \
350         "PRIVACY_CAN_JOIN",                     \
351         "BASIC_RATE_SET",                       \
352         "",                                     \
353         "",                                     \
354         "0 Joined a net, 1 Created a net",      \
355         "Current DEF_TXRATE",                   \
356         "Current ENCRYPT",                      \
357         "Current NET_TYPE",                     \
358         "",                                     \
359         "Current PRIV_START",                   \
360         "Current PRIV_JOIN",                    \
361         "",                                     \
362         "N/A",                                  \
363         "Desired DEF_TXRATE",                   \
364         "Desired ENCRYPT",                      \
365         "Desired NET_TYPE",                     \
366         "",                                     \
367         "Desired PRIV_START",                   \
368         "Desired PRIV_JOIN",                    \
369         "Current AP_STATUS",                    \
370         "Current PROMISC",                      \
371         "Desired AP_STATUS",                    \
372         "Desired PROMISC",                      \
373         "Current FRAMING",                      \
374         "Desired FRAMING"                       \
375 }
376
377 /*
378  * Applicable versions and work size for each MIB element
379  */
380 #define RAY_MIB_INFO_SIZ4 1
381 #define RAY_MIB_INFO_SIZ5 2
382 #define RAY_MIB_SIZE(info, mib, version) \
383         info[(mib)][(version & RAY_V4)?RAY_MIB_INFO_SIZ4:RAY_MIB_INFO_SIZ5]
384 #define RAY_MIB_INFO {                                                  \
385 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_NET_TYPE */                  \
386 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_AP_STATUS */                 \
387 {RAY_V4|RAY_V5, IEEE80211_NWID_LEN,                                     \
388                         IEEE80211_NWID_LEN},/* RAY_MIB_SSID */          \
389 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_SCAN_MODE */                 \
390 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_APM_MODE */                  \
391 {RAY_V4|RAY_V5, ETHER_ADDR_LEN,                                         \
392                         ETHER_ADDR_LEN},/* RAY_MIB_MAC_ADDR */          \
393 {RAY_V4|RAY_V5, 2,      2},     /* RAY_MIB_FRAG_THRESH */               \
394 {RAY_V4|RAY_V5, 2,      2},     /* RAY_MIB_DWELL_TIME */                \
395 {RAY_V4|RAY_V5, 2,      2},     /* RAY_MIB_BEACON_PERIOD */             \
396 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_DTIM_INTERVAL */             \
397 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_MAX_RETRY */                 \
398 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_ACK_TIMO */                  \
399 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_SIFS */                      \
400 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_DIFS */                      \
401 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_PIFS */                      \
402 {RAY_V4|RAY_V5, 2,      2},     /* RAY_MIB_RTS_THRESH */                \
403 {RAY_V4|RAY_V5, 2,      2},     /* RAY_MIB_SCAN_DWELL */                \
404 {RAY_V4|RAY_V5, 2,      2},     /* RAY_MIB_SCAN_MAX_DWELL */            \
405 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_ASSOC_TIMO */                \
406 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_ADHOC_SCAN_CYCLE */          \
407 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_INFRA_SCAN_CYCLE */          \
408 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_INFRA_SUPER_SCAN_CYCLE */    \
409 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_PROMISC */                   \
410 {RAY_V4|RAY_V5, 2,      2},     /* RAY_MIB_UNIQ_WORD */                 \
411 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_SLOT_TIME */                 \
412 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_ROAM_LOW_SNR_THRESH */       \
413 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_LOW_SNR_COUNT */             \
414 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_INFRA_MISSED_BEACON_COUNT */ \
415 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_ADHOC_MISSED_BEACON_COUNT */ \
416 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_COUNTRY_CODE */              \
417 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_HOP_SEQ */                   \
418 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_HOP_SEQ_LEN */               \
419 {RAY_V4|RAY_V5, 1,      2},     /* RAY_MIB_CW_MAX */                    \
420 {RAY_V4|RAY_V5, 1,      2},     /* RAY_MIB_CW_MIN */                    \
421 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_NOISE_FILTER_GAIN */         \
422 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_NOISE_LIMIT_OFFSET */        \
423 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_RSSI_THRESH_OFFSET */        \
424 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_BUSY_THRESH_OFFSET */        \
425 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_SYNC_THRESH */               \
426 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_TEST_MODE */                 \
427 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_TEST_MIN_CHAN */             \
428 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_TEST_MAX_CHAN */             \
429 {       RAY_V5, 0,      1},     /* RAY_MIB_ALLOW_PROBE_RESP */          \
430 {       RAY_V5, 0,      1},     /* RAY_MIB_PRIVACY_MUST_START */        \
431 {       RAY_V5, 0,      1},     /* RAY_MIB_PRIVACY_CAN_JOIN */          \
432 {       RAY_V5, 0,      8},     /* RAY_MIB_BASIC_RATE_SET */            \
433 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_VERSION */                   \
434 {RAY_V4|RAY_V5, ETHER_ADDR_LEN,                                         \
435                         ETHER_ADDR_LEN},/* RAY_MIB_CUR_BSSID */         \
436 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_CUR_INITED */                \
437 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_CUR_DEF_TXRATE */            \
438 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_CUR_ENCRYPT */               \
439 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_CUR_NET_TYPE */              \
440 {RAY_V4|RAY_V5, IEEE80211_NWID_LEN,                                     \
441                         IEEE80211_NWID_LEN}, /* RAY_MIB_CUR_SSID */     \
442 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_CUR_PRIV_START */            \
443 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_CUR_PRIV_JOIN */             \
444 {RAY_V4|RAY_V5, ETHER_ADDR_LEN,                                         \
445                         ETHER_ADDR_LEN},/* RAY_MIB_DES_BSSID */         \
446 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_DES_INITED */                \
447 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_DES_DEF_TXRATE */            \
448 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_DES_ENCRYPT */               \
449 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_DES_NET_TYPE */              \
450 {RAY_V4|RAY_V5, IEEE80211_NWID_LEN,                                     \
451                         IEEE80211_NWID_LEN}, /* RAY_MIB_DES_SSID */     \
452 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_DES_PRIV_START */            \
453 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_DES_PRIV_JOIN */             \
454 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_CUR_AP_STATUS */             \
455 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_CUR_PROMISC */               \
456 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_DES_AP_STATUS */             \
457 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_DES_PROMISC */               \
458 {RAY_V4|RAY_V5, 1,      1},     /* RAY_MIB_CUR_FRAMING */               \
459 {RAY_V4|RAY_V5, 1,      1}      /* RAY_MIB_DES_FRAMING */               \
460 }
461
462 /*
463  * MIB values
464  *
465  * I've included comments as to where the numbers have originated
466  * from.
467  *
468  * Linux refers to ray_cs.c and rayctl.h from version 167 of the
469  * Linux Raylink driver.
470  *
471  * NetBSD refers to if_ray.c from version 1.12 of the NetBSD Raylink
472  * driver.
473  *
474  * Symb refers to numbers cleaned from the 802.11 specification,
475  * discussion with 802.11 knowledgable people at Symbionics or
476  * stuff needed by me (i.e. me, * aps, ifo, hjl).
477  *
478  * V4 and V5 refer to settings for version 4 and version 5 of
479  * the firmware.
480  *
481  * DOC refers to the
482  *      Combined Interface Requirements Specification
483  *      and Interface Design Document (IRS/IDD)
484  *      for the
485  *      WLAN System Interfaces Between the
486  *      HOST COMPUTER and the
487  *      PCMCIA WLAN INTERFACE CARD
488  *      Revision ECF 5.00
489  *      17 June, 1998
490  */
491
492 /* Obtained by raycontrol _before_ downloading
493  *
494  * WebGear Aviator
495  *
496  * # raycontrol -i ray0
497  * Firmware version                4
498  * Network type                    0x01    0 Ad hoc, 1 Infrastructure
499  * AP status                       0x00    0 Station, 1 Access Point
500  * SSID                                                            
501  * Scan mode                       0x01    0 Passive, 1 Active
502  * APM mode                        0x00    0 Off, 1 On
503  * MAC address                     00:00:8f:48:e4:44
504  * Fragmentation threshold         0x0200  FRAG_THRESH
505  * Dwell tIME                      0x01    DWELL_TIME
506  * Beacon period                   0x01    BEACON_PERIOD
507  * DTIM_INTERVAL                   0x05    DTIM_INTERVAL
508  * MAX_RETRY                       0x03    MAX_RETRY
509  * ACK_TIMO                        0x8c    ACK_TIMO
510  * SIFS                            0x1e    SIFS
511  * DIFS                            0x82    DIFS
512  * PIFS                            0xce    PIFS
513  * RTS_THRESH                      0x0100  RTS_THRESH
514  * SCAN_DWELL                      0xfc18  SCAN_DWELL
515  * SCAN_MAX_DWELL                  0xc180  SCAN_MAX_DWELL
516  * ASSOC_TIMO                      0x05    ASSOC_TIMO
517  * ADHOC_SCAN_CYCLE                0x04    ADHOC_SCAN_CYCLE
518  * INFRA_SCAN_CYCLE                0x02    INFRA_SCAN_CYCLE
519  * INFRA_SUPER_SCAN_CYCLE          0x04    INFRA_SUPER_SCAN_CYCLE
520  * PROMISC                         0x00    PROMISC
521  * UNIQ_WORD                       0x0cbd  UNIQ_WORD
522  * SLOT_TIME                       0x4e    SLOT_TIME
523  * ROAM_LOW_SNR_THRESH             0x20    ROAM_LOW_SNR_THRESH
524  * LOW_SNR_COUNT                   0x04    LOW_SNR_COUNT
525  * INFRA_MISSED_BEACON_COUNT       0x04    INFRA_MISSED_BEACON_COUNT
526  * ADHOC_MISSED_BEACON_COUNT       0x04    ADHOC_MISSED_BEACON_COUNT
527  * COUNTRY_CODE                    0x01    COUNTRY_CODE
528  * HOP_SEQ                         0x07    HOP_SEQ
529  * HOP_SEQ_LEN                     0x4e    HOP_SEQ_LEN
530  * CW_MAX                          0x3f    CW_MAX
531  * CW_MIN                          0x0f    CW_MIN
532  * NOISE_FILTER_GAIN               0x00    NOISE_FILTER_GAIN
533  * NOISE_LIMIT_OFFSET              0x00    NOISE_LIMIT_OFFSET
534  * RSSI_THRESH_OFFSET              0x70    RSSI_THRESH_OFFSET
535  * BUSY_THRESH_OFFSET              0x70    BUSY_THRESH_OFFSET
536  * SYNC_THRESH                     0x07    SYNC_THRESH
537  * TEST_MODE                       0x00    TEST_MODE
538  * TEST_MIN_CHAN                   0x02    TEST_MIN_CHAN
539  * TEST_MAX_CHAN                   0x02    TEST_MAX_CHAN
540  *
541  * Raylink
542  * Firmware version             5
543  * Network type                 0x01    0 Ad hoc, 1 Infrastructure
544  * AP status                    0x00    0 Station, 1 Access Point
545  * SSID                         ESSID1                                  
546  * Scan mode                    0x01    0 Passive, 1 Active
547  * APM mode                     0x00    0 Off, 1 On
548  * MAC address                  00:00:8f:a8:17:06       
549  * Fragmentation threshold      0x7fff  Bytes
550  * Dwell time                   0x0080  DWELL_TIME
551  * Beacon period                0x0100  BEACON_PERIOD
552  * DTIM_INTERVAL                0x01    DTIM_INTERVAL
553  * MAX_RETRY                    0x1f    MAX_RETRY
554  * ACK_TIMO                     0x86    ACK_TIMO
555  * SIFS                         0x1c    SIFS
556  * DIFS                         0x82    DIFS
557  * PIFS                         0x4e    PIFS
558  * RTS_THRESH                   0x7fff  RTS_THRESH
559  * SCAN_DWELL                   0x04e2  SCAN_DWELL
560  * SCAN_MAX_DWELL               0x38a4  SCAN_MAX_DWELL
561  * ASSOC_TIMO                   0x05    ASSOC_TIMO
562  * ADHOC_SCAN_CYCLE             0x08    ADHOC_SCAN_CYCLE
563  * INFRA_SCAN_CYCLE             0x02    INFRA_SCAN_CYCLE
564  * INFRA_SUPER_SCAN_CYCLE       0x08    INFRA_SUPER_SCAN_CYCLE
565  * PROMISC                      0x00    PROMISC
566  * UNIQ_WORD                    0x0cbd  UNIQ_WORD
567  * SLOT_TIME                    0x32    SLOT_TIME
568  * ROAM_LOW_SNR_THRESH          0xff    ROAM_LOW_SNR_THRESH
569  * LOW_SNR_COUNT                0xff    LOW_SNR_COUNT
570  * INFRA_MISSED_BEACON_COUNT    0x02    INFRA_MISSED_BEACON_COUNT
571  * ADHOC_MISSED_BEACON_COUNT    0xff    ADHOC_MISSED_BEACON_COUNT
572  * COUNTRY_CODE                 0x01    COUNTRY_CODE
573  * HOP_SEQ                      0x0b    HOP_SEQ
574  * HOP_SEQ_LEN                  0x55    HOP_SEQ_LEN
575  * CW_MAX                       0x003f  CW_MAX
576  * CW_MIN                       0x000f  CW_MIN
577  * NOISE_FILTER_GAIN            0x04    NOISE_FILTER_GAIN
578  * NOISE_LIMIT_OFFSET           0x08    NOISE_LIMIT_OFFSET
579  * RSSI_THRESH_OFFSET           0x28    RSSI_THRESH_OFFSET
580  * BUSY_THRESH_OFFSET           0x28    BUSY_THRESH_OFFSET
581  * SYNC_THRESH                  0x07    SYNC_THRESH
582  * TEST_MODE                    0x00    TEST_MODE
583  * TEST_MIN_CHAN                0x02    TEST_MIN_CHAN
584  * TEST_MAX_CHAN                0x02    TEST_MAX_CHAN
585  * ALLOW_PROBE_RESP             0x00    ALLOW_PROBE_RESP
586  * PRIVACY_MUST_START           0x00    PRIVACY_MUST_START
587  * PRIVACY_CAN_JOIN             0x00    PRIVACY_CAN_JOIN
588  * BASIC_RATE_SET               0x02    BASIC_RATE_SET
589  */
590
591 /*
592  * mib_net_type
593  *
594  * DOC          0x01    - Defines network type for Start and Join
595  *                      - Network commands.
596  *
597  * As the V4 cards don't do infra we have to use adhoc. For V5 cards
598  * we follow standard FreeBSD practise and use infrastructure mode.
599  */
600 #define RAY_MIB_NET_TYPE_ADHOC                  0x00
601 #define RAY_MIB_NET_TYPE_INFRA                  0x01
602 #define RAY_MIB_NET_TYPE_V4                     RAY_MIB_NET_TYPE_ADHOC
603 #define RAY_MIB_NET_TYPE_V5                     RAY_MIB_NET_TYPE_INFRA
604
605 /*
606  * mib_ap_status
607  *
608  * DOC          0x00    - Applicable only when Network Type is
609  *                      - Infrastructure.
610  */
611 #define RAY_MIB_AP_STATUS_TERMINAL              0x00
612 #define RAY_MIB_AP_STATUS_AP                    0x01
613 #define RAY_MIB_AP_STATUS_V4                    RAY_MIB_AP_STATUS_TERMINAL
614 #define RAY_MIB_AP_STATUS_V5                    RAY_MIB_AP_STATUS_TERMINAL
615
616 /*
617  * mib_ssid
618  *
619  * DOC          ESSID1  - Service Set ID. Can be any ASCII string
620  *                      - up to 32 bytes in length. If the string is
621  *                      - less than 32 bytes long, it must be
622  *                      - followed by a byte of 00h.
623  *
624  * Symb                 - windows setting comes from the Aviator software v1.1
625  */
626 #define RAY_MIB_SSID_WINDOWS                    "NETWORK_NAME"
627 #define RAY_MIB_SSID_RAYLINK                    "ESSID1"
628 #define RAY_MIB_SSID_V4                         RAY_MIB_SSID_WINDOWS
629 #define RAY_MIB_SSID_V5                         RAY_MIB_SSID_RAYLINK
630
631 /*
632  * mib_scan_mode
633  *
634  * DOC          0x01    - Defines acquisition approach for
635  *                      - terminals operating in either Ad Hoc or
636  *                      - Infrastructure Networks. N/A for APs. 
637  */
638 #define RAY_MIB_SCAN_MODE_PASSIVE               0x00
639 #define RAY_MIB_SCAN_MODE_ACTIVE                0x01
640 #define RAY_MIB_SCAN_MODE_V4                    RAY_MIB_SCAN_MODE_ACTIVE
641 #define RAY_MIB_SCAN_MODE_V5                    RAY_MIB_SCAN_MODE_ACTIVE
642
643 /*
644  * mib_apm_mode
645  *
646  * DOC          0x00    - Defines power management mode for
647  *                      - stations operating in either Ad Hoc or
648  *                      - Infrastructure Networks. Must always
649  *                      - be 0 for APs.
650  */
651 #define RAY_MIB_APM_MODE_NONE                   0x00
652 #define RAY_MIB_APM_MODE_POWERSAVE              0x01
653 #define RAY_MIB_APM_MODE_V4                     RAY_MIB_APM_MODE_NONE
654 #define RAY_MIB_APM_MODE_V5                     RAY_MIB_APM_MODE_NONE
655
656 /*
657  * mib_mac_addr
658  *
659  * DOC                  - MAC Address to be used by WIC (For
660  *                      - format see Figure 3.2.4.1.2-1, MAC
661  *                      - Address Format). Host may echo card
662  *                      - supplied address or use locally
663  *                      - administered address.
664  */
665
666 /*
667  * mib_frag_thresh
668  *
669  * DOC          0x7fff  - Maximum over-the-air packet size (in
670  *                      - bytes)
671  *
672  * Symb         0xXXXX  - you really should fragment when in low signal
673  *                      - conditions but getting it wrong
674  *                        crucifies the performance
675  */
676 #define RAY_MIB_FRAG_THRESH_MINIMUM             0
677 #define RAY_MIB_FRAG_THRESH_MAXIMUM             2346
678 #define RAY_MIB_FRAG_THRESH_DISABLE             0x7fff
679 #define RAY_MIB_FRAG_THRESH_V4                  RAY_MIB_FRAG_THRESH_DISABLE
680 #define RAY_MIB_FRAG_THRESH_V5                  RAY_MIB_FRAG_THRESH_DISABLE
681
682 /*
683  * mib_dwell_time
684  *
685  * DOC          0x0080  - Defines hop dwell time in Kusec.
686  *                      - Required only of stations which intend
687  *                      - to issue a Start Network command.
688  *                      - Forward Compatible Firmware (Build
689  *                      - 5) requires that the dwell time be one of
690  *                      - the set 16, 32, 64, 128, and 256.
691  *
692  * Linux.h              - 16k * 2**n, n=0-4 in Kus
693  * Linux.c-V4   0x0200
694  * Linux.c-V5   0x0080  - 128 Kus
695  * NetBSD-V4    0x0200  - from Linux
696  * NetBSD-V4    0x0400  - "divined"
697  * NetBSD-V5    0x0080
698  * Symb-V4      0xXXXX  - 802.11 dwell time is XXX Kus
699  * Symb-V5      0xXXXX  - 802.11 dwell time is XXX Kus
700  *
701  * XXX confirm that 1024Kus is okay for windows driver - how? and see
702  * XXX how it is over the maximum
703  */
704 #define RAY_MIB_DWELL_TIME_MINIMUM              1
705 #define RAY_MIB_DWELL_TIME_MAXIMUM              390
706 #define RAY_MIB_DWELL_TIME_V4                   0x0400
707 #define RAY_MIB_DWELL_TIME_V5                   0x0080
708
709 /*
710  * mib_beacon_period
711  *
712  * DOC          0x0100  - Defines time between target beacon
713  *                      - transmit times (TBTT) in Kusec.
714  *                      - Forward Compatible Firmware (Build
715  *                      - 5) requires that the Beacon Period be an
716  *                      - integral multiple of the Dwell Time (not
717  *                      - exceeding 255 hops).
718  *                      - Required only of stations which intend
719  *                      - to issue a Start Network command.
720  *
721  * Linux.h              - n * a_hop_time  in Kus
722  * Linux.c-V4   0x0001
723  * Linux.c-V5   0x0100  - 256 Kus
724  * NetBSD-V4    0x0001  - from Linux
725  * NetBSD-V4    0x0000  - "divined"
726  * NetBSD-V5    0x0100
727  * Symb-V4      0x0001  - best performance is one beacon each dwell XXX
728  * Symb-V5      0x0080  - best performance is one beacon each dwell XXX
729  *
730  * XXX V4 should probably set this to dwell_time
731  */
732 #define RAY_MIB_BEACON_PERIOD_MINIMUM           1
733 #define RAY_MIB_BEACON_PERIOD_MAXIMUM           0xffff
734 #define RAY_MIB_BEACON_PERIOD_V4                0x0001
735 #define RAY_MIB_BEACON_PERIOD_V5                (2*RAY_MIB_DWELL_TIME_V5)
736
737 /*
738  * mib_dtim_interval
739  *
740  * DOC          0x01    - Number of beacons per DTIM period.
741  *                      - Only APs will use this parameter, to set
742  *                      - the DTIM period.
743  *
744  * Linux.h              - in beacons
745  * Linux.c      0x01
746  * NetBSD       0x01
747  * Symb         0xXX    - need to find out what DTIM is
748  */
749 #define RAY_MIB_DTIM_INTERVAL_MINIMUM           1
750 #define RAY_MIB_DTIM_INTERVAL_MAXIMUM           255
751 #define RAY_MIB_DTIM_INTERVAL_V4                0x01
752 #define RAY_MIB_DTIM_INTERVAL_V5                0x01
753
754 /*
755  * mib_max_retry
756  *
757  * DOC          31      - Number of times WIC will attempt to
758  *                      - retransmit a failed packet.
759  *
760  * Linux.c      0x07
761  * NetBSD       0x01    - "documented default for 5/6"
762  * NetBSD       0x07    - from Linux
763  * NetBSD       0x03    - "divined"
764  * Symb         0xXX    - 7 retries seems okay but check with APS
765  */
766 #define RAY_MIB_MAX_RETRY_MINIMUM               0
767 #define RAY_MIB_MAX_RETRY_MAXIMUM               255
768 #define RAY_MIB_MAX_RETRY_V4                    0x07
769 #define RAY_MIB_MAX_RETRY_V5                    0x1f
770
771 /*
772  * mib_ack_timo
773  *
774  * DOC          0x86    - Time WIC will wait after completion of
775  *                      - a transmit before timing out anticipated
776  *                      - ACK (2 usec steps). Should equal
777  *                      - SIFS + constant.
778  *
779  * Linux.c      0xa3
780  * NetBSD       0x86    - documented default for 5/6
781  * NetBSD       0xa3    - from Linux
782  * NetBSD       0xa3    - "divined"
783  * Symb         0xXX    - this must be a 802.11 defined setting?
784  */
785 #define RAY_MIB_ACK_TIMO_MINIMUM                0
786 #define RAY_MIB_ACK_TIMO_MAXIMUM                255
787 #define RAY_MIB_ACK_TIMO_V4                     0xa3
788 #define RAY_MIB_ACK_TIMO_V5                     0x86
789
790 /*
791  * mib_sifs
792  *
793  * DOC          0x1c    - SIFS time in usec.
794  *
795  * Linux.c      0x1d
796  * NetBSD       0x1c    - documented default for 5/6
797  * NetBSD       0x1d    - from Linux
798  * NetBSD       0x1d    - "divined"
799  * Symb         0xXX    - default SIFS for 802.11
800  */
801 #define RAY_MIB_SIFS_MINIMUM                    28
802 #define RAY_MIB_SIFS_MAXIMUM                    62
803 #define RAY_MIB_SIFS_V4                         0x1d
804 #define RAY_MIB_SIFS_V5                         0x1c
805
806 /*
807  * mib_difs
808  *
809  * DOC          0x82    - DIFS time in usec.
810  */
811 #define RAY_MIB_DIFS_MINIMUM                    130
812 #define RAY_MIB_DIFS_MAXIMUM                    255
813 #define RAY_MIB_DIFS_V4                         0x82
814 #define RAY_MIB_DIFS_V5                         0x82
815
816 /*
817  * mib_pifs
818  *
819  * DOC          78      - PIFS time in usec. (Not currently
820  *                      - implemented.
821  */
822 #define RAY_MIB_PIFS_MINIMUM                    78
823 #define RAY_MIB_PIFS_MAXIMUM                    255
824 #define RAY_MIB_PIFS_V4                         0xce
825 #define RAY_MIB_PIFS_V5                         0x4e
826
827 /*
828  * mib_rts_thresh
829  *
830  * DOC          0x7ffff - Threshold size in bytes below which
831  *                      - messages will not require use of RTS
832  *                      - Protocol.
833  *
834  * Linux.c      0x7fff
835  * NetBSD       0x7fff  - disabled
836  * Symb         0xXXXX  - need to set this realistically to get CTS/RTS mode
837  *                        working right
838  */
839 #define RAY_MIB_RTS_THRESH_MINIMUM              0
840 #define RAY_MIB_RTS_THRESH_MAXIMUM              2346
841 #define RAY_MIB_RTS_THRESH_DISABLE              0x7fff
842 #define RAY_MIB_RTS_THRESH_V4                   RAY_MIB_RTS_THRESH_DISABLE
843 #define RAY_MIB_RTS_THRESH_V5                   RAY_MIB_RTS_THRESH_DISABLE
844
845 /*
846  * mib_scan_dwell
847  *
848  * DOC          0x04e2  - Time channel remains clear after probe
849  *                      - transmission prior to hopping to next
850  *                      - channel. (in 2 msec steps).
851  *
852  * Linux.c-V4   0xfb1e  - 128572us
853  * Linix.c-V5   0x04e2  -   2500us
854  * NetBSD-V4    0xfb1e
855  * NetBSD-V5    0x04e2
856  * Symb         0xXXXX  - Check that v4 h/w can do 2.5ms and default it
857  */
858 #define RAY_MIB_SCAN_DWELL_MINIMUM              1
859 #define RAY_MIB_SCAN_DWELL_MAXIMUM              65535
860 #define RAY_MIB_SCAN_DWELL_V4                   0xfb1e
861 #define RAY_MIB_SCAN_DWELL_V5                   0x04e2
862
863 /*
864  * mib_scan_max_dwell
865  *
866  * DOC          0x38a4  - Time to remain on a frequency channel
867  *                      - if CCA is detected after probe
868  *                      - transmission. (in 2 usec steps).
869  *
870  * Linux.c-V4   0xc75c  - 102072us
871  * Linix.c-V5   0x38a4  -  29000us
872  * NetBSD-V4    0xc75c
873  * NetBSD-V5    0x38a4
874  * Symb         0xXXXX  - see above - this may be total time before giving up
875  */
876 #define RAY_MIB_SCAN_MAX_DWELL_MINIMUM          1
877 #define RAY_MIB_SCAN_MAX_DWELL_MAXIMUM          65535
878 #define RAY_MIB_SCAN_MAX_DWELL_V4               0xc75c
879 #define RAY_MIB_SCAN_MAX_DWELL_V5               0x38a4
880
881 /*
882  * mib_assoc_timo
883  *
884  * DOC          0x05    - Time (in hops) a station waits after
885  *                      - transmitting an Association Request
886  *                      - Message before association attempt is
887  *                      - considered failed. N/A for Ad Hoc
888  *                      - Networks and for APs in Infrastructure
889  */
890 #define RAY_MIB_ASSOC_TIMO_MINIMUM              0
891 #define RAY_MIB_ASSOC_TIMO_MAXIMUM              255
892 #define RAY_MIB_ASSOC_TIMO_V4                   0x05
893 #define RAY_MIB_ASSOC_TIMO_V5                   0x05
894
895 /*
896  * mib_adhoc_scan_cycle
897  *
898  * DOC          0x08    - Maximum number of times to cycle
899  *                      - through frequency hopping pattern as
900  *                      - part of scanning during Ad Hoc
901  *                      - Acquisition.
902  */
903 #define RAY_MIB_ADHOC_SCAN_CYCLE_MINIMUM        1
904 #define RAY_MIB_ADHOC_SCAN_CYCLE_MAXIMUM        255
905 #define RAY_MIB_ADHOC_SCAN_CYCLE_V4             0x08
906 #define RAY_MIB_ADHOC_SCAN_CYCLE_V5             0x08
907
908 /*
909  * mib_infra_scan_cycle
910  *
911  * DOC          0x02    - Number of times to cycle through
912  *                      - frequency hopping pattern as part of
913  *                      - scanning during Infrastructure Network
914  *                      - Acquisition.
915  */
916 #define RAY_MIB_INFRA_SCAN_CYCLE_MINIMUM        1
917 #define RAY_MIB_INFRA_SCAN_CYCLE_MAXIMUM        255
918 #define RAY_MIB_INFRA_SCAN_CYCLE_V4             0x02
919 #define RAY_MIB_INFRA_SCAN_CYCLE_V5             0x02
920
921 /*
922  * mib_infra_super_scan_cycle
923  *
924  * DOC          0x08    - Number of times to repeat an
925  *                      - Infrastructure scan cycle if no APs are
926  *                      - found before indicating a failure.
927  */
928 #define RAY_MIB_INFRA_SUPER_SCAN_CYCLE_MINIMUM  1
929 #define RAY_MIB_INFRA_SUPER_SCAN_CYCLE_MAXIMUM  255
930 #define RAY_MIB_INFRA_SUPER_SCAN_CYCLE_V4               0x08
931 #define RAY_MIB_INFRA_SUPER_SCAN_CYCLE_V5               0x08
932
933 /*
934  * mib_promisc
935  *
936  * DOC          0x00    - Controls operation of WIC in
937  *                      - promiscuous mode.
938  */
939 #define RAY_MIB_PROMISC_DISABLED                0
940 #define RAY_MIB_PROMISC_ENABLED                 1
941 #define RAY_MIB_PROMISC_V4                      0x00
942 #define RAY_MIB_PROMISC_V5                      0x00
943
944 /*
945  * mib_uniq_word
946  *
947  * DOC          0x0cdb  - Unique word pattern (Transmitted as
948  *                      - 0CBDh per 802.11)
949  */
950 #define RAY_MIB_UNIQ_WORD_MINIMUM               0
951 #define RAY_MIB_UNIQ_WORD_MAXIMUM               0xffff
952 #define RAY_MIB_UNIQ_WORD_V4                    0x0cbd
953 #define RAY_MIB_UNIQ_WORD_V5                    0x0cbd
954
955 /*
956  * mib_slot_time
957  *
958  * DOC          0x32    - Slot time in usec
959  *
960  * Linux.c-V4   0x4e
961  * Linix.c-V5   0x32
962  * NetBSD-V4    0x4e    - Linux
963  * NetBSD-V4    0x18    - "divined"
964  * NetBSD-V5    0x32    - mentions spec. is 50us i.e. 0x32
965  * Symb         0xXX    - wtf 0x4e = 78
966  */
967 #define RAY_MIB_SLOT_TIME_MINIMUM               1
968 #define RAY_MIB_SLOT_TIME_MAXIMUM               128
969 #define RAY_MIB_SLOT_TIME_V4                    0x4e
970 #define RAY_MIB_SLOT_TIME_V5                    0x32
971
972 /*
973  * mib_roam_low_snr_thresh
974  *
975  * DOC          0xff    - SNR Threshold for use by roaming
976  *                      - algorithm. [Low power count is
977  *                      - incremented when Beacon is received at
978  *                      - SNR lower than Roaming Low SNR
979  *                      - Threshold.] To disable, set to FFh.
980  *
981  * Linux.c      0xff
982  * NetBSD-V4    0xff    - Linux
983  * NetBSD-V4    0x30    - "divined"
984  * NetBSD-V5    0xff    - disabled
985  * NetBSD.h             - if below this inc count
986  * Symb         0xXX    - hmm is 0xff really disabled? need this to work
987  */
988 #define RAY_MIB_ROAM_LOW_SNR_THRESH_MINIMUM     0
989 #define RAY_MIB_ROAM_LOW_SNR_THRESH_MAXIMUM     255
990 #define RAY_MIB_ROAM_LOW_SNR_THRESH_DISABLED    0xff
991 #define RAY_MIB_ROAM_LOW_SNR_THRESH_V4          RAY_MIB_ROAM_LOW_SNR_THRESH_DISABLED    
992 #define RAY_MIB_ROAM_LOW_SNR_THRESH_V5          RAY_MIB_ROAM_LOW_SNR_THRESH_DISABLED    
993
994 /*
995  * mib_low_snr_count
996  *
997  * DOC          0xff    - Threshold that number of consecutive
998  *                      - beacons received at SNR < Roaming
999  *                      - Low SNR Threshold must exceed
1000  *                      - before roaming processing begins. To
1001  *                      - disable, set to FFh.
1002  *
1003  * Linux.c      0xff
1004  * NetBSD       0x07    - "divined - check" and marked as disabled
1005  * NetBSD       0xff    - disabled
1006  * NetBSD.h             - roam after cnt below thrsh
1007  * Symb         0xXX    - hmm is 0xff really disabled? need
1008  *                      - this to work in infrastructure mode with mutliple APs
1009  */
1010 #define RAY_MIB_LOW_SNR_COUNT_MINIMUM           0
1011 #define RAY_MIB_LOW_SNR_COUNT_MAXIMUM           255
1012 #define RAY_MIB_LOW_SNR_COUNT_DISABLED          0xff
1013 #define RAY_MIB_LOW_SNR_COUNT_V4                RAY_MIB_LOW_SNR_COUNT_DISABLED
1014 #define RAY_MIB_LOW_SNR_COUNT_V5                RAY_MIB_LOW_SNR_COUNT_DISABLED
1015
1016 /*
1017  * mib_infra_missed_beacon_count
1018  *
1019  * DOC          0x02    - Threshold that number of consecutive
1020  *                      - beacons not received must exceed
1021  *                      - before roaming processing begins in an
1022  *                      - infrastructure network. To disable, set
1023  *                      - to FFh.
1024  * Linux.c      0x05
1025  * NetBSD       0x02    - documented default for 5/6
1026  * NetBSD       0x05    - Linux
1027  * NetBSD       0x07    - "divined - check, looks fishy"
1028  * Symb         0xXX    - 5 missed beacons is probably okay
1029  */
1030 #define RAY_MIB_INFRA_MISSED_BEACON_COUNT_MINIMUM       0
1031 #define RAY_MIB_INFRA_MISSED_BEACON_COUNT_MAXIMUM       255
1032 #define RAY_MIB_INFRA_MISSED_BEACON_COUNT_V4            0x05
1033 #define RAY_MIB_INFRA_MISSED_BEACON_COUNT_V5            0x02
1034
1035 /*
1036  * mib_adhoc_missed_beacon_count
1037  *
1038  * DOC          0xff    - Threshold that number of consecutive
1039  *                      - beacons transmitted by a terminal must
1040  *                      - exceed before reacquisition processing
1041  *                      - begins in Ad Hoc Network.
1042  */
1043 #define RAY_MIB_ADHOC_MISSED_BEACON_COUNT_MINIMUM       0
1044 #define RAY_MIB_ADHOC_MISSED_BEACON_COUNT_MAXIMUM       255
1045 #define RAY_MIB_ADHOC_MISSED_BEACON_COUNT_DISABLED      0xff
1046 #define RAY_MIB_ADHOC_MISSED_BEACON_COUNT_V4            RAY_MIB_ADHOC_MISSED_BEACON_COUNT_DISABLED
1047 #define RAY_MIB_ADHOC_MISSED_BEACON_COUNT_V5            RAY_MIB_ADHOC_MISSED_BEACON_COUNT_DISABLED
1048
1049 /*
1050  * mib_country_code
1051  *
1052  * DOC          0x01    - Country set of hopping patterns
1053  *                      - (element value in beacon)
1054  *                      - Note: Japan Test is for a special test
1055  *                      - mode required by the Japanese
1056  *                      - regulatory authorities.
1057  */
1058 #define RAY_MIB_COUNTRY_CODE_MIMIMUM            0x01
1059 #define RAY_MIB_COUNTRY_CODE_MAXIMUM            0x09
1060 #define RAY_MIB_COUNTRY_CODE_USA                0x01
1061 #define RAY_MIB_COUNTRY_CODE_EUROPE             0x02
1062 #define RAY_MIB_COUNTRY_CODE_JAPAN              0x03
1063 #define RAY_MIB_COUNTRY_CODE_KOREA              0x04
1064 #define RAY_MIB_COUNTRY_CODE_SPAIN              0x05
1065 #define RAY_MIB_COUNTRY_CODE_FRANCE             0x06
1066 #define RAY_MIB_COUNTRY_CODE_ISRAEL             0x07
1067 #define RAY_MIB_COUNTRY_CODE_AUSTRALIA          0x08
1068 #define RAY_MIB_COUNTRY_CODE_JAPAN_TEST         0x09
1069 #define RAY_MIB_COUNTRY_CODE_V4                 RAY_MIB_COUNTRY_CODE_USA
1070 #define RAY_MIB_COUNTRY_CODE_V5                 RAY_MIB_COUNTRY_CODE_USA
1071
1072 /*
1073  * mib_hop_seq
1074  *
1075  * DOC          0x0b    - Hop Pattern to use. (Currently 66
1076  *                      - US/Europe plus 12 Japanese).
1077  *
1078  * NetBSD.h             - no longer supported
1079  */
1080 #define RAY_MIB_HOP_SEQ_MINIMUM                 6
1081 #define RAY_MIB_HOP_SEQ_MAXIMUM                 72
1082 #define RAY_MIB_HOP_SEQ_V4                      0x0b
1083 #define RAY_MIB_HOP_SEQ_V5                      0x04
1084
1085 /*
1086  * mib_hop_seq_len
1087  *
1088  * DOC          0x4f    - Number of frequency channels in
1089  *                      - hopping pattern is now set to the value
1090  *                      - defined in IEEE802.11 for the selected
1091  *                      - Current Country Code.
1092  */
1093 #define RAY_MIB_HOP_SEQ_LEN_MINIMUM             1
1094 #define RAY_MIB_HOP_SEQ_LEN_MAXIMUM             79
1095 #define RAY_MIB_HOP_SEQ_LEN_V4                  0x4e
1096 #define RAY_MIB_HOP_SEQ_LEN_V5                  0x4f
1097
1098 /*
1099  * All from here down are the same in Linux/NetBSD and seem to be sane.
1100  */
1101 #define RAY_MIB_CW_MAX_V4                       0x3f
1102 #define RAY_MIB_CW_MAX_V5                       0x003f
1103
1104 #define RAY_MIB_CW_MIN_V4                       0x0f
1105 #define RAY_MIB_CW_MIN_V5                       0x000f
1106
1107 /*
1108  * Symb         0xXX    - these parameters will affect the clear channel
1109  *                        assesment false triggering
1110  *
1111  */
1112 #define RAY_MIB_NOISE_FILTER_GAIN_DEFAULT       0x04
1113 #define RAY_MIB_NOISE_LIMIT_OFFSET_DEFAULT      0x08
1114 #define RAY_MIB_RSSI_THRESH_OFFSET_DEFAULT      0x28
1115 #define RAY_MIB_BUSY_THRESH_OFFSET_DEFAULT      0x28
1116 #define RAY_MIB_SYNC_THRESH_DEFAULT             0x07
1117
1118 #define RAY_MIB_TEST_MODE_NORMAL                0x0
1119 #define RAY_MIB_TEST_MODE_ANT_1                 0x1
1120 #define RAY_MIB_TEST_MODE_ATN_2                 0x2
1121 #define RAY_MIB_TEST_MODE_ATN_BOTH              0x3
1122 #define RAY_MIB_TEST_MODE_DEFAULT               RAY_MIB_TEST_MODE_NORMAL
1123
1124 #define RAY_MIB_TEST_MIN_CHAN_DEFAULT           0x02
1125 #define RAY_MIB_TEST_MAX_CHAN_DEFAULT           0x02
1126
1127 #define RAY_MIB_ALLOW_PROBE_RESP_DISALLOW       0x0
1128 #define RAY_MIB_ALLOW_PROBE_RESP_ALLOW          0x1
1129 #define RAY_MIB_ALLOW_PROBE_RESP_DEFAULT        RAY_MIB_ALLOW_PROBE_RESP_DISALLOW
1130
1131 #define RAY_MIB_PRIVACY_MUST_START_NOWEP        0x0
1132 #define RAY_MIB_PRIVACY_MUST_START_WEP          0x1
1133 #define RAY_MIB_PRIVACY_MUST_START_DEFAULT      RAY_MIB_PRIVACY_MUST_START_NOWEP
1134
1135 #define RAY_MIB_PRIVACY_CAN_JOIN_NOWEP          0x0
1136 #define RAY_MIB_PRIVACY_CAN_JOIN_WEP            0x1
1137 #define RAY_MIB_PRIVACY_CAN_JOIN_DONT_CARE      0x2
1138 #define RAY_MIB_PRIVACY_CAN_JOIN_DEFAULT        RAY_MIB_PRIVACY_CAN_JOIN_NOWEP
1139
1140 #define RAY_MIB_BASIC_RATE_SET_MINIMUM          1
1141 #define RAY_MIB_BASIC_RATE_SET_MAXIMUM          4
1142 #define RAY_MIB_BASIC_RATE_SET_500K             1
1143 #define RAY_MIB_BASIC_RATE_SET_1000K            2
1144 #define RAY_MIB_BASIC_RATE_SET_1500K            3
1145 #define RAY_MIB_BASIC_RATE_SET_2000K            4
1146 #define RAY_MIB_BASIC_RATE_SET_DEFAULT          RAY_MIB_BASIC_RATE_SET_2000K
1147
1148 /*
1149  * IOCTL support
1150  */
1151 struct ray_param_req {
1152         int             r_failcause;
1153         u_int8_t        r_paramid;
1154         u_int8_t        r_len;
1155         u_int8_t        r_data[256];
1156 };
1157 struct ray_stats_req {
1158         u_int64_t       rxoverflow;     /* Number of rx overflows       */
1159         u_int64_t       rxcksum;        /* Number of checksum errors    */
1160         u_int64_t       rxhcksum;       /* Number of header checksum errors */
1161         u_int8_t        rxnoise;        /* Average receiver level       */
1162 };
1163 #define RAY_FAILCAUSE_EIDRANGE  1
1164 #define RAY_FAILCAUSE_ELENGTH   2
1165 /* device can possibly return up to 255 */
1166 #define RAY_FAILCAUSE_EDEVSTOP  256
1167
1168 /* Get a param the data is a ray_param_req structure */
1169 #define SIOCSRAYPARAM   SIOCSIFGENERIC
1170 #define SIOCGRAYPARAM   SIOCGIFGENERIC
1171 /* Get the error counters the data is a ray_stats_req structure */
1172 #define SIOCGRAYSTATS   _IOWR('i', 201, struct ifreq)
1173 #define SIOCGRAYSIGLEV  _IOWR('i', 202, struct ifreq)
1174
1175 #define RAY_NSIGLEVRECS 8
1176 #define RAY_NSIGLEV 8
1177 #define RAY_NANTENNA 8
1178
1179 struct ray_siglev {
1180         u_int8_t        rsl_host[ETHER_ADDR_LEN]; /* MAC address */
1181         u_int8_t        rsl_siglevs[RAY_NSIGLEV]; /* levels, newest in [0] */
1182         u_int8_t        rsl_antennas[RAY_NANTENNA]; /* best antenna */
1183         struct timeval  rsl_time;                 /* time of last packet */
1184 };