jbd: Fix a race between checkpointing code and journal_get_write_access()
[linux/fpc-iii.git] / drivers / staging / vt6655 / vntwifi.c
blob58a1ba0eac0743a637e0c9216abefd159813c4f4
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 #if !defined(__VNTWIFI_H__)
35 #include "vntwifi.h"
36 #endif
37 #if !defined(__UMEM_H__)
38 #include "umem.h"
39 #endif
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
62 /*--------------------- Static Definitions -------------------------*/
63 //static int msglevel =MSG_LEVEL_DEBUG;
64 //static int msglevel =MSG_LEVEL_INFO;
66 /*--------------------- Static Classes ----------------------------*/
68 /*--------------------- Static Variables --------------------------*/
70 /*--------------------- Static Functions --------------------------*/
72 /*--------------------- Export Variables --------------------------*/
74 /*--------------------- Export Functions --------------------------*/
76 /*+
78 * Description:
79 * Set Operation Mode
81 * Parameters:
82 * In:
83 * pMgmtHandle - pointer to management object
84 * eOPMode - Opreation Mode
85 * Out:
86 * none
88 * Return Value: none
90 -*/
91 VOID
92 VNTWIFIvSetOPMode (
93 IN PVOID pMgmtHandle,
94 IN WMAC_CONFIG_MODE eOPMode
97 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
99 pMgmt->eConfigMode = eOPMode;
105 * Description:
106 * Set Operation Mode
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
117 * Return Value: none
120 VOID
121 VNTWIFIvSetIBSSParameter (
122 IN PVOID pMgmtHandle,
123 IN WORD wBeaconPeriod,
124 IN WORD wATIMWindow,
125 IN UINT uChannel
128 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
130 pMgmt->wIBSSBeaconPeriod = wBeaconPeriod;
131 pMgmt->wIBSSATIMWindow = wATIMWindow;
132 pMgmt->uIBSSChannel = uChannel;
137 * Description:
138 * Get current SSID
140 * Parameters:
141 * In:
142 * pMgmtHandle - pointer to management object
143 * Out:
144 * none
146 * Return Value: current SSID pointer.
149 PWLAN_IE_SSID
150 VNTWIFIpGetCurrentSSID (
151 IN PVOID pMgmtHandle
154 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
155 return((PWLAN_IE_SSID) pMgmt->abyCurrSSID);
160 * Description:
161 * Get current link channel
163 * Parameters:
164 * In:
165 * pMgmtHandle - pointer to management object
166 * Out:
167 * none
169 * Return Value: current Channel.
172 UINT
173 VNTWIFIpGetCurrentChannel (
174 IN PVOID pMgmtHandle
177 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
178 if (pMgmtHandle != NULL) {
179 return (pMgmt->uCurrChannel);
181 return 0;
186 * Description:
187 * Get current Assoc ID
189 * Parameters:
190 * In:
191 * pMgmtHandle - pointer to management object
192 * Out:
193 * none
195 * Return Value: current Assoc ID
198 WORD
199 VNTWIFIwGetAssocID (
200 IN PVOID pMgmtHandle
203 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
204 return(pMgmt->wCurrAID);
211 * Description:
212 * This routine return max support rate of IES
214 * Parameters:
215 * In:
216 * pSupportRateIEs
217 * pExtSupportRateIEs
219 * Out:
221 * Return Value: max support rate
224 BYTE
225 VNTWIFIbyGetMaxSupportRate (
226 IN PWLAN_IE_SUPP_RATES pSupportRateIEs,
227 IN PWLAN_IE_SUPP_RATES pExtSupportRateIEs
230 BYTE byMaxSupportRate = RATE_1M;
231 BYTE bySupportRate = RATE_1M;
232 UINT ii = 0;
234 if (pSupportRateIEs) {
235 for (ii = 0; ii < pSupportRateIEs->len; ii++) {
236 bySupportRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
237 if (bySupportRate > byMaxSupportRate) {
238 byMaxSupportRate = bySupportRate;
242 if (pExtSupportRateIEs) {
243 for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
244 bySupportRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
245 if (bySupportRate > byMaxSupportRate) {
246 byMaxSupportRate = bySupportRate;
251 return byMaxSupportRate;
256 * Description:
257 * This routine return data rate of ACK packtet
259 * Parameters:
260 * In:
261 * byRxDataRate
262 * pSupportRateIEs
263 * pExtSupportRateIEs
265 * Out:
267 * Return Value: max support rate
270 BYTE
271 VNTWIFIbyGetACKTxRate (
272 IN BYTE byRxDataRate,
273 IN PWLAN_IE_SUPP_RATES pSupportRateIEs,
274 IN PWLAN_IE_SUPP_RATES pExtSupportRateIEs
277 BYTE byMaxAckRate;
278 BYTE byBasicRate;
279 UINT ii;
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;
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;
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;
310 return byMaxAckRate;
315 * Description:
316 * Set Authentication Mode
318 * Parameters:
319 * In:
320 * pMgmtHandle - pointer to management object
321 * eAuthMode - Authentication mode
322 * Out:
323 * none
325 * Return Value: none
328 VOID
329 VNTWIFIvSetAuthenticationMode (
330 IN PVOID pMgmtHandle,
331 IN WMAC_AUTHENTICATION_MODE eAuthMode
334 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
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;
347 * Description:
348 * Set Encryption Mode
350 * Parameters:
351 * In:
352 * pMgmtHandle - pointer to management object
353 * eAuthMode - Authentication mode
354 * Out:
355 * none
357 * Return Value: none
360 VOID
361 VNTWIFIvSetEncryptionMode (
362 IN PVOID pMgmtHandle,
363 IN WMAC_ENCRYPTION_MODE eEncryptionMode
366 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
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;
380 BOOL
381 VNTWIFIbConfigPhyMode (
382 IN PVOID pMgmtHandle,
383 IN CARD_PHY_TYPE ePhyType
386 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
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);
396 pMgmt->eConfigPHYMode = ePhyType;
397 return(TRUE);
401 VOID
402 VNTWIFIbGetConfigPhyMode (
403 IN PVOID pMgmtHandle,
404 OUT PVOID pePhyType
407 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
409 if ((pMgmt != NULL) && (pePhyType != NULL)) {
410 *(PCARD_PHY_TYPE)pePhyType = pMgmt->eConfigPHYMode;
416 * Description:
417 * Clear BSS List Database except current assoc BSS
419 * Parameters:
420 * In:
421 * pMgmtHandle - Management Object structure
422 * bLinkPass - Current Link status
423 * Out:
425 * Return Value: None.
432 * Description:
433 * Query BSS List in management database
435 * Parameters:
436 * In:
437 * pMgmtHandle - Management Object structure
438 * Out:
439 * puBSSCount - BSS count
440 * pvFirstBSS - pointer to first BSS
442 * Return Value: None.
446 VOID
447 VNTWIFIvQueryBSSList (
448 IN PVOID pMgmtHandle,
449 OUT PUINT puBSSCount,
450 OUT PVOID *pvFirstBSS
453 UINT ii = 0;
454 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
455 PKnownBSS pBSS = NULL;
456 UINT uCount = 0;
458 *pvFirstBSS = NULL;
460 for (ii = 0; ii < MAX_BSS_NUM; ii++) {
461 pBSS = &(pMgmt->sBSSList[ii]);
462 if (!pBSS->bActive) {
463 continue;
465 if (*pvFirstBSS == NULL) {
466 *pvFirstBSS = &(pMgmt->sBSSList[ii]);
468 uCount++;
470 *puBSSCount = uCount;
476 VOID
477 VNTWIFIvGetNextBSS (
478 IN PVOID pMgmtHandle,
479 IN PVOID pvCurrentBSS,
480 OUT PVOID *pvNextBSS
483 PKnownBSS pBSS = (PKnownBSS) pvCurrentBSS;
484 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
486 *pvNextBSS = NULL;
488 while (*pvNextBSS == NULL) {
489 pBSS++;
490 if (pBSS > &(pMgmt->sBSSList[MAX_BSS_NUM])) {
491 return;
493 if (pBSS->bActive == TRUE) {
494 *pvNextBSS = pBSS;
495 return;
506 * Description:
507 * Update Tx attemps, Tx failure counter in Node DB
509 * In:
510 * Out:
511 * none
513 * Return Value: none
516 VOID
517 VNTWIFIvUpdateNodeTxCounter(
518 IN PVOID pMgmtHandle,
519 IN PBYTE pbyDestAddress,
520 IN BOOL bTxOk,
521 IN WORD wRate,
522 IN PBYTE pbyTxFailCount
525 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
526 UINT uNodeIndex = 0;
527 UINT ii;
529 if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
530 (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
531 if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex) == FALSE) {
532 return;
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++;
543 pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += pbyTxFailCount[MAX_RATE];
544 for(ii=0;ii<MAX_RATE;ii++) {
545 pMgmt->sNodeDBTable[uNodeIndex].uTxFail[ii] += pbyTxFailCount[ii];
547 return;
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
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;
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;
584 pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
585 pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
587 } else { // Infrastructure: rate decided from AP Node, index = 0
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
598 pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
599 pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
601 byACKRate = VNTWIFIbyGetACKTxRate( (BYTE) wTxDataRate,
602 pSupportRateIEs,
603 pExtSupportRateIEs
605 if (byACKRate > (BYTE) wTxDataRate) {
606 byACKRate = (BYTE) wTxDataRate;
608 byCCKBasicRate = VNTWIFIbyGetACKTxRate( RATE_11M,
609 pSupportRateIEs,
610 pExtSupportRateIEs
612 byOFDMBasicRate = VNTWIFIbyGetACKTxRate(RATE_54M,
613 pSupportRateIEs,
614 pExtSupportRateIEs
616 *pwTxDataRate = wTxDataRate;
617 *pbyACKRate = byACKRate;
618 *pbyCCKBasicRate = byCCKBasicRate;
619 *pbyOFDMBasicRate = byOFDMBasicRate;
620 return;
623 BYTE
624 VNTWIFIbyGetKeyCypher(
625 IN PVOID pMgmtHandle,
626 IN BOOL bGroupKey
629 PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
631 if (bGroupKey == TRUE) {
632 return (pMgmt->byCSSGK);
633 } else {
634 return (pMgmt->byCSSPK);
640 BOOL
641 VNTWIFIbInit(
642 IN PVOID pAdapterHandler,
643 OUT PVOID *pMgmtHandler
647 PSMgmtObject pMgmt = NULL;
648 UINT ii;
651 pMgmt = (PSMgmtObject)kmalloc(sizeof(SMgmtObject), (int)GFP_ATOMIC);
652 if (pMgmt == NULL) {
653 *pMgmtHandler = NULL;
654 return FALSE;
657 memset(pMgmt, 0, sizeof(SMgmtObject));
658 pMgmt->pAdapter = (PVOID) pAdapterHandler;
660 // should initial MAC address abyMACAddr
661 for(ii=0;ii<WLAN_BSSID_LEN;ii++) {
662 pMgmt->abyDesireBSSID[ii] = 0xFF;
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;
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;
677 *pMgmtHandler = pMgmt;
678 return TRUE;
684 BOOL
685 VNTWIFIbSetPMKIDCache (
686 IN PVOID pMgmtObject,
687 IN ULONG ulCount,
688 IN PVOID pPMKIDInfo
691 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
693 if (ulCount > MAX_PMKID_CACHE) {
694 return (FALSE);
696 pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount;
697 MEMvCopy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo)));
698 return (TRUE);
703 WORD
704 VNTWIFIwGetMaxSupportRate(
705 IN PVOID pMgmtObject
708 WORD wRate = RATE_54M;
709 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
711 for(wRate = RATE_54M; wRate > RATE_1M; wRate--) {
712 if (BITbIsBitOn(pMgmt->sNodeDBTable[0].wSuppRate, (1<<wRate))) {
713 return (wRate);
716 if (pMgmt->eCurrentPHYMode == PHY_TYPE_11A) {
717 return (RATE_6M);
718 } else {
719 return (RATE_1M);
724 VOID
725 VNTWIFIvSet11h (
726 IN PVOID pMgmtObject,
727 IN BOOL b11hEnable
730 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
732 pMgmt->b11hEnable = b11hEnable;
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
746 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
747 PBYTE pbyCurrentEID = (PBYTE) (pMgmt->pCurrMeasureEIDRep);
749 //spin_lock_irq(&pDevice->lock);
750 if ((pvMeasureEID != NULL) &&
751 (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(WLAN_80211HDR_A3) - 3))
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;
783 pbyCurrentEID += (2 + pMgmt->pCurrMeasureEIDRep->len);
784 pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len);
785 pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID;
787 if (bEndOfReport == TRUE) {
788 IEEE11hbMSRRepTx(pMgmt);
790 //spin_unlock_irq(&pDevice->lock);
791 return (TRUE);
795 BOOL
796 VNTWIFIbChannelSwitch(
797 IN PVOID pMgmtObject,
798 IN BYTE byNewChannel
801 PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
803 //spin_lock_irq(&pDevice->lock);
804 pMgmt->uCurrChannel = byNewChannel;
805 pMgmt->bSwitchChannel = FALSE;
806 //spin_unlock_irq(&pDevice->lock);
807 return TRUE;
811 BOOL
812 VNTWIFIbRadarPresent(
813 IN PVOID pMgmtObject,
814 IN BYTE byChannel
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;
826 BEACONbSendBeacon(pMgmt);
827 CARDbChannelSwitch(pMgmt->pAdapter, 0, pMgmt->byNewChannel, 10);
829 return TRUE;