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