]> Pileus Git - ~andy/linux/blob - drivers/staging/vt6655/vntwifi.c
Merge branch 'bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs...
[~andy/linux] / drivers / staging / vt6655 / vntwifi.c
1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  *
20  * File: vntwifi.c
21  *
22  * Purpose: export functions for vntwifi lib
23  *
24  * Functions:
25  *
26  * Revision History:
27  *
28  * Author: Yiching Chen
29  *
30  * Date: feb. 2, 2005
31  *
32  */
33
34 #include "vntwifi.h"
35 #include "IEEE11h.h"
36 #include "country.h"
37 #include "device.h"
38 #include "wmgr.h"
39 #include "datarate.h"
40
41 //#define       PLICE_DEBUG
42
43 /*---------------------  Static Definitions -------------------------*/
44 //static int          msglevel                =MSG_LEVEL_DEBUG;
45 //static int          msglevel                =MSG_LEVEL_INFO;
46
47 /*---------------------  Static Classes  ----------------------------*/
48
49 /*---------------------  Static Variables  --------------------------*/
50
51 /*---------------------  Static Functions  --------------------------*/
52
53 /*---------------------  Export Variables  --------------------------*/
54
55 /*---------------------  Export Functions  --------------------------*/
56
57 /*+
58  *
59  * Description:
60  *    Set Operation Mode
61  *
62  * Parameters:
63  *  In:
64  *      pMgmtHandle - pointer to management object
65  *      eOPMode     - Opreation Mode
66  *  Out:
67  *      none
68  *
69  * Return Value: none
70  *
71 -*/
72 void
73 VNTWIFIvSetOPMode (
74     void *pMgmtHandle,
75     WMAC_CONFIG_MODE eOPMode
76     )
77 {
78     PSMgmtObject        pMgmt = (PSMgmtObject)pMgmtHandle;
79
80     pMgmt->eConfigMode = eOPMode;
81 }
82
83
84 /*+
85  *
86  * Description:
87  *    Set Operation Mode
88  *
89  * Parameters:
90  *  In:
91  *      pMgmtHandle - pointer to management object
92  *      wBeaconPeriod - Beacon Period
93  *      wATIMWindow - ATIM window
94  *      uChannel - channel number
95  *  Out:
96  *      none
97  *
98  * Return Value: none
99  *
100 -*/
101 void
102 VNTWIFIvSetIBSSParameter (
103     void *pMgmtHandle,
104     unsigned short wBeaconPeriod,
105     unsigned short wATIMWindow,
106     unsigned int uChannel
107     )
108 {
109     PSMgmtObject        pMgmt = (PSMgmtObject)pMgmtHandle;
110
111     pMgmt->wIBSSBeaconPeriod = wBeaconPeriod;
112     pMgmt->wIBSSATIMWindow = wATIMWindow;
113     pMgmt->uIBSSChannel = uChannel;
114 }
115
116 /*+
117  *
118  * Description:
119  *    Get current SSID
120  *
121  * Parameters:
122  *  In:
123  *      pMgmtHandle - pointer to management object
124  *  Out:
125  *      none
126  *
127  * Return Value: current SSID pointer.
128  *
129 -*/
130 PWLAN_IE_SSID
131 VNTWIFIpGetCurrentSSID (
132     void *pMgmtHandle
133     )
134 {
135     PSMgmtObject        pMgmt = (PSMgmtObject)pMgmtHandle;
136     return((PWLAN_IE_SSID) pMgmt->abyCurrSSID);
137 }
138
139 /*+
140  *
141  * Description:
142  *    Get current link channel
143  *
144  * Parameters:
145  *  In:
146  *      pMgmtHandle - pointer to management object
147  *  Out:
148  *      none
149  *
150  * Return Value: current Channel.
151  *
152 -*/
153 unsigned int
154 VNTWIFIpGetCurrentChannel (
155     void *pMgmtHandle
156     )
157 {
158     PSMgmtObject        pMgmt = (PSMgmtObject)pMgmtHandle;
159     if (pMgmtHandle != NULL) {
160         return (pMgmt->uCurrChannel);
161     }
162     return 0;
163 }
164
165 /*+
166  *
167  * Description:
168  *    Get current Assoc ID
169  *
170  * Parameters:
171  *  In:
172  *      pMgmtHandle - pointer to management object
173  *  Out:
174  *      none
175  *
176  * Return Value: current Assoc ID
177  *
178 -*/
179 unsigned short
180 VNTWIFIwGetAssocID (
181     void *pMgmtHandle
182     )
183 {
184     PSMgmtObject        pMgmt = (PSMgmtObject)pMgmtHandle;
185     return(pMgmt->wCurrAID);
186 }
187
188
189
190 /*+
191  *
192  * Description:
193  *    This routine return max support rate of IES
194  *
195  * Parameters:
196  *  In:
197  *      pSupportRateIEs
198  *      pExtSupportRateIEs
199  *
200  *  Out:
201  *
202  * Return Value: max support rate
203  *
204 -*/
205 unsigned char
206 VNTWIFIbyGetMaxSupportRate (
207     PWLAN_IE_SUPP_RATES pSupportRateIEs,
208     PWLAN_IE_SUPP_RATES pExtSupportRateIEs
209     )
210 {
211     unsigned char byMaxSupportRate = RATE_1M;
212     unsigned char bySupportRate = RATE_1M;
213     unsigned int ii = 0;
214
215     if (pSupportRateIEs) {
216         for (ii = 0; ii < pSupportRateIEs->len; ii++) {
217             bySupportRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
218             if (bySupportRate > byMaxSupportRate) {
219                 byMaxSupportRate = bySupportRate;
220             }
221         }
222     }
223     if (pExtSupportRateIEs) {
224         for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
225             bySupportRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
226             if (bySupportRate > byMaxSupportRate) {
227                 byMaxSupportRate = bySupportRate;
228             }
229         }
230     }
231
232     return byMaxSupportRate;
233 }
234
235 /*+
236  *
237  * Description:
238  *    This routine return data rate of ACK packtet
239  *
240  * Parameters:
241  *  In:
242  *      byRxDataRate
243  *      pSupportRateIEs
244  *      pExtSupportRateIEs
245  *
246  *  Out:
247  *
248  * Return Value: max support rate
249  *
250 -*/
251 unsigned char
252 VNTWIFIbyGetACKTxRate (
253     unsigned char byRxDataRate,
254     PWLAN_IE_SUPP_RATES pSupportRateIEs,
255     PWLAN_IE_SUPP_RATES pExtSupportRateIEs
256     )
257 {
258     unsigned char byMaxAckRate;
259     unsigned char byBasicRate;
260     unsigned int ii;
261
262     if (byRxDataRate <= RATE_11M) {
263         byMaxAckRate = RATE_1M;
264     } else  {
265         // 24M is mandatory for 802.11a and 802.11g
266         byMaxAckRate = RATE_24M;
267     }
268     if (pSupportRateIEs) {
269         for (ii = 0; ii < pSupportRateIEs->len; ii++) {
270             if (pSupportRateIEs->abyRates[ii] & 0x80) {
271                 byBasicRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
272                 if ((byBasicRate <= byRxDataRate) &&
273                     (byBasicRate > byMaxAckRate))  {
274                     byMaxAckRate = byBasicRate;
275                 }
276             }
277         }
278     }
279     if (pExtSupportRateIEs) {
280         for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
281             if (pExtSupportRateIEs->abyRates[ii] & 0x80) {
282                 byBasicRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
283                 if ((byBasicRate <= byRxDataRate) &&
284                     (byBasicRate > byMaxAckRate))  {
285                     byMaxAckRate = byBasicRate;
286                 }
287             }
288         }
289     }
290
291     return byMaxAckRate;
292 }
293
294 /*+
295  *
296  * Description:
297  *    Set Authentication Mode
298  *
299  * Parameters:
300  *  In:
301  *      pMgmtHandle - pointer to management object
302  *      eAuthMode   - Authentication mode
303  *  Out:
304  *      none
305  *
306  * Return Value: none
307  *
308 -*/
309 void
310 VNTWIFIvSetAuthenticationMode (
311     void *pMgmtHandle,
312     WMAC_AUTHENTICATION_MODE eAuthMode
313     )
314 {
315     PSMgmtObject        pMgmt = (PSMgmtObject)pMgmtHandle;
316
317     pMgmt->eAuthenMode = eAuthMode;
318     if ((eAuthMode == WMAC_AUTH_SHAREKEY) ||
319         (eAuthMode == WMAC_AUTH_AUTO)) {
320         pMgmt->bShareKeyAlgorithm = true;
321     } else {
322         pMgmt->bShareKeyAlgorithm = false;
323     }
324 }
325
326 /*+
327  *
328  * Description:
329  *    Set Encryption Mode
330  *
331  * Parameters:
332  *  In:
333  *      pMgmtHandle - pointer to management object
334  *      eAuthMode   - Authentication mode
335  *  Out:
336  *      none
337  *
338  * Return Value: none
339  *
340 -*/
341 void
342 VNTWIFIvSetEncryptionMode (
343     void *pMgmtHandle,
344     WMAC_ENCRYPTION_MODE eEncryptionMode
345     )
346 {
347     PSMgmtObject        pMgmt = (PSMgmtObject)pMgmtHandle;
348
349     pMgmt->eEncryptionMode = eEncryptionMode;
350     if ((eEncryptionMode == WMAC_ENCRYPTION_WEPEnabled) ||
351         (eEncryptionMode == WMAC_ENCRYPTION_TKIPEnabled) ||
352         (eEncryptionMode == WMAC_ENCRYPTION_AESEnabled) ) {
353         pMgmt->bPrivacyInvoked = true;
354     } else {
355         pMgmt->bPrivacyInvoked = false;
356     }
357 }
358
359
360
361 bool
362 VNTWIFIbConfigPhyMode (
363     void *pMgmtHandle,
364     CARD_PHY_TYPE ePhyType
365     )
366 {
367     PSMgmtObject        pMgmt = (PSMgmtObject)pMgmtHandle;
368
369     if ((ePhyType != PHY_TYPE_AUTO) &&
370         (ePhyType != pMgmt->eCurrentPHYMode)) {
371         if (CARDbSetPhyParameter(pMgmt->pAdapter, ePhyType, 0, 0, NULL, NULL)==true) {
372             pMgmt->eCurrentPHYMode = ePhyType;
373         } else {
374             return(false);
375         }
376     }
377     pMgmt->eConfigPHYMode = ePhyType;
378     return(true);
379 }
380
381
382 void
383 VNTWIFIbGetConfigPhyMode (
384     void *pMgmtHandle,
385     void *pePhyType
386     )
387 {
388     PSMgmtObject        pMgmt = (PSMgmtObject)pMgmtHandle;
389
390     if ((pMgmt != NULL) && (pePhyType != NULL)) {
391         *(PCARD_PHY_TYPE)pePhyType = pMgmt->eConfigPHYMode;
392     }
393 }
394
395 /*+
396  *
397  * Description:
398  *      Clear BSS List Database except current assoc BSS
399  *
400  * Parameters:
401  *  In:
402  *      pMgmtHandle     - Management Object structure
403  *      bLinkPass       - Current Link status
404  *  Out:
405  *
406  * Return Value: None.
407  *
408 -*/
409
410
411 /*+
412  *
413  * Description:
414  *      Query BSS List in management database
415  *
416  * Parameters:
417  *  In:
418  *      pMgmtHandle     - Management Object structure
419  *  Out:
420  *      puBSSCount      - BSS count
421  *      pvFirstBSS      - pointer to first BSS
422  *
423  * Return Value: None.
424  *
425 -*/
426
427 void
428 VNTWIFIvQueryBSSList(void *pMgmtHandle, unsigned int *puBSSCount, void **pvFirstBSS)
429 {
430     unsigned int ii = 0;
431     PSMgmtObject    pMgmt = (PSMgmtObject)pMgmtHandle;
432     PKnownBSS       pBSS = NULL;
433     unsigned int uCount = 0;
434
435     *pvFirstBSS = NULL;
436
437     for (ii = 0; ii < MAX_BSS_NUM; ii++) {
438         pBSS = &(pMgmt->sBSSList[ii]);
439         if (!pBSS->bActive) {
440             continue;
441         }
442         if (*pvFirstBSS == NULL) {
443             *pvFirstBSS = &(pMgmt->sBSSList[ii]);
444         }
445         uCount++;
446     }
447     *puBSSCount = uCount;
448 }
449
450
451
452
453 void
454 VNTWIFIvGetNextBSS (
455     void *pMgmtHandle,
456     void *pvCurrentBSS,
457     void **pvNextBSS
458     )
459 {
460     PKnownBSS       pBSS = (PKnownBSS) pvCurrentBSS;
461     PSMgmtObject    pMgmt = (PSMgmtObject)pMgmtHandle;
462
463     *pvNextBSS = NULL;
464
465     while (*pvNextBSS == NULL) {
466         pBSS++;
467         if (pBSS > &(pMgmt->sBSSList[MAX_BSS_NUM])) {
468             return;
469         }
470         if (pBSS->bActive == true) {
471             *pvNextBSS = pBSS;
472             return;
473         }
474     }
475 }
476
477
478
479
480
481 /*+
482  *
483  * Description:
484  *      Update Tx attemps, Tx failure counter in Node DB
485  *
486  *  In:
487  *  Out:
488  *      none
489  *
490  * Return Value: none
491  *
492 -*/
493 void
494 VNTWIFIvUpdateNodeTxCounter(
495     void *pMgmtHandle,
496     unsigned char *pbyDestAddress,
497     bool bTxOk,
498     unsigned short wRate,
499     unsigned char *pbyTxFailCount
500     )
501 {
502     PSMgmtObject    pMgmt = (PSMgmtObject)pMgmtHandle;
503     unsigned int uNodeIndex = 0;
504     unsigned int ii;
505
506     if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
507         (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
508         if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex) == false) {
509             return;
510         }
511     }
512     pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts++;
513     if (bTxOk == true) {
514         // transmit success, TxAttempts at least plus one
515         pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
516         pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wRate]++;
517     } else {
518         pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++;
519     }
520     pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += pbyTxFailCount[MAX_RATE];
521     for(ii=0;ii<MAX_RATE;ii++) {
522         pMgmt->sNodeDBTable[uNodeIndex].uTxFail[ii] += pbyTxFailCount[ii];
523     }
524     return;
525 }
526
527
528 void
529 VNTWIFIvGetTxRate(
530     void *pMgmtHandle,
531     unsigned char *pbyDestAddress,
532     unsigned short *pwTxDataRate,
533     unsigned char *pbyACKRate,
534     unsigned char *pbyCCKBasicRate,
535     unsigned char *pbyOFDMBasicRate
536     )
537 {
538     PSMgmtObject        pMgmt = (PSMgmtObject)pMgmtHandle;
539     unsigned int uNodeIndex = 0;
540     unsigned short wTxDataRate = RATE_1M;
541     unsigned char byACKRate = RATE_1M;
542     unsigned char byCCKBasicRate = RATE_1M;
543     unsigned char byOFDMBasicRate = RATE_24M;
544     PWLAN_IE_SUPP_RATES pSupportRateIEs = NULL;
545     PWLAN_IE_SUPP_RATES pExtSupportRateIEs = NULL;
546
547
548     if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
549         (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
550         // Adhoc Tx rate decided from node DB
551         if(BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex)) {
552             wTxDataRate = (pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
553             pSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrSuppRates);
554             pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrExtSuppRates);
555         } else {
556             if (pMgmt->eCurrentPHYMode != PHY_TYPE_11A) {
557                 wTxDataRate = RATE_2M;
558             } else {
559                 wTxDataRate = RATE_24M;
560             }
561             pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
562             pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
563         }
564     } else { // Infrastructure: rate decided from AP Node, index = 0
565
566                 wTxDataRate = (pMgmt->sNodeDBTable[0].wTxDataRate);
567 #ifdef  PLICE_DEBUG
568                 printk("GetTxRate:AP MAC is %02x:%02x:%02x:%02x:%02x:%02x,TxRate is %d\n",
569                                 pMgmt->sNodeDBTable[0].abyMACAddr[0],pMgmt->sNodeDBTable[0].abyMACAddr[1],
570                                 pMgmt->sNodeDBTable[0].abyMACAddr[2],pMgmt->sNodeDBTable[0].abyMACAddr[3],
571                                 pMgmt->sNodeDBTable[0].abyMACAddr[4],pMgmt->sNodeDBTable[0].abyMACAddr[5],wTxDataRate);
572 #endif
573
574
575         pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
576         pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
577     }
578     byACKRate = VNTWIFIbyGetACKTxRate(  (unsigned char) wTxDataRate,
579                                         pSupportRateIEs,
580                                         pExtSupportRateIEs
581                                         );
582     if (byACKRate > (unsigned char) wTxDataRate) {
583         byACKRate = (unsigned char) wTxDataRate;
584     }
585     byCCKBasicRate = VNTWIFIbyGetACKTxRate( RATE_11M,
586                                             pSupportRateIEs,
587                                             pExtSupportRateIEs
588                                             );
589     byOFDMBasicRate = VNTWIFIbyGetACKTxRate(RATE_54M,
590                                             pSupportRateIEs,
591                                             pExtSupportRateIEs
592                                             );
593     *pwTxDataRate = wTxDataRate;
594     *pbyACKRate = byACKRate;
595     *pbyCCKBasicRate = byCCKBasicRate;
596     *pbyOFDMBasicRate = byOFDMBasicRate;
597     return;
598 }
599
600 unsigned char
601 VNTWIFIbyGetKeyCypher(
602     void *pMgmtHandle,
603     bool bGroupKey
604     )
605 {
606     PSMgmtObject    pMgmt = (PSMgmtObject)pMgmtHandle;
607
608     if (bGroupKey == true) {
609         return (pMgmt->byCSSGK);
610     } else {
611         return (pMgmt->byCSSPK);
612     }
613 }
614
615
616 /*
617 bool
618 VNTWIFIbInit(
619     void *pAdapterHandler,
620     void **pMgmtHandler
621     )
622 {
623
624     PSMgmtObject        pMgmt = NULL;
625     unsigned int ii;
626
627
628     pMgmt = (PSMgmtObject)kmalloc(sizeof(SMgmtObject), (int)GFP_ATOMIC);
629     if (pMgmt == NULL) {
630         *pMgmtHandler = NULL;
631         return false;
632     }
633
634     memset(pMgmt, 0, sizeof(SMgmtObject));
635     pMgmt->pAdapter = (void *) pAdapterHandler;
636
637     // should initial MAC address abyMACAddr
638     for(ii=0;ii<WLAN_BSSID_LEN;ii++) {
639         pMgmt->abyDesireBSSID[ii] = 0xFF;
640     }
641     pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0];
642     pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0];
643     pMgmt->byCSSPK = KEY_CTL_NONE;
644     pMgmt->byCSSGK = KEY_CTL_NONE;
645     pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI;
646
647     pMgmt->cbFreeCmdQueue = CMD_Q_SIZE;
648     pMgmt->uCmdDequeueIdx = 0;
649     pMgmt->uCmdEnqueueIdx = 0;
650     pMgmt->eCommandState = WLAN_CMD_STATE_IDLE;
651     pMgmt->bCmdStop = false;
652     pMgmt->bCmdRunning = false;
653
654     *pMgmtHandler = pMgmt;
655     return true;
656 }
657 */
658
659
660
661 bool
662 VNTWIFIbSetPMKIDCache (
663     void *pMgmtObject,
664     unsigned long ulCount,
665     void *pPMKIDInfo
666     )
667 {
668     PSMgmtObject    pMgmt = (PSMgmtObject) pMgmtObject;
669
670     if (ulCount > MAX_PMKID_CACHE) {
671         return (false);
672     }
673     pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount;
674     memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo)));
675     return (true);
676 }
677
678
679
680 unsigned short
681 VNTWIFIwGetMaxSupportRate(
682     void *pMgmtObject
683     )
684 {
685     unsigned short wRate = RATE_54M;
686     PSMgmtObject    pMgmt = (PSMgmtObject) pMgmtObject;
687
688     for(wRate = RATE_54M; wRate > RATE_1M; wRate--) {
689         if (pMgmt->sNodeDBTable[0].wSuppRate & (1<<wRate)) {
690             return (wRate);
691         }
692     }
693     if (pMgmt->eCurrentPHYMode == PHY_TYPE_11A) {
694         return (RATE_6M);
695     } else {
696         return (RATE_1M);
697     }
698 }
699
700
701 void
702 VNTWIFIvSet11h (
703     void *pMgmtObject,
704     bool b11hEnable
705     )
706 {
707     PSMgmtObject    pMgmt = (PSMgmtObject) pMgmtObject;
708
709     pMgmt->b11hEnable = b11hEnable;
710 }
711
712 bool
713 VNTWIFIbMeasureReport(
714     void *pMgmtObject,
715     bool bEndOfReport,
716     void *pvMeasureEID,
717     unsigned char byReportMode,
718     unsigned char byBasicMap,
719     unsigned char byCCAFraction,
720     unsigned char *pbyRPIs
721     )
722 {
723     PSMgmtObject    pMgmt = (PSMgmtObject) pMgmtObject;
724     unsigned char *pbyCurrentEID = (unsigned char *) (pMgmt->pCurrMeasureEIDRep);
725
726     //spin_lock_irq(&pDevice->lock);
727     if ((pvMeasureEID != NULL) &&
728         (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(WLAN_80211HDR_A3) - 3))
729         ) {
730         pMgmt->pCurrMeasureEIDRep->byElementID = WLAN_EID_MEASURE_REP;
731         pMgmt->pCurrMeasureEIDRep->len = 3;
732         pMgmt->pCurrMeasureEIDRep->byToken = ((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->byToken;
733         pMgmt->pCurrMeasureEIDRep->byMode = byReportMode;
734         pMgmt->pCurrMeasureEIDRep->byType = ((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->byType;
735         switch (pMgmt->pCurrMeasureEIDRep->byType) {
736             case MEASURE_TYPE_BASIC :
737                 pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_BASIC);
738                 memcpy(   &(pMgmt->pCurrMeasureEIDRep->sRep.sBasic),
739                             &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
740                             sizeof(MEASEURE_REQ));
741                 pMgmt->pCurrMeasureEIDRep->sRep.sBasic.byMap = byBasicMap;
742                 break;
743             case MEASURE_TYPE_CCA :
744                 pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_CCA);
745                 memcpy(   &(pMgmt->pCurrMeasureEIDRep->sRep.sCCA),
746                             &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
747                             sizeof(MEASEURE_REQ));
748                 pMgmt->pCurrMeasureEIDRep->sRep.sCCA.byCCABusyFraction = byCCAFraction;
749                 break;
750             case MEASURE_TYPE_RPI :
751                 pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_RPI);
752                 memcpy(   &(pMgmt->pCurrMeasureEIDRep->sRep.sRPI),
753                             &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
754                             sizeof(MEASEURE_REQ));
755                 memcpy(pMgmt->pCurrMeasureEIDRep->sRep.sRPI.abyRPIdensity, pbyRPIs, 8);
756                 break;
757             default :
758                 break;
759         }
760         pbyCurrentEID += (2 + pMgmt->pCurrMeasureEIDRep->len);
761         pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len);
762         pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID;
763     }
764     if (bEndOfReport == true) {
765         IEEE11hbMSRRepTx(pMgmt);
766     }
767     //spin_unlock_irq(&pDevice->lock);
768     return (true);
769 }
770
771
772 bool
773 VNTWIFIbChannelSwitch(
774     void *pMgmtObject,
775     unsigned char byNewChannel
776     )
777 {
778     PSMgmtObject    pMgmt = (PSMgmtObject) pMgmtObject;
779
780     //spin_lock_irq(&pDevice->lock);
781     pMgmt->uCurrChannel = byNewChannel;
782     pMgmt->bSwitchChannel = false;
783     //spin_unlock_irq(&pDevice->lock);
784     return true;
785 }
786
787 /*
788 bool
789 VNTWIFIbRadarPresent(
790     void *pMgmtObject,
791     unsigned char byChannel
792     )
793 {
794     PSMgmtObject    pMgmt = (PSMgmtObject) pMgmtObject;
795     if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
796         (byChannel == (unsigned char) pMgmt->uCurrChannel) &&
797         (pMgmt->bSwitchChannel != true) &&
798         (pMgmt->b11hEnable == true)) {
799         if (!compare_ether_addr(pMgmt->abyIBSSDFSOwner, CARDpGetCurrentAddress(pMgmt->pAdapter))) {
800             pMgmt->byNewChannel = CARDbyAutoChannelSelect(pMgmt->pAdapter,(unsigned char) pMgmt->uCurrChannel);
801             pMgmt->bSwitchChannel = true;
802         }
803         BEACONbSendBeacon(pMgmt);
804         CARDbChannelSwitch(pMgmt->pAdapter, 0, pMgmt->byNewChannel, 10);
805     }
806     return true;
807 }
808 */
809