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