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