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