Staging: wlan-ng: Use standard kernel integer (u32/s32/etc) types.
[firefly-linux-kernel-4.4.55.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 <linux/version.h>
58
59 #include <linux/module.h>
60 #include <linux/kernel.h>
61 #include <linux/sched.h>
62 #include <linux/types.h>
63 #include <linux/slab.h>
64 #include <linux/wireless.h>
65 #include <linux/netdevice.h>
66 #include <asm/io.h>
67 #include <linux/delay.h>
68 #include <asm/byteorder.h>
69 #include <linux/usb.h>
70
71 /*================================================================*/
72 /* Project Includes */
73
74 #include "p80211types.h"
75 #include "p80211hdr.h"
76 #include "p80211mgmt.h"
77 #include "p80211conv.h"
78 #include "p80211msg.h"
79 #include "p80211netdev.h"
80 #include "p80211metadef.h"
81 #include "p80211metastruct.h"
82 #include "hfa384x.h"
83 #include "prism2mgmt.h"
84
85 /*================================================================*/
86 /* Local Constants */
87
88 #define MIB_TMP_MAXLEN    200    /* Max length of RID record (in bytes). */
89
90 /*================================================================*/
91 /* Local Types */
92
93 #define  F_STA        0x1        /* MIB is supported on stations. */
94 #define  F_READ       0x2        /* MIB may be read. */
95 #define  F_WRITE      0x4        /* MIB may be written. */
96
97 typedef struct mibrec
98 {
99     u32   did;
100     u16   flag;
101     u16   parm1;
102     u16   parm2;
103     u16   parm3;
104     int      (*func)(struct mibrec                *mib,
105                      int                          isget,
106                      wlandevice_t                 *wlandev,
107                      hfa384x_t                    *hw,
108                      p80211msg_dot11req_mibset_t  *msg,
109                      void                         *data);
110 } mibrec_t;
111
112 /*================================================================*/
113 /* Local Function Declarations */
114
115 static int prism2mib_bytestr2pstr(
116 mibrec_t                     *mib,
117 int                          isget,
118 wlandevice_t                 *wlandev,
119 hfa384x_t                    *hw,
120 p80211msg_dot11req_mibset_t  *msg,
121 void                         *data);
122
123 static int prism2mib_bytearea2pstr(
124 mibrec_t                     *mib,
125 int                          isget,
126 wlandevice_t                 *wlandev,
127 hfa384x_t                    *hw,
128 p80211msg_dot11req_mibset_t  *msg,
129 void                         *data);
130
131 static int prism2mib_uint32(
132 mibrec_t                     *mib,
133 int                          isget,
134 wlandevice_t                 *wlandev,
135 hfa384x_t                    *hw,
136 p80211msg_dot11req_mibset_t  *msg,
137 void                         *data);
138
139 static int prism2mib_uint32array(
140 mibrec_t                     *mib,
141 int                          isget,
142 wlandevice_t                 *wlandev,
143 hfa384x_t                    *hw,
144 p80211msg_dot11req_mibset_t  *msg,
145 void                         *data);
146
147 static int prism2mib_uint32offset(
148 mibrec_t                     *mib,
149 int                          isget,
150 wlandevice_t                 *wlandev,
151 hfa384x_t                    *hw,
152 p80211msg_dot11req_mibset_t  *msg,
153 void                         *data);
154
155 static int prism2mib_truth(
156 mibrec_t                     *mib,
157 int                          isget,
158 wlandevice_t                 *wlandev,
159 hfa384x_t                    *hw,
160 p80211msg_dot11req_mibset_t  *msg,
161 void                         *data);
162
163 static int prism2mib_preamble(
164 mibrec_t                     *mib,
165 int                          isget,
166 wlandevice_t                 *wlandev,
167 hfa384x_t                    *hw,
168 p80211msg_dot11req_mibset_t  *msg,
169 void                         *data);
170
171 static int prism2mib_flag(
172 mibrec_t                     *mib,
173 int                          isget,
174 wlandevice_t                 *wlandev,
175 hfa384x_t                    *hw,
176 p80211msg_dot11req_mibset_t  *msg,
177 void                         *data);
178
179 static int prism2mib_regulatorydomains(
180 mibrec_t                     *mib,
181 int                          isget,
182 wlandevice_t                 *wlandev,
183 hfa384x_t                    *hw,
184 p80211msg_dot11req_mibset_t  *msg,
185 void                         *data);
186
187 static int prism2mib_wepdefaultkey(
188 mibrec_t                     *mib,
189 int                          isget,
190 wlandevice_t                 *wlandev,
191 hfa384x_t                    *hw,
192 p80211msg_dot11req_mibset_t  *msg,
193 void                         *data);
194
195 static int prism2mib_powermanagement(
196 mibrec_t                     *mib,
197 int                          isget,
198 wlandevice_t                 *wlandev,
199 hfa384x_t                    *hw,
200 p80211msg_dot11req_mibset_t  *msg,
201 void                         *data);
202
203 static int prism2mib_privacyinvoked(
204 mibrec_t                     *mib,
205 int                          isget,
206 wlandevice_t                 *wlandev,
207 hfa384x_t                    *hw,
208 p80211msg_dot11req_mibset_t  *msg,
209 void                         *data);
210
211 static int prism2mib_excludeunencrypted(
212 mibrec_t                     *mib,
213 int                          isget,
214 wlandevice_t                 *wlandev,
215 hfa384x_t                    *hw,
216 p80211msg_dot11req_mibset_t  *msg,
217 void                         *data);
218
219 static int prism2mib_fragmentationthreshold(
220 mibrec_t                     *mib,
221 int                          isget,
222 wlandevice_t                 *wlandev,
223 hfa384x_t                    *hw,
224 p80211msg_dot11req_mibset_t  *msg,
225 void                         *data);
226
227 static int prism2mib_operationalrateset(
228 mibrec_t                     *mib,
229 int                          isget,
230 wlandevice_t                 *wlandev,
231 hfa384x_t                    *hw,
232 p80211msg_dot11req_mibset_t  *msg,
233 void                         *data);
234
235 static int prism2mib_groupaddress(
236 mibrec_t                     *mib,
237 int                          isget,
238 wlandevice_t                 *wlandev,
239 hfa384x_t                    *hw,
240 p80211msg_dot11req_mibset_t  *msg,
241 void                         *data);
242
243 static int prism2mib_fwid(
244 mibrec_t                     *mib,
245 int                          isget,
246 wlandevice_t                 *wlandev,
247 hfa384x_t                    *hw,
248 p80211msg_dot11req_mibset_t  *msg,
249 void                         *data);
250
251 static int prism2mib_authalg(
252 mibrec_t                     *mib,
253 int                          isget,
254 wlandevice_t                 *wlandev,
255 hfa384x_t                    *hw,
256 p80211msg_dot11req_mibset_t  *msg,
257 void                         *data);
258
259 static int prism2mib_authalgenable(
260 mibrec_t                     *mib,
261 int                          isget,
262 wlandevice_t                 *wlandev,
263 hfa384x_t                    *hw,
264 p80211msg_dot11req_mibset_t  *msg,
265 void                         *data);
266
267 static int prism2mib_priv(
268 mibrec_t                     *mib,
269 int                          isget,
270 wlandevice_t                 *wlandev,
271 hfa384x_t                    *hw,
272 p80211msg_dot11req_mibset_t  *msg,
273 void                         *data);
274
275 /*================================================================*/
276 /* Local Static Definitions */
277
278 static mibrec_t mibtab[] = {
279
280     /* dot11smt MIB's */
281
282     { DIDmib_dot11smt_dot11StationConfigTable_dot11StationID,
283           F_STA | F_READ | F_WRITE,
284           HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
285           prism2mib_bytearea2pstr },
286     { DIDmib_dot11smt_dot11StationConfigTable_dot11CFPollable,
287           F_STA | F_READ,
288           HFA384x_RID_CFPOLLABLE, 0, 0,
289           prism2mib_uint32 },
290     { DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticationResponseTimeOut,
291           F_STA | F_READ | F_WRITE,
292           HFA384x_RID_CNFAUTHRSPTIMEOUT, 0, 0,
293           prism2mib_uint32 },
294     { DIDmib_dot11smt_dot11StationConfigTable_dot11PrivacyOptionImplemented,
295           F_STA | F_READ,
296           HFA384x_RID_PRIVACYOPTIMP, 0, 0,
297           prism2mib_uint32 },
298     { DIDmib_dot11smt_dot11StationConfigTable_dot11PowerManagementMode,
299           F_STA | F_READ | F_WRITE,
300           HFA384x_RID_CNFPMENABLED, 0, 0,
301           prism2mib_powermanagement },
302     { DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredSSID,
303           F_STA | F_READ | F_WRITE,
304           HFA384x_RID_CNFDESIREDSSID, HFA384x_RID_CNFDESIREDSSID_LEN, 0,
305           prism2mib_bytestr2pstr },
306     { DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType,
307           F_STA | F_READ | F_WRITE,
308           0, 0, 0,
309           prism2mib_priv },
310     { DIDmib_dot11smt_dot11StationConfigTable_dot11OperationalRateSet,
311           F_STA | F_READ | F_WRITE,
312           HFA384x_RID_TXRATECNTL, 0, 0,
313           prism2mib_operationalrateset },
314     { DIDmib_dot11smt_dot11StationConfigTable_dot11DTIMPeriod,
315           F_STA | F_READ | F_WRITE,
316           HFA384x_RID_CNFOWNDTIMPER, 0, 0,
317           prism2mib_uint32 },
318     { DIDmib_dot11smt_dot11StationConfigTable_dot11AssociationResponseTimeOut,
319           F_STA | F_READ,
320           HFA384x_RID_PROTOCOLRSPTIME, 0, 0,
321           prism2mib_uint32 },
322     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm1,
323           F_STA | F_READ,
324           1, 0, 0,
325           prism2mib_authalg },
326     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm2,
327           F_STA | F_READ,
328           2, 0, 0,
329           prism2mib_authalg },
330     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm3,
331           F_STA | F_READ,
332           3, 0, 0,
333           prism2mib_authalg },
334     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm4,
335           F_STA | F_READ,
336           4, 0, 0,
337           prism2mib_authalg },
338     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm5,
339           F_STA | F_READ,
340           5, 0, 0,
341           prism2mib_authalg },
342     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm6,
343           F_STA | F_READ,
344           6, 0, 0,
345           prism2mib_authalg },
346     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable1,
347           F_STA | F_READ | F_WRITE,
348           1, 0, 0,
349           prism2mib_authalgenable },
350     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable2,
351           F_STA | F_READ | F_WRITE,
352           2, 0, 0,
353           prism2mib_authalgenable },
354     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable3,
355           F_STA | F_READ | F_WRITE,
356           3, 0, 0,
357           prism2mib_authalgenable },
358     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable4,
359           F_STA | F_READ | F_WRITE,
360           4, 0, 0,
361           prism2mib_authalgenable },
362     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable5,
363           F_STA | F_READ | F_WRITE,
364           5, 0, 0,
365           prism2mib_authalgenable },
366     { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable6,
367           F_STA | F_READ | F_WRITE,
368           6, 0, 0,
369           prism2mib_authalgenable },
370     { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0,
371           F_STA | F_WRITE,
372           HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0,
373           prism2mib_wepdefaultkey },
374     { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1,
375           F_STA | F_WRITE,
376           HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0,
377           prism2mib_wepdefaultkey },
378     { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2,
379           F_STA | F_WRITE,
380           HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0,
381           prism2mib_wepdefaultkey },
382     { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3,
383           F_STA | F_WRITE,
384           HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0,
385           prism2mib_wepdefaultkey },
386     { DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
387           F_STA | F_READ | F_WRITE,
388           HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_PRIVINVOKED, 0,
389           prism2mib_privacyinvoked },
390     { DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
391           F_STA | F_READ | F_WRITE,
392           HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0,
393           prism2mib_uint32 },
394     { DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
395           F_STA | F_READ | F_WRITE,
396           HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_EXCLUDE, 0,
397           prism2mib_excludeunencrypted },
398     { DIDmib_dot11phy_dot11PhyOperationTable_dot11ShortPreambleEnabled,
399           F_STA | F_READ | F_WRITE,
400           HFA384x_RID_CNFSHORTPREAMBLE, 0, 0,
401           prism2mib_preamble },
402
403     /* dot11mac MIB's */
404
405     { DIDmib_dot11mac_dot11OperationTable_dot11MACAddress,
406           F_STA | F_READ | F_WRITE,
407           HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
408           prism2mib_bytearea2pstr },
409     { DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold,
410           F_STA | F_READ | F_WRITE,
411           HFA384x_RID_RTSTHRESH, 0, 0,
412           prism2mib_uint32 },
413     { DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit,
414           F_STA | F_READ,
415           HFA384x_RID_SHORTRETRYLIMIT, 0, 0,
416           prism2mib_uint32 },
417     { DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit,
418           F_STA | F_READ,
419           HFA384x_RID_LONGRETRYLIMIT, 0, 0,
420           prism2mib_uint32 },
421     { DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold,
422           F_STA | F_READ | F_WRITE,
423           HFA384x_RID_FRAGTHRESH, 0, 0,
424           prism2mib_fragmentationthreshold },
425     { DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime,
426           F_STA | F_READ,
427           HFA384x_RID_MAXTXLIFETIME, 0, 0,
428           prism2mib_uint32 },
429     { DIDmib_dot11mac_dot11OperationTable_dot11MaxReceiveLifetime,
430           F_STA | F_READ,
431           HFA384x_RID_MAXRXLIFETIME, 0, 0,
432           prism2mib_uint32 },
433     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1,
434           F_STA | F_READ | F_WRITE,
435           0, 0, 0,
436           prism2mib_groupaddress },
437     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2,
438           F_STA | F_READ | F_WRITE,
439           0, 0, 0,
440           prism2mib_groupaddress },
441     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3,
442           F_STA | F_READ | F_WRITE,
443           0, 0, 0,
444           prism2mib_groupaddress },
445     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4,
446           F_STA | F_READ | F_WRITE,
447           0, 0, 0,
448           prism2mib_groupaddress },
449     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5,
450           F_STA | F_READ | F_WRITE,
451           0, 0, 0,
452           prism2mib_groupaddress },
453     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6,
454           F_STA | F_READ | F_WRITE,
455           0, 0, 0,
456           prism2mib_groupaddress },
457     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7,
458           F_STA | F_READ | F_WRITE,
459           0, 0, 0,
460           prism2mib_groupaddress },
461     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8,
462           F_STA | F_READ | F_WRITE,
463           0, 0, 0,
464           prism2mib_groupaddress },
465     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9,
466           F_STA | F_READ | F_WRITE,
467           0, 0, 0,
468           prism2mib_groupaddress },
469     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10,
470           F_STA | F_READ | F_WRITE,
471           0, 0, 0,
472           prism2mib_groupaddress },
473     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11,
474           F_STA | F_READ | F_WRITE,
475           0, 0, 0,
476           prism2mib_groupaddress },
477     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12,
478           F_STA | F_READ | F_WRITE,
479           0, 0, 0,
480           prism2mib_groupaddress },
481     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13,
482           F_STA | F_READ | F_WRITE,
483           0, 0, 0,
484           prism2mib_groupaddress },
485     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14,
486           F_STA | F_READ | F_WRITE,
487           0, 0, 0,
488           prism2mib_groupaddress },
489     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15,
490           F_STA | F_READ | F_WRITE,
491           0, 0, 0,
492           prism2mib_groupaddress },
493     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16,
494           F_STA | F_READ | F_WRITE,
495           0, 0, 0,
496           prism2mib_groupaddress },
497     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17,
498           F_STA | F_READ | F_WRITE,
499           0, 0, 0,
500           prism2mib_groupaddress },
501     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18,
502           F_STA | F_READ | F_WRITE,
503           0, 0, 0,
504           prism2mib_groupaddress },
505     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19,
506           F_STA | F_READ | F_WRITE,
507           0, 0, 0,
508           prism2mib_groupaddress },
509     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20,
510           F_STA | F_READ | F_WRITE,
511           0, 0, 0,
512           prism2mib_groupaddress },
513     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21,
514           F_STA | F_READ | F_WRITE,
515           0, 0, 0,
516           prism2mib_groupaddress },
517     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22,
518           F_STA | F_READ | F_WRITE,
519           0, 0, 0,
520           prism2mib_groupaddress },
521     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23,
522           F_STA | F_READ | F_WRITE,
523           0, 0, 0,
524           prism2mib_groupaddress },
525     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24,
526           F_STA | F_READ | F_WRITE,
527           0, 0, 0,
528           prism2mib_groupaddress },
529     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25,
530           F_STA | F_READ | F_WRITE,
531           0, 0, 0,
532           prism2mib_groupaddress },
533     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26,
534           F_STA | F_READ | F_WRITE,
535           0, 0, 0,
536           prism2mib_groupaddress },
537     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27,
538           F_STA | F_READ | F_WRITE,
539           0, 0, 0,
540           prism2mib_groupaddress },
541     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28,
542           F_STA | F_READ | F_WRITE,
543           0, 0, 0,
544           prism2mib_groupaddress },
545     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29,
546           F_STA | F_READ | F_WRITE,
547           0, 0, 0,
548           prism2mib_groupaddress },
549     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30,
550           F_STA | F_READ | F_WRITE,
551           0, 0, 0,
552           prism2mib_groupaddress },
553     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31,
554           F_STA | F_READ | F_WRITE,
555           0, 0, 0,
556           prism2mib_groupaddress },
557     { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32,
558           F_STA | F_READ | F_WRITE,
559           0, 0, 0,
560           prism2mib_groupaddress },
561
562     /* dot11phy MIB's */
563
564     { DIDmib_dot11phy_dot11PhyOperationTable_dot11PHYType,
565           F_STA | F_READ,
566           HFA384x_RID_PHYTYPE, 0, 0,
567           prism2mib_uint32 },
568     { DIDmib_dot11phy_dot11PhyOperationTable_dot11TempType,
569           F_STA | F_READ,
570           HFA384x_RID_TEMPTYPE, 0, 0,
571           prism2mib_uint32 },
572     { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
573           F_STA | F_READ,
574           HFA384x_RID_CURRENTCHANNEL, 0, 0,
575           prism2mib_uint32 },
576     { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentCCAMode,
577           F_STA | F_READ,
578           HFA384x_RID_CCAMODE, 0, 0,
579           prism2mib_uint32 },
580
581     /* p2Table MIB's */
582
583     { DIDmib_p2_p2Table_p2MMTx,
584           F_STA | F_READ | F_WRITE,
585           0, 0, 0,
586           prism2mib_priv },
587     { DIDmib_p2_p2Table_p2ReceivedFrameStatistics,
588           F_STA | F_READ,
589           0, 0, 0,
590           prism2mib_priv },
591     { DIDmib_p2_p2Table_p2CommunicationTallies,
592           F_STA | F_READ,
593           0, 0, 0,
594           prism2mib_priv },
595     { DIDmib_p2_p2Table_p2Comment,
596           F_STA | F_READ | F_WRITE,
597           0, 0, 0,
598           prism2mib_priv },
599
600     /* p2Static MIB's */
601
602     { DIDmib_p2_p2Static_p2CnfPortType,
603           F_STA | F_READ | F_WRITE,
604           HFA384x_RID_CNFPORTTYPE, 0, 0,
605           prism2mib_uint32 },
606     { DIDmib_p2_p2Static_p2CnfOwnMACAddress,
607           F_STA | F_READ | F_WRITE,
608           HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
609           prism2mib_bytearea2pstr },
610     { DIDmib_p2_p2Static_p2CnfDesiredSSID,
611           F_STA | F_READ | F_WRITE,
612           HFA384x_RID_CNFDESIREDSSID, HFA384x_RID_CNFDESIREDSSID_LEN, 0,
613           prism2mib_bytestr2pstr },
614     { DIDmib_p2_p2Static_p2CnfOwnChannel,
615           F_STA | F_READ | F_WRITE,
616           HFA384x_RID_CNFOWNCHANNEL, 0, 0,
617           prism2mib_uint32 },
618     { DIDmib_p2_p2Static_p2CnfOwnSSID,
619           F_STA | F_READ | F_WRITE,
620           HFA384x_RID_CNFOWNSSID, HFA384x_RID_CNFOWNSSID_LEN, 0,
621           prism2mib_bytestr2pstr },
622     { DIDmib_p2_p2Static_p2CnfOwnATIMWindow,
623           F_STA | F_READ | F_WRITE,
624           HFA384x_RID_CNFOWNATIMWIN, 0, 0,
625           prism2mib_uint32 },
626     { DIDmib_p2_p2Static_p2CnfSystemScale,
627           F_STA | F_READ | F_WRITE,
628           HFA384x_RID_CNFSYSSCALE, 0, 0,
629           prism2mib_uint32 },
630     { DIDmib_p2_p2Static_p2CnfMaxDataLength,
631           F_STA | F_READ | F_WRITE,
632           HFA384x_RID_CNFMAXDATALEN, 0, 0,
633           prism2mib_uint32 },
634     { DIDmib_p2_p2Static_p2CnfWDSAddress,
635           F_STA | F_READ | F_WRITE,
636           HFA384x_RID_CNFWDSADDR, HFA384x_RID_CNFWDSADDR_LEN, 0,
637           prism2mib_bytearea2pstr },
638     { DIDmib_p2_p2Static_p2CnfPMEnabled,
639           F_STA | F_READ | F_WRITE,
640           HFA384x_RID_CNFPMENABLED, 0, 0,
641           prism2mib_truth },
642     { DIDmib_p2_p2Static_p2CnfPMEPS,
643           F_STA | F_READ | F_WRITE,
644           HFA384x_RID_CNFPMEPS, 0, 0,
645           prism2mib_truth },
646     { DIDmib_p2_p2Static_p2CnfMulticastReceive,
647           F_STA | F_READ | F_WRITE,
648           HFA384x_RID_CNFMULTICASTRX, 0, 0,
649           prism2mib_truth },
650     { DIDmib_p2_p2Static_p2CnfMaxSleepDuration,
651           F_STA | F_READ | F_WRITE,
652           HFA384x_RID_CNFMAXSLEEPDUR, 0, 0,
653           prism2mib_uint32 },
654     { DIDmib_p2_p2Static_p2CnfPMHoldoverDuration,
655           F_STA | F_READ | F_WRITE,
656           HFA384x_RID_CNFPMHOLDDUR, 0, 0,
657           prism2mib_uint32 },
658     { DIDmib_p2_p2Static_p2CnfOwnName,
659           F_STA | F_READ | F_WRITE,
660           HFA384x_RID_CNFOWNNAME, HFA384x_RID_CNFOWNNAME_LEN, 0,
661           prism2mib_bytestr2pstr },
662     { DIDmib_p2_p2Static_p2CnfOwnDTIMPeriod,
663           F_STA | F_READ | F_WRITE,
664           HFA384x_RID_CNFOWNDTIMPER, 0, 0,
665           prism2mib_uint32 },
666     { DIDmib_p2_p2Static_p2CnfWEPDefaultKeyID,
667           F_STA | F_READ | F_WRITE,
668           HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0,
669           prism2mib_uint32 },
670     { DIDmib_p2_p2Static_p2CnfWEPDefaultKey0,
671           F_STA | F_WRITE,
672           HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0,
673           prism2mib_wepdefaultkey },
674     { DIDmib_p2_p2Static_p2CnfWEPDefaultKey1,
675           F_STA | F_WRITE,
676           HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0,
677           prism2mib_wepdefaultkey },
678     { DIDmib_p2_p2Static_p2CnfWEPDefaultKey2,
679           F_STA | F_WRITE,
680           HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0,
681           prism2mib_wepdefaultkey },
682     { DIDmib_p2_p2Static_p2CnfWEPDefaultKey3,
683           F_STA | F_WRITE,
684           HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0,
685           prism2mib_wepdefaultkey },
686     { DIDmib_p2_p2Static_p2CnfWEPFlags,
687           F_STA | F_READ | F_WRITE,
688           HFA384x_RID_CNFWEPFLAGS, 0, 0,
689           prism2mib_uint32 },
690     { DIDmib_p2_p2Static_p2CnfAuthentication,
691           F_STA | F_READ | F_WRITE,
692           HFA384x_RID_CNFAUTHENTICATION, 0, 0,
693           prism2mib_uint32 },
694     { DIDmib_p2_p2Static_p2CnfTxControl,
695           F_STA | F_READ | F_WRITE,
696           HFA384x_RID_CNFTXCONTROL, 0, 0,
697           prism2mib_uint32 },
698     { DIDmib_p2_p2Static_p2CnfRoamingMode,
699           F_STA | F_READ | F_WRITE,
700           HFA384x_RID_CNFROAMINGMODE, 0, 0,
701           prism2mib_uint32 },
702     { DIDmib_p2_p2Static_p2CnfRcvCrcError,
703           F_STA | F_READ | F_WRITE,
704           HFA384x_RID_CNFRCVCRCERROR, 0, 0,
705           prism2mib_uint32 },
706     { DIDmib_p2_p2Static_p2CnfAltRetryCount,
707           F_STA | F_READ | F_WRITE,
708           HFA384x_RID_CNFALTRETRYCNT, 0, 0,
709           prism2mib_uint32 },
710     { DIDmib_p2_p2Static_p2CnfSTAPCFInfo,
711           F_STA | F_READ | F_WRITE,
712           HFA384x_RID_CNFSTAPCFINFO, 0, 0,
713           prism2mib_uint32 },
714     { DIDmib_p2_p2Static_p2CnfPriorityQUsage,
715           F_STA | F_READ | F_WRITE,
716           HFA384x_RID_CNFPRIORITYQUSAGE, HFA384x_RID_CNFPRIOQUSAGE_LEN, 0,
717           prism2mib_uint32array },
718     { DIDmib_p2_p2Static_p2CnfTIMCtrl,
719           F_STA | F_READ | F_WRITE,
720           HFA384x_RID_CNFTIMCTRL, 0, 0,
721           prism2mib_uint32 },
722     { DIDmib_p2_p2Static_p2CnfThirty2Tally,
723           F_STA | F_READ | F_WRITE,
724           HFA384x_RID_CNFTHIRTY2TALLY, 0, 0,
725           prism2mib_truth },
726     { DIDmib_p2_p2Static_p2CnfShortPreamble,
727           F_STA | F_READ | F_WRITE,
728           HFA384x_RID_CNFSHORTPREAMBLE, 0, 0,
729           prism2mib_preamble },
730     { DIDmib_p2_p2Static_p2CnfAuthenticationRspTO,
731           F_STA | F_READ | F_WRITE,
732           HFA384x_RID_CNFAUTHRSPTIMEOUT, 0, 0,
733           prism2mib_uint32 },
734     { DIDmib_p2_p2Static_p2CnfBasicRates,
735           F_STA | F_READ | F_WRITE,
736           HFA384x_RID_CNFBASICRATES, 0, 0,
737           prism2mib_uint32 },
738     { DIDmib_p2_p2Static_p2CnfSupportedRates,
739           F_STA | F_READ | F_WRITE,
740           HFA384x_RID_CNFSUPPRATES, 0, 0,
741           prism2mib_uint32 },
742
743     /* p2Dynamic MIB's */
744
745     { DIDmib_p2_p2Dynamic_p2CreateIBSS,
746           F_STA | F_READ | F_WRITE,
747           HFA384x_RID_CREATEIBSS, 0, 0,
748           prism2mib_truth },
749     { DIDmib_p2_p2Dynamic_p2FragmentationThreshold,
750           F_STA | F_READ | F_WRITE,
751           HFA384x_RID_FRAGTHRESH, 0, 0,
752           prism2mib_fragmentationthreshold },
753     { DIDmib_p2_p2Dynamic_p2RTSThreshold,
754           F_STA | F_READ | F_WRITE,
755           HFA384x_RID_RTSTHRESH, 0, 0,
756           prism2mib_uint32 },
757     { DIDmib_p2_p2Dynamic_p2TxRateControl,
758           F_STA | F_READ | F_WRITE,
759           HFA384x_RID_TXRATECNTL, 0, 0,
760           prism2mib_uint32 },
761     { DIDmib_p2_p2Dynamic_p2PromiscuousMode,
762           F_STA | F_READ | F_WRITE,
763           HFA384x_RID_PROMISCMODE, 0, 0,
764           prism2mib_truth },
765
766     /* p2Behavior MIB's */
767
768     { DIDmib_p2_p2Behavior_p2TickTime,
769           F_STA | F_READ | F_WRITE,
770           HFA384x_RID_ITICKTIME, 0, 0,
771           prism2mib_uint32 },
772
773     /* p2NIC MIB's */
774
775     { DIDmib_p2_p2NIC_p2MaxLoadTime,
776           F_STA | F_READ,
777           HFA384x_RID_MAXLOADTIME, 0, 0,
778           prism2mib_uint32 },
779     { DIDmib_p2_p2NIC_p2DLBufferPage,
780           F_STA | F_READ,
781           HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 0,
782           prism2mib_uint32offset },
783     { DIDmib_p2_p2NIC_p2DLBufferOffset,
784           F_STA | F_READ,
785           HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 1,
786           prism2mib_uint32offset },
787     { DIDmib_p2_p2NIC_p2DLBufferLength,
788           F_STA | F_READ,
789           HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 2,
790           prism2mib_uint32offset },
791     { DIDmib_p2_p2NIC_p2PRIIdentity,
792           F_STA | F_READ,
793           HFA384x_RID_PRIIDENTITY, HFA384x_RID_PRIIDENTITY_LEN, 0,
794           prism2mib_uint32array },
795     { DIDmib_p2_p2NIC_p2PRISupRange,
796           F_STA | F_READ,
797           HFA384x_RID_PRISUPRANGE, HFA384x_RID_PRISUPRANGE_LEN, 0,
798           prism2mib_uint32array },
799     { DIDmib_p2_p2NIC_p2CFIActRanges,
800           F_STA | F_READ,
801           HFA384x_RID_PRI_CFIACTRANGES, HFA384x_RID_CFIACTRANGES_LEN, 0,
802           prism2mib_uint32array },
803     { DIDmib_p2_p2NIC_p2BuildSequence,
804           F_STA | F_READ,
805           HFA384x_RID_BUILDSEQ, HFA384x_RID_BUILDSEQ_LEN, 0,
806           prism2mib_uint32array },
807     { DIDmib_p2_p2NIC_p2PrimaryFWID,
808           F_STA | F_READ,
809           0, 0, 0,
810           prism2mib_fwid },
811     { DIDmib_p2_p2NIC_p2SecondaryFWID,
812           F_STA | F_READ,
813           0, 0, 0,
814           prism2mib_fwid },
815     { DIDmib_p2_p2NIC_p2NICSerialNumber,
816           F_STA | F_READ,
817           HFA384x_RID_NICSERIALNUMBER, HFA384x_RID_NICSERIALNUMBER_LEN, 0,
818           prism2mib_bytearea2pstr },
819     { DIDmib_p2_p2NIC_p2NICIdentity,
820           F_STA | F_READ,
821           HFA384x_RID_NICIDENTITY, HFA384x_RID_NICIDENTITY_LEN, 0,
822           prism2mib_uint32array },
823     { DIDmib_p2_p2NIC_p2MFISupRange,
824           F_STA | F_READ,
825           HFA384x_RID_MFISUPRANGE, HFA384x_RID_MFISUPRANGE_LEN, 0,
826           prism2mib_uint32array },
827     { DIDmib_p2_p2NIC_p2CFISupRange,
828           F_STA | F_READ,
829           HFA384x_RID_CFISUPRANGE, HFA384x_RID_CFISUPRANGE_LEN, 0,
830           prism2mib_uint32array },
831     { DIDmib_p2_p2NIC_p2ChannelList,
832           F_STA | F_READ,
833           HFA384x_RID_CHANNELLIST, 0, 0,
834           prism2mib_uint32 },
835     { DIDmib_p2_p2NIC_p2RegulatoryDomains,
836           F_STA | F_READ,
837           HFA384x_RID_REGULATORYDOMAINS, HFA384x_RID_REGULATORYDOMAINS_LEN, 0,
838           prism2mib_regulatorydomains },
839     { DIDmib_p2_p2NIC_p2TempType,
840           F_STA | F_READ,
841           HFA384x_RID_TEMPTYPE, 0, 0,
842           prism2mib_uint32 },
843     { DIDmib_p2_p2NIC_p2STAIdentity,
844           F_STA | F_READ,
845           HFA384x_RID_STAIDENTITY, HFA384x_RID_STAIDENTITY_LEN, 0,
846           prism2mib_uint32array },
847     { DIDmib_p2_p2NIC_p2STASupRange,
848           F_STA | F_READ,
849           HFA384x_RID_STASUPRANGE, HFA384x_RID_STASUPRANGE_LEN, 0,
850           prism2mib_uint32array },
851     { DIDmib_p2_p2NIC_p2MFIActRanges,
852           F_STA | F_READ,
853           HFA384x_RID_STA_MFIACTRANGES, HFA384x_RID_MFIACTRANGES_LEN, 0,
854           prism2mib_uint32array },
855     { DIDmib_p2_p2NIC_p2STACFIActRanges,
856           F_STA | F_READ,
857           HFA384x_RID_STA_CFIACTRANGES, HFA384x_RID_CFIACTRANGES2_LEN, 0,
858           prism2mib_uint32array },
859
860     /* p2MAC MIB's */
861
862     { DIDmib_p2_p2MAC_p2PortStatus,
863           F_STA | F_READ,
864           HFA384x_RID_PORTSTATUS, 0, 0,
865           prism2mib_uint32 },
866     { DIDmib_p2_p2MAC_p2CurrentSSID,
867           F_STA | F_READ,
868           HFA384x_RID_CURRENTSSID, HFA384x_RID_CURRENTSSID_LEN, 0,
869           prism2mib_bytestr2pstr },
870     { DIDmib_p2_p2MAC_p2CurrentBSSID,
871           F_STA | F_READ,
872           HFA384x_RID_CURRENTBSSID, HFA384x_RID_CURRENTBSSID_LEN, 0,
873           prism2mib_bytearea2pstr },
874     { DIDmib_p2_p2MAC_p2CommsQuality,
875           F_STA | F_READ,
876           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
877           prism2mib_uint32array },
878     { DIDmib_p2_p2MAC_p2CommsQualityCQ,
879           F_STA | F_READ,
880           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
881           prism2mib_uint32offset },
882     { DIDmib_p2_p2MAC_p2CommsQualityASL,
883           F_STA | F_READ,
884           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 1,
885           prism2mib_uint32offset },
886     { DIDmib_p2_p2MAC_p2CommsQualityANL,
887           F_STA | F_READ,
888           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 2,
889           prism2mib_uint32offset },
890     { DIDmib_p2_p2MAC_p2dbmCommsQuality,
891           F_STA | F_READ,
892           HFA384x_RID_DBMCOMMSQUALITY, HFA384x_RID_DBMCOMMSQUALITY_LEN, 0,
893           prism2mib_uint32array },
894     { DIDmib_p2_p2MAC_p2dbmCommsQualityCQ,
895           F_STA | F_READ,
896           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
897           prism2mib_uint32offset },
898     { DIDmib_p2_p2MAC_p2dbmCommsQualityASL,
899           F_STA | F_READ,
900           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 1,
901           prism2mib_uint32offset },
902     { DIDmib_p2_p2MAC_p2dbmCommsQualityANL,
903           F_STA | F_READ,
904           HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 2,
905           prism2mib_uint32offset },
906     { DIDmib_p2_p2MAC_p2CurrentTxRate,
907           F_STA | F_READ,
908           HFA384x_RID_CURRENTTXRATE, 0, 0,
909           prism2mib_uint32 },
910     { DIDmib_p2_p2MAC_p2CurrentBeaconInterval,
911           F_STA | F_READ,
912           HFA384x_RID_CURRENTBCNint, 0, 0,
913           prism2mib_uint32 },
914     { DIDmib_p2_p2MAC_p2StaCurrentScaleThresholds,
915           F_STA | F_READ,
916           HFA384x_RID_CURRENTSCALETHRESH, HFA384x_RID_STACURSCALETHRESH_LEN, 0,
917           prism2mib_uint32array },
918     { DIDmib_p2_p2MAC_p2ProtocolRspTime,
919           F_STA | F_READ,
920           HFA384x_RID_PROTOCOLRSPTIME, 0, 0,
921           prism2mib_uint32 },
922     { DIDmib_p2_p2MAC_p2ShortRetryLimit,
923           F_STA | F_READ,
924           HFA384x_RID_SHORTRETRYLIMIT, 0, 0,
925           prism2mib_uint32 },
926     { DIDmib_p2_p2MAC_p2LongRetryLimit,
927           F_STA | F_READ,
928           HFA384x_RID_LONGRETRYLIMIT, 0, 0,
929           prism2mib_uint32 },
930     { DIDmib_p2_p2MAC_p2MaxTransmitLifetime,
931           F_STA | F_READ,
932           HFA384x_RID_MAXTXLIFETIME, 0, 0,
933           prism2mib_uint32 },
934     { DIDmib_p2_p2MAC_p2MaxReceiveLifetime,
935           F_STA | F_READ,
936           HFA384x_RID_MAXRXLIFETIME, 0, 0,
937           prism2mib_uint32 },
938     { DIDmib_p2_p2MAC_p2CFPollable,
939           F_STA | F_READ,
940           HFA384x_RID_CFPOLLABLE, 0, 0,
941           prism2mib_uint32 },
942     { DIDmib_p2_p2MAC_p2AuthenticationAlgorithms,
943           F_STA | F_READ,
944           HFA384x_RID_AUTHALGORITHMS, HFA384x_RID_AUTHALGORITHMS_LEN, 0,
945           prism2mib_uint32array },
946     { DIDmib_p2_p2MAC_p2PrivacyOptionImplemented,
947           F_STA | F_READ,
948           HFA384x_RID_PRIVACYOPTIMP, 0, 0,
949           prism2mib_uint32 },
950
951     /* p2Modem MIB's */
952
953     { DIDmib_p2_p2Modem_p2PHYType,
954           F_STA | F_READ,
955           HFA384x_RID_PHYTYPE, 0, 0,
956           prism2mib_uint32 },
957     { DIDmib_p2_p2Modem_p2CurrentChannel,
958           F_STA | F_READ,
959           HFA384x_RID_CURRENTCHANNEL, 0, 0,
960           prism2mib_uint32 },
961     { DIDmib_p2_p2Modem_p2CurrentPowerState,
962           F_STA | F_READ,
963           HFA384x_RID_CURRENTPOWERSTATE, 0, 0,
964           prism2mib_uint32 },
965     { DIDmib_p2_p2Modem_p2CCAMode,
966           F_STA | F_READ,
967           HFA384x_RID_CCAMODE, 0, 0,
968           prism2mib_uint32 },
969     { DIDmib_p2_p2Modem_p2TxPowerMax,
970           F_STA | F_READ | F_WRITE,
971           HFA384x_RID_TXPOWERMAX, 0, 0,
972           prism2mib_uint32 },
973     { DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel,
974           F_STA | F_READ | F_WRITE,
975           HFA384x_RID_TXPOWERMAX, 0, 0,
976           prism2mib_uint32 },
977     { DIDmib_p2_p2Modem_p2SupportedDataRates,
978           F_STA | F_READ,
979           HFA384x_RID_SUPPORTEDDATARATES, HFA384x_RID_SUPPORTEDDATARATES_LEN, 0,
980           prism2mib_bytestr2pstr },
981
982     /* And finally, lnx mibs */
983     { DIDmib_lnx_lnxConfigTable_lnxRSNAIE,
984           F_STA | F_READ | F_WRITE,
985           HFA384x_RID_CNFWPADATA, 0, 0,
986           prism2mib_priv },
987     { 0, 0, 0, 0, 0, NULL}};
988
989 /*----------------------------------------------------------------
990 These MIB's are not supported at this time:
991
992 DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityPresent
993 DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityEnabled
994 DIDmib_dot11phy_dot11PhyDSSSTable_dot11PBCCOptionImplemented
995 DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportIndex
996 DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxIndex
997 DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxValue
998 DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxIndex
999 DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxValue
1000
1001 DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportValue
1002 TODO: need to investigate why wlan has this as enumerated and Prism2 has this
1003       as btye str.
1004
1005 DIDmib_dot11phy_dot11PhyDSSSTable_dot11ShortPreambleOptionImplemented
1006 TODO: Find out the firmware version number(s) for identifying
1007       whether the firmware is capable of short preamble. TRUE or FALSE
1008       will be returned based on the version of the firmware.
1009
1010 WEP Key mappings aren't supported in the f/w.
1011 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingIndex
1012 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingAddress
1013 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingWEPOn
1014 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingValue
1015 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPKeyMappingLength
1016
1017 TODO: implement counters.
1018 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPICVErrorCount
1019 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPExcludedCount
1020 DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFragmentCount
1021 DIDmib_dot11mac_dot11CountersTable_dot11MulticastTransmittedFrameCount
1022 DIDmib_dot11mac_dot11CountersTable_dot11FailedCount
1023 DIDmib_dot11mac_dot11CountersTable_dot11RetryCount
1024 DIDmib_dot11mac_dot11CountersTable_dot11MultipleRetryCount
1025 DIDmib_dot11mac_dot11CountersTable_dot11FrameDuplicateCount
1026 DIDmib_dot11mac_dot11CountersTable_dot11RTSSuccessCount
1027 DIDmib_dot11mac_dot11CountersTable_dot11RTSFailureCount
1028 DIDmib_dot11mac_dot11CountersTable_dot11ACKFailureCount
1029 DIDmib_dot11mac_dot11CountersTable_dot11ReceivedFragmentCount
1030 DIDmib_dot11mac_dot11CountersTable_dot11MulticastReceivedFrameCount
1031 DIDmib_dot11mac_dot11CountersTable_dot11FCSErrorCount
1032 DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFrameCount
1033 DIDmib_dot11mac_dot11CountersTable_dot11WEPUndecryptableCount
1034
1035 TODO: implement sane values for these.
1036 DIDmib_dot11mac_dot11OperationTable_dot11ManufacturerID
1037 DIDmib_dot11mac_dot11OperationTable_dot11ProductID
1038
1039 Not too worried about these at the moment.
1040 DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentTxAntenna
1041 DIDmib_dot11phy_dot11PhyAntennaTable_dot11DiversitySupport
1042 DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentRxAntenna
1043 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11NumberSupportedPowerLevels
1044 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel1
1045 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel2
1046 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel3
1047 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel4
1048 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel5
1049 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel6
1050 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel7
1051 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel8
1052 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel
1053
1054 Ummm, FH and IR don't apply
1055 DIDmib_dot11phy_dot11PhyFHSSTable_dot11HopTime
1056 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentChannelNumber
1057 DIDmib_dot11phy_dot11PhyFHSSTable_dot11MaxDwellTime
1058 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentDwellTime
1059 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentSet
1060 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentPattern
1061 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentIndex
1062 DIDmib_dot11phy_dot11PhyDSSSTable_dot11CCAModeSupported
1063 DIDmib_dot11phy_dot11PhyDSSSTable_dot11EDThreshold
1064 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMax
1065 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMax
1066 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMin
1067 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMin
1068
1069 We just don't have enough antennas right now to worry about this.
1070 DIDmib_dot11phy_dot11AntennasListTable_dot11AntennaListIndex
1071 DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedTxAntenna
1072 DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedRxAntenna
1073 DIDmib_dot11phy_dot11AntennasListTable_dot11DiversitySelectionRx
1074
1075 ------------------------------------------------------------------*/
1076
1077 /*================================================================*/
1078 /* Function Definitions */
1079
1080 /*----------------------------------------------------------------
1081 * prism2mgmt_mibset_mibget
1082 *
1083 * Set the value of a mib item.
1084 *
1085 * Arguments:
1086 *       wlandev         wlan device structure
1087 *       msgp            ptr to msg buffer
1088 *
1089 * Returns:
1090 *       0       success and done
1091 *       <0      success, but we're waiting for something to finish.
1092 *       >0      an error occurred while handling the message.
1093 * Side effects:
1094 *
1095 * Call context:
1096 *       process thread  (usually)
1097 *       interrupt
1098 ----------------------------------------------------------------*/
1099
1100 int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp)
1101 {
1102         hfa384x_t               *hw = wlandev->priv;
1103         int                     result, isget;
1104         mibrec_t                *mib;
1105
1106         u16                     which;
1107
1108         p80211msg_dot11req_mibset_t     *msg = msgp;
1109         p80211itemd_t                   *mibitem;
1110
1111         DBFENTER;
1112
1113         msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
1114         msg->resultcode.data = P80211ENUM_resultcode_success;
1115
1116         /*
1117         ** Determine if this is an Access Point or a station.
1118         */
1119
1120         which = F_STA;
1121
1122         /*
1123         ** Find the MIB in the MIB table.  Note that a MIB may be in the
1124         ** table twice...once for an AP and once for a station.  Make sure
1125         ** to get the correct one.  Note that DID=0 marks the end of the
1126         ** MIB table.
1127         */
1128
1129         mibitem = (p80211itemd_t *) msg->mibattribute.data;
1130
1131         for (mib = mibtab; mib->did != 0; mib++)
1132                 if (mib->did == mibitem->did && (mib->flag & which))
1133                         break;
1134
1135         if (mib->did == 0) {
1136                 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
1137                 goto done;
1138         }
1139
1140         /*
1141         ** Determine if this is a "mibget" or a "mibset".  If this is a
1142         ** "mibget", then make sure that the MIB may be read.  Otherwise,
1143         ** this is a "mibset" so make make sure that the MIB may be written.
1144         */
1145
1146         isget = (msg->msgcode == DIDmsg_dot11req_mibget);
1147
1148         if (isget) {
1149                 if (!(mib->flag & F_READ)) {
1150                         msg->resultcode.data =
1151                                 P80211ENUM_resultcode_cant_get_writeonly_mib;
1152                         goto done;
1153                 }
1154         } else {
1155                 if (!(mib->flag & F_WRITE)) {
1156                         msg->resultcode.data =
1157                                 P80211ENUM_resultcode_cant_set_readonly_mib;
1158                         goto done;
1159                 }
1160         }
1161
1162         /*
1163         ** Execute the MIB function.  If things worked okay, then make
1164         ** sure that the MIB function also worked okay.  If so, and this
1165         ** is a "mibget", then the status value must be set for both the
1166         ** "mibattribute" parameter and the mib item within the data
1167         ** portion of the "mibattribute".
1168         */
1169
1170         result = mib->func(mib, isget, wlandev, hw, msg,
1171                            (void *) mibitem->data);
1172
1173         if (msg->resultcode.data == P80211ENUM_resultcode_success) {
1174                 if (result != 0) {
1175                         WLAN_LOG_DEBUG(1, "get/set failure, result=%d\n",
1176                                         result);
1177                         msg->resultcode.data =
1178                                  P80211ENUM_resultcode_implementation_failure;
1179                 } else {
1180                         if (isget) {
1181                                 msg->mibattribute.status =
1182                                         P80211ENUM_msgitem_status_data_ok;
1183                                 mibitem->status =
1184                                         P80211ENUM_msgitem_status_data_ok;
1185                         }
1186                 }
1187         }
1188
1189 done:
1190         DBFEXIT;
1191
1192         return(0);
1193 }
1194
1195 /*----------------------------------------------------------------
1196 * prism2mib_bytestr2pstr
1197 *
1198 * Get/set pstr data to/from a byte string.
1199 *
1200 * MIB record parameters:
1201 *       parm1    Prism2 RID value.
1202 *       parm2    Number of bytes of RID data.
1203 *       parm3    Not used.
1204 *
1205 * Arguments:
1206 *       mib      MIB record.
1207 *       isget    MIBGET/MIBSET flag.
1208 *       wlandev  wlan device structure.
1209 *       priv     "priv" structure.
1210 *       hw       "hw" structure.
1211 *       msg      Message structure.
1212 *       data     Data buffer.
1213 *
1214 * Returns:
1215 *       0   - Success.
1216 *       ~0  - Error.
1217 *
1218 ----------------------------------------------------------------*/
1219
1220 static int prism2mib_bytestr2pstr(
1221 mibrec_t                     *mib,
1222 int                          isget,
1223 wlandevice_t                 *wlandev,
1224 hfa384x_t                    *hw,
1225 p80211msg_dot11req_mibset_t  *msg,
1226 void                         *data)
1227 {
1228         int                result;
1229         p80211pstrd_t      *pstr = (p80211pstrd_t*) data;
1230         u8              bytebuf[MIB_TMP_MAXLEN];
1231         hfa384x_bytestr_t  *p2bytestr = (hfa384x_bytestr_t*) bytebuf;
1232
1233         DBFENTER;
1234
1235         if (isget) {
1236                 result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2);
1237                 prism2mgmt_bytestr2pstr(p2bytestr, pstr);
1238         } else {
1239                 memset(bytebuf, 0, mib->parm2);
1240                 prism2mgmt_pstr2bytestr(p2bytestr, pstr);
1241                 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
1242         }
1243
1244         DBFEXIT;
1245         return(result);
1246 }
1247
1248 /*----------------------------------------------------------------
1249 * prism2mib_bytearea2pstr
1250 *
1251 * Get/set pstr data to/from a byte area.
1252 *
1253 * MIB record parameters:
1254 *       parm1    Prism2 RID value.
1255 *       parm2    Number of bytes of RID data.
1256 *       parm3    Not used.
1257 *
1258 * Arguments:
1259 *       mib      MIB record.
1260 *       isget    MIBGET/MIBSET flag.
1261 *       wlandev  wlan device structure.
1262 *       priv     "priv" structure.
1263 *       hw       "hw" structure.
1264 *       msg      Message structure.
1265 *       data     Data buffer.
1266 *
1267 * Returns:
1268 *       0   - Success.
1269 *       ~0  - Error.
1270 *
1271 ----------------------------------------------------------------*/
1272
1273 static int prism2mib_bytearea2pstr(
1274 mibrec_t                     *mib,
1275 int                          isget,
1276 wlandevice_t                 *wlandev,
1277 hfa384x_t                    *hw,
1278 p80211msg_dot11req_mibset_t  *msg,
1279 void                         *data)
1280 {
1281         int            result;
1282         p80211pstrd_t  *pstr = (p80211pstrd_t*) data;
1283         u8          bytebuf[MIB_TMP_MAXLEN];
1284
1285         DBFENTER;
1286
1287         if (isget) {
1288                 result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2);
1289                 prism2mgmt_bytearea2pstr(bytebuf, pstr, mib->parm2);
1290         } else {
1291                 memset(bytebuf, 0, mib->parm2);
1292                 prism2mgmt_pstr2bytearea(bytebuf, pstr);
1293                 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
1294         }
1295
1296         DBFEXIT;
1297         return(result);
1298 }
1299
1300 /*----------------------------------------------------------------
1301 * prism2mib_uint32
1302 *
1303 * Get/set uint32 data.
1304 *
1305 * MIB record parameters:
1306 *       parm1    Prism2 RID value.
1307 *       parm2    Not used.
1308 *       parm3    Not used.
1309 *
1310 * Arguments:
1311 *       mib      MIB record.
1312 *       isget    MIBGET/MIBSET flag.
1313 *       wlandev  wlan device structure.
1314 *       priv     "priv" structure.
1315 *       hw       "hw" structure.
1316 *       msg      Message structure.
1317 *       data     Data buffer.
1318 *
1319 * Returns:
1320 *       0   - Success.
1321 *       ~0  - Error.
1322 *
1323 ----------------------------------------------------------------*/
1324
1325 static int prism2mib_uint32(
1326 mibrec_t                     *mib,
1327 int                          isget,
1328 wlandevice_t                 *wlandev,
1329 hfa384x_t                    *hw,
1330 p80211msg_dot11req_mibset_t  *msg,
1331 void                         *data)
1332 {
1333         int     result;
1334         u32  *uint32 = (u32*) data;
1335         u8   bytebuf[MIB_TMP_MAXLEN];
1336         u16  *wordbuf = (u16*) bytebuf;
1337
1338         DBFENTER;
1339
1340         if (isget) {
1341                 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1342                 *uint32 = *wordbuf;
1343                 /* [MSM] Removed, getconfig16 returns the value in host order.
1344                  * prism2mgmt_prism2int2p80211int(wordbuf, uint32);
1345                  */
1346         } else {
1347                 /* [MSM] Removed, setconfig16 expects host order.
1348                  * prism2mgmt_p80211int2prism2int(wordbuf, uint32);
1349                  */
1350                 *wordbuf = *uint32;
1351                 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1352         }
1353
1354         DBFEXIT;
1355         return(result);
1356 }
1357
1358 /*----------------------------------------------------------------
1359 * prism2mib_uint32array
1360 *
1361 * Get/set an array of uint32 data.
1362 *
1363 * MIB record parameters:
1364 *       parm1    Prism2 RID value.
1365 *       parm2    Number of bytes of RID data.
1366 *       parm3    Not used.
1367 *
1368 * Arguments:
1369 *       mib      MIB record.
1370 *       isget    MIBGET/MIBSET flag.
1371 *       wlandev  wlan device structure.
1372 *       priv     "priv" structure.
1373 *       hw       "hw" structure.
1374 *       msg      Message structure.
1375 *       data     Data buffer.
1376 *
1377 * Returns:
1378 *       0   - Success.
1379 *       ~0  - Error.
1380 *
1381 ----------------------------------------------------------------*/
1382
1383 static int prism2mib_uint32array(
1384 mibrec_t                     *mib,
1385 int                          isget,
1386 wlandevice_t                 *wlandev,
1387 hfa384x_t                    *hw,
1388 p80211msg_dot11req_mibset_t  *msg,
1389 void                         *data)
1390 {
1391         int     result;
1392         u32  *uint32 = (u32 *) data;
1393         u8   bytebuf[MIB_TMP_MAXLEN];
1394         u16  *wordbuf = (u16*) bytebuf;
1395         int     i, cnt;
1396
1397         DBFENTER;
1398
1399         cnt = mib->parm2 / sizeof(u16);
1400
1401         if (isget) {
1402                 result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
1403                 for (i = 0; i < cnt; i++)
1404                         prism2mgmt_prism2int2p80211int(wordbuf+i, uint32+i);
1405         } else {
1406                 for (i = 0; i < cnt; i++)
1407                         prism2mgmt_p80211int2prism2int(wordbuf+i, uint32+i);
1408                 result = hfa384x_drvr_setconfig(hw, mib->parm1, wordbuf, mib->parm2);
1409                 }
1410
1411         DBFEXIT;
1412         return(result);
1413 }
1414
1415 /*----------------------------------------------------------------
1416 * prism2mib_uint32offset
1417 *
1418 * Get/set a single element in an array of uint32 data.
1419 *
1420 * MIB record parameters:
1421 *       parm1    Prism2 RID value.
1422 *       parm2    Number of bytes of RID data.
1423 *       parm3    Element index.
1424 *
1425 * Arguments:
1426 *       mib      MIB record.
1427 *       isget    MIBGET/MIBSET flag.
1428 *       wlandev  wlan device structure.
1429 *       priv     "priv" structure.
1430 *       hw       "hw" structure.
1431 *       msg      Message structure.
1432 *       data     Data buffer.
1433 *
1434 * Returns:
1435 *       0   - Success.
1436 *       ~0  - Error.
1437 *
1438 ----------------------------------------------------------------*/
1439
1440 static int prism2mib_uint32offset(
1441 mibrec_t                     *mib,
1442 int                          isget,
1443 wlandevice_t                 *wlandev,
1444 hfa384x_t                    *hw,
1445 p80211msg_dot11req_mibset_t  *msg,
1446 void                         *data)
1447 {
1448         int     result;
1449         u32  *uint32 = (u32*) data;
1450         u8   bytebuf[MIB_TMP_MAXLEN];
1451         u16  *wordbuf = (u16*) bytebuf;
1452         u16  cnt;
1453
1454         DBFENTER;
1455
1456         cnt = mib->parm2 / sizeof(u16);
1457
1458         result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
1459         if (result == 0) {
1460                 if (isget) {
1461                         if (mib->parm3 < cnt)
1462                                 prism2mgmt_prism2int2p80211int(wordbuf+mib->parm3, uint32);
1463                         else
1464                                 *uint32 = 0;
1465                 } else {
1466                         if (mib->parm3 < cnt) {
1467                                 prism2mgmt_p80211int2prism2int(wordbuf+mib->parm3, uint32);
1468                                 result = hfa384x_drvr_setconfig(hw, mib->parm1, wordbuf, mib->parm2);
1469                         }
1470                 }
1471         }
1472
1473         DBFEXIT;
1474         return(result);
1475 }
1476
1477 /*----------------------------------------------------------------
1478 * prism2mib_truth
1479 *
1480 * Get/set truth data.
1481 *
1482 * MIB record parameters:
1483 *       parm1    Prism2 RID value.
1484 *       parm2    Not used.
1485 *       parm3    Not used.
1486 *
1487 * Arguments:
1488 *       mib      MIB record.
1489 *       isget    MIBGET/MIBSET flag.
1490 *       wlandev  wlan device structure.
1491 *       priv     "priv" structure.
1492 *       hw       "hw" structure.
1493 *       msg      Message structure.
1494 *       data     Data buffer.
1495 *
1496 * Returns:
1497 *       0   - Success.
1498 *       ~0  - Error.
1499 *
1500 ----------------------------------------------------------------*/
1501
1502 static int prism2mib_truth(
1503 mibrec_t                     *mib,
1504 int                          isget,
1505 wlandevice_t                 *wlandev,
1506 hfa384x_t                    *hw,
1507 p80211msg_dot11req_mibset_t  *msg,
1508 void                         *data)
1509 {
1510         int     result;
1511         u32  *uint32 = (u32*) data;
1512         u8   bytebuf[MIB_TMP_MAXLEN];
1513         u16  *wordbuf = (u16*) bytebuf;
1514
1515         DBFENTER;
1516
1517         if (isget) {
1518                 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1519                 *uint32 = (*wordbuf) ?
1520                                 P80211ENUM_truth_true : P80211ENUM_truth_false;
1521         } else {
1522                 *wordbuf = ((*uint32) == P80211ENUM_truth_true) ? 1 : 0;
1523                 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1524         }
1525
1526         DBFEXIT;
1527         return(result);
1528 }
1529
1530 /*----------------------------------------------------------------
1531 * prism2mib_flag
1532 *
1533 * Get/set a flag.
1534 *
1535 * MIB record parameters:
1536 *       parm1    Prism2 RID value.
1537 *       parm2    Bit to get/set.
1538 *       parm3    Not used.
1539 *
1540 * Arguments:
1541 *       mib      MIB record.
1542 *       isget    MIBGET/MIBSET flag.
1543 *       wlandev  wlan device structure.
1544 *       priv     "priv" structure.
1545 *       hw       "hw" structure.
1546 *       msg      Message structure.
1547 *       data     Data buffer.
1548 *
1549 * Returns:
1550 *       0   - Success.
1551 *       ~0  - Error.
1552 *
1553 ----------------------------------------------------------------*/
1554
1555 static int prism2mib_flag(
1556 mibrec_t                     *mib,
1557 int                          isget,
1558 wlandevice_t                 *wlandev,
1559 hfa384x_t                    *hw,
1560 p80211msg_dot11req_mibset_t  *msg,
1561 void                         *data)
1562 {
1563         int     result;
1564         u32  *uint32 = (u32*) data;
1565         u8   bytebuf[MIB_TMP_MAXLEN];
1566         u16  *wordbuf = (u16*) bytebuf;
1567         u32  flags;
1568
1569         DBFENTER;
1570
1571         result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1572         if (result == 0) {
1573                 /* [MSM] Removed, getconfig16 returns the value in host order.
1574                  * prism2mgmt_prism2int2p80211int(wordbuf, &flags);
1575                  */
1576                 flags = *wordbuf;
1577                 if (isget) {
1578                         *uint32 = (flags & mib->parm2) ?
1579                                 P80211ENUM_truth_true : P80211ENUM_truth_false;
1580                 } else {
1581                         if ((*uint32) == P80211ENUM_truth_true)
1582                                 flags |= mib->parm2;
1583                         else
1584                                 flags &= ~mib->parm2;
1585                         /* [MSM] Removed, setconfig16 expects host order.
1586                          * prism2mgmt_p80211int2prism2int(wordbuf, &flags);
1587                          */
1588                         *wordbuf = flags;
1589                         result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1590                 }
1591         }
1592
1593         DBFEXIT;
1594         return(result);
1595 }
1596
1597 /*----------------------------------------------------------------
1598 * prism2mib_regulatorydomains
1599 *
1600 * Get regulatory domain data.
1601 *
1602 * MIB record parameters:
1603 *       parm1    Prism2 RID value.
1604 *       parm2    Number of bytes of RID data.
1605 *       parm3    Not used.
1606 *
1607 * Arguments:
1608 *       mib      MIB record.
1609 *       isget    MIBGET/MIBSET flag.
1610 *       wlandev  wlan device structure.
1611 *       priv     "priv" structure.
1612 *       hw       "hw" structure.
1613 *       msg      Message structure.
1614 *       data     Data buffer.
1615 *
1616 * Returns:
1617 *       0   - Success.
1618 *       ~0  - Error.
1619 *
1620 ----------------------------------------------------------------*/
1621
1622 static int prism2mib_regulatorydomains(
1623 mibrec_t                     *mib,
1624 int                          isget,
1625 wlandevice_t                 *wlandev,
1626 hfa384x_t                    *hw,
1627 p80211msg_dot11req_mibset_t  *msg,
1628 void                         *data)
1629 {
1630         int            result;
1631         u32         cnt;
1632         p80211pstrd_t  *pstr = (p80211pstrd_t*) data;
1633         u8          bytebuf[MIB_TMP_MAXLEN];
1634         u16         *wordbuf = (u16*) bytebuf;
1635
1636         DBFENTER;
1637
1638         result = 0;
1639
1640         if (isget) {
1641                 result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
1642                 prism2mgmt_prism2int2p80211int(wordbuf, &cnt);
1643                 pstr->len = (u8) cnt;
1644                 memcpy(pstr->data, &wordbuf[1], pstr->len);
1645         }
1646
1647         DBFEXIT;
1648         return(result);
1649 }
1650
1651 /*----------------------------------------------------------------
1652 * prism2mib_wepdefaultkey
1653 *
1654 * Get/set WEP default keys.
1655 *
1656 * MIB record parameters:
1657 *       parm1    Prism2 RID value.
1658 *       parm2    Number of bytes of RID data.
1659 *       parm3    Not used.
1660 *
1661 * Arguments:
1662 *       mib      MIB record.
1663 *       isget    MIBGET/MIBSET flag.
1664 *       wlandev  wlan device structure.
1665 *       priv     "priv" structure.
1666 *       hw       "hw" structure.
1667 *       msg      Message structure.
1668 *       data     Data buffer.
1669 *
1670 * Returns:
1671 *       0   - Success.
1672 *       ~0  - Error.
1673 *
1674 ----------------------------------------------------------------*/
1675
1676 static int prism2mib_wepdefaultkey(
1677 mibrec_t                     *mib,
1678 int                          isget,
1679 wlandevice_t                 *wlandev,
1680 hfa384x_t                    *hw,
1681 p80211msg_dot11req_mibset_t  *msg,
1682 void                         *data)
1683 {
1684         int            result;
1685         p80211pstrd_t  *pstr = (p80211pstrd_t*) data;
1686         u8          bytebuf[MIB_TMP_MAXLEN];
1687         u16         len;
1688
1689         DBFENTER;
1690
1691         if (isget) {
1692                 result = 0;    /* Should never happen. */
1693         } else {
1694                 len = (pstr->len > 5) ? HFA384x_RID_CNFWEP128DEFAULTKEY_LEN :
1695                                         HFA384x_RID_CNFWEPDEFAULTKEY_LEN;
1696                 memset(bytebuf, 0, len);
1697                 prism2mgmt_pstr2bytearea(bytebuf, pstr);
1698                 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, len);
1699         }
1700
1701         DBFEXIT;
1702         return(result);
1703 }
1704
1705 /*----------------------------------------------------------------
1706 * prism2mib_powermanagement
1707 *
1708 * Get/set 802.11 power management value.  Note that this is defined differently
1709 * by 802.11 and Prism2:
1710 *
1711 *       Meaning     802.11       Prism2
1712 *        active       1           false
1713 *      powersave      2           true
1714 *
1715 * MIB record parameters:
1716 *       parm1    Prism2 RID value.
1717 *       parm2    Not used.
1718 *       parm3    Not used.
1719 *
1720 * Arguments:
1721 *       mib      MIB record.
1722 *       isget    MIBGET/MIBSET flag.
1723 *       wlandev  wlan device structure.
1724 *       priv     "priv" structure.
1725 *       hw       "hw" structure.
1726 *       msg      Message structure.
1727 *       data     Data buffer.
1728 *
1729 * Returns:
1730 *       0   - Success.
1731 *       ~0  - Error.
1732 *
1733 ----------------------------------------------------------------*/
1734
1735 static int prism2mib_powermanagement(
1736 mibrec_t                     *mib,
1737 int                          isget,
1738 wlandevice_t                 *wlandev,
1739 hfa384x_t                    *hw,
1740 p80211msg_dot11req_mibset_t  *msg,
1741 void                         *data)
1742 {
1743         int     result;
1744         u32  *uint32 = (u32*) data;
1745         u32  value;
1746
1747         DBFENTER;
1748
1749         if (isget) {
1750                 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value);
1751                 *uint32 = (value == 0) ? 1 : 2;
1752         } else {
1753                 value = ((*uint32) == 1) ? 0 : 1;
1754                 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value);
1755         }
1756
1757         DBFEXIT;
1758         return(result);
1759 }
1760
1761 /*----------------------------------------------------------------
1762 * prism2mib_preamble
1763 *
1764 * Get/set Prism2 short preamble
1765 *
1766 * MIB record parameters:
1767 *       parm1    Prism2 RID value.
1768 *       parm2    Not used.
1769 *       parm3    Not used.
1770 *
1771 * Arguments:
1772 *       mib      MIB record.
1773 *       isget    MIBGET/MIBSET flag.
1774 *       wlandev  wlan device structure.
1775 *       priv     "priv" structure.
1776 *       hw       "hw" structure.
1777 *       msg      Message structure.
1778 *       data     Data buffer.
1779 *
1780 * Returns:
1781 *       0   - Success.
1782 *       ~0  - Error.
1783 *
1784 ----------------------------------------------------------------*/
1785
1786 static int prism2mib_preamble(
1787 mibrec_t                     *mib,
1788 int                          isget,
1789 wlandevice_t                 *wlandev,
1790 hfa384x_t                    *hw,
1791 p80211msg_dot11req_mibset_t  *msg,
1792 void                         *data)
1793 {
1794         int     result;
1795         u32  *uint32 = (u32*) data;
1796         u8   bytebuf[MIB_TMP_MAXLEN];
1797         u16  *wordbuf = (u16*) bytebuf;
1798
1799         DBFENTER;
1800
1801         if (isget) {
1802                 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1803                 *uint32 = *wordbuf;
1804         } else {
1805                 *wordbuf = *uint32;
1806                 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1807         }
1808
1809         DBFEXIT;
1810         return(result);
1811 }
1812
1813 /*----------------------------------------------------------------
1814 * prism2mib_privacyinvoked
1815 *
1816 * Get/set the dot11PrivacyInvoked value.
1817 *
1818 * MIB record parameters:
1819 *       parm1    Prism2 RID value.
1820 *       parm2    Bit value for PrivacyInvoked flag.
1821 *       parm3    Not used.
1822 *
1823 * Arguments:
1824 *       mib      MIB record.
1825 *       isget    MIBGET/MIBSET flag.
1826 *       wlandev  wlan device structure.
1827 *       priv     "priv" structure.
1828 *       hw       "hw" structure.
1829 *       msg      Message structure.
1830 *       data     Data buffer.
1831 *
1832 * Returns:
1833 *       0   - Success.
1834 *       ~0  - Error.
1835 *
1836 ----------------------------------------------------------------*/
1837
1838 static int prism2mib_privacyinvoked(
1839 mibrec_t                     *mib,
1840 int                          isget,
1841 wlandevice_t                 *wlandev,
1842 hfa384x_t                    *hw,
1843 p80211msg_dot11req_mibset_t  *msg,
1844 void                         *data)
1845 {
1846         int     result;
1847
1848         DBFENTER;
1849
1850         if (wlandev->hostwep & HOSTWEP_DECRYPT) {
1851                 if (wlandev->hostwep & HOSTWEP_DECRYPT)
1852                         mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
1853                 if (wlandev->hostwep & HOSTWEP_ENCRYPT)
1854                         mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_TXCRYPT;
1855         }
1856
1857         result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
1858
1859         DBFEXIT;
1860         return(result);
1861 }
1862
1863 /*----------------------------------------------------------------
1864 * prism2mib_excludeunencrypted
1865 *
1866 * Get/set the dot11ExcludeUnencrypted value.
1867 *
1868 * MIB record parameters:
1869 *       parm1    Prism2 RID value.
1870 *       parm2    Bit value for ExcludeUnencrypted flag.
1871 *       parm3    Not used.
1872 *
1873 * Arguments:
1874 *       mib      MIB record.
1875 *       isget    MIBGET/MIBSET flag.
1876 *       wlandev  wlan device structure.
1877 *       priv     "priv" structure.
1878 *       hw       "hw" structure.
1879 *       msg      Message structure.
1880 *       data     Data buffer.
1881 *
1882 * Returns:
1883 *       0   - Success.
1884 *       ~0  - Error.
1885 *
1886 ----------------------------------------------------------------*/
1887
1888 static int prism2mib_excludeunencrypted(
1889 mibrec_t                     *mib,
1890 int                          isget,
1891 wlandevice_t                 *wlandev,
1892 hfa384x_t                    *hw,
1893 p80211msg_dot11req_mibset_t  *msg,
1894 void                         *data)
1895 {
1896         int     result;
1897
1898         DBFENTER;
1899
1900         result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
1901
1902         DBFEXIT;
1903         return(result);
1904 }
1905
1906 /*----------------------------------------------------------------
1907 * prism2mib_fragmentationthreshold
1908 *
1909 * Get/set the fragmentation threshold.
1910 *
1911 * MIB record parameters:
1912 *       parm1    Prism2 RID value.
1913 *       parm2    Not used.
1914 *       parm3    Not used.
1915 *
1916 * Arguments:
1917 *       mib      MIB record.
1918 *       isget    MIBGET/MIBSET flag.
1919 *       wlandev  wlan device structure.
1920 *       priv     "priv" structure.
1921 *       hw       "hw" structure.
1922 *       msg      Message structure.
1923 *       data     Data buffer.
1924 *
1925 * Returns:
1926 *       0   - Success.
1927 *       ~0  - Error.
1928 *
1929 ----------------------------------------------------------------*/
1930
1931 static int prism2mib_fragmentationthreshold(
1932 mibrec_t                     *mib,
1933 int                          isget,
1934 wlandevice_t                 *wlandev,
1935 hfa384x_t                    *hw,
1936 p80211msg_dot11req_mibset_t  *msg,
1937 void                         *data)
1938 {
1939         int     result;
1940         u32  *uint32 = (u32*) data;
1941
1942         DBFENTER;
1943
1944         if (!isget)
1945                 if ((*uint32) % 2) {
1946                         WLAN_LOG_WARNING("Attempt to set odd number "
1947                                           "FragmentationThreshold\n");
1948                         msg->resultcode.data = P80211ENUM_resultcode_not_supported;
1949                         return(0);
1950                 }
1951
1952         result = prism2mib_uint32(mib, isget, wlandev, hw, msg, data);
1953
1954         DBFEXIT;
1955         return(result);
1956 }
1957
1958 /*----------------------------------------------------------------
1959 * prism2mib_operationalrateset
1960 *
1961 * Get/set the operational rate set.
1962 *
1963 * MIB record parameters:
1964 *       parm1    Prism2 RID value.
1965 *       parm2    Not used.
1966 *       parm3    Not used.
1967 *
1968 * Arguments:
1969 *       mib      MIB record.
1970 *       isget    MIBGET/MIBSET flag.
1971 *       wlandev  wlan device structure.
1972 *       priv     "priv" structure.
1973 *       hw       "hw" structure.
1974 *       msg      Message structure.
1975 *       data     Data buffer.
1976 *
1977 * Returns:
1978 *       0   - Success.
1979 *       ~0  - Error.
1980 *
1981 ----------------------------------------------------------------*/
1982
1983 static int prism2mib_operationalrateset(
1984 mibrec_t                     *mib,
1985 int                          isget,
1986 wlandevice_t                 *wlandev,
1987 hfa384x_t                    *hw,
1988 p80211msg_dot11req_mibset_t  *msg,
1989 void                         *data)
1990 {
1991         int            result;
1992         p80211pstrd_t  *pstr = (p80211pstrd_t *) data;
1993         u8          bytebuf[MIB_TMP_MAXLEN];
1994         u16         *wordbuf = (u16*) bytebuf;
1995
1996         DBFENTER;
1997
1998         if (isget) {
1999                 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
2000                 prism2mgmt_get_oprateset(wordbuf, pstr);
2001         } else {
2002                 prism2mgmt_set_oprateset(wordbuf, pstr);
2003                 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
2004                 result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, *wordbuf);
2005         }
2006
2007         DBFEXIT;
2008         return(result);
2009 }
2010
2011 /*----------------------------------------------------------------
2012 * prism2mib_groupaddress
2013 *
2014 * Get/set the dot11GroupAddressesTable.
2015 *
2016 * MIB record parameters:
2017 *       parm1    Not used.
2018 *       parm2    Not used.
2019 *       parm3    Not used.
2020 *
2021 * Arguments:
2022 *       mib      MIB record.
2023 *       isget    MIBGET/MIBSET flag.
2024 *       wlandev  wlan device structure.
2025 *       priv     "priv" structure.
2026 *       hw       "hw" structure.
2027 *       msg      Message structure.
2028 *       data     Data buffer.
2029 *
2030 * Returns:
2031 *       0   - Success.
2032 *       ~0  - Error.
2033 *
2034 ----------------------------------------------------------------*/
2035
2036 static int prism2mib_groupaddress(
2037 mibrec_t                     *mib,
2038 int                          isget,
2039 wlandevice_t                 *wlandev,
2040 hfa384x_t                    *hw,
2041 p80211msg_dot11req_mibset_t  *msg,
2042 void                         *data)
2043 {
2044         int            result;
2045         p80211pstrd_t  *pstr = (p80211pstrd_t *) data;
2046         u8          bytebuf[MIB_TMP_MAXLEN];
2047         u16         len;
2048
2049         DBFENTER;
2050
2051         /* TODO: fix this.  f/w doesn't support mcast filters */
2052
2053         if (isget) {
2054                 prism2mgmt_get_grpaddr(mib->did, pstr, hw);
2055                 return(0);
2056         }
2057
2058         result = prism2mgmt_set_grpaddr(mib->did, bytebuf, pstr, hw);
2059         if (result != 0) {
2060                 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2061                 return(result);
2062         }
2063
2064         if (hw->dot11_grpcnt <= MAX_PRISM2_GRP_ADDR) {
2065                 len = hw->dot11_grpcnt * WLAN_ADDR_LEN;
2066                 memcpy(bytebuf, hw->dot11_grp_addr[0], len);
2067                 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_GROUPADDR, bytebuf, len);
2068
2069                 /*
2070                 ** Turn off promiscuous mode if count is equal to MAX.  We may
2071                 ** have been at a higher count in promiscuous mode and need to
2072                 ** turn it off.
2073                 */
2074
2075                 /* but only if we're not already in promisc mode. :) */
2076                 if ((hw->dot11_grpcnt == MAX_PRISM2_GRP_ADDR) &&
2077                     !( wlandev->netdev->flags & IFF_PROMISC)) {
2078                         result = hfa384x_drvr_setconfig16(hw,
2079                                              HFA384x_RID_PROMISCMODE, 0);
2080                 }
2081         } else {
2082
2083                 /*
2084                 ** Clear group addresses in card and set to promiscuous mode.
2085                 */
2086
2087                 memset(bytebuf, 0, sizeof(bytebuf));
2088                 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_GROUPADDR,
2089                                                 bytebuf, 0);
2090                 if (result == 0) {
2091                         result = hfa384x_drvr_setconfig16(hw,
2092                                         HFA384x_RID_PROMISCMODE, 1);
2093                 }
2094         }
2095
2096         DBFEXIT;
2097         return(result);
2098 }
2099
2100 /*----------------------------------------------------------------
2101 * prism2mib_fwid
2102 *
2103 * Get the firmware ID.
2104 *
2105 * MIB record parameters:
2106 *       parm1    Not used.
2107 *       parm2    Not used.
2108 *       parm3    Not used.
2109 *
2110 * Arguments:
2111 *       mib      MIB record.
2112 *       isget    MIBGET/MIBSET flag.
2113 *       wlandev  wlan device structure.
2114 *       priv     "priv" structure.
2115 *       hw       "hw" structure.
2116 *       msg      Message structure.
2117 *       data     Data buffer.
2118 *
2119 * Returns:
2120 *       0   - Success.
2121 *       ~0  - Error.
2122 *
2123 ----------------------------------------------------------------*/
2124
2125 static int prism2mib_fwid(
2126 mibrec_t                     *mib,
2127 int                          isget,
2128 wlandevice_t                 *wlandev,
2129 hfa384x_t                    *hw,
2130 p80211msg_dot11req_mibset_t  *msg,
2131 void                         *data)
2132 {
2133         int             result;
2134         p80211pstrd_t   *pstr = (p80211pstrd_t *) data;
2135         hfa384x_FWID_t  fwid;
2136
2137         DBFENTER;
2138
2139         if (isget) {
2140                 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_FWID,
2141                                                 &fwid, HFA384x_RID_FWID_LEN);
2142                 if (mib->did == DIDmib_p2_p2NIC_p2PrimaryFWID) {
2143                         fwid.primary[HFA384x_FWID_LEN - 1] = '\0';
2144                         pstr->len = strlen(fwid.primary);
2145                         memcpy(pstr->data, fwid.primary, pstr->len);
2146                 } else {
2147                         fwid.secondary[HFA384x_FWID_LEN - 1] = '\0';
2148                         pstr->len = strlen(fwid.secondary);
2149                         memcpy(pstr->data, fwid.secondary, pstr->len);
2150                 }
2151         } else
2152                 result = 0;     /* Should never happen. */
2153
2154         DBFEXIT;
2155         return(result);
2156 }
2157
2158 /*----------------------------------------------------------------
2159 * prism2mib_authalg
2160 *
2161 * Get values from the AuhtenticationAlgorithmsTable.
2162 *
2163 * MIB record parameters:
2164 *       parm1    Table index (1-6).
2165 *       parm2    Not used.
2166 *       parm3    Not used.
2167 *
2168 * Arguments:
2169 *       mib      MIB record.
2170 *       isget    MIBGET/MIBSET flag.
2171 *       wlandev  wlan device structure.
2172 *       priv     "priv" structure.
2173 *       hw       "hw" structure.
2174 *       msg      Message structure.
2175 *       data     Data buffer.
2176 *
2177 * Returns:
2178 *       0   - Success.
2179 *       ~0  - Error.
2180 *
2181 ----------------------------------------------------------------*/
2182
2183 static int prism2mib_authalg(
2184 mibrec_t                     *mib,
2185 int                          isget,
2186 wlandevice_t                 *wlandev,
2187 hfa384x_t                    *hw,
2188 p80211msg_dot11req_mibset_t  *msg,
2189 void                         *data)
2190 {
2191         u32  *uint32 = (u32*) data;
2192
2193         DBFENTER;
2194
2195         /* MSM: pkx supplied code that  code queries RID FD4D....but the f/w's
2196          *  results are bogus. Therefore, we have to simulate the appropriate
2197          *  results here in the driver based on our knowledge of existing MAC
2198          *  features.  That's the whole point behind this ugly function.
2199          */
2200
2201         if (isget) {
2202                 msg->resultcode.data = P80211ENUM_resultcode_success;
2203                 switch (mib->parm1) {
2204                         case 1: /* Open System */
2205                                 *uint32 = P80211ENUM_authalg_opensystem;
2206                                 break;
2207                         case 2: /* SharedKey */
2208                                 *uint32 = P80211ENUM_authalg_sharedkey;
2209                                 break;
2210                         default:
2211                                 *uint32 = 0;
2212                                 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2213                                 break;
2214                 }
2215         }
2216
2217         DBFEXIT;
2218         return(0);
2219 }
2220
2221 /*----------------------------------------------------------------
2222 * prism2mib_authalgenable
2223 *
2224 * Get/set the enable values from the AuhtenticationAlgorithmsTable.
2225 *
2226 * MIB record parameters:
2227 *       parm1    Table index (1-6).
2228 *       parm2    Not used.
2229 *       parm3    Not used.
2230 *
2231 * Arguments:
2232 *       mib      MIB record.
2233 *       isget    MIBGET/MIBSET flag.
2234 *       wlandev  wlan device structure.
2235 *       priv     "priv" structure.
2236 *       hw       "hw" structure.
2237 *       msg      Message structure.
2238 *       data     Data buffer.
2239 *
2240 * Returns:
2241 *       0   - Success.
2242 *       ~0  - Error.
2243 *
2244 ----------------------------------------------------------------*/
2245
2246 static int prism2mib_authalgenable(
2247 mibrec_t                     *mib,
2248 int                          isget,
2249 wlandevice_t                 *wlandev,
2250 hfa384x_t                    *hw,
2251 p80211msg_dot11req_mibset_t  *msg,
2252 void                         *data)
2253 {
2254         int     result;
2255         u32  *uint32 = (u32*) data;
2256
2257         int     index;
2258         u16  cnf_auth;
2259         u16     mask;
2260
2261         DBFENTER;
2262
2263         index = mib->parm1 - 1;
2264
2265         result = hfa384x_drvr_getconfig16( hw,
2266                         HFA384x_RID_CNFAUTHENTICATION, &cnf_auth);
2267         WLAN_LOG_DEBUG(2,"cnfAuthentication0=%d, index=%d\n", cnf_auth, index);
2268
2269         if (isget) {
2270                 if ( index == 0 || index == 1 ) {
2271                         *uint32 = (cnf_auth & (1<<index)) ?
2272                                 P80211ENUM_truth_true: P80211ENUM_truth_false;
2273                 } else {
2274                         *uint32 = P80211ENUM_truth_false;
2275                         msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2276                 }
2277         } else {
2278                 if ( index == 0 || index == 1 ) {
2279                         mask = 1 << index;
2280                         if (*uint32==P80211ENUM_truth_true ) {
2281                                 cnf_auth |= mask;
2282                         } else {
2283                                 cnf_auth &= ~mask;
2284                         }
2285                         result = hfa384x_drvr_setconfig16( hw,
2286                                         HFA384x_RID_CNFAUTHENTICATION, cnf_auth);
2287                         WLAN_LOG_DEBUG(2,"cnfAuthentication:=%d\n", cnf_auth);
2288                         if ( result ) {
2289                                 WLAN_LOG_DEBUG(1,"Unable to set p2cnfAuthentication to %d\n", cnf_auth);
2290                                 msg->resultcode.data = P80211ENUM_resultcode_implementation_failure;
2291                         }
2292                 } else {
2293                         msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2294                 }
2295         }
2296
2297         DBFEXIT;
2298         return(result);
2299 }
2300
2301 /*----------------------------------------------------------------
2302 * prism2mib_priv
2303 *
2304 * Get/set values in the "priv" data structure.
2305 *
2306 * MIB record parameters:
2307 *       parm1    Not used.
2308 *       parm2    Not used.
2309 *       parm3    Not used.
2310 *
2311 * Arguments:
2312 *       mib      MIB record.
2313 *       isget    MIBGET/MIBSET flag.
2314 *       wlandev  wlan device structure.
2315 *       priv     "priv" structure.
2316 *       hw       "hw" structure.
2317 *       msg      Message structure.
2318 *       data     Data buffer.
2319 *
2320 * Returns:
2321 *       0   - Success.
2322 *       ~0  - Error.
2323 *
2324 ----------------------------------------------------------------*/
2325
2326 static int prism2mib_priv(
2327 mibrec_t                     *mib,
2328 int                          isget,
2329 wlandevice_t                 *wlandev,
2330 hfa384x_t                    *hw,
2331 p80211msg_dot11req_mibset_t  *msg,
2332 void                         *data)
2333 {
2334         u32            *uint32 = (u32*) data;
2335         p80211pstrd_t     *pstr = (p80211pstrd_t*) data;
2336
2337         int  i, cnt, result;
2338
2339         /*
2340         ** "test" is a lot longer than necessary but who cares?  ...as long as
2341         ** it is long enough!
2342         */
2343
2344         u8  test[sizeof(wlandev->rx) + sizeof(hw->tallies)];
2345
2346         DBFENTER;
2347
2348         switch (mib->did) {
2349         case DIDmib_p2_p2Table_p2ReceivedFrameStatistics:
2350
2351                 /*
2352                 ** Note: The values in this record are changed by the
2353                 ** interrupt handler and therefore cannot be guaranteed
2354                 ** to be stable while they are being copied.  However,
2355                 ** the interrupt handler will take priority over this
2356                 ** code.  Hence, if the same values are copied twice,
2357                 ** then we are ensured that the values have not been
2358                 ** changed.  If they have, then just try again.  Don't
2359                 ** try more than 10 times...if we still haven't got it,
2360                 ** then the values we do have are probably good enough.
2361                 ** This scheme for copying values is used in order to
2362                 ** prevent having to block the interrupt handler while
2363                 ** we copy the values.
2364                 */
2365
2366                 if (isget)
2367                         for (i = 0; i < 10; i++) {
2368                                 memcpy(data, &wlandev->rx, sizeof(wlandev->rx));
2369                                 memcpy(test, &wlandev->rx, sizeof(wlandev->rx));
2370                                 if (memcmp(data, test, sizeof(wlandev->rx)) == 0) break;
2371                         }
2372
2373                 break;
2374
2375         case DIDmib_p2_p2Table_p2CommunicationTallies:
2376
2377                 /*
2378                 ** Note: The values in this record are changed by the
2379                 ** interrupt handler and therefore cannot be guaranteed
2380                 ** to be stable while they are being copied.  See the
2381                 ** note above about copying values.
2382                 */
2383
2384                 if (isget) {
2385                         result = hfa384x_drvr_commtallies(hw);
2386
2387                         /* ?????? We need to wait a bit here for the */
2388                         /*   tallies to get updated. ?????? */
2389                         /* MSM: TODO: The right way to do this is to
2390                          *      add a "commtallie" wait queue to the
2391                          *      priv structure that gets run every time
2392                          *      we receive a commtally info frame.
2393                          *      This process would sleep on that
2394                          *      queue and get awakened when the
2395                          *      the requested info frame arrives.
2396                          *      Don't have time to do and test this
2397                          *      right now.
2398                          */
2399
2400                         /* Ugh, this is nasty. */
2401                         for (i = 0; i < 10; i++) {
2402                                 memcpy(data,
2403                                        &hw->tallies,
2404                                        sizeof(hw->tallies));
2405                                 memcpy(test,
2406                                        &hw->tallies,
2407                                        sizeof(hw->tallies));
2408                                 if ( memcmp(data,
2409                                             test,
2410                                             sizeof(hw->tallies)) == 0)
2411                                         break;
2412                         }
2413                 }
2414
2415                 break;
2416
2417         case DIDmib_p2_p2Table_p2Comment:
2418
2419                 if (isget) {
2420                         pstr->len = strlen(hw->comment);
2421                         memcpy(pstr->data, hw->comment, pstr->len);
2422                 } else {
2423                         cnt = pstr->len;
2424                         if (cnt < 0) cnt = 0;
2425                         if (cnt >= sizeof(hw->comment))
2426                                 cnt = sizeof(hw->comment)-1;
2427                         memcpy(hw->comment, pstr->data, cnt);
2428                         pstr->data[cnt] = '\0';
2429                 }
2430
2431                 break;
2432
2433         case DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType:
2434
2435                 if (isget)
2436                         *uint32 = hw->dot11_desired_bss_type;
2437                 else
2438                         hw->dot11_desired_bss_type = *uint32;
2439
2440                 break;
2441
2442         case DIDmib_lnx_lnxConfigTable_lnxRSNAIE: {
2443                 hfa384x_WPAData_t wpa;
2444                 if (isget) {
2445                         hfa384x_drvr_getconfig( hw, HFA384x_RID_CNFWPADATA,
2446                                                 (u8 *) &wpa, sizeof(wpa));
2447                         pstr->len = hfa384x2host_16(wpa.datalen);
2448                         memcpy(pstr->data, wpa.data, pstr->len);
2449                 } else {
2450                         wpa.datalen = host2hfa384x_16(pstr->len);
2451                         memcpy(wpa.data, pstr->data, pstr->len);
2452
2453                         result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFWPADATA,
2454                                 (u8 *) &wpa, sizeof(wpa));
2455                 }
2456                 break;
2457         }
2458         default:
2459                 WLAN_LOG_ERROR("Unhandled DID 0x%08x\n", mib->did);
2460         }
2461
2462         DBFEXIT;
2463         return(0);
2464 }
2465
2466 /*----------------------------------------------------------------
2467 * prism2mgmt_pstr2bytestr
2468 *
2469 * Convert the pstr data in the WLAN message structure into an hfa384x
2470 * byte string format.
2471 *
2472 * Arguments:
2473 *       bytestr         hfa384x byte string data type
2474 *       pstr            wlan message data
2475 *
2476 * Returns:
2477 *       Nothing
2478 *
2479 ----------------------------------------------------------------*/
2480
2481 void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
2482 {
2483         DBFENTER;
2484
2485         bytestr->len = host2hfa384x_16((u16)(pstr->len));
2486         memcpy(bytestr->data, pstr->data, pstr->len);
2487         DBFEXIT;
2488 }
2489
2490
2491 /*----------------------------------------------------------------
2492 * prism2mgmt_pstr2bytearea
2493 *
2494 * Convert the pstr data in the WLAN message structure into an hfa384x
2495 * byte area format.
2496 *
2497 * Arguments:
2498 *       bytearea        hfa384x byte area data type
2499 *       pstr            wlan message data
2500 *
2501 * Returns:
2502 *       Nothing
2503 *
2504 ----------------------------------------------------------------*/
2505
2506 void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr)
2507 {
2508         DBFENTER;
2509
2510         memcpy(bytearea, pstr->data, pstr->len);
2511         DBFEXIT;
2512 }
2513
2514
2515 /*----------------------------------------------------------------
2516 * prism2mgmt_bytestr2pstr
2517 *
2518 * Convert the data in an hfa384x byte string format into a
2519 * pstr in the WLAN message.
2520 *
2521 * Arguments:
2522 *       bytestr         hfa384x byte string data type
2523 *       msg             wlan message
2524 *
2525 * Returns:
2526 *       Nothing
2527 *
2528 ----------------------------------------------------------------*/
2529
2530 void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
2531 {
2532         DBFENTER;
2533
2534         pstr->len = (u8)(hfa384x2host_16((u16)(bytestr->len)));
2535         memcpy(pstr->data, bytestr->data, pstr->len);
2536         DBFEXIT;
2537 }
2538
2539
2540 /*----------------------------------------------------------------
2541 * prism2mgmt_bytearea2pstr
2542 *
2543 * Convert the data in an hfa384x byte area format into a pstr
2544 * in the WLAN message.
2545 *
2546 * Arguments:
2547 *       bytearea        hfa384x byte area data type
2548 *       msg             wlan message
2549 *
2550 * Returns:
2551 *       Nothing
2552 *
2553 ----------------------------------------------------------------*/
2554
2555 void prism2mgmt_bytearea2pstr(u8 *bytearea, p80211pstrd_t *pstr, int len)
2556 {
2557         DBFENTER;
2558
2559         pstr->len = (u8)len;
2560         memcpy(pstr->data, bytearea, len);
2561         DBFEXIT;
2562 }
2563
2564
2565 /*----------------------------------------------------------------
2566 * prism2mgmt_prism2int2p80211int
2567 *
2568 * Convert an hfa384x integer into a wlan integer
2569 *
2570 * Arguments:
2571 *       prism2enum      pointer to hfa384x integer
2572 *       wlanenum        pointer to p80211 integer
2573 *
2574 * Returns:
2575 *       Nothing
2576 *
2577 ----------------------------------------------------------------*/
2578
2579 void prism2mgmt_prism2int2p80211int(u16 *prism2int, u32 *wlanint)
2580 {
2581         DBFENTER;
2582
2583         *wlanint = (u32)hfa384x2host_16(*prism2int);
2584         DBFEXIT;
2585 }
2586
2587
2588 /*----------------------------------------------------------------
2589 * prism2mgmt_p80211int2prism2int
2590 *
2591 * Convert a wlan integer into an hfa384x integer
2592 *
2593 * Arguments:
2594 *       prism2enum      pointer to hfa384x integer
2595 *       wlanenum        pointer to p80211 integer
2596 *
2597 * Returns:
2598 *       Nothing
2599 *
2600 ----------------------------------------------------------------*/
2601
2602 void prism2mgmt_p80211int2prism2int(u16 *prism2int, u32 *wlanint)
2603 {
2604         DBFENTER;
2605
2606         *prism2int = host2hfa384x_16((u16)(*wlanint));
2607         DBFEXIT;
2608 }
2609
2610
2611 /*----------------------------------------------------------------
2612 * prism2mgmt_prism2enum2p80211enum
2613 *
2614 * Convert the hfa384x enumerated int into a p80211 enumerated int
2615 *
2616 * Arguments:
2617 *       prism2enum      pointer to hfa384x integer
2618 *       wlanenum        pointer to p80211 integer
2619 *       rid             hfa384x record id
2620 *
2621 * Returns:
2622 *       Nothing
2623 *
2624 ----------------------------------------------------------------*/
2625 void prism2mgmt_prism2enum2p80211enum(u16 *prism2enum, u32 *wlanenum, u16 rid)
2626 {
2627         DBFENTER;
2628
2629         /* At the moment, the need for this functionality hasn't
2630         presented itself. All the wlan enumerated values are
2631         a 1-to-1 match against the Prism2 enumerated values*/
2632         DBFEXIT;
2633         return;
2634 }
2635
2636
2637 /*----------------------------------------------------------------
2638 * prism2mgmt_p80211enum2prism2enum
2639 *
2640 * Convert the p80211 enumerated int into an hfa384x enumerated int
2641 *
2642 * Arguments:
2643 *       prism2enum      pointer to hfa384x integer
2644 *       wlanenum        pointer to p80211 integer
2645 *       rid             hfa384x record id
2646 *
2647 * Returns:
2648 *       Nothing
2649 *
2650 ----------------------------------------------------------------*/
2651 void prism2mgmt_p80211enum2prism2enum(u16 *prism2enum, u32 *wlanenum, u16 rid)
2652 {
2653         DBFENTER;
2654
2655         /* At the moment, the need for this functionality hasn't
2656         presented itself. All the wlan enumerated values are
2657         a 1-to-1 match against the Prism2 enumerated values*/
2658         DBFEXIT;
2659         return;
2660 }
2661
2662
2663
2664 /*----------------------------------------------------------------
2665 * prism2mgmt_get_oprateset
2666 *
2667 * Convert the hfa384x bit area into a wlan octet string.
2668 *
2669 * Arguments:
2670 *       rate            Prism2 bit area
2671 *       pstr            wlan octet string
2672 *
2673 * Returns:
2674 *       Nothing
2675 *
2676 ----------------------------------------------------------------*/
2677 void prism2mgmt_get_oprateset(u16 *rate, p80211pstrd_t *pstr)
2678 {
2679         u8      len;
2680         u8      *datarate;
2681
2682         DBFENTER;
2683
2684         len = 0;
2685         datarate = pstr->data;
2686
2687         /* 1 Mbps */
2688         if ( BIT0 & (*rate) ) {
2689                 len += (u8)1;
2690                 *datarate = (u8)2;
2691                 datarate++;
2692         }
2693
2694         /* 2 Mbps */
2695         if ( BIT1 & (*rate) ) {
2696                 len += (u8)1;
2697                 *datarate = (u8)4;
2698                 datarate++;
2699         }
2700
2701         /* 5.5 Mbps */
2702         if ( BIT2 & (*rate) ) {
2703                 len += (u8)1;
2704                 *datarate = (u8)11;
2705                 datarate++;
2706         }
2707
2708         /* 11 Mbps */
2709         if ( BIT3 & (*rate) ) {
2710                 len += (u8)1;
2711                 *datarate = (u8)22;
2712                 datarate++;
2713         }
2714
2715         pstr->len = len;
2716
2717         DBFEXIT;
2718         return;
2719 }
2720
2721
2722
2723 /*----------------------------------------------------------------
2724 * prism2mgmt_set_oprateset
2725 *
2726 * Convert the wlan octet string into an hfa384x bit area.
2727 *
2728 * Arguments:
2729 *       rate            Prism2 bit area
2730 *       pstr            wlan octet string
2731 *
2732 * Returns:
2733 *       Nothing
2734 *
2735 ----------------------------------------------------------------*/
2736 void prism2mgmt_set_oprateset(u16 *rate, p80211pstrd_t *pstr)
2737 {
2738         u8      *datarate;
2739         int     i;
2740
2741         DBFENTER;
2742
2743         *rate = 0;
2744
2745         datarate = pstr->data;
2746
2747         for ( i=0; i < pstr->len; i++, datarate++ ) {
2748                 switch (*datarate) {
2749                 case 2: /* 1 Mbps */
2750                         *rate |= BIT0;
2751                         break;
2752                 case 4: /* 2 Mbps */
2753                         *rate |= BIT1;
2754                         break;
2755                 case 11: /* 5.5 Mbps */
2756                         *rate |= BIT2;
2757                         break;
2758                 case 22: /* 11 Mbps */
2759                         *rate |= BIT3;
2760                         break;
2761                 default:
2762                         WLAN_LOG_DEBUG(1, "Unrecoginzed Rate of %d\n",
2763                                 *datarate);
2764                         break;
2765                 }
2766         }
2767
2768         DBFEXIT;
2769         return;
2770 }
2771
2772
2773
2774 /*----------------------------------------------------------------
2775 * prism2mgmt_get_grpaddr
2776 *
2777 * Retrieves a particular group address from the list of
2778 * group addresses.
2779 *
2780 * Arguments:
2781 *       did             mibitem did
2782 *       pstr            wlan octet string
2783 *       priv            prism2 driver private data structure
2784 *
2785 * Returns:
2786 *       Nothing
2787 *
2788 ----------------------------------------------------------------*/
2789 void prism2mgmt_get_grpaddr(u32 did, p80211pstrd_t *pstr,
2790         hfa384x_t *hw )
2791 {
2792         int     index;
2793
2794         DBFENTER;
2795
2796         index = prism2mgmt_get_grpaddr_index(did);
2797
2798         if ( index >= 0 ) {
2799                 pstr->len = WLAN_ADDR_LEN;
2800                 memcpy(pstr->data, hw->dot11_grp_addr[index],
2801                         WLAN_ADDR_LEN);
2802         }
2803
2804         DBFEXIT;
2805         return;
2806 }
2807
2808
2809
2810 /*----------------------------------------------------------------
2811 * prism2mgmt_set_grpaddr
2812 *
2813 * Convert the wlan octet string into an hfa384x bit area.
2814 *
2815 * Arguments:
2816 *       did             mibitem did
2817 *       buf
2818 *       groups
2819 *
2820 * Returns:
2821 *       0       Success
2822 *       !0      Error
2823 *
2824 ----------------------------------------------------------------*/
2825 int prism2mgmt_set_grpaddr(u32 did, u8 *prism2buf,
2826         p80211pstrd_t *pstr, hfa384x_t *hw )
2827 {
2828         u8      no_addr[WLAN_ADDR_LEN];
2829         int     index;
2830
2831         DBFENTER;
2832
2833         memset(no_addr, 0, WLAN_ADDR_LEN);
2834         if (memcmp(no_addr, pstr->data, WLAN_ADDR_LEN) != 0) {
2835
2836                 /*
2837                 ** The address is NOT 0 so we are "adding" an address to the
2838                 ** group address list.  Check to make sure we aren't trying
2839                 ** to add more than the maximum allowed number of group
2840                 ** addresses in the list.  The new address is added to the
2841                 ** end of the list regardless of the DID used to add the
2842                 ** address.
2843                 */
2844
2845                 if (hw->dot11_grpcnt >= MAX_GRP_ADDR) return(-1);
2846
2847                 memcpy(hw->dot11_grp_addr[hw->dot11_grpcnt], pstr->data,
2848                                                                  WLAN_ADDR_LEN);
2849                 hw->dot11_grpcnt += 1;
2850         } else {
2851
2852                 /*
2853                 ** The address is 0.  Interpret this as "deleting" an address
2854                 ** from the group address list.  Get the address index from
2855                 ** the DID.  If this is within the range of used addresses,
2856                 ** then delete the specified address by shifting all following
2857                 ** addresses down.  Then clear the last address (which should
2858                 ** now be unused).  If the address index is NOT within the
2859                 ** range of used addresses, then just ignore the address.
2860                 */
2861
2862                 index = prism2mgmt_get_grpaddr_index(did);
2863                 if (index >= 0 && index < hw->dot11_grpcnt) {
2864                         hw->dot11_grpcnt -= 1;
2865                         memmove(hw->dot11_grp_addr[index],
2866                                 hw->dot11_grp_addr[index + 1],
2867                                 ((hw->dot11_grpcnt)-index) * WLAN_ADDR_LEN);
2868                         memset(hw->dot11_grp_addr[hw->dot11_grpcnt], 0,
2869                                                                  WLAN_ADDR_LEN);
2870                 }
2871         }
2872
2873         DBFEXIT;
2874         return(0);
2875 }
2876
2877
2878 /*----------------------------------------------------------------
2879 * prism2mgmt_get_grpaddr_index
2880 *
2881 * Gets the index in the group address list based on the did.
2882 *
2883 * Arguments:
2884 *       did             mibitem did
2885 *
2886 * Returns:
2887 *       >= 0    If valid did
2888 *       < 0     If not valid did
2889 *
2890 ----------------------------------------------------------------*/
2891 int prism2mgmt_get_grpaddr_index( u32 did )
2892 {
2893         int     index;
2894
2895         DBFENTER;
2896
2897         index = -1;
2898
2899         switch (did) {
2900         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1:
2901                 index = 0;
2902                 break;
2903         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2:
2904                 index = 1;
2905                 break;
2906         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3:
2907                 index = 2;
2908                 break;
2909         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4:
2910                 index = 3;
2911                 break;
2912         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5:
2913                 index = 4;
2914                 break;
2915         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6:
2916                 index = 5;
2917                 break;
2918         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7:
2919                 index = 6;
2920                 break;
2921         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8:
2922                 index = 7;
2923                 break;
2924         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9:
2925                 index = 8;
2926                 break;
2927         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10:
2928                 index = 9;
2929                 break;
2930         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11:
2931                 index = 10;
2932                 break;
2933         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12:
2934                 index = 11;
2935                 break;
2936         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13:
2937                 index = 12;
2938                 break;
2939         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14:
2940                 index = 13;
2941                 break;
2942         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15:
2943                 index = 14;
2944                 break;
2945         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16:
2946                 index = 15;
2947                 break;
2948         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17:
2949                 index = 16;
2950                 break;
2951         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18:
2952                 index = 17;
2953                 break;
2954         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19:
2955                 index = 18;
2956                 break;
2957         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20:
2958                 index = 19;
2959                 break;
2960         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21:
2961                 index = 20;
2962                 break;
2963         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22:
2964                 index = 21;
2965                 break;
2966         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23:
2967                 index = 22;
2968                 break;
2969         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24:
2970                 index = 23;
2971                 break;
2972         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25:
2973                 index = 24;
2974                 break;
2975         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26:
2976                 index = 25;
2977                 break;
2978         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27:
2979                 index = 26;
2980                 break;
2981         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28:
2982                 index = 27;
2983                 break;
2984         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29:
2985                 index = 28;
2986                 break;
2987         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30:
2988                 index = 29;
2989                 break;
2990         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31:
2991                 index = 30;
2992                 break;
2993         case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32:
2994                 index = 31;
2995                 break;
2996         }
2997
2998         DBFEXIT;
2999         return index;
3000 }