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