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