1
2
3
4#include "ieee80211.h"
5#include "rtl819x_HT.h"
6u8 MCS_FILTER_ALL[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
7
8u8 MCS_FILTER_1SS[16] = {0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
9
10u16 MCS_DATA_RATE[2][2][77] =
11 { { {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78 ,104, 156, 208, 234, 260,
12 39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 312, 416, 468, 520,
13 0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 182, 182, 208, 156, 195,
14 195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 234, 208, 234, 260, 260,
15 286, 195, 234, 273, 234, 273, 312, 351, 312, 351, 390, 390, 429},
16 {14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 173, 231, 260, 289,
17 43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 231, 347, 462, 520, 578,
18 0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 202, 202, 231, 173, 217,
19 217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 260, 231, 260, 289, 289,
20 318, 217, 260, 303, 260, 303, 347, 390, 347, 390, 433, 433, 477} },
21 { {27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486, 540,
22 81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 432, 648, 864, 972, 1080,
23 12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324, 378, 378, 432, 324, 405,
24 405, 486, 567, 567, 648, 270, 324, 378, 324, 378, 432, 486, 432, 486, 540, 540,
25 594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 810, 891},
26 {30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600,
27 90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 480, 720, 960, 1080, 1200,
28 13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360, 420, 420, 480, 360, 450,
29 450, 540, 630, 630, 720, 300, 360, 420, 360, 420, 480, 540, 480, 540, 600, 600,
30 660, 450, 540, 630, 540, 630, 720, 810, 720, 810, 900, 900, 990} }
31 };
32
33static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
34static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0x00, 0x1a, 0x70};
35static u8 LINKSYSWRT350_LINKSYSWRT150_BROADCOM[3] = {0x00, 0x1d, 0x7e};
36static u8 NETGEAR834Bv2_BROADCOM[3] = {0x00, 0x1b, 0x2f};
37static u8 BELKINF5D8233V1_RALINK[3] = {0x00, 0x17, 0x3f};
38static u8 BELKINF5D82334V3_RALINK[3] = {0x00, 0x1c, 0xdf};
39static u8 PCI_RALINK[3] = {0x00, 0x90, 0xcc};
40static u8 EDIMAX_RALINK[3] = {0x00, 0x0e, 0x2e};
41static u8 AIRLINK_RALINK[3] = {0x00, 0x18, 0x02};
42
43static u8 CISCO_BROADCOM[3] = {0x00, 0x17, 0x94};
44
45
46
47
48
49
50
51
52
53
54
55void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
56{
57 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
58
59
60
61
62
63 pHTInfo->bRegShortGI20MHz= 1;
64 pHTInfo->bRegShortGI40MHz= 1;
65
66
67 pHTInfo->bRegBW40MHz = 1;
68
69
70 if(pHTInfo->bRegBW40MHz)
71 pHTInfo->bRegSuppCCK = 1;
72 else
73 pHTInfo->bRegSuppCCK = true;
74
75
76 pHTInfo->nAMSDU_MaxSize = 7935UL;
77 pHTInfo->bAMSDU_Support = 0;
78
79
80 pHTInfo->bAMPDUEnable = 1;
81 pHTInfo->AMPDU_Factor = 2;
82 pHTInfo->MPDU_Density = 0;
83
84
85 pHTInfo->SelfMimoPs = 3;
86 if(pHTInfo->SelfMimoPs == 2)
87 pHTInfo->SelfMimoPs = 3;
88
89 ieee->bTxDisableRateFallBack = 0;
90 ieee->bTxUseDriverAssingedRate = 0;
91
92#ifdef TO_DO_LIST
93
94 pMgntInfo->bTxEnableFwCalcDur = (BOOLEAN)pNdisCommon->bRegTxEnableFwCalcDur;
95#endif
96
97
98 pHTInfo->bRegRT2RTAggregation = 1;
99
100
101 pHTInfo->bRegRxReorderEnable = 1;
102 pHTInfo->RxReorderWinSize = 64;
103 pHTInfo->RxReorderPendingTime = 30;
104
105#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
106 pHTInfo->UsbTxAggrNum = 4;
107#endif
108#ifdef USB_RX_AGGREGATION_SUPPORT
109 pHTInfo->UsbRxFwAggrEn = 1;
110 pHTInfo->UsbRxFwAggrPageNum = 24;
111 pHTInfo->UsbRxFwAggrPacketNum = 8;
112 pHTInfo->UsbRxFwAggrTimeout = 16;
113#endif
114
115
116}
117
118
119
120
121
122
123
124
125void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
126{
127
128 static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
129 PHT_CAPABILITY_ELE pCapELE;
130
131 if(!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap)))
132 {
133
134 IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __func__);
135 pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[4]);
136 }else
137 pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[0]);
138
139 IEEE80211_DEBUG(IEEE80211_DL_HT, "<Log HT Capability>. Called by %s\n", TitleString );
140
141 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupported Channel Width = %s\n", (pCapELE->ChlWidth)?"20MHz": "20/40MHz");
142 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport Short GI for 20M = %s\n", (pCapELE->ShortGI20Mhz)?"YES": "NO");
143 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport Short GI for 40M = %s\n", (pCapELE->ShortGI40Mhz)?"YES": "NO");
144 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport TX STBC = %s\n", (pCapELE->TxSTBC)?"YES": "NO");
145 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMax AMSDU Size = %s\n", (pCapELE->MaxAMSDUSize)?"3839": "7935");
146 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport CCK in 20/40 mode = %s\n", (pCapELE->DssCCk)?"YES": "NO");
147 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMax AMPDU Factor = %d\n", pCapELE->MaxRxAMPDUFactor);
148 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMPDU Density = %d\n", pCapELE->MPDUDensity);
149 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMCS Rate Set = [%x][%x][%x][%x][%x]\n", pCapELE->MCS[0],\
150 pCapELE->MCS[1], pCapELE->MCS[2], pCapELE->MCS[3], pCapELE->MCS[4]);
151 return;
152
153}
154
155
156
157
158
159
160
161
162void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
163{
164
165 static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};
166 PHT_INFORMATION_ELE pHTInfoEle;
167
168 if(!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo)))
169 {
170
171 IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __func__);
172 pHTInfoEle = (PHT_INFORMATION_ELE)(&InfoIE[4]);
173 }else
174 pHTInfoEle = (PHT_INFORMATION_ELE)(&InfoIE[0]);
175
176
177 IEEE80211_DEBUG(IEEE80211_DL_HT, "<Log HT Information Element>. Called by %s\n", TitleString);
178
179 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tPrimary channel = %d\n", pHTInfoEle->ControlChl);
180 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSecondary channel =");
181 switch (pHTInfoEle->ExtChlOffset)
182 {
183 case 0:
184 IEEE80211_DEBUG(IEEE80211_DL_HT, "Not Present\n");
185 break;
186 case 1:
187 IEEE80211_DEBUG(IEEE80211_DL_HT, "Upper channel\n");
188 break;
189 case 2:
190 IEEE80211_DEBUG(IEEE80211_DL_HT, "Reserved. Eooro!!!\n");
191 break;
192 case 3:
193 IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
194 break;
195 }
196 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", (pHTInfoEle->RecommemdedTxWidth)?"20Mhz": "40Mhz");
197
198 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tOperation mode for protection = ");
199 switch (pHTInfoEle->OptMode)
200 {
201 case 0:
202 IEEE80211_DEBUG(IEEE80211_DL_HT, "No Protection\n");
203 break;
204 case 1:
205 IEEE80211_DEBUG(IEEE80211_DL_HT, "HT non-member protection mode\n");
206 break;
207 case 2:
208 IEEE80211_DEBUG(IEEE80211_DL_HT, "Suggest to open protection\n");
209 break;
210 case 3:
211 IEEE80211_DEBUG(IEEE80211_DL_HT, "HT mixed mode\n");
212 break;
213 }
214
215 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tBasic MCS Rate Set = [%x][%x][%x][%x][%x]\n", pHTInfoEle->BasicMSC[0],\
216 pHTInfoEle->BasicMSC[1], pHTInfoEle->BasicMSC[2], pHTInfoEle->BasicMSC[3], pHTInfoEle->BasicMSC[4]);
217 return;
218}
219
220
221
222
223static bool IsHTHalfNmode40Bandwidth(struct ieee80211_device *ieee)
224{
225 bool retValue = false;
226 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
227
228 if(!pHTInfo->bCurrentHTSupport)
229 retValue = false;
230 else if(!pHTInfo->bRegBW40MHz)
231 retValue = false;
232 else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
233 retValue = false;
234 else if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ChlWidth)
235 retValue = true;
236 else
237 retValue = false;
238
239 return retValue;
240}
241
242static bool IsHTHalfNmodeSGI(struct ieee80211_device *ieee, bool is40MHz)
243{
244 bool retValue = false;
245 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
246
247 if(!pHTInfo->bCurrentHTSupport)
248 retValue = false;
249 else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
250 retValue = false;
251 else if(is40MHz)
252 {
253 if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI40Mhz)
254 retValue = true;
255 else
256 retValue = false;
257 }
258 else
259 {
260 if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI20Mhz)
261 retValue = true;
262 else
263 retValue = false;
264 }
265
266 return retValue;
267}
268
269u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate)
270{
271
272 u8 is40MHz;
273 u8 isShortGI;
274
275 is40MHz = (IsHTHalfNmode40Bandwidth(ieee))?1:0;
276 isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz))? 1:0;
277
278 return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
279}
280
281
282u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate)
283{
284 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
285
286 u8 is40MHz = (pHTInfo->bCurBW40MHz)?1:0;
287 u8 isShortGI = (pHTInfo->bCurBW40MHz)?
288 ((pHTInfo->bCurShortGI40MHz)?1:0):
289 ((pHTInfo->bCurShortGI20MHz)?1:0);
290 return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
291}
292
293
294
295
296
297
298
299
300
301u16 TxCountToDataRate(struct ieee80211_device *ieee, u8 nDataRate)
302{
303
304 u16 CCKOFDMRate[12] = {0x02 , 0x04 , 0x0b , 0x16 , 0x0c , 0x12 , 0x18 , 0x24 , 0x30 , 0x48 , 0x60 , 0x6c};
305 u8 is40MHz = 0;
306 u8 isShortGI = 0;
307
308 if(nDataRate < 12)
309 {
310 return CCKOFDMRate[nDataRate];
311 }
312 else
313 {
314 if (nDataRate >= 0x10 && nDataRate <= 0x1f)
315 {
316 is40MHz = 0;
317 isShortGI = 0;
318
319
320 }
321 else if(nDataRate >=0x20 && nDataRate <= 0x2f )
322 {
323 is40MHz = 1;
324 isShortGI = 0;
325
326
327 }
328 else if(nDataRate >= 0x30 && nDataRate <= 0x3f )
329 {
330 is40MHz = 0;
331 isShortGI = 1;
332
333
334 }
335 else if(nDataRate >= 0x40 && nDataRate <= 0x4f )
336 {
337 is40MHz = 1;
338 isShortGI = 1;
339
340
341 }
342 return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf];
343 }
344}
345
346
347
348bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee)
349{
350 bool retValue = false;
351 struct ieee80211_network *net = &ieee->current_network;
352 if((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) ||
353 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) ||
354 (memcmp(net->bssid, PCI_RALINK, 3)==0) ||
355 (memcmp(net->bssid, EDIMAX_RALINK, 3)==0) ||
356 (memcmp(net->bssid, AIRLINK_RALINK, 3)==0) ||
357 (net->ralink_cap_exist))
358 retValue = true;
359 else if((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) ||
360 (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
361 (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
362 (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) ||
363 (net->broadcom_cap_exist))
364 retValue = true;
365 else if(net->bssht.bdRT2RTAggregation)
366 retValue = true;
367 else
368 retValue = false;
369
370 return retValue;
371}
372
373
374
375
376
377
378
379
380static void HTIOTPeerDetermine(struct ieee80211_device *ieee)
381{
382 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
383 struct ieee80211_network *net = &ieee->current_network;
384 if(net->bssht.bdRT2RTAggregation)
385 pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK;
386 else if(net->broadcom_cap_exist)
387 pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
388 else if((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) ||
389 (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
390 (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
391 (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) )
392 pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
393 else if((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) ||
394 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) ||
395 (memcmp(net->bssid, PCI_RALINK, 3)==0) ||
396 (memcmp(net->bssid, EDIMAX_RALINK, 3)==0) ||
397 (memcmp(net->bssid, AIRLINK_RALINK, 3)==0) ||
398 net->ralink_cap_exist)
399 pHTInfo->IOTPeer = HT_IOT_PEER_RALINK;
400 else if(net->atheros_cap_exist)
401 pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS;
402 else if(memcmp(net->bssid, CISCO_BROADCOM, 3)==0)
403 pHTInfo->IOTPeer = HT_IOT_PEER_CISCO;
404 else
405 pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
406
407 IEEE80211_DEBUG(IEEE80211_DL_IOT, "Joseph debug!! IOTPEER: %x\n", pHTInfo->IOTPeer);
408}
409
410
411
412
413
414
415
416
417static u8 HTIOTActIsDisableMCS14(struct ieee80211_device *ieee, u8 *PeerMacAddr)
418{
419 return 0;
420 }
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435static bool HTIOTActIsDisableMCS15(struct ieee80211_device *ieee)
436{
437 bool retValue = false;
438
439#ifdef TODO
440
441#if (HAL_CODE_BASE==RTL8192)
442
443#if (DEV_BUS_TYPE == USB_INTERFACE)
444
445 retValue = true;
446#elif (DEV_BUS_TYPE == PCI_INTERFACE)
447
448
449
450
451 retValue = false;
452#endif
453#endif
454#endif
455
456
457 return retValue;
458}
459
460
461
462
463
464
465
466
467
468
469
470
471
472static bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device *ieee,
473 u8 *PeerMacAddr)
474{
475#ifdef TODO
476
477#endif
478 return false;
479}
480
481
482
483
484
485
486
487
488static u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device *ieee,
489 u8 *PeerMacAddr)
490{
491 return false;
492}
493
494
495
496
497
498
499
500static u8 HTIOTActIsMgntUseCCK6M(struct ieee80211_network *network)
501{
502 u8 retValue = 0;
503
504
505
506
507 if (network->broadcom_cap_exist)
508 {
509 retValue = 1;
510 }
511
512 return retValue;
513}
514
515static u8 HTIOTActIsCCDFsync(u8 *PeerMacAddr)
516{
517 u8 retValue = 0;
518 if( (memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) ||
519 (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) ||
520 (memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ==0))
521 {
522 retValue = 1;
523 }
524
525 return retValue;
526}
527
528void HTResetIOTSetting(
529 PRT_HIGH_THROUGHPUT pHTInfo
530)
531{
532 pHTInfo->IOTAction = 0;
533 pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
534}
535
536
537
538
539
540
541
542
543
544
545
546
547void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u8 *len, u8 IsEncrypt)
548{
549 PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo;
550 PHT_CAPABILITY_ELE pCapELE = NULL;
551
552
553 if ((posHTCap == NULL) || (pHT == NULL))
554 {
555 IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTCap or pHTInfo can't be null in HTConstructCapabilityElement()\n");
556 return;
557 }
558 memset(posHTCap, 0, *len);
559 if(pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC)
560 {
561 u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
562 memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
563 pCapELE = (PHT_CAPABILITY_ELE)&(posHTCap[4]);
564 }else
565 {
566 pCapELE = (PHT_CAPABILITY_ELE)posHTCap;
567 }
568
569
570
571 pCapELE->AdvCoding = 0;
572 if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
573 {
574 pCapELE->ChlWidth = 0;
575 }
576 else
577 {
578 pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0);
579 }
580
581
582 pCapELE->MimoPwrSave = pHT->SelfMimoPs;
583 pCapELE->GreenField = 0;
584 pCapELE->ShortGI20Mhz = 1;
585 pCapELE->ShortGI40Mhz = 1;
586
587
588 pCapELE->TxSTBC = 1;
589 pCapELE->RxSTBC = 0;
590 pCapELE->DelayBA = 0;
591 pCapELE->MaxAMSDUSize = (MAX_RECEIVE_BUFFER_SIZE>=7935)?1:0;
592 pCapELE->DssCCk = ((pHT->bRegBW40MHz)?(pHT->bRegSuppCCK?1:0):0);
593 pCapELE->PSMP = 0;
594 pCapELE->LSigTxopProtect = 0;
595
596
597
598
599 IEEE80211_DEBUG(IEEE80211_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk);
600
601 if (IsEncrypt) {
602 pCapELE->MPDUDensity = 7;
603 pCapELE->MaxRxAMPDUFactor = 2;
604 }
605 else
606 {
607 pCapELE->MaxRxAMPDUFactor = 3;
608 pCapELE->MPDUDensity = 0;
609 }
610
611
612 memcpy(pCapELE->MCS, ieee->Regdot11HTOperationalRateSet, 16);
613 if(pHT->IOTAction & HT_IOT_ACT_DISABLE_MCS15)
614 pCapELE->MCS[1] &= 0x7f;
615
616 if(pHT->IOTAction & HT_IOT_ACT_DISABLE_MCS14)
617 pCapELE->MCS[1] &= 0xbf;
618
619 if(pHT->IOTAction & HT_IOT_ACT_DISABLE_ALL_2SS)
620 pCapELE->MCS[1] &= 0x00;
621
622
623
624 if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
625 {
626 int i;
627 for(i = 1; i< 16; i++)
628 pCapELE->MCS[i] = 0;
629 }
630
631
632 memset(&pCapELE->ExtHTCapInfo, 0, 2);
633
634
635
636 memset(pCapELE->TxBFCap, 0, 4);
637
638
639 pCapELE->ASCap = 0;
640
641 if(pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC)
642 *len = 30 + 2;
643 else
644 *len = 26 + 2;
645
646
647
648
649
650
651
652 return;
653
654}
655
656
657
658
659
660
661
662
663
664
665void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *len, u8 IsEncrypt)
666{
667 PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo;
668 PHT_INFORMATION_ELE pHTInfoEle = (PHT_INFORMATION_ELE)posHTInfo;
669 if ((posHTInfo == NULL) || (pHTInfoEle == NULL))
670 {
671 IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTInfo or pHTInfoEle can't be null in HTConstructInfoElement()\n");
672 return;
673 }
674
675 memset(posHTInfo, 0, *len);
676 if ( (ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == IW_MODE_MASTER))
677 {
678 pHTInfoEle->ControlChl = ieee->current_network.channel;
679 pHTInfoEle->ExtChlOffset = ((!pHT->bRegBW40MHz)?HT_EXTCHNL_OFFSET_NO_EXT:
680 (ieee->current_network.channel<=6)?
681 HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER);
682 pHTInfoEle->RecommemdedTxWidth = pHT->bRegBW40MHz;
683 pHTInfoEle->RIFS = 0;
684 pHTInfoEle->PSMPAccessOnly = 0;
685 pHTInfoEle->SrvIntGranularity = 0;
686 pHTInfoEle->OptMode = pHT->CurrentOpMode;
687 pHTInfoEle->NonGFDevPresent = 0;
688 pHTInfoEle->DualBeacon = 0;
689 pHTInfoEle->SecondaryBeacon = 0;
690 pHTInfoEle->LSigTxopProtectFull = 0;
691 pHTInfoEle->PcoActive = 0;
692 pHTInfoEle->PcoPhase = 0;
693
694 memset(pHTInfoEle->BasicMSC, 0, 16);
695
696
697 *len = 22 + 2;
698
699 }
700 else
701 {
702
703 *len = 0;
704 }
705
706
707 return;
708}
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg, u8 *len)
738{
739 if (posRT2RTAgg == NULL) {
740 IEEE80211_DEBUG(IEEE80211_DL_ERR, "posRT2RTAgg can't be null in HTConstructRT2RTAggElement()\n");
741 return;
742 }
743 memset(posRT2RTAgg, 0, *len);
744 *posRT2RTAgg++ = 0x00;
745 *posRT2RTAgg++ = 0xe0;
746 *posRT2RTAgg++ = 0x4c;
747 *posRT2RTAgg++ = 0x02;
748 *posRT2RTAgg++ = 0x01;
749 *posRT2RTAgg = 0x10;
750
751 if (ieee->bSupportRemoteWakeUp) {
752 *posRT2RTAgg |= 0x08;
753 }
754
755 *len = 6 + 2;
756 return;
757#ifdef TODO
758#if (HAL_CODE_BASE == RTL8192 && DEV_BUS_TYPE == USB_INTERFACE)
759
760
761
762
763
764
765
766
767
768
769
770
771#else
772
773#endif
774
775 posRT2RTAgg->Length = 6;
776#endif
777
778
779
780
781}
782
783
784
785
786
787
788
789
790
791static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
792{
793 u8 i;
794 if (pOperateMCS == NULL)
795 {
796 IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in HT_PickMCSRate()\n");
797 return false;
798 }
799
800 switch (ieee->mode)
801 {
802 case IEEE_A:
803 case IEEE_B:
804 case IEEE_G:
805
806
807
808 for(i=0;i<=15;i++){
809 pOperateMCS[i] = 0;
810 }
811 break;
812
813 case IEEE_N_24G:
814 case IEEE_N_5G:
815
816
817
818
819
820 pOperateMCS[0] &=RATE_ADPT_1SS_MASK;
821 pOperateMCS[1] &=RATE_ADPT_2SS_MASK;
822 pOperateMCS[3] &=RATE_ADPT_MCS32_MASK;
823 break;
824
825
826 default:
827
828 break;
829
830 }
831
832 return true;
833}
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 *pMCSRateSet, u8 *pMCSFilter)
855{
856 u8 i, j;
857 u8 bitMap;
858 u8 mcsRate = 0;
859 u8 availableMcsRate[16];
860 if (pMCSRateSet == NULL || pMCSFilter == NULL)
861 {
862 IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter can't be null in HTGetHighestMCSRate()\n");
863 return false;
864 }
865 for(i=0; i<16; i++)
866 availableMcsRate[i] = pMCSRateSet[i] & pMCSFilter[i];
867
868 for(i = 0; i < 16; i++)
869 {
870 if(availableMcsRate[i] != 0)
871 break;
872 }
873 if(i == 16)
874 return false;
875
876 for(i = 0; i < 16; i++)
877 {
878 if (availableMcsRate[i] != 0)
879 {
880 bitMap = availableMcsRate[i];
881 for(j = 0; j < 8; j++)
882 {
883 if ((bitMap%2) != 0)
884 {
885 if(HTMcsToDataRate(ieee, (8*i+j)) > HTMcsToDataRate(ieee, mcsRate))
886 mcsRate = (8*i+j);
887 }
888 bitMap >>= 1;
889 }
890 }
891 }
892 return (mcsRate|0x80);
893}
894
895
896
897
898
899
900
901
902
903
904
905
906static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 *pSupportMCS,
907 u8 *pOperateMCS)
908{
909
910 u8 i=0;
911
912
913 for(i=0;i<=15;i++){
914 pOperateMCS[i] = ieee->Regdot11HTOperationalRateSet[i]&pSupportMCS[i];
915 }
916
917
918
919
920
921
922 HT_PickMCSRate(ieee, pOperateMCS);
923
924
925 if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
926 pOperateMCS[1] = 0;
927
928
929
930
931
932 for(i=2; i<=15; i++)
933 pOperateMCS[i] = 0;
934
935 return true;
936}
937void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset);
938void HTOnAssocRsp(struct ieee80211_device *ieee)
939{
940 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
941 PHT_CAPABILITY_ELE pPeerHTCap = NULL;
942 PHT_INFORMATION_ELE pPeerHTInfo = NULL;
943 u16 nMaxAMSDUSize = 0;
944 u8 *pMcsFilter = NULL;
945
946 static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
947 static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};
948
949 if (!pHTInfo->bCurrentHTSupport) {
950 IEEE80211_DEBUG(IEEE80211_DL_ERR, "<=== HTOnAssocRsp(): HT_DISABLE\n");
951 return;
952 }
953 IEEE80211_DEBUG(IEEE80211_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n");
954
955
956
957
958
959
960 if (!memcmp(pHTInfo->PeerHTCapBuf, EWC11NHTCap, sizeof(EWC11NHTCap)))
961 pPeerHTCap = (PHT_CAPABILITY_ELE)(&pHTInfo->PeerHTCapBuf[4]);
962 else
963 pPeerHTCap = (PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf);
964
965 if(!memcmp(pHTInfo->PeerHTInfoBuf, EWC11NHTInfo, sizeof(EWC11NHTInfo)))
966 pPeerHTInfo = (PHT_INFORMATION_ELE)(&pHTInfo->PeerHTInfoBuf[4]);
967 else
968 pPeerHTInfo = (PHT_INFORMATION_ELE)(pHTInfo->PeerHTInfoBuf);
969
970
971
972
973
974 IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_HT, pPeerHTCap, sizeof(HT_CAPABILITY_ELE));
975
976
977
978 HTSetConnectBwMode(ieee, (HT_CHANNEL_WIDTH)(pPeerHTCap->ChlWidth), (HT_EXTCHNL_OFFSET)(pPeerHTInfo->ExtChlOffset));
979
980 pHTInfo->bCurTxBW40MHz = (pPeerHTInfo->RecommemdedTxWidth == 1);
981
982
983
984
985
986 pHTInfo->bCurShortGI20MHz = pHTInfo->bRegShortGI20MHz &&
987 (pPeerHTCap->ShortGI20Mhz == 1);
988 pHTInfo->bCurShortGI40MHz = pHTInfo->bRegShortGI40MHz &&
989 (pPeerHTCap->ShortGI40Mhz == 1);
990
991
992
993
994
995
996
997
998
999
1000 pHTInfo->bCurSuppCCK = pHTInfo->bRegSuppCCK &&
1001 (pPeerHTCap->DssCCk == 1);
1002
1003
1004
1005
1006
1007 pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support;
1008
1009 nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize==0)?3839:7935;
1010
1011 if(pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize )
1012 pHTInfo->nCurrent_AMSDU_MaxSize = nMaxAMSDUSize;
1013 else
1014 pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
1015
1016
1017
1018
1019
1020 pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable;
1021
1022
1023
1024
1025 if(!pHTInfo->bRegRT2RTAggregation)
1026 {
1027
1028 if(pHTInfo->AMPDU_Factor > pPeerHTCap->MaxRxAMPDUFactor)
1029 pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor;
1030 else
1031 pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
1032
1033 }else
1034 {
1035
1036
1037 if (ieee->current_network.bssht.bdRT2RTAggregation)
1038 {
1039 if (ieee->pairwise_key_type != KEY_TYPE_NA)
1040
1041 pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor;
1042 else
1043 pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_64K;
1044 }else
1045 {
1046 if(pPeerHTCap->MaxRxAMPDUFactor < HT_AGG_SIZE_32K)
1047 pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor;
1048 else
1049 pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_32K;
1050 }
1051 }
1052
1053
1054
1055 if(pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity)
1056 pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
1057 else
1058 pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
1059 if(ieee->pairwise_key_type != KEY_TYPE_NA )
1060 pHTInfo->CurrentMPDUDensity = 7;
1061
1062
1063
1064
1065 if (0)
1066 {
1067
1068 pHTInfo->bCurrentAMPDUEnable = false;
1069 pHTInfo->ForcedAMSDUMode = HT_AGG_FORCE_ENABLE;
1070 pHTInfo->ForcedAMSDUMaxSize = 7935;
1071
1072 pHTInfo->IOTAction |= HT_IOT_ACT_TX_USE_AMSDU_8K;
1073 }
1074
1075
1076 pHTInfo->bCurRxReorderEnable = pHTInfo->bRegRxReorderEnable;
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086 if(pPeerHTCap->MCS[0] == 0)
1087 pPeerHTCap->MCS[0] = 0xff;
1088
1089 HTFilterMCSRate(ieee, pPeerHTCap->MCS, ieee->dot11HTOperationalRateSet);
1090
1091
1092
1093
1094 pHTInfo->PeerMimoPs = pPeerHTCap->MimoPwrSave;
1095 if(pHTInfo->PeerMimoPs == MIMO_PS_STATIC)
1096 pMcsFilter = MCS_FILTER_1SS;
1097 else
1098 pMcsFilter = MCS_FILTER_ALL;
1099
1100
1101 ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee, ieee->dot11HTOperationalRateSet, pMcsFilter);
1102 ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate;
1103
1104
1105
1106
1107 pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;
1108
1109
1110
1111}
1112
1113void HTSetConnectBwModeCallback(struct ieee80211_device *ieee);
1114
1115
1116
1117
1118
1119
1120
1121
1122void HTInitializeHTInfo(struct ieee80211_device *ieee)
1123{
1124 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1125
1126
1127
1128
1129 IEEE80211_DEBUG(IEEE80211_DL_HT, "===========>%s()\n", __func__);
1130 pHTInfo->bCurrentHTSupport = false;
1131
1132
1133 pHTInfo->bCurBW40MHz = false;
1134 pHTInfo->bCurTxBW40MHz = false;
1135
1136
1137 pHTInfo->bCurShortGI20MHz = false;
1138 pHTInfo->bCurShortGI40MHz = false;
1139 pHTInfo->bForcedShortGI = false;
1140
1141
1142
1143
1144
1145 pHTInfo->bCurSuppCCK = true;
1146
1147
1148 pHTInfo->bCurrent_AMSDU_Support = false;
1149 pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
1150
1151
1152 pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
1153 pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
1154
1155
1156
1157
1158 memset((void *)(&(pHTInfo->SelfHTCap)), 0, sizeof(pHTInfo->SelfHTCap));
1159 memset((void *)(&(pHTInfo->SelfHTInfo)), 0, sizeof(pHTInfo->SelfHTInfo));
1160 memset((void *)(&(pHTInfo->PeerHTCapBuf)), 0, sizeof(pHTInfo->PeerHTCapBuf));
1161 memset((void *)(&(pHTInfo->PeerHTInfoBuf)), 0, sizeof(pHTInfo->PeerHTInfoBuf));
1162
1163 pHTInfo->bSwBwInProgress = false;
1164 pHTInfo->ChnlOp = CHNLOP_NONE;
1165
1166
1167 pHTInfo->ePeerHTSpecVer = HT_SPEC_VER_IEEE;
1168
1169
1170 pHTInfo->bCurrentRT2RTAggregation = false;
1171 pHTInfo->bCurrentRT2RTLongSlotTime = false;
1172 pHTInfo->IOTPeer = 0;
1173 pHTInfo->IOTAction = 0;
1174
1175
1176 {
1177 u8 *RegHTSuppRateSets = &(ieee->RegHTSuppRateSet[0]);
1178 RegHTSuppRateSets[0] = 0xFF;
1179 RegHTSuppRateSets[1] = 0xFF;
1180 RegHTSuppRateSets[4] = 0x01;
1181 }
1182}
1183
1184
1185
1186
1187
1188
1189
1190void HTInitializeBssDesc(PBSS_HT pBssHT)
1191{
1192
1193 pBssHT->bdSupportHT = false;
1194 memset(pBssHT->bdHTCapBuf, 0, sizeof(pBssHT->bdHTCapBuf));
1195 pBssHT->bdHTCapLen = 0;
1196 memset(pBssHT->bdHTInfoBuf, 0, sizeof(pBssHT->bdHTInfoBuf));
1197 pBssHT->bdHTInfoLen = 0;
1198
1199 pBssHT->bdHTSpecVer= HT_SPEC_VER_IEEE;
1200
1201 pBssHT->bdRT2RTAggregation = false;
1202 pBssHT->bdRT2RTLongSlotTime = false;
1203}
1204
1205
1206
1207
1208
1209
1210
1211
1212void HTResetSelfAndSavePeerSetting(struct ieee80211_device *ieee, struct ieee80211_network *pNetwork)
1213{
1214 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1215
1216
1217
1218
1219 u8 bIOTAction = 0;
1220
1221
1222
1223
1224 IEEE80211_DEBUG(IEEE80211_DL_HT, "==============>%s()\n", __func__);
1225
1226
1227 if (pNetwork->bssht.bdSupportHT)
1228 {
1229 pHTInfo->bCurrentHTSupport = true;
1230 pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer;
1231
1232
1233 if(pNetwork->bssht.bdHTCapLen > 0 && pNetwork->bssht.bdHTCapLen <= sizeof(pHTInfo->PeerHTCapBuf))
1234 memcpy(pHTInfo->PeerHTCapBuf, pNetwork->bssht.bdHTCapBuf, pNetwork->bssht.bdHTCapLen);
1235
1236 if(pNetwork->bssht.bdHTInfoLen > 0 && pNetwork->bssht.bdHTInfoLen <= sizeof(pHTInfo->PeerHTInfoBuf))
1237 memcpy(pHTInfo->PeerHTInfoBuf, pNetwork->bssht.bdHTInfoBuf, pNetwork->bssht.bdHTInfoLen);
1238
1239
1240 if(pHTInfo->bRegRT2RTAggregation)
1241 {
1242 pHTInfo->bCurrentRT2RTAggregation = pNetwork->bssht.bdRT2RTAggregation;
1243 pHTInfo->bCurrentRT2RTLongSlotTime = pNetwork->bssht.bdRT2RTLongSlotTime;
1244 }
1245 else
1246 {
1247 pHTInfo->bCurrentRT2RTAggregation = false;
1248 pHTInfo->bCurrentRT2RTLongSlotTime = false;
1249 }
1250
1251
1252 HTIOTPeerDetermine(ieee);
1253
1254
1255
1256 pHTInfo->IOTAction = 0;
1257 bIOTAction = HTIOTActIsDisableMCS14(ieee, pNetwork->bssid);
1258 if(bIOTAction)
1259 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_MCS14;
1260
1261 bIOTAction = HTIOTActIsDisableMCS15(ieee);
1262 if(bIOTAction)
1263 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_MCS15;
1264
1265 bIOTAction = HTIOTActIsDisableMCSTwoSpatialStream(ieee, pNetwork->bssid);
1266 if(bIOTAction)
1267 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_ALL_2SS;
1268
1269
1270 bIOTAction = HTIOTActIsDisableEDCATurbo(ieee, pNetwork->bssid);
1271 if(bIOTAction)
1272 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_EDCA_TURBO;
1273
1274 bIOTAction = HTIOTActIsMgntUseCCK6M(pNetwork);
1275 if(bIOTAction)
1276 pHTInfo->IOTAction |= HT_IOT_ACT_MGNT_USE_CCK_6M;
1277
1278 bIOTAction = HTIOTActIsCCDFsync(pNetwork->bssid);
1279 if(bIOTAction)
1280 pHTInfo->IOTAction |= HT_IOT_ACT_CDD_FSYNC;
1281
1282
1283 }
1284 else
1285 {
1286 pHTInfo->bCurrentHTSupport = false;
1287 pHTInfo->bCurrentRT2RTAggregation = false;
1288 pHTInfo->bCurrentRT2RTLongSlotTime = false;
1289
1290 pHTInfo->IOTAction = 0;
1291 }
1292
1293}
1294
1295void HTUpdateSelfAndPeerSetting(struct ieee80211_device *ieee, struct ieee80211_network *pNetwork)
1296{
1297 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1298
1299 PHT_INFORMATION_ELE pPeerHTInfo = (PHT_INFORMATION_ELE)pNetwork->bssht.bdHTInfoBuf;
1300
1301 if (pHTInfo->bCurrentHTSupport)
1302 {
1303
1304
1305
1306 if(pNetwork->bssht.bdHTInfoLen != 0)
1307 pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;
1308
1309
1310
1311
1312 }
1313}
1314EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting);
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame)
1325{
1326 if (ieee->pHTInfo->bCurrentHTSupport)
1327 {
1328 if ((IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1) {
1329 IEEE80211_DEBUG(IEEE80211_DL_HT, "HT CONTROL FILED EXIST!!\n");
1330 return true;
1331 }
1332 }
1333 return false;
1334}
1335
1336
1337
1338
1339void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset)
1340{
1341 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1342
1343
1344 if(!pHTInfo->bRegBW40MHz)
1345 return;
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355 if (pHTInfo->bSwBwInProgress) {
1356
1357 return;
1358 }
1359
1360 if(Bandwidth==HT_CHANNEL_WIDTH_20_40 && (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)))
1361 {
1362
1363 if(ieee->current_network.channel<2 && Offset==HT_EXTCHNL_OFFSET_LOWER)
1364 Offset = HT_EXTCHNL_OFFSET_NO_EXT;
1365 if(Offset==HT_EXTCHNL_OFFSET_UPPER || Offset==HT_EXTCHNL_OFFSET_LOWER) {
1366 pHTInfo->bCurBW40MHz = true;
1367 pHTInfo->CurSTAExtChnlOffset = Offset;
1368 } else {
1369 pHTInfo->bCurBW40MHz = false;
1370 pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT;
1371 }
1372 } else {
1373 pHTInfo->bCurBW40MHz = false;
1374 pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT;
1375 }
1376
1377 pHTInfo->bSwBwInProgress = true;
1378
1379
1380
1381
1382
1383 HTSetConnectBwModeCallback(ieee);
1384
1385
1386}
1387
1388void HTSetConnectBwModeCallback(struct ieee80211_device *ieee)
1389{
1390 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1391
1392 IEEE80211_DEBUG(IEEE80211_DL_HT, "======>%s()\n", __func__);
1393
1394 if(pHTInfo->bCurBW40MHz)
1395 {
1396 if(pHTInfo->CurSTAExtChnlOffset==HT_EXTCHNL_OFFSET_UPPER)
1397 ieee->set_chan(ieee->dev, ieee->current_network.channel+2);
1398 else if(pHTInfo->CurSTAExtChnlOffset==HT_EXTCHNL_OFFSET_LOWER)
1399 ieee->set_chan(ieee->dev, ieee->current_network.channel-2);
1400 else
1401 ieee->set_chan(ieee->dev, ieee->current_network.channel);
1402
1403 ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20_40, pHTInfo->CurSTAExtChnlOffset);
1404 } else {
1405 ieee->set_chan(ieee->dev, ieee->current_network.channel);
1406 ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
1407 }
1408
1409 pHTInfo->bSwBwInProgress = false;
1410}
1411