Merge branches 'topic/fix/hda' and 'topic/fix/misc' into for-linus
[linux-2.6] / drivers / staging / wlan-ng / prism2mib.c
1 /* src/prism2/driver/prism2mib.c
2 *
3 * Management request for mibset/mibget
4 *
5 * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
6 * --------------------------------------------------------------------
7 *
8 * linux-wlan
9 *
10 *   The contents of this file are subject to the Mozilla Public
11 *   License Version 1.1 (the "License"); you may not use this file
12 *   except in compliance with the License. You may obtain a copy of
13 *   the License at http://www.mozilla.org/MPL/
14 *
15 *   Software distributed under the License is distributed on an "AS
16 *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17 *   implied. See the License for the specific language governing
18 *   rights and limitations under the License.
19 *
20 *   Alternatively, the contents of this file may be used under the
21 *   terms of the GNU Public License version 2 (the "GPL"), in which
22 *   case the provisions of the GPL are applicable instead of the
23 *   above.  If you wish to allow the use of your version of this file
24 *   only under the terms of the GPL and not to allow others to use
25 *   your version of this file under the MPL, indicate your decision
26 *   by deleting the provisions above and replace them with the notice
27 *   and other provisions required by the GPL.  If you do not delete
28 *   the provisions above, a recipient may use your version of this
29 *   file under either the MPL or the GPL.
30 *
31 * --------------------------------------------------------------------
32 *
33 * Inquiries regarding the linux-wlan Open Source project can be
34 * made directly to:
35 *
36 * AbsoluteValue Systems Inc.
37 * info@linux-wlan.com
38 * http://www.linux-wlan.com
39 *
40 * --------------------------------------------------------------------
41 *
42 * Portions of the development of this software were funded by
43 * Intersil Corporation as part of PRISM(R) chipset product development.
44 *
45 * --------------------------------------------------------------------
46 *
47 * The functions in this file handle the mibset/mibget management
48 * functions.
49 *
50 * --------------------------------------------------------------------
51 */
52
53 /*================================================================*/
54 /* System Includes */
55 #define WLAN_DBVAR      prism2_debug
56
57 #include "version.h"
58
59
60 #include <linux/version.h>
61
62 #include <linux/module.h>
63 #include <linux/kernel.h>
64 #include <linux/sched.h>
65 #include <linux/types.h>
66 #include <linux/slab.h>
67 #include <linux/wireless.h>
68 #include <linux/netdevice.h>
69 #include <asm/io.h>
70 #include <linux/delay.h>
71 #include <asm/byteorder.h>
72
73 #include "wlan_compat.h"
74
75 //#if (WLAN_HOSTIF == WLAN_PCMCIA)
76 //#include <pcmcia/version.h>
77 //#include <pcmcia/cs_types.h>
78 //#include <pcmcia/cs.h>
79 //#include <pcmcia/cistpl.h>
80 //#include <pcmcia/ds.h>
81 //#include <pcmcia/cisreg.h>
82 //#endif
83 //
84 //#if ((WLAN_HOSTIF == WLAN_PLX) || (WLAN_HOSTIF == WLAN_PCI))
85 //#include <linux/ioport.h>
86 //#include <linux/pci.h>
87 //endif
88
89 //#if (WLAN_HOSTIF == WLAN_USB)
90 #include <linux/usb.h>
91 //#endif
92
93 #include "wlan_compat.h"
94
95 /*================================================================*/
96 /* Project Includes */
97
98 #include "p80211types.h"
99 #include "p80211hdr.h"
100 #include "p80211mgmt.h"
101 #include "p80211conv.h"
102 #include "p80211msg.h"
103 #include "p80211netdev.h"
104 #include "p80211metadef.h"
105 #include "p80211metastruct.h"
106 #include "hfa384x.h"
107 #include "prism2mgmt.h"
108
109 /*================================================================*/
110 /* Local Constants */
111
112 #define MIB_TMP_MAXLEN    200    /* Max length of RID record (in bytes). */
113
114 /*================================================================*/
115 /* Local Types */
116
117 #define  F_AP         0x1        /* MIB is supported on Access Points. */
118 #define  F_STA        0x2        /* MIB is supported on stations. */
119 #define  F_READ       0x4        /* MIB may be read. */
120 #define  F_WRITE      0x8        /* MIB may be written. */
121
122 typedef struct mibrec
123 {
124     UINT32   did;
125     UINT16   flag;
126     UINT16   parm1;
127     UINT16   parm2;
128     UINT16   parm3;
129     int      (*func)(struct mibrec                *mib,
130                      int                          isget,
131                      wlandevice_t                 *wlandev,
132                      hfa384x_t                    *hw,
133                      p80211msg_dot11req_mibset_t  *msg,
134                      void                         *data);
135 } mibrec_t;
136
137 /*================================================================*/
138 /* Local Function Declarations */
139
140 static int prism2mib_bytestr2pstr(
141 mibrec_t                     *mib,
142 int                          isget,
143 wlandevice_t                 *wlandev,
144 hfa384x_t                    *hw,
145 p80211msg_dot11req_mibset_t  *msg,
146 void                         *data);
147
148 static int prism2mib_bytearea2pstr(
149 mibrec_t                     *mib,
150 int                          isget,
151 wlandevice_t                 *wlandev,
152 hfa384x_t                    *hw,
153 p80211msg_dot11req_mibset_t  *msg,
154 void                         *data);
155
156 static int prism2mib_uint32(
157 mibrec_t                     *mib,
158 int                          isget,
159 wlandevice_t                 *wlandev,
160 hfa384x_t                    *hw,
161 p80211msg_dot11req_mibset_t  *msg,
162 void                         *data);
163
164 static int prism2mib_uint32array(
165 mibrec_t                     *mib,
166 int                          isget,
167 wlandevice_t                 *wlandev,
168 hfa384x_t                    *hw,
169 p80211msg_dot11req_mibset_t  *msg,
170 void                         *data);
171
172 static int prism2mib_uint32offset(
173 mibrec_t                     *mib,
174 int                          isget,
175 wlandevice_t                 *wlandev,
176 hfa384x_t                    *hw,
177 p80211msg_dot11req_mibset_t  *msg,
178 void                         *data);
179
180 static int prism2mib_truth(
181 mibrec_t                     *mib,
182 int                          isget,
183 wlandevice_t                 *wlandev,
184 hfa384x_t                    *hw,
185 p80211msg_dot11req_mibset_t  *msg,
186 void                         *data);
187
188 static int prism2mib_preamble(
189 mibrec_t                     *mib,
190 int                          isget,
191 wlandevice_t                 *wlandev,
192 hfa384x_t                    *hw,
193 p80211msg_dot11req_mibset_t  *msg,
194 void                         *data);
195
196 static int prism2mib_flag(
197 mibrec_t                     *mib,
198 int                          isget,
199 wlandevice_t                 *wlandev,
200 hfa384x_t                    *hw,
201 p80211msg_dot11req_mibset_t  *msg,
202 void                         *data);
203
204 static int prism2mib_appcfinfoflag(
205 mibrec_t                     *mib,
206 int                          isget,
207 wlandevice_t                 *wlandev,
208 hfa384x_t                    *hw,
209 p80211msg_dot11req_mibset_t  *msg,
210 void                         *data);
211
212 static int prism2mib_regulatorydomains(
213 mibrec_t                     *mib,
214 int                          isget,
215 wlandevice_t                 *wlandev,
216 hfa384x_t                    *hw,
217 p80211msg_dot11req_mibset_t  *msg,
218 void                         *data);
219
220 static int prism2mib_wepdefaultkey(
221 mibrec_t                     *mib,
222 int                          isget,
223 wlandevice_t                 *wlandev,
224 hfa384x_t                    *hw,
225 p80211msg_dot11req_mibset_t  *msg,
226 void                         *data);
227
228 static int prism2mib_powermanagement(
229 mibrec_t                     *mib,
230 int                          isget,
231 wlandevice_t                 *wlandev,
232 hfa384x_t                    *hw,
233 p80211msg_dot11req_mibset_t  *msg,
234 void                         *data);
235
236 static int prism2mib_privacyinvoked(
237 mibrec_t                     *mib,
238 int                          isget,
239 wlandevice_t                 *wlandev,
240 hfa384x_t                    *hw,
241 p80211msg_dot11req_mibset_t  *msg,
242 void                         *data);
243
244 static int prism2mib_excludeunencrypted(
245 mibrec_t                     *mib,
246 int                          isget,
247 wlandevice_t                 *wlandev,
248 hfa384x_t                    *hw,
249 p80211msg_dot11req_mibset_t  *msg,
250 void                         *data);
251
252 static int prism2mib_fragmentationthreshold(
253 mibrec_t                     *mib,
254 int                          isget,
255 wlandevice_t                 *wlandev,
256 hfa384x_t                    *hw,
257 p80211msg_dot11req_mibset_t  *msg,
258 void                         *data);
259
260 static int prism2mib_operationalrateset(
261 mibrec_t                     *mib,
262 int                          isget,
263 wlandevice_t                 *wlandev,
264 hfa384x_t                    *hw,
265 p80211msg_dot11req_mibset_t  *msg,
266 void                         *data);
267
268 static int prism2mib_groupaddress(
269 mibrec_t                     *mib,
270 int                          isget,
271 wlandevice_t                 *wlandev,
272 hfa384x_t                    *hw,
273 p80211msg_dot11req_mibset_t  *msg,
274 void                         *data);
275
276 static int prism2mib_fwid(
277 mibrec_t                     *mib,
278 int                          isget,
279 wlandevice_t                 *wlandev,
280 hfa384x_t                    *hw,
281 p80211msg_dot11req_mibset_t  *msg,
282 void                         *data);
283
284 static int prism2mib_authalg(
285 mibrec_t                     *mib,
286 int                          isget,
287 wlandevice_t                 *wlandev,
288 hfa384x_t                    *hw,
289 p80211msg_dot11req_mibset_t  *msg,
290 void                         *data);
291
292 static int prism2mib_authalgenable(
293 mibrec_t                     *mib,
294 int                          isget,
295 wlandevice_t                 *wlandev,
296 hfa384x_t                    *hw,
297 p80211msg_dot11req_mibset_t  *msg,
298 void                         *data);
299
300 static int prism2mib_priv(
301 mibrec_t                     *mib,
302 int                          isget,
303 wlandevice_t                 *wlandev,
304 hfa384x_t                    *hw,
305 p80211msg_dot11req_mibset_t  *msg,
306 void                         *data);
307
308 static void prism2mib_priv_authlist(
309 hfa384x_t      *hw,
310 prism2sta_authlist_t  *list);
311
312 static void prism2mib_priv_accessmode(
313 hfa384x_t         *hw,
314 UINT32            mode);
315
316 static void prism2mib_priv_accessallow(
317 hfa384x_t         *hw,
318 p80211macarray_t  *macarray);
319
320 static void prism2mib_priv_accessdeny(
321 hfa384x_t         *hw,
322 p80211macarray_t  *macarray);
323
324 static void prism2mib_priv_deauthenticate(
325 hfa384x_t         *hw,
326 UINT8             *addr);
327
328 /*================================================================*/
329 /* Local Static Definitions */
330
331 static mibrec_t mibtab[] = {
332
333     /* dot11smt MIB's */
334
335     { DIDmib_dot11smt_dot11StationConfigTable_dot11StationID,
336           F_AP | F_STA | F_READ | F_WRITE,
337           HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
338           prism2mib_bytearea2pstr },
339     { DIDmib_dot11smt_dot11StationConfigTable_dot11MediumOccupancyLimit,
340           F_AP | F_READ | F_WRITE,
341           HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 0,
342           prism2mib_uint32offset },
343     { DIDmib_dot11smt_dot11StationConfigTable_dot11CFPollable,
344           F_STA | F_READ,
345           HFA384x_RID_CFPOLLABLE, 0, 0,
346           prism2mib_uint32 },
347     { DIDmib_dot11smt_dot11StationConfigTable_dot11CFPPeriod,
348           F_AP | F_READ | F_WRITE,
349           HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 1,
350           prism2mib_uint32offset },
351     { DIDmib_dot11smt_dot11StationConfigTable_dot11CFPMaxDuration,
352           F_AP | F_READ | F_WRITE,
353           HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 2,
354           prism2mib_uint32offset },
355     { DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticationResponseTimeOut,
356           F_STA | F_READ | F_WRITE,
357           HFA384x_RID_CNFAUTHRSPTIMEOUT, 0, 0,
358           prism2mib_uint32 },
359     { DIDmib_dot11smt_dot11StationConfigTable_dot11PrivacyOptionImplemented,
360           F_AP | F_STA | F_READ,
361           HFA384x_RID_PRIVACYOPTIMP, 0, 0,
362           prism2mib_uint32 },
363     { DIDmib_dot11smt_dot11StationConfigTable_dot11PowerManagementMode,
364           F_STA | F_READ | F_WRITE,
365           HFA384x_RID_CNFPMENABLED, 0, 0,
366           prism2mib_powermanagement },
367     { DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredSSID,
368           F_STA | F_READ | F_WRITE,
369           HFA384x_RID_CNFDESIREDSSID, HFA384x_RID_CNFDESIREDSSID_LEN, 0,
370           prism2mib_bytestr2pstr },
371     { DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType,
372           F_STA | F_READ | F_WRITE,
373           0, 0, 0,
374           prism2mib_priv },
375     { DIDmib_dot11smt_dot11StationConfigTable_dot11OperationalRateSet,
376           F_STA | F_READ | F_WRITE,
377           HFA384x_RID_TXRATECNTL, 0, 0,
378           prism2mib_operationalrateset },
379     { DIDmib_dot11smt_dot11StationConfigTable_dot11OperationalRateSet,
380           F_AP | F_READ | F_WRITE,
381           HFA384x_RID_TXRATECNTL0, 0, 0,
382           prism2mib_operationalrateset },
383     { DIDmib_dot11smt_dot11StationConfigTable_dot11BeaconPeriod,
384           F_AP | F_READ | F_WRITE,
385           HFA384x_RID_CNFAPBCNINT, 0, 0,
386           prism2mib_uint32 },
387     { DIDmib_dot11smt_dot11StationConfigTable_dot11DTIMPeriod,
388           F_AP | F_STA | F_READ | F_WRITE,
389           HFA384x_RID_CNFOWNDTIMPER, 0, 0,
390           prism2mib_uint32 },
391     { DIDmib_dot11smt_dot11StationConfigTable_dot11AssociationResponseTimeOut,
392           F_AP | F_STA | F_READ,
393           HFA384x_RID_PROTOCOLRSPTIME, 0, 0,
394           prism2mib_uint32 },
395     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm1,
396           F_AP | F_STA | F_READ,
397           1, 0, 0,
398           prism2mib_authalg },
399     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm2,
400           F_AP | F_STA | F_READ,
401           2, 0, 0,
402           prism2mib_authalg },
403     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm3,
404           F_AP | F_STA | F_READ,
405           3, 0, 0,
406           prism2mib_authalg },
407     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm4,
408           F_AP | F_STA | F_READ,
409           4, 0, 0,
410           prism2mib_authalg },
411     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm5,
412           F_AP | F_STA | F_READ,
413           5, 0, 0,
414           prism2mib_authalg },
415     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm6,
416           F_AP | F_STA | F_READ,
417           6, 0, 0,
418           prism2mib_authalg },
419     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable1,
420           F_AP | F_STA | F_READ | F_WRITE,
421           1, 0, 0,
422           prism2mib_authalgenable },
423     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable2,
424           F_AP | F_STA | F_READ | F_WRITE,
425           2, 0, 0,
426           prism2mib_authalgenable },
427     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable3,
428           F_AP | F_STA | F_READ | F_WRITE,
429           3, 0, 0,
430           prism2mib_authalgenable },
431     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable4,
432           F_AP | F_STA | F_READ | F_WRITE,
433           4, 0, 0,
434           prism2mib_authalgenable },
435     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable5,
436           F_AP | F_STA | F_READ | F_WRITE,
437           5, 0, 0,
438           prism2mib_authalgenable },
439     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable6,
440           F_AP | F_STA | F_READ | F_WRITE,
441           6, 0, 0,
442           prism2mib_authalgenable },
443     { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0,
444           F_AP | F_STA | F_WRITE,
445           HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0,
446           prism2mib_wepdefaultkey },
447     { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1,
448           F_AP | F_STA | F_WRITE,
449           HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0,
450           prism2mib_wepdefaultkey },
451     { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2,
452           F_AP | F_STA | F_WRITE,
453           HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0,
454           prism2mib_wepdefaultkey },
455     { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3,
456           F_AP | F_STA | F_WRITE,
457           HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0,
458           prism2mib_wepdefaultkey },
459     { DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
460           F_AP | F_STA | F_READ | F_WRITE,
461           HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_PRIVINVOKED, 0,
462           prism2mib_privacyinvoked },
463     { DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
464           F_AP | F_STA | F_READ | F_WRITE,
465           HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0,
466           prism2mib_uint32 },
467     { DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
468           F_AP | F_STA | F_READ | F_WRITE,
469           HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_EXCLUDE, 0,
470           prism2mib_excludeunencrypted },
471     { DIDmib_dot11phy_dot11PhyOperationTable_dot11ShortPreambleEnabled,
472           F_AP | F_STA | F_READ | F_WRITE,
473           HFA384x_RID_CNFSHORTPREAMBLE, 0, 0,
474           prism2mib_preamble },
475
476     /* dot11mac MIB's */
477
478     { DIDmib_dot11mac_dot11OperationTable_dot11MACAddress,
479           F_AP | F_STA | F_READ | F_WRITE,
480           HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
481           prism2mib_bytearea2pstr },
482     { DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold,
483           F_STA | F_READ | F_WRITE,
484           HFA384x_RID_RTSTHRESH, 0, 0,
485           prism2mib_uint32 },
486     { DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold,
487           F_AP | F_READ | F_WRITE,
488           HFA384x_RID_RTSTHRESH0, 0, 0,
489           prism2mib_uint32 },
490     { DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit,
491           F_AP | F_STA | F_READ,
492           HFA384x_RID_SHORTRETRYLIMIT, 0, 0,
493           prism2mib_uint32 },
494     { DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit,
495           F_AP | F_STA | F_READ,
496           HFA384x_RID_LONGRETRYLIMIT, 0, 0,
497           prism2mib_uint32 },
498     { DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold,
499           F_STA | F_READ | F_WRITE,
500           HFA384x_RID_FRAGTHRESH, 0, 0,
501           prism2mib_fragmentationthreshold },
502     { DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold,
503           F_AP | F_READ | F_WRITE,
504           HFA384x_RID_FRAGTHRESH0, 0, 0,
505           prism2mib_fragmentationthreshold },
506     { DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime,
507           F_AP | F_STA | F_READ,
508           HFA384x_RID_MAXTXLIFETIME, 0, 0,
509           prism2mib_uint32 },
510     { DIDmib_dot11mac_dot11OperationTable_dot11MaxReceiveLifetime,
511           F_AP | F_STA | F_READ,
512           HFA384x_RID_MAXRXLIFETIME, 0, 0,
513           prism2mib_uint32 },
514     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1,
515           F_STA | F_READ | F_WRITE,
516           0, 0, 0,
517           prism2mib_groupaddress },
518     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2,
519           F_STA | F_READ | F_WRITE,
520           0, 0, 0,
521           prism2mib_groupaddress },
522     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3,
523           F_STA | F_READ | F_WRITE,
524           0, 0, 0,
525           prism2mib_groupaddress },
526     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4,
527           F_STA | F_READ | F_WRITE,
528           0, 0, 0,
529           prism2mib_groupaddress },
530     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5,
531           F_STA | F_READ | F_WRITE,
532           0, 0, 0,
533           prism2mib_groupaddress },
534     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6,
535           F_STA | F_READ | F_WRITE,
536           0, 0, 0,
537           prism2mib_groupaddress },
538     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7,
539           F_STA | F_READ | F_WRITE,
540           0, 0, 0,
541           prism2mib_groupaddress },
542     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8,
543           F_STA | F_READ | F_WRITE,
544           0, 0, 0,
545           prism2mib_groupaddress },
546     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9,
547           F_STA | F_READ | F_WRITE,
548           0, 0, 0,
549           prism2mib_groupaddress },
550     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10,
551           F_STA | F_READ | F_WRITE,
552           0, 0, 0,
553           prism2mib_groupaddress },
554     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11,
555           F_STA | F_READ | F_WRITE,
556           0, 0, 0,
557           prism2mib_groupaddress },
558     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12,
559           F_STA | F_READ | F_WRITE,
560           0, 0, 0,
561           prism2mib_groupaddress },
562     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13,
563           F_STA | F_READ | F_WRITE,
564           0, 0, 0,
565           prism2mib_groupaddress },
566     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14,
567           F_STA | F_READ | F_WRITE,
568           0, 0, 0,
569           prism2mib_groupaddress },
570     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15,
571           F_STA | F_READ | F_WRITE,
572           0, 0, 0,
573           prism2mib_groupaddress },
574     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16,
575           F_STA | F_READ | F_WRITE,
576           0, 0, 0,
577           prism2mib_groupaddress },
578     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17,
579           F_STA | F_READ | F_WRITE,
580           0, 0, 0,
581           prism2mib_groupaddress },
582     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18,
583           F_STA | F_READ | F_WRITE,
584           0, 0, 0,
585           prism2mib_groupaddress },
586     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19,
587           F_STA | F_READ | F_WRITE,
588           0, 0, 0,
589           prism2mib_groupaddress },
590     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20,
591           F_STA | F_READ | F_WRITE,
592           0, 0, 0,
593           prism2mib_groupaddress },
594     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21,
595           F_STA | F_READ | F_WRITE,
596           0, 0, 0,
597           prism2mib_groupaddress },
598     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22,
599           F_STA | F_READ | F_WRITE,
600           0, 0, 0,
601           prism2mib_groupaddress },
602     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23,
603           F_STA | F_READ | F_WRITE,
604           0, 0, 0,
605           prism2mib_groupaddress },
606     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24,
607           F_STA | F_READ | F_WRITE,
608           0, 0, 0,
609           prism2mib_groupaddress },
610     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25,
611           F_STA | F_READ | F_WRITE,
612           0, 0, 0,
613           prism2mib_groupaddress },
614     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26,
615           F_STA | F_READ | F_WRITE,
616           0, 0, 0,
617           prism2mib_groupaddress },
618     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27,
619           F_STA | F_READ | F_WRITE,
620           0, 0, 0,
621           prism2mib_groupaddress },
622     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28,
623           F_STA | F_READ | F_WRITE,
624           0, 0, 0,
625           prism2mib_groupaddress },
626     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29,
627           F_STA | F_READ | F_WRITE,
628           0, 0, 0,
629           prism2mib_groupaddress },
630     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30,
631           F_STA | F_READ | F_WRITE,
632           0, 0, 0,
633           prism2mib_groupaddress },
634     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31,
635           F_STA | F_READ | F_WRITE,
636           0, 0, 0,
637           prism2mib_groupaddress },
638     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32,
639           F_STA | F_READ | F_WRITE,
640           0, 0, 0,
641           prism2mib_groupaddress },
642
643     /* dot11phy MIB's */
644
645     { DIDmib_dot11phy_dot11PhyOperationTable_dot11PHYType,
646           F_AP | F_STA | F_READ,
647           HFA384x_RID_PHYTYPE, 0, 0,
648           prism2mib_uint32 },
649     { DIDmib_dot11phy_dot11PhyOperationTable_dot11TempType,
650           F_AP | F_STA | F_READ,
651           HFA384x_RID_TEMPTYPE, 0, 0,
652           prism2mib_uint32 },
653     { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
654           F_STA | F_READ,
655           HFA384x_RID_CURRENTCHANNEL, 0, 0,
656           prism2mib_uint32 },
657     { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
658           F_AP | F_READ,
659           HFA384x_RID_CNFOWNCHANNEL, 0, 0,
660           prism2mib_uint32 },
661     { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentCCAMode,
662           F_AP | F_STA | F_READ,
663           HFA384x_RID_CCAMODE, 0, 0,
664           prism2mib_uint32 },
665
666     /* p2Table MIB's */
667
668     { DIDmib_p2_p2Table_p2MMTx,
669           F_AP | F_STA | F_READ | F_WRITE,
670           0, 0, 0,
671           prism2mib_priv },
672     { DIDmib_p2_p2Table_p2EarlyBeacon,
673           F_AP | F_READ | F_WRITE,
674           BIT7, 0, 0,
675           prism2mib_appcfinfoflag },
676     { DIDmib_p2_p2Table_p2ReceivedFrameStatistics,
677           F_AP | F_STA | F_READ,
678           0, 0, 0,
679           prism2mib_priv },
680     { DIDmib_p2_p2Table_p2CommunicationTallies,
681           F_AP | F_STA | F_READ,
682           0, 0, 0,
683           prism2mib_priv },
684     { DIDmib_p2_p2Table_p2Authenticated,
685           F_AP | F_READ,
686           0, 0, 0,
687           prism2mib_priv },
688     { DIDmib_p2_p2Table_p2Associated,
689           F_AP | F_READ,
690           0, 0, 0,
691           prism2mib_priv },
692     { DIDmib_p2_p2Table_p2PowerSaveUserCount,
693           F_AP | F_READ,
694           0, 0, 0,
695           prism2mib_priv },
696     { DIDmib_p2_p2Table_p2Comment,
697           F_AP | F_STA | F_READ | F_WRITE,
698           0, 0, 0,
699           prism2mib_priv },
700     { DIDmib_p2_p2Table_p2AccessMode,
701           F_AP | F_READ | F_WRITE,
702           0, 0, 0,
703           prism2mib_priv },
704     { DIDmib_p2_p2Table_p2AccessAllow,
705           F_AP | F_READ | F_WRITE,
706           0, 0, 0,
707           prism2mib_priv },
708     { DIDmib_p2_p2Table_p2AccessDeny,
709           F_AP | F_READ | F_WRITE,
710           0, 0, 0,
711           prism2mib_priv },
712     { DIDmib_p2_p2Table_p2ChannelInfoResults,
713           F_AP | F_READ,
714           0, 0, 0,
715           prism2mib_priv },
716
717     /* p2Static MIB's */
718
719     { DIDmib_p2_p2Static_p2CnfPortType,
720           F_STA | F_READ | F_WRITE,
721           HFA384x_RID_CNFPORTTYPE, 0, 0,
722           prism2mib_uint32 },
723     { DIDmib_p2_p2Static_p2CnfOwnMACAddress,
724           F_AP | F_STA | F_READ | F_WRITE,
725           HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
726           prism2mib_bytearea2pstr },
727     { DIDmib_p2_p2Static_p2CnfDesiredSSID,
728           F_STA | F_READ | F_WRITE,
729           HFA384x_RID_CNFDESIREDSSID, HFA384x_RID_CNFDESIREDSSID_LEN, 0,
730           prism2mib_bytestr2pstr },
731     { DIDmib_p2_p2Static_p2CnfOwnChannel,
732           F_AP | F_STA | F_READ | F_WRITE,
733           HFA384x_RID_CNFOWNCHANNEL, 0, 0,
734           prism2mib_uint32 },
735     { DIDmib_p2_p2Static_p2CnfOwnSSID,
736           F_AP | F_STA | F_READ | F_WRITE,
737           HFA384x_RID_CNFOWNSSID, HFA384x_RID_CNFOWNSSID_LEN, 0,
738           prism2mib_bytestr2pstr },
739     { DIDmib_p2_p2Static_p2CnfOwnATIMWindow,
740           F_STA | F_READ | F_WRITE,
741           HFA384x_RID_CNFOWNATIMWIN, 0, 0,
742           prism2mib_uint32 },
743     { DIDmib_p2_p2Static_p2CnfSystemScale,
744           F_AP | F_STA | F_READ | F_WRITE,
745           HFA384x_RID_CNFSYSSCALE, 0, 0,
746           prism2mib_uint32 },
747     { DIDmib_p2_p2Static_p2CnfMaxDataLength,
748           F_AP | F_STA | F_READ | F_WRITE,
749           HFA384x_RID_CNFMAXDATALEN, 0, 0,
750           prism2mib_uint32 },
751     { DIDmib_p2_p2Static_p2CnfWDSAddress,
752           F_STA | F_READ | F_WRITE,
753           HFA384x_RID_CNFWDSADDR, HFA384x_RID_CNFWDSADDR_LEN, 0,
754           prism2mib_bytearea2pstr },
755     { DIDmib_p2_p2Static_p2CnfPMEnabled,
756           F_STA | F_READ | F_WRITE,
757           HFA384x_RID_CNFPMENABLED, 0, 0,
758           prism2mib_truth },
759     { DIDmib_p2_p2Static_p2CnfPMEPS,
760           F_STA | F_READ | F_WRITE,
761           HFA384x_RID_CNFPMEPS, 0, 0,
762           prism2mib_truth },
763     { DIDmib_p2_p2Static_p2CnfMulticastReceive,
764           F_STA | F_READ | F_WRITE,
765           HFA384x_RID_CNFMULTICASTRX, 0, 0,
766           prism2mib_truth },
767     { DIDmib_p2_p2Static_p2CnfMaxSleepDuration,
768           F_STA | F_READ | F_WRITE,
769           HFA384x_RID_CNFMAXSLEEPDUR, 0, 0,
770           prism2mib_uint32 },
771     { DIDmib_p2_p2Static_p2CnfPMHoldoverDuration,
772           F_STA | F_READ | F_WRITE,
773           HFA384x_RID_CNFPMHOLDDUR, 0, 0,
774           prism2mib_uint32 },
775     { DIDmib_p2_p2Static_p2CnfOwnName,
776           F_AP | F_STA | F_READ | F_WRITE,
777           HFA384x_RID_CNFOWNNAME, HFA384x_RID_CNFOWNNAME_LEN, 0,
778           prism2mib_bytestr2pstr },
779     { DIDmib_p2_p2Static_p2CnfOwnDTIMPeriod,
780           F_AP | F_STA | F_READ | F_WRITE,
781           HFA384x_RID_CNFOWNDTIMPER, 0, 0,
782           prism2mib_uint32 },
783     { DIDmib_p2_p2Static_p2CnfWDSAddress1,
784           F_AP | F_READ | F_WRITE,
785           HFA384x_RID_CNFWDSADDR1, HFA384x_RID_CNFWDSADDR1_LEN, 0,
786           prism2mib_bytearea2pstr },
787     { DIDmib_p2_p2Static_p2CnfWDSAddress2,
788           F_AP | F_READ | F_WRITE,
789           HFA384x_RID_CNFWDSADDR2, HFA384x_RID_CNFWDSADDR2_LEN, 0,
790           prism2mib_bytearea2pstr },
791     { DIDmib_p2_p2Static_p2CnfWDSAddress3,
792           F_AP | F_READ | F_WRITE,
793           HFA384x_RID_CNFWDSADDR3, HFA384x_RID_CNFWDSADDR3_LEN, 0,
794           prism2mib_bytearea2pstr },
795     { DIDmib_p2_p2Static_p2CnfWDSAddress4,
796           F_AP | F_READ | F_WRITE,
797           HFA384x_RID_CNFWDSADDR4, HFA384x_RID_CNFWDSADDR4_LEN, 0,
798           prism2mib_bytearea2pstr },
799     { DIDmib_p2_p2Static_p2CnfWDSAddress5,
800           F_AP | F_READ | F_WRITE,
801           HFA384x_RID_CNFWDSADDR5, HFA384x_RID_CNFWDSADDR5_LEN, 0,
802           prism2mib_bytearea2pstr },
803     { DIDmib_p2_p2Static_p2CnfWDSAddress6,
804           F_AP | F_READ | F_WRITE,
805           HFA384x_RID_CNFWDSADDR6, HFA384x_RID_CNFWDSADDR6_LEN, 0,
806           prism2mib_bytearea2pstr },
807     { DIDmib_p2_p2Static_p2CnfMulticastPMBuffering,
808           F_AP | F_READ | F_WRITE,
809           HFA384x_RID_CNFMCASTPMBUFF, 0, 0,
810           prism2mib_truth },
811     { DIDmib_p2_p2Static_p2CnfWEPDefaultKeyID,
812           F_AP | F_STA | F_READ | F_WRITE,
813           HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0,
814           prism2mib_uint32 },
815     { DIDmib_p2_p2Static_p2CnfWEPDefaultKey0,
816           F_AP | F_STA | F_WRITE,
817           HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0,
818           prism2mib_wepdefaultkey },
819     { DIDmib_p2_p2Static_p2CnfWEPDefaultKey1,
820           F_AP | F_STA | F_WRITE,
821           HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0,
822           prism2mib_wepdefaultkey },
823     { DIDmib_p2_p2Static_p2CnfWEPDefaultKey2,
824           F_AP | F_STA | F_WRITE,
825           HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0,
826           prism2mib_wepdefaultkey },
827     { DIDmib_p2_p2Static_p2CnfWEPDefaultKey3,
828           F_AP | F_STA | F_WRITE,
829           HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0,
830           prism2mib_wepdefaultkey },
831     { DIDmib_p2_p2Static_p2CnfWEPFlags,
832           F_AP | F_STA | F_READ | F_WRITE,
833           HFA384x_RID_CNFWEPFLAGS, 0, 0,
834           prism2mib_uint32 },
835     { DIDmib_p2_p2Static_p2CnfAuthentication,
836           F_AP | F_STA | F_READ | F_WRITE,
837           HFA384x_RID_CNFAUTHENTICATION, 0, 0,
838           prism2mib_uint32 },
839     { DIDmib_p2_p2Static_p2CnfMaxAssociatedStations,
840           F_AP | F_READ | F_WRITE,
841           HFA384x_RID_CNFMAXASSOCSTATIONS, 0, 0,
842           prism2mib_uint32 },
843     { DIDmib_p2_p2Static_p2CnfTxControl,
844           F_AP | F_STA | F_READ | F_WRITE,
845           HFA384x_RID_CNFTXCONTROL, 0, 0,
846           prism2mib_uint32 },
847     { DIDmib_p2_p2Static_p2CnfRoamingMode,
848           F_STA | F_READ | F_WRITE,
849           HFA384x_RID_CNFROAMINGMODE, 0, 0,
850           prism2mib_uint32 },
851     { DIDmib_p2_p2Static_p2CnfHostAuthentication,
852           F_AP | F_READ | F_WRITE,
853           HFA384x_RID_CNFHOSTAUTHASSOC, 0, 0,
854           prism2mib_truth },
855     { DIDmib_p2_p2Static_p2CnfRcvCrcError,
856           F_AP | F_STA | F_READ | F_WRITE,
857           HFA384x_RID_CNFRCVCRCERROR, 0, 0,
858           prism2mib_uint32 },
859     { DIDmib_p2_p2Static_p2CnfAltRetryCount,
860           F_AP | F_STA | F_READ | F_WRITE,
861           HFA384x_RID_CNFALTRETRYCNT, 0, 0,
862           prism2mib_uint32 },
863     { DIDmib_p2_p2Static_p2CnfBeaconInterval,
864           F_AP | F_READ | F_WRITE,
865           HFA384x_RID_CNFAPBCNINT, 0, 0,
866           prism2mib_uint32 },
867     { DIDmib_p2_p2Static_p2CnfMediumOccupancyLimit,
868           F_AP | F_READ | F_WRITE,
869           HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 0,
870           prism2mib_uint32offset },
871     { DIDmib_p2_p2Static_p2CnfCFPPeriod,
872           F_AP | F_READ | F_WRITE,
873           HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 1,
874           prism2mib_uint32offset },
875     { DIDmib_p2_p2Static_p2CnfCFPMaxDuration,
876           F_AP | F_READ | F_WRITE,
877           HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 2,
878           prism2mib_uint32offset },
879     { DIDmib_p2_p2Static_p2CnfCFPFlags,
880           F_AP | F_READ | F_WRITE,
881           HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 3,
882           prism2mib_uint32offset },
883     { DIDmib_p2_p2Static_p2CnfSTAPCFInfo,
884           F_STA | F_READ | F_WRITE,
885           HFA384x_RID_CNFSTAPCFINFO, 0, 0,
886           prism2mib_uint32 },
887     { DIDmib_p2_p2Static_p2CnfPriorityQUsage,
888           F_AP | F_STA | F_READ | F_WRITE,
889           HFA384x_RID_CNFPRIORITYQUSAGE, HFA384x_RID_CNFPRIOQUSAGE_LEN, 0,
890           prism2mib_uint32array },
891     { DIDmib_p2_p2Static_p2CnfTIMCtrl,
892           F_AP | F_STA | F_READ | F_WRITE,
893           HFA384x_RID_CNFTIMCTRL, 0, 0,
894           prism2mib_uint32 },
895     { DIDmib_p2_p2Static_p2CnfThirty2Tally,
896           F_AP | F_STA | F_READ | F_WRITE,
897           HFA384x_RID_CNFTHIRTY2TALLY, 0, 0,
898           prism2mib_truth },
899     { DIDmib_p2_p2Static_p2CnfEnhSecurity,
900           F_AP | F_READ | F_WRITE,
901           HFA384x_RID_CNFENHSECURITY, 0, 0,
902           prism2mib_uint32 },
903     { DIDmib_p2_p2Static_p2CnfShortPreamble,
904           F_AP | F_STA | F_READ | F_WRITE,
905           HFA384x_RID_CNFSHORTPREAMBLE, 0, 0,
906           prism2mib_preamble },
907     { DIDmib_p2_p2Static_p2CnfExcludeLongPreamble,
908           F_AP | F_READ | F_WRITE,
909           HFA384x_RID_CNFEXCLONGPREAMBLE, 0, 0,
910           prism2mib_truth },
911     { DIDmib_p2_p2Static_p2CnfAuthenticationRspTO,
912           F_STA | F_READ | F_WRITE,
913           HFA384x_RID_CNFAUTHRSPTIMEOUT, 0, 0,
914           prism2mib_uint32 },
915     { DIDmib_p2_p2Static_p2CnfBasicRates,
916           F_AP | F_STA | F_READ | F_WRITE,
917           HFA384x_RID_CNFBASICRATES, 0, 0,
918           prism2mib_uint32 },
919     { DIDmib_p2_p2Static_p2CnfSupportedRates,
920           F_AP | F_STA | F_READ | F_WRITE,
921           HFA384x_RID_CNFSUPPRATES, 0, 0,
922           prism2mib_uint32 },
923
924     /* p2Dynamic MIB's */
925
926     { DIDmib_p2_p2Dynamic_p2CreateIBSS,
927           F_STA | F_READ | F_WRITE,
928           HFA384x_RID_CREATEIBSS, 0, 0,
929           prism2mib_truth },
930     { DIDmib_p2_p2Dynamic_p2FragmentationThreshold,
931           F_STA | F_READ | F_WRITE,
932           HFA384x_RID_FRAGTHRESH, 0, 0,
933           prism2mib_fragmentationthreshold },
934     { DIDmib_p2_p2Dynamic_p2RTSThreshold,
935           F_STA | F_READ | F_WRITE,
936           HFA384x_RID_RTSTHRESH, 0, 0,
937           prism2mib_uint32 },
938     { DIDmib_p2_p2Dynamic_p2TxRateControl,
939           F_STA | F_READ | F_WRITE,
940           HFA384x_RID_TXRATECNTL, 0, 0,
941           prism2mib_uint32 },
942     { DIDmib_p2_p2Dynamic_p2PromiscuousMode,
943           F_STA | F_READ | F_WRITE,
944           HFA384x_RID_PROMISCMODE, 0, 0,
945           prism2mib_truth },
946     { DIDmib_p2_p2Dynamic_p2FragmentationThreshold0,
947           F_AP | F_READ | F_WRITE,
948           HFA384x_RID_FRAGTHRESH0, 0, 0,
949           prism2mib_fragmentationthreshold },
950     { DIDmib_p2_p2Dynamic_p2FragmentationThreshold1,
951           F_AP | F_READ | F_WRITE,
952           HFA384x_RID_FRAGTHRESH1, 0, 0,
953           prism2mib_fragmentationthreshold },
954     { DIDmib_p2_p2Dynamic_p2FragmentationThreshold2,
955           F_AP | F_READ | F_WRITE,
956           HFA384x_RID_FRAGTHRESH2, 0, 0,
957           prism2mib_fragmentationthreshold },
958     { DIDmib_p2_p2Dynamic_p2FragmentationThreshold3,
959           F_AP | F_READ | F_WRITE,
960           HFA384x_RID_FRAGTHRESH3, 0, 0,
961           prism2mib_fragmentationthreshold },
962     { DIDmib_p2_p2Dynamic_p2FragmentationThreshold4,
963           F_AP | F_READ | F_WRITE,
964           HFA384x_RID_FRAGTHRESH4, 0, 0,
965           prism2mib_fragmentationthreshold },
966     { DIDmib_p2_p2Dynamic_p2FragmentationThreshold5,
967           F_AP | F_READ | F_WRITE,
968           HFA384x_RID_FRAGTHRESH5, 0, 0,
969           prism2mib_fragmentationthreshold },
970     { DIDmib_p2_p2Dynamic_p2FragmentationThreshold6,
971           F_AP | F_READ | F_WRITE,
972           HFA384x_RID_FRAGTHRESH6, 0, 0,
973           prism2mib_fragmentationthreshold },
974     { DIDmib_p2_p2Dynamic_p2RTSThreshold0,
975           F_AP | F_READ | F_WRITE,
976           HFA384x_RID_RTSTHRESH0, 0, 0,
977           prism2mib_uint32 },
978     { DIDmib_p2_p2Dynamic_p2RTSThreshold1,
979           F_AP | F_READ | F_WRITE,
980           HFA384x_RID_RTSTHRESH1, 0, 0,
981           prism2mib_uint32 },
982     { DIDmib_p2_p2Dynamic_p2RTSThreshold2,
983           F_AP | F_READ | F_WRITE,
984           HFA384x_RID_RTSTHRESH2, 0, 0,
985           prism2mib_uint32 },
986     { DIDmib_p2_p2Dynamic_p2RTSThreshold3,
987           F_AP | F_READ | F_WRITE,
988           HFA384x_RID_RTSTHRESH3, 0, 0,
989           prism2mib_uint32 },
990     { DIDmib_p2_p2Dynamic_p2RTSThreshold4,
991           F_AP | F_READ | F_WRITE,
992           HFA384x_RID_RTSTHRESH4, 0, 0,
993           prism2mib_uint32 },
994     { DIDmib_p2_p2Dynamic_p2RTSThreshold5,
995           F_AP | F_READ | F_WRITE,
996           HFA384x_RID_RTSTHRESH5, 0, 0,
997           prism2mib_uint32 },
998     { DIDmib_p2_p2Dynamic_p2RTSThreshold6,
999           F_AP | F_READ | F_WRITE,
1000           HFA384x_RID_RTSTHRESH6, 0, 0,
1001           prism2mib_uint32 },
1002     { DIDmib_p2_p2Dynamic_p2TxRateControl0,
1003           F_AP | F_READ | F_WRITE,
1004           HFA384x_RID_TXRATECNTL0, 0, 0,
1005           prism2mib_uint32 },
1006     { DIDmib_p2_p2Dynamic_p2TxRateControl1,
1007           F_AP | F_READ | F_WRITE,
1008           HFA384x_RID_TXRATECNTL1, 0, 0,
1009           prism2mib_uint32 },
1010     { DIDmib_p2_p2Dynamic_p2TxRateControl2,
1011           F_AP | F_READ | F_WRITE,
1012           HFA384x_RID_TXRATECNTL2, 0, 0,
1013           prism2mib_uint32 },
1014     { DIDmib_p2_p2Dynamic_p2TxRateControl3,
1015           F_AP | F_READ | F_WRITE,
1016           HFA384x_RID_TXRATECNTL3, 0, 0,
1017           prism2mib_uint32 },
1018     { DIDmib_p2_p2Dynamic_p2TxRateControl4,
1019           F_AP | F_READ | F_WRITE,
1020           HFA384x_RID_TXRATECNTL4, 0, 0,
1021           prism2mib_uint32 },
1022     { DIDmib_p2_p2Dynamic_p2TxRateControl5,
1023           F_AP | F_READ | F_WRITE,
1024           HFA384x_RID_TXRATECNTL5, 0, 0,
1025           prism2mib_uint32 },
1026     { DIDmib_p2_p2Dynamic_p2TxRateControl6,
1027           F_AP | F_READ | F_WRITE,
1028           HFA384x_RID_TXRATECNTL6, 0, 0,
1029           prism2mib_uint32 },
1030
1031     /* p2Behavior MIB's */
1032
1033     { DIDmib_p2_p2Behavior_p2TickTime,
1034           F_AP | F_STA | F_READ | F_WRITE,
1035           HFA384x_RID_ITICKTIME, 0, 0,
1036           prism2mib_uint32 },
1037
1038     /* p2NIC MIB's */
1039
1040     { DIDmib_p2_p2NIC_p2MaxLoadTime,
1041           F_AP | F_STA | F_READ,
1042           HFA384x_RID_MAXLOADTIME, 0, 0,
1043           prism2mib_uint32 },
1044     { DIDmib_p2_p2NIC_p2DLBufferPage,
1045           F_AP | F_STA | F_READ,
1046           HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 0,
1047           prism2mib_uint32offset },
1048     { DIDmib_p2_p2NIC_p2DLBufferOffset,
1049           F_AP | F_STA | F_READ,
1050           HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 1,
1051           prism2mib_uint32offset },
1052     { DIDmib_p2_p2NIC_p2DLBufferLength,
1053           F_AP | F_STA | F_READ,
1054           HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 2,
1055           prism2mib_uint32offset },
1056     { DIDmib_p2_p2NIC_p2PRIIdentity,
1057           F_AP | F_STA | F_READ,
1058           HFA384x_RID_PRIIDENTITY, HFA384x_RID_PRIIDENTITY_LEN, 0,
1059           prism2mib_uint32array },
1060     { DIDmib_p2_p2NIC_p2PRISupRange,
1061           F_AP | F_STA | F_READ,
1062           HFA384x_RID_PRISUPRANGE, HFA384x_RID_PRISUPRANGE_LEN, 0,
1063           prism2mib_uint32array },
1064     { DIDmib_p2_p2NIC_p2CFIActRanges,
1065           F_AP | F_STA | F_READ,
1066           HFA384x_RID_PRI_CFIACTRANGES, HFA384x_RID_CFIACTRANGES_LEN, 0,
1067           prism2mib_uint32array },
1068     { DIDmib_p2_p2NIC_p2BuildSequence,
1069           F_AP | F_STA | F_READ,
1070           HFA384x_RID_BUILDSEQ, HFA384x_RID_BUILDSEQ_LEN, 0,
1071           prism2mib_uint32array },
1072     { DIDmib_p2_p2NIC_p2PrimaryFWID,
1073           F_AP | F_STA | F_READ,
1074           0, 0, 0,
1075           prism2mib_fwid },
1076     { DIDmib_p2_p2NIC_p2SecondaryFWID,
1077           F_AP | F_STA | F_READ,
1078           0, 0, 0,
1079           prism2mib_fwid },
1080     { DIDmib_p2_p2NIC_p2TertiaryFWID,
1081           F_AP | F_READ,
1082           0, 0, 0,
1083           prism2mib_fwid },
1084     { DIDmib_p2_p2NIC_p2NICSerialNumber,
1085           F_AP | F_STA | F_READ,
1086           HFA384x_RID_NICSERIALNUMBER, HFA384x_RID_NICSERIALNUMBER_LEN, 0,
1087           prism2mib_bytearea2pstr },
1088     { DIDmib_p2_p2NIC_p2NICIdentity,
1089           F_AP | F_STA | F_READ,
1090           HFA384x_RID_NICIDENTITY, HFA384x_RID_NICIDENTITY_LEN, 0,
1091           prism2mib_uint32array },
1092     { DIDmib_p2_p2NIC_p2MFISupRange,
1093           F_AP | F_STA | F_READ,
1094           HFA384x_RID_MFISUPRANGE, HFA384x_RID_MFISUPRANGE_LEN, 0,
1095           prism2mib_uint32array },
1096     { DIDmib_p2_p2NIC_p2CFISupRange,
1097           F_AP | F_STA | F_READ,
1098           HFA384x_RID_CFISUPRANGE, HFA384x_RID_CFISUPRANGE_LEN, 0,
1099           prism2mib_uint32array },
1100     { DIDmib_p2_p2NIC_p2ChannelList,
1101           F_AP | F_STA | F_READ,
1102           HFA384x_RID_CHANNELLIST, 0, 0,
1103           prism2mib_uint32 },
1104     { DIDmib_p2_p2NIC_p2RegulatoryDomains,
1105           F_AP | F_STA | F_READ,
1106           HFA384x_RID_REGULATORYDOMAINS, HFA384x_RID_REGULATORYDOMAINS_LEN, 0,
1107           prism2mib_regulatorydomains },
1108     { DIDmib_p2_p2NIC_p2TempType,
1109           F_AP | F_STA | F_READ,
1110           HFA384x_RID_TEMPTYPE, 0, 0,
1111           prism2mib_uint32 },
1112     { DIDmib_p2_p2NIC_p2STAIdentity,
1113           F_AP | F_STA | F_READ,
1114           HFA384x_RID_STAIDENTITY, HFA384x_RID_STAIDENTITY_LEN, 0,
1115           prism2mib_uint32array },
1116     { DIDmib_p2_p2NIC_p2STASupRange,
1117           F_AP | F_STA | F_READ,
1118           HFA384x_RID_STASUPRANGE, HFA384x_RID_STASUPRANGE_LEN, 0,
1119           prism2mib_uint32array },
1120     { DIDmib_p2_p2NIC_p2MFIActRanges,
1121           F_AP | F_STA | F_READ,
1122           HFA384x_RID_STA_MFIACTRANGES, HFA384x_RID_MFIACTRANGES_LEN, 0,
1123           prism2mib_uint32array },
1124     { DIDmib_p2_p2NIC_p2STACFIActRanges,
1125           F_AP | F_STA | F_READ,
1126           HFA384x_RID_STA_CFIACTRANGES, HFA384x_RID_CFIACTRANGES2_LEN, 0,
1127           prism2mib_uint32array },
1128
1129     /* p2MAC MIB's */
1130
1131     { DIDmib_p2_p2MAC_p2PortStatus,
1132           F_STA | F_READ,
1133           HFA384x_RID_PORTSTATUS, 0, 0,
1134           prism2mib_uint32 },
1135     { DIDmib_p2_p2MAC_p2CurrentSSID,
1136           F_STA | F_READ,
1137           HFA384x_RID_CURRENTSSID, HFA384x_RID_CURRENTSSID_LEN, 0,
1138           prism2mib_bytestr2pstr },
1139     { DIDmib_p2_p2MAC_p2CurrentBSSID,
1140           F_STA | F_READ,
1141           HFA384x_RID_CURRENTBSSID, HFA384x_RID_CURRENTBSSID_LEN, 0,
1142           prism2mib_bytearea2pstr },
1143     { DIDmib_p2_p2MAC_p2CommsQuality,
1144           F_STA | F_READ,
1145           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
1146           prism2mib_uint32array },
1147     { DIDmib_p2_p2MAC_p2CommsQualityCQ,
1148           F_STA | F_READ,
1149           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
1150           prism2mib_uint32offset },
1151     { DIDmib_p2_p2MAC_p2CommsQualityASL,
1152           F_STA | F_READ,
1153           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 1,
1154           prism2mib_uint32offset },
1155     { DIDmib_p2_p2MAC_p2CommsQualityANL,
1156           F_STA | F_READ,
1157           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 2,
1158           prism2mib_uint32offset },
1159     { DIDmib_p2_p2MAC_p2dbmCommsQuality,
1160           F_STA | F_READ,
1161           HFA384x_RID_DBMCOMMSQUALITY, HFA384x_RID_DBMCOMMSQUALITY_LEN, 0,
1162           prism2mib_uint32array },
1163     { DIDmib_p2_p2MAC_p2dbmCommsQualityCQ,
1164           F_STA | F_READ,
1165           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
1166           prism2mib_uint32offset },
1167     { DIDmib_p2_p2MAC_p2dbmCommsQualityASL,
1168           F_STA | F_READ,
1169           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 1,
1170           prism2mib_uint32offset },
1171     { DIDmib_p2_p2MAC_p2dbmCommsQualityANL,
1172           F_STA | F_READ,
1173           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 2,
1174           prism2mib_uint32offset },
1175     { DIDmib_p2_p2MAC_p2CurrentTxRate,
1176           F_STA | F_READ,
1177           HFA384x_RID_CURRENTTXRATE, 0, 0,
1178           prism2mib_uint32 },
1179     { DIDmib_p2_p2MAC_p2CurrentBeaconInterval,
1180           F_AP | F_STA | F_READ,
1181           HFA384x_RID_CURRENTBCNINT, 0, 0,
1182           prism2mib_uint32 },
1183     { DIDmib_p2_p2MAC_p2StaCurrentScaleThresholds,
1184           F_STA | F_READ,
1185           HFA384x_RID_CURRENTSCALETHRESH, HFA384x_RID_STACURSCALETHRESH_LEN, 0,
1186           prism2mib_uint32array },
1187     { DIDmib_p2_p2MAC_p2APCurrentScaleThresholds,
1188           F_AP | F_READ,
1189           HFA384x_RID_CURRENTSCALETHRESH, HFA384x_RID_APCURSCALETHRESH_LEN, 0,
1190           prism2mib_uint32array },
1191     { DIDmib_p2_p2MAC_p2ProtocolRspTime,
1192           F_AP | F_STA | F_READ,
1193           HFA384x_RID_PROTOCOLRSPTIME, 0, 0,
1194           prism2mib_uint32 },
1195     { DIDmib_p2_p2MAC_p2ShortRetryLimit,
1196           F_AP | F_STA | F_READ,
1197           HFA384x_RID_SHORTRETRYLIMIT, 0, 0,
1198           prism2mib_uint32 },
1199     { DIDmib_p2_p2MAC_p2LongRetryLimit,
1200           F_AP | F_STA | F_READ,
1201           HFA384x_RID_LONGRETRYLIMIT, 0, 0,
1202           prism2mib_uint32 },
1203     { DIDmib_p2_p2MAC_p2MaxTransmitLifetime,
1204           F_AP | F_STA | F_READ,
1205           HFA384x_RID_MAXTXLIFETIME, 0, 0,
1206           prism2mib_uint32 },
1207     { DIDmib_p2_p2MAC_p2MaxReceiveLifetime,
1208           F_AP | F_STA | F_READ,
1209           HFA384x_RID_MAXRXLIFETIME, 0, 0,
1210           prism2mib_uint32 },
1211     { DIDmib_p2_p2MAC_p2CFPollable,
1212           F_STA | F_READ,
1213           HFA384x_RID_CFPOLLABLE, 0, 0,
1214           prism2mib_uint32 },
1215     { DIDmib_p2_p2MAC_p2AuthenticationAlgorithms,
1216           F_AP | F_STA | F_READ,
1217           HFA384x_RID_AUTHALGORITHMS, HFA384x_RID_AUTHALGORITHMS_LEN, 0,
1218           prism2mib_uint32array },
1219     { DIDmib_p2_p2MAC_p2PrivacyOptionImplemented,
1220           F_AP | F_STA | F_READ,
1221           HFA384x_RID_PRIVACYOPTIMP, 0, 0,
1222           prism2mib_uint32 },
1223     { DIDmib_p2_p2MAC_p2CurrentTxRate1,
1224           F_AP | F_READ,
1225           HFA384x_RID_CURRENTTXRATE1, 0, 0,
1226           prism2mib_uint32 },
1227     { DIDmib_p2_p2MAC_p2CurrentTxRate2,
1228           F_AP | F_READ,
1229           HFA384x_RID_CURRENTTXRATE2, 0, 0,
1230           prism2mib_uint32 },
1231     { DIDmib_p2_p2MAC_p2CurrentTxRate3,
1232           F_AP | F_READ,
1233           HFA384x_RID_CURRENTTXRATE3, 0, 0,
1234           prism2mib_uint32 },
1235     { DIDmib_p2_p2MAC_p2CurrentTxRate4,
1236           F_AP | F_READ,
1237           HFA384x_RID_CURRENTTXRATE4, 0, 0,
1238           prism2mib_uint32 },
1239     { DIDmib_p2_p2MAC_p2CurrentTxRate5,
1240           F_AP | F_READ,
1241           HFA384x_RID_CURRENTTXRATE5, 0, 0,
1242           prism2mib_uint32 },
1243     { DIDmib_p2_p2MAC_p2CurrentTxRate6,
1244           F_AP | F_READ,
1245           HFA384x_RID_CURRENTTXRATE6, 0, 0,
1246           prism2mib_uint32 },
1247     { DIDmib_p2_p2MAC_p2OwnMACAddress,
1248           F_AP | F_READ,
1249           HFA384x_RID_OWNMACADDRESS, HFA384x_RID_OWNMACADDRESS_LEN, 0,
1250           prism2mib_bytearea2pstr },
1251
1252     /* p2Modem MIB's */
1253
1254     { DIDmib_p2_p2Modem_p2PHYType,
1255           F_AP | F_STA | F_READ,
1256           HFA384x_RID_PHYTYPE, 0, 0,
1257           prism2mib_uint32 },
1258     { DIDmib_p2_p2Modem_p2CurrentChannel,
1259           F_AP | F_STA | F_READ,
1260           HFA384x_RID_CURRENTCHANNEL, 0, 0,
1261           prism2mib_uint32 },
1262     { DIDmib_p2_p2Modem_p2CurrentPowerState,
1263           F_AP | F_STA | F_READ,
1264           HFA384x_RID_CURRENTPOWERSTATE, 0, 0,
1265           prism2mib_uint32 },
1266     { DIDmib_p2_p2Modem_p2CCAMode,
1267           F_AP | F_STA | F_READ,
1268           HFA384x_RID_CCAMODE, 0, 0,
1269           prism2mib_uint32 },
1270     { DIDmib_p2_p2Modem_p2TxPowerMax,
1271           F_AP | F_STA | F_READ | F_WRITE,
1272           HFA384x_RID_TXPOWERMAX, 0, 0,
1273           prism2mib_uint32 },
1274     { DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel,
1275           F_AP | F_STA | F_READ | F_WRITE,
1276           HFA384x_RID_TXPOWERMAX, 0, 0,
1277           prism2mib_uint32 },
1278     { DIDmib_p2_p2Modem_p2SupportedDataRates,
1279           F_AP | F_STA | F_READ,
1280           HFA384x_RID_SUPPORTEDDATARATES, HFA384x_RID_SUPPORTEDDATARATES_LEN, 0,
1281           prism2mib_bytestr2pstr },
1282
1283     /* And finally, lnx mibs */
1284     { DIDmib_lnx_lnxConfigTable_lnxRSNAIE,
1285           F_STA | F_READ | F_WRITE,
1286           HFA384x_RID_CNFWPADATA, 0, 0,
1287           prism2mib_priv },
1288     { 0, 0, 0, 0, 0, NULL}};
1289
1290 /*----------------------------------------------------------------
1291 These MIB's are not supported at this time:
1292
1293 DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityPresent
1294 DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityEnabled
1295 DIDmib_dot11phy_dot11PhyDSSSTable_dot11PBCCOptionImplemented
1296 DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportIndex
1297 DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxIndex
1298 DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxValue
1299 DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxIndex
1300 DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxValue
1301
1302 DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportValue
1303 TODO: need to investigate why wlan has this as enumerated and Prism2 has this
1304       as btye str.
1305
1306 DIDmib_dot11phy_dot11PhyDSSSTable_dot11ShortPreambleOptionImplemented
1307 TODO: Find out the firmware version number(s) for identifying
1308       whether the firmware is capable of short preamble. TRUE or FALSE
1309       will be returned based on the version of the firmware.
1310
1311 WEP Key mappings aren't supported in the f/w.
1312 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingIndex
1313 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingAddress
1314 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingWEPOn
1315 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingValue
1316 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPKeyMappingLength
1317
1318 TODO: implement counters.
1319 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPICVErrorCount
1320 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPExcludedCount
1321 DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFragmentCount
1322 DIDmib_dot11mac_dot11CountersTable_dot11MulticastTransmittedFrameCount
1323 DIDmib_dot11mac_dot11CountersTable_dot11FailedCount
1324 DIDmib_dot11mac_dot11CountersTable_dot11RetryCount
1325 DIDmib_dot11mac_dot11CountersTable_dot11MultipleRetryCount
1326 DIDmib_dot11mac_dot11CountersTable_dot11FrameDuplicateCount
1327 DIDmib_dot11mac_dot11CountersTable_dot11RTSSuccessCount
1328 DIDmib_dot11mac_dot11CountersTable_dot11RTSFailureCount
1329 DIDmib_dot11mac_dot11CountersTable_dot11ACKFailureCount
1330 DIDmib_dot11mac_dot11CountersTable_dot11ReceivedFragmentCount
1331 DIDmib_dot11mac_dot11CountersTable_dot11MulticastReceivedFrameCount
1332 DIDmib_dot11mac_dot11CountersTable_dot11FCSErrorCount
1333 DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFrameCount
1334 DIDmib_dot11mac_dot11CountersTable_dot11WEPUndecryptableCount
1335
1336 TODO: implement sane values for these.
1337 DIDmib_dot11mac_dot11OperationTable_dot11ManufacturerID
1338 DIDmib_dot11mac_dot11OperationTable_dot11ProductID
1339
1340 Not too worried about these at the moment.
1341 DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentTxAntenna
1342 DIDmib_dot11phy_dot11PhyAntennaTable_dot11DiversitySupport
1343 DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentRxAntenna
1344 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11NumberSupportedPowerLevels
1345 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel1
1346 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel2
1347 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel3
1348 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel4
1349 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel5
1350 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel6
1351 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel7
1352 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel8
1353 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel
1354
1355 Ummm, FH and IR don't apply
1356 DIDmib_dot11phy_dot11PhyFHSSTable_dot11HopTime
1357 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentChannelNumber
1358 DIDmib_dot11phy_dot11PhyFHSSTable_dot11MaxDwellTime
1359 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentDwellTime
1360 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentSet
1361 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentPattern
1362 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentIndex
1363 DIDmib_dot11phy_dot11PhyDSSSTable_dot11CCAModeSupported
1364 DIDmib_dot11phy_dot11PhyDSSSTable_dot11EDThreshold
1365 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMax
1366 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMax
1367 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMin
1368 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMin
1369
1370 We just don't have enough antennas right now to worry about this.
1371 DIDmib_dot11phy_dot11AntennasListTable_dot11AntennaListIndex
1372 DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedTxAntenna
1373 DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedRxAntenna
1374 DIDmib_dot11phy_dot11AntennasListTable_dot11DiversitySelectionRx
1375
1376 ------------------------------------------------------------------*/
1377
1378 /*================================================================*/
1379 /* Function Definitions */
1380
1381 /*----------------------------------------------------------------
1382 * prism2mgmt_mibset_mibget
1383 *
1384 * Set the value of a mib item.
1385 *
1386 * Arguments:
1387 *       wlandev         wlan device structure
1388 *       msgp            ptr to msg buffer
1389 *
1390 * Returns:
1391 *       0       success and done
1392 *       <0      success, but we're waiting for something to finish.
1393 *       >0      an error occurred while handling the message.
1394 * Side effects:
1395 *
1396 * Call context:
1397 *       process thread  (usually)
1398 *       interrupt
1399 ----------------------------------------------------------------*/
1400
1401 int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp)
1402 {
1403         hfa384x_t               *hw = wlandev->priv;
1404         int                     result, isget;
1405         mibrec_t                *mib;
1406         UINT16                  which;
1407
1408         p80211msg_dot11req_mibset_t     *msg = msgp;
1409         p80211itemd_t                   *mibitem;
1410
1411         DBFENTER;
1412
1413         msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
1414         msg->resultcode.data = P80211ENUM_resultcode_success;
1415
1416         /*
1417         ** Determine if this is an Access Point or a station.
1418         */
1419
1420         which = hw->ap ? F_AP : F_STA;
1421
1422         /*
1423         ** Find the MIB in the MIB table.  Note that a MIB may be in the
1424         ** table twice...once for an AP and once for a station.  Make sure
1425         ** to get the correct one.  Note that DID=0 marks the end of the
1426         ** MIB table.
1427         */
1428
1429         mibitem = (p80211itemd_t *) msg->mibattribute.data;
1430
1431         for (mib = mibtab; mib->did != 0; mib++)
1432                 if (mib->did == mibitem->did && (mib->flag & which))
1433                         break;
1434
1435         if (mib->did == 0) {
1436                 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
1437                 goto done;
1438         }
1439
1440         /*
1441         ** Determine if this is a "mibget" or a "mibset".  If this is a
1442         ** "mibget", then make sure that the MIB may be read.  Otherwise,
1443         ** this is a "mibset" so make make sure that the MIB may be written.
1444         */
1445
1446         isget = (msg->msgcode == DIDmsg_dot11req_mibget);
1447
1448         if (isget) {
1449                 if (!(mib->flag & F_READ)) {
1450                         msg->resultcode.data =
1451                                 P80211ENUM_resultcode_cant_get_writeonly_mib;
1452                         goto done;
1453                 }
1454         } else {
1455                 if (!(mib->flag & F_WRITE)) {
1456                         msg->resultcode.data =
1457                                 P80211ENUM_resultcode_cant_set_readonly_mib;
1458                         goto done;
1459                 }
1460         }
1461
1462         /*
1463         ** Execute the MIB function.  If things worked okay, then make
1464         ** sure that the MIB function also worked okay.  If so, and this
1465         ** is a "mibget", then the status value must be set for both the
1466         ** "mibattribute" parameter and the mib item within the data
1467         ** portion of the "mibattribute".
1468         */
1469
1470         result = mib->func(mib, isget, wlandev, hw, msg,
1471                            (void *) mibitem->data);
1472
1473         if (msg->resultcode.data == P80211ENUM_resultcode_success) {
1474                 if (result != 0) {
1475                         WLAN_LOG_DEBUG(1, "get/set failure, result=%d\n",
1476                                         result);
1477                         msg->resultcode.data =
1478                                  P80211ENUM_resultcode_implementation_failure;
1479                 } else {
1480                         if (isget) {
1481                                 msg->mibattribute.status =
1482                                         P80211ENUM_msgitem_status_data_ok;
1483                                 mibitem->status =
1484                                         P80211ENUM_msgitem_status_data_ok;
1485                         }
1486                 }
1487         }
1488
1489 done:
1490         DBFEXIT;
1491
1492         return(0);
1493 }
1494
1495 /*----------------------------------------------------------------
1496 * prism2mib_bytestr2pstr
1497 *
1498 * Get/set pstr data to/from a byte string.
1499 *
1500 * MIB record parameters:
1501 *       parm1    Prism2 RID value.
1502 *       parm2    Number of bytes of RID data.
1503 *       parm3    Not used.
1504 *
1505 * Arguments:
1506 *       mib      MIB record.
1507 *       isget    MIBGET/MIBSET flag.
1508 *       wlandev  wlan device structure.
1509 *       priv     "priv" structure.
1510 *       hw       "hw" structure.
1511 *       msg      Message structure.
1512 *       data     Data buffer.
1513 *
1514 * Returns:
1515 *       0   - Success.
1516 *       ~0  - Error.
1517 *
1518 ----------------------------------------------------------------*/
1519
1520 static int prism2mib_bytestr2pstr(
1521 mibrec_t                     *mib,
1522 int                          isget,
1523 wlandevice_t                 *wlandev,
1524 hfa384x_t                    *hw,
1525 p80211msg_dot11req_mibset_t  *msg,
1526 void                         *data)
1527 {
1528         int                result;
1529         p80211pstrd_t      *pstr = (p80211pstrd_t*) data;
1530         UINT8              bytebuf[MIB_TMP_MAXLEN];
1531         hfa384x_bytestr_t  *p2bytestr = (hfa384x_bytestr_t*) bytebuf;
1532
1533         DBFENTER;
1534
1535         if (isget) {
1536                 result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2);
1537                 prism2mgmt_bytestr2pstr(p2bytestr, pstr);
1538         } else {
1539                 memset(bytebuf, 0, mib->parm2);
1540                 prism2mgmt_pstr2bytestr(p2bytestr, pstr);
1541                 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
1542         }
1543
1544         DBFEXIT;
1545         return(result);
1546 }
1547
1548 /*----------------------------------------------------------------
1549 * prism2mib_bytearea2pstr
1550 *
1551 * Get/set pstr data to/from a byte area.
1552 *
1553 * MIB record parameters:
1554 *       parm1    Prism2 RID value.
1555 *       parm2    Number of bytes of RID data.
1556 *       parm3    Not used.
1557 *
1558 * Arguments:
1559 *       mib      MIB record.
1560 *       isget    MIBGET/MIBSET flag.
1561 *       wlandev  wlan device structure.
1562 *       priv     "priv" structure.
1563 *       hw       "hw" structure.
1564 *       msg      Message structure.
1565 *       data     Data buffer.
1566 *
1567 * Returns:
1568 *       0   - Success.
1569 *       ~0  - Error.
1570 *
1571 ----------------------------------------------------------------*/
1572
1573 static int prism2mib_bytearea2pstr(
1574 mibrec_t                     *mib,
1575 int                          isget,
1576 wlandevice_t                 *wlandev,
1577 hfa384x_t                    *hw,
1578 p80211msg_dot11req_mibset_t  *msg,
1579 void                         *data)
1580 {
1581         int            result;
1582         p80211pstrd_t  *pstr = (p80211pstrd_t*) data;
1583         UINT8          bytebuf[MIB_TMP_MAXLEN];
1584
1585         DBFENTER;
1586
1587         if (isget) {
1588                 result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2);
1589                 prism2mgmt_bytearea2pstr(bytebuf, pstr, mib->parm2);
1590         } else {
1591                 memset(bytebuf, 0, mib->parm2);
1592                 prism2mgmt_pstr2bytearea(bytebuf, pstr);
1593                 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
1594         }
1595
1596         DBFEXIT;
1597         return(result);
1598 }
1599
1600 /*----------------------------------------------------------------
1601 * prism2mib_uint32
1602 *
1603 * Get/set uint32 data.
1604 *
1605 * MIB record parameters:
1606 *       parm1    Prism2 RID value.
1607 *       parm2    Not used.
1608 *       parm3    Not used.
1609 *
1610 * Arguments:
1611 *       mib      MIB record.
1612 *       isget    MIBGET/MIBSET flag.
1613 *       wlandev  wlan device structure.
1614 *       priv     "priv" structure.
1615 *       hw       "hw" structure.
1616 *       msg      Message structure.
1617 *       data     Data buffer.
1618 *
1619 * Returns:
1620 *       0   - Success.
1621 *       ~0  - Error.
1622 *
1623 ----------------------------------------------------------------*/
1624
1625 static int prism2mib_uint32(
1626 mibrec_t                     *mib,
1627 int                          isget,
1628 wlandevice_t                 *wlandev,
1629 hfa384x_t                    *hw,
1630 p80211msg_dot11req_mibset_t  *msg,
1631 void                         *data)
1632 {
1633         int     result;
1634         UINT32  *uint32 = (UINT32*) data;
1635         UINT8   bytebuf[MIB_TMP_MAXLEN];
1636         UINT16  *wordbuf = (UINT16*) bytebuf;
1637
1638         DBFENTER;
1639
1640         if (isget) {
1641                 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1642                 *uint32 = *wordbuf;
1643                 /* [MSM] Removed, getconfig16 returns the value in host order.
1644                  * prism2mgmt_prism2int2p80211int(wordbuf, uint32);
1645                  */
1646         } else {
1647                 /* [MSM] Removed, setconfig16 expects host order.
1648                  * prism2mgmt_p80211int2prism2int(wordbuf, uint32);
1649                  */
1650                 *wordbuf = *uint32;
1651                 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1652         }
1653
1654         DBFEXIT;
1655         return(result);
1656 }
1657
1658 /*----------------------------------------------------------------
1659 * prism2mib_uint32array
1660 *
1661 * Get/set an array of uint32 data.
1662 *
1663 * MIB record parameters:
1664 *       parm1    Prism2 RID value.
1665 *       parm2    Number of bytes of RID data.
1666 *       parm3    Not used.
1667 *
1668 * Arguments:
1669 *       mib      MIB record.
1670 *       isget    MIBGET/MIBSET flag.
1671 *       wlandev  wlan device structure.
1672 *       priv     "priv" structure.
1673 *       hw       "hw" structure.
1674 *       msg      Message structure.
1675 *       data     Data buffer.
1676 *
1677 * Returns:
1678 *       0   - Success.
1679 *       ~0  - Error.
1680 *
1681 ----------------------------------------------------------------*/
1682
1683 static int prism2mib_uint32array(
1684 mibrec_t                     *mib,
1685 int                          isget,
1686 wlandevice_t                 *wlandev,
1687 hfa384x_t                    *hw,
1688 p80211msg_dot11req_mibset_t  *msg,
1689 void                         *data)
1690 {
1691         int     result;
1692         UINT32  *uint32 = (UINT32 *) data;
1693         UINT8   bytebuf[MIB_TMP_MAXLEN];
1694         UINT16  *wordbuf = (UINT16*) bytebuf;
1695         int     i, cnt;
1696
1697         DBFENTER;
1698
1699         cnt = mib->parm2 / sizeof(UINT16);
1700
1701         if (isget) {
1702                 result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
1703                 for (i = 0; i < cnt; i++)
1704                         prism2mgmt_prism2int2p80211int(wordbuf+i, uint32+i);
1705         } else {
1706                 for (i = 0; i < cnt; i++)
1707                         prism2mgmt_p80211int2prism2int(wordbuf+i, uint32+i);
1708                 result = hfa384x_drvr_setconfig(hw, mib->parm1, wordbuf, mib->parm2);
1709                 }
1710
1711         DBFEXIT;
1712         return(result);
1713 }
1714
1715 /*----------------------------------------------------------------
1716 * prism2mib_uint32offset
1717 *
1718 * Get/set a single element in an array of uint32 data.
1719 *
1720 * MIB record parameters:
1721 *       parm1    Prism2 RID value.
1722 *       parm2    Number of bytes of RID data.
1723 *       parm3    Element index.
1724 *
1725 * Arguments:
1726 *       mib      MIB record.
1727 *       isget    MIBGET/MIBSET flag.
1728 *       wlandev  wlan device structure.
1729 *       priv     "priv" structure.
1730 *       hw       "hw" structure.
1731 *       msg      Message structure.
1732 *       data     Data buffer.
1733 *
1734 * Returns:
1735 *       0   - Success.
1736 *       ~0  - Error.
1737 *
1738 ----------------------------------------------------------------*/
1739
1740 static int prism2mib_uint32offset(
1741 mibrec_t                     *mib,
1742 int                          isget,
1743 wlandevice_t                 *wlandev,
1744 hfa384x_t                    *hw,
1745 p80211msg_dot11req_mibset_t  *msg,
1746 void                         *data)
1747 {
1748         int     result;
1749         UINT32  *uint32 = (UINT32*) data;
1750         UINT8   bytebuf[MIB_TMP_MAXLEN];
1751         UINT16  *wordbuf = (UINT16*) bytebuf;
1752         UINT16  cnt;
1753
1754         DBFENTER;
1755
1756         cnt = mib->parm2 / sizeof(UINT16);
1757
1758         result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
1759         if (result == 0) {
1760                 if (isget) {
1761                         if (mib->parm3 < cnt)
1762                                 prism2mgmt_prism2int2p80211int(wordbuf+mib->parm3, uint32);
1763                         else
1764                                 *uint32 = 0;
1765                 } else {
1766                         if (mib->parm3 < cnt) {
1767                                 prism2mgmt_p80211int2prism2int(wordbuf+mib->parm3, uint32);
1768                                 result = hfa384x_drvr_setconfig(hw, mib->parm1, wordbuf, mib->parm2);
1769                         }
1770                 }
1771         }
1772
1773         DBFEXIT;
1774         return(result);
1775 }
1776
1777 /*----------------------------------------------------------------
1778 * prism2mib_truth
1779 *
1780 * Get/set truth data.
1781 *
1782 * MIB record parameters:
1783 *       parm1    Prism2 RID value.
1784 *       parm2    Not used.
1785 *       parm3    Not used.
1786 *
1787 * Arguments:
1788 *       mib      MIB record.
1789 *       isget    MIBGET/MIBSET flag.
1790 *       wlandev  wlan device structure.
1791 *       priv     "priv" structure.
1792 *       hw       "hw" structure.
1793 *       msg      Message structure.
1794 *       data     Data buffer.
1795 *
1796 * Returns:
1797 *       0   - Success.
1798 *       ~0  - Error.
1799 *
1800 ----------------------------------------------------------------*/
1801
1802 static int prism2mib_truth(
1803 mibrec_t                     *mib,
1804 int                          isget,
1805 wlandevice_t                 *wlandev,
1806 hfa384x_t                    *hw,
1807 p80211msg_dot11req_mibset_t  *msg,
1808 void                         *data)
1809 {
1810         int     result;
1811         UINT32  *uint32 = (UINT32*) data;
1812         UINT8   bytebuf[MIB_TMP_MAXLEN];
1813         UINT16  *wordbuf = (UINT16*) bytebuf;
1814
1815         DBFENTER;
1816
1817         if (isget) {
1818                 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1819                 *uint32 = (*wordbuf) ?
1820                                 P80211ENUM_truth_true : P80211ENUM_truth_false;
1821         } else {
1822                 *wordbuf = ((*uint32) == P80211ENUM_truth_true) ? 1 : 0;
1823                 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1824         }
1825
1826         DBFEXIT;
1827         return(result);
1828 }
1829
1830 /*----------------------------------------------------------------
1831 * prism2mib_flag
1832 *
1833 * Get/set a flag.
1834 *
1835 * MIB record parameters:
1836 *       parm1    Prism2 RID value.
1837 *       parm2    Bit to get/set.
1838 *       parm3    Not used.
1839 *
1840 * Arguments:
1841 *       mib      MIB record.
1842 *       isget    MIBGET/MIBSET flag.
1843 *       wlandev  wlan device structure.
1844 *       priv     "priv" structure.
1845 *       hw       "hw" structure.
1846 *       msg      Message structure.
1847 *       data     Data buffer.
1848 *
1849 * Returns:
1850 *       0   - Success.
1851 *       ~0  - Error.
1852 *
1853 ----------------------------------------------------------------*/
1854
1855 static int prism2mib_flag(
1856 mibrec_t                     *mib,
1857 int                          isget,
1858 wlandevice_t                 *wlandev,
1859 hfa384x_t                    *hw,
1860 p80211msg_dot11req_mibset_t  *msg,
1861 void                         *data)
1862 {
1863         int     result;
1864         UINT32  *uint32 = (UINT32*) data;
1865         UINT8   bytebuf[MIB_TMP_MAXLEN];
1866         UINT16  *wordbuf = (UINT16*) bytebuf;
1867         UINT32  flags;
1868
1869         DBFENTER;
1870
1871         result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1872         if (result == 0) {
1873                 /* [MSM] Removed, getconfig16 returns the value in host order.
1874                  * prism2mgmt_prism2int2p80211int(wordbuf, &flags);
1875                  */
1876                 flags = *wordbuf;
1877                 if (isget) {
1878                         *uint32 = (flags & mib->parm2) ?
1879                                 P80211ENUM_truth_true : P80211ENUM_truth_false;
1880                 } else {
1881                         if ((*uint32) == P80211ENUM_truth_true)
1882                                 flags |= mib->parm2;
1883                         else
1884                                 flags &= ~mib->parm2;
1885                         /* [MSM] Removed, setconfig16 expects host order.
1886                          * prism2mgmt_p80211int2prism2int(wordbuf, &flags);
1887                          */
1888                         *wordbuf = flags;
1889                         result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1890                 }
1891         }
1892
1893         DBFEXIT;
1894         return(result);
1895 }
1896
1897 /*----------------------------------------------------------------
1898 * prism2mib_appcfinfoflag
1899 *
1900 * Get/set a single flag in the APPCFINFO record.
1901 *
1902 * MIB record parameters:
1903 *       parm1    Bit to get/set.
1904 *       parm2    Not used.
1905 *       parm3    Not used.
1906 *
1907 * Arguments:
1908 *       mib      MIB record.
1909 *       isget    MIBGET/MIBSET flag.
1910 *       wlandev  wlan device structure.
1911 *       priv     "priv" structure.
1912 *       hw       "hw" structure.
1913 *       msg      Message structure.
1914 *       data     Data buffer.
1915 *
1916 * Returns:
1917 *       0   - Success.
1918 *       ~0  - Error.
1919 *
1920 ----------------------------------------------------------------*/
1921
1922 static int prism2mib_appcfinfoflag(
1923 mibrec_t                     *mib,
1924 int                          isget,
1925 wlandevice_t                 *wlandev,
1926 hfa384x_t                    *hw,
1927 p80211msg_dot11req_mibset_t  *msg,
1928 void                         *data)
1929 {
1930         int     result;
1931         UINT32  *uint32 = (UINT32*) data;
1932         UINT8   bytebuf[MIB_TMP_MAXLEN];
1933         UINT16  *wordbuf = (UINT16*) bytebuf;
1934         UINT16  word;
1935
1936         DBFENTER;
1937
1938         result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFAPPCFINFO,
1939                                         bytebuf, HFA384x_RID_CNFAPPCFINFO_LEN);
1940         if (result == 0) {
1941                 if (isget) {
1942                         *uint32 = (hfa384x2host_16(wordbuf[3]) & mib->parm1) ?
1943                                 P80211ENUM_truth_true : P80211ENUM_truth_false;
1944                 } else {
1945                         word = hfa384x2host_16(wordbuf[3]);
1946                         word = ((*uint32) == P80211ENUM_truth_true) ?
1947                                 (word | mib->parm1) : (word & ~mib->parm1);
1948                         wordbuf[3] = host2hfa384x_16(word);
1949                         result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFAPPCFINFO,
1950                                         bytebuf, HFA384x_RID_CNFAPPCFINFO_LEN);
1951                 }
1952         }
1953
1954         DBFEXIT;
1955         return(result);
1956 }
1957
1958 /*----------------------------------------------------------------
1959 * prism2mib_regulatorydomains
1960 *
1961 * Get regulatory domain data.
1962 *
1963 * MIB record parameters:
1964 *       parm1    Prism2 RID value.
1965 *       parm2    Number of bytes of RID data.
1966 *       parm3    Not used.
1967 *
1968 * Arguments:
1969 *       mib      MIB record.
1970 *       isget    MIBGET/MIBSET flag.
1971 *       wlandev  wlan device structure.
1972 *       priv     "priv" structure.
1973 *       hw       "hw" structure.
1974 *       msg      Message structure.
1975 *       data     Data buffer.
1976 *
1977 * Returns:
1978 *       0   - Success.
1979 *       ~0  - Error.
1980 *
1981 ----------------------------------------------------------------*/
1982
1983 static int prism2mib_regulatorydomains(
1984 mibrec_t                     *mib,
1985 int                          isget,
1986 wlandevice_t                 *wlandev,
1987 hfa384x_t                    *hw,
1988 p80211msg_dot11req_mibset_t  *msg,
1989 void                         *data)
1990 {
1991         int            result;
1992         UINT32         cnt;
1993         p80211pstrd_t  *pstr = (p80211pstrd_t*) data;
1994         UINT8          bytebuf[MIB_TMP_MAXLEN];
1995         UINT16         *wordbuf = (UINT16*) bytebuf;
1996
1997         DBFENTER;
1998
1999         result = 0;
2000
2001         if (isget) {
2002                 result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
2003                 prism2mgmt_prism2int2p80211int(wordbuf, &cnt);
2004                 pstr->len = (UINT8) cnt;
2005                 memcpy(pstr->data, &wordbuf[1], pstr->len);
2006         }
2007
2008         DBFEXIT;
2009         return(result);
2010 }
2011
2012 /*----------------------------------------------------------------
2013 * prism2mib_wepdefaultkey
2014 *
2015 * Get/set WEP default keys.
2016 *
2017 * MIB record parameters:
2018 *       parm1    Prism2 RID value.
2019 *       parm2    Number of bytes of RID data.
2020 *       parm3    Not used.
2021 *
2022 * Arguments:
2023 *       mib      MIB record.
2024 *       isget    MIBGET/MIBSET flag.
2025 *       wlandev  wlan device structure.
2026 *       priv     "priv" structure.
2027 *       hw       "hw" structure.
2028 *       msg      Message structure.
2029 *       data     Data buffer.
2030 *
2031 * Returns:
2032 *       0   - Success.
2033 *       ~0  - Error.
2034 *
2035 ----------------------------------------------------------------*/
2036
2037 static int prism2mib_wepdefaultkey(
2038 mibrec_t                     *mib,
2039 int                          isget,
2040 wlandevice_t                 *wlandev,
2041 hfa384x_t                    *hw,
2042 p80211msg_dot11req_mibset_t  *msg,
2043 void                         *data)
2044 {
2045         int            result;
2046         p80211pstrd_t  *pstr = (p80211pstrd_t*) data;
2047         UINT8          bytebuf[MIB_TMP_MAXLEN];
2048         UINT16         len;
2049
2050         DBFENTER;
2051
2052         if (isget) {
2053                 result = 0;    /* Should never happen. */
2054         } else {
2055                 len = (pstr->len > 5) ? HFA384x_RID_CNFWEP128DEFAULTKEY_LEN :
2056                                         HFA384x_RID_CNFWEPDEFAULTKEY_LEN;
2057                 memset(bytebuf, 0, len);
2058                 prism2mgmt_pstr2bytearea(bytebuf, pstr);
2059                 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, len);
2060         }
2061
2062         DBFEXIT;
2063         return(result);
2064 }
2065
2066 /*----------------------------------------------------------------
2067 * prism2mib_powermanagement
2068 *
2069 * Get/set 802.11 power management value.  Note that this is defined differently
2070 * by 802.11 and Prism2:
2071 *
2072 *       Meaning     802.11       Prism2
2073 *        active       1           false
2074 *      powersave      2           true
2075 *
2076 * MIB record parameters:
2077 *       parm1    Prism2 RID value.
2078 *       parm2    Not used.
2079 *       parm3    Not used.
2080 *
2081 * Arguments:
2082 *       mib      MIB record.
2083 *       isget    MIBGET/MIBSET flag.
2084 *       wlandev  wlan device structure.
2085 *       priv     "priv" structure.
2086 *       hw       "hw" structure.
2087 *       msg      Message structure.
2088 *       data     Data buffer.
2089 *
2090 * Returns:
2091 *       0   - Success.
2092 *       ~0  - Error.
2093 *
2094 ----------------------------------------------------------------*/
2095
2096 static int prism2mib_powermanagement(
2097 mibrec_t                     *mib,
2098 int                          isget,
2099 wlandevice_t                 *wlandev,
2100 hfa384x_t                    *hw,
2101 p80211msg_dot11req_mibset_t  *msg,
2102 void                         *data)
2103 {
2104         int     result;
2105         UINT32  *uint32 = (UINT32*) data;
2106         UINT32  value;
2107
2108         DBFENTER;
2109
2110         if (isget) {
2111                 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value);
2112                 *uint32 = (value == 0) ? 1 : 2;
2113         } else {
2114                 value = ((*uint32) == 1) ? 0 : 1;
2115                 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value);
2116         }
2117
2118         DBFEXIT;
2119         return(result);
2120 }
2121
2122 /*----------------------------------------------------------------
2123 * prism2mib_preamble
2124 *
2125 * Get/set Prism2 short preamble
2126 *
2127 * MIB record parameters:
2128 *       parm1    Prism2 RID value.
2129 *       parm2    Not used.
2130 *       parm3    Not used.
2131 *
2132 * Arguments:
2133 *       mib      MIB record.
2134 *       isget    MIBGET/MIBSET flag.
2135 *       wlandev  wlan device structure.
2136 *       priv     "priv" structure.
2137 *       hw       "hw" structure.
2138 *       msg      Message structure.
2139 *       data     Data buffer.
2140 *
2141 * Returns:
2142 *       0   - Success.
2143 *       ~0  - Error.
2144 *
2145 ----------------------------------------------------------------*/
2146
2147 static int prism2mib_preamble(
2148 mibrec_t                     *mib,
2149 int                          isget,
2150 wlandevice_t                 *wlandev,
2151 hfa384x_t                    *hw,
2152 p80211msg_dot11req_mibset_t  *msg,
2153 void                         *data)
2154 {
2155         int     result;
2156         UINT32  *uint32 = (UINT32*) data;
2157         UINT8   bytebuf[MIB_TMP_MAXLEN];
2158         UINT16  *wordbuf = (UINT16*) bytebuf;
2159
2160         DBFENTER;
2161
2162         if (isget) {
2163                 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
2164                 *uint32 = *wordbuf;
2165         } else {
2166                 *wordbuf = *uint32;
2167                 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
2168         }
2169
2170         DBFEXIT;
2171         return(result);
2172 }
2173
2174 /*----------------------------------------------------------------
2175 * prism2mib_privacyinvoked
2176 *
2177 * Get/set the dot11PrivacyInvoked value.
2178 *
2179 * MIB record parameters:
2180 *       parm1    Prism2 RID value.
2181 *       parm2    Bit value for PrivacyInvoked flag.
2182 *       parm3    Not used.
2183 *
2184 * Arguments:
2185 *       mib      MIB record.
2186 *       isget    MIBGET/MIBSET flag.
2187 *       wlandev  wlan device structure.
2188 *       priv     "priv" structure.
2189 *       hw       "hw" structure.
2190 *       msg      Message structure.
2191 *       data     Data buffer.
2192 *
2193 * Returns:
2194 *       0   - Success.
2195 *       ~0  - Error.
2196 *
2197 ----------------------------------------------------------------*/
2198
2199 static int prism2mib_privacyinvoked(
2200 mibrec_t                     *mib,
2201 int                          isget,
2202 wlandevice_t                 *wlandev,
2203 hfa384x_t                    *hw,
2204 p80211msg_dot11req_mibset_t  *msg,
2205 void                         *data)
2206 {
2207         int     result;
2208
2209         DBFENTER;
2210
2211         if (wlandev->hostwep & HOSTWEP_DECRYPT) {
2212                 if (wlandev->hostwep & HOSTWEP_DECRYPT)
2213                         mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
2214                 if (wlandev->hostwep & HOSTWEP_ENCRYPT)
2215                         mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_TXCRYPT;
2216         }
2217
2218         result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
2219
2220         DBFEXIT;
2221         return(result);
2222 }
2223
2224 /*----------------------------------------------------------------
2225 * prism2mib_excludeunencrypted
2226 *
2227 * Get/set the dot11ExcludeUnencrypted value.
2228 *
2229 * MIB record parameters:
2230 *       parm1    Prism2 RID value.
2231 *       parm2    Bit value for ExcludeUnencrypted flag.
2232 *       parm3    Not used.
2233 *
2234 * Arguments:
2235 *       mib      MIB record.
2236 *       isget    MIBGET/MIBSET flag.
2237 *       wlandev  wlan device structure.
2238 *       priv     "priv" structure.
2239 *       hw       "hw" structure.
2240 *       msg      Message structure.
2241 *       data     Data buffer.
2242 *
2243 * Returns:
2244 *       0   - Success.
2245 *       ~0  - Error.
2246 *
2247 ----------------------------------------------------------------*/
2248
2249 static int prism2mib_excludeunencrypted(
2250 mibrec_t                     *mib,
2251 int                          isget,
2252 wlandevice_t                 *wlandev,
2253 hfa384x_t                    *hw,
2254 p80211msg_dot11req_mibset_t  *msg,
2255 void                         *data)
2256 {
2257         int     result;
2258
2259         DBFENTER;
2260
2261         result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
2262
2263         DBFEXIT;
2264         return(result);
2265 }
2266
2267 /*----------------------------------------------------------------
2268 * prism2mib_fragmentationthreshold
2269 *
2270 * Get/set the fragmentation threshold.
2271 *
2272 * MIB record parameters:
2273 *       parm1    Prism2 RID value.
2274 *       parm2    Not used.
2275 *       parm3    Not used.
2276 *
2277 * Arguments:
2278 *       mib      MIB record.
2279 *       isget    MIBGET/MIBSET flag.
2280 *       wlandev  wlan device structure.
2281 *       priv     "priv" structure.
2282 *       hw       "hw" structure.
2283 *       msg      Message structure.
2284 *       data     Data buffer.
2285 *
2286 * Returns:
2287 *       0   - Success.
2288 *       ~0  - Error.
2289 *
2290 ----------------------------------------------------------------*/
2291
2292 static int prism2mib_fragmentationthreshold(
2293 mibrec_t                     *mib,
2294 int                          isget,
2295 wlandevice_t                 *wlandev,
2296 hfa384x_t                    *hw,
2297 p80211msg_dot11req_mibset_t  *msg,
2298 void                         *data)
2299 {
2300         int     result;
2301         UINT32  *uint32 = (UINT32*) data;
2302
2303         DBFENTER;
2304
2305         if (!isget)
2306                 if ((*uint32) % 2) {
2307                         WLAN_LOG_WARNING("Attempt to set odd number "
2308                                           "FragmentationThreshold\n");
2309                         msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2310                         return(0);
2311                 }
2312
2313         result = prism2mib_uint32(mib, isget, wlandev, hw, msg, data);
2314
2315         DBFEXIT;
2316         return(result);
2317 }
2318
2319 /*----------------------------------------------------------------
2320 * prism2mib_operationalrateset
2321 *
2322 * Get/set the operational rate set.
2323 *
2324 * MIB record parameters:
2325 *       parm1    Prism2 RID value.
2326 *       parm2    Not used.
2327 *       parm3    Not used.
2328 *
2329 * Arguments:
2330 *       mib      MIB record.
2331 *       isget    MIBGET/MIBSET flag.
2332 *       wlandev  wlan device structure.
2333 *       priv     "priv" structure.
2334 *       hw       "hw" structure.
2335 *       msg      Message structure.
2336 *       data     Data buffer.
2337 *
2338 * Returns:
2339 *       0   - Success.
2340 *       ~0  - Error.
2341 *
2342 ----------------------------------------------------------------*/
2343
2344 static int prism2mib_operationalrateset(
2345 mibrec_t                     *mib,
2346 int                          isget,
2347 wlandevice_t                 *wlandev,
2348 hfa384x_t                    *hw,
2349 p80211msg_dot11req_mibset_t  *msg,
2350 void                         *data)
2351 {
2352         int            result;
2353         p80211pstrd_t  *pstr = (p80211pstrd_t *) data;
2354         UINT8          bytebuf[MIB_TMP_MAXLEN];
2355         UINT16         *wordbuf = (UINT16*) bytebuf;
2356
2357         DBFENTER;
2358
2359         if (isget) {
2360                 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
2361                 prism2mgmt_get_oprateset(wordbuf, pstr);
2362         } else {
2363                 prism2mgmt_set_oprateset(wordbuf, pstr);
2364                 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
2365                 result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, *wordbuf);
2366         }
2367
2368         DBFEXIT;
2369         return(result);
2370 }
2371
2372 /*----------------------------------------------------------------
2373 * prism2mib_groupaddress
2374 *
2375 * Get/set the dot11GroupAddressesTable.
2376 *
2377 * MIB record parameters:
2378 *       parm1    Not used.
2379 *       parm2    Not used.
2380 *       parm3    Not used.
2381 *
2382 * Arguments:
2383 *       mib      MIB record.
2384 *       isget    MIBGET/MIBSET flag.
2385 *       wlandev  wlan device structure.
2386 *       priv     "priv" structure.
2387 *       hw       "hw" structure.
2388 *       msg      Message structure.
2389 *       data     Data buffer.
2390 *
2391 * Returns:
2392 *       0   - Success.
2393 *       ~0  - Error.
2394 *
2395 ----------------------------------------------------------------*/
2396
2397 static int prism2mib_groupaddress(
2398 mibrec_t                     *mib,
2399 int                          isget,
2400 wlandevice_t                 *wlandev,
2401 hfa384x_t                    *hw,
2402 p80211msg_dot11req_mibset_t  *msg,
2403 void                         *data)
2404 {
2405         int            result;
2406         p80211pstrd_t  *pstr = (p80211pstrd_t *) data;
2407         UINT8          bytebuf[MIB_TMP_MAXLEN];
2408         UINT16         len;
2409
2410         DBFENTER;
2411
2412         /* TODO: fix this.  f/w doesn't support mcast filters */
2413
2414         if (isget) {
2415                 prism2mgmt_get_grpaddr(mib->did, pstr, hw);
2416                 return(0);
2417         }
2418
2419         result = prism2mgmt_set_grpaddr(mib->did, bytebuf, pstr, hw);
2420         if (result != 0) {
2421                 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2422                 return(result);
2423         }
2424
2425         if (hw->dot11_grpcnt <= MAX_PRISM2_GRP_ADDR) {
2426                 len = hw->dot11_grpcnt * WLAN_ADDR_LEN;
2427                 memcpy(bytebuf, hw->dot11_grp_addr[0], len);
2428                 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_GROUPADDR, bytebuf, len);
2429
2430                 /*
2431                 ** Turn off promiscuous mode if count is equal to MAX.  We may
2432                 ** have been at a higher count in promiscuous mode and need to
2433                 ** turn it off.
2434                 */
2435
2436                 /* but only if we're not already in promisc mode. :) */
2437                 if ((hw->dot11_grpcnt == MAX_PRISM2_GRP_ADDR) &&
2438                     !( wlandev->netdev->flags & IFF_PROMISC)) {
2439                         result = hfa384x_drvr_setconfig16(hw,
2440                                              HFA384x_RID_PROMISCMODE, 0);
2441                 }
2442         } else {
2443
2444                 /*
2445                 ** Clear group addresses in card and set to promiscuous mode.
2446                 */
2447
2448                 memset(bytebuf, 0, sizeof(bytebuf));
2449                 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_GROUPADDR,
2450                                                 bytebuf, 0);
2451                 if (result == 0) {
2452                         result = hfa384x_drvr_setconfig16(hw,
2453                                         HFA384x_RID_PROMISCMODE, 1);
2454                 }
2455         }
2456
2457         DBFEXIT;
2458         return(result);
2459 }
2460
2461 /*----------------------------------------------------------------
2462 * prism2mib_fwid
2463 *
2464 * Get the firmware ID.
2465 *
2466 * MIB record parameters:
2467 *       parm1    Not used.
2468 *       parm2    Not used.
2469 *       parm3    Not used.
2470 *
2471 * Arguments:
2472 *       mib      MIB record.
2473 *       isget    MIBGET/MIBSET flag.
2474 *       wlandev  wlan device structure.
2475 *       priv     "priv" structure.
2476 *       hw       "hw" structure.
2477 *       msg      Message structure.
2478 *       data     Data buffer.
2479 *
2480 * Returns:
2481 *       0   - Success.
2482 *       ~0  - Error.
2483 *
2484 ----------------------------------------------------------------*/
2485
2486 static int prism2mib_fwid(
2487 mibrec_t                     *mib,
2488 int                          isget,
2489 wlandevice_t                 *wlandev,
2490 hfa384x_t                    *hw,
2491 p80211msg_dot11req_mibset_t  *msg,
2492 void                         *data)
2493 {
2494         int             result;
2495         p80211pstrd_t   *pstr = (p80211pstrd_t *) data;
2496         hfa384x_FWID_t  fwid;
2497
2498         DBFENTER;
2499
2500         if (isget) {
2501                 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_FWID,
2502                                                 &fwid, HFA384x_RID_FWID_LEN);
2503                 if (mib->did == DIDmib_p2_p2NIC_p2PrimaryFWID) {
2504                         fwid.primary[HFA384x_FWID_LEN - 1] = '\0';
2505                         pstr->len = strlen(fwid.primary);
2506                         memcpy(pstr->data, fwid.primary, pstr->len);
2507                 } else {
2508                         fwid.secondary[HFA384x_FWID_LEN - 1] = '\0';
2509                         pstr->len = strlen(fwid.secondary);
2510                         memcpy(pstr->data, fwid.secondary, pstr->len);
2511                 }
2512         } else
2513                 result = 0;     /* Should never happen. */
2514
2515         DBFEXIT;
2516         return(result);
2517 }
2518
2519 /*----------------------------------------------------------------
2520 * prism2mib_authalg
2521 *
2522 * Get values from the AuhtenticationAlgorithmsTable.
2523 *
2524 * MIB record parameters:
2525 *       parm1    Table index (1-6).
2526 *       parm2    Not used.
2527 *       parm3    Not used.
2528 *
2529 * Arguments:
2530 *       mib      MIB record.
2531 *       isget    MIBGET/MIBSET flag.
2532 *       wlandev  wlan device structure.
2533 *       priv     "priv" structure.
2534 *       hw       "hw" structure.
2535 *       msg      Message structure.
2536 *       data     Data buffer.
2537 *
2538 * Returns:
2539 *       0   - Success.
2540 *       ~0  - Error.
2541 *
2542 ----------------------------------------------------------------*/
2543
2544 static int prism2mib_authalg(
2545 mibrec_t                     *mib,
2546 int                          isget,
2547 wlandevice_t                 *wlandev,
2548 hfa384x_t                    *hw,
2549 p80211msg_dot11req_mibset_t  *msg,
2550 void                         *data)
2551 {
2552         UINT32  *uint32 = (UINT32*) data;
2553
2554         DBFENTER;
2555
2556         /* MSM: pkx supplied code that  code queries RID FD4D....but the f/w's
2557          *  results are bogus. Therefore, we have to simulate the appropriate
2558          *  results here in the driver based on our knowledge of existing MAC
2559          *  features.  That's the whole point behind this ugly function.
2560          */
2561
2562         if (isget) {
2563                 msg->resultcode.data = P80211ENUM_resultcode_success;
2564                 switch (mib->parm1) {
2565                         case 1: /* Open System */
2566                                 *uint32 = P80211ENUM_authalg_opensystem;
2567                                 break;
2568                         case 2: /* SharedKey */
2569                                 *uint32 = P80211ENUM_authalg_sharedkey;
2570                                 break;
2571                         default:
2572                                 *uint32 = 0;
2573                                 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2574                                 break;
2575                 }
2576         }
2577
2578         DBFEXIT;
2579         return(0);
2580 }
2581
2582 /*----------------------------------------------------------------
2583 * prism2mib_authalgenable
2584 *
2585 * Get/set the enable values from the AuhtenticationAlgorithmsTable.
2586 *
2587 * MIB record parameters:
2588 *       parm1    Table index (1-6).
2589 *       parm2    Not used.
2590 *       parm3    Not used.
2591 *
2592 * Arguments:
2593 *       mib      MIB record.
2594 *       isget    MIBGET/MIBSET flag.
2595 *       wlandev  wlan device structure.
2596 *       priv     "priv" structure.
2597 *       hw       "hw" structure.
2598 *       msg      Message structure.
2599 *       data     Data buffer.
2600 *
2601 * Returns:
2602 *       0   - Success.
2603 *       ~0  - Error.
2604 *
2605 ----------------------------------------------------------------*/
2606
2607 static int prism2mib_authalgenable(
2608 mibrec_t                     *mib,
2609 int                          isget,
2610 wlandevice_t                 *wlandev,
2611 hfa384x_t                    *hw,
2612 p80211msg_dot11req_mibset_t  *msg,
2613 void                         *data)
2614 {
2615         int     result;
2616         UINT32  *uint32 = (UINT32*) data;
2617
2618         int     index;
2619         UINT16  cnf_auth;
2620         UINT16  mask;
2621
2622         DBFENTER;
2623
2624         index = mib->parm1 - 1;
2625
2626         result = hfa384x_drvr_getconfig16( hw,
2627                         HFA384x_RID_CNFAUTHENTICATION, &cnf_auth);
2628         WLAN_LOG_DEBUG(2,"cnfAuthentication0=%d, index=%d\n", cnf_auth, index);
2629
2630         if (isget) {
2631                 if ( index == 0 || index == 1 ) {
2632                         *uint32 = (cnf_auth & (1<<index)) ?
2633                                 P80211ENUM_truth_true: P80211ENUM_truth_false;
2634                 } else {
2635                         *uint32 = P80211ENUM_truth_false;
2636                         msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2637                 }
2638         } else {
2639                 if ( index == 0 || index == 1 ) {
2640                         mask = 1 << index;
2641                         if (*uint32==P80211ENUM_truth_true ) {
2642                                 cnf_auth |= mask;
2643                         } else {
2644                                 cnf_auth &= ~mask;
2645                         }
2646                         result = hfa384x_drvr_setconfig16( hw,
2647                                         HFA384x_RID_CNFAUTHENTICATION, cnf_auth);
2648                         WLAN_LOG_DEBUG(2,"cnfAuthentication:=%d\n", cnf_auth);
2649                         if ( result ) {
2650                                 WLAN_LOG_DEBUG(1,"Unable to set p2cnfAuthentication to %d\n", cnf_auth);
2651                                 msg->resultcode.data = P80211ENUM_resultcode_implementation_failure;
2652                         }
2653                 } else {
2654                         msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2655                 }
2656         }
2657
2658         DBFEXIT;
2659         return(result);
2660 }
2661
2662 /*----------------------------------------------------------------
2663 * prism2mib_priv
2664 *
2665 * Get/set values in the "priv" data structure.
2666 *
2667 * MIB record parameters:
2668 *       parm1    Not used.
2669 *       parm2    Not used.
2670 *       parm3    Not used.
2671 *
2672 * Arguments:
2673 *       mib      MIB record.
2674 *       isget    MIBGET/MIBSET flag.
2675 *       wlandev  wlan device structure.
2676 *       priv     "priv" structure.
2677 *       hw       "hw" structure.
2678 *       msg      Message structure.
2679 *       data     Data buffer.
2680 *
2681 * Returns:
2682 *       0   - Success.
2683 *       ~0  - Error.
2684 *
2685 ----------------------------------------------------------------*/
2686
2687 static int prism2mib_priv(
2688 mibrec_t                     *mib,
2689 int                          isget,
2690 wlandevice_t                 *wlandev,
2691 hfa384x_t                    *hw,
2692 p80211msg_dot11req_mibset_t  *msg,
2693 void                         *data)
2694 {
2695         UINT32            *uint32 = (UINT32*) data;
2696         p80211pstrd_t     *pstr = (p80211pstrd_t*) data;
2697         p80211macarray_t  *macarray = (p80211macarray_t *) data;
2698
2699         int  i, cnt, result, done;
2700
2701         prism2sta_authlist_t  old;
2702
2703         /*
2704         ** "test" is a lot longer than necessary but who cares?  ...as long as
2705         ** it is long enough!
2706         */
2707
2708         UINT8  test[sizeof(wlandev->rx) + sizeof(hw->tallies)];
2709
2710         DBFENTER;
2711
2712         switch (mib->did) {
2713         case DIDmib_p2_p2Table_p2ReceivedFrameStatistics:
2714
2715                 /*
2716                 ** Note: The values in this record are changed by the
2717                 ** interrupt handler and therefore cannot be guaranteed
2718                 ** to be stable while they are being copied.  However,
2719                 ** the interrupt handler will take priority over this
2720                 ** code.  Hence, if the same values are copied twice,
2721                 ** then we are ensured that the values have not been
2722                 ** changed.  If they have, then just try again.  Don't
2723                 ** try more than 10 times...if we still haven't got it,
2724                 ** then the values we do have are probably good enough.
2725                 ** This scheme for copying values is used in order to
2726                 ** prevent having to block the interrupt handler while
2727                 ** we copy the values.
2728                 */
2729
2730                 if (isget)
2731                         for (i = 0; i < 10; i++) {
2732                                 memcpy(data, &wlandev->rx, sizeof(wlandev->rx));
2733                                 memcpy(test, &wlandev->rx, sizeof(wlandev->rx));
2734                                 if (memcmp(data, test, sizeof(wlandev->rx)) == 0) break;
2735                         }
2736
2737                 break;
2738
2739         case DIDmib_p2_p2Table_p2CommunicationTallies:
2740
2741                 /*
2742                 ** Note: The values in this record are changed by the
2743                 ** interrupt handler and therefore cannot be guaranteed
2744                 ** to be stable while they are being copied.  See the
2745                 ** note above about copying values.
2746                 */
2747
2748                 if (isget) {
2749                         result = hfa384x_drvr_commtallies(hw);
2750
2751                         /* ?????? We need to wait a bit here for the */
2752                         /*   tallies to get updated. ?????? */
2753                         /* MSM: TODO: The right way to do this is to
2754                          *      add a "commtallie" wait queue to the
2755                          *      priv structure that gets run every time
2756                          *      we receive a commtally info frame.
2757                          *      This process would sleep on that
2758                          *      queue and get awakened when the
2759                          *      the requested info frame arrives.
2760                          *      Don't have time to do and test this
2761                          *      right now.
2762                          */
2763
2764                         /* Ugh, this is nasty. */
2765                         for (i = 0; i < 10; i++) {
2766                                 memcpy(data,
2767                                        &hw->tallies,
2768                                        sizeof(hw->tallies));
2769                                 memcpy(test,
2770                                        &hw->tallies,
2771                                        sizeof(hw->tallies));
2772                                 if ( memcmp(data,
2773                                             test,
2774                                             sizeof(hw->tallies)) == 0)
2775                                         break;
2776                         }
2777                 }
2778
2779                 break;
2780
2781         case DIDmib_p2_p2Table_p2Authenticated:
2782
2783                 if (isget) {
2784                         prism2mib_priv_authlist(hw, &old);
2785
2786                         macarray->cnt = 0;
2787                         for (i = 0; i < old.cnt; i++) {
2788                                 if (!old.assoc[i]) {
2789                                         memcpy(macarray->data[macarray->cnt], old.addr[i], WLAN_ADDR_LEN);
2790                                         macarray->cnt++;
2791                                 }
2792                         }
2793                 }
2794
2795                 break;
2796
2797         case DIDmib_p2_p2Table_p2Associated:
2798
2799                 if (isget) {
2800                         prism2mib_priv_authlist(hw, &old);
2801
2802                         macarray->cnt = 0;
2803                         for (i = 0; i < old.cnt; i++) {
2804                                 if (old.assoc[i]) {
2805                                         memcpy(macarray->data[macarray->cnt], old.addr[i], WLAN_ADDR_LEN);
2806                                         macarray->cnt++;
2807                                 }
2808                         }
2809                 }
2810
2811                 break;
2812
2813         case DIDmib_p2_p2Table_p2PowerSaveUserCount:
2814
2815                 if (isget)
2816                         *uint32 = hw->psusercount;
2817
2818                 break;
2819
2820         case DIDmib_p2_p2Table_p2Comment:
2821
2822                 if (isget) {
2823                         pstr->len = strlen(hw->comment);
2824                         memcpy(pstr->data, hw->comment, pstr->len);
2825                 } else {
2826                         cnt = pstr->len;
2827                         if (cnt < 0) cnt = 0;
2828                         if (cnt >= sizeof(hw->comment))
2829                                 cnt = sizeof(hw->comment)-1;
2830                         memcpy(hw->comment, pstr->data, cnt);
2831                         pstr->data[cnt] = '\0';
2832                 }
2833
2834                 break;
2835
2836         case DIDmib_p2_p2Table_p2AccessMode:
2837
2838                 if (isget)
2839                         *uint32 = hw->accessmode;
2840                 else
2841                         prism2mib_priv_accessmode(hw, *uint32);
2842
2843                 break;
2844
2845         case DIDmib_p2_p2Table_p2AccessAllow:
2846
2847                 if (isget) {
2848                         macarray->cnt = hw->allow.cnt;
2849                         memcpy(macarray->data, hw->allow.addr,
2850                                macarray->cnt*WLAN_ADDR_LEN);
2851                 } else {
2852                         prism2mib_priv_accessallow(hw, macarray);
2853                 }
2854
2855                 break;
2856
2857         case DIDmib_p2_p2Table_p2AccessDeny:
2858
2859                 if (isget) {
2860                         macarray->cnt = hw->deny.cnt;
2861                         memcpy(macarray->data, hw->deny.addr,
2862                                macarray->cnt*WLAN_ADDR_LEN);
2863                 } else {
2864                         prism2mib_priv_accessdeny(hw, macarray);
2865                 }
2866
2867                 break;
2868
2869         case DIDmib_p2_p2Table_p2ChannelInfoResults:
2870
2871                 if (isget) {
2872                         done = atomic_read(&hw->channel_info.done);
2873                         if (done == 0) {
2874                                 msg->resultcode.status = P80211ENUM_msgitem_status_no_value;
2875                                 break;
2876                         }
2877                         if (done == 1) {
2878                                 msg->resultcode.status = P80211ENUM_msgitem_status_incomplete_itemdata;
2879                                 break;
2880                         }
2881
2882                         for (i = 0; i < 14; i++, uint32 += 5) {
2883                                 uint32[0] = i+1;
2884                                 uint32[1] = hw->channel_info.results.result[i].anl;
2885                                 uint32[2] = hw->channel_info.results.result[i].pnl;
2886                                 uint32[3] = (hw->channel_info.results.result[i].active & HFA384x_CHINFORESULT_BSSACTIVE) ? 1 : 0;
2887                                 uint32[4] = (hw->channel_info.results.result[i].active & HFA384x_CHINFORESULT_PCFACTIVE) ? 1 : 0;
2888                         }
2889                 }
2890
2891                 break;
2892
2893         case DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType:
2894
2895                 if (isget)
2896                         *uint32 = hw->dot11_desired_bss_type;
2897                 else
2898                         hw->dot11_desired_bss_type = *uint32;
2899
2900                 break;
2901
2902         case DIDmib_lnx_lnxConfigTable_lnxRSNAIE: {
2903                 hfa384x_WPAData_t wpa;
2904                 if (isget) {
2905                         hfa384x_drvr_getconfig( hw, HFA384x_RID_CNFWPADATA,
2906                                                 (UINT8 *) &wpa, sizeof(wpa));
2907                         pstr->len = hfa384x2host_16(wpa.datalen);
2908                         memcpy(pstr->data, wpa.data, pstr->len);
2909                 } else {
2910                         wpa.datalen = host2hfa384x_16(pstr->len);
2911                         memcpy(wpa.data, pstr->data, pstr->len);
2912
2913                         result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFWPADATA,
2914                                 (UINT8 *) &wpa, sizeof(wpa));
2915                 }
2916                 break;
2917         }
2918         default:
2919                 WLAN_LOG_ERROR("Unhandled DID 0x%08x\n", mib->did);
2920         }
2921
2922         DBFEXIT;
2923         return(0);
2924 }
2925
2926 /*----------------------------------------------------------------
2927 * prism2mib_priv_authlist
2928 *
2929 * Get a copy of the list of authenticated stations.
2930 *
2931 * Arguments:
2932 *       priv     "priv" structure.
2933 *       list     List of authenticated stations.
2934 *
2935 * Returns:
2936 *       Nothing
2937 *
2938 ----------------------------------------------------------------*/
2939
2940 static void prism2mib_priv_authlist(
2941 hfa384x_t             *hw,
2942 prism2sta_authlist_t  *list)
2943 {
2944         prism2sta_authlist_t  test;
2945         int                   i;
2946
2947         DBFENTER;
2948
2949         /*
2950         ** Note: The values in this record are changed by the interrupt
2951         ** handler and therefore cannot be guaranteed to be stable while
2952         ** they are being copied.  However, the interrupt handler will
2953         ** take priority over this code.  Hence, if the same values are
2954         ** copied twice, then we are ensured that the values have not
2955         ** been changed.  If they have, then just try again.  Don't try
2956         ** more than 10 times...the list of authenticated stations is
2957         ** unlikely to be changing frequently enough that we can't get
2958         ** a snapshot in 10 tries.  Don't try more than this so that we
2959         ** don't risk locking-up for long periods of time.  If we still
2960         ** haven't got the snapshot, then generate an error message and
2961         ** return an empty list (since this is the only valid list that
2962         ** we can guarentee).  This scheme for copying values is used in
2963         ** order to prevent having to block the interrupt handler while
2964         ** we copy the values.
2965         */
2966
2967         for (i = 0; i < 10; i++) {
2968                 memcpy(list, &hw->authlist, sizeof(prism2sta_authlist_t));
2969                 memcpy(&test, &hw->authlist, sizeof(prism2sta_authlist_t));
2970                 if (memcmp(list, &test, sizeof(prism2sta_authlist_t)) == 0)
2971                         break;
2972         }
2973
2974         if (i >= 10) {
2975                 list->cnt = 0;
2976                 WLAN_LOG_ERROR("Could not obtain snapshot of authenticated stations.\n");
2977                 }
2978
2979         DBFEXIT;
2980         return;
2981 }
2982
2983 /*----------------------------------------------------------------
2984 * prism2mib_priv_accessmode
2985 *
2986 * Set the Access Mode.
2987 *
2988 * Arguments:
2989 *       priv     "priv" structure.
2990 *       hw       "hw" structure.
2991 *       mode     New access mode.
2992 *
2993 * Returns:
2994 *       Nothing
2995 *
2996 ----------------------------------------------------------------*/
2997
2998 static void prism2mib_priv_accessmode(
2999 hfa384x_t         *hw,
3000 UINT32            mode)
3001 {
3002         prism2sta_authlist_t  old;
3003         int                   i, j, deauth;
3004         UINT8                 *addr;
3005
3006         DBFENTER;
3007
3008         /*
3009         ** If the mode is not changing or it is changing to "All", then it's
3010         ** okay to go ahead without a lot of messing around.  Otherwise, the
3011         ** access mode is changing in a way that may leave some stations
3012         ** authenticated which should not be authenticated.  It will be
3013         ** necessary to de-authenticate these stations.
3014         */
3015
3016         if (mode == WLAN_ACCESS_ALL || mode == hw->accessmode) {
3017                 hw->accessmode = mode;
3018                 return;
3019         }
3020
3021         /*
3022         ** Switch to the new access mode.  Once this is done, then the interrupt
3023         ** handler (which uses this value) will be prevented from authenticating
3024         ** ADDITIONAL stations which should not be authenticated.  Then get a
3025         ** copy of the current list of authenticated stations.
3026         */
3027
3028         hw->accessmode = mode;
3029
3030         prism2mib_priv_authlist(hw, &old);
3031
3032         /*
3033         ** Now go through the list of previously authenticated stations (some
3034         ** of which might de-authenticate themselves while we are processing it
3035         ** but that is okay).  Any station which no longer matches the access
3036         ** mode, must be de-authenticated.
3037         */
3038
3039         for (i = 0; i < old.cnt; i++) {
3040                 addr = old.addr[i];
3041
3042                 if (mode == WLAN_ACCESS_NONE)
3043                         deauth = 1;
3044                 else {
3045                         if (mode == WLAN_ACCESS_ALLOW) {
3046                                 for (j = 0; j < hw->allow.cnt; j++)
3047                                         if (memcmp(addr, hw->allow.addr[j],
3048                                                         WLAN_ADDR_LEN) == 0)
3049                                                 break;
3050                                 deauth = (j >= hw->allow.cnt);
3051                         } else {
3052                                 for (j = 0; j < hw->deny.cnt; j++)
3053                                         if (memcmp(addr, hw->deny.addr[j],
3054                                                         WLAN_ADDR_LEN) == 0)
3055                                                 break;
3056                                 deauth = (j < hw->deny.cnt);
3057                         }
3058                 }
3059
3060                 if (deauth) prism2mib_priv_deauthenticate(hw, addr);
3061         }
3062
3063         DBFEXIT;
3064         return;
3065 }
3066
3067 /*----------------------------------------------------------------
3068 * prism2mib_priv_accessallow
3069 *
3070 * Change the list of allowed MAC addresses.
3071 *
3072 * Arguments:
3073 *       priv      "priv" structure.
3074 *       hw        "hw" structure.
3075 *       macarray  New array of MAC addresses.
3076 *
3077 * Returns:
3078 *       Nothing
3079 *
3080 ----------------------------------------------------------------*/
3081
3082 static void prism2mib_priv_accessallow(
3083 hfa384x_t         *hw,
3084 p80211macarray_t  *macarray)
3085 {
3086         prism2sta_authlist_t  old;
3087         int                   i, j;
3088
3089         DBFENTER;
3090
3091         /*
3092         ** Change the access list.  Note that the interrupt handler may be in
3093         ** the middle of using the access list!!!  Since the interrupt handler
3094         ** will always have priority over this process and this is the only
3095         ** process that will modify the list, this problem can be handled as
3096         ** follows:
3097         **
3098         **    1. Set the "modify" flag.
3099         **    2. Change the first copy of the list.
3100         **    3. Clear the "modify" flag.
3101         **    4. Change the backup copy of the list.
3102         **
3103         ** The interrupt handler will check the "modify" flag.  If NOT set, then
3104         ** the first copy of the list is valid and may be used.  Otherwise, the
3105         ** first copy is being changed but the backup copy is valid and may be
3106         ** used.  Doing things this way prevents having to have the interrupt
3107         ** handler block while the list is being updated.
3108         */
3109
3110         hw->allow.modify = 1;
3111
3112         hw->allow.cnt = macarray->cnt;
3113         memcpy(hw->allow.addr, macarray->data, macarray->cnt*WLAN_ADDR_LEN);
3114
3115         hw->allow.modify = 0;
3116
3117         hw->allow.cnt1 = macarray->cnt;
3118         memcpy(hw->allow.addr1, macarray->data, macarray->cnt*WLAN_ADDR_LEN);
3119
3120         /*
3121         ** If the current access mode is "Allow", then changing the access
3122         ** list may leave some stations authenticated which should not be
3123         ** authenticated.  It will be necessary to de-authenticate these
3124         ** stations.  Otherwise, the list can be changed without a lot of fuss.
3125         */
3126
3127         if (hw->accessmode == WLAN_ACCESS_ALLOW) {
3128
3129                 /*
3130                 ** Go through the list of authenticated stations (some of
3131                 ** which might de-authenticate themselves while we are
3132                 ** processing it but that is okay).  Any station which is
3133                 ** no longer in the list of allowed stations, must be
3134                 ** de-authenticated.
3135                 */
3136
3137                 prism2mib_priv_authlist(hw, &old);
3138
3139                 for (i = 0; i < old.cnt; i++) {
3140                         for (j = 0; j < hw->allow.cnt; j++)
3141                                 if (memcmp(old.addr[i], hw->allow.addr[j],
3142                                                         WLAN_ADDR_LEN) == 0)
3143                                         break;
3144                         if (j >= hw->allow.cnt)
3145                                 prism2mib_priv_deauthenticate(hw, old.addr[i]);
3146                 }
3147         }
3148
3149         DBFEXIT;
3150         return;
3151 }
3152
3153 /*----------------------------------------------------------------
3154 * prism2mib_priv_accessdeny
3155 *
3156 * Change the list of denied MAC addresses.
3157 *
3158 * Arguments:
3159 *       priv      "priv" structure.
3160 *       hw        "hw" structure.
3161 *       macarray  New array of MAC addresses.
3162 *
3163 * Returns:
3164 *       Nothing
3165 *
3166 ----------------------------------------------------------------*/
3167
3168 static void prism2mib_priv_accessdeny(
3169 hfa384x_t         *hw,
3170 p80211macarray_t  *macarray)
3171 {
3172         prism2sta_authlist_t  old;
3173         int                   i, j;
3174
3175         DBFENTER;
3176
3177         /*
3178         ** Change the access list.  Note that the interrupt handler may be in
3179         ** the middle of using the access list!!!  Since the interrupt handler
3180         ** will always have priority over this process and this is the only
3181         ** process that will modify the list, this problem can be handled as
3182         ** follows:
3183         **
3184         **    1. Set the "modify" flag.
3185         **    2. Change the first copy of the list.
3186         **    3. Clear the "modify" flag.
3187         **    4. Change the backup copy of the list.
3188         **
3189         ** The interrupt handler will check the "modify" flag.  If NOT set, then
3190         ** the first copy of the list is valid and may be used.  Otherwise, the
3191         ** first copy is being changed but the backup copy is valid and may be
3192         ** used.  Doing things this way prevents having to have the interrupt
3193         ** handler block while the list is being updated.
3194         */
3195
3196         hw->deny.modify = 1;
3197
3198         hw->deny.cnt = macarray->cnt;
3199         memcpy(hw->deny.addr, macarray->data, macarray->cnt*WLAN_ADDR_LEN);
3200
3201         hw->deny.modify = 0;
3202
3203         hw->deny.cnt1 = macarray->cnt;
3204         memcpy(hw->deny.addr1, macarray->data, macarray->cnt*WLAN_ADDR_LEN);
3205
3206         /*
3207         ** If the current access mode is "Deny", then changing the access
3208         ** list may leave some stations authenticated which should not be
3209         ** authenticated.  It will be necessary to de-authenticate these
3210         ** stations.  Otherwise, the list can be changed without a lot of fuss.
3211         */
3212
3213         if (hw->accessmode == WLAN_ACCESS_DENY) {
3214
3215                 /*
3216                 ** Go through the list of authenticated stations (some of
3217                 ** which might de-authenticate themselves while we are
3218                 ** processing it but that is okay).  Any station which is
3219                 ** now in the list of denied stations, must be de-authenticated.
3220                 */
3221
3222                 prism2mib_priv_authlist(hw, &old);
3223
3224                 for (i = 0; i < old.cnt; i++)
3225                         for (j = 0; j < hw->deny.cnt; j++)
3226                                 if (memcmp(old.addr[i], hw->deny.addr[j],
3227                                                          WLAN_ADDR_LEN) == 0) {
3228                                         prism2mib_priv_deauthenticate(hw, old.addr[i]);
3229                                         break;
3230                                 }
3231         }
3232
3233         DBFEXIT;
3234         return;
3235 }
3236
3237 /*----------------------------------------------------------------
3238 * prism2mib_priv_deauthenticate
3239 *
3240 * De-authenticate a station.  This is done by sending a HandoverAddress
3241 * information frame to the firmware.  This should work, according to
3242 * Intersil.
3243 *
3244 * Arguments:
3245 *       priv     "priv" structure.
3246 *       hw       "hw" structure.
3247 *       addr     MAC address of station to be de-authenticated.
3248 *
3249 * Returns:
3250 *       Nothing
3251 *
3252 ----------------------------------------------------------------*/
3253
3254 static void prism2mib_priv_deauthenticate(
3255 hfa384x_t         *hw,
3256 UINT8             *addr)
3257 {
3258         DBFENTER;
3259         hfa384x_drvr_handover(hw, addr);
3260         DBFEXIT;
3261         return;
3262 }
3263
3264
3265 /*----------------------------------------------------------------
3266 * prism2mgmt_pstr2bytestr
3267 *
3268 * Convert the pstr data in the WLAN message structure into an hfa384x
3269 * byte string format.
3270 *
3271 * Arguments:
3272 *       bytestr         hfa384x byte string data type
3273 *       pstr            wlan message data
3274 *
3275 * Returns:
3276 *       Nothing
3277 *
3278 ----------------------------------------------------------------*/
3279
3280 void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
3281 {
3282         DBFENTER;
3283
3284         bytestr->len = host2hfa384x_16((UINT16)(pstr->len));
3285         memcpy(bytestr->data, pstr->data, pstr->len);
3286         DBFEXIT;
3287 }
3288
3289
3290 /*----------------------------------------------------------------
3291 * prism2mgmt_pstr2bytearea
3292 *
3293 * Convert the pstr data in the WLAN message structure into an hfa384x
3294 * byte area format.
3295 *
3296 * Arguments:
3297 *       bytearea        hfa384x byte area data type
3298 *       pstr            wlan message data
3299 *
3300 * Returns:
3301 *       Nothing
3302 *
3303 ----------------------------------------------------------------*/
3304
3305 void prism2mgmt_pstr2bytearea(UINT8 *bytearea, p80211pstrd_t *pstr)
3306 {
3307         DBFENTER;
3308
3309         memcpy(bytearea, pstr->data, pstr->len);
3310         DBFEXIT;
3311 }
3312
3313
3314 /*----------------------------------------------------------------
3315 * prism2mgmt_bytestr2pstr
3316 *
3317 * Convert the data in an hfa384x byte string format into a
3318 * pstr in the WLAN message.
3319 *
3320 * Arguments:
3321 *       bytestr         hfa384x byte string data type
3322 *       msg             wlan message
3323 *
3324 * Returns:
3325 *       Nothing
3326 *
3327 ----------------------------------------------------------------*/
3328
3329 void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
3330 {
3331         DBFENTER;
3332
3333         pstr->len = (UINT8)(hfa384x2host_16((UINT16)(bytestr->len)));
3334         memcpy(pstr->data, bytestr->data, pstr->len);
3335         DBFEXIT;
3336 }
3337
3338
3339 /*----------------------------------------------------------------
3340 * prism2mgmt_bytearea2pstr
3341 *
3342 * Convert the data in an hfa384x byte area format into a pstr
3343 * in the WLAN message.
3344 *
3345 * Arguments:
3346 *       bytearea        hfa384x byte area data type
3347 *       msg             wlan message
3348 *
3349 * Returns:
3350 *       Nothing
3351 *
3352 ----------------------------------------------------------------*/
3353
3354 void prism2mgmt_bytearea2pstr(UINT8 *bytearea, p80211pstrd_t *pstr, int len)
3355 {
3356         DBFENTER;
3357
3358         pstr->len = (UINT8)len;
3359         memcpy(pstr->data, bytearea, len);
3360         DBFEXIT;
3361 }
3362
3363
3364 /*----------------------------------------------------------------
3365 * prism2mgmt_prism2int2p80211int
3366 *
3367 * Convert an hfa384x integer into a wlan integer
3368 *
3369 * Arguments:
3370 *       prism2enum      pointer to hfa384x integer
3371 *       wlanenum        pointer to p80211 integer
3372 *
3373 * Returns:
3374 *       Nothing
3375 *
3376 ----------------------------------------------------------------*/
3377
3378 void prism2mgmt_prism2int2p80211int(UINT16 *prism2int, UINT32 *wlanint)
3379 {
3380         DBFENTER;
3381
3382         *wlanint = (UINT32)hfa384x2host_16(*prism2int);
3383         DBFEXIT;
3384 }
3385
3386
3387 /*----------------------------------------------------------------
3388 * prism2mgmt_p80211int2prism2int
3389 *
3390 * Convert a wlan integer into an hfa384x integer
3391 *
3392 * Arguments:
3393 *       prism2enum      pointer to hfa384x integer
3394 *       wlanenum        pointer to p80211 integer
3395 *
3396 * Returns:
3397 *       Nothing
3398 *
3399 ----------------------------------------------------------------*/
3400
3401 void prism2mgmt_p80211int2prism2int(UINT16 *prism2int, UINT32 *wlanint)
3402 {
3403         DBFENTER;
3404
3405         *prism2int = host2hfa384x_16((UINT16)(*wlanint));
3406         DBFEXIT;
3407 }
3408
3409
3410 /*----------------------------------------------------------------
3411 * prism2mgmt_prism2enum2p80211enum
3412 *
3413 * Convert the hfa384x enumerated int into a p80211 enumerated int
3414 *
3415 * Arguments:
3416 *       prism2enum      pointer to hfa384x integer
3417 *       wlanenum        pointer to p80211 integer
3418 *       rid             hfa384x record id
3419 *
3420 * Returns:
3421 *       Nothing
3422 *
3423 ----------------------------------------------------------------*/
3424 void prism2mgmt_prism2enum2p80211enum(UINT16 *prism2enum, UINT32 *wlanenum, UINT16 rid)
3425 {
3426         DBFENTER;
3427
3428         /* At the moment, the need for this functionality hasn't
3429         presented itself. All the wlan enumerated values are
3430         a 1-to-1 match against the Prism2 enumerated values*/
3431         DBFEXIT;
3432         return;
3433 }
3434
3435
3436 /*----------------------------------------------------------------
3437 * prism2mgmt_p80211enum2prism2enum
3438 *
3439 * Convert the p80211 enumerated int into an hfa384x enumerated int
3440 *
3441 * Arguments:
3442 *       prism2enum      pointer to hfa384x integer
3443 *       wlanenum        pointer to p80211 integer
3444 *       rid             hfa384x record id
3445 *
3446 * Returns:
3447 *       Nothing
3448 *
3449 ----------------------------------------------------------------*/
3450 void prism2mgmt_p80211enum2prism2enum(UINT16 *prism2enum, UINT32 *wlanenum, UINT16 rid)
3451 {
3452         DBFENTER;
3453
3454         /* At the moment, the need for this functionality hasn't
3455         presented itself. All the wlan enumerated values are
3456         a 1-to-1 match against the Prism2 enumerated values*/
3457         DBFEXIT;
3458         return;
3459 }
3460
3461
3462
3463 /*----------------------------------------------------------------
3464 * prism2mgmt_get_oprateset
3465 *
3466 * Convert the hfa384x bit area into a wlan octet string.
3467 *
3468 * Arguments:
3469 *       rate            Prism2 bit area
3470 *       pstr            wlan octet string
3471 *
3472 * Returns:
3473 *       Nothing
3474 *
3475 ----------------------------------------------------------------*/
3476 void prism2mgmt_get_oprateset(UINT16 *rate, p80211pstrd_t *pstr)
3477 {
3478         UINT8   len;
3479         UINT8   *datarate;
3480
3481         DBFENTER;
3482
3483         len = 0;
3484         datarate = pstr->data;
3485
3486         /* 1 Mbps */
3487         if ( BIT0 & (*rate) ) {
3488                 len += (UINT8)1;
3489                 *datarate = (UINT8)2;
3490                 datarate++;
3491         }
3492
3493         /* 2 Mbps */
3494         if ( BIT1 & (*rate) ) {
3495                 len += (UINT8)1;
3496                 *datarate = (UINT8)4;
3497                 datarate++;
3498         }
3499
3500         /* 5.5 Mbps */
3501         if ( BIT2 & (*rate) ) {
3502                 len += (UINT8)1;
3503                 *datarate = (UINT8)11;
3504                 datarate++;
3505         }
3506
3507         /* 11 Mbps */
3508         if ( BIT3 & (*rate) ) {
3509                 len += (UINT8)1;
3510                 *datarate = (UINT8)22;
3511                 datarate++;
3512         }
3513
3514         pstr->len = len;
3515
3516         DBFEXIT;
3517         return;
3518 }
3519
3520
3521
3522 /*----------------------------------------------------------------
3523 * prism2mgmt_set_oprateset
3524 *
3525 * Convert the wlan octet string into an hfa384x bit area.
3526 *
3527 * Arguments:
3528 *       rate            Prism2 bit area
3529 *       pstr            wlan octet string
3530 *
3531 * Returns:
3532 *       Nothing
3533 *
3534 ----------------------------------------------------------------*/
3535 void prism2mgmt_set_oprateset(UINT16 *rate, p80211pstrd_t *pstr)
3536 {
3537         UINT8   *datarate;
3538         int     i;
3539
3540         DBFENTER;
3541
3542         *rate = 0;
3543
3544         datarate = pstr->data;
3545
3546         for ( i=0; i < pstr->len; i++, datarate++ ) {
3547                 switch (*datarate) {
3548                 case 2: /* 1 Mbps */
3549                         *rate |= BIT0;
3550                         break;
3551                 case 4: /* 2 Mbps */
3552                         *rate |= BIT1;
3553                         break;
3554                 case 11: /* 5.5 Mbps */
3555                         *rate |= BIT2;
3556                         break;
3557                 case 22: /* 11 Mbps */
3558                         *rate |= BIT3;
3559                         break;
3560                 default:
3561                         WLAN_LOG_DEBUG(1, "Unrecoginzed Rate of %d\n",
3562                                 *datarate);
3563                         break;
3564                 }
3565         }
3566
3567         DBFEXIT;
3568         return;
3569 }
3570
3571
3572
3573 /*----------------------------------------------------------------
3574 * prism2mgmt_get_grpaddr
3575 *
3576 * Retrieves a particular group address from the list of
3577 * group addresses.
3578 *
3579 * Arguments:
3580 *       did             mibitem did
3581 *       pstr            wlan octet string
3582 *       priv            prism2 driver private data structure
3583 *
3584 * Returns:
3585 *       Nothing
3586 *
3587 ----------------------------------------------------------------*/
3588 void prism2mgmt_get_grpaddr(UINT32 did, p80211pstrd_t *pstr,
3589         hfa384x_t *hw )
3590 {
3591         int     index;
3592
3593         DBFENTER;
3594
3595         index = prism2mgmt_get_grpaddr_index(did);
3596
3597         if ( index >= 0 ) {
3598                 pstr->len = WLAN_ADDR_LEN;
3599                 memcpy(pstr->data, hw->dot11_grp_addr[index],
3600                         WLAN_ADDR_LEN);
3601         }
3602
3603         DBFEXIT;
3604         return;
3605 }
3606
3607
3608
3609 /*----------------------------------------------------------------
3610 * prism2mgmt_set_grpaddr
3611 *
3612 * Convert the wlan octet string into an hfa384x bit area.
3613 *
3614 * Arguments:
3615 *       did             mibitem did
3616 *       buf
3617 *       groups
3618 *
3619 * Returns:
3620 *       0       Success
3621 *       !0      Error
3622 *
3623 ----------------------------------------------------------------*/
3624 int prism2mgmt_set_grpaddr(UINT32 did, UINT8 *prism2buf,
3625         p80211pstrd_t *pstr, hfa384x_t *hw )
3626 {
3627         UINT8   no_addr[WLAN_ADDR_LEN];
3628         int     index;
3629
3630         DBFENTER;
3631
3632         memset(no_addr, 0, WLAN_ADDR_LEN);
3633         if (memcmp(no_addr, pstr->data, WLAN_ADDR_LEN) != 0) {
3634
3635                 /*
3636                 ** The address is NOT 0 so we are "adding" an address to the
3637                 ** group address list.  Check to make sure we aren't trying
3638                 ** to add more than the maximum allowed number of group
3639                 ** addresses in the list.  The new address is added to the
3640                 ** end of the list regardless of the DID used to add the
3641                 ** address.
3642                 */
3643
3644                 if (hw->dot11_grpcnt >= MAX_GRP_ADDR) return(-1);
3645
3646                 memcpy(hw->dot11_grp_addr[hw->dot11_grpcnt], pstr->data,
3647                                                                  WLAN_ADDR_LEN);
3648                 hw->dot11_grpcnt += 1;
3649         } else {
3650
3651                 /*
3652                 ** The address is 0.  Interpret this as "deleting" an address
3653                 ** from the group address list.  Get the address index from
3654                 ** the DID.  If this is within the range of used addresses,
3655                 ** then delete the specified address by shifting all following
3656                 ** addresses down.  Then clear the last address (which should
3657                 ** now be unused).  If the address index is NOT within the
3658                 ** range of used addresses, then just ignore the address.
3659                 */
3660
3661                 index = prism2mgmt_get_grpaddr_index(did);
3662                 if (index >= 0 && index < hw->dot11_grpcnt) {
3663                         hw->dot11_grpcnt -= 1;
3664                         memmove(hw->dot11_grp_addr[index],
3665                                 hw->dot11_grp_addr[index + 1],
3666                                 ((hw->dot11_grpcnt)-index) * WLAN_ADDR_LEN);
3667                         memset(hw->dot11_grp_addr[hw->dot11_grpcnt], 0,
3668                                                                  WLAN_ADDR_LEN);
3669                 }
3670         }
3671
3672         DBFEXIT;
3673         return(0);
3674 }
3675
3676
3677 /*----------------------------------------------------------------
3678 * prism2mgmt_get_grpaddr_index
3679 *
3680 * Gets the index in the group address list based on the did.
3681 *
3682 * Arguments:
3683 *       did             mibitem did
3684 *
3685 * Returns:
3686 *       >= 0    If valid did
3687 *       < 0     If not valid did
3688 *
3689 ----------------------------------------------------------------*/
3690 int prism2mgmt_get_grpaddr_index( UINT32 did )
3691 {
3692         int     index;
3693
3694         DBFENTER;
3695
3696         index = -1;
3697
3698         switch (did) {
3699         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1:
3700                 index = 0;
3701                 break;
3702         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2:
3703                 index = 1;
3704                 break;
3705         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3:
3706                 index = 2;
3707                 break;
3708         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4:
3709                 index = 3;
3710                 break;
3711         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5:
3712                 index = 4;
3713                 break;
3714         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6:
3715                 index = 5;
3716                 break;
3717         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7:
3718                 index = 6;
3719                 break;
3720         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8:
3721                 index = 7;
3722                 break;
3723         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9:
3724                 index = 8;
3725                 break;
3726         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10:
3727                 index = 9;
3728                 break;
3729         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11:
3730                 index = 10;
3731                 break;
3732         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12:
3733                 index = 11;
3734                 break;
3735         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13:
3736                 index = 12;
3737                 break;
3738         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14:
3739                 index = 13;
3740                 break;
3741         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15:
3742                 index = 14;
3743                 break;
3744         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16:
3745                 index = 15;
3746                 break;
3747         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17:
3748                 index = 16;
3749                 break;
3750         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18:
3751                 index = 17;
3752                 break;
3753         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19:
3754                 index = 18;
3755                 break;
3756         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20:
3757                 index = 19;
3758                 break;
3759         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21:
3760                 index = 20;
3761                 break;
3762         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22:
3763                 index = 21;
3764                 break;
3765         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23:
3766                 index = 22;
3767                 break;
3768         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24:
3769                 index = 23;
3770                 break;
3771         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25:
3772                 index = 24;
3773                 break;
3774         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26:
3775                 index = 25;
3776                 break;
3777         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27:
3778                 index = 26;
3779                 break;
3780         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28:
3781                 index = 27;
3782                 break;
3783         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29:
3784                 index = 28;
3785                 break;
3786         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30:
3787                 index = 29;
3788                 break;
3789         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31:
3790                 index = 30;
3791                 break;
3792         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32:
3793                 index = 31;
3794                 break;
3795         }
3796
3797         DBFEXIT;
3798         return index;
3799 }