1 /* src/prism2/driver/prism2mib.c
3 * Management request for mibset/mibget
5 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
6 * --------------------------------------------------------------------
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/
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.
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.
31 * --------------------------------------------------------------------
33 * Inquiries regarding the linux-wlan Open Source project can be
36 * AbsoluteValue Systems Inc.
38 * http://www.linux-wlan.com
40 * --------------------------------------------------------------------
42 * Portions of the development of this software were funded by
43 * Intersil Corporation as part of PRISM(R) chipset product development.
45 * --------------------------------------------------------------------
47 * The functions in this file handle the mibset/mibget management
50 * --------------------------------------------------------------------
53 /*================================================================*/
55 #define WLAN_DBVAR prism2_debug
57 #include <linux/version.h>
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>
67 #include <linux/delay.h>
68 #include <asm/byteorder.h>
69 #include <linux/usb.h>
71 /*================================================================*/
72 /* Project Includes */
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"
83 #include "prism2mgmt.h"
85 /*================================================================*/
88 #define MIB_TMP_MAXLEN 200 /* Max length of RID record (in bytes). */
90 /*================================================================*/
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. */
104 int (*func)(struct mibrec *mib,
106 wlandevice_t *wlandev,
108 p80211msg_dot11req_mibset_t *msg,
112 /*================================================================*/
113 /* Local Function Declarations */
115 static int prism2mib_bytestr2pstr(
118 wlandevice_t *wlandev,
120 p80211msg_dot11req_mibset_t *msg,
123 static int prism2mib_bytearea2pstr(
126 wlandevice_t *wlandev,
128 p80211msg_dot11req_mibset_t *msg,
131 static int prism2mib_uint32(
134 wlandevice_t *wlandev,
136 p80211msg_dot11req_mibset_t *msg,
139 static int prism2mib_uint32array(
142 wlandevice_t *wlandev,
144 p80211msg_dot11req_mibset_t *msg,
147 static int prism2mib_uint32offset(
150 wlandevice_t *wlandev,
152 p80211msg_dot11req_mibset_t *msg,
155 static int prism2mib_truth(
158 wlandevice_t *wlandev,
160 p80211msg_dot11req_mibset_t *msg,
163 static int prism2mib_preamble(
166 wlandevice_t *wlandev,
168 p80211msg_dot11req_mibset_t *msg,
171 static int prism2mib_flag(
174 wlandevice_t *wlandev,
176 p80211msg_dot11req_mibset_t *msg,
179 static int prism2mib_regulatorydomains(
182 wlandevice_t *wlandev,
184 p80211msg_dot11req_mibset_t *msg,
187 static int prism2mib_wepdefaultkey(
190 wlandevice_t *wlandev,
192 p80211msg_dot11req_mibset_t *msg,
195 static int prism2mib_powermanagement(
198 wlandevice_t *wlandev,
200 p80211msg_dot11req_mibset_t *msg,
203 static int prism2mib_privacyinvoked(
206 wlandevice_t *wlandev,
208 p80211msg_dot11req_mibset_t *msg,
211 static int prism2mib_excludeunencrypted(
214 wlandevice_t *wlandev,
216 p80211msg_dot11req_mibset_t *msg,
219 static int prism2mib_fragmentationthreshold(
222 wlandevice_t *wlandev,
224 p80211msg_dot11req_mibset_t *msg,
227 static int prism2mib_operationalrateset(
230 wlandevice_t *wlandev,
232 p80211msg_dot11req_mibset_t *msg,
235 static int prism2mib_groupaddress(
238 wlandevice_t *wlandev,
240 p80211msg_dot11req_mibset_t *msg,
243 static int prism2mib_fwid(
246 wlandevice_t *wlandev,
248 p80211msg_dot11req_mibset_t *msg,
251 static int prism2mib_authalg(
254 wlandevice_t *wlandev,
256 p80211msg_dot11req_mibset_t *msg,
259 static int prism2mib_authalgenable(
262 wlandevice_t *wlandev,
264 p80211msg_dot11req_mibset_t *msg,
267 static int prism2mib_priv(
270 wlandevice_t *wlandev,
272 p80211msg_dot11req_mibset_t *msg,
275 /*================================================================*/
276 /* Local Static Definitions */
278 static mibrec_t mibtab[] = {
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,
288 HFA384x_RID_CFPOLLABLE, 0, 0,
290 { DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticationResponseTimeOut,
291 F_STA | F_READ | F_WRITE,
292 HFA384x_RID_CNFAUTHRSPTIMEOUT, 0, 0,
294 { DIDmib_dot11smt_dot11StationConfigTable_dot11PrivacyOptionImplemented,
296 HFA384x_RID_PRIVACYOPTIMP, 0, 0,
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,
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,
318 { DIDmib_dot11smt_dot11StationConfigTable_dot11AssociationResponseTimeOut,
320 HFA384x_RID_PROTOCOLRSPTIME, 0, 0,
322 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm1,
326 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm2,
330 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm3,
334 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm4,
338 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm5,
342 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm6,
346 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable1,
347 F_STA | F_READ | F_WRITE,
349 prism2mib_authalgenable },
350 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable2,
351 F_STA | F_READ | F_WRITE,
353 prism2mib_authalgenable },
354 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable3,
355 F_STA | F_READ | F_WRITE,
357 prism2mib_authalgenable },
358 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable4,
359 F_STA | F_READ | F_WRITE,
361 prism2mib_authalgenable },
362 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable5,
363 F_STA | F_READ | F_WRITE,
365 prism2mib_authalgenable },
366 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable6,
367 F_STA | F_READ | F_WRITE,
369 prism2mib_authalgenable },
370 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0,
372 HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0,
373 prism2mib_wepdefaultkey },
374 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1,
376 HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0,
377 prism2mib_wepdefaultkey },
378 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2,
380 HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0,
381 prism2mib_wepdefaultkey },
382 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3,
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,
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 },
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,
413 { DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit,
415 HFA384x_RID_SHORTRETRYLIMIT, 0, 0,
417 { DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit,
419 HFA384x_RID_LONGRETRYLIMIT, 0, 0,
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,
427 HFA384x_RID_MAXTXLIFETIME, 0, 0,
429 { DIDmib_dot11mac_dot11OperationTable_dot11MaxReceiveLifetime,
431 HFA384x_RID_MAXRXLIFETIME, 0, 0,
433 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1,
434 F_STA | F_READ | F_WRITE,
436 prism2mib_groupaddress },
437 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2,
438 F_STA | F_READ | F_WRITE,
440 prism2mib_groupaddress },
441 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3,
442 F_STA | F_READ | F_WRITE,
444 prism2mib_groupaddress },
445 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4,
446 F_STA | F_READ | F_WRITE,
448 prism2mib_groupaddress },
449 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5,
450 F_STA | F_READ | F_WRITE,
452 prism2mib_groupaddress },
453 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6,
454 F_STA | F_READ | F_WRITE,
456 prism2mib_groupaddress },
457 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7,
458 F_STA | F_READ | F_WRITE,
460 prism2mib_groupaddress },
461 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8,
462 F_STA | F_READ | F_WRITE,
464 prism2mib_groupaddress },
465 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9,
466 F_STA | F_READ | F_WRITE,
468 prism2mib_groupaddress },
469 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10,
470 F_STA | F_READ | F_WRITE,
472 prism2mib_groupaddress },
473 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11,
474 F_STA | F_READ | F_WRITE,
476 prism2mib_groupaddress },
477 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12,
478 F_STA | F_READ | F_WRITE,
480 prism2mib_groupaddress },
481 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13,
482 F_STA | F_READ | F_WRITE,
484 prism2mib_groupaddress },
485 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14,
486 F_STA | F_READ | F_WRITE,
488 prism2mib_groupaddress },
489 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15,
490 F_STA | F_READ | F_WRITE,
492 prism2mib_groupaddress },
493 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16,
494 F_STA | F_READ | F_WRITE,
496 prism2mib_groupaddress },
497 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17,
498 F_STA | F_READ | F_WRITE,
500 prism2mib_groupaddress },
501 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18,
502 F_STA | F_READ | F_WRITE,
504 prism2mib_groupaddress },
505 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19,
506 F_STA | F_READ | F_WRITE,
508 prism2mib_groupaddress },
509 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20,
510 F_STA | F_READ | F_WRITE,
512 prism2mib_groupaddress },
513 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21,
514 F_STA | F_READ | F_WRITE,
516 prism2mib_groupaddress },
517 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22,
518 F_STA | F_READ | F_WRITE,
520 prism2mib_groupaddress },
521 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23,
522 F_STA | F_READ | F_WRITE,
524 prism2mib_groupaddress },
525 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24,
526 F_STA | F_READ | F_WRITE,
528 prism2mib_groupaddress },
529 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25,
530 F_STA | F_READ | F_WRITE,
532 prism2mib_groupaddress },
533 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26,
534 F_STA | F_READ | F_WRITE,
536 prism2mib_groupaddress },
537 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27,
538 F_STA | F_READ | F_WRITE,
540 prism2mib_groupaddress },
541 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28,
542 F_STA | F_READ | F_WRITE,
544 prism2mib_groupaddress },
545 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29,
546 F_STA | F_READ | F_WRITE,
548 prism2mib_groupaddress },
549 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30,
550 F_STA | F_READ | F_WRITE,
552 prism2mib_groupaddress },
553 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31,
554 F_STA | F_READ | F_WRITE,
556 prism2mib_groupaddress },
557 { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32,
558 F_STA | F_READ | F_WRITE,
560 prism2mib_groupaddress },
564 { DIDmib_dot11phy_dot11PhyOperationTable_dot11PHYType,
566 HFA384x_RID_PHYTYPE, 0, 0,
568 { DIDmib_dot11phy_dot11PhyOperationTable_dot11TempType,
570 HFA384x_RID_TEMPTYPE, 0, 0,
572 { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
574 HFA384x_RID_CURRENTCHANNEL, 0, 0,
576 { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentCCAMode,
578 HFA384x_RID_CCAMODE, 0, 0,
583 { DIDmib_p2_p2Table_p2MMTx,
584 F_STA | F_READ | F_WRITE,
587 { DIDmib_p2_p2Table_p2ReceivedFrameStatistics,
591 { DIDmib_p2_p2Table_p2CommunicationTallies,
595 { DIDmib_p2_p2Table_p2Comment,
596 F_STA | F_READ | F_WRITE,
602 { DIDmib_p2_p2Static_p2CnfPortType,
603 F_STA | F_READ | F_WRITE,
604 HFA384x_RID_CNFPORTTYPE, 0, 0,
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,
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,
626 { DIDmib_p2_p2Static_p2CnfSystemScale,
627 F_STA | F_READ | F_WRITE,
628 HFA384x_RID_CNFSYSSCALE, 0, 0,
630 { DIDmib_p2_p2Static_p2CnfMaxDataLength,
631 F_STA | F_READ | F_WRITE,
632 HFA384x_RID_CNFMAXDATALEN, 0, 0,
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,
642 { DIDmib_p2_p2Static_p2CnfPMEPS,
643 F_STA | F_READ | F_WRITE,
644 HFA384x_RID_CNFPMEPS, 0, 0,
646 { DIDmib_p2_p2Static_p2CnfMulticastReceive,
647 F_STA | F_READ | F_WRITE,
648 HFA384x_RID_CNFMULTICASTRX, 0, 0,
650 { DIDmib_p2_p2Static_p2CnfMaxSleepDuration,
651 F_STA | F_READ | F_WRITE,
652 HFA384x_RID_CNFMAXSLEEPDUR, 0, 0,
654 { DIDmib_p2_p2Static_p2CnfPMHoldoverDuration,
655 F_STA | F_READ | F_WRITE,
656 HFA384x_RID_CNFPMHOLDDUR, 0, 0,
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,
666 { DIDmib_p2_p2Static_p2CnfWEPDefaultKeyID,
667 F_STA | F_READ | F_WRITE,
668 HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0,
670 { DIDmib_p2_p2Static_p2CnfWEPDefaultKey0,
672 HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0,
673 prism2mib_wepdefaultkey },
674 { DIDmib_p2_p2Static_p2CnfWEPDefaultKey1,
676 HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0,
677 prism2mib_wepdefaultkey },
678 { DIDmib_p2_p2Static_p2CnfWEPDefaultKey2,
680 HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0,
681 prism2mib_wepdefaultkey },
682 { DIDmib_p2_p2Static_p2CnfWEPDefaultKey3,
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,
690 { DIDmib_p2_p2Static_p2CnfAuthentication,
691 F_STA | F_READ | F_WRITE,
692 HFA384x_RID_CNFAUTHENTICATION, 0, 0,
694 { DIDmib_p2_p2Static_p2CnfTxControl,
695 F_STA | F_READ | F_WRITE,
696 HFA384x_RID_CNFTXCONTROL, 0, 0,
698 { DIDmib_p2_p2Static_p2CnfRoamingMode,
699 F_STA | F_READ | F_WRITE,
700 HFA384x_RID_CNFROAMINGMODE, 0, 0,
702 { DIDmib_p2_p2Static_p2CnfRcvCrcError,
703 F_STA | F_READ | F_WRITE,
704 HFA384x_RID_CNFRCVCRCERROR, 0, 0,
706 { DIDmib_p2_p2Static_p2CnfAltRetryCount,
707 F_STA | F_READ | F_WRITE,
708 HFA384x_RID_CNFALTRETRYCNT, 0, 0,
710 { DIDmib_p2_p2Static_p2CnfSTAPCFInfo,
711 F_STA | F_READ | F_WRITE,
712 HFA384x_RID_CNFSTAPCFINFO, 0, 0,
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,
722 { DIDmib_p2_p2Static_p2CnfThirty2Tally,
723 F_STA | F_READ | F_WRITE,
724 HFA384x_RID_CNFTHIRTY2TALLY, 0, 0,
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,
734 { DIDmib_p2_p2Static_p2CnfBasicRates,
735 F_STA | F_READ | F_WRITE,
736 HFA384x_RID_CNFBASICRATES, 0, 0,
738 { DIDmib_p2_p2Static_p2CnfSupportedRates,
739 F_STA | F_READ | F_WRITE,
740 HFA384x_RID_CNFSUPPRATES, 0, 0,
743 /* p2Dynamic MIB's */
745 { DIDmib_p2_p2Dynamic_p2CreateIBSS,
746 F_STA | F_READ | F_WRITE,
747 HFA384x_RID_CREATEIBSS, 0, 0,
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,
757 { DIDmib_p2_p2Dynamic_p2TxRateControl,
758 F_STA | F_READ | F_WRITE,
759 HFA384x_RID_TXRATECNTL, 0, 0,
761 { DIDmib_p2_p2Dynamic_p2PromiscuousMode,
762 F_STA | F_READ | F_WRITE,
763 HFA384x_RID_PROMISCMODE, 0, 0,
766 /* p2Behavior MIB's */
768 { DIDmib_p2_p2Behavior_p2TickTime,
769 F_STA | F_READ | F_WRITE,
770 HFA384x_RID_ITICKTIME, 0, 0,
775 { DIDmib_p2_p2NIC_p2MaxLoadTime,
777 HFA384x_RID_MAXLOADTIME, 0, 0,
779 { DIDmib_p2_p2NIC_p2DLBufferPage,
781 HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 0,
782 prism2mib_uint32offset },
783 { DIDmib_p2_p2NIC_p2DLBufferOffset,
785 HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 1,
786 prism2mib_uint32offset },
787 { DIDmib_p2_p2NIC_p2DLBufferLength,
789 HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 2,
790 prism2mib_uint32offset },
791 { DIDmib_p2_p2NIC_p2PRIIdentity,
793 HFA384x_RID_PRIIDENTITY, HFA384x_RID_PRIIDENTITY_LEN, 0,
794 prism2mib_uint32array },
795 { DIDmib_p2_p2NIC_p2PRISupRange,
797 HFA384x_RID_PRISUPRANGE, HFA384x_RID_PRISUPRANGE_LEN, 0,
798 prism2mib_uint32array },
799 { DIDmib_p2_p2NIC_p2CFIActRanges,
801 HFA384x_RID_PRI_CFIACTRANGES, HFA384x_RID_CFIACTRANGES_LEN, 0,
802 prism2mib_uint32array },
803 { DIDmib_p2_p2NIC_p2BuildSequence,
805 HFA384x_RID_BUILDSEQ, HFA384x_RID_BUILDSEQ_LEN, 0,
806 prism2mib_uint32array },
807 { DIDmib_p2_p2NIC_p2PrimaryFWID,
811 { DIDmib_p2_p2NIC_p2SecondaryFWID,
815 { DIDmib_p2_p2NIC_p2NICSerialNumber,
817 HFA384x_RID_NICSERIALNUMBER, HFA384x_RID_NICSERIALNUMBER_LEN, 0,
818 prism2mib_bytearea2pstr },
819 { DIDmib_p2_p2NIC_p2NICIdentity,
821 HFA384x_RID_NICIDENTITY, HFA384x_RID_NICIDENTITY_LEN, 0,
822 prism2mib_uint32array },
823 { DIDmib_p2_p2NIC_p2MFISupRange,
825 HFA384x_RID_MFISUPRANGE, HFA384x_RID_MFISUPRANGE_LEN, 0,
826 prism2mib_uint32array },
827 { DIDmib_p2_p2NIC_p2CFISupRange,
829 HFA384x_RID_CFISUPRANGE, HFA384x_RID_CFISUPRANGE_LEN, 0,
830 prism2mib_uint32array },
831 { DIDmib_p2_p2NIC_p2ChannelList,
833 HFA384x_RID_CHANNELLIST, 0, 0,
835 { DIDmib_p2_p2NIC_p2RegulatoryDomains,
837 HFA384x_RID_REGULATORYDOMAINS, HFA384x_RID_REGULATORYDOMAINS_LEN, 0,
838 prism2mib_regulatorydomains },
839 { DIDmib_p2_p2NIC_p2TempType,
841 HFA384x_RID_TEMPTYPE, 0, 0,
843 { DIDmib_p2_p2NIC_p2STAIdentity,
845 HFA384x_RID_STAIDENTITY, HFA384x_RID_STAIDENTITY_LEN, 0,
846 prism2mib_uint32array },
847 { DIDmib_p2_p2NIC_p2STASupRange,
849 HFA384x_RID_STASUPRANGE, HFA384x_RID_STASUPRANGE_LEN, 0,
850 prism2mib_uint32array },
851 { DIDmib_p2_p2NIC_p2MFIActRanges,
853 HFA384x_RID_STA_MFIACTRANGES, HFA384x_RID_MFIACTRANGES_LEN, 0,
854 prism2mib_uint32array },
855 { DIDmib_p2_p2NIC_p2STACFIActRanges,
857 HFA384x_RID_STA_CFIACTRANGES, HFA384x_RID_CFIACTRANGES2_LEN, 0,
858 prism2mib_uint32array },
862 { DIDmib_p2_p2MAC_p2PortStatus,
864 HFA384x_RID_PORTSTATUS, 0, 0,
866 { DIDmib_p2_p2MAC_p2CurrentSSID,
868 HFA384x_RID_CURRENTSSID, HFA384x_RID_CURRENTSSID_LEN, 0,
869 prism2mib_bytestr2pstr },
870 { DIDmib_p2_p2MAC_p2CurrentBSSID,
872 HFA384x_RID_CURRENTBSSID, HFA384x_RID_CURRENTBSSID_LEN, 0,
873 prism2mib_bytearea2pstr },
874 { DIDmib_p2_p2MAC_p2CommsQuality,
876 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
877 prism2mib_uint32array },
878 { DIDmib_p2_p2MAC_p2CommsQualityCQ,
880 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
881 prism2mib_uint32offset },
882 { DIDmib_p2_p2MAC_p2CommsQualityASL,
884 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 1,
885 prism2mib_uint32offset },
886 { DIDmib_p2_p2MAC_p2CommsQualityANL,
888 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 2,
889 prism2mib_uint32offset },
890 { DIDmib_p2_p2MAC_p2dbmCommsQuality,
892 HFA384x_RID_DBMCOMMSQUALITY, HFA384x_RID_DBMCOMMSQUALITY_LEN, 0,
893 prism2mib_uint32array },
894 { DIDmib_p2_p2MAC_p2dbmCommsQualityCQ,
896 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
897 prism2mib_uint32offset },
898 { DIDmib_p2_p2MAC_p2dbmCommsQualityASL,
900 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 1,
901 prism2mib_uint32offset },
902 { DIDmib_p2_p2MAC_p2dbmCommsQualityANL,
904 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 2,
905 prism2mib_uint32offset },
906 { DIDmib_p2_p2MAC_p2CurrentTxRate,
908 HFA384x_RID_CURRENTTXRATE, 0, 0,
910 { DIDmib_p2_p2MAC_p2CurrentBeaconInterval,
912 HFA384x_RID_CURRENTBCNINT, 0, 0,
914 { DIDmib_p2_p2MAC_p2StaCurrentScaleThresholds,
916 HFA384x_RID_CURRENTSCALETHRESH, HFA384x_RID_STACURSCALETHRESH_LEN, 0,
917 prism2mib_uint32array },
918 { DIDmib_p2_p2MAC_p2ProtocolRspTime,
920 HFA384x_RID_PROTOCOLRSPTIME, 0, 0,
922 { DIDmib_p2_p2MAC_p2ShortRetryLimit,
924 HFA384x_RID_SHORTRETRYLIMIT, 0, 0,
926 { DIDmib_p2_p2MAC_p2LongRetryLimit,
928 HFA384x_RID_LONGRETRYLIMIT, 0, 0,
930 { DIDmib_p2_p2MAC_p2MaxTransmitLifetime,
932 HFA384x_RID_MAXTXLIFETIME, 0, 0,
934 { DIDmib_p2_p2MAC_p2MaxReceiveLifetime,
936 HFA384x_RID_MAXRXLIFETIME, 0, 0,
938 { DIDmib_p2_p2MAC_p2CFPollable,
940 HFA384x_RID_CFPOLLABLE, 0, 0,
942 { DIDmib_p2_p2MAC_p2AuthenticationAlgorithms,
944 HFA384x_RID_AUTHALGORITHMS, HFA384x_RID_AUTHALGORITHMS_LEN, 0,
945 prism2mib_uint32array },
946 { DIDmib_p2_p2MAC_p2PrivacyOptionImplemented,
948 HFA384x_RID_PRIVACYOPTIMP, 0, 0,
953 { DIDmib_p2_p2Modem_p2PHYType,
955 HFA384x_RID_PHYTYPE, 0, 0,
957 { DIDmib_p2_p2Modem_p2CurrentChannel,
959 HFA384x_RID_CURRENTCHANNEL, 0, 0,
961 { DIDmib_p2_p2Modem_p2CurrentPowerState,
963 HFA384x_RID_CURRENTPOWERSTATE, 0, 0,
965 { DIDmib_p2_p2Modem_p2CCAMode,
967 HFA384x_RID_CCAMODE, 0, 0,
969 { DIDmib_p2_p2Modem_p2TxPowerMax,
970 F_STA | F_READ | F_WRITE,
971 HFA384x_RID_TXPOWERMAX, 0, 0,
973 { DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel,
974 F_STA | F_READ | F_WRITE,
975 HFA384x_RID_TXPOWERMAX, 0, 0,
977 { DIDmib_p2_p2Modem_p2SupportedDataRates,
979 HFA384x_RID_SUPPORTEDDATARATES, HFA384x_RID_SUPPORTEDDATARATES_LEN, 0,
980 prism2mib_bytestr2pstr },
982 /* And finally, lnx mibs */
983 { DIDmib_lnx_lnxConfigTable_lnxRSNAIE,
984 F_STA | F_READ | F_WRITE,
985 HFA384x_RID_CNFWPADATA, 0, 0,
987 { 0, 0, 0, 0, 0, NULL}};
989 /*----------------------------------------------------------------
990 These MIB's are not supported at this time:
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
1001 DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportValue
1002 TODO: need to investigate why wlan has this as enumerated and Prism2 has this
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.
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
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
1035 TODO: implement sane values for these.
1036 DIDmib_dot11mac_dot11OperationTable_dot11ManufacturerID
1037 DIDmib_dot11mac_dot11OperationTable_dot11ProductID
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
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
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
1075 ------------------------------------------------------------------*/
1077 /*================================================================*/
1078 /* Function Definitions */
1080 /*----------------------------------------------------------------
1081 * prism2mgmt_mibset_mibget
1083 * Set the value of a mib item.
1086 * wlandev wlan device structure
1087 * msgp ptr to msg buffer
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.
1096 * process thread (usually)
1098 ----------------------------------------------------------------*/
1100 int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp)
1102 hfa384x_t *hw = wlandev->priv;
1108 p80211msg_dot11req_mibset_t *msg = msgp;
1109 p80211itemd_t *mibitem;
1113 msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
1114 msg->resultcode.data = P80211ENUM_resultcode_success;
1117 ** Determine if this is an Access Point or a station.
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
1129 mibitem = (p80211itemd_t *) msg->mibattribute.data;
1131 for (mib = mibtab; mib->did != 0; mib++)
1132 if (mib->did == mibitem->did && (mib->flag & which))
1135 if (mib->did == 0) {
1136 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
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.
1146 isget = (msg->msgcode == DIDmsg_dot11req_mibget);
1149 if (!(mib->flag & F_READ)) {
1150 msg->resultcode.data =
1151 P80211ENUM_resultcode_cant_get_writeonly_mib;
1155 if (!(mib->flag & F_WRITE)) {
1156 msg->resultcode.data =
1157 P80211ENUM_resultcode_cant_set_readonly_mib;
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".
1170 result = mib->func(mib, isget, wlandev, hw, msg,
1171 (void *) mibitem->data);
1173 if (msg->resultcode.data == P80211ENUM_resultcode_success) {
1175 WLAN_LOG_DEBUG(1, "get/set failure, result=%d\n",
1177 msg->resultcode.data =
1178 P80211ENUM_resultcode_implementation_failure;
1181 msg->mibattribute.status =
1182 P80211ENUM_msgitem_status_data_ok;
1184 P80211ENUM_msgitem_status_data_ok;
1195 /*----------------------------------------------------------------
1196 * prism2mib_bytestr2pstr
1198 * Get/set pstr data to/from a byte string.
1200 * MIB record parameters:
1201 * parm1 Prism2 RID value.
1202 * parm2 Number of bytes of RID data.
1207 * isget MIBGET/MIBSET flag.
1208 * wlandev wlan device structure.
1209 * priv "priv" structure.
1210 * hw "hw" structure.
1211 * msg Message structure.
1218 ----------------------------------------------------------------*/
1220 static int prism2mib_bytestr2pstr(
1223 wlandevice_t *wlandev,
1225 p80211msg_dot11req_mibset_t *msg,
1229 p80211pstrd_t *pstr = (p80211pstrd_t*) data;
1230 UINT8 bytebuf[MIB_TMP_MAXLEN];
1231 hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*) bytebuf;
1236 result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2);
1237 prism2mgmt_bytestr2pstr(p2bytestr, pstr);
1239 memset(bytebuf, 0, mib->parm2);
1240 prism2mgmt_pstr2bytestr(p2bytestr, pstr);
1241 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
1248 /*----------------------------------------------------------------
1249 * prism2mib_bytearea2pstr
1251 * Get/set pstr data to/from a byte area.
1253 * MIB record parameters:
1254 * parm1 Prism2 RID value.
1255 * parm2 Number of bytes of RID data.
1260 * isget MIBGET/MIBSET flag.
1261 * wlandev wlan device structure.
1262 * priv "priv" structure.
1263 * hw "hw" structure.
1264 * msg Message structure.
1271 ----------------------------------------------------------------*/
1273 static int prism2mib_bytearea2pstr(
1276 wlandevice_t *wlandev,
1278 p80211msg_dot11req_mibset_t *msg,
1282 p80211pstrd_t *pstr = (p80211pstrd_t*) data;
1283 UINT8 bytebuf[MIB_TMP_MAXLEN];
1288 result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2);
1289 prism2mgmt_bytearea2pstr(bytebuf, pstr, mib->parm2);
1291 memset(bytebuf, 0, mib->parm2);
1292 prism2mgmt_pstr2bytearea(bytebuf, pstr);
1293 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
1300 /*----------------------------------------------------------------
1303 * Get/set uint32 data.
1305 * MIB record parameters:
1306 * parm1 Prism2 RID value.
1312 * isget MIBGET/MIBSET flag.
1313 * wlandev wlan device structure.
1314 * priv "priv" structure.
1315 * hw "hw" structure.
1316 * msg Message structure.
1323 ----------------------------------------------------------------*/
1325 static int prism2mib_uint32(
1328 wlandevice_t *wlandev,
1330 p80211msg_dot11req_mibset_t *msg,
1334 UINT32 *uint32 = (UINT32*) data;
1335 UINT8 bytebuf[MIB_TMP_MAXLEN];
1336 UINT16 *wordbuf = (UINT16*) bytebuf;
1341 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1343 /* [MSM] Removed, getconfig16 returns the value in host order.
1344 * prism2mgmt_prism2int2p80211int(wordbuf, uint32);
1347 /* [MSM] Removed, setconfig16 expects host order.
1348 * prism2mgmt_p80211int2prism2int(wordbuf, uint32);
1351 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1358 /*----------------------------------------------------------------
1359 * prism2mib_uint32array
1361 * Get/set an array of uint32 data.
1363 * MIB record parameters:
1364 * parm1 Prism2 RID value.
1365 * parm2 Number of bytes of RID data.
1370 * isget MIBGET/MIBSET flag.
1371 * wlandev wlan device structure.
1372 * priv "priv" structure.
1373 * hw "hw" structure.
1374 * msg Message structure.
1381 ----------------------------------------------------------------*/
1383 static int prism2mib_uint32array(
1386 wlandevice_t *wlandev,
1388 p80211msg_dot11req_mibset_t *msg,
1392 UINT32 *uint32 = (UINT32 *) data;
1393 UINT8 bytebuf[MIB_TMP_MAXLEN];
1394 UINT16 *wordbuf = (UINT16*) bytebuf;
1399 cnt = mib->parm2 / sizeof(UINT16);
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);
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);
1415 /*----------------------------------------------------------------
1416 * prism2mib_uint32offset
1418 * Get/set a single element in an array of uint32 data.
1420 * MIB record parameters:
1421 * parm1 Prism2 RID value.
1422 * parm2 Number of bytes of RID data.
1423 * parm3 Element index.
1427 * isget MIBGET/MIBSET flag.
1428 * wlandev wlan device structure.
1429 * priv "priv" structure.
1430 * hw "hw" structure.
1431 * msg Message structure.
1438 ----------------------------------------------------------------*/
1440 static int prism2mib_uint32offset(
1443 wlandevice_t *wlandev,
1445 p80211msg_dot11req_mibset_t *msg,
1449 UINT32 *uint32 = (UINT32*) data;
1450 UINT8 bytebuf[MIB_TMP_MAXLEN];
1451 UINT16 *wordbuf = (UINT16*) bytebuf;
1456 cnt = mib->parm2 / sizeof(UINT16);
1458 result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
1461 if (mib->parm3 < cnt)
1462 prism2mgmt_prism2int2p80211int(wordbuf+mib->parm3, uint32);
1466 if (mib->parm3 < cnt) {
1467 prism2mgmt_p80211int2prism2int(wordbuf+mib->parm3, uint32);
1468 result = hfa384x_drvr_setconfig(hw, mib->parm1, wordbuf, mib->parm2);
1477 /*----------------------------------------------------------------
1480 * Get/set truth data.
1482 * MIB record parameters:
1483 * parm1 Prism2 RID value.
1489 * isget MIBGET/MIBSET flag.
1490 * wlandev wlan device structure.
1491 * priv "priv" structure.
1492 * hw "hw" structure.
1493 * msg Message structure.
1500 ----------------------------------------------------------------*/
1502 static int prism2mib_truth(
1505 wlandevice_t *wlandev,
1507 p80211msg_dot11req_mibset_t *msg,
1511 UINT32 *uint32 = (UINT32*) data;
1512 UINT8 bytebuf[MIB_TMP_MAXLEN];
1513 UINT16 *wordbuf = (UINT16*) bytebuf;
1518 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1519 *uint32 = (*wordbuf) ?
1520 P80211ENUM_truth_true : P80211ENUM_truth_false;
1522 *wordbuf = ((*uint32) == P80211ENUM_truth_true) ? 1 : 0;
1523 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1530 /*----------------------------------------------------------------
1535 * MIB record parameters:
1536 * parm1 Prism2 RID value.
1537 * parm2 Bit to get/set.
1542 * isget MIBGET/MIBSET flag.
1543 * wlandev wlan device structure.
1544 * priv "priv" structure.
1545 * hw "hw" structure.
1546 * msg Message structure.
1553 ----------------------------------------------------------------*/
1555 static int prism2mib_flag(
1558 wlandevice_t *wlandev,
1560 p80211msg_dot11req_mibset_t *msg,
1564 UINT32 *uint32 = (UINT32*) data;
1565 UINT8 bytebuf[MIB_TMP_MAXLEN];
1566 UINT16 *wordbuf = (UINT16*) bytebuf;
1571 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1573 /* [MSM] Removed, getconfig16 returns the value in host order.
1574 * prism2mgmt_prism2int2p80211int(wordbuf, &flags);
1578 *uint32 = (flags & mib->parm2) ?
1579 P80211ENUM_truth_true : P80211ENUM_truth_false;
1581 if ((*uint32) == P80211ENUM_truth_true)
1582 flags |= mib->parm2;
1584 flags &= ~mib->parm2;
1585 /* [MSM] Removed, setconfig16 expects host order.
1586 * prism2mgmt_p80211int2prism2int(wordbuf, &flags);
1589 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1597 /*----------------------------------------------------------------
1598 * prism2mib_regulatorydomains
1600 * Get regulatory domain data.
1602 * MIB record parameters:
1603 * parm1 Prism2 RID value.
1604 * parm2 Number of bytes of RID data.
1609 * isget MIBGET/MIBSET flag.
1610 * wlandev wlan device structure.
1611 * priv "priv" structure.
1612 * hw "hw" structure.
1613 * msg Message structure.
1620 ----------------------------------------------------------------*/
1622 static int prism2mib_regulatorydomains(
1625 wlandevice_t *wlandev,
1627 p80211msg_dot11req_mibset_t *msg,
1632 p80211pstrd_t *pstr = (p80211pstrd_t*) data;
1633 UINT8 bytebuf[MIB_TMP_MAXLEN];
1634 UINT16 *wordbuf = (UINT16*) bytebuf;
1641 result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
1642 prism2mgmt_prism2int2p80211int(wordbuf, &cnt);
1643 pstr->len = (UINT8) cnt;
1644 memcpy(pstr->data, &wordbuf[1], pstr->len);
1651 /*----------------------------------------------------------------
1652 * prism2mib_wepdefaultkey
1654 * Get/set WEP default keys.
1656 * MIB record parameters:
1657 * parm1 Prism2 RID value.
1658 * parm2 Number of bytes of RID data.
1663 * isget MIBGET/MIBSET flag.
1664 * wlandev wlan device structure.
1665 * priv "priv" structure.
1666 * hw "hw" structure.
1667 * msg Message structure.
1674 ----------------------------------------------------------------*/
1676 static int prism2mib_wepdefaultkey(
1679 wlandevice_t *wlandev,
1681 p80211msg_dot11req_mibset_t *msg,
1685 p80211pstrd_t *pstr = (p80211pstrd_t*) data;
1686 UINT8 bytebuf[MIB_TMP_MAXLEN];
1692 result = 0; /* Should never happen. */
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);
1705 /*----------------------------------------------------------------
1706 * prism2mib_powermanagement
1708 * Get/set 802.11 power management value. Note that this is defined differently
1709 * by 802.11 and Prism2:
1711 * Meaning 802.11 Prism2
1715 * MIB record parameters:
1716 * parm1 Prism2 RID value.
1722 * isget MIBGET/MIBSET flag.
1723 * wlandev wlan device structure.
1724 * priv "priv" structure.
1725 * hw "hw" structure.
1726 * msg Message structure.
1733 ----------------------------------------------------------------*/
1735 static int prism2mib_powermanagement(
1738 wlandevice_t *wlandev,
1740 p80211msg_dot11req_mibset_t *msg,
1744 UINT32 *uint32 = (UINT32*) data;
1750 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value);
1751 *uint32 = (value == 0) ? 1 : 2;
1753 value = ((*uint32) == 1) ? 0 : 1;
1754 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value);
1761 /*----------------------------------------------------------------
1762 * prism2mib_preamble
1764 * Get/set Prism2 short preamble
1766 * MIB record parameters:
1767 * parm1 Prism2 RID value.
1773 * isget MIBGET/MIBSET flag.
1774 * wlandev wlan device structure.
1775 * priv "priv" structure.
1776 * hw "hw" structure.
1777 * msg Message structure.
1784 ----------------------------------------------------------------*/
1786 static int prism2mib_preamble(
1789 wlandevice_t *wlandev,
1791 p80211msg_dot11req_mibset_t *msg,
1795 UINT32 *uint32 = (UINT32*) data;
1796 UINT8 bytebuf[MIB_TMP_MAXLEN];
1797 UINT16 *wordbuf = (UINT16*) bytebuf;
1802 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1806 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1813 /*----------------------------------------------------------------
1814 * prism2mib_privacyinvoked
1816 * Get/set the dot11PrivacyInvoked value.
1818 * MIB record parameters:
1819 * parm1 Prism2 RID value.
1820 * parm2 Bit value for PrivacyInvoked flag.
1825 * isget MIBGET/MIBSET flag.
1826 * wlandev wlan device structure.
1827 * priv "priv" structure.
1828 * hw "hw" structure.
1829 * msg Message structure.
1836 ----------------------------------------------------------------*/
1838 static int prism2mib_privacyinvoked(
1841 wlandevice_t *wlandev,
1843 p80211msg_dot11req_mibset_t *msg,
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;
1857 result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
1863 /*----------------------------------------------------------------
1864 * prism2mib_excludeunencrypted
1866 * Get/set the dot11ExcludeUnencrypted value.
1868 * MIB record parameters:
1869 * parm1 Prism2 RID value.
1870 * parm2 Bit value for ExcludeUnencrypted flag.
1875 * isget MIBGET/MIBSET flag.
1876 * wlandev wlan device structure.
1877 * priv "priv" structure.
1878 * hw "hw" structure.
1879 * msg Message structure.
1886 ----------------------------------------------------------------*/
1888 static int prism2mib_excludeunencrypted(
1891 wlandevice_t *wlandev,
1893 p80211msg_dot11req_mibset_t *msg,
1900 result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
1906 /*----------------------------------------------------------------
1907 * prism2mib_fragmentationthreshold
1909 * Get/set the fragmentation threshold.
1911 * MIB record parameters:
1912 * parm1 Prism2 RID value.
1918 * isget MIBGET/MIBSET flag.
1919 * wlandev wlan device structure.
1920 * priv "priv" structure.
1921 * hw "hw" structure.
1922 * msg Message structure.
1929 ----------------------------------------------------------------*/
1931 static int prism2mib_fragmentationthreshold(
1934 wlandevice_t *wlandev,
1936 p80211msg_dot11req_mibset_t *msg,
1940 UINT32 *uint32 = (UINT32*) data;
1945 if ((*uint32) % 2) {
1946 WLAN_LOG_WARNING("Attempt to set odd number "
1947 "FragmentationThreshold\n");
1948 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
1952 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, data);
1958 /*----------------------------------------------------------------
1959 * prism2mib_operationalrateset
1961 * Get/set the operational rate set.
1963 * MIB record parameters:
1964 * parm1 Prism2 RID value.
1970 * isget MIBGET/MIBSET flag.
1971 * wlandev wlan device structure.
1972 * priv "priv" structure.
1973 * hw "hw" structure.
1974 * msg Message structure.
1981 ----------------------------------------------------------------*/
1983 static int prism2mib_operationalrateset(
1986 wlandevice_t *wlandev,
1988 p80211msg_dot11req_mibset_t *msg,
1992 p80211pstrd_t *pstr = (p80211pstrd_t *) data;
1993 UINT8 bytebuf[MIB_TMP_MAXLEN];
1994 UINT16 *wordbuf = (UINT16*) bytebuf;
1999 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
2000 prism2mgmt_get_oprateset(wordbuf, pstr);
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);
2011 /*----------------------------------------------------------------
2012 * prism2mib_groupaddress
2014 * Get/set the dot11GroupAddressesTable.
2016 * MIB record parameters:
2023 * isget MIBGET/MIBSET flag.
2024 * wlandev wlan device structure.
2025 * priv "priv" structure.
2026 * hw "hw" structure.
2027 * msg Message structure.
2034 ----------------------------------------------------------------*/
2036 static int prism2mib_groupaddress(
2039 wlandevice_t *wlandev,
2041 p80211msg_dot11req_mibset_t *msg,
2045 p80211pstrd_t *pstr = (p80211pstrd_t *) data;
2046 UINT8 bytebuf[MIB_TMP_MAXLEN];
2051 /* TODO: fix this. f/w doesn't support mcast filters */
2054 prism2mgmt_get_grpaddr(mib->did, pstr, hw);
2058 result = prism2mgmt_set_grpaddr(mib->did, bytebuf, pstr, hw);
2060 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
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);
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
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);
2084 ** Clear group addresses in card and set to promiscuous mode.
2087 memset(bytebuf, 0, sizeof(bytebuf));
2088 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_GROUPADDR,
2091 result = hfa384x_drvr_setconfig16(hw,
2092 HFA384x_RID_PROMISCMODE, 1);
2100 /*----------------------------------------------------------------
2103 * Get the firmware ID.
2105 * MIB record parameters:
2112 * isget MIBGET/MIBSET flag.
2113 * wlandev wlan device structure.
2114 * priv "priv" structure.
2115 * hw "hw" structure.
2116 * msg Message structure.
2123 ----------------------------------------------------------------*/
2125 static int prism2mib_fwid(
2128 wlandevice_t *wlandev,
2130 p80211msg_dot11req_mibset_t *msg,
2134 p80211pstrd_t *pstr = (p80211pstrd_t *) data;
2135 hfa384x_FWID_t fwid;
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);
2147 fwid.secondary[HFA384x_FWID_LEN - 1] = '\0';
2148 pstr->len = strlen(fwid.secondary);
2149 memcpy(pstr->data, fwid.secondary, pstr->len);
2152 result = 0; /* Should never happen. */
2158 /*----------------------------------------------------------------
2161 * Get values from the AuhtenticationAlgorithmsTable.
2163 * MIB record parameters:
2164 * parm1 Table index (1-6).
2170 * isget MIBGET/MIBSET flag.
2171 * wlandev wlan device structure.
2172 * priv "priv" structure.
2173 * hw "hw" structure.
2174 * msg Message structure.
2181 ----------------------------------------------------------------*/
2183 static int prism2mib_authalg(
2186 wlandevice_t *wlandev,
2188 p80211msg_dot11req_mibset_t *msg,
2191 UINT32 *uint32 = (UINT32*) data;
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.
2202 msg->resultcode.data = P80211ENUM_resultcode_success;
2203 switch (mib->parm1) {
2204 case 1: /* Open System */
2205 *uint32 = P80211ENUM_authalg_opensystem;
2207 case 2: /* SharedKey */
2208 *uint32 = P80211ENUM_authalg_sharedkey;
2212 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2221 /*----------------------------------------------------------------
2222 * prism2mib_authalgenable
2224 * Get/set the enable values from the AuhtenticationAlgorithmsTable.
2226 * MIB record parameters:
2227 * parm1 Table index (1-6).
2233 * isget MIBGET/MIBSET flag.
2234 * wlandev wlan device structure.
2235 * priv "priv" structure.
2236 * hw "hw" structure.
2237 * msg Message structure.
2244 ----------------------------------------------------------------*/
2246 static int prism2mib_authalgenable(
2249 wlandevice_t *wlandev,
2251 p80211msg_dot11req_mibset_t *msg,
2255 UINT32 *uint32 = (UINT32*) data;
2263 index = mib->parm1 - 1;
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);
2270 if ( index == 0 || index == 1 ) {
2271 *uint32 = (cnf_auth & (1<<index)) ?
2272 P80211ENUM_truth_true: P80211ENUM_truth_false;
2274 *uint32 = P80211ENUM_truth_false;
2275 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2278 if ( index == 0 || index == 1 ) {
2280 if (*uint32==P80211ENUM_truth_true ) {
2285 result = hfa384x_drvr_setconfig16( hw,
2286 HFA384x_RID_CNFAUTHENTICATION, cnf_auth);
2287 WLAN_LOG_DEBUG(2,"cnfAuthentication:=%d\n", cnf_auth);
2289 WLAN_LOG_DEBUG(1,"Unable to set p2cnfAuthentication to %d\n", cnf_auth);
2290 msg->resultcode.data = P80211ENUM_resultcode_implementation_failure;
2293 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2301 /*----------------------------------------------------------------
2304 * Get/set values in the "priv" data structure.
2306 * MIB record parameters:
2313 * isget MIBGET/MIBSET flag.
2314 * wlandev wlan device structure.
2315 * priv "priv" structure.
2316 * hw "hw" structure.
2317 * msg Message structure.
2324 ----------------------------------------------------------------*/
2326 static int prism2mib_priv(
2329 wlandevice_t *wlandev,
2331 p80211msg_dot11req_mibset_t *msg,
2334 UINT32 *uint32 = (UINT32*) data;
2335 p80211pstrd_t *pstr = (p80211pstrd_t*) data;
2340 ** "test" is a lot longer than necessary but who cares? ...as long as
2341 ** it is long enough!
2344 UINT8 test[sizeof(wlandev->rx) + sizeof(hw->tallies)];
2349 case DIDmib_p2_p2Table_p2ReceivedFrameStatistics:
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.
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;
2375 case DIDmib_p2_p2Table_p2CommunicationTallies:
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.
2385 result = hfa384x_drvr_commtallies(hw);
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
2400 /* Ugh, this is nasty. */
2401 for (i = 0; i < 10; i++) {
2404 sizeof(hw->tallies));
2407 sizeof(hw->tallies));
2410 sizeof(hw->tallies)) == 0)
2417 case DIDmib_p2_p2Table_p2Comment:
2420 pstr->len = strlen(hw->comment);
2421 memcpy(pstr->data, hw->comment, 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';
2433 case DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType:
2436 *uint32 = hw->dot11_desired_bss_type;
2438 hw->dot11_desired_bss_type = *uint32;
2442 case DIDmib_lnx_lnxConfigTable_lnxRSNAIE: {
2443 hfa384x_WPAData_t wpa;
2445 hfa384x_drvr_getconfig( hw, HFA384x_RID_CNFWPADATA,
2446 (UINT8 *) &wpa, sizeof(wpa));
2447 pstr->len = hfa384x2host_16(wpa.datalen);
2448 memcpy(pstr->data, wpa.data, pstr->len);
2450 wpa.datalen = host2hfa384x_16(pstr->len);
2451 memcpy(wpa.data, pstr->data, pstr->len);
2453 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFWPADATA,
2454 (UINT8 *) &wpa, sizeof(wpa));
2459 WLAN_LOG_ERROR("Unhandled DID 0x%08x\n", mib->did);
2466 /*----------------------------------------------------------------
2467 * prism2mgmt_pstr2bytestr
2469 * Convert the pstr data in the WLAN message structure into an hfa384x
2470 * byte string format.
2473 * bytestr hfa384x byte string data type
2474 * pstr wlan message data
2479 ----------------------------------------------------------------*/
2481 void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
2485 bytestr->len = host2hfa384x_16((UINT16)(pstr->len));
2486 memcpy(bytestr->data, pstr->data, pstr->len);
2491 /*----------------------------------------------------------------
2492 * prism2mgmt_pstr2bytearea
2494 * Convert the pstr data in the WLAN message structure into an hfa384x
2498 * bytearea hfa384x byte area data type
2499 * pstr wlan message data
2504 ----------------------------------------------------------------*/
2506 void prism2mgmt_pstr2bytearea(UINT8 *bytearea, p80211pstrd_t *pstr)
2510 memcpy(bytearea, pstr->data, pstr->len);
2515 /*----------------------------------------------------------------
2516 * prism2mgmt_bytestr2pstr
2518 * Convert the data in an hfa384x byte string format into a
2519 * pstr in the WLAN message.
2522 * bytestr hfa384x byte string data type
2528 ----------------------------------------------------------------*/
2530 void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
2534 pstr->len = (UINT8)(hfa384x2host_16((UINT16)(bytestr->len)));
2535 memcpy(pstr->data, bytestr->data, pstr->len);
2540 /*----------------------------------------------------------------
2541 * prism2mgmt_bytearea2pstr
2543 * Convert the data in an hfa384x byte area format into a pstr
2544 * in the WLAN message.
2547 * bytearea hfa384x byte area data type
2553 ----------------------------------------------------------------*/
2555 void prism2mgmt_bytearea2pstr(UINT8 *bytearea, p80211pstrd_t *pstr, int len)
2559 pstr->len = (UINT8)len;
2560 memcpy(pstr->data, bytearea, len);
2565 /*----------------------------------------------------------------
2566 * prism2mgmt_prism2int2p80211int
2568 * Convert an hfa384x integer into a wlan integer
2571 * prism2enum pointer to hfa384x integer
2572 * wlanenum pointer to p80211 integer
2577 ----------------------------------------------------------------*/
2579 void prism2mgmt_prism2int2p80211int(UINT16 *prism2int, UINT32 *wlanint)
2583 *wlanint = (UINT32)hfa384x2host_16(*prism2int);
2588 /*----------------------------------------------------------------
2589 * prism2mgmt_p80211int2prism2int
2591 * Convert a wlan integer into an hfa384x integer
2594 * prism2enum pointer to hfa384x integer
2595 * wlanenum pointer to p80211 integer
2600 ----------------------------------------------------------------*/
2602 void prism2mgmt_p80211int2prism2int(UINT16 *prism2int, UINT32 *wlanint)
2606 *prism2int = host2hfa384x_16((UINT16)(*wlanint));
2611 /*----------------------------------------------------------------
2612 * prism2mgmt_prism2enum2p80211enum
2614 * Convert the hfa384x enumerated int into a p80211 enumerated int
2617 * prism2enum pointer to hfa384x integer
2618 * wlanenum pointer to p80211 integer
2619 * rid hfa384x record id
2624 ----------------------------------------------------------------*/
2625 void prism2mgmt_prism2enum2p80211enum(UINT16 *prism2enum, UINT32 *wlanenum, UINT16 rid)
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*/
2637 /*----------------------------------------------------------------
2638 * prism2mgmt_p80211enum2prism2enum
2640 * Convert the p80211 enumerated int into an hfa384x enumerated int
2643 * prism2enum pointer to hfa384x integer
2644 * wlanenum pointer to p80211 integer
2645 * rid hfa384x record id
2650 ----------------------------------------------------------------*/
2651 void prism2mgmt_p80211enum2prism2enum(UINT16 *prism2enum, UINT32 *wlanenum, UINT16 rid)
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*/
2664 /*----------------------------------------------------------------
2665 * prism2mgmt_get_oprateset
2667 * Convert the hfa384x bit area into a wlan octet string.
2670 * rate Prism2 bit area
2671 * pstr wlan octet string
2676 ----------------------------------------------------------------*/
2677 void prism2mgmt_get_oprateset(UINT16 *rate, p80211pstrd_t *pstr)
2685 datarate = pstr->data;
2688 if ( BIT0 & (*rate) ) {
2690 *datarate = (UINT8)2;
2695 if ( BIT1 & (*rate) ) {
2697 *datarate = (UINT8)4;
2702 if ( BIT2 & (*rate) ) {
2704 *datarate = (UINT8)11;
2709 if ( BIT3 & (*rate) ) {
2711 *datarate = (UINT8)22;
2723 /*----------------------------------------------------------------
2724 * prism2mgmt_set_oprateset
2726 * Convert the wlan octet string into an hfa384x bit area.
2729 * rate Prism2 bit area
2730 * pstr wlan octet string
2735 ----------------------------------------------------------------*/
2736 void prism2mgmt_set_oprateset(UINT16 *rate, p80211pstrd_t *pstr)
2745 datarate = pstr->data;
2747 for ( i=0; i < pstr->len; i++, datarate++ ) {
2748 switch (*datarate) {
2749 case 2: /* 1 Mbps */
2752 case 4: /* 2 Mbps */
2755 case 11: /* 5.5 Mbps */
2758 case 22: /* 11 Mbps */
2762 WLAN_LOG_DEBUG(1, "Unrecoginzed Rate of %d\n",
2774 /*----------------------------------------------------------------
2775 * prism2mgmt_get_grpaddr
2777 * Retrieves a particular group address from the list of
2782 * pstr wlan octet string
2783 * priv prism2 driver private data structure
2788 ----------------------------------------------------------------*/
2789 void prism2mgmt_get_grpaddr(UINT32 did, p80211pstrd_t *pstr,
2796 index = prism2mgmt_get_grpaddr_index(did);
2799 pstr->len = WLAN_ADDR_LEN;
2800 memcpy(pstr->data, hw->dot11_grp_addr[index],
2810 /*----------------------------------------------------------------
2811 * prism2mgmt_set_grpaddr
2813 * Convert the wlan octet string into an hfa384x bit area.
2824 ----------------------------------------------------------------*/
2825 int prism2mgmt_set_grpaddr(UINT32 did, UINT8 *prism2buf,
2826 p80211pstrd_t *pstr, hfa384x_t *hw )
2828 UINT8 no_addr[WLAN_ADDR_LEN];
2833 memset(no_addr, 0, WLAN_ADDR_LEN);
2834 if (memcmp(no_addr, pstr->data, WLAN_ADDR_LEN) != 0) {
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
2845 if (hw->dot11_grpcnt >= MAX_GRP_ADDR) return(-1);
2847 memcpy(hw->dot11_grp_addr[hw->dot11_grpcnt], pstr->data,
2849 hw->dot11_grpcnt += 1;
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.
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,
2878 /*----------------------------------------------------------------
2879 * prism2mgmt_get_grpaddr_index
2881 * Gets the index in the group address list based on the did.
2888 * < 0 If not valid did
2890 ----------------------------------------------------------------*/
2891 int prism2mgmt_get_grpaddr_index( UINT32 did )
2900 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1:
2903 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2:
2906 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3:
2909 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4:
2912 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5:
2915 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6:
2918 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7:
2921 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8:
2924 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9:
2927 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10:
2930 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11:
2933 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12:
2936 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13:
2939 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14:
2942 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15:
2945 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16:
2948 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17:
2951 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18:
2954 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19:
2957 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20:
2960 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21:
2963 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22:
2966 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23:
2969 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24:
2972 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25:
2975 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26:
2978 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27:
2981 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28:
2984 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29:
2987 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30:
2990 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31:
2993 case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32: