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