xenbus_client.c: correct exit path for xenbus_map_ring_valloc_hvm
[linux/fpc-iii.git] / drivers / staging / vt6655 / vntwifi.c
blobd8f4f8e7d05eba72281375483ca35fe09f7fbd46
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 /*--------------------- Static Definitions -------------------------*/
42 //static int msglevel =MSG_LEVEL_DEBUG;
43 //static int msglevel =MSG_LEVEL_INFO;
45 /*--------------------- Static Classes ----------------------------*/
47 /*--------------------- Static Variables --------------------------*/
49 /*--------------------- Static Functions --------------------------*/
51 /*--------------------- Export Variables --------------------------*/
53 /*--------------------- Export Functions --------------------------*/
55 /*+
57 * Description:
58 * Set Operation Mode
60 * Parameters:
61 * In:
62 * pMgmtHandle - pointer to management object
63 * eOPMode - Operation Mode
64 * Out:
65 * none
67 * Return Value: none
69 -*/
70 void
71 VNTWIFIvSetOPMode(
72 void *pMgmtHandle,
73 WMAC_CONFIG_MODE eOPMode
76 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
78 pMgmt->eConfigMode = eOPMode;
81 /*+
83 * Description:
84 * Set Operation Mode
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
95 * Return Value: none
97 -*/
98 void
99 VNTWIFIvSetIBSSParameter(
100 void *pMgmtHandle,
101 unsigned short wBeaconPeriod,
102 unsigned short wATIMWindow,
103 unsigned int uChannel
106 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
108 pMgmt->wIBSSBeaconPeriod = wBeaconPeriod;
109 pMgmt->wIBSSATIMWindow = wATIMWindow;
110 pMgmt->uIBSSChannel = uChannel;
115 * Description:
116 * Get current SSID
118 * Parameters:
119 * In:
120 * pMgmtHandle - pointer to management object
121 * Out:
122 * none
124 * Return Value: current SSID pointer.
127 PWLAN_IE_SSID
128 VNTWIFIpGetCurrentSSID(
129 void *pMgmtHandle
132 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
133 return (PWLAN_IE_SSID) pMgmt->abyCurrSSID;
138 * Description:
139 * Get current link channel
141 * Parameters:
142 * In:
143 * pMgmtHandle - pointer to management object
144 * Out:
145 * none
147 * Return Value: current Channel.
150 unsigned int
151 VNTWIFIpGetCurrentChannel(
152 void *pMgmtHandle
155 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
156 if (pMgmtHandle != NULL) {
157 return pMgmt->uCurrChannel;
159 return 0;
164 * Description:
165 * Get current Assoc ID
167 * Parameters:
168 * In:
169 * pMgmtHandle - pointer to management object
170 * Out:
171 * none
173 * Return Value: current Assoc ID
176 unsigned short
177 VNTWIFIwGetAssocID(
178 void *pMgmtHandle
181 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
182 return pMgmt->wCurrAID;
187 * Description:
188 * This routine return max support rate of IES
190 * Parameters:
191 * In:
192 * pSupportRateIEs
193 * pExtSupportRateIEs
195 * Out:
197 * Return Value: max support rate
200 unsigned char
201 VNTWIFIbyGetMaxSupportRate(
202 PWLAN_IE_SUPP_RATES pSupportRateIEs,
203 PWLAN_IE_SUPP_RATES pExtSupportRateIEs
206 unsigned char byMaxSupportRate = RATE_1M;
207 unsigned char bySupportRate = RATE_1M;
208 unsigned int ii = 0;
210 if (pSupportRateIEs) {
211 for (ii = 0; ii < pSupportRateIEs->len; ii++) {
212 bySupportRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
213 if (bySupportRate > byMaxSupportRate) {
214 byMaxSupportRate = bySupportRate;
218 if (pExtSupportRateIEs) {
219 for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
220 bySupportRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
221 if (bySupportRate > byMaxSupportRate) {
222 byMaxSupportRate = bySupportRate;
227 return byMaxSupportRate;
232 * Description:
233 * This routine return data rate of ACK packtet
235 * Parameters:
236 * In:
237 * byRxDataRate
238 * pSupportRateIEs
239 * pExtSupportRateIEs
241 * Out:
243 * Return Value: max support rate
246 unsigned char
247 VNTWIFIbyGetACKTxRate(
248 unsigned char byRxDataRate,
249 PWLAN_IE_SUPP_RATES pSupportRateIEs,
250 PWLAN_IE_SUPP_RATES pExtSupportRateIEs
253 unsigned char byMaxAckRate;
254 unsigned char byBasicRate;
255 unsigned int ii;
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;
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;
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;
286 return byMaxAckRate;
291 * Description:
292 * Set Authentication Mode
294 * Parameters:
295 * In:
296 * pMgmtHandle - pointer to management object
297 * eAuthMode - Authentication mode
298 * Out:
299 * none
301 * Return Value: none
304 void
305 VNTWIFIvSetAuthenticationMode(
306 void *pMgmtHandle,
307 WMAC_AUTHENTICATION_MODE eAuthMode
310 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
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;
323 * Description:
324 * Set Encryption Mode
326 * Parameters:
327 * In:
328 * pMgmtHandle - pointer to management object
329 * eAuthMode - Authentication mode
330 * Out:
331 * none
333 * Return Value: none
336 void
337 VNTWIFIvSetEncryptionMode(
338 void *pMgmtHandle,
339 WMAC_ENCRYPTION_MODE eEncryptionMode
342 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
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;
354 bool
355 VNTWIFIbConfigPhyMode(
356 void *pMgmtHandle,
357 CARD_PHY_TYPE ePhyType
360 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
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;
370 pMgmt->eConfigPHYMode = ePhyType;
371 return true;
374 void
375 VNTWIFIbGetConfigPhyMode(
376 void *pMgmtHandle,
377 void *pePhyType
380 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
382 if ((pMgmt != NULL) && (pePhyType != NULL)) {
383 *(PCARD_PHY_TYPE)pePhyType = pMgmt->eConfigPHYMode;
389 * Description:
390 * Clear BSS List Database except current assoc BSS
392 * Parameters:
393 * In:
394 * pMgmtHandle - Management Object structure
395 * bLinkPass - Current Link status
396 * Out:
398 * Return Value: None.
404 * Description:
405 * Query BSS List in management database
407 * Parameters:
408 * In:
409 * pMgmtHandle - Management Object structure
410 * Out:
411 * puBSSCount - BSS count
412 * pvFirstBSS - pointer to first BSS
414 * Return Value: None.
418 void
419 VNTWIFIvQueryBSSList(void *pMgmtHandle, unsigned int *puBSSCount, void **pvFirstBSS)
421 unsigned int ii = 0;
422 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
423 PKnownBSS pBSS = NULL;
424 unsigned int uCount = 0;
426 *pvFirstBSS = NULL;
428 for (ii = 0; ii < MAX_BSS_NUM; ii++) {
429 pBSS = &(pMgmt->sBSSList[ii]);
430 if (!pBSS->bActive) {
431 continue;
433 if (*pvFirstBSS == NULL) {
434 *pvFirstBSS = &(pMgmt->sBSSList[ii]);
436 uCount++;
438 *puBSSCount = uCount;
441 void
442 VNTWIFIvGetNextBSS(
443 void *pMgmtHandle,
444 void *pvCurrentBSS,
445 void **pvNextBSS
448 PKnownBSS pBSS = (PKnownBSS) pvCurrentBSS;
449 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
451 *pvNextBSS = NULL;
453 while (*pvNextBSS == NULL) {
454 pBSS++;
455 if (pBSS > &(pMgmt->sBSSList[MAX_BSS_NUM])) {
456 return;
458 if (pBSS->bActive == true) {
459 *pvNextBSS = pBSS;
460 return;
467 * Description:
468 * Update Tx attemps, Tx failure counter in Node DB
470 * In:
471 * Out:
472 * none
474 * Return Value: none
477 void
478 VNTWIFIvUpdateNodeTxCounter(
479 void *pMgmtHandle,
480 unsigned char *pbyDestAddress,
481 bool bTxOk,
482 unsigned short wRate,
483 unsigned char *pbyTxFailCount
486 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
487 unsigned int uNodeIndex = 0;
488 unsigned int ii;
490 if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
491 (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
492 if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex) == false) {
493 return;
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++;
504 pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += pbyTxFailCount[MAX_RATE];
505 for (ii = 0; ii < MAX_RATE; ii++) {
506 pMgmt->sNodeDBTable[uNodeIndex].uTxFail[ii] += pbyTxFailCount[ii];
508 return;
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
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;
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;
543 pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
544 pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
546 } else { // Infrastructure: rate decided from AP Node, index = 0
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
554 pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
555 pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
557 byACKRate = VNTWIFIbyGetACKTxRate((unsigned char) wTxDataRate,
558 pSupportRateIEs,
559 pExtSupportRateIEs
561 if (byACKRate > (unsigned char) wTxDataRate) {
562 byACKRate = (unsigned char) wTxDataRate;
564 byCCKBasicRate = VNTWIFIbyGetACKTxRate(RATE_11M,
565 pSupportRateIEs,
566 pExtSupportRateIEs
568 byOFDMBasicRate = VNTWIFIbyGetACKTxRate(RATE_54M,
569 pSupportRateIEs,
570 pExtSupportRateIEs
572 *pwTxDataRate = wTxDataRate;
573 *pbyACKRate = byACKRate;
574 *pbyCCKBasicRate = byCCKBasicRate;
575 *pbyOFDMBasicRate = byOFDMBasicRate;
576 return;
579 unsigned char
580 VNTWIFIbyGetKeyCypher(
581 void *pMgmtHandle,
582 bool bGroupKey
585 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
587 if (bGroupKey == true) {
588 return pMgmt->byCSSGK;
589 } else {
590 return pMgmt->byCSSPK;
595 bool
596 VNTWIFIbInit(
597 void *pAdapterHandler,
598 void **pMgmtHandler
600 PSMgmtObject pMgmt = NULL;
601 unsigned int ii;
603 pMgmt = (PSMgmtObject)kmalloc(sizeof(SMgmtObject), (int)GFP_ATOMIC);
604 if (pMgmt == NULL) {
605 *pMgmtHandler = NULL;
606 return false;
609 memset(pMgmt, 0, sizeof(SMgmtObject));
610 pMgmt->pAdapter = (void *) pAdapterHandler;
612 // should initial MAC address abyMACAddr
613 for (ii=0; ii<WLAN_BSSID_LEN; ii++) {
614 pMgmt->abyDesireBSSID[ii] = 0xFF;
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;
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;
629 *pMgmtHandler = pMgmt;
630 return true;
634 bool
635 VNTWIFIbSetPMKIDCache(
636 void *pMgmtObject,
637 unsigned long ulCount,
638 void *pPMKIDInfo
641 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
643 if (ulCount > MAX_PMKID_CACHE) {
644 return false;
646 pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount;
647 memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo)));
648 return true;
651 unsigned short
652 VNTWIFIwGetMaxSupportRate(
653 void *pMgmtObject
656 unsigned short wRate = RATE_54M;
657 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
659 for (wRate = RATE_54M; wRate > RATE_1M; wRate--) {
660 if (pMgmt->sNodeDBTable[0].wSuppRate & (1<<wRate)) {
661 return wRate;
664 if (pMgmt->eCurrentPHYMode == PHY_TYPE_11A) {
665 return RATE_6M;
666 } else {
667 return RATE_1M;
671 void
672 VNTWIFIvSet11h(
673 void *pMgmtObject,
674 bool b11hEnable
677 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
679 pMgmt->b11hEnable = b11hEnable;
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
693 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
694 unsigned char *pbyCurrentEID = (unsigned char *)(pMgmt->pCurrMeasureEIDRep);
696 //spin_lock_irq(&pDevice->lock);
697 if ((pvMeasureEID != NULL) &&
698 (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(WLAN_80211HDR_A3) - 3))
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;
730 pbyCurrentEID += (2 + pMgmt->pCurrMeasureEIDRep->len);
731 pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len);
732 pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID;
734 if (bEndOfReport == true) {
735 IEEE11hbMSRRepTx(pMgmt);
737 //spin_unlock_irq(&pDevice->lock);
738 return true;
741 bool
742 VNTWIFIbChannelSwitch(
743 void *pMgmtObject,
744 unsigned char byNewChannel
747 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
749 //spin_lock_irq(&pDevice->lock);
750 pMgmt->uCurrChannel = byNewChannel;
751 pMgmt->bSwitchChannel = false;
752 //spin_unlock_irq(&pDevice->lock);
753 return true;
757 bool
758 VNTWIFIbRadarPresent(
759 void *pMgmtObject,
760 unsigned char byChannel
762 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
763 if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
764 (byChannel == (unsigned char) pMgmt->uCurrChannel) &&
765 (pMgmt->bSwitchChannel != true) &&
766 (pMgmt->b11hEnable == true)) {
767 if (!compare_ether_addr(pMgmt->abyIBSSDFSOwner, CARDpGetCurrentAddress(pMgmt->pAdapter))) {
768 pMgmt->byNewChannel = CARDbyAutoChannelSelect(pMgmt->pAdapter,(unsigned char) pMgmt->uCurrChannel);
769 pMgmt->bSwitchChannel = true;
771 BEACONbSendBeacon(pMgmt);
772 CARDbChannelSwitch(pMgmt->pAdapter, 0, pMgmt->byNewChannel, 10);
774 return true;