Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
/* src/prism2/driver/prism2mib.c
 *
 * Management request for mibset/mibget
 *
 * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
 * --------------------------------------------------------------------
 *
 * linux-wlan
 *
 *   The contents of this file are subject to the Mozilla Public
 *   License Version 1.1 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.mozilla.org/MPL/
 *
 *   Software distributed under the License is distributed on an "AS
 *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 *   implied. See the License for the specific language governing
 *   rights and limitations under the License.
 *
 *   Alternatively, the contents of this file may be used under the
 *   terms of the GNU Public License version 2 (the "GPL"), in which
 *   case the provisions of the GPL are applicable instead of the
 *   above.  If you wish to allow the use of your version of this file
 *   only under the terms of the GPL and not to allow others to use
 *   your version of this file under the MPL, indicate your decision
 *   by deleting the provisions above and replace them with the notice
 *   and other provisions required by the GPL.  If you do not delete
 *   the provisions above, a recipient may use your version of this
 *   file under either the MPL or the GPL.
 *
 * --------------------------------------------------------------------
 *
 * Inquiries regarding the linux-wlan Open Source project can be
 * made directly to:
 *
 * AbsoluteValue Systems Inc.
 * info@linux-wlan.com
 * http://www.linux-wlan.com
 *
 * --------------------------------------------------------------------
 *
 * Portions of the development of this software were funded by
 * Intersil Corporation as part of PRISM(R) chipset product development.
 *
 * --------------------------------------------------------------------
 *
 * The functions in this file handle the mibset/mibget management
 * functions.
 *
 * --------------------------------------------------------------------
 */

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/wireless.h>
#include <linux/netdevice.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <asm/byteorder.h>
#include <linux/usb.h>
#include <linux/bitops.h>

#include "p80211types.h"
#include "p80211hdr.h"
#include "p80211mgmt.h"
#include "p80211conv.h"
#include "p80211msg.h"
#include "p80211netdev.h"
#include "p80211metadef.h"
#include "p80211metastruct.h"
#include "hfa384x.h"
#include "prism2mgmt.h"

#define MIB_TMP_MAXLEN    200	/* Max length of RID record (in bytes). */

#define  F_STA        0x1	/* MIB is supported on stations. */
#define  F_READ       0x2	/* MIB may be read. */
#define  F_WRITE      0x4	/* MIB may be written. */

struct mibrec {
	u32 did;
	u16 flag;
	u16 parm1;
	u16 parm2;
	u16 parm3;
	int (*func)(struct mibrec *mib,
		     int isget,
		     struct wlandevice *wlandev,
		     struct hfa384x *hw,
		     struct p80211msg_dot11req_mibset *msg, void *data);
};

static int prism2mib_bytearea2pstr(struct mibrec *mib,
				   int isget,
				   struct wlandevice *wlandev,
				   struct hfa384x *hw,
				   struct p80211msg_dot11req_mibset *msg,
				   void *data);

static int prism2mib_uint32(struct mibrec *mib,
			    int isget,
			    struct wlandevice *wlandev,
			    struct hfa384x *hw,
			    struct p80211msg_dot11req_mibset *msg, void *data);

static int prism2mib_flag(struct mibrec *mib,
			  int isget,
			  struct wlandevice *wlandev,
			  struct hfa384x *hw,
			  struct p80211msg_dot11req_mibset *msg, void *data);

static int prism2mib_wepdefaultkey(struct mibrec *mib,
				   int isget,
				   struct wlandevice *wlandev,
				   struct hfa384x *hw,
				   struct p80211msg_dot11req_mibset *msg,
				   void *data);

static int prism2mib_privacyinvoked(struct mibrec *mib,
				    int isget,
				    struct wlandevice *wlandev,
				    struct hfa384x *hw,
				    struct p80211msg_dot11req_mibset *msg,
				    void *data);

static int prism2mib_excludeunencrypted(struct mibrec *mib,
					int isget,
					struct wlandevice *wlandev,
					struct hfa384x *hw,
					struct p80211msg_dot11req_mibset *msg,
					void *data);

static int prism2mib_fragmentationthreshold(struct mibrec *mib,
					    int isget,
					    struct wlandevice *wlandev,
					    struct hfa384x *hw,
					    struct p80211msg_dot11req_mibset *msg,
					    void *data);

static int prism2mib_priv(struct mibrec *mib,
			  int isget,
			  struct wlandevice *wlandev,
			  struct hfa384x *hw,
			  struct p80211msg_dot11req_mibset *msg, void *data);

static struct mibrec mibtab[] = {

	/* dot11smt MIB's */
	{DIDmib_dot11smt_dot11WEPDefaultKeysTable_key(1),
	 F_STA | F_WRITE,
	 HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0,
	 prism2mib_wepdefaultkey},
	{DIDmib_dot11smt_dot11WEPDefaultKeysTable_key(2),
	 F_STA | F_WRITE,
	 HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0,
	 prism2mib_wepdefaultkey},
	{DIDmib_dot11smt_dot11WEPDefaultKeysTable_key(3),
	 F_STA | F_WRITE,
	 HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0,
	 prism2mib_wepdefaultkey},
	{DIDmib_dot11smt_dot11WEPDefaultKeysTable_key(4),
	 F_STA | F_WRITE,
	 HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0,
	 prism2mib_wepdefaultkey},
	{DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
	 F_STA | F_READ | F_WRITE,
	 HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_PRIVINVOKED, 0,
	 prism2mib_privacyinvoked},
	{DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
	 F_STA | F_READ | F_WRITE,
	 HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0,
	 prism2mib_uint32},
	{DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
	 F_STA | F_READ | F_WRITE,
	 HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_EXCLUDE, 0,
	 prism2mib_excludeunencrypted},

	/* dot11mac MIB's */

	{DIDmib_dot11mac_dot11OperationTable_dot11MACAddress,
	 F_STA | F_READ | F_WRITE,
	 HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
	 prism2mib_bytearea2pstr},
	{DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold,
	 F_STA | F_READ | F_WRITE,
	 HFA384x_RID_RTSTHRESH, 0, 0,
	 prism2mib_uint32},
	{DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit,
	 F_STA | F_READ,
	 HFA384x_RID_SHORTRETRYLIMIT, 0, 0,
	 prism2mib_uint32},
	{DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit,
	 F_STA | F_READ,
	 HFA384x_RID_LONGRETRYLIMIT, 0, 0,
	 prism2mib_uint32},
	{DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold,
	 F_STA | F_READ | F_WRITE,
	 HFA384x_RID_FRAGTHRESH, 0, 0,
	 prism2mib_fragmentationthreshold},
	{DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime,
	 F_STA | F_READ,
	 HFA384x_RID_MAXTXLIFETIME, 0, 0,
	 prism2mib_uint32},

	/* dot11phy MIB's */

	{DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
	 F_STA | F_READ,
	 HFA384x_RID_CURRENTCHANNEL, 0, 0,
	 prism2mib_uint32},
	{DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel,
	 F_STA | F_READ | F_WRITE,
	 HFA384x_RID_TXPOWERMAX, 0, 0,
	 prism2mib_uint32},

	/* p2Static MIB's */

	{DIDmib_p2_p2Static_p2CnfPortType,
	 F_STA | F_READ | F_WRITE,
	 HFA384x_RID_CNFPORTTYPE, 0, 0,
	 prism2mib_uint32},

	/* p2MAC MIB's */

	{DIDmib_p2_p2MAC_p2CurrentTxRate,
	 F_STA | F_READ,
	 HFA384x_RID_CURRENTTXRATE, 0, 0,
	 prism2mib_uint32},

	/* And finally, lnx mibs */
	{DIDmib_lnx_lnxConfigTable_lnxRSNAIE,
	 F_STA | F_READ | F_WRITE,
	 HFA384x_RID_CNFWPADATA, 0, 0,
	 prism2mib_priv},
	{0, 0, 0, 0, 0, NULL}
};

/*
 * prism2mgmt_mibset_mibget
 *
 * Set the value of a mib item.
 *
 * Arguments:
 *	wlandev		wlan device structure
 *	msgp		ptr to msg buffer
 *
 * Returns:
 *	0	success and done
 *	<0	success, but we're waiting for something to finish.
 *	>0	an error occurred while handling the message.
 * Side effects:
 *
 * Call context:
 *	process thread  (usually)
 *	interrupt
 */

int prism2mgmt_mibset_mibget(struct wlandevice *wlandev, void *msgp)
{
	struct hfa384x *hw = wlandev->priv;
	int result, isget;
	struct mibrec *mib;

	u16 which;

	struct p80211msg_dot11req_mibset *msg = msgp;
	struct p80211itemd *mibitem;

	msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
	msg->resultcode.data = P80211ENUM_resultcode_success;

	/*
	 ** Determine if this is an Access Point or a station.
	 */

	which = F_STA;

	/*
	 ** Find the MIB in the MIB table.  Note that a MIB may be in the
	 ** table twice...once for an AP and once for a station.  Make sure
	 ** to get the correct one.  Note that DID=0 marks the end of the
	 ** MIB table.
	 */

	mibitem = (struct p80211itemd *)msg->mibattribute.data;

	for (mib = mibtab; mib->did != 0; mib++)
		if (mib->did == mibitem->did && (mib->flag & which))
			break;

	if (mib->did == 0) {
		msg->resultcode.data = P80211ENUM_resultcode_not_supported;
		goto done;
	}

	/*
	 ** Determine if this is a "mibget" or a "mibset".  If this is a
	 ** "mibget", then make sure that the MIB may be read.  Otherwise,
	 ** this is a "mibset" so make make sure that the MIB may be written.
	 */

	isget = (msg->msgcode == DIDmsg_dot11req_mibget);

	if (isget) {
		if (!(mib->flag & F_READ)) {
			msg->resultcode.data =
			    P80211ENUM_resultcode_cant_get_writeonly_mib;
			goto done;
		}
	} else {
		if (!(mib->flag & F_WRITE)) {
			msg->resultcode.data =
			    P80211ENUM_resultcode_cant_set_readonly_mib;
			goto done;
		}
	}

	/*
	 ** Execute the MIB function.  If things worked okay, then make
	 ** sure that the MIB function also worked okay.  If so, and this
	 ** is a "mibget", then the status value must be set for both the
	 ** "mibattribute" parameter and the mib item within the data
	 ** portion of the "mibattribute".
	 */

	result = mib->func(mib, isget, wlandev, hw, msg, (void *)mibitem->data);

	if (msg->resultcode.data == P80211ENUM_resultcode_success) {
		if (result != 0) {
			pr_debug("get/set failure, result=%d\n", result);
			msg->resultcode.data =
			    P80211ENUM_resultcode_implementation_failure;
		} else {
			if (isget) {
				msg->mibattribute.status =
				    P80211ENUM_msgitem_status_data_ok;
				mibitem->status =
				    P80211ENUM_msgitem_status_data_ok;
			}
		}
	}

done:
	return 0;
}

/*
 * prism2mib_bytearea2pstr
 *
 * Get/set pstr data to/from a byte area.
 *
 * MIB record parameters:
 *       parm1    Prism2 RID value.
 *       parm2    Number of bytes of RID data.
 *       parm3    Not used.
 *
 * Arguments:
 *       mib      MIB record.
 *       isget    MIBGET/MIBSET flag.
 *       wlandev  wlan device structure.
 *       priv     "priv" structure.
 *       hw       "hw" structure.
 *       msg      Message structure.
 *       data     Data buffer.
 *
 * Returns:
 *       0   - Success.
 *       ~0  - Error.
 *
 */

static int prism2mib_bytearea2pstr(struct mibrec *mib,
				   int isget,
				   struct wlandevice *wlandev,
				   struct hfa384x *hw,
				   struct p80211msg_dot11req_mibset *msg,
				   void *data)
{
	int result;
	struct p80211pstrd *pstr = data;
	u8 bytebuf[MIB_TMP_MAXLEN];

	if (isget) {
		result =
		    hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2);
		prism2mgmt_bytearea2pstr(bytebuf, pstr, mib->parm2);
	} else {
		memset(bytebuf, 0, mib->parm2);
		memcpy(bytebuf, pstr->data, pstr->len);
		result =
		    hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
	}

	return result;
}

/*
 * prism2mib_uint32
 *
 * Get/set uint32 data.
 *
 * MIB record parameters:
 *       parm1    Prism2 RID value.
 *       parm2    Not used.
 *       parm3    Not used.
 *
 * Arguments:
 *       mib      MIB record.
 *       isget    MIBGET/MIBSET flag.
 *       wlandev  wlan device structure.
 *       priv     "priv" structure.
 *       hw       "hw" structure.
 *       msg      Message structure.
 *       data     Data buffer.
 *
 * Returns:
 *       0   - Success.
 *       ~0  - Error.
 *
 */

static int prism2mib_uint32(struct mibrec *mib,
			    int isget,
			    struct wlandevice *wlandev,
			    struct hfa384x *hw,
			    struct p80211msg_dot11req_mibset *msg, void *data)
{
	int result;
	u32 *uint32 = data;
	u8 bytebuf[MIB_TMP_MAXLEN];
	u16 *wordbuf = (u16 *)bytebuf;

	if (isget) {
		result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
		*uint32 = *wordbuf;
	} else {
		*wordbuf = *uint32;
		result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
	}

	return result;
}

/*
 * prism2mib_flag
 *
 * Get/set a flag.
 *
 * MIB record parameters:
 *       parm1    Prism2 RID value.
 *       parm2    Bit to get/set.
 *       parm3    Not used.
 *
 * Arguments:
 *       mib      MIB record.
 *       isget    MIBGET/MIBSET flag.
 *       wlandev  wlan device structure.
 *       priv     "priv" structure.
 *       hw       "hw" structure.
 *       msg      Message structure.
 *       data     Data buffer.
 *
 * Returns:
 *       0   - Success.
 *       ~0  - Error.
 *
 */

static int prism2mib_flag(struct mibrec *mib,
			  int isget,
			  struct wlandevice *wlandev,
			  struct hfa384x *hw,
			  struct p80211msg_dot11req_mibset *msg, void *data)
{
	int result;
	u32 *uint32 = data;
	u8 bytebuf[MIB_TMP_MAXLEN];
	u16 *wordbuf = (u16 *)bytebuf;
	u32 flags;

	result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
	if (result == 0) {
		flags = *wordbuf;
		if (isget) {
			*uint32 = (flags & mib->parm2) ?
			    P80211ENUM_truth_true : P80211ENUM_truth_false;
		} else {
			if ((*uint32) == P80211ENUM_truth_true)
				flags |= mib->parm2;
			else
				flags &= ~mib->parm2;
			*wordbuf = flags;
			result =
			    hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
		}
	}

	return result;
}

/*
 * prism2mib_wepdefaultkey
 *
 * Get/set WEP default keys.
 *
 * MIB record parameters:
 *       parm1    Prism2 RID value.
 *       parm2    Number of bytes of RID data.
 *       parm3    Not used.
 *
 * Arguments:
 *       mib      MIB record.
 *       isget    MIBGET/MIBSET flag.
 *       wlandev  wlan device structure.
 *       priv     "priv" structure.
 *       hw       "hw" structure.
 *       msg      Message structure.
 *       data     Data buffer.
 *
 * Returns:
 *       0   - Success.
 *       ~0  - Error.
 *
 */

static int prism2mib_wepdefaultkey(struct mibrec *mib,
				   int isget,
				   struct wlandevice *wlandev,
				   struct hfa384x *hw,
				   struct p80211msg_dot11req_mibset *msg,
				   void *data)
{
	int result;
	struct p80211pstrd *pstr = data;
	u8 bytebuf[MIB_TMP_MAXLEN];
	u16 len;

	if (isget) {
		result = 0;	/* Should never happen. */
	} else {
		len = (pstr->len > 5) ? HFA384x_RID_CNFWEP128DEFAULTKEY_LEN :
		    HFA384x_RID_CNFWEPDEFAULTKEY_LEN;
		memset(bytebuf, 0, len);
		memcpy(bytebuf, pstr->data, pstr->len);
		result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, len);
	}

	return result;
}

/*
 * prism2mib_privacyinvoked
 *
 * Get/set the dot11PrivacyInvoked value.
 *
 * MIB record parameters:
 *       parm1    Prism2 RID value.
 *       parm2    Bit value for PrivacyInvoked flag.
 *       parm3    Not used.
 *
 * Arguments:
 *       mib      MIB record.
 *       isget    MIBGET/MIBSET flag.
 *       wlandev  wlan device structure.
 *       priv     "priv" structure.
 *       hw       "hw" structure.
 *       msg      Message structure.
 *       data     Data buffer.
 *
 * Returns:
 *       0   - Success.
 *       ~0  - Error.
 *
 */

static int prism2mib_privacyinvoked(struct mibrec *mib,
				    int isget,
				    struct wlandevice *wlandev,
				    struct hfa384x *hw,
				    struct p80211msg_dot11req_mibset *msg,
				    void *data)
{
	if (wlandev->hostwep & HOSTWEP_DECRYPT) {
		if (wlandev->hostwep & HOSTWEP_DECRYPT)
			mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
		if (wlandev->hostwep & HOSTWEP_ENCRYPT)
			mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_TXCRYPT;
	}

	return prism2mib_flag(mib, isget, wlandev, hw, msg, data);
}

/*
 * prism2mib_excludeunencrypted
 *
 * Get/set the dot11ExcludeUnencrypted value.
 *
 * MIB record parameters:
 *       parm1    Prism2 RID value.
 *       parm2    Bit value for ExcludeUnencrypted flag.
 *       parm3    Not used.
 *
 * Arguments:
 *       mib      MIB record.
 *       isget    MIBGET/MIBSET flag.
 *       wlandev  wlan device structure.
 *       priv     "priv" structure.
 *       hw       "hw" structure.
 *       msg      Message structure.
 *       data     Data buffer.
 *
 * Returns:
 *       0   - Success.
 *       ~0  - Error.
 *
 */

static int prism2mib_excludeunencrypted(struct mibrec *mib,
					int isget,
					struct wlandevice *wlandev,
					struct hfa384x *hw,
					struct p80211msg_dot11req_mibset *msg,
					void *data)
{

	return prism2mib_flag(mib, isget, wlandev, hw, msg, data);
}

/*
 * prism2mib_fragmentationthreshold
 *
 * Get/set the fragmentation threshold.
 *
 * MIB record parameters:
 *       parm1    Prism2 RID value.
 *       parm2    Not used.
 *       parm3    Not used.
 *
 * Arguments:
 *       mib      MIB record.
 *       isget    MIBGET/MIBSET flag.
 *       wlandev  wlan device structure.
 *       priv     "priv" structure.
 *       hw       "hw" structure.
 *       msg      Message structure.
 *       data     Data buffer.
 *
 * Returns:
 *       0   - Success.
 *       ~0  - Error.
 *
 */

static int prism2mib_fragmentationthreshold(struct mibrec *mib,
					    int isget,
					    struct wlandevice *wlandev,
					    struct hfa384x *hw,
					    struct p80211msg_dot11req_mibset *msg,
					    void *data)
{
	u32 *uint32 = data;

	if (!isget)
		if ((*uint32) % 2) {
			netdev_warn(wlandev->netdev,
				    "Attempt to set odd number FragmentationThreshold\n");
			msg->resultcode.data =
			    P80211ENUM_resultcode_not_supported;
			return 0;
		}

	return prism2mib_uint32(mib, isget, wlandev, hw, msg, data);
}

/*
 * prism2mib_priv
 *
 * Get/set values in the "priv" data structure.
 *
 * MIB record parameters:
 *       parm1    Not used.
 *       parm2    Not used.
 *       parm3    Not used.
 *
 * Arguments:
 *       mib      MIB record.
 *       isget    MIBGET/MIBSET flag.
 *       wlandev  wlan device structure.
 *       priv     "priv" structure.
 *       hw       "hw" structure.
 *       msg      Message structure.
 *       data     Data buffer.
 *
 * Returns:
 *       0   - Success.
 *       ~0  - Error.
 *
 */

static int prism2mib_priv(struct mibrec *mib,
			  int isget,
			  struct wlandevice *wlandev,
			  struct hfa384x *hw,
			  struct p80211msg_dot11req_mibset *msg, void *data)
{
	struct p80211pstrd *pstr = data;

	switch (mib->did) {
	case DIDmib_lnx_lnxConfigTable_lnxRSNAIE:{
			struct hfa384x_wpa_data wpa;

			if (isget) {
				hfa384x_drvr_getconfig(hw,
						       HFA384x_RID_CNFWPADATA,
						       (u8 *)&wpa,
						       sizeof(wpa));
				pstr->len = le16_to_cpu(wpa.datalen);
				memcpy(pstr->data, wpa.data, pstr->len);
			} else {
				wpa.datalen = cpu_to_le16(pstr->len);
				memcpy(wpa.data, pstr->data, pstr->len);

				hfa384x_drvr_setconfig(hw,
						       HFA384x_RID_CNFWPADATA,
						       (u8 *)&wpa,
						       sizeof(wpa));
			}
			break;
		}
	default:
		netdev_err(wlandev->netdev, "Unhandled DID 0x%08x\n", mib->did);
	}

	return 0;
}

/*
 * prism2mgmt_pstr2bytestr
 *
 * Convert the pstr data in the WLAN message structure into an hfa384x
 * byte string format.
 *
 * Arguments:
 *	bytestr		hfa384x byte string data type
 *	pstr		wlan message data
 *
 * Returns:
 * 	Nothing
 *
 */

void prism2mgmt_pstr2bytestr(struct hfa384x_bytestr *bytestr,
			     struct p80211pstrd *pstr)
{
	bytestr->len = cpu_to_le16((u16)(pstr->len));
	memcpy(bytestr->data, pstr->data, pstr->len);
}

/*
 * prism2mgmt_bytestr2pstr
 *
 * Convert the data in an hfa384x byte string format into a
 * pstr in the WLAN message.
 *
 * Arguments:
 *	bytestr		hfa384x byte string data type
 *	msg		wlan message
 *
 * Returns:
 *	Nothing
 *
 */

void prism2mgmt_bytestr2pstr(struct hfa384x_bytestr *bytestr,
			     struct p80211pstrd *pstr)
{
	pstr->len = (u8)(le16_to_cpu((u16)(bytestr->len)));
	memcpy(pstr->data, bytestr->data, pstr->len);
}

/*
 * prism2mgmt_bytearea2pstr
 *
 * Convert the data in an hfa384x byte area format into a pstr
 * in the WLAN message.
 *
 * Arguments:
 *	bytearea	hfa384x byte area data type
 *	msg		wlan message
 *
 * Returns:
 *	Nothing
 *
 */

void prism2mgmt_bytearea2pstr(u8 *bytearea, struct p80211pstrd *pstr, int len)
{
	pstr->len = (u8)len;
	memcpy(pstr->data, bytearea, len);
}