1
2 //As this function is mainly ported from Windows driver, so leave the name little changed. If any confusion caused, tell me. Created by WB. 2008.05.08
3 #include "ieee80211.h"
4 #include "rtl819x_HT.h"
5 u8 MCS_FILTER_ALL[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
6
7 u8 MCS_FILTER_1SS[16] = {0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
8
9 u16 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}, // Long GI, 20MHz
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} }, // Short GI, 20MHz
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}, // Long GI, 40MHz
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} } // Short GI, 40MHz
30 };
31
32 static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
33 static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0x00, 0x1a, 0x70};
34 static u8 LINKSYSWRT350_LINKSYSWRT150_BROADCOM[3] = {0x00, 0x1d, 0x7e};
35 static u8 NETGEAR834Bv2_BROADCOM[3] = {0x00, 0x1b, 0x2f};
36 static u8 BELKINF5D8233V1_RALINK[3] = {0x00, 0x17, 0x3f}; //cosa 03202008
37 static u8 BELKINF5D82334V3_RALINK[3] = {0x00, 0x1c, 0xdf};
38 static u8 PCI_RALINK[3] = {0x00, 0x90, 0xcc};
39 static u8 EDIMAX_RALINK[3] = {0x00, 0x0e, 0x2e};
40 static u8 AIRLINK_RALINK[3] = {0x00, 0x18, 0x02};
41 static u8 DLINK_ATHEROS_1[3] = {0x00, 0x1c, 0xf0};
42 static u8 DLINK_ATHEROS_2[3] = {0x00, 0x21, 0x91};
43 static u8 CISCO_BROADCOM[3] = {0x00, 0x17, 0x94};
44 static u8 LINKSYS_MARVELL_4400N[3] = {0x00, 0x14, 0xa4};
45 // 2008/04/01 MH For Cisco G mode RX TP We need to change FW duration. Shoud we put the
46 // code in other place??
47 //static u8 WIFI_CISCO_G_AP[3] = {0x00, 0x40, 0x96};
48 /********************************************************************************************************************
49 *function: This function update default settings in pHTInfo structure
50 * input: PRT_HIGH_THROUGHPUT pHTInfo
51 * output: none
52 * return: none
53 * notice: These value need be modified if any changes.
54 * *****************************************************************************************************************/
55 void HTUpdateDefaultSetting(struct ieee80211_device* ieee)
56 {
57 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
58 //const typeof( ((struct ieee80211_device *)0)->pHTInfo ) *__mptr = &pHTInfo;
59
60 //printk("pHTinfo:%p, &pHTinfo:%p, mptr:%p, offsetof:%x\n", pHTInfo, &pHTInfo, __mptr, offsetof(struct ieee80211_device, pHTInfo));
61 //printk("===>ieee:%p,\n", ieee);
62 // ShortGI support
63 pHTInfo->bRegShortGI20MHz= 1;
64 pHTInfo->bRegShortGI40MHz= 1;
65
66 // 40MHz channel support
67 pHTInfo->bRegBW40MHz = 1;
68
69 // CCK rate support in 40MHz channel
70 if(pHTInfo->bRegBW40MHz)
71 pHTInfo->bRegSuppCCK = 1;
72 else
73 pHTInfo->bRegSuppCCK = true;
74
75 // AMSDU related
76 pHTInfo->nAMSDU_MaxSize = 7935UL;
77 pHTInfo->bAMSDU_Support = 0;
78
79 // AMPDU related
80 pHTInfo->bAMPDUEnable = 1; //YJ,test,090311
81 pHTInfo->AMPDU_Factor = 2; //// 0: 2n13(8K), 1:2n14(16K), 2:2n15(32K), 3:2n16(64k)
82 pHTInfo->MPDU_Density = 0;// 0: No restriction, 1: 1/8usec, 2: 1/4usec, 3: 1/2usec, 4: 1usec, 5: 2usec, 6: 4usec, 7:8usec
83
84 // MIMO Power Save
85 pHTInfo->SelfMimoPs = 3;// 0: Static Mimo Ps, 1: Dynamic Mimo Ps, 3: No Limitation, 2: Reserved(Set to 3 automatically.)
86 if(pHTInfo->SelfMimoPs == 2)
87 pHTInfo->SelfMimoPs = 3;
88 // 8190 only. Assign rate operation mode to firmware
89 ieee->bTxDisableRateFallBack = 0;
90 ieee->bTxUseDriverAssingedRate = 0;
91
92 #ifdef TO_DO_LIST
93 // 8190 only. Assign duration operation mode to firmware
94 pMgntInfo->bTxEnableFwCalcDur = (BOOLEAN)pNdisCommon->bRegTxEnableFwCalcDur;
95 #endif
96 // 8190 only, Realtek proprietary aggregation mode
97 // Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others
98 pHTInfo->bRegRT2RTAggregation = 1;//0: Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others
99
100 // For Rx Reorder Control
101 pHTInfo->bRegRxReorderEnable = 1;//YJ,test,090311
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 #ifdef RTL8192SU
110 pHTInfo->UsbRxFwAggrEn = 1;
111 pHTInfo->UsbRxFwAggrPageNum = 16;
112 pHTInfo->UsbRxFwAggrPacketNum = 8;
113 pHTInfo->UsbRxFwAggrTimeout = 4; ////usb rx FW aggregation timeout threshold.It's in units of 64us
114 // For page size of receive packet buffer.
115 pHTInfo->UsbRxPageSize= 128;
116 #else
117 pHTInfo->UsbRxFwAggrEn = 1;
118 pHTInfo->UsbRxFwAggrPageNum = 24;
119 pHTInfo->UsbRxFwAggrPacketNum = 8;
120 pHTInfo->UsbRxFwAggrTimeout = 16; ////usb rx FW aggregation timeout threshold.It's in units of 64us
121 #endif
122 #endif
123
124
125 }
126 /********************************************************************************************************************
127 *function: This function print out each field on HT capability IE mainly from (Beacon/ProbeRsp/AssocReq)
128 * input: u8* CapIE //Capability IE to be printed out
129 * u8* TitleString //mainly print out caller function
130 * output: none
131 * return: none
132 * notice: Driver should not print out this message by default.
133 * *****************************************************************************************************************/
134 void HTDebugHTCapability(u8* CapIE, u8* TitleString )
135 {
136
137 static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily
138 PHT_CAPABILITY_ELE pCapELE;
139
140 if(!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap)))
141 {
142 //EWC IE
143 IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __FUNCTION__);
144 pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[4]);
145 }else
146 pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[0]);
147
148 IEEE80211_DEBUG(IEEE80211_DL_HT, "<Log HT Capability>. Called by %s\n", TitleString );
149
150 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupported Channel Width = %s\n", (pCapELE->ChlWidth)?"20MHz": "20/40MHz");
151 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport Short GI for 20M = %s\n", (pCapELE->ShortGI20Mhz)?"YES": "NO");
152 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport Short GI for 40M = %s\n", (pCapELE->ShortGI40Mhz)?"YES": "NO");
153 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport TX STBC = %s\n", (pCapELE->TxSTBC)?"YES": "NO");
154 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMax AMSDU Size = %s\n", (pCapELE->MaxAMSDUSize)?"3839": "7935");
155 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport CCK in 20/40 mode = %s\n", (pCapELE->DssCCk)?"YES": "NO");
156 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMax AMPDU Factor = %d\n", pCapELE->MaxRxAMPDUFactor);
157 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMPDU Density = %d\n", pCapELE->MPDUDensity);
158 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMCS Rate Set = [%x][%x][%x][%x][%x]\n", pCapELE->MCS[0],\
159 pCapELE->MCS[1], pCapELE->MCS[2], pCapELE->MCS[3], pCapELE->MCS[4]);
160 return;
161
162 }
163 /********************************************************************************************************************
164 *function: This function print out each field on HT Information IE mainly from (Beacon/ProbeRsp)
165 * input: u8* InfoIE //Capability IE to be printed out
166 * u8* TitleString //mainly print out caller function
167 * output: none
168 * return: none
169 * notice: Driver should not print out this message by default.
170 * *****************************************************************************************************************/
171 void HTDebugHTInfo(u8* InfoIE, u8* TitleString)
172 {
173
174 static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; // For 11n EWC definition, 2007.07.17, by Emily
175 PHT_INFORMATION_ELE pHTInfoEle;
176
177 if(!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo)))
178 {
179 // Not EWC IE
180 IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __FUNCTION__);
181 pHTInfoEle = (PHT_INFORMATION_ELE)(&InfoIE[4]);
182 }else
183 pHTInfoEle = (PHT_INFORMATION_ELE)(&InfoIE[0]);
184
185
186 IEEE80211_DEBUG(IEEE80211_DL_HT, "<Log HT Information Element>. Called by %s\n", TitleString);
187
188 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tPrimary channel = %d\n", pHTInfoEle->ControlChl);
189 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSenondary channel =");
190 switch(pHTInfoEle->ExtChlOffset)
191 {
192 case 0:
193 IEEE80211_DEBUG(IEEE80211_DL_HT, "Not Present\n");
194 break;
195 case 1:
196 IEEE80211_DEBUG(IEEE80211_DL_HT, "Upper channel\n");
197 break;
198 case 2:
199 IEEE80211_DEBUG(IEEE80211_DL_HT, "Reserved. Eooro!!!\n");
200 break;
201 case 3:
202 IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
203 break;
204 }
205 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", (pHTInfoEle->RecommemdedTxWidth)?"20Mhz": "40Mhz");
206
207 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tOperation mode for protection = ");
208 switch(pHTInfoEle->OptMode)
209 {
210 case 0:
211 IEEE80211_DEBUG(IEEE80211_DL_HT, "No Protection\n");
212 break;
213 case 1:
214 IEEE80211_DEBUG(IEEE80211_DL_HT, "HT non-member protection mode\n");
215 break;
216 case 2:
217 IEEE80211_DEBUG(IEEE80211_DL_HT, "Suggest to open protection\n");
218 break;
219 case 3:
220 IEEE80211_DEBUG(IEEE80211_DL_HT, "HT mixed mode\n");
221 break;
222 }
223
224 IEEE80211_DEBUG(IEEE80211_DL_HT, "\tBasic MCS Rate Set = [%x][%x][%x][%x][%x]\n", pHTInfoEle->BasicMSC[0],\
225 pHTInfoEle->BasicMSC[1], pHTInfoEle->BasicMSC[2], pHTInfoEle->BasicMSC[3], pHTInfoEle->BasicMSC[4]);
226 return;
227 }
228
229 /*
230 * Return: true if station in half n mode and AP supports 40 bw
231 */
232 bool IsHTHalfNmode40Bandwidth(struct ieee80211_device* ieee)
233 {
234 bool retValue = false;
235 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
236
237 if(pHTInfo->bCurrentHTSupport == false ) // wireless is n mode
238 retValue = false;
239 else if(pHTInfo->bRegBW40MHz == false) // station supports 40 bw
240 retValue = false;
241 else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode
242 retValue = false;
243 else if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ChlWidth) // ap support 40 bw
244 retValue = true;
245 else
246 retValue = false;
247
248 return retValue;
249 }
250
251 bool IsHTHalfNmodeSGI(struct ieee80211_device* ieee, bool is40MHz)
252 {
253 bool retValue = false;
254 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
255
256 if(pHTInfo->bCurrentHTSupport == false ) // wireless is n mode
257 retValue = false;
258 else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode
259 retValue = false;
260 else if(is40MHz) // ap support 40 bw
261 {
262 if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) // ap support 40 bw short GI
263 retValue = true;
264 else
265 retValue = false;
266 }
267 else
268 {
269 if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI20Mhz) // ap support 40 bw short GI
270 retValue = true;
271 else
272 retValue = false;
273 }
274
275 return retValue;
276 }
277
278 u16 HTHalfMcsToDataRate(struct ieee80211_device* ieee, u8 nMcsRate)
279 {
280
281 u8 is40MHz;
282 u8 isShortGI;
283
284 is40MHz = (IsHTHalfNmode40Bandwidth(ieee))?1:0;
285 isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz))? 1:0;
286
287 return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
288 }
289
290
291 u16 HTMcsToDataRate( struct ieee80211_device* ieee, u8 nMcsRate)
292 {
293 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
294
295 u8 is40MHz = (pHTInfo->bCurBW40MHz)?1:0;
296 u8 isShortGI = (pHTInfo->bCurBW40MHz)?
297 ((pHTInfo->bCurShortGI40MHz)?1:0):
298 ((pHTInfo->bCurShortGI20MHz)?1:0);
299 return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
300 }
301
302 /********************************************************************************************************************
303 *function: This function returns current datarate.
304 * input: struct ieee80211_device* ieee
305 * u8 nDataRate
306 * output: none
307 * return: tx rate
308 * notice: quite unsure about how to use this function //wb
309 * *****************************************************************************************************************/
310 u16 TxCountToDataRate( struct ieee80211_device* ieee, u8 nDataRate)
311 {
312 //PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
313 u16 CCKOFDMRate[12] = {0x02 , 0x04 , 0x0b , 0x16 , 0x0c , 0x12 , 0x18 , 0x24 , 0x30 , 0x48 , 0x60 , 0x6c};
314 u8 is40MHz = 0;
315 u8 isShortGI = 0;
316
317 if(nDataRate < 12)
318 {
319 return CCKOFDMRate[nDataRate];
320 }
321 else
322 {
323 if (nDataRate >= 0x10 && nDataRate <= 0x1f)//if(nDataRate > 11 && nDataRate < 28 )
324 {
325 is40MHz = 0;
326 isShortGI = 0;
327
328 // nDataRate = nDataRate - 12;
329 }
330 else if(nDataRate >=0x20 && nDataRate <= 0x2f ) //(27, 44)
331 {
332 is40MHz = 1;
333 isShortGI = 0;
334
335 //nDataRate = nDataRate - 28;
336 }
337 else if(nDataRate >= 0x30 && nDataRate <= 0x3f ) //(43, 60)
338 {
339 is40MHz = 0;
340 isShortGI = 1;
341
342 //nDataRate = nDataRate - 44;
343 }
344 else if(nDataRate >= 0x40 && nDataRate <= 0x4f ) //(59, 76)
345 {
346 is40MHz = 1;
347 isShortGI = 1;
348
349 //nDataRate = nDataRate - 60;
350 }
351 return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf];
352 }
353 }
354
355
356
357 bool IsHTHalfNmodeAPs(struct ieee80211_device* ieee)
358 {
359 bool retValue = false;
360 struct ieee80211_network* net = &ieee->current_network;
361 #if 0
362 if(pMgntInfo->bHalfNMode == false)
363 retValue = false;
364 else
365 #endif
366 if((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) ||
367 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) ||
368 (memcmp(net->bssid, PCI_RALINK, 3)==0) ||
369 (memcmp(net->bssid, EDIMAX_RALINK, 3)==0) ||
370 (memcmp(net->bssid, AIRLINK_RALINK, 3)==0) ||
371 (net->ralink_cap_exist))
372 retValue = true;
373 else if((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) ||
374 (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
375 (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
376 (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) ||
377 (net->broadcom_cap_exist))
378 retValue = true;
379 else if(net->bssht.bdRT2RTAggregation)
380 retValue = true;
381 else
382 retValue = false;
383
384 return retValue;
385 }
386
387 /********************************************************************************************************************
388 *function: This function returns peer IOT.
389 * input: struct ieee80211_device* ieee
390 * output: none
391 * return:
392 * notice:
393 * *****************************************************************************************************************/
394 void HTIOTPeerDetermine(struct ieee80211_device* ieee)
395 {
396 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
397 struct ieee80211_network* net = &ieee->current_network;
398 //FIXME: need to decide 92U_SOFTAP //LZM,090320
399 if(net->bssht.bdRT2RTAggregation){
400 pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK;
401 if(net->bssht.RT2RT_HT_Mode & RT_HT_CAP_USE_92SE){
402 pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK_92SE;
403 }
404 }
405 else if(net->broadcom_cap_exist)
406 pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
407 else if((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) ||
408 (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
409 (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
410 (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) )
411 pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
412 else if((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) ||
413 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) ||
414 (memcmp(net->bssid, PCI_RALINK, 3)==0) ||
415 (memcmp(net->bssid, EDIMAX_RALINK, 3)==0) ||
416 (memcmp(net->bssid, AIRLINK_RALINK, 3)==0) ||
417 net->ralink_cap_exist)
418 pHTInfo->IOTPeer = HT_IOT_PEER_RALINK;
419 else if((net->atheros_cap_exist )||
420 (memcmp(net->bssid, DLINK_ATHEROS_1, 3) == 0)||
421 (memcmp(net->bssid, DLINK_ATHEROS_2, 3) == 0))
422 pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS;
423 else if(memcmp(net->bssid, CISCO_BROADCOM, 3)==0)
424 pHTInfo->IOTPeer = HT_IOT_PEER_CISCO;
425 else if ((memcmp(net->bssid, LINKSYS_MARVELL_4400N, 3) == 0) ||
426 net->marvell_cap_exist)
427 pHTInfo->IOTPeer = HT_IOT_PEER_MARVELL;
428 else
429 pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
430
431 IEEE80211_DEBUG(IEEE80211_DL_IOT, "Joseph debug!! IOTPEER: %x\n", pHTInfo->IOTPeer);
432 }
433 /********************************************************************************************************************
434 *function: Check whether driver should declare received rate up to MCS13 only since some chipset is not good
435 * at receiving MCS14~15 frame from some AP.
436 * input: struct ieee80211_device* ieee
437 * u8 * PeerMacAddr
438 * output: none
439 * return: return 1 if driver should declare MCS13 only(otherwise return 0)
440 * *****************************************************************************************************************/
441 u8 HTIOTActIsDisableMCS14(struct ieee80211_device* ieee, u8* PeerMacAddr)
442 {
443 u8 ret = 0;
444 #if 0
445 // Apply for 819u only
446 #if (HAL_CODE_BASE==RTL8192 && DEV_BUS_TYPE==USB_INTERFACE)
447 if((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) ||
448 (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)
449 )
450 {
451 ret = 1;
452 }
453
454
455 if(pHTInfo->bCurrentRT2RTAggregation)
456 {
457 // The parameter of pHTInfo->bCurrentRT2RTAggregation must be decided previously
458 ret = 1;
459 }
460 #endif
461 #endif
462 return ret;
463 }
464
465
466 /**
467 * Function: HTIOTActIsDisableMCS15
468 *
469 * Overview: Check whether driver should declare capability of receving MCS15
470 *
471 * Input:
472 * PADAPTER Adapter,
473 *
474 * Output: None
475 * Return: true if driver should disable MCS15
476 * 2008.04.15 Emily
477 */
478 bool HTIOTActIsDisableMCS15(struct ieee80211_device* ieee)
479 {
480 bool retValue = false;
481
482 #ifdef TODO
483 // Apply for 819u only
484 #if (HAL_CODE_BASE==RTL8192)
485
486 #if (DEV_BUS_TYPE == USB_INTERFACE)
487 // Alway disable MCS15 by Jerry Chang's request.by Emily, 2008.04.15
488 retValue = true;
489 #elif (DEV_BUS_TYPE == PCI_INTERFACE)
490 // Enable MCS15 if the peer is Cisco AP. by Emily, 2008.05.12
491 // if(pBssDesc->bCiscoCapExist)
492 // retValue = false;
493 // else
494 retValue = false;
495 #endif
496 #endif
497 #endif
498 // Jerry Chang suggest that 8190 1x2 does not need to disable MCS15
499
500 return retValue;
501 }
502
503 /**
504 * Function: HTIOTActIsDisableMCSTwoSpatialStream
505 *
506 * Overview: Check whether driver should declare capability of receving All 2 ss packets
507 *
508 * Input:
509 * PADAPTER Adapter,
510 *
511 * Output: None
512 * Return: true if driver should disable all two spatial stream packet
513 * 2008.04.21 Emily
514 */
515 bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device* ieee)
516 {
517 bool retValue = false;
518 #ifdef TODO
519 // Apply for 819u only
520 //#if (HAL_CODE_BASE==RTL8192)
521
522 //This rule only apply to Belkin(Ralink) AP
523 if(IS_UNDER_11N_AES_MODE(Adapter))
524 {
525 if((PlatformCompareMemory(PeerMacAddr, BELKINF5D8233V1_RALINK, 3)==0) ||
526 (PlatformCompareMemory(PeerMacAddr, PCI_RALINK, 3)==0) ||
527 (PlatformCompareMemory(PeerMacAddr, EDIMAX_RALINK, 3)==0))
528 {
529 //Set True to disable this function. Disable by default, Emily, 2008.04.23
530 retValue = false;
531 }
532 }
533
534 //#endif
535 #endif
536 #if 1
537 #if (defined(RTL8192SE) || (defined(RTL8192SU)))
538 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
539 if(ieee->is_ap_in_wep_tkip && ieee->is_ap_in_wep_tkip(ieee->dev))
540 {
541 if( (pHTInfo->IOTPeer != HT_IOT_PEER_ATHEROS) &&
542 (pHTInfo->IOTPeer != HT_IOT_PEER_UNKNOWN) &&
543 (pHTInfo->IOTPeer != HT_IOT_PEER_MARVELL) )
544 retValue = true;
545 }
546 #endif
547 #endif
548 return retValue;
549 }
550
551 /********************************************************************************************************************
552 *function: Check whether driver should disable EDCA turbo mode
553 * input: struct ieee80211_device* ieee
554 * u8* PeerMacAddr
555 * output: none
556 * return: return 1 if driver should disable EDCA turbo mode(otherwise return 0)
557 * *****************************************************************************************************************/
558 u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device* ieee, u8* PeerMacAddr)
559 {
560 u8 retValue = false; // default enable EDCA Turbo mode.
561 // Set specific EDCA parameter for different AP in DM handler.
562
563 return retValue;
564 #if 0
565 if((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0)||
566 (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
567 (memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
568 (memcmp(PeerMacAddr, NETGEAR834Bv2_BROADCOM, 3)==0))
569
570 {
571 retValue = 1; //Linksys disable EDCA turbo mode
572 }
573
574 return retValue;
575 #endif
576 }
577
578 /********************************************************************************************************************
579 *function: Check whether we need to use OFDM to sned MGNT frame for broadcom AP
580 * input: struct ieee80211_network *network //current network we live
581 * output: none
582 * return: return 1 if true
583 * *****************************************************************************************************************/
584 u8 HTIOTActIsMgntUseCCK6M(struct ieee80211_network *network)
585 {
586 u8 retValue = 0;
587
588 // 2008/01/25 MH Judeg if we need to use OFDM to sned MGNT frame for broadcom AP.
589 // 2008/01/28 MH We must prevent that we select null bssid to link.
590
591 if(network->broadcom_cap_exist)
592 {
593 retValue = 1;
594 }
595
596 return retValue;
597 }
598
599 u8 HTIOTActIsForcedCTS2Self(struct ieee80211_network *network)
600 {
601 u8 retValue = 0;
602
603 if(network->marvell_cap_exist)
604 {
605 retValue = 1;
606 }
607
608 return retValue;
609 }
610
611 u8 HTIOTActIsForcedRTSCTS(struct ieee80211_device *ieee, struct ieee80211_network *network)
612 {
613 u8 retValue = 0;
614 printk("============>%s(), %d\n", __FUNCTION__, network->realtek_cap_exit);
615 // Force protection
616 #if defined(RTL8192SE) || defined(RTL8192SU)
617 if(ieee->pHTInfo->bCurrentHTSupport)
618 {
619 //if(!network->realtek_cap_exit)
620 if((ieee->pHTInfo->IOTPeer != HT_IOT_PEER_REALTEK)&&
621 (ieee->pHTInfo->IOTPeer != HT_IOT_PEER_REALTEK_92SE))
622 {
623 if((ieee->pHTInfo->IOTAction & HT_IOT_ACT_TX_NO_AGGREGATION) == 0)
624 retValue = 1;
625 }
626 }
627 #endif
628 return retValue;
629 }
630
631 u8
632 HTIOTActIsForcedAMSDU8K(struct ieee80211_device *ieee, struct ieee80211_network *network)
633 {
634 u8 retValue = 0;
635
636 return retValue;
637 }
638
639 u8 HTIOTActIsCCDFsync(u8* PeerMacAddr)
640 {
641 u8 retValue = 0;
642 #ifndef RTL8192SE
643 if( (memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) ||
644 (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) ||
645 (memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ==0))
646 {
647 retValue = 1;
648 }
649 #endif
650 return retValue;
651 }
652
653 /*
654 * 819xS single chip b-cut series cannot handle BAR
655 */
656 u8
657 HTIOCActRejcectADDBARequest(struct ieee80211_network *network)
658 {
659 u8 retValue = 0;
660 //if(IS_HARDWARE_TYPE_8192SE(Adapter) ||
661 // IS_HARDWARE_TYPE_8192SU(Adapter)
662 //)
663 #if (defined RTL8192SE || defined RTL8192SU)
664 {
665 // Do not reject ADDBA REQ because some of the AP may
666 // keep on sending ADDBA REQ qhich cause DHCP fail or ping loss!
667 // by HPFan, 2008/12/30
668
669 //if(pBssDesc->Vender == HT_IOT_PEER_MARVELL)
670 // return FALSE;
671
672 }
673 #endif
674
675 return retValue;
676
677 }
678
679 /*
680 * EDCA parameters bias on downlink
681 */
682 u8
683 HTIOTActIsEDCABiasRx(struct ieee80211_device* ieee,struct ieee80211_network *network)
684 {
685 u8 retValue = 0;
686 //if(IS_HARDWARE_TYPE_8192SU(Adapter))
687 #ifdef RTL8192SU
688 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
689 {
690 //#if UNDER_VISTA
691 // if(pBssDesc->Vender==HT_IOT_PEER_ATHEROS ||
692 // pBssDesc->Vender==HT_IOT_PEER_RALINK)
693 //#else
694 if(pHTInfo->IOTPeer==HT_IOT_PEER_ATHEROS ||
695 pHTInfo->IOTPeer==HT_IOT_PEER_BROADCOM ||
696 pHTInfo->IOTPeer==HT_IOT_PEER_RALINK)
697 //#endif
698 return 1;
699
700 }
701 #endif
702 return retValue;
703 }
704
705 u8
706 HTIOTActDisableShortGI(struct ieee80211_device* ieee,struct ieee80211_network *network)
707 {
708 u8 retValue = 0;
709 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
710
711 if(pHTInfo->IOTPeer==HT_IOT_PEER_RALINK)
712 {
713 if(network->bssht.bdHT1R)
714 retValue = 1;
715 }
716
717 return retValue;
718 }
719
720 u8
721 HTIOTActDisableHighPower(struct ieee80211_device* ieee,struct ieee80211_network *network)
722 {
723 u8 retValue = 0;
724 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
725
726 if(pHTInfo->IOTPeer==HT_IOT_PEER_RALINK)
727 {
728 if(network->bssht.bdHT1R)
729 retValue = 1;
730 }
731
732 return retValue;
733 }
734
735 void
736 HTIOTActDetermineRaFunc(struct ieee80211_device* ieee, bool bPeerRx2ss)
737 {
738 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
739 pHTInfo->IOTRaFunc &= HT_IOT_RAFUNC_DISABLE_ALL;
740
741 if(pHTInfo->IOTPeer == HT_IOT_PEER_RALINK && !bPeerRx2ss)
742 pHTInfo->IOTRaFunc |= HT_IOT_RAFUNC_PEER_1R;
743
744 if(pHTInfo->IOTAction & HT_IOT_ACT_AMSDU_ENABLE)
745 pHTInfo->IOTRaFunc |= HT_IOT_RAFUNC_TX_AMSDU;
746
747 printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!IOTRaFunc = %8.8x\n", pHTInfo->IOTRaFunc);
748 }
749
750
751 u8
752 HTIOTActIsDisableTx40MHz(struct ieee80211_device* ieee,struct ieee80211_network *network)
753 {
754 u8 retValue = 0;
755
756 #if (defined RTL8192SU || defined RTL8192SE)
757 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
758 if( (KEY_TYPE_WEP104 == ieee->pairwise_key_type) ||
759 (KEY_TYPE_WEP40 == ieee->pairwise_key_type) ||
760 (KEY_TYPE_WEP104 == ieee->group_key_type) ||
761 (KEY_TYPE_WEP40 == ieee->group_key_type) ||
762 (KEY_TYPE_TKIP == ieee->pairwise_key_type) )
763 {
764 if((pHTInfo->IOTPeer==HT_IOT_PEER_REALTEK) && (network->bssht.bdSupportHT))
765 retValue = 1;
766 }
767 #endif
768
769 return retValue;
770 }
771
772 u8
773 HTIOTActIsTxNoAggregation(struct ieee80211_device* ieee,struct ieee80211_network *network)
774 {
775 u8 retValue = 0;
776
777 #if (defined RTL8192SU || defined RTL8192SE)
778 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
779 if( (KEY_TYPE_WEP104 == ieee->pairwise_key_type) ||
780 (KEY_TYPE_WEP40 == ieee->pairwise_key_type) ||
781 (KEY_TYPE_WEP104 == ieee->group_key_type) ||
782 (KEY_TYPE_WEP40 == ieee->group_key_type) ||
783 (KEY_TYPE_TKIP == ieee->pairwise_key_type) )
784 {
785 if(pHTInfo->IOTPeer==HT_IOT_PEER_REALTEK ||
786 pHTInfo->IOTPeer==HT_IOT_PEER_UNKNOWN)
787 retValue = 1;
788 }
789 #endif
790
791 return retValue;
792 }
793
794
795 u8
796 HTIOTActIsDisableTx2SS(struct ieee80211_device* ieee,struct ieee80211_network *network)
797 {
798 u8 retValue = 0;
799
800 #if (defined RTL8192SU || defined RTL8192SE)
801 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
802 if( (KEY_TYPE_WEP104 == ieee->pairwise_key_type) ||
803 (KEY_TYPE_WEP40 == ieee->pairwise_key_type) ||
804 (KEY_TYPE_WEP104 == ieee->group_key_type) ||
805 (KEY_TYPE_WEP40 == ieee->group_key_type) ||
806 (KEY_TYPE_TKIP == ieee->pairwise_key_type) )
807 {
808 if((pHTInfo->IOTPeer==HT_IOT_PEER_REALTEK) && (network->bssht.bdSupportHT))
809 retValue = 1;
810 }
811 #endif
812
813 return retValue;
814 }
815
816
817 bool HTIOCActAllowPeerAggOnePacket(struct ieee80211_device* ieee,struct ieee80211_network *network)
818 {
819 bool retValue = false;
820 #if defined(RTL8192SE) || defined(RTL8192SU)
821 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
822 {
823 if(pHTInfo->IOTPeer == HT_IOT_PEER_MARVELL)
824 return true;
825
826 }
827 #endif
828 return retValue;
829 }
830
831 void HTResetIOTSetting(
832 PRT_HIGH_THROUGHPUT pHTInfo
833 )
834 {
835 pHTInfo->IOTAction = 0;
836 pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
837 pHTInfo->IOTRaFunc = 0;
838 }
839
840
841 /********************************************************************************************************************
842 *function: Construct Capablility Element in Beacon... if HTEnable is turned on
843 * input: struct ieee80211_device* ieee
844 * u8* posHTCap //pointer to store Capability Ele
845 * u8* len //store length of CE
846 * u8 IsEncrypt //whether encrypt, needed further
847 * output: none
848 * return: none
849 * notice: posHTCap can't be null and should be initialized before.
850 * *****************************************************************************************************************/
851 void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u8* len, u8 IsEncrypt)
852 {
853 PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo;
854 PHT_CAPABILITY_ELE pCapELE = NULL;
855 //u8 bIsDeclareMCS13;
856
857 if ((posHTCap == NULL) || (pHT == NULL))
858 {
859 IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTCap or pHTInfo can't be null in HTConstructCapabilityElement()\n");
860 return;
861 }
862 memset(posHTCap, 0, *len);
863 if(pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC)
864 {
865 u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily
866 memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
867 pCapELE = (PHT_CAPABILITY_ELE)&(posHTCap[4]);
868 }else
869 {
870 pCapELE = (PHT_CAPABILITY_ELE)posHTCap;
871 }
872
873
874 //HT capability info
875 pCapELE->AdvCoding = 0; // This feature is not supported now!!
876 if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
877 {
878 pCapELE->ChlWidth = 0;
879 }
880 else
881 {
882 pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0);
883 }
884
885 // pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0);
886 pCapELE->MimoPwrSave = pHT->SelfMimoPs;
887 pCapELE->GreenField = 0; // This feature is not supported now!!
888 pCapELE->ShortGI20Mhz = 1; // We can receive Short GI!!
889 pCapELE->ShortGI40Mhz = 1; // We can receive Short GI!!
890 //DbgPrint("TX HT cap/info ele BW=%d SG20=%d SG40=%d\n\r",
891 //pCapELE->ChlWidth, pCapELE->ShortGI20Mhz, pCapELE->ShortGI40Mhz);
892 pCapELE->TxSTBC = 1;
893 pCapELE->RxSTBC = 0;
894 pCapELE->DelayBA = 0; // Do not support now!!
895 pCapELE->MaxAMSDUSize = (MAX_RECEIVE_BUFFER_SIZE>=7935)?1:0;
896 pCapELE->DssCCk = ((pHT->bRegBW40MHz)?(pHT->bRegSuppCCK?1:0):0);
897 pCapELE->PSMP = 0; // Do not support now!!
898 pCapELE->LSigTxopProtect = 0; // Do not support now!!
899
900
901 //MAC HT parameters info
902 // TODO: Nedd to take care of this part
903 IEEE80211_DEBUG(IEEE80211_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk);
904
905 if( IsEncrypt)
906 {
907 pCapELE->MPDUDensity = 7; // 8us
908 pCapELE->MaxRxAMPDUFactor = 2; // 2 is for 32 K and 3 is 64K
909 }
910 else
911 {
912 pCapELE->MaxRxAMPDUFactor = 3; // 2 is for 32 K and 3 is 64K
913 pCapELE->MPDUDensity = 0; // no density
914 }
915
916 //Supported MCS set
917 memcpy(pCapELE->MCS, ieee->Regdot11HTOperationalRateSet, 16);
918 if(pHT->IOTAction & HT_IOT_ACT_DISABLE_MCS15)
919 pCapELE->MCS[1] &= 0x7f;
920
921 if(pHT->IOTAction & HT_IOT_ACT_DISABLE_MCS14)
922 pCapELE->MCS[1] &= 0xbf;
923
924 if(pHT->IOTAction & HT_IOT_ACT_DISABLE_ALL_2SS)
925 pCapELE->MCS[1] &= 0x00;
926
927 // 2008.06.12
928 // For RTL819X, if pairwisekey = wep/tkip, ap is ralink, we support only MCS0~7.
929 if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
930 {
931 int i;
932 for(i = 1; i< 16; i++)
933 pCapELE->MCS[i] = 0;
934 }
935
936 //Extended HT Capability Info
937 memset(&pCapELE->ExtHTCapInfo, 0, 2);
938
939
940 //TXBF Capabilities
941 memset(pCapELE->TxBFCap, 0, 4);
942
943 //Antenna Selection Capabilities
944 pCapELE->ASCap = 0;
945 //add 2 to give space for element ID and len when construct frames
946 if(pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC)
947 *len = 30 + 2;
948 else
949 *len = 26 + 2;
950
951
952
953 // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA | IEEE80211_DL_HT, posHTCap, *len -2);
954
955 //Print each field in detail. Driver should not print out this message by default
956 // HTDebugHTCapability(posHTCap, (u8*)"HTConstructCapability()");
957 return;
958
959 }
960 /********************************************************************************************************************
961 *function: Construct Information Element in Beacon... if HTEnable is turned on
962 * input: struct ieee80211_device* ieee
963 * u8* posHTCap //pointer to store Information Ele
964 * u8* len //store len of
965 * u8 IsEncrypt //whether encrypt, needed further
966 * output: none
967 * return: none
968 * notice: posHTCap can't be null and be initialized before. only AP and IBSS sta should do this
969 * *****************************************************************************************************************/
970 void HTConstructInfoElement(struct ieee80211_device* ieee, u8* posHTInfo, u8* len, u8 IsEncrypt)
971 {
972 PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo;
973 PHT_INFORMATION_ELE pHTInfoEle = (PHT_INFORMATION_ELE)posHTInfo;
974 if ((posHTInfo == NULL) || (pHTInfoEle == NULL))
975 {
976 IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTInfo or pHTInfoEle can't be null in HTConstructInfoElement()\n");
977 return;
978 }
979
980 memset(posHTInfo, 0, *len);
981 if ( (ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == IW_MODE_MASTER)) //ap mode is not currently supported
982 {
983 pHTInfoEle->ControlChl = ieee->current_network.channel;
984 pHTInfoEle->ExtChlOffset = ((pHT->bRegBW40MHz == false)?HT_EXTCHNL_OFFSET_NO_EXT:
985 (ieee->current_network.channel<=6)?
986 HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER);
987 pHTInfoEle->RecommemdedTxWidth = pHT->bRegBW40MHz;
988 pHTInfoEle->RIFS = 0;
989 pHTInfoEle->PSMPAccessOnly = 0;
990 pHTInfoEle->SrvIntGranularity = 0;
991 pHTInfoEle->OptMode = pHT->CurrentOpMode;
992 pHTInfoEle->NonGFDevPresent = 0;
993 pHTInfoEle->DualBeacon = 0;
994 pHTInfoEle->SecondaryBeacon = 0;
995 pHTInfoEle->LSigTxopProtectFull = 0;
996 pHTInfoEle->PcoActive = 0;
997 pHTInfoEle->PcoPhase = 0;
998
999 memset(pHTInfoEle->BasicMSC, 0, 16);
1000
1001
1002 *len = 22 + 2; //same above
1003
1004 }
1005 else
1006 {
1007 //STA should not generate High Throughput Information Element
1008 *len = 0;
1009 }
1010 //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA | IEEE80211_DL_HT, posHTInfo, *len - 2);
1011 //HTDebugHTInfo(posHTInfo, "HTConstructInforElement");
1012 return;
1013 }
1014
1015 /*
1016 * According to experiment, Realtek AP to STA (based on rtl8190) may achieve best performance
1017 * if both STA and AP set limitation of aggregation size to 32K, that is, set AMPDU density to 2
1018 * (Ref: IEEE 11n specification). However, if Realtek STA associates to other AP, STA should set
1019 * limitation of aggregation size to 8K, otherwise, performance of traffic stream from STA to AP
1020 * will be much less than the traffic stream from AP to STA if both of the stream runs concurrently
1021 * at the same time.
1022 *
1023 * Frame Format
1024 * Element ID Length OUI Type1 Reserved
1025 * 1 byte 1 byte 3 bytes 1 byte 1 byte
1026 *
1027 * OUI = 0x00, 0xe0, 0x4c,
1028 * Type = 0x02
1029 * Reserved = 0x00
1030 *
1031 * 2007.8.21 by Emily
1032 */
1033 /********************************************************************************************************************
1034 *function: Construct Information Element in Beacon... in RT2RT condition
1035 * input: struct ieee80211_device* ieee
1036 * u8* posRT2RTAgg //pointer to store Information Ele
1037 * u8* len //store len
1038 * output: none
1039 * return: none
1040 * notice:
1041 * *****************************************************************************************************************/
1042 void HTConstructRT2RTAggElement(struct ieee80211_device* ieee, u8* posRT2RTAgg, u8* len)
1043 {
1044 if (posRT2RTAgg == NULL) {
1045 IEEE80211_DEBUG(IEEE80211_DL_ERR, "posRT2RTAgg can't be null in HTConstructRT2RTAggElement()\n");
1046 return;
1047 }
1048 memset(posRT2RTAgg, 0, *len);
1049 *posRT2RTAgg++ = 0x00;
1050 *posRT2RTAgg++ = 0xe0;
1051 *posRT2RTAgg++ = 0x4c;
1052 *posRT2RTAgg++ = 0x02;
1053 *posRT2RTAgg++ = 0x01;
1054 *posRT2RTAgg = 0x10;//*posRT2RTAgg = 0x02;
1055
1056 if(ieee->bSupportRemoteWakeUp) {
1057 *posRT2RTAgg |= 0x08;//RT_HT_CAP_USE_WOW;
1058 }
1059
1060 *len = 6 + 2;
1061 return;
1062 #ifdef TODO
1063 #if(HAL_CODE_BASE == RTL8192 && DEV_BUS_TYPE == USB_INTERFACE)
1064 /*
1065 //Emily. If it is required to Ask Realtek AP to send AMPDU during AES mode, enable this
1066 section of code.
1067 if(IS_UNDER_11N_AES_MODE(Adapter))
1068 {
1069 posRT2RTAgg->Octet[5] |=RT_HT_CAP_USE_AMPDU;
1070 }else
1071 {
1072 posRT2RTAgg->Octet[5] &= 0xfb;
1073 }
1074 */
1075
1076 #else
1077 // Do Nothing
1078 #endif
1079
1080 posRT2RTAgg->Length = 6;
1081 #endif
1082
1083
1084
1085
1086 }
1087
1088
1089 /********************************************************************************************************************
1090 *function: Pick the right Rate Adaptive table to use
1091 * input: struct ieee80211_device* ieee
1092 * u8* pOperateMCS //A pointer to MCS rate bitmap
1093 * return: always we return true
1094 * notice:
1095 * *****************************************************************************************************************/
1096 u8 HT_PickMCSRate(struct ieee80211_device* ieee, u8* pOperateMCS)
1097 {
1098 u8 i;
1099 if (pOperateMCS == NULL)
1100 {
1101 IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in HT_PickMCSRate()\n");
1102 return false;
1103 }
1104
1105 switch(ieee->mode)
1106 {
1107 case IEEE_A:
1108 case IEEE_B:
1109 case IEEE_G:
1110 //legacy rate routine handled at selectedrate
1111
1112 //no MCS rate
1113 for(i=0;i<=15;i++){
1114 pOperateMCS[i] = 0;
1115 }
1116 break;
1117
1118 case IEEE_N_24G: //assume CCK rate ok
1119 case IEEE_N_5G:
1120 // Legacy part we only use 6, 5.5,2,1 for N_24G and 6 for N_5G.
1121 // Legacy part shall be handled at SelectRateSet().
1122
1123 //HT part
1124 // TODO: may be different if we have different number of antenna
1125 pOperateMCS[0] &=RATE_ADPT_1SS_MASK; //support MCS 0~7
1126 pOperateMCS[1] &=RATE_ADPT_2SS_MASK;
1127 pOperateMCS[3] &=RATE_ADPT_MCS32_MASK;
1128 break;
1129
1130 //should never reach here
1131 default:
1132
1133 break;
1134
1135 }
1136
1137 return true;
1138 }
1139
1140 /*
1141 * Description:
1142 * This function will get the highest speed rate in input MCS set.
1143 *
1144 * /param Adapter Pionter to Adapter entity
1145 * pMCSRateSet Pointer to MCS rate bitmap
1146 * pMCSFilter Pointer to MCS rate filter
1147 *
1148 * /return Highest MCS rate included in pMCSRateSet and filtered by pMCSFilter.
1149 *
1150 */
1151 /********************************************************************************************************************
1152 *function: This function will get the highest speed rate in input MCS set.
1153 * input: struct ieee80211_device* ieee
1154 * u8* pMCSRateSet //Pointer to MCS rate bitmap
1155 * u8* pMCSFilter //Pointer to MCS rate filter
1156 * return: Highest MCS rate included in pMCSRateSet and filtered by pMCSFilter
1157 * notice:
1158 * *****************************************************************************************************************/
1159 u8 HTGetHighestMCSRate(struct ieee80211_device* ieee, u8* pMCSRateSet, u8* pMCSFilter)
1160 {
1161 u8 i, j;
1162 u8 bitMap;
1163 u8 mcsRate = 0;
1164 u8 availableMcsRate[16];
1165 if (pMCSRateSet == NULL || pMCSFilter == NULL)
1166 {
1167 IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter can't be null in HTGetHighestMCSRate()\n");
1168 return false;
1169 }
1170 for(i=0; i<16; i++)
1171 availableMcsRate[i] = pMCSRateSet[i] & pMCSFilter[i];
1172
1173 for(i = 0; i < 16; i++)
1174 {
1175 if(availableMcsRate[i] != 0)
1176 break;
1177 }
1178 if(i == 16)
1179 return false;
1180
1181 for(i = 0; i < 16; i++)
1182 {
1183 if(availableMcsRate[i] != 0)
1184 {
1185 bitMap = availableMcsRate[i];
1186 for(j = 0; j < 8; j++)
1187 {
1188 if((bitMap%2) != 0)
1189 {
1190 if(HTMcsToDataRate(ieee, (8*i+j)) > HTMcsToDataRate(ieee, mcsRate))
1191 mcsRate = (8*i+j);
1192 }
1193 bitMap = bitMap>>1;
1194 }
1195 }
1196 }
1197 return (mcsRate|0x80);
1198 }
1199
1200
1201
1202 /*
1203 **
1204 **1.Filter our operation rate set with AP's rate set
1205 **2.shall reference channel bandwidth, STBC, Antenna number
1206 **3.generate rate adative table for firmware
1207 **David 20060906
1208 **
1209 ** \pHTSupportedCap: the connected STA's supported rate Capability element
1210 */
1211 u8 HTFilterMCSRate( struct ieee80211_device* ieee, u8* pSupportMCS, u8* pOperateMCS)
1212 {
1213
1214 u8 i=0;
1215
1216 // filter out operational rate set not supported by AP, the lenth of it is 16
1217 for(i=0;i<=15;i++){
1218 pOperateMCS[i] = ieee->Regdot11HTOperationalRateSet[i]&pSupportMCS[i];
1219 }
1220
1221
1222 // TODO: adjust our operational rate set according to our channel bandwidth, STBC and Antenna number
1223
1224 // TODO: fill suggested rate adaptive rate index and give firmware info using Tx command packet
1225 // we also shall suggested the first start rate set according to our singal strength
1226 HT_PickMCSRate(ieee, pOperateMCS);
1227
1228 // For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7.
1229 if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
1230 pOperateMCS[1] = 0;
1231
1232 //
1233 // For RTL819X, we support only MCS0~15.
1234 // And also, we do not know how to use MCS32 now.
1235 //
1236 for(i=2; i<=15; i++)
1237 pOperateMCS[i] = 0;
1238
1239 return true;
1240 }
1241 void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset);
1242 #if 0
1243 //I need move this function to other places, such as rx?
1244 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1245 void HTOnAssocRsp_wq(struct work_struct *work)
1246 {
1247 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, ht_onAssRsp);
1248 #else
1249 void HTOnAssocRsp_wq(struct ieee80211_device *ieee)
1250 {
1251 #endif
1252 #endif
1253 void HTOnAssocRsp(struct ieee80211_device *ieee)
1254 {
1255 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1256 PHT_CAPABILITY_ELE pPeerHTCap = NULL;
1257 PHT_INFORMATION_ELE pPeerHTInfo = NULL;
1258 u16 nMaxAMSDUSize = 0;
1259 u8* pMcsFilter = NULL;
1260
1261 static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily
1262 static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; // For 11n EWC definition, 2007.07.17, by Emily
1263
1264 if( pHTInfo->bCurrentHTSupport == false )
1265 {
1266 IEEE80211_DEBUG(IEEE80211_DL_ERR, "<=== HTOnAssocRsp(): HT_DISABLE\n");
1267 return;
1268 }
1269 IEEE80211_DEBUG(IEEE80211_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n");
1270 // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, pHTInfo->PeerHTCapBuf, sizeof(HT_CAPABILITY_ELE));
1271 // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, pHTInfo->PeerHTInfoBuf, sizeof(HT_INFORMATION_ELE));
1272
1273 // HTDebugHTCapability(pHTInfo->PeerHTCapBuf,"HTOnAssocRsp_wq");
1274 // HTDebugHTInfo(pHTInfo->PeerHTInfoBuf,"HTOnAssocRsp_wq");
1275 //
1276 if(!memcmp(pHTInfo->PeerHTCapBuf,EWC11NHTCap, sizeof(EWC11NHTCap)))
1277 pPeerHTCap = (PHT_CAPABILITY_ELE)(&pHTInfo->PeerHTCapBuf[4]);
1278 else
1279 pPeerHTCap = (PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf);
1280
1281 if(!memcmp(pHTInfo->PeerHTInfoBuf, EWC11NHTInfo, sizeof(EWC11NHTInfo)))
1282 pPeerHTInfo = (PHT_INFORMATION_ELE)(&pHTInfo->PeerHTInfoBuf[4]);
1283 else
1284 pPeerHTInfo = (PHT_INFORMATION_ELE)(pHTInfo->PeerHTInfoBuf);
1285
1286
1287 ////////////////////////////////////////////////////////
1288 // Configurations:
1289 ////////////////////////////////////////////////////////
1290 IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_HT, pPeerHTCap, sizeof(HT_CAPABILITY_ELE));
1291 // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_HT, pPeerHTInfo, sizeof(HT_INFORMATION_ELE));
1292 // Config Supported Channel Width setting
1293 //
1294 HTSetConnectBwMode(ieee, (HT_CHANNEL_WIDTH)(pPeerHTCap->ChlWidth), (HT_EXTCHNL_OFFSET)(pPeerHTInfo->ExtChlOffset));
1295
1296 // if(pHTInfo->bCurBW40MHz == true)
1297 pHTInfo->bCurTxBW40MHz = ((pPeerHTInfo->RecommemdedTxWidth == 1)?true:false);
1298
1299 //
1300 // Update short GI/ long GI setting
1301 //
1302 // TODO:
1303 pHTInfo->bCurShortGI20MHz=
1304 ((pHTInfo->bRegShortGI20MHz)?((pPeerHTCap->ShortGI20Mhz==1)?true:false):false);
1305 pHTInfo->bCurShortGI40MHz=
1306 ((pHTInfo->bRegShortGI40MHz)?((pPeerHTCap->ShortGI40Mhz==1)?true:false):false);
1307
1308 //
1309 // Config TX STBC setting
1310 //
1311 // TODO:
1312
1313 //
1314 // Config DSSS/CCK mode in 40MHz mode
1315 //
1316 // TODO:
1317 pHTInfo->bCurSuppCCK =
1318 ((pHTInfo->bRegSuppCCK)?((pPeerHTCap->DssCCk==1)?true:false):false);
1319
1320
1321 //
1322 // Config and configure A-MSDU setting
1323 //
1324 pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support;
1325
1326 nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize==0)?3839:7935;
1327
1328 if(pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize )
1329 pHTInfo->nCurrent_AMSDU_MaxSize = nMaxAMSDUSize;
1330 else
1331 pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
1332
1333 //
1334 // Config A-MPDU setting
1335 //
1336 pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable;
1337 if(ieee->is_ap_in_wep_tkip && ieee->is_ap_in_wep_tkip(ieee->dev))
1338 {
1339 if( (pHTInfo->IOTPeer== HT_IOT_PEER_ATHEROS) ||
1340 (pHTInfo->IOTPeer == HT_IOT_PEER_UNKNOWN) )
1341 pHTInfo->bCurrentAMPDUEnable = false;
1342 }
1343
1344 // <1> Decide AMPDU Factor
1345
1346 // By Emily
1347 if(!pHTInfo->bRegRT2RTAggregation)
1348 {
1349 // Decide AMPDU Factor according to protocol handshake
1350 if(pHTInfo->AMPDU_Factor > pPeerHTCap->MaxRxAMPDUFactor)
1351 pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor;
1352 else
1353 pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
1354
1355 }else
1356 {
1357 // Set MPDU density to 2 to Realtek AP, and set it to 0 for others
1358 // Replace MPDU factor declared in original association response frame format. 2007.08.20 by Emily
1359 #if 0
1360 osTmp= PacketGetElement( asocpdu, EID_Vendor, OUI_SUB_REALTEK_AGG, OUI_SUBTYPE_DONT_CARE);
1361 if(osTmp.Length >= 5) //00:e0:4c:02:00
1362 #endif
1363 if (ieee->current_network.bssht.bdRT2RTAggregation)
1364 {
1365 if( ieee->pairwise_key_type != KEY_TYPE_NA)
1366 // Realtek may set 32k in security mode and 64k for others
1367 pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor;
1368 else
1369 pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_64K;
1370 }else
1371 {
1372 if(pPeerHTCap->MaxRxAMPDUFactor < HT_AGG_SIZE_32K)
1373 pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor;
1374 else
1375 pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_32K;
1376 }
1377 }
1378
1379 // <2> Set AMPDU Minimum MPDU Start Spacing
1380 // 802.11n 3.0 section 9.7d.3
1381 #if 1
1382 if(pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity)
1383 pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
1384 else
1385 pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
1386 if(ieee->pairwise_key_type != KEY_TYPE_NA )
1387 pHTInfo->CurrentMPDUDensity = 7; // 8us
1388 #else
1389 if(pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity)
1390 pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
1391 else
1392 pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
1393 #endif
1394 // Force TX AMSDU
1395
1396 // Lanhsin: mark for tmp to avoid deauth by ap from s3
1397 //if(memcmp(pMgntInfo->Bssid, NETGEAR834Bv2_BROADCOM, 3)==0)
1398 if(pHTInfo->IOTAction & HT_IOT_ACT_TX_USE_AMSDU_8K)
1399 {
1400
1401 pHTInfo->bCurrentAMPDUEnable = false;
1402 pHTInfo->ForcedAMSDUMode = HT_AGG_FORCE_ENABLE;
1403 pHTInfo->ForcedAMSDUMaxSize = 7935;
1404 }
1405
1406 // Rx Reorder Setting
1407 pHTInfo->bCurRxReorderEnable = pHTInfo->bRegRxReorderEnable;
1408
1409 //
1410 // Filter out unsupported HT rate for this AP
1411 // Update RATR table
1412 // This is only for 8190 ,8192 or later product which using firmware to handle rate adaptive mechanism.
1413 //
1414
1415 // Handle Ralink AP bad MCS rate set condition. Joseph.
1416 // This fix the bug of Ralink AP. This may be removed in the future.
1417 if(pPeerHTCap->MCS[0] == 0)
1418 pPeerHTCap->MCS[0] = 0xff;
1419
1420 // Joseph test //LZM ADD 090318
1421 HTIOTActDetermineRaFunc(ieee, ((pPeerHTCap->MCS[1])!=0));
1422
1423 HTFilterMCSRate(ieee, pPeerHTCap->MCS, ieee->dot11HTOperationalRateSet);
1424
1425 //
1426 // Config MIMO Power Save setting
1427 //
1428 pHTInfo->PeerMimoPs = pPeerHTCap->MimoPwrSave;
1429 if(pHTInfo->PeerMimoPs == MIMO_PS_STATIC)
1430 pMcsFilter = MCS_FILTER_1SS;
1431 else
1432 pMcsFilter = MCS_FILTER_ALL;
1433 //WB add for MCS8 bug
1434 // pMcsFilter = MCS_FILTER_1SS;
1435 ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee, ieee->dot11HTOperationalRateSet, pMcsFilter);
1436 ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate;
1437
1438 //
1439 // Config current operation mode.
1440 //
1441 pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;
1442
1443
1444
1445 }
1446
1447 void HTSetConnectBwModeCallback(struct ieee80211_device* ieee);
1448 /********************************************************************************************************************
1449 *function: initialize HT info(struct PRT_HIGH_THROUGHPUT)
1450 * input: struct ieee80211_device* ieee
1451 * output: none
1452 * return: none
1453 * notice: This function is called when * (1) MPInitialization Phase * (2) Receiving of Deauthentication from AP
1454 ********************************************************************************************************************/
1455 // TODO: Should this funciton be called when receiving of Disassociation?
1456 void HTInitializeHTInfo(struct ieee80211_device* ieee)
1457 {
1458 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1459
1460 //
1461 // These parameters will be reset when receiving deauthentication packet
1462 //
1463 IEEE80211_DEBUG(IEEE80211_DL_HT, "===========>%s()\n", __FUNCTION__);
1464 pHTInfo->bCurrentHTSupport = false;
1465
1466 // 40MHz channel support
1467 pHTInfo->bCurBW40MHz = false;
1468 pHTInfo->bCurTxBW40MHz = false;
1469
1470 // Short GI support
1471 pHTInfo->bCurShortGI20MHz = false;
1472 pHTInfo->bCurShortGI40MHz = false;
1473 pHTInfo->bForcedShortGI = false;
1474
1475 // CCK rate support
1476 // This flag is set to true to support CCK rate by default.
1477 // It will be affected by "pHTInfo->bRegSuppCCK" and AP capabilities only when associate to
1478 // 11N BSS.
1479 pHTInfo->bCurSuppCCK = true;
1480
1481 // AMSDU related
1482 pHTInfo->bCurrent_AMSDU_Support = false;
1483 pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
1484
1485 // AMPUD related
1486 pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
1487 pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
1488
1489
1490
1491 // Initialize all of the parameters related to 11n
1492 memset((void*)(&(pHTInfo->SelfHTCap)), 0, sizeof(pHTInfo->SelfHTCap));
1493 memset((void*)(&(pHTInfo->SelfHTInfo)), 0, sizeof(pHTInfo->SelfHTInfo));
1494 memset((void*)(&(pHTInfo->PeerHTCapBuf)), 0, sizeof(pHTInfo->PeerHTCapBuf));
1495 memset((void*)(&(pHTInfo->PeerHTInfoBuf)), 0, sizeof(pHTInfo->PeerHTInfoBuf));
1496
1497 pHTInfo->bSwBwInProgress = false;
1498 pHTInfo->ChnlOp = CHNLOP_NONE;
1499
1500 // Set default IEEE spec for Draft N
1501 pHTInfo->ePeerHTSpecVer = HT_SPEC_VER_IEEE;
1502
1503 // Realtek proprietary aggregation mode
1504 pHTInfo->bCurrentRT2RTAggregation = false;
1505 pHTInfo->bCurrentRT2RTLongSlotTime = false;
1506 pHTInfo->RT2RT_HT_Mode = (RT_HT_CAPBILITY)0;
1507
1508 pHTInfo->IOTPeer = 0;
1509 pHTInfo->IOTAction = 0;
1510 pHTInfo->IOTRaFunc = 0;
1511
1512 //MCS rate initialized here
1513 {
1514 u8* RegHTSuppRateSets = &(ieee->RegHTSuppRateSet[0]);
1515 RegHTSuppRateSets[0] = 0xFF; //support MCS 0~7
1516 RegHTSuppRateSets[1] = 0xFF; //support MCS 8~15
1517 RegHTSuppRateSets[4] = 0x01; //support MCS 32
1518 }
1519 }
1520 /********************************************************************************************************************
1521 *function: initialize Bss HT structure(struct PBSS_HT)
1522 * input: PBSS_HT pBssHT //to be initialized
1523 * output: none
1524 * return: none
1525 * notice: This function is called when initialize network structure
1526 ********************************************************************************************************************/
1527 void HTInitializeBssDesc(PBSS_HT pBssHT)
1528 {
1529
1530 pBssHT->bdSupportHT = false;
1531 memset(pBssHT->bdHTCapBuf, 0, sizeof(pBssHT->bdHTCapBuf));
1532 pBssHT->bdHTCapLen = 0;
1533 memset(pBssHT->bdHTInfoBuf, 0, sizeof(pBssHT->bdHTInfoBuf));
1534 pBssHT->bdHTInfoLen = 0;
1535
1536 pBssHT->bdHTSpecVer= HT_SPEC_VER_IEEE;
1537
1538 pBssHT->bdRT2RTAggregation = false;
1539 pBssHT->bdRT2RTLongSlotTime = false;
1540 pBssHT->RT2RT_HT_Mode = (RT_HT_CAPBILITY)0;
1541 }
1542 #if 0
1543 //below function has merged into ieee80211_network_init() in ieee80211_rx.c
1544 void
1545 HTParsingHTCapElement(
1546 IN PADAPTER Adapter,
1547 IN OCTET_STRING HTCapIE,
1548 OUT PRT_WLAN_BSS pBssDesc
1549 )
1550 {
1551 PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
1552
1553 if( HTCapIE.Length > sizeof(pBssDesc->BssHT.bdHTCapBuf) )
1554 {
1555 RT_TRACE( COMP_HT, DBG_LOUD, ("HTParsingHTCapElement(): HT Capability Element length is too long!\n") );
1556 return;
1557 }
1558
1559 // TODO: Check the correctness of HT Cap
1560 //Print each field in detail. Driver should not print out this message by default
1561 if(!pMgntInfo->mActingAsAp && !pMgntInfo->mAssoc)
1562 HTDebugHTCapability(DBG_TRACE, Adapter, &HTCapIE, (pu8)"HTParsingHTCapElement()");
1563
1564 HTCapIE.Length = HTCapIE.Length > sizeof(pBssDesc->BssHT.bdHTCapBuf)?\
1565 sizeof(pBssDesc->BssHT.bdHTCapBuf):HTCapIE.Length; //prevent from overflow
1566
1567 CopyMem(pBssDesc->BssHT.bdHTCapBuf, HTCapIE.Octet, HTCapIE.Length);
1568 pBssDesc->BssHT.bdHTCapLen = HTCapIE.Length;
1569
1570 }
1571
1572
1573 void
1574 HTParsingHTInfoElement(
1575 PADAPTER Adapter,
1576 OCTET_STRING HTInfoIE,
1577 PRT_WLAN_BSS pBssDesc
1578 )
1579 {
1580 PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
1581
1582 if( HTInfoIE.Length > sizeof(pBssDesc->BssHT.bdHTInfoBuf))
1583 {
1584 RT_TRACE( COMP_HT, DBG_LOUD, ("HTParsingHTInfoElement(): HT Information Element length is too long!\n") );
1585 return;
1586 }
1587
1588 // TODO: Check the correctness of HT Info
1589 //Print each field in detail. Driver should not print out this message by default
1590 if(!pMgntInfo->mActingAsAp && !pMgntInfo->mAssoc)
1591 HTDebugHTInfo(DBG_TRACE, Adapter, &HTInfoIE, (pu8)"HTParsingHTInfoElement()");
1592
1593 HTInfoIE.Length = HTInfoIE.Length > sizeof(pBssDesc->BssHT.bdHTInfoBuf)?\
1594 sizeof(pBssDesc->BssHT.bdHTInfoBuf):HTInfoIE.Length; //prevent from overflow
1595
1596 CopyMem( pBssDesc->BssHT.bdHTInfoBuf, HTInfoIE.Octet, HTInfoIE.Length);
1597 pBssDesc->BssHT.bdHTInfoLen = HTInfoIE.Length;
1598 }
1599
1600 /*
1601 * Get HT related information from beacon and save it in BssDesc
1602 *
1603 * (1) Parse HTCap, and HTInfo, and record whether it is 11n AP
1604 * (2) If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT()
1605 * (3) Check whether peer is Realtek AP (for Realtek proprietary aggregation mode).
1606 * Input:
1607 * PADAPTER Adapter
1608 *
1609 * Output:
1610 * PRT_TCB BssDesc
1611 *
1612 */
1613 void HTGetValueFromBeaconOrProbeRsp(
1614 PADAPTER Adapter,
1615 POCTET_STRING pSRCmmpdu,
1616 PRT_WLAN_BSS bssDesc
1617 )
1618 {
1619 PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
1620 PRT_HIGH_THROUGHPUT pHTInfo = GET_HT_INFO(pMgntInfo);
1621 OCTET_STRING HTCapIE, HTInfoIE, HTRealtekAgg, mmpdu;
1622 OCTET_STRING BroadcomElement, CiscoElement;
1623
1624 mmpdu.Octet = pSRCmmpdu->Octet;
1625 mmpdu.Length = pSRCmmpdu->Length;
1626
1627 //2Note:
1628 // Mark for IOT testing using Linksys WRT350N, This AP does not contain WMM IE when
1629 // it is configured at pure-N mode.
1630 // if(bssDesc->BssQos.bdQoSMode & QOS_WMM)
1631 //
1632
1633 HTInitializeBssDesc (&bssDesc->BssHT);
1634
1635 //2<1> Parse HTCap, and HTInfo
1636 // Get HT Capability IE: (1) Get IEEE Draft N IE or (2) Get EWC IE
1637 HTCapIE = PacketGetElement(mmpdu, EID_HTCapability, OUI_SUB_DONT_CARE, OUI_SUBTYPE_DONT_CARE);
1638 if(HTCapIE.Length == 0)
1639 {
1640 HTCapIE = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_11N_EWC_HT_CAP, OUI_SUBTYPE_DONT_CARE);
1641 if(HTCapIE.Length != 0)
1642 bssDesc->BssHT.bdHTSpecVer= HT_SPEC_VER_EWC;
1643 }
1644 if(HTCapIE.Length != 0)
1645 HTParsingHTCapElement(Adapter, HTCapIE, bssDesc);
1646
1647 // Get HT Information IE: (1) Get IEEE Draft N IE or (2) Get EWC IE
1648 HTInfoIE = PacketGetElement(mmpdu, EID_HTInfo, OUI_SUB_DONT_CARE, OUI_SUBTYPE_DONT_CARE);
1649 if(HTInfoIE.Length == 0)
1650 {
1651 HTInfoIE = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_11N_EWC_HT_INFO, OUI_SUBTYPE_DONT_CARE);
1652 if(HTInfoIE.Length != 0)
1653 bssDesc->BssHT.bdHTSpecVer = HT_SPEC_VER_EWC;
1654 }
1655 if(HTInfoIE.Length != 0)
1656 HTParsingHTInfoElement(Adapter, HTInfoIE, bssDesc);
1657
1658 //2<2>If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT()
1659 if(HTCapIE.Length != 0)
1660 {
1661 bssDesc->BssHT.bdSupportHT = true;
1662 if(bssDesc->BssQos.bdQoSMode == QOS_DISABLE)
1663 QosSetLegacyWMMParamWithHT(Adapter, bssDesc);
1664 }
1665 else
1666 {
1667 bssDesc->BssHT.bdSupportHT = false;
1668 }
1669
1670 //2<3>Check whether the peer is Realtek AP/STA
1671 if(pHTInfo->bRegRT2RTAggregation)
1672 {
1673 if(bssDesc->BssHT.bdSupportHT)
1674 {
1675 HTRealtekAgg = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_REALTEK_AGG, OUI_SUBTYPE_DONT_CARE);
1676 if(HTRealtekAgg.Length >=5 )
1677 {
1678 bssDesc->BssHT.bdRT2RTAggregation = true;
1679
1680 if((HTRealtekAgg.Octet[4]==1) && (HTRealtekAgg.Octet[5] & 0x02))
1681 bssDesc->BssHT.bdRT2RTLongSlotTime = true;
1682 }
1683 }
1684 }
1685
1686 //
1687 // 2008/01/25 MH Get Broadcom AP IE for manamgent frame CCK rate problem.
1688 // AP can not receive CCK managemtn from from 92E.
1689 //
1690
1691 // Initialize every new bss broadcom cap exist as false..
1692 bssDesc->bBroadcomCapExist= false;
1693
1694 if(HTCapIE.Length != 0 || HTInfoIE.Length != 0)
1695 {
1696 u4Byte Length = 0;
1697
1698 FillOctetString(BroadcomElement, NULL, 0);
1699
1700 BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_1, OUI_SUBTYPE_DONT_CARE);
1701 Length += BroadcomElement.Length;
1702 BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_2, OUI_SUBTYPE_DONT_CARE);
1703 Length += BroadcomElement.Length;
1704 BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_3, OUI_SUBTYPE_DONT_CARE);
1705 Length += BroadcomElement.Length;
1706
1707 if(Length > 0)
1708 bssDesc->bBroadcomCapExist = true;
1709 }
1710
1711
1712 // For Cisco IOT issue
1713 CiscoElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_CISCO_IE, OUI_SUBTYPE_DONT_CARE);
1714 if(CiscoElement.Length != 0){ // 3: 0x00, 0x40, 0x96 ....
1715 bssDesc->bCiscoCapExist = true;
1716 }else{
1717 bssDesc->bCiscoCapExist = false;
1718 }
1719 }
1720
1721
1722 #endif
1723 /********************************************************************************************************************
1724 *function: initialize Bss HT structure(struct PBSS_HT)
1725 * input: struct ieee80211_device *ieee
1726 * struct ieee80211_network *pNetwork //usually current network we are live in
1727 * output: none
1728 * return: none
1729 * notice: This function should ONLY be called before association
1730 ********************************************************************************************************************/
1731 void HTResetSelfAndSavePeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork)
1732 {
1733 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1734 // u16 nMaxAMSDUSize;
1735 // PHT_CAPABILITY_ELE pPeerHTCap = (PHT_CAPABILITY_ELE)pNetwork->bssht.bdHTCapBuf;
1736 // PHT_INFORMATION_ELE pPeerHTInfo = (PHT_INFORMATION_ELE)pNetwork->bssht.bdHTInfoBuf;
1737 // u8* pMcsFilter;
1738 u8 bIOTAction = 0;
1739
1740 //
1741 // Save Peer Setting before Association
1742 //
1743 IEEE80211_DEBUG(IEEE80211_DL_HT, "==============>%s()\n", __FUNCTION__);
1744 /*unmark bEnableHT flag here is the same reason why unmarked in function ieee80211_softmac_new_net. WB 2008.09.10*/
1745 // if( pHTInfo->bEnableHT && pNetwork->bssht.bdSupportHT)
1746 if (pNetwork->bssht.bdSupportHT)
1747 {
1748 pHTInfo->bCurrentHTSupport = true;
1749 pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer;
1750
1751 // Save HTCap and HTInfo information Element
1752 if(pNetwork->bssht.bdHTCapLen > 0 && pNetwork->bssht.bdHTCapLen <= sizeof(pHTInfo->PeerHTCapBuf))
1753 memcpy(pHTInfo->PeerHTCapBuf, pNetwork->bssht.bdHTCapBuf, pNetwork->bssht.bdHTCapLen);
1754
1755 if(pNetwork->bssht.bdHTInfoLen > 0 && pNetwork->bssht.bdHTInfoLen <= sizeof(pHTInfo->PeerHTInfoBuf))
1756 memcpy(pHTInfo->PeerHTInfoBuf, pNetwork->bssht.bdHTInfoBuf, pNetwork->bssht.bdHTInfoLen);
1757
1758 // Check whether RT to RT aggregation mode is enabled
1759 if(pHTInfo->bRegRT2RTAggregation)
1760 {
1761 pHTInfo->bCurrentRT2RTAggregation = pNetwork->bssht.bdRT2RTAggregation;
1762 pHTInfo->bCurrentRT2RTLongSlotTime = pNetwork->bssht.bdRT2RTLongSlotTime;
1763 pHTInfo->RT2RT_HT_Mode = pNetwork->bssht.RT2RT_HT_Mode;
1764 }
1765 else
1766 {
1767 pHTInfo->bCurrentRT2RTAggregation = false;
1768 pHTInfo->bCurrentRT2RTLongSlotTime = false;
1769 pHTInfo->RT2RT_HT_Mode = (RT_HT_CAPBILITY)0;
1770 }
1771
1772 // Determine the IOT Peer Vendor.
1773 HTIOTPeerDetermine(ieee);
1774
1775 // Decide IOT Action
1776 // Must be called after the parameter of pHTInfo->bCurrentRT2RTAggregation is decided
1777 pHTInfo->IOTAction = 0;
1778 bIOTAction = HTIOTActIsDisableMCS14(ieee, pNetwork->bssid);
1779 if(bIOTAction)
1780 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_MCS14;
1781
1782 bIOTAction = HTIOTActIsDisableMCS15(ieee);
1783 if(bIOTAction)
1784 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_MCS15;
1785
1786 bIOTAction = HTIOTActIsDisableMCSTwoSpatialStream(ieee);
1787 if(bIOTAction)
1788 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_ALL_2SS;
1789
1790
1791 bIOTAction = HTIOTActIsDisableEDCATurbo(ieee, pNetwork->bssid);
1792 if(bIOTAction)
1793 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_EDCA_TURBO;
1794
1795 bIOTAction = HTIOTActIsMgntUseCCK6M(pNetwork);
1796 if(bIOTAction)
1797 pHTInfo->IOTAction |= HT_IOT_ACT_MGNT_USE_CCK_6M;
1798
1799 bIOTAction = HTIOTActIsCCDFsync(pNetwork->bssid);
1800 if(bIOTAction)
1801 pHTInfo->IOTAction |= HT_IOT_ACT_CDD_FSYNC;
1802
1803 bIOTAction = HTIOTActIsForcedCTS2Self(pNetwork);
1804 if(bIOTAction)
1805 pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF;
1806
1807 //bIOTAction = HTIOTActIsForcedRTSCTS(ieee, pNetwork);
1808 //if(bIOTAction)
1809 // pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_RTS;
1810
1811 #if defined(RTL8192SU)
1812 bIOTAction = HTIOCActRejcectADDBARequest(pNetwork);
1813 if(bIOTAction)
1814 pHTInfo->IOTAction |= HT_IOT_ACT_REJECT_ADDBA_REQ;
1815 #endif
1816
1817 bIOTAction = HTIOCActAllowPeerAggOnePacket(ieee, pNetwork);
1818 if(bIOTAction)
1819 pHTInfo->IOTAction |= HT_IOT_ACT_ALLOW_PEER_AGG_ONE_PKT;
1820
1821 bIOTAction = HTIOTActIsEDCABiasRx(ieee, pNetwork);
1822 if(bIOTAction)
1823 pHTInfo->IOTAction |= HT_IOT_ACT_EDCA_BIAS_ON_RX;
1824
1825 #if defined(RTL8192SU)
1826 bIOTAction = HTIOTActDisableShortGI(ieee, pNetwork);
1827 if(bIOTAction)
1828 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_SHORT_GI;
1829
1830 bIOTAction = HTIOTActDisableHighPower(ieee, pNetwork);
1831 if(bIOTAction)
1832 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_HIGH_POWER;
1833 #endif
1834
1835 bIOTAction = HTIOTActIsForcedAMSDU8K(ieee, pNetwork);
1836 if(bIOTAction)
1837 pHTInfo->IOTAction |= HT_IOT_ACT_TX_USE_AMSDU_8K;
1838
1839 #if defined(RTL8192SU)
1840 bIOTAction = HTIOTActIsTxNoAggregation(ieee, pNetwork);
1841 if(bIOTAction)
1842 pHTInfo->IOTAction |= HT_IOT_ACT_TX_NO_AGGREGATION;
1843
1844 bIOTAction = HTIOTActIsDisableTx40MHz(ieee, pNetwork);
1845 if(bIOTAction)
1846 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_TX_40_MHZ;
1847
1848 bIOTAction = HTIOTActIsDisableTx2SS(ieee, pNetwork);
1849 if(bIOTAction)
1850 pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_TX_2SS;
1851 #endif
1852 //must after HT_IOT_ACT_TX_NO_AGGREGATION
1853 bIOTAction = HTIOTActIsForcedRTSCTS(ieee, pNetwork);
1854 if(bIOTAction)
1855 pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_RTS;
1856
1857 printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!IOTAction = %8.8x\n", pHTInfo->IOTAction);
1858 }
1859 else
1860 {
1861 pHTInfo->bCurrentHTSupport = false;
1862 pHTInfo->bCurrentRT2RTAggregation = false;
1863 pHTInfo->bCurrentRT2RTLongSlotTime = false;
1864 pHTInfo->RT2RT_HT_Mode = (RT_HT_CAPBILITY)0;
1865
1866 pHTInfo->IOTAction = 0;
1867 pHTInfo->IOTRaFunc = 0;
1868 }
1869
1870 }
1871
1872 void HTUpdateSelfAndPeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork)
1873 {
1874 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1875 // PHT_CAPABILITY_ELE pPeerHTCap = (PHT_CAPABILITY_ELE)pNetwork->bssht.bdHTCapBuf;
1876 PHT_INFORMATION_ELE pPeerHTInfo = (PHT_INFORMATION_ELE)pNetwork->bssht.bdHTInfoBuf;
1877
1878 if(pHTInfo->bCurrentHTSupport)
1879 {
1880 //
1881 // Config current operation mode.
1882 //
1883 if(pNetwork->bssht.bdHTInfoLen != 0)
1884 pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;
1885
1886 //
1887 // <TODO: Config according to OBSS non-HT STA present!!>
1888 //
1889 }
1890 }
1891
1892 void HTUseDefaultSetting(struct ieee80211_device* ieee)
1893 {
1894 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1895 // u8 regBwOpMode;
1896
1897 if(pHTInfo->bEnableHT)
1898 {
1899 pHTInfo->bCurrentHTSupport = true;
1900
1901 pHTInfo->bCurSuppCCK = pHTInfo->bRegSuppCCK;
1902
1903 pHTInfo->bCurBW40MHz = pHTInfo->bRegBW40MHz;
1904
1905 pHTInfo->bCurShortGI20MHz= pHTInfo->bRegShortGI20MHz;
1906
1907 pHTInfo->bCurShortGI40MHz= pHTInfo->bRegShortGI40MHz;
1908
1909 pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support;
1910
1911 pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
1912
1913 pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable;
1914
1915 pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
1916
1917 pHTInfo->CurrentMPDUDensity = pHTInfo->CurrentMPDUDensity;
1918
1919 // Set BWOpMode register
1920
1921 //update RATR index0
1922 HTFilterMCSRate(ieee, ieee->Regdot11HTOperationalRateSet, ieee->dot11HTOperationalRateSet);
1923 //function below is not implemented at all. WB
1924 #ifdef TODO
1925 Adapter->HalFunc.InitHalRATRTableHandler( Adapter, &pMgntInfo->dot11OperationalRateSet, pMgntInfo->dot11HTOperationalRateSet);
1926 #endif
1927 ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee, ieee->dot11HTOperationalRateSet, MCS_FILTER_ALL);
1928 ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate;
1929
1930 }
1931 else
1932 {
1933 pHTInfo->bCurrentHTSupport = false;
1934 }
1935 return;
1936 }
1937 /********************************************************************************************************************
1938 *function: check whether HT control field exists
1939 * input: struct ieee80211_device *ieee
1940 * u8* pFrame //coming skb->data
1941 * output: none
1942 * return: return true if HT control field exists(false otherwise)
1943 * notice:
1944 ********************************************************************************************************************/
1945 u8 HTCCheck(struct ieee80211_device* ieee, u8* pFrame)
1946 {
1947 if(ieee->pHTInfo->bCurrentHTSupport)
1948 {
1949 if( (IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1)
1950 {
1951 IEEE80211_DEBUG(IEEE80211_DL_HT, "HT CONTROL FILED EXIST!!\n");
1952 return true;
1953 }
1954 }
1955 return false;
1956 }
1957
1958 //
1959 // This function set bandwidth mode in protocol layer.
1960 //
1961 void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset)
1962 {
1963 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1964 // u32 flags = 0;
1965
1966 if(pHTInfo->bRegBW40MHz == false)
1967 return;
1968
1969
1970
1971 // To reduce dummy operation
1972 // if((pHTInfo->bCurBW40MHz==false && Bandwidth==HT_CHANNEL_WIDTH_20) ||
1973 // (pHTInfo->bCurBW40MHz==true && Bandwidth==HT_CHANNEL_WIDTH_20_40 && Offset==pHTInfo->CurSTAExtChnlOffset))
1974 // return;
1975
1976 // spin_lock_irqsave(&(ieee->bw_spinlock), flags);
1977 if(pHTInfo->bSwBwInProgress) {
1978 // spin_unlock_irqrestore(&(ieee->bw_spinlock), flags);
1979 return;
1980 }
1981 //if in half N mode, set to 20M bandwidth please 09.08.2008 WB.
1982 if(Bandwidth==HT_CHANNEL_WIDTH_20_40 && (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)))
1983 {
1984 // Handle Illegal extention channel offset!!
1985 if(ieee->current_network.channel<2 && Offset==HT_EXTCHNL_OFFSET_LOWER)
1986 Offset = HT_EXTCHNL_OFFSET_NO_EXT;
1987 if(Offset==HT_EXTCHNL_OFFSET_UPPER || Offset==HT_EXTCHNL_OFFSET_LOWER) {
1988 pHTInfo->bCurBW40MHz = true;
1989 pHTInfo->CurSTAExtChnlOffset = Offset;
1990 } else {
1991 pHTInfo->bCurBW40MHz = false;
1992 pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT;
1993 }
1994 } else {
1995 pHTInfo->bCurBW40MHz = false;
1996 pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT;
1997 }
1998
1999 pHTInfo->bSwBwInProgress = true;
2000
2001 // TODO: 2007.7.13 by Emily Wait 2000ms in order to garantee that switching
2002 // bandwidth is executed after scan is finished. It is a temporal solution
2003 // because software should ganrantee the last operation of switching bandwidth
2004 // is executed properlly.
2005 HTSetConnectBwModeCallback(ieee);
2006
2007 // spin_unlock_irqrestore(&(ieee->bw_spinlock), flags);
2008 }
2009
2010 void HTSetConnectBwModeCallback(struct ieee80211_device* ieee)
2011 {
2012 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
2013
2014 IEEE80211_DEBUG(IEEE80211_DL_HT, "======>%s()\n", __FUNCTION__);
2015 if(pHTInfo->bCurBW40MHz)
2016 {
2017 if(pHTInfo->CurSTAExtChnlOffset==HT_EXTCHNL_OFFSET_UPPER)
2018 ieee->set_chan(ieee->dev, ieee->current_network.channel+2);
2019 else if(pHTInfo->CurSTAExtChnlOffset==HT_EXTCHNL_OFFSET_LOWER)
2020 ieee->set_chan(ieee->dev, ieee->current_network.channel-2);
2021 else
2022 ieee->set_chan(ieee->dev, ieee->current_network.channel);
2023
2024 ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20_40, pHTInfo->CurSTAExtChnlOffset);
2025 } else {
2026 ieee->set_chan(ieee->dev, ieee->current_network.channel);
2027 ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
2028 }
2029
2030 pHTInfo->bSwBwInProgress = false;
2031 }
2032
2033 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
2034 EXPORT_SYMBOL_NOVERS(HTUpdateSelfAndPeerSetting);
2035 #else
2036 EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting);
2037 #endif
2038
|
This page was automatically generated by the
LXR engine.
|