i2c-eg20t: change timeout value 50msec to 1000msec
[zen-stable.git] / drivers / staging / vt6655 / vntwifi.c
blob0491d0b52c854ad7ee99cfa398fe584a16d3ee93
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
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.
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.
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.
20 * File: vntwifi.c
22 * Purpose: export functions for vntwifi lib
24 * Functions:
26 * Revision History:
28 * Author: Yiching Chen
30 * Date: feb. 2, 2005
34 #include "vntwifi.h"
35 #include "IEEE11h.h"
36 #include "country.h"
37 #include "device.h"
38 #include "wmgr.h"
39 #include "datarate.h"
41 //#define PLICE_DEBUG
43 /*--------------------- Static Definitions -------------------------*/
44 //static int msglevel =MSG_LEVEL_DEBUG;
45 //static int msglevel =MSG_LEVEL_INFO;
47 /*--------------------- Static Classes ----------------------------*/
49 /*--------------------- Static Variables --------------------------*/
51 /*--------------------- Static Functions --------------------------*/
53 /*--------------------- Export Variables --------------------------*/
55 /*--------------------- Export Functions --------------------------*/
57 /*+
59 * Description:
60 * Set Operation Mode
62 * Parameters:
63 * In:
64 * pMgmtHandle - pointer to management object
65 * eOPMode - Opreation Mode
66 * Out:
67 * none
69 * Return Value: none
71 -*/
72 void
73 VNTWIFIvSetOPMode (
74 void *pMgmtHandle,
75 WMAC_CONFIG_MODE eOPMode
78 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
80 pMgmt->eConfigMode = eOPMode;
84 /*+
86 * Description:
87 * Set Operation Mode
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
98 * Return Value: none
101 void
102 VNTWIFIvSetIBSSParameter (
103 void *pMgmtHandle,
104 unsigned short wBeaconPeriod,
105 unsigned short wATIMWindow,
106 unsigned int uChannel
109 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
111 pMgmt->wIBSSBeaconPeriod = wBeaconPeriod;
112 pMgmt->wIBSSATIMWindow = wATIMWindow;
113 pMgmt->uIBSSChannel = uChannel;
118 * Description:
119 * Get current SSID
121 * Parameters:
122 * In:
123 * pMgmtHandle - pointer to management object
124 * Out:
125 * none
127 * Return Value: current SSID pointer.
130 PWLAN_IE_SSID
131 VNTWIFIpGetCurrentSSID (
132 void *pMgmtHandle
135 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
136 return((PWLAN_IE_SSID) pMgmt->abyCurrSSID);
141 * Description:
142 * Get current link channel
144 * Parameters:
145 * In:
146 * pMgmtHandle - pointer to management object
147 * Out:
148 * none
150 * Return Value: current Channel.
153 unsigned int
154 VNTWIFIpGetCurrentChannel (
155 void *pMgmtHandle
158 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
159 if (pMgmtHandle != NULL) {
160 return (pMgmt->uCurrChannel);
162 return 0;
167 * Description:
168 * Get current Assoc ID
170 * Parameters:
171 * In:
172 * pMgmtHandle - pointer to management object
173 * Out:
174 * none
176 * Return Value: current Assoc ID
179 unsigned short
180 VNTWIFIwGetAssocID (
181 void *pMgmtHandle
184 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
185 return(pMgmt->wCurrAID);
192 * Description:
193 * This routine return max support rate of IES
195 * Parameters:
196 * In:
197 * pSupportRateIEs
198 * pExtSupportRateIEs
200 * Out:
202 * Return Value: max support rate
205 unsigned char
206 VNTWIFIbyGetMaxSupportRate (
207 PWLAN_IE_SUPP_RATES pSupportRateIEs,
208 PWLAN_IE_SUPP_RATES pExtSupportRateIEs
211 unsigned char byMaxSupportRate = RATE_1M;
212 unsigned char bySupportRate = RATE_1M;
213 unsigned int ii = 0;
215 if (pSupportRateIEs) {
216 for (ii = 0; ii < pSupportRateIEs->len; ii++) {
217 bySupportRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
218 if (bySupportRate > byMaxSupportRate) {
219 byMaxSupportRate = bySupportRate;
223 if (pExtSupportRateIEs) {
224 for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
225 bySupportRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
226 if (bySupportRate > byMaxSupportRate) {
227 byMaxSupportRate = bySupportRate;
232 return byMaxSupportRate;
237 * Description:
238 * This routine return data rate of ACK packtet
240 * Parameters:
241 * In:
242 * byRxDataRate
243 * pSupportRateIEs
244 * pExtSupportRateIEs
246 * Out:
248 * Return Value: max support rate
251 unsigned char
252 VNTWIFIbyGetACKTxRate (
253 unsigned char byRxDataRate,
254 PWLAN_IE_SUPP_RATES pSupportRateIEs,
255 PWLAN_IE_SUPP_RATES pExtSupportRateIEs
258 unsigned char byMaxAckRate;
259 unsigned char byBasicRate;
260 unsigned int ii;
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;
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;
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;
291 return byMaxAckRate;
296 * Description:
297 * Set Authentication Mode
299 * Parameters:
300 * In:
301 * pMgmtHandle - pointer to management object
302 * eAuthMode - Authentication mode
303 * Out:
304 * none
306 * Return Value: none
309 void
310 VNTWIFIvSetAuthenticationMode (
311 void *pMgmtHandle,
312 WMAC_AUTHENTICATION_MODE eAuthMode
315 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
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;
328 * Description:
329 * Set Encryption Mode
331 * Parameters:
332 * In:
333 * pMgmtHandle - pointer to management object
334 * eAuthMode - Authentication mode
335 * Out:
336 * none
338 * Return Value: none
341 void
342 VNTWIFIvSetEncryptionMode (
343 void *pMgmtHandle,
344 WMAC_ENCRYPTION_MODE eEncryptionMode
347 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
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;
361 bool
362 VNTWIFIbConfigPhyMode (
363 void *pMgmtHandle,
364 CARD_PHY_TYPE ePhyType
367 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
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);
377 pMgmt->eConfigPHYMode = ePhyType;
378 return(true);
382 void
383 VNTWIFIbGetConfigPhyMode (
384 void *pMgmtHandle,
385 void *pePhyType
388 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
390 if ((pMgmt != NULL) && (pePhyType != NULL)) {
391 *(PCARD_PHY_TYPE)pePhyType = pMgmt->eConfigPHYMode;
397 * Description:
398 * Clear BSS List Database except current assoc BSS
400 * Parameters:
401 * In:
402 * pMgmtHandle - Management Object structure
403 * bLinkPass - Current Link status
404 * Out:
406 * Return Value: None.
413 * Description:
414 * Query BSS List in management database
416 * Parameters:
417 * In:
418 * pMgmtHandle - Management Object structure
419 * Out:
420 * puBSSCount - BSS count
421 * pvFirstBSS - pointer to first BSS
423 * Return Value: None.
427 void
428 VNTWIFIvQueryBSSList(void *pMgmtHandle, unsigned int *puBSSCount, void **pvFirstBSS)
430 unsigned int ii = 0;
431 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
432 PKnownBSS pBSS = NULL;
433 unsigned int uCount = 0;
435 *pvFirstBSS = NULL;
437 for (ii = 0; ii < MAX_BSS_NUM; ii++) {
438 pBSS = &(pMgmt->sBSSList[ii]);
439 if (!pBSS->bActive) {
440 continue;
442 if (*pvFirstBSS == NULL) {
443 *pvFirstBSS = &(pMgmt->sBSSList[ii]);
445 uCount++;
447 *puBSSCount = uCount;
453 void
454 VNTWIFIvGetNextBSS (
455 void *pMgmtHandle,
456 void *pvCurrentBSS,
457 void **pvNextBSS
460 PKnownBSS pBSS = (PKnownBSS) pvCurrentBSS;
461 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
463 *pvNextBSS = NULL;
465 while (*pvNextBSS == NULL) {
466 pBSS++;
467 if (pBSS > &(pMgmt->sBSSList[MAX_BSS_NUM])) {
468 return;
470 if (pBSS->bActive == true) {
471 *pvNextBSS = pBSS;
472 return;
483 * Description:
484 * Update Tx attemps, Tx failure counter in Node DB
486 * In:
487 * Out:
488 * none
490 * Return Value: none
493 void
494 VNTWIFIvUpdateNodeTxCounter(
495 void *pMgmtHandle,
496 unsigned char *pbyDestAddress,
497 bool bTxOk,
498 unsigned short wRate,
499 unsigned char *pbyTxFailCount
502 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
503 unsigned int uNodeIndex = 0;
504 unsigned int ii;
506 if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
507 (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
508 if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex) == false) {
509 return;
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++;
520 pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += pbyTxFailCount[MAX_RATE];
521 for(ii=0;ii<MAX_RATE;ii++) {
522 pMgmt->sNodeDBTable[uNodeIndex].uTxFail[ii] += pbyTxFailCount[ii];
524 return;
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
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;
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;
561 pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
562 pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
564 } else { // Infrastructure: rate decided from AP Node, index = 0
566 wTxDataRate = (pMgmt->sNodeDBTable[0].wTxDataRate);
567 #ifdef PLICE_DEBUG
568 printk(KERN_DEBUG "GetTxRate:AP MAC is %pM,TxRate is %d\n",
569 pMgmt->sNodeDBTable[0].abyMACAddr, wTxDataRate);
570 #endif
573 pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
574 pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
576 byACKRate = VNTWIFIbyGetACKTxRate( (unsigned char) wTxDataRate,
577 pSupportRateIEs,
578 pExtSupportRateIEs
580 if (byACKRate > (unsigned char) wTxDataRate) {
581 byACKRate = (unsigned char) wTxDataRate;
583 byCCKBasicRate = VNTWIFIbyGetACKTxRate( RATE_11M,
584 pSupportRateIEs,
585 pExtSupportRateIEs
587 byOFDMBasicRate = VNTWIFIbyGetACKTxRate(RATE_54M,
588 pSupportRateIEs,
589 pExtSupportRateIEs
591 *pwTxDataRate = wTxDataRate;
592 *pbyACKRate = byACKRate;
593 *pbyCCKBasicRate = byCCKBasicRate;
594 *pbyOFDMBasicRate = byOFDMBasicRate;
595 return;
598 unsigned char
599 VNTWIFIbyGetKeyCypher(
600 void *pMgmtHandle,
601 bool bGroupKey
604 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
606 if (bGroupKey == true) {
607 return (pMgmt->byCSSGK);
608 } else {
609 return (pMgmt->byCSSPK);
615 bool
616 VNTWIFIbInit(
617 void *pAdapterHandler,
618 void **pMgmtHandler
622 PSMgmtObject pMgmt = NULL;
623 unsigned int ii;
626 pMgmt = (PSMgmtObject)kmalloc(sizeof(SMgmtObject), (int)GFP_ATOMIC);
627 if (pMgmt == NULL) {
628 *pMgmtHandler = NULL;
629 return false;
632 memset(pMgmt, 0, sizeof(SMgmtObject));
633 pMgmt->pAdapter = (void *) pAdapterHandler;
635 // should initial MAC address abyMACAddr
636 for(ii=0;ii<WLAN_BSSID_LEN;ii++) {
637 pMgmt->abyDesireBSSID[ii] = 0xFF;
639 pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0];
640 pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0];
641 pMgmt->byCSSPK = KEY_CTL_NONE;
642 pMgmt->byCSSGK = KEY_CTL_NONE;
643 pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI;
645 pMgmt->cbFreeCmdQueue = CMD_Q_SIZE;
646 pMgmt->uCmdDequeueIdx = 0;
647 pMgmt->uCmdEnqueueIdx = 0;
648 pMgmt->eCommandState = WLAN_CMD_STATE_IDLE;
649 pMgmt->bCmdStop = false;
650 pMgmt->bCmdRunning = false;
652 *pMgmtHandler = pMgmt;
653 return true;
659 bool
660 VNTWIFIbSetPMKIDCache (
661 void *pMgmtObject,
662 unsigned long ulCount,
663 void *pPMKIDInfo
666 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
668 if (ulCount > MAX_PMKID_CACHE) {
669 return (false);
671 pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount;
672 memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo)));
673 return (true);
678 unsigned short
679 VNTWIFIwGetMaxSupportRate(
680 void *pMgmtObject
683 unsigned short wRate = RATE_54M;
684 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
686 for(wRate = RATE_54M; wRate > RATE_1M; wRate--) {
687 if (pMgmt->sNodeDBTable[0].wSuppRate & (1<<wRate)) {
688 return (wRate);
691 if (pMgmt->eCurrentPHYMode == PHY_TYPE_11A) {
692 return (RATE_6M);
693 } else {
694 return (RATE_1M);
699 void
700 VNTWIFIvSet11h (
701 void *pMgmtObject,
702 bool b11hEnable
705 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
707 pMgmt->b11hEnable = b11hEnable;
710 bool
711 VNTWIFIbMeasureReport(
712 void *pMgmtObject,
713 bool bEndOfReport,
714 void *pvMeasureEID,
715 unsigned char byReportMode,
716 unsigned char byBasicMap,
717 unsigned char byCCAFraction,
718 unsigned char *pbyRPIs
721 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
722 unsigned char *pbyCurrentEID = (unsigned char *) (pMgmt->pCurrMeasureEIDRep);
724 //spin_lock_irq(&pDevice->lock);
725 if ((pvMeasureEID != NULL) &&
726 (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(WLAN_80211HDR_A3) - 3))
728 pMgmt->pCurrMeasureEIDRep->byElementID = WLAN_EID_MEASURE_REP;
729 pMgmt->pCurrMeasureEIDRep->len = 3;
730 pMgmt->pCurrMeasureEIDRep->byToken = ((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->byToken;
731 pMgmt->pCurrMeasureEIDRep->byMode = byReportMode;
732 pMgmt->pCurrMeasureEIDRep->byType = ((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->byType;
733 switch (pMgmt->pCurrMeasureEIDRep->byType) {
734 case MEASURE_TYPE_BASIC :
735 pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_BASIC);
736 memcpy( &(pMgmt->pCurrMeasureEIDRep->sRep.sBasic),
737 &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
738 sizeof(MEASEURE_REQ));
739 pMgmt->pCurrMeasureEIDRep->sRep.sBasic.byMap = byBasicMap;
740 break;
741 case MEASURE_TYPE_CCA :
742 pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_CCA);
743 memcpy( &(pMgmt->pCurrMeasureEIDRep->sRep.sCCA),
744 &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
745 sizeof(MEASEURE_REQ));
746 pMgmt->pCurrMeasureEIDRep->sRep.sCCA.byCCABusyFraction = byCCAFraction;
747 break;
748 case MEASURE_TYPE_RPI :
749 pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_RPI);
750 memcpy( &(pMgmt->pCurrMeasureEIDRep->sRep.sRPI),
751 &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
752 sizeof(MEASEURE_REQ));
753 memcpy(pMgmt->pCurrMeasureEIDRep->sRep.sRPI.abyRPIdensity, pbyRPIs, 8);
754 break;
755 default :
756 break;
758 pbyCurrentEID += (2 + pMgmt->pCurrMeasureEIDRep->len);
759 pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len);
760 pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID;
762 if (bEndOfReport == true) {
763 IEEE11hbMSRRepTx(pMgmt);
765 //spin_unlock_irq(&pDevice->lock);
766 return (true);
770 bool
771 VNTWIFIbChannelSwitch(
772 void *pMgmtObject,
773 unsigned char byNewChannel
776 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
778 //spin_lock_irq(&pDevice->lock);
779 pMgmt->uCurrChannel = byNewChannel;
780 pMgmt->bSwitchChannel = false;
781 //spin_unlock_irq(&pDevice->lock);
782 return true;
786 bool
787 VNTWIFIbRadarPresent(
788 void *pMgmtObject,
789 unsigned char byChannel
792 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
793 if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
794 (byChannel == (unsigned char) pMgmt->uCurrChannel) &&
795 (pMgmt->bSwitchChannel != true) &&
796 (pMgmt->b11hEnable == true)) {
797 if (!compare_ether_addr(pMgmt->abyIBSSDFSOwner, CARDpGetCurrentAddress(pMgmt->pAdapter))) {
798 pMgmt->byNewChannel = CARDbyAutoChannelSelect(pMgmt->pAdapter,(unsigned char) pMgmt->uCurrChannel);
799 pMgmt->bSwitchChannel = true;
801 BEACONbSendBeacon(pMgmt);
802 CARDbChannelSwitch(pMgmt->pAdapter, 0, pMgmt->byNewChannel, 10);
804 return true;