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_fwid(
238 wlandevice_t *wlandev,
240 p80211msg_dot11req_mibset_t *msg,
243 static int prism2mib_authalg(
246 wlandevice_t *wlandev,
248 p80211msg_dot11req_mibset_t *msg,
251 static int prism2mib_authalgenable(
254 wlandevice_t *wlandev,
256 p80211msg_dot11req_mibset_t *msg,
259 static int prism2mib_priv(
262 wlandevice_t *wlandev,
264 p80211msg_dot11req_mibset_t *msg,
267 /*================================================================*/
268 /* Local Static Definitions */
270 static mibrec_t mibtab[] = {
274 { DIDmib_dot11smt_dot11StationConfigTable_dot11StationID,
275 F_STA | F_READ | F_WRITE,
276 HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
277 prism2mib_bytearea2pstr },
278 { DIDmib_dot11smt_dot11StationConfigTable_dot11CFPollable,
280 HFA384x_RID_CFPOLLABLE, 0, 0,
282 { DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticationResponseTimeOut,
283 F_STA | F_READ | F_WRITE,
284 HFA384x_RID_CNFAUTHRSPTIMEOUT, 0, 0,
286 { DIDmib_dot11smt_dot11StationConfigTable_dot11PrivacyOptionImplemented,
288 HFA384x_RID_PRIVACYOPTIMP, 0, 0,
290 { DIDmib_dot11smt_dot11StationConfigTable_dot11PowerManagementMode,
291 F_STA | F_READ | F_WRITE,
292 HFA384x_RID_CNFPMENABLED, 0, 0,
293 prism2mib_powermanagement },
294 { DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredSSID,
295 F_STA | F_READ | F_WRITE,
296 HFA384x_RID_CNFDESIREDSSID, HFA384x_RID_CNFDESIREDSSID_LEN, 0,
297 prism2mib_bytestr2pstr },
298 { DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType,
299 F_STA | F_READ | F_WRITE,
302 { DIDmib_dot11smt_dot11StationConfigTable_dot11OperationalRateSet,
303 F_STA | F_READ | F_WRITE,
304 HFA384x_RID_TXRATECNTL, 0, 0,
305 prism2mib_operationalrateset },
306 { DIDmib_dot11smt_dot11StationConfigTable_dot11DTIMPeriod,
307 F_STA | F_READ | F_WRITE,
308 HFA384x_RID_CNFOWNDTIMPER, 0, 0,
310 { DIDmib_dot11smt_dot11StationConfigTable_dot11AssociationResponseTimeOut,
312 HFA384x_RID_PROTOCOLRSPTIME, 0, 0,
314 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm1,
318 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm2,
322 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm3,
326 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm4,
330 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm5,
334 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm6,
338 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable1,
339 F_STA | F_READ | F_WRITE,
341 prism2mib_authalgenable },
342 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable2,
343 F_STA | F_READ | F_WRITE,
345 prism2mib_authalgenable },
346 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable3,
347 F_STA | F_READ | F_WRITE,
349 prism2mib_authalgenable },
350 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable4,
351 F_STA | F_READ | F_WRITE,
353 prism2mib_authalgenable },
354 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable5,
355 F_STA | F_READ | F_WRITE,
357 prism2mib_authalgenable },
358 { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable6,
359 F_STA | F_READ | F_WRITE,
361 prism2mib_authalgenable },
362 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0,
364 HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0,
365 prism2mib_wepdefaultkey },
366 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1,
368 HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0,
369 prism2mib_wepdefaultkey },
370 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2,
372 HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0,
373 prism2mib_wepdefaultkey },
374 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3,
376 HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0,
377 prism2mib_wepdefaultkey },
378 { DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
379 F_STA | F_READ | F_WRITE,
380 HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_PRIVINVOKED, 0,
381 prism2mib_privacyinvoked },
382 { DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
383 F_STA | F_READ | F_WRITE,
384 HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0,
386 { DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
387 F_STA | F_READ | F_WRITE,
388 HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_EXCLUDE, 0,
389 prism2mib_excludeunencrypted },
390 { DIDmib_dot11phy_dot11PhyOperationTable_dot11ShortPreambleEnabled,
391 F_STA | F_READ | F_WRITE,
392 HFA384x_RID_CNFSHORTPREAMBLE, 0, 0,
393 prism2mib_preamble },
397 { DIDmib_dot11mac_dot11OperationTable_dot11MACAddress,
398 F_STA | F_READ | F_WRITE,
399 HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
400 prism2mib_bytearea2pstr },
401 { DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold,
402 F_STA | F_READ | F_WRITE,
403 HFA384x_RID_RTSTHRESH, 0, 0,
405 { DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit,
407 HFA384x_RID_SHORTRETRYLIMIT, 0, 0,
409 { DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit,
411 HFA384x_RID_LONGRETRYLIMIT, 0, 0,
413 { DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold,
414 F_STA | F_READ | F_WRITE,
415 HFA384x_RID_FRAGTHRESH, 0, 0,
416 prism2mib_fragmentationthreshold },
417 { DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime,
419 HFA384x_RID_MAXTXLIFETIME, 0, 0,
421 { DIDmib_dot11mac_dot11OperationTable_dot11MaxReceiveLifetime,
423 HFA384x_RID_MAXRXLIFETIME, 0, 0,
428 { DIDmib_dot11phy_dot11PhyOperationTable_dot11PHYType,
430 HFA384x_RID_PHYTYPE, 0, 0,
432 { DIDmib_dot11phy_dot11PhyOperationTable_dot11TempType,
434 HFA384x_RID_TEMPTYPE, 0, 0,
436 { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
438 HFA384x_RID_CURRENTCHANNEL, 0, 0,
440 { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentCCAMode,
442 HFA384x_RID_CCAMODE, 0, 0,
447 { DIDmib_p2_p2Table_p2MMTx,
448 F_STA | F_READ | F_WRITE,
451 { DIDmib_p2_p2Table_p2ReceivedFrameStatistics,
455 { DIDmib_p2_p2Table_p2CommunicationTallies,
459 { DIDmib_p2_p2Table_p2Comment,
460 F_STA | F_READ | F_WRITE,
466 { DIDmib_p2_p2Static_p2CnfPortType,
467 F_STA | F_READ | F_WRITE,
468 HFA384x_RID_CNFPORTTYPE, 0, 0,
470 { DIDmib_p2_p2Static_p2CnfOwnMACAddress,
471 F_STA | F_READ | F_WRITE,
472 HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
473 prism2mib_bytearea2pstr },
474 { DIDmib_p2_p2Static_p2CnfDesiredSSID,
475 F_STA | F_READ | F_WRITE,
476 HFA384x_RID_CNFDESIREDSSID, HFA384x_RID_CNFDESIREDSSID_LEN, 0,
477 prism2mib_bytestr2pstr },
478 { DIDmib_p2_p2Static_p2CnfOwnChannel,
479 F_STA | F_READ | F_WRITE,
480 HFA384x_RID_CNFOWNCHANNEL, 0, 0,
482 { DIDmib_p2_p2Static_p2CnfOwnSSID,
483 F_STA | F_READ | F_WRITE,
484 HFA384x_RID_CNFOWNSSID, HFA384x_RID_CNFOWNSSID_LEN, 0,
485 prism2mib_bytestr2pstr },
486 { DIDmib_p2_p2Static_p2CnfOwnATIMWindow,
487 F_STA | F_READ | F_WRITE,
488 HFA384x_RID_CNFOWNATIMWIN, 0, 0,
490 { DIDmib_p2_p2Static_p2CnfSystemScale,
491 F_STA | F_READ | F_WRITE,
492 HFA384x_RID_CNFSYSSCALE, 0, 0,
494 { DIDmib_p2_p2Static_p2CnfMaxDataLength,
495 F_STA | F_READ | F_WRITE,
496 HFA384x_RID_CNFMAXDATALEN, 0, 0,
498 { DIDmib_p2_p2Static_p2CnfWDSAddress,
499 F_STA | F_READ | F_WRITE,
500 HFA384x_RID_CNFWDSADDR, HFA384x_RID_CNFWDSADDR_LEN, 0,
501 prism2mib_bytearea2pstr },
502 { DIDmib_p2_p2Static_p2CnfPMEnabled,
503 F_STA | F_READ | F_WRITE,
504 HFA384x_RID_CNFPMENABLED, 0, 0,
506 { DIDmib_p2_p2Static_p2CnfPMEPS,
507 F_STA | F_READ | F_WRITE,
508 HFA384x_RID_CNFPMEPS, 0, 0,
510 { DIDmib_p2_p2Static_p2CnfMulticastReceive,
511 F_STA | F_READ | F_WRITE,
512 HFA384x_RID_CNFMULTICASTRX, 0, 0,
514 { DIDmib_p2_p2Static_p2CnfMaxSleepDuration,
515 F_STA | F_READ | F_WRITE,
516 HFA384x_RID_CNFMAXSLEEPDUR, 0, 0,
518 { DIDmib_p2_p2Static_p2CnfPMHoldoverDuration,
519 F_STA | F_READ | F_WRITE,
520 HFA384x_RID_CNFPMHOLDDUR, 0, 0,
522 { DIDmib_p2_p2Static_p2CnfOwnName,
523 F_STA | F_READ | F_WRITE,
524 HFA384x_RID_CNFOWNNAME, HFA384x_RID_CNFOWNNAME_LEN, 0,
525 prism2mib_bytestr2pstr },
526 { DIDmib_p2_p2Static_p2CnfOwnDTIMPeriod,
527 F_STA | F_READ | F_WRITE,
528 HFA384x_RID_CNFOWNDTIMPER, 0, 0,
530 { DIDmib_p2_p2Static_p2CnfWEPDefaultKeyID,
531 F_STA | F_READ | F_WRITE,
532 HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0,
534 { DIDmib_p2_p2Static_p2CnfWEPDefaultKey0,
536 HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0,
537 prism2mib_wepdefaultkey },
538 { DIDmib_p2_p2Static_p2CnfWEPDefaultKey1,
540 HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0,
541 prism2mib_wepdefaultkey },
542 { DIDmib_p2_p2Static_p2CnfWEPDefaultKey2,
544 HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0,
545 prism2mib_wepdefaultkey },
546 { DIDmib_p2_p2Static_p2CnfWEPDefaultKey3,
548 HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0,
549 prism2mib_wepdefaultkey },
550 { DIDmib_p2_p2Static_p2CnfWEPFlags,
551 F_STA | F_READ | F_WRITE,
552 HFA384x_RID_CNFWEPFLAGS, 0, 0,
554 { DIDmib_p2_p2Static_p2CnfAuthentication,
555 F_STA | F_READ | F_WRITE,
556 HFA384x_RID_CNFAUTHENTICATION, 0, 0,
558 { DIDmib_p2_p2Static_p2CnfTxControl,
559 F_STA | F_READ | F_WRITE,
560 HFA384x_RID_CNFTXCONTROL, 0, 0,
562 { DIDmib_p2_p2Static_p2CnfRoamingMode,
563 F_STA | F_READ | F_WRITE,
564 HFA384x_RID_CNFROAMINGMODE, 0, 0,
566 { DIDmib_p2_p2Static_p2CnfRcvCrcError,
567 F_STA | F_READ | F_WRITE,
568 HFA384x_RID_CNFRCVCRCERROR, 0, 0,
570 { DIDmib_p2_p2Static_p2CnfAltRetryCount,
571 F_STA | F_READ | F_WRITE,
572 HFA384x_RID_CNFALTRETRYCNT, 0, 0,
574 { DIDmib_p2_p2Static_p2CnfSTAPCFInfo,
575 F_STA | F_READ | F_WRITE,
576 HFA384x_RID_CNFSTAPCFINFO, 0, 0,
578 { DIDmib_p2_p2Static_p2CnfPriorityQUsage,
579 F_STA | F_READ | F_WRITE,
580 HFA384x_RID_CNFPRIORITYQUSAGE, HFA384x_RID_CNFPRIOQUSAGE_LEN, 0,
581 prism2mib_uint32array },
582 { DIDmib_p2_p2Static_p2CnfTIMCtrl,
583 F_STA | F_READ | F_WRITE,
584 HFA384x_RID_CNFTIMCTRL, 0, 0,
586 { DIDmib_p2_p2Static_p2CnfThirty2Tally,
587 F_STA | F_READ | F_WRITE,
588 HFA384x_RID_CNFTHIRTY2TALLY, 0, 0,
590 { DIDmib_p2_p2Static_p2CnfShortPreamble,
591 F_STA | F_READ | F_WRITE,
592 HFA384x_RID_CNFSHORTPREAMBLE, 0, 0,
593 prism2mib_preamble },
594 { DIDmib_p2_p2Static_p2CnfAuthenticationRspTO,
595 F_STA | F_READ | F_WRITE,
596 HFA384x_RID_CNFAUTHRSPTIMEOUT, 0, 0,
598 { DIDmib_p2_p2Static_p2CnfBasicRates,
599 F_STA | F_READ | F_WRITE,
600 HFA384x_RID_CNFBASICRATES, 0, 0,
602 { DIDmib_p2_p2Static_p2CnfSupportedRates,
603 F_STA | F_READ | F_WRITE,
604 HFA384x_RID_CNFSUPPRATES, 0, 0,
607 /* p2Dynamic MIB's */
609 { DIDmib_p2_p2Dynamic_p2CreateIBSS,
610 F_STA | F_READ | F_WRITE,
611 HFA384x_RID_CREATEIBSS, 0, 0,
613 { DIDmib_p2_p2Dynamic_p2FragmentationThreshold,
614 F_STA | F_READ | F_WRITE,
615 HFA384x_RID_FRAGTHRESH, 0, 0,
616 prism2mib_fragmentationthreshold },
617 { DIDmib_p2_p2Dynamic_p2RTSThreshold,
618 F_STA | F_READ | F_WRITE,
619 HFA384x_RID_RTSTHRESH, 0, 0,
621 { DIDmib_p2_p2Dynamic_p2TxRateControl,
622 F_STA | F_READ | F_WRITE,
623 HFA384x_RID_TXRATECNTL, 0, 0,
625 { DIDmib_p2_p2Dynamic_p2PromiscuousMode,
626 F_STA | F_READ | F_WRITE,
627 HFA384x_RID_PROMISCMODE, 0, 0,
630 /* p2Behavior MIB's */
632 { DIDmib_p2_p2Behavior_p2TickTime,
633 F_STA | F_READ | F_WRITE,
634 HFA384x_RID_ITICKTIME, 0, 0,
639 { DIDmib_p2_p2NIC_p2MaxLoadTime,
641 HFA384x_RID_MAXLOADTIME, 0, 0,
643 { DIDmib_p2_p2NIC_p2DLBufferPage,
645 HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 0,
646 prism2mib_uint32offset },
647 { DIDmib_p2_p2NIC_p2DLBufferOffset,
649 HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 1,
650 prism2mib_uint32offset },
651 { DIDmib_p2_p2NIC_p2DLBufferLength,
653 HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 2,
654 prism2mib_uint32offset },
655 { DIDmib_p2_p2NIC_p2PRIIdentity,
657 HFA384x_RID_PRIIDENTITY, HFA384x_RID_PRIIDENTITY_LEN, 0,
658 prism2mib_uint32array },
659 { DIDmib_p2_p2NIC_p2PRISupRange,
661 HFA384x_RID_PRISUPRANGE, HFA384x_RID_PRISUPRANGE_LEN, 0,
662 prism2mib_uint32array },
663 { DIDmib_p2_p2NIC_p2CFIActRanges,
665 HFA384x_RID_PRI_CFIACTRANGES, HFA384x_RID_CFIACTRANGES_LEN, 0,
666 prism2mib_uint32array },
667 { DIDmib_p2_p2NIC_p2BuildSequence,
669 HFA384x_RID_BUILDSEQ, HFA384x_RID_BUILDSEQ_LEN, 0,
670 prism2mib_uint32array },
671 { DIDmib_p2_p2NIC_p2PrimaryFWID,
675 { DIDmib_p2_p2NIC_p2SecondaryFWID,
679 { DIDmib_p2_p2NIC_p2NICSerialNumber,
681 HFA384x_RID_NICSERIALNUMBER, HFA384x_RID_NICSERIALNUMBER_LEN, 0,
682 prism2mib_bytearea2pstr },
683 { DIDmib_p2_p2NIC_p2NICIdentity,
685 HFA384x_RID_NICIDENTITY, HFA384x_RID_NICIDENTITY_LEN, 0,
686 prism2mib_uint32array },
687 { DIDmib_p2_p2NIC_p2MFISupRange,
689 HFA384x_RID_MFISUPRANGE, HFA384x_RID_MFISUPRANGE_LEN, 0,
690 prism2mib_uint32array },
691 { DIDmib_p2_p2NIC_p2CFISupRange,
693 HFA384x_RID_CFISUPRANGE, HFA384x_RID_CFISUPRANGE_LEN, 0,
694 prism2mib_uint32array },
695 { DIDmib_p2_p2NIC_p2ChannelList,
697 HFA384x_RID_CHANNELLIST, 0, 0,
699 { DIDmib_p2_p2NIC_p2RegulatoryDomains,
701 HFA384x_RID_REGULATORYDOMAINS, HFA384x_RID_REGULATORYDOMAINS_LEN, 0,
702 prism2mib_regulatorydomains },
703 { DIDmib_p2_p2NIC_p2TempType,
705 HFA384x_RID_TEMPTYPE, 0, 0,
707 { DIDmib_p2_p2NIC_p2STAIdentity,
709 HFA384x_RID_STAIDENTITY, HFA384x_RID_STAIDENTITY_LEN, 0,
710 prism2mib_uint32array },
711 { DIDmib_p2_p2NIC_p2STASupRange,
713 HFA384x_RID_STASUPRANGE, HFA384x_RID_STASUPRANGE_LEN, 0,
714 prism2mib_uint32array },
715 { DIDmib_p2_p2NIC_p2MFIActRanges,
717 HFA384x_RID_STA_MFIACTRANGES, HFA384x_RID_MFIACTRANGES_LEN, 0,
718 prism2mib_uint32array },
719 { DIDmib_p2_p2NIC_p2STACFIActRanges,
721 HFA384x_RID_STA_CFIACTRANGES, HFA384x_RID_CFIACTRANGES2_LEN, 0,
722 prism2mib_uint32array },
726 { DIDmib_p2_p2MAC_p2PortStatus,
728 HFA384x_RID_PORTSTATUS, 0, 0,
730 { DIDmib_p2_p2MAC_p2CurrentSSID,
732 HFA384x_RID_CURRENTSSID, HFA384x_RID_CURRENTSSID_LEN, 0,
733 prism2mib_bytestr2pstr },
734 { DIDmib_p2_p2MAC_p2CurrentBSSID,
736 HFA384x_RID_CURRENTBSSID, HFA384x_RID_CURRENTBSSID_LEN, 0,
737 prism2mib_bytearea2pstr },
738 { DIDmib_p2_p2MAC_p2CommsQuality,
740 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
741 prism2mib_uint32array },
742 { DIDmib_p2_p2MAC_p2CommsQualityCQ,
744 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
745 prism2mib_uint32offset },
746 { DIDmib_p2_p2MAC_p2CommsQualityASL,
748 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 1,
749 prism2mib_uint32offset },
750 { DIDmib_p2_p2MAC_p2CommsQualityANL,
752 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 2,
753 prism2mib_uint32offset },
754 { DIDmib_p2_p2MAC_p2dbmCommsQuality,
756 HFA384x_RID_DBMCOMMSQUALITY, HFA384x_RID_DBMCOMMSQUALITY_LEN, 0,
757 prism2mib_uint32array },
758 { DIDmib_p2_p2MAC_p2dbmCommsQualityCQ,
760 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0,
761 prism2mib_uint32offset },
762 { DIDmib_p2_p2MAC_p2dbmCommsQualityASL,
764 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 1,
765 prism2mib_uint32offset },
766 { DIDmib_p2_p2MAC_p2dbmCommsQualityANL,
768 HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 2,
769 prism2mib_uint32offset },
770 { DIDmib_p2_p2MAC_p2CurrentTxRate,
772 HFA384x_RID_CURRENTTXRATE, 0, 0,
774 { DIDmib_p2_p2MAC_p2CurrentBeaconInterval,
776 HFA384x_RID_CURRENTBCNint, 0, 0,
778 { DIDmib_p2_p2MAC_p2StaCurrentScaleThresholds,
780 HFA384x_RID_CURRENTSCALETHRESH, HFA384x_RID_STACURSCALETHRESH_LEN, 0,
781 prism2mib_uint32array },
782 { DIDmib_p2_p2MAC_p2ProtocolRspTime,
784 HFA384x_RID_PROTOCOLRSPTIME, 0, 0,
786 { DIDmib_p2_p2MAC_p2ShortRetryLimit,
788 HFA384x_RID_SHORTRETRYLIMIT, 0, 0,
790 { DIDmib_p2_p2MAC_p2LongRetryLimit,
792 HFA384x_RID_LONGRETRYLIMIT, 0, 0,
794 { DIDmib_p2_p2MAC_p2MaxTransmitLifetime,
796 HFA384x_RID_MAXTXLIFETIME, 0, 0,
798 { DIDmib_p2_p2MAC_p2MaxReceiveLifetime,
800 HFA384x_RID_MAXRXLIFETIME, 0, 0,
802 { DIDmib_p2_p2MAC_p2CFPollable,
804 HFA384x_RID_CFPOLLABLE, 0, 0,
806 { DIDmib_p2_p2MAC_p2AuthenticationAlgorithms,
808 HFA384x_RID_AUTHALGORITHMS, HFA384x_RID_AUTHALGORITHMS_LEN, 0,
809 prism2mib_uint32array },
810 { DIDmib_p2_p2MAC_p2PrivacyOptionImplemented,
812 HFA384x_RID_PRIVACYOPTIMP, 0, 0,
817 { DIDmib_p2_p2Modem_p2PHYType,
819 HFA384x_RID_PHYTYPE, 0, 0,
821 { DIDmib_p2_p2Modem_p2CurrentChannel,
823 HFA384x_RID_CURRENTCHANNEL, 0, 0,
825 { DIDmib_p2_p2Modem_p2CurrentPowerState,
827 HFA384x_RID_CURRENTPOWERSTATE, 0, 0,
829 { DIDmib_p2_p2Modem_p2CCAMode,
831 HFA384x_RID_CCAMODE, 0, 0,
833 { DIDmib_p2_p2Modem_p2TxPowerMax,
834 F_STA | F_READ | F_WRITE,
835 HFA384x_RID_TXPOWERMAX, 0, 0,
837 { DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel,
838 F_STA | F_READ | F_WRITE,
839 HFA384x_RID_TXPOWERMAX, 0, 0,
841 { DIDmib_p2_p2Modem_p2SupportedDataRates,
843 HFA384x_RID_SUPPORTEDDATARATES, HFA384x_RID_SUPPORTEDDATARATES_LEN, 0,
844 prism2mib_bytestr2pstr },
846 /* And finally, lnx mibs */
847 { DIDmib_lnx_lnxConfigTable_lnxRSNAIE,
848 F_STA | F_READ | F_WRITE,
849 HFA384x_RID_CNFWPADATA, 0, 0,
851 { 0, 0, 0, 0, 0, NULL}};
853 /*----------------------------------------------------------------
854 These MIB's are not supported at this time:
856 DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityPresent
857 DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityEnabled
858 DIDmib_dot11phy_dot11PhyDSSSTable_dot11PBCCOptionImplemented
859 DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportIndex
860 DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxIndex
861 DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxValue
862 DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxIndex
863 DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxValue
865 DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportValue
866 TODO: need to investigate why wlan has this as enumerated and Prism2 has this
869 DIDmib_dot11phy_dot11PhyDSSSTable_dot11ShortPreambleOptionImplemented
870 TODO: Find out the firmware version number(s) for identifying
871 whether the firmware is capable of short preamble. TRUE or FALSE
872 will be returned based on the version of the firmware.
874 WEP Key mappings aren't supported in the f/w.
875 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingIndex
876 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingAddress
877 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingWEPOn
878 DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingValue
879 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPKeyMappingLength
881 TODO: implement counters.
882 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPICVErrorCount
883 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPExcludedCount
884 DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFragmentCount
885 DIDmib_dot11mac_dot11CountersTable_dot11MulticastTransmittedFrameCount
886 DIDmib_dot11mac_dot11CountersTable_dot11FailedCount
887 DIDmib_dot11mac_dot11CountersTable_dot11RetryCount
888 DIDmib_dot11mac_dot11CountersTable_dot11MultipleRetryCount
889 DIDmib_dot11mac_dot11CountersTable_dot11FrameDuplicateCount
890 DIDmib_dot11mac_dot11CountersTable_dot11RTSSuccessCount
891 DIDmib_dot11mac_dot11CountersTable_dot11RTSFailureCount
892 DIDmib_dot11mac_dot11CountersTable_dot11ACKFailureCount
893 DIDmib_dot11mac_dot11CountersTable_dot11ReceivedFragmentCount
894 DIDmib_dot11mac_dot11CountersTable_dot11MulticastReceivedFrameCount
895 DIDmib_dot11mac_dot11CountersTable_dot11FCSErrorCount
896 DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFrameCount
897 DIDmib_dot11mac_dot11CountersTable_dot11WEPUndecryptableCount
899 TODO: implement sane values for these.
900 DIDmib_dot11mac_dot11OperationTable_dot11ManufacturerID
901 DIDmib_dot11mac_dot11OperationTable_dot11ProductID
903 Not too worried about these at the moment.
904 DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentTxAntenna
905 DIDmib_dot11phy_dot11PhyAntennaTable_dot11DiversitySupport
906 DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentRxAntenna
907 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11NumberSupportedPowerLevels
908 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel1
909 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel2
910 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel3
911 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel4
912 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel5
913 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel6
914 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel7
915 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel8
916 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel
918 Ummm, FH and IR don't apply
919 DIDmib_dot11phy_dot11PhyFHSSTable_dot11HopTime
920 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentChannelNumber
921 DIDmib_dot11phy_dot11PhyFHSSTable_dot11MaxDwellTime
922 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentDwellTime
923 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentSet
924 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentPattern
925 DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentIndex
926 DIDmib_dot11phy_dot11PhyDSSSTable_dot11CCAModeSupported
927 DIDmib_dot11phy_dot11PhyDSSSTable_dot11EDThreshold
928 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMax
929 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMax
930 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMin
931 DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMin
933 We just don't have enough antennas right now to worry about this.
934 DIDmib_dot11phy_dot11AntennasListTable_dot11AntennaListIndex
935 DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedTxAntenna
936 DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedRxAntenna
937 DIDmib_dot11phy_dot11AntennasListTable_dot11DiversitySelectionRx
939 ------------------------------------------------------------------*/
941 /*================================================================*/
942 /* Function Definitions */
944 /*----------------------------------------------------------------
945 * prism2mgmt_mibset_mibget
947 * Set the value of a mib item.
950 * wlandev wlan device structure
951 * msgp ptr to msg buffer
955 * <0 success, but we're waiting for something to finish.
956 * >0 an error occurred while handling the message.
960 * process thread (usually)
962 ----------------------------------------------------------------*/
964 int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp)
966 hfa384x_t *hw = wlandev->priv;
972 p80211msg_dot11req_mibset_t *msg = msgp;
973 p80211itemd_t *mibitem;
977 msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
978 msg->resultcode.data = P80211ENUM_resultcode_success;
981 ** Determine if this is an Access Point or a station.
987 ** Find the MIB in the MIB table. Note that a MIB may be in the
988 ** table twice...once for an AP and once for a station. Make sure
989 ** to get the correct one. Note that DID=0 marks the end of the
993 mibitem = (p80211itemd_t *) msg->mibattribute.data;
995 for (mib = mibtab; mib->did != 0; mib++)
996 if (mib->did == mibitem->did && (mib->flag & which))
1000 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
1005 ** Determine if this is a "mibget" or a "mibset". If this is a
1006 ** "mibget", then make sure that the MIB may be read. Otherwise,
1007 ** this is a "mibset" so make make sure that the MIB may be written.
1010 isget = (msg->msgcode == DIDmsg_dot11req_mibget);
1013 if (!(mib->flag & F_READ)) {
1014 msg->resultcode.data =
1015 P80211ENUM_resultcode_cant_get_writeonly_mib;
1019 if (!(mib->flag & F_WRITE)) {
1020 msg->resultcode.data =
1021 P80211ENUM_resultcode_cant_set_readonly_mib;
1027 ** Execute the MIB function. If things worked okay, then make
1028 ** sure that the MIB function also worked okay. If so, and this
1029 ** is a "mibget", then the status value must be set for both the
1030 ** "mibattribute" parameter and the mib item within the data
1031 ** portion of the "mibattribute".
1034 result = mib->func(mib, isget, wlandev, hw, msg,
1035 (void *) mibitem->data);
1037 if (msg->resultcode.data == P80211ENUM_resultcode_success) {
1039 WLAN_LOG_DEBUG(1, "get/set failure, result=%d\n",
1041 msg->resultcode.data =
1042 P80211ENUM_resultcode_implementation_failure;
1045 msg->mibattribute.status =
1046 P80211ENUM_msgitem_status_data_ok;
1048 P80211ENUM_msgitem_status_data_ok;
1059 /*----------------------------------------------------------------
1060 * prism2mib_bytestr2pstr
1062 * Get/set pstr data to/from a byte string.
1064 * MIB record parameters:
1065 * parm1 Prism2 RID value.
1066 * parm2 Number of bytes of RID data.
1071 * isget MIBGET/MIBSET flag.
1072 * wlandev wlan device structure.
1073 * priv "priv" structure.
1074 * hw "hw" structure.
1075 * msg Message structure.
1082 ----------------------------------------------------------------*/
1084 static int prism2mib_bytestr2pstr(
1087 wlandevice_t *wlandev,
1089 p80211msg_dot11req_mibset_t *msg,
1093 p80211pstrd_t *pstr = (p80211pstrd_t*) data;
1094 u8 bytebuf[MIB_TMP_MAXLEN];
1095 hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*) bytebuf;
1100 result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2);
1101 prism2mgmt_bytestr2pstr(p2bytestr, pstr);
1103 memset(bytebuf, 0, mib->parm2);
1104 prism2mgmt_pstr2bytestr(p2bytestr, pstr);
1105 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
1112 /*----------------------------------------------------------------
1113 * prism2mib_bytearea2pstr
1115 * Get/set pstr data to/from a byte area.
1117 * MIB record parameters:
1118 * parm1 Prism2 RID value.
1119 * parm2 Number of bytes of RID data.
1124 * isget MIBGET/MIBSET flag.
1125 * wlandev wlan device structure.
1126 * priv "priv" structure.
1127 * hw "hw" structure.
1128 * msg Message structure.
1135 ----------------------------------------------------------------*/
1137 static int prism2mib_bytearea2pstr(
1140 wlandevice_t *wlandev,
1142 p80211msg_dot11req_mibset_t *msg,
1146 p80211pstrd_t *pstr = (p80211pstrd_t*) data;
1147 u8 bytebuf[MIB_TMP_MAXLEN];
1152 result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2);
1153 prism2mgmt_bytearea2pstr(bytebuf, pstr, mib->parm2);
1155 memset(bytebuf, 0, mib->parm2);
1156 prism2mgmt_pstr2bytearea(bytebuf, pstr);
1157 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
1164 /*----------------------------------------------------------------
1167 * Get/set uint32 data.
1169 * MIB record parameters:
1170 * parm1 Prism2 RID value.
1176 * isget MIBGET/MIBSET flag.
1177 * wlandev wlan device structure.
1178 * priv "priv" structure.
1179 * hw "hw" structure.
1180 * msg Message structure.
1187 ----------------------------------------------------------------*/
1189 static int prism2mib_uint32(
1192 wlandevice_t *wlandev,
1194 p80211msg_dot11req_mibset_t *msg,
1198 u32 *uint32 = (u32*) data;
1199 u8 bytebuf[MIB_TMP_MAXLEN];
1200 u16 *wordbuf = (u16*) bytebuf;
1205 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1207 /* [MSM] Removed, getconfig16 returns the value in host order.
1208 * prism2mgmt_prism2int2p80211int(wordbuf, uint32);
1211 /* [MSM] Removed, setconfig16 expects host order.
1212 * prism2mgmt_p80211int2prism2int(wordbuf, uint32);
1215 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1222 /*----------------------------------------------------------------
1223 * prism2mib_uint32array
1225 * Get/set an array of uint32 data.
1227 * MIB record parameters:
1228 * parm1 Prism2 RID value.
1229 * parm2 Number of bytes of RID data.
1234 * isget MIBGET/MIBSET flag.
1235 * wlandev wlan device structure.
1236 * priv "priv" structure.
1237 * hw "hw" structure.
1238 * msg Message structure.
1245 ----------------------------------------------------------------*/
1247 static int prism2mib_uint32array(
1250 wlandevice_t *wlandev,
1252 p80211msg_dot11req_mibset_t *msg,
1256 u32 *uint32 = (u32 *) data;
1257 u8 bytebuf[MIB_TMP_MAXLEN];
1258 u16 *wordbuf = (u16*) bytebuf;
1263 cnt = mib->parm2 / sizeof(u16);
1266 result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
1267 for (i = 0; i < cnt; i++)
1268 prism2mgmt_prism2int2p80211int(wordbuf+i, uint32+i);
1270 for (i = 0; i < cnt; i++)
1271 prism2mgmt_p80211int2prism2int(wordbuf+i, uint32+i);
1272 result = hfa384x_drvr_setconfig(hw, mib->parm1, wordbuf, mib->parm2);
1279 /*----------------------------------------------------------------
1280 * prism2mib_uint32offset
1282 * Get/set a single element in an array of uint32 data.
1284 * MIB record parameters:
1285 * parm1 Prism2 RID value.
1286 * parm2 Number of bytes of RID data.
1287 * parm3 Element index.
1291 * isget MIBGET/MIBSET flag.
1292 * wlandev wlan device structure.
1293 * priv "priv" structure.
1294 * hw "hw" structure.
1295 * msg Message structure.
1302 ----------------------------------------------------------------*/
1304 static int prism2mib_uint32offset(
1307 wlandevice_t *wlandev,
1309 p80211msg_dot11req_mibset_t *msg,
1313 u32 *uint32 = (u32*) data;
1314 u8 bytebuf[MIB_TMP_MAXLEN];
1315 u16 *wordbuf = (u16*) bytebuf;
1320 cnt = mib->parm2 / sizeof(u16);
1322 result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
1325 if (mib->parm3 < cnt)
1326 prism2mgmt_prism2int2p80211int(wordbuf+mib->parm3, uint32);
1330 if (mib->parm3 < cnt) {
1331 prism2mgmt_p80211int2prism2int(wordbuf+mib->parm3, uint32);
1332 result = hfa384x_drvr_setconfig(hw, mib->parm1, wordbuf, mib->parm2);
1341 /*----------------------------------------------------------------
1344 * Get/set truth data.
1346 * MIB record parameters:
1347 * parm1 Prism2 RID value.
1353 * isget MIBGET/MIBSET flag.
1354 * wlandev wlan device structure.
1355 * priv "priv" structure.
1356 * hw "hw" structure.
1357 * msg Message structure.
1364 ----------------------------------------------------------------*/
1366 static int prism2mib_truth(
1369 wlandevice_t *wlandev,
1371 p80211msg_dot11req_mibset_t *msg,
1375 u32 *uint32 = (u32*) data;
1376 u8 bytebuf[MIB_TMP_MAXLEN];
1377 u16 *wordbuf = (u16*) bytebuf;
1382 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1383 *uint32 = (*wordbuf) ?
1384 P80211ENUM_truth_true : P80211ENUM_truth_false;
1386 *wordbuf = ((*uint32) == P80211ENUM_truth_true) ? 1 : 0;
1387 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1394 /*----------------------------------------------------------------
1399 * MIB record parameters:
1400 * parm1 Prism2 RID value.
1401 * parm2 Bit to get/set.
1406 * isget MIBGET/MIBSET flag.
1407 * wlandev wlan device structure.
1408 * priv "priv" structure.
1409 * hw "hw" structure.
1410 * msg Message structure.
1417 ----------------------------------------------------------------*/
1419 static int prism2mib_flag(
1422 wlandevice_t *wlandev,
1424 p80211msg_dot11req_mibset_t *msg,
1428 u32 *uint32 = (u32*) data;
1429 u8 bytebuf[MIB_TMP_MAXLEN];
1430 u16 *wordbuf = (u16*) bytebuf;
1435 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1437 /* [MSM] Removed, getconfig16 returns the value in host order.
1438 * prism2mgmt_prism2int2p80211int(wordbuf, &flags);
1442 *uint32 = (flags & mib->parm2) ?
1443 P80211ENUM_truth_true : P80211ENUM_truth_false;
1445 if ((*uint32) == P80211ENUM_truth_true)
1446 flags |= mib->parm2;
1448 flags &= ~mib->parm2;
1449 /* [MSM] Removed, setconfig16 expects host order.
1450 * prism2mgmt_p80211int2prism2int(wordbuf, &flags);
1453 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1461 /*----------------------------------------------------------------
1462 * prism2mib_regulatorydomains
1464 * Get regulatory domain data.
1466 * MIB record parameters:
1467 * parm1 Prism2 RID value.
1468 * parm2 Number of bytes of RID data.
1473 * isget MIBGET/MIBSET flag.
1474 * wlandev wlan device structure.
1475 * priv "priv" structure.
1476 * hw "hw" structure.
1477 * msg Message structure.
1484 ----------------------------------------------------------------*/
1486 static int prism2mib_regulatorydomains(
1489 wlandevice_t *wlandev,
1491 p80211msg_dot11req_mibset_t *msg,
1496 p80211pstrd_t *pstr = (p80211pstrd_t*) data;
1497 u8 bytebuf[MIB_TMP_MAXLEN];
1498 u16 *wordbuf = (u16*) bytebuf;
1505 result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2);
1506 prism2mgmt_prism2int2p80211int(wordbuf, &cnt);
1507 pstr->len = (u8) cnt;
1508 memcpy(pstr->data, &wordbuf[1], pstr->len);
1515 /*----------------------------------------------------------------
1516 * prism2mib_wepdefaultkey
1518 * Get/set WEP default keys.
1520 * MIB record parameters:
1521 * parm1 Prism2 RID value.
1522 * parm2 Number of bytes of RID data.
1527 * isget MIBGET/MIBSET flag.
1528 * wlandev wlan device structure.
1529 * priv "priv" structure.
1530 * hw "hw" structure.
1531 * msg Message structure.
1538 ----------------------------------------------------------------*/
1540 static int prism2mib_wepdefaultkey(
1543 wlandevice_t *wlandev,
1545 p80211msg_dot11req_mibset_t *msg,
1549 p80211pstrd_t *pstr = (p80211pstrd_t*) data;
1550 u8 bytebuf[MIB_TMP_MAXLEN];
1556 result = 0; /* Should never happen. */
1558 len = (pstr->len > 5) ? HFA384x_RID_CNFWEP128DEFAULTKEY_LEN :
1559 HFA384x_RID_CNFWEPDEFAULTKEY_LEN;
1560 memset(bytebuf, 0, len);
1561 prism2mgmt_pstr2bytearea(bytebuf, pstr);
1562 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, len);
1569 /*----------------------------------------------------------------
1570 * prism2mib_powermanagement
1572 * Get/set 802.11 power management value. Note that this is defined differently
1573 * by 802.11 and Prism2:
1575 * Meaning 802.11 Prism2
1579 * MIB record parameters:
1580 * parm1 Prism2 RID value.
1586 * isget MIBGET/MIBSET flag.
1587 * wlandev wlan device structure.
1588 * priv "priv" structure.
1589 * hw "hw" structure.
1590 * msg Message structure.
1597 ----------------------------------------------------------------*/
1599 static int prism2mib_powermanagement(
1602 wlandevice_t *wlandev,
1604 p80211msg_dot11req_mibset_t *msg,
1608 u32 *uint32 = (u32*) data;
1614 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value);
1615 *uint32 = (value == 0) ? 1 : 2;
1617 value = ((*uint32) == 1) ? 0 : 1;
1618 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value);
1625 /*----------------------------------------------------------------
1626 * prism2mib_preamble
1628 * Get/set Prism2 short preamble
1630 * MIB record parameters:
1631 * parm1 Prism2 RID value.
1637 * isget MIBGET/MIBSET flag.
1638 * wlandev wlan device structure.
1639 * priv "priv" structure.
1640 * hw "hw" structure.
1641 * msg Message structure.
1648 ----------------------------------------------------------------*/
1650 static int prism2mib_preamble(
1653 wlandevice_t *wlandev,
1655 p80211msg_dot11req_mibset_t *msg,
1659 u32 *uint32 = (u32*) data;
1660 u8 bytebuf[MIB_TMP_MAXLEN];
1661 u16 *wordbuf = (u16*) bytebuf;
1666 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1670 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1677 /*----------------------------------------------------------------
1678 * prism2mib_privacyinvoked
1680 * Get/set the dot11PrivacyInvoked value.
1682 * MIB record parameters:
1683 * parm1 Prism2 RID value.
1684 * parm2 Bit value for PrivacyInvoked flag.
1689 * isget MIBGET/MIBSET flag.
1690 * wlandev wlan device structure.
1691 * priv "priv" structure.
1692 * hw "hw" structure.
1693 * msg Message structure.
1700 ----------------------------------------------------------------*/
1702 static int prism2mib_privacyinvoked(
1705 wlandevice_t *wlandev,
1707 p80211msg_dot11req_mibset_t *msg,
1714 if (wlandev->hostwep & HOSTWEP_DECRYPT) {
1715 if (wlandev->hostwep & HOSTWEP_DECRYPT)
1716 mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
1717 if (wlandev->hostwep & HOSTWEP_ENCRYPT)
1718 mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_TXCRYPT;
1721 result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
1727 /*----------------------------------------------------------------
1728 * prism2mib_excludeunencrypted
1730 * Get/set the dot11ExcludeUnencrypted value.
1732 * MIB record parameters:
1733 * parm1 Prism2 RID value.
1734 * parm2 Bit value for ExcludeUnencrypted flag.
1739 * isget MIBGET/MIBSET flag.
1740 * wlandev wlan device structure.
1741 * priv "priv" structure.
1742 * hw "hw" structure.
1743 * msg Message structure.
1750 ----------------------------------------------------------------*/
1752 static int prism2mib_excludeunencrypted(
1755 wlandevice_t *wlandev,
1757 p80211msg_dot11req_mibset_t *msg,
1764 result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
1770 /*----------------------------------------------------------------
1771 * prism2mib_fragmentationthreshold
1773 * Get/set the fragmentation threshold.
1775 * MIB record parameters:
1776 * parm1 Prism2 RID value.
1782 * isget MIBGET/MIBSET flag.
1783 * wlandev wlan device structure.
1784 * priv "priv" structure.
1785 * hw "hw" structure.
1786 * msg Message structure.
1793 ----------------------------------------------------------------*/
1795 static int prism2mib_fragmentationthreshold(
1798 wlandevice_t *wlandev,
1800 p80211msg_dot11req_mibset_t *msg,
1804 u32 *uint32 = (u32*) data;
1809 if ((*uint32) % 2) {
1810 WLAN_LOG_WARNING("Attempt to set odd number "
1811 "FragmentationThreshold\n");
1812 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
1816 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, data);
1822 /*----------------------------------------------------------------
1823 * prism2mib_operationalrateset
1825 * Get/set the operational rate set.
1827 * MIB record parameters:
1828 * parm1 Prism2 RID value.
1834 * isget MIBGET/MIBSET flag.
1835 * wlandev wlan device structure.
1836 * priv "priv" structure.
1837 * hw "hw" structure.
1838 * msg Message structure.
1845 ----------------------------------------------------------------*/
1847 static int prism2mib_operationalrateset(
1850 wlandevice_t *wlandev,
1852 p80211msg_dot11req_mibset_t *msg,
1856 p80211pstrd_t *pstr = (p80211pstrd_t *) data;
1857 u8 bytebuf[MIB_TMP_MAXLEN];
1858 u16 *wordbuf = (u16*) bytebuf;
1863 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
1864 prism2mgmt_get_oprateset(wordbuf, pstr);
1866 prism2mgmt_set_oprateset(wordbuf, pstr);
1867 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
1868 result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, *wordbuf);
1875 /*----------------------------------------------------------------
1878 * Get the firmware ID.
1880 * MIB record parameters:
1887 * isget MIBGET/MIBSET flag.
1888 * wlandev wlan device structure.
1889 * priv "priv" structure.
1890 * hw "hw" structure.
1891 * msg Message structure.
1898 ----------------------------------------------------------------*/
1900 static int prism2mib_fwid(
1903 wlandevice_t *wlandev,
1905 p80211msg_dot11req_mibset_t *msg,
1909 p80211pstrd_t *pstr = (p80211pstrd_t *) data;
1910 hfa384x_FWID_t fwid;
1915 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_FWID,
1916 &fwid, HFA384x_RID_FWID_LEN);
1917 if (mib->did == DIDmib_p2_p2NIC_p2PrimaryFWID) {
1918 fwid.primary[HFA384x_FWID_LEN - 1] = '\0';
1919 pstr->len = strlen(fwid.primary);
1920 memcpy(pstr->data, fwid.primary, pstr->len);
1922 fwid.secondary[HFA384x_FWID_LEN - 1] = '\0';
1923 pstr->len = strlen(fwid.secondary);
1924 memcpy(pstr->data, fwid.secondary, pstr->len);
1927 result = 0; /* Should never happen. */
1933 /*----------------------------------------------------------------
1936 * Get values from the AuhtenticationAlgorithmsTable.
1938 * MIB record parameters:
1939 * parm1 Table index (1-6).
1945 * isget MIBGET/MIBSET flag.
1946 * wlandev wlan device structure.
1947 * priv "priv" structure.
1948 * hw "hw" structure.
1949 * msg Message structure.
1956 ----------------------------------------------------------------*/
1958 static int prism2mib_authalg(
1961 wlandevice_t *wlandev,
1963 p80211msg_dot11req_mibset_t *msg,
1966 u32 *uint32 = (u32*) data;
1970 /* MSM: pkx supplied code that code queries RID FD4D....but the f/w's
1971 * results are bogus. Therefore, we have to simulate the appropriate
1972 * results here in the driver based on our knowledge of existing MAC
1973 * features. That's the whole point behind this ugly function.
1977 msg->resultcode.data = P80211ENUM_resultcode_success;
1978 switch (mib->parm1) {
1979 case 1: /* Open System */
1980 *uint32 = P80211ENUM_authalg_opensystem;
1982 case 2: /* SharedKey */
1983 *uint32 = P80211ENUM_authalg_sharedkey;
1987 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
1996 /*----------------------------------------------------------------
1997 * prism2mib_authalgenable
1999 * Get/set the enable values from the AuhtenticationAlgorithmsTable.
2001 * MIB record parameters:
2002 * parm1 Table index (1-6).
2008 * isget MIBGET/MIBSET flag.
2009 * wlandev wlan device structure.
2010 * priv "priv" structure.
2011 * hw "hw" structure.
2012 * msg Message structure.
2019 ----------------------------------------------------------------*/
2021 static int prism2mib_authalgenable(
2024 wlandevice_t *wlandev,
2026 p80211msg_dot11req_mibset_t *msg,
2030 u32 *uint32 = (u32*) data;
2038 index = mib->parm1 - 1;
2040 result = hfa384x_drvr_getconfig16( hw,
2041 HFA384x_RID_CNFAUTHENTICATION, &cnf_auth);
2042 WLAN_LOG_DEBUG(2,"cnfAuthentication0=%d, index=%d\n", cnf_auth, index);
2045 if ( index == 0 || index == 1 ) {
2046 *uint32 = (cnf_auth & (1<<index)) ?
2047 P80211ENUM_truth_true: P80211ENUM_truth_false;
2049 *uint32 = P80211ENUM_truth_false;
2050 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2053 if ( index == 0 || index == 1 ) {
2055 if (*uint32==P80211ENUM_truth_true ) {
2060 result = hfa384x_drvr_setconfig16( hw,
2061 HFA384x_RID_CNFAUTHENTICATION, cnf_auth);
2062 WLAN_LOG_DEBUG(2,"cnfAuthentication:=%d\n", cnf_auth);
2064 WLAN_LOG_DEBUG(1,"Unable to set p2cnfAuthentication to %d\n", cnf_auth);
2065 msg->resultcode.data = P80211ENUM_resultcode_implementation_failure;
2068 msg->resultcode.data = P80211ENUM_resultcode_not_supported;
2076 /*----------------------------------------------------------------
2079 * Get/set values in the "priv" data structure.
2081 * MIB record parameters:
2088 * isget MIBGET/MIBSET flag.
2089 * wlandev wlan device structure.
2090 * priv "priv" structure.
2091 * hw "hw" structure.
2092 * msg Message structure.
2099 ----------------------------------------------------------------*/
2101 static int prism2mib_priv(
2104 wlandevice_t *wlandev,
2106 p80211msg_dot11req_mibset_t *msg,
2109 u32 *uint32 = (u32*) data;
2110 p80211pstrd_t *pstr = (p80211pstrd_t*) data;
2115 ** "test" is a lot longer than necessary but who cares? ...as long as
2116 ** it is long enough!
2119 u8 test[sizeof(wlandev->rx) + sizeof(hw->tallies)];
2124 case DIDmib_p2_p2Table_p2ReceivedFrameStatistics:
2127 ** Note: The values in this record are changed by the
2128 ** interrupt handler and therefore cannot be guaranteed
2129 ** to be stable while they are being copied. However,
2130 ** the interrupt handler will take priority over this
2131 ** code. Hence, if the same values are copied twice,
2132 ** then we are ensured that the values have not been
2133 ** changed. If they have, then just try again. Don't
2134 ** try more than 10 times...if we still haven't got it,
2135 ** then the values we do have are probably good enough.
2136 ** This scheme for copying values is used in order to
2137 ** prevent having to block the interrupt handler while
2138 ** we copy the values.
2142 for (i = 0; i < 10; i++) {
2143 memcpy(data, &wlandev->rx, sizeof(wlandev->rx));
2144 memcpy(test, &wlandev->rx, sizeof(wlandev->rx));
2145 if (memcmp(data, test, sizeof(wlandev->rx)) == 0) break;
2150 case DIDmib_p2_p2Table_p2CommunicationTallies:
2153 ** Note: The values in this record are changed by the
2154 ** interrupt handler and therefore cannot be guaranteed
2155 ** to be stable while they are being copied. See the
2156 ** note above about copying values.
2160 result = hfa384x_drvr_commtallies(hw);
2162 /* ?????? We need to wait a bit here for the */
2163 /* tallies to get updated. ?????? */
2164 /* MSM: TODO: The right way to do this is to
2165 * add a "commtallie" wait queue to the
2166 * priv structure that gets run every time
2167 * we receive a commtally info frame.
2168 * This process would sleep on that
2169 * queue and get awakened when the
2170 * the requested info frame arrives.
2171 * Don't have time to do and test this
2175 /* Ugh, this is nasty. */
2176 for (i = 0; i < 10; i++) {
2179 sizeof(hw->tallies));
2182 sizeof(hw->tallies));
2185 sizeof(hw->tallies)) == 0)
2192 case DIDmib_p2_p2Table_p2Comment:
2195 pstr->len = strlen(hw->comment);
2196 memcpy(pstr->data, hw->comment, pstr->len);
2199 if (cnt < 0) cnt = 0;
2200 if (cnt >= sizeof(hw->comment))
2201 cnt = sizeof(hw->comment)-1;
2202 memcpy(hw->comment, pstr->data, cnt);
2203 pstr->data[cnt] = '\0';
2208 case DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType:
2211 *uint32 = hw->dot11_desired_bss_type;
2213 hw->dot11_desired_bss_type = *uint32;
2217 case DIDmib_lnx_lnxConfigTable_lnxRSNAIE: {
2218 hfa384x_WPAData_t wpa;
2220 hfa384x_drvr_getconfig( hw, HFA384x_RID_CNFWPADATA,
2221 (u8 *) &wpa, sizeof(wpa));
2222 pstr->len = hfa384x2host_16(wpa.datalen);
2223 memcpy(pstr->data, wpa.data, pstr->len);
2225 wpa.datalen = host2hfa384x_16(pstr->len);
2226 memcpy(wpa.data, pstr->data, pstr->len);
2228 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFWPADATA,
2229 (u8 *) &wpa, sizeof(wpa));
2234 WLAN_LOG_ERROR("Unhandled DID 0x%08x\n", mib->did);
2241 /*----------------------------------------------------------------
2242 * prism2mgmt_pstr2bytestr
2244 * Convert the pstr data in the WLAN message structure into an hfa384x
2245 * byte string format.
2248 * bytestr hfa384x byte string data type
2249 * pstr wlan message data
2254 ----------------------------------------------------------------*/
2256 void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
2260 bytestr->len = host2hfa384x_16((u16)(pstr->len));
2261 memcpy(bytestr->data, pstr->data, pstr->len);
2266 /*----------------------------------------------------------------
2267 * prism2mgmt_pstr2bytearea
2269 * Convert the pstr data in the WLAN message structure into an hfa384x
2273 * bytearea hfa384x byte area data type
2274 * pstr wlan message data
2279 ----------------------------------------------------------------*/
2281 void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr)
2285 memcpy(bytearea, pstr->data, pstr->len);
2290 /*----------------------------------------------------------------
2291 * prism2mgmt_bytestr2pstr
2293 * Convert the data in an hfa384x byte string format into a
2294 * pstr in the WLAN message.
2297 * bytestr hfa384x byte string data type
2303 ----------------------------------------------------------------*/
2305 void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
2309 pstr->len = (u8)(hfa384x2host_16((u16)(bytestr->len)));
2310 memcpy(pstr->data, bytestr->data, pstr->len);
2315 /*----------------------------------------------------------------
2316 * prism2mgmt_bytearea2pstr
2318 * Convert the data in an hfa384x byte area format into a pstr
2319 * in the WLAN message.
2322 * bytearea hfa384x byte area data type
2328 ----------------------------------------------------------------*/
2330 void prism2mgmt_bytearea2pstr(u8 *bytearea, p80211pstrd_t *pstr, int len)
2334 pstr->len = (u8)len;
2335 memcpy(pstr->data, bytearea, len);
2340 /*----------------------------------------------------------------
2341 * prism2mgmt_prism2int2p80211int
2343 * Convert an hfa384x integer into a wlan integer
2346 * prism2enum pointer to hfa384x integer
2347 * wlanenum pointer to p80211 integer
2352 ----------------------------------------------------------------*/
2354 void prism2mgmt_prism2int2p80211int(u16 *prism2int, u32 *wlanint)
2358 *wlanint = (u32)hfa384x2host_16(*prism2int);
2363 /*----------------------------------------------------------------
2364 * prism2mgmt_p80211int2prism2int
2366 * Convert a wlan integer into an hfa384x integer
2369 * prism2enum pointer to hfa384x integer
2370 * wlanenum pointer to p80211 integer
2375 ----------------------------------------------------------------*/
2377 void prism2mgmt_p80211int2prism2int(u16 *prism2int, u32 *wlanint)
2381 *prism2int = host2hfa384x_16((u16)(*wlanint));
2386 /*----------------------------------------------------------------
2387 * prism2mgmt_prism2enum2p80211enum
2389 * Convert the hfa384x enumerated int into a p80211 enumerated int
2392 * prism2enum pointer to hfa384x integer
2393 * wlanenum pointer to p80211 integer
2394 * rid hfa384x record id
2399 ----------------------------------------------------------------*/
2400 void prism2mgmt_prism2enum2p80211enum(u16 *prism2enum, u32 *wlanenum, u16 rid)
2404 /* At the moment, the need for this functionality hasn't
2405 presented itself. All the wlan enumerated values are
2406 a 1-to-1 match against the Prism2 enumerated values*/
2412 /*----------------------------------------------------------------
2413 * prism2mgmt_p80211enum2prism2enum
2415 * Convert the p80211 enumerated int into an hfa384x enumerated int
2418 * prism2enum pointer to hfa384x integer
2419 * wlanenum pointer to p80211 integer
2420 * rid hfa384x record id
2425 ----------------------------------------------------------------*/
2426 void prism2mgmt_p80211enum2prism2enum(u16 *prism2enum, u32 *wlanenum, u16 rid)
2430 /* At the moment, the need for this functionality hasn't
2431 presented itself. All the wlan enumerated values are
2432 a 1-to-1 match against the Prism2 enumerated values*/
2439 /*----------------------------------------------------------------
2440 * prism2mgmt_get_oprateset
2442 * Convert the hfa384x bit area into a wlan octet string.
2445 * rate Prism2 bit area
2446 * pstr wlan octet string
2451 ----------------------------------------------------------------*/
2452 void prism2mgmt_get_oprateset(u16 *rate, p80211pstrd_t *pstr)
2460 datarate = pstr->data;
2463 if ( BIT0 & (*rate) ) {
2470 if ( BIT1 & (*rate) ) {
2477 if ( BIT2 & (*rate) ) {
2484 if ( BIT3 & (*rate) ) {
2498 /*----------------------------------------------------------------
2499 * prism2mgmt_set_oprateset
2501 * Convert the wlan octet string into an hfa384x bit area.
2504 * rate Prism2 bit area
2505 * pstr wlan octet string
2510 ----------------------------------------------------------------*/
2511 void prism2mgmt_set_oprateset(u16 *rate, p80211pstrd_t *pstr)
2520 datarate = pstr->data;
2522 for ( i=0; i < pstr->len; i++, datarate++ ) {
2523 switch (*datarate) {
2524 case 2: /* 1 Mbps */
2527 case 4: /* 2 Mbps */
2530 case 11: /* 5.5 Mbps */
2533 case 22: /* 11 Mbps */
2537 WLAN_LOG_DEBUG(1, "Unrecoginzed Rate of %d\n",
2549 /*----------------------------------------------------------------
2550 * prism2mgmt_get_grpaddr
2552 * Retrieves a particular group address from the list of
2557 * pstr wlan octet string
2558 * priv prism2 driver private data structure
2563 ----------------------------------------------------------------*/
2564 void prism2mgmt_get_grpaddr(u32 did, p80211pstrd_t *pstr,
2571 index = prism2mgmt_get_grpaddr_index(did);
2574 pstr->len = WLAN_ADDR_LEN;
2575 memcpy(pstr->data, hw->dot11_grp_addr[index],
2585 /*----------------------------------------------------------------
2586 * prism2mgmt_set_grpaddr
2588 * Convert the wlan octet string into an hfa384x bit area.
2599 ----------------------------------------------------------------*/
2600 int prism2mgmt_set_grpaddr(u32 did, u8 *prism2buf,
2601 p80211pstrd_t *pstr, hfa384x_t *hw )
2603 u8 no_addr[WLAN_ADDR_LEN];
2608 memset(no_addr, 0, WLAN_ADDR_LEN);
2609 if (memcmp(no_addr, pstr->data, WLAN_ADDR_LEN) != 0) {
2612 ** The address is NOT 0 so we are "adding" an address to the
2613 ** group address list. Check to make sure we aren't trying
2614 ** to add more than the maximum allowed number of group
2615 ** addresses in the list. The new address is added to the
2616 ** end of the list regardless of the DID used to add the
2620 if (hw->dot11_grpcnt >= MAX_GRP_ADDR) return(-1);
2622 memcpy(hw->dot11_grp_addr[hw->dot11_grpcnt], pstr->data,
2624 hw->dot11_grpcnt += 1;
2628 ** The address is 0. Interpret this as "deleting" an address
2629 ** from the group address list. Get the address index from
2630 ** the DID. If this is within the range of used addresses,
2631 ** then delete the specified address by shifting all following
2632 ** addresses down. Then clear the last address (which should
2633 ** now be unused). If the address index is NOT within the
2634 ** range of used addresses, then just ignore the address.
2637 index = prism2mgmt_get_grpaddr_index(did);
2638 if (index >= 0 && index < hw->dot11_grpcnt) {
2639 hw->dot11_grpcnt -= 1;
2640 memmove(hw->dot11_grp_addr[index],
2641 hw->dot11_grp_addr[index + 1],
2642 ((hw->dot11_grpcnt)-index) * WLAN_ADDR_LEN);
2643 memset(hw->dot11_grp_addr[hw->dot11_grpcnt], 0,