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
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};
7 u8 MCS_FILTER_1SS
[16] = {0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
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
32 static const u8 UNKNOWN_BORADCOM
[3] = {0x00, 0x14, 0xbf};
33 static const u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM
[3] = {0x00, 0x1a, 0x70};
34 static const u8 LINKSYSWRT350_LINKSYSWRT150_BROADCOM
[3] = {0x00, 0x1d, 0x7e};
35 //static u8 NETGEAR834Bv2_BROADCOM[3] = {0x00, 0x1b, 0x2f};
36 static const u8 BELKINF5D8233V1_RALINK
[3] = {0x00, 0x17, 0x3f};
37 static const u8 BELKINF5D82334V3_RALINK
[3] = {0x00, 0x1c, 0xdf};
38 static const u8 PCI_RALINK
[3] = {0x00, 0x90, 0xcc};
39 static const u8 EDIMAX_RALINK
[3] = {0x00, 0x0e, 0x2e};
40 static const u8 AIRLINK_RALINK
[3] = {0x00, 0x18, 0x02};
41 static const u8 DLINK_ATHEROS
[3] = {0x00, 0x1c, 0xf0};
42 static const u8 CISCO_BROADCOM
[3] = {0x00, 0x17, 0x94};
43 static const 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. Should 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
53 * notice: These value need be modified if any changes.
54 * *****************************************************************************************************************/
55 void HTUpdateDefaultSetting(struct ieee80211_device
* ieee
)
57 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
60 pHTInfo
->bRegShortGI20MHz
= 1;
61 pHTInfo
->bRegShortGI40MHz
= 1;
63 // 40MHz channel support
64 pHTInfo
->bRegBW40MHz
= 1;
66 // CCK rate support in 40MHz channel
67 if(pHTInfo
->bRegBW40MHz
)
68 pHTInfo
->bRegSuppCCK
= 1;
70 pHTInfo
->bRegSuppCCK
= true;
73 pHTInfo
->nAMSDU_MaxSize
= 7935UL;
74 pHTInfo
->bAMSDU_Support
= 0;
77 pHTInfo
->bAMPDUEnable
= 1;
78 pHTInfo
->AMPDU_Factor
= 2; //// 0: 2n13(8K), 1:2n14(16K), 2:2n15(32K), 3:2n16(64k)
79 pHTInfo
->MPDU_Density
= 0;// 0: No restriction, 1: 1/8usec, 2: 1/4usec, 3: 1/2usec, 4: 1usec, 5: 2usec, 6: 4usec, 7:8usec
82 pHTInfo
->SelfMimoPs
= 3;// 0: Static Mimo Ps, 1: Dynamic Mimo Ps, 3: No Limitation, 2: Reserved(Set to 3 automatically.)
83 if(pHTInfo
->SelfMimoPs
== 2)
84 pHTInfo
->SelfMimoPs
= 3;
85 // 8190 only. Assign rate operation mode to firmware
86 ieee
->bTxDisableRateFallBack
= 0;
87 ieee
->bTxUseDriverAssingedRate
= 0;
90 // 8190 only. Assign duration operation mode to firmware
91 pMgntInfo
->bTxEnableFwCalcDur
= (BOOLEAN
)pNdisCommon
->bRegTxEnableFwCalcDur
;
93 // 8190 only, Realtek proprietary aggregation mode
94 // Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others
95 pHTInfo
->bRegRT2RTAggregation
= 1;//0: Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others
97 // For Rx Reorder Control
98 pHTInfo
->bRegRxReorderEnable
= 1;
99 pHTInfo
->RxReorderWinSize
= 64;
100 pHTInfo
->RxReorderPendingTime
= 30;
102 #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
103 pHTInfo
->UsbTxAggrNum
= 4;
105 #ifdef USB_RX_AGGREGATION_SUPPORT
106 pHTInfo
->UsbRxFwAggrEn
= 1;
107 pHTInfo
->UsbRxFwAggrPageNum
= 24;
108 pHTInfo
->UsbRxFwAggrPacketNum
= 8;
109 pHTInfo
->UsbRxFwAggrTimeout
= 16; ////usb rx FW aggregation timeout threshold.It's in units of 64us
114 /********************************************************************************************************************
115 *function: This function print out each field on HT capability IE mainly from (Beacon/ProbeRsp/AssocReq)
116 * input: u8* CapIE //Capability IE to be printed out
117 * u8* TitleString //mainly print out caller function
120 * notice: Driver should not print out this message by default.
121 * *****************************************************************************************************************/
122 void HTDebugHTCapability(u8
* CapIE
, u8
* TitleString
)
125 static u8 EWC11NHTCap
[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily
126 PHT_CAPABILITY_ELE pCapELE
;
128 if(!memcmp(CapIE
, EWC11NHTCap
, sizeof(EWC11NHTCap
)))
131 IEEE80211_DEBUG(IEEE80211_DL_HT
, "EWC IE in %s()\n", __FUNCTION__
);
132 pCapELE
= (PHT_CAPABILITY_ELE
)(&CapIE
[4]);
134 pCapELE
= (PHT_CAPABILITY_ELE
)(&CapIE
[0]);
136 IEEE80211_DEBUG(IEEE80211_DL_HT
, "<Log HT Capability>. Called by %s\n", TitleString
);
138 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tSupported Channel Width = %s\n", (pCapELE
->ChlWidth
)?"20MHz": "20/40MHz");
139 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tSupport Short GI for 20M = %s\n", (pCapELE
->ShortGI20Mhz
)?"YES": "NO");
140 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tSupport Short GI for 40M = %s\n", (pCapELE
->ShortGI40Mhz
)?"YES": "NO");
141 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tSupport TX STBC = %s\n", (pCapELE
->TxSTBC
)?"YES": "NO");
142 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tMax AMSDU Size = %s\n", (pCapELE
->MaxAMSDUSize
)?"3839": "7935");
143 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tSupport CCK in 20/40 mode = %s\n", (pCapELE
->DssCCk
)?"YES": "NO");
144 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tMax AMPDU Factor = %d\n", pCapELE
->MaxRxAMPDUFactor
);
145 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tMPDU Density = %d\n", pCapELE
->MPDUDensity
);
146 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tMCS Rate Set = [%x][%x][%x][%x][%x]\n", pCapELE
->MCS
[0],\
147 pCapELE
->MCS
[1], pCapELE
->MCS
[2], pCapELE
->MCS
[3], pCapELE
->MCS
[4]);
149 /********************************************************************************************************************
150 *function: This function print out each field on HT Information IE mainly from (Beacon/ProbeRsp)
151 * input: u8* InfoIE //Capability IE to be printed out
152 * u8* TitleString //mainly print out caller function
155 * notice: Driver should not print out this message by default.
156 * *****************************************************************************************************************/
157 void HTDebugHTInfo(u8
* InfoIE
, u8
* TitleString
)
160 static u8 EWC11NHTInfo
[] = {0x00, 0x90, 0x4c, 0x34}; // For 11n EWC definition, 2007.07.17, by Emily
161 PHT_INFORMATION_ELE pHTInfoEle
;
163 if(!memcmp(InfoIE
, EWC11NHTInfo
, sizeof(EWC11NHTInfo
)))
166 IEEE80211_DEBUG(IEEE80211_DL_HT
, "EWC IE in %s()\n", __FUNCTION__
);
167 pHTInfoEle
= (PHT_INFORMATION_ELE
)(&InfoIE
[4]);
169 pHTInfoEle
= (PHT_INFORMATION_ELE
)(&InfoIE
[0]);
172 IEEE80211_DEBUG(IEEE80211_DL_HT
, "<Log HT Information Element>. Called by %s\n", TitleString
);
174 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tPrimary channel = %d\n", pHTInfoEle
->ControlChl
);
175 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tSenondary channel =");
176 switch(pHTInfoEle
->ExtChlOffset
)
179 IEEE80211_DEBUG(IEEE80211_DL_HT
, "Not Present\n");
182 IEEE80211_DEBUG(IEEE80211_DL_HT
, "Upper channel\n");
185 IEEE80211_DEBUG(IEEE80211_DL_HT
, "Reserved. Eooro!!!\n");
188 IEEE80211_DEBUG(IEEE80211_DL_HT
, "Lower Channel\n");
191 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tRecommended channel width = %s\n", (pHTInfoEle
->RecommemdedTxWidth
)?"20Mhz": "40Mhz");
193 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tOperation mode for protection = ");
194 switch(pHTInfoEle
->OptMode
)
197 IEEE80211_DEBUG(IEEE80211_DL_HT
, "No Protection\n");
200 IEEE80211_DEBUG(IEEE80211_DL_HT
, "HT non-member protection mode\n");
203 IEEE80211_DEBUG(IEEE80211_DL_HT
, "Suggest to open protection\n");
206 IEEE80211_DEBUG(IEEE80211_DL_HT
, "HT mixed mode\n");
210 IEEE80211_DEBUG(IEEE80211_DL_HT
, "\tBasic MCS Rate Set = [%x][%x][%x][%x][%x]\n", pHTInfoEle
->BasicMSC
[0],\
211 pHTInfoEle
->BasicMSC
[1], pHTInfoEle
->BasicMSC
[2], pHTInfoEle
->BasicMSC
[3], pHTInfoEle
->BasicMSC
[4]);
215 * Return: true if station in half n mode and AP supports 40 bw
217 bool IsHTHalfNmode40Bandwidth(struct ieee80211_device
* ieee
)
219 bool retValue
= false;
220 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
222 if(pHTInfo
->bCurrentHTSupport
== false ) // wireless is n mode
224 else if(pHTInfo
->bRegBW40MHz
== false) // station supports 40 bw
226 else if (!ieee
->GetHalfNmodeSupportByAPsHandler(ieee
)) // station in half n mode
228 else if(((PHT_CAPABILITY_ELE
)(pHTInfo
->PeerHTCapBuf
))->ChlWidth
) // ap support 40 bw
236 bool IsHTHalfNmodeSGI(struct ieee80211_device
* ieee
, bool is40MHz
)
238 bool retValue
= false;
239 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
241 if(pHTInfo
->bCurrentHTSupport
== false ) // wireless is n mode
243 else if (!ieee
->GetHalfNmodeSupportByAPsHandler(ieee
)) // station in half n mode
245 else if(is40MHz
) // ap support 40 bw
247 if(((PHT_CAPABILITY_ELE
)(pHTInfo
->PeerHTCapBuf
))->ShortGI40Mhz
) // ap support 40 bw short GI
254 if(((PHT_CAPABILITY_ELE
)(pHTInfo
->PeerHTCapBuf
))->ShortGI20Mhz
) // ap support 40 bw short GI
263 u16
HTHalfMcsToDataRate(struct ieee80211_device
* ieee
, u8 nMcsRate
)
269 is40MHz
= (IsHTHalfNmode40Bandwidth(ieee
))?1:0;
270 isShortGI
= (IsHTHalfNmodeSGI(ieee
, is40MHz
))? 1:0;
272 return MCS_DATA_RATE
[is40MHz
][isShortGI
][(nMcsRate
&0x7f)];
276 u16
HTMcsToDataRate( struct ieee80211_device
* ieee
, u8 nMcsRate
)
278 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
280 u8 is40MHz
= (pHTInfo
->bCurBW40MHz
)?1:0;
281 u8 isShortGI
= (pHTInfo
->bCurBW40MHz
)?
282 ((pHTInfo
->bCurShortGI40MHz
)?1:0):
283 ((pHTInfo
->bCurShortGI20MHz
)?1:0);
284 return MCS_DATA_RATE
[is40MHz
][isShortGI
][(nMcsRate
&0x7f)];
287 /********************************************************************************************************************
288 *function: This function returns current datarate.
289 * input: struct ieee80211_device* ieee
293 * notice: quite unsure about how to use this function //wb
294 * *****************************************************************************************************************/
295 u16
TxCountToDataRate( struct ieee80211_device
* ieee
, u8 nDataRate
)
297 //PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
298 u16 CCKOFDMRate
[12] = {0x02 , 0x04 , 0x0b , 0x16 , 0x0c , 0x12 , 0x18 , 0x24 , 0x30 , 0x48 , 0x60 , 0x6c};
304 return CCKOFDMRate
[nDataRate
];
308 if (nDataRate
>= 0x10 && nDataRate
<= 0x1f)//if(nDataRate > 11 && nDataRate < 28 )
313 // nDataRate = nDataRate - 12;
315 else if(nDataRate
>=0x20 && nDataRate
<= 0x2f ) //(27, 44)
320 //nDataRate = nDataRate - 28;
322 else if(nDataRate
>= 0x30 && nDataRate
<= 0x3f ) //(43, 60)
327 //nDataRate = nDataRate - 44;
329 else if(nDataRate
>= 0x40 && nDataRate
<= 0x4f ) //(59, 76)
334 //nDataRate = nDataRate - 60;
336 return MCS_DATA_RATE
[is40MHz
][isShortGI
][nDataRate
&0xf];
342 bool IsHTHalfNmodeAPs(struct ieee80211_device
* ieee
)
344 bool retValue
= false;
345 struct ieee80211_network
* net
= &ieee
->current_network
;
347 if(ieee
->bHalfNMode
== false)
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
))
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
))
364 else if(net
->bssht
.bdRT2RTAggregation
)
372 /********************************************************************************************************************
373 *function: This function returns peer IOT.
374 * input: struct ieee80211_device* ieee
378 * *****************************************************************************************************************/
379 void HTIOTPeerDetermine(struct ieee80211_device
* ieee
)
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
;
388 else if((memcmp(net
->bssid
, UNKNOWN_BORADCOM
, 3)==0) ||
389 (memcmp(net
->bssid
, LINKSYSWRT330_LINKSYSWRT300_BROADCOM
, 3)==0)||
390 (memcmp(net
->bssid
, LINKSYSWRT350_LINKSYSWRT150_BROADCOM
, 3)==0)){//||
391 //(memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) ){
392 pHTInfo
->IOTPeer
= HT_IOT_PEER_BROADCOM
;
394 else if((memcmp(net
->bssid
, BELKINF5D8233V1_RALINK
, 3)==0) ||
395 (memcmp(net
->bssid
, BELKINF5D82334V3_RALINK
, 3)==0) ||
396 (memcmp(net
->bssid
, PCI_RALINK
, 3)==0) ||
397 (memcmp(net
->bssid
, EDIMAX_RALINK
, 3)==0) ||
398 (memcmp(net
->bssid
, AIRLINK_RALINK
, 3)==0) ||
399 net
->ralink_cap_exist
)
400 pHTInfo
->IOTPeer
= HT_IOT_PEER_RALINK
;
401 else if((net
->atheros_cap_exist
)|| (memcmp(net
->bssid
, DLINK_ATHEROS
, 3) == 0))
402 pHTInfo
->IOTPeer
= HT_IOT_PEER_ATHEROS
;
403 else if(memcmp(net
->bssid
, CISCO_BROADCOM
, 3)==0)
404 pHTInfo
->IOTPeer
= HT_IOT_PEER_CISCO
;
405 else if ((memcmp(net
->bssid
, LINKSYS_MARVELL_4400N
, 3) == 0) ||
406 net
->marvell_cap_exist
){
407 pHTInfo
->IOTPeer
= HT_IOT_PEER_MARVELL
;
410 pHTInfo
->IOTPeer
= HT_IOT_PEER_UNKNOWN
;
412 IEEE80211_DEBUG(IEEE80211_DL_IOT
, "Joseph debug!! IOTPEER: %x\n", pHTInfo
->IOTPeer
);
414 /********************************************************************************************************************
415 *function: Check whether driver should declare received rate up to MCS13 only since some chipset is not good
416 * at receiving MCS14~15 frame from some AP.
417 * input: struct ieee80211_device* ieee
420 * return: return 1 if driver should declare MCS13 only(otherwise return 0)
421 * *****************************************************************************************************************/
422 u8
HTIOTActIsDisableMCS14(struct ieee80211_device
* ieee
, u8
* PeerMacAddr
)
426 // Apply for 819u only
427 #if (HAL_CODE_BASE==RTL8192 && DEV_BUS_TYPE==USB_INTERFACE)
428 if((memcmp(PeerMacAddr
, UNKNOWN_BORADCOM
, 3)==0) ||
429 (memcmp(PeerMacAddr
, LINKSYSWRT330_LINKSYSWRT300_BROADCOM
, 3)==0)
436 if(pHTInfo
->bCurrentRT2RTAggregation
)
438 // The parameter of pHTInfo->bCurrentRT2RTAggregation must be decided previously
446 u8
HTIOTActIsForcedCTS2Self(struct ieee80211_device
*ieee
, struct ieee80211_network
*network
)
449 //if(network->marvell_cap_exist)
450 if(ieee
->pHTInfo
->IOTPeer
== HT_IOT_PEER_MARVELL
)
460 * Function: HTIOTActIsDisableMCS15
462 * Overview: Check whether driver should declare capability of receiving MCS15
468 * Return: true if driver should disable MCS15
471 bool HTIOTActIsDisableMCS15(struct ieee80211_device
* ieee
)
473 bool retValue
= false;
476 // Apply for 819u only
477 #if (HAL_CODE_BASE==RTL8192)
479 #if (DEV_BUS_TYPE == USB_INTERFACE)
480 // Alway disable MCS15 by Jerry Chang's request.by Emily, 2008.04.15
482 #elif (DEV_BUS_TYPE == PCI_INTERFACE)
483 // Enable MCS15 if the peer is Cisco AP. by Emily, 2008.05.12
484 // if(pBssDesc->bCiscoCapExist)
491 // Jerry Chang suggest that 8190 1x2 does not need to disable MCS15
497 * Function: HTIOTActIsDisableMCSTwoSpatialStream
499 * Overview: Check whether driver should declare capability of receiving All 2 ss packets
505 * Return: true if driver should disable all two spatial stream packet
508 bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device
* ieee
, u8
*PeerMacAddr
)
510 bool retValue
= false;
513 // Apply for 819u only
514 //#if (HAL_CODE_BASE==RTL8192)
516 //This rule only apply to Belkin(Ralink) AP
517 if(IS_UNDER_11N_AES_MODE(Adapter
))
519 if((PlatformCompareMemory(PeerMacAddr
, BELKINF5D8233V1_RALINK
, 3)==0) ||
520 (PlatformCompareMemory(PeerMacAddr
, PCI_RALINK
, 3)==0) ||
521 (PlatformCompareMemory(PeerMacAddr
, EDIMAX_RALINK
, 3)==0))
523 //Set True to disable this function. Disable by default, Emily, 2008.04.23
533 /********************************************************************************************************************
534 *function: Check whether driver should disable EDCA turbo mode
535 * input: struct ieee80211_device* ieee
538 * return: return 1 if driver should disable EDCA turbo mode(otherwise return 0)
539 * *****************************************************************************************************************/
540 u8
HTIOTActIsDisableEDCATurbo(struct ieee80211_device
* ieee
, u8
* PeerMacAddr
)
542 u8 retValue
= false; // default enable EDCA Turbo mode.
543 // Set specific EDCA parameter for different AP in DM handler.
547 if((memcmp(PeerMacAddr
, UNKNOWN_BORADCOM
, 3)==0)||
548 (memcmp(PeerMacAddr
, LINKSYSWRT330_LINKSYSWRT300_BROADCOM
, 3)==0)||
549 (memcmp(PeerMacAddr
, LINKSYSWRT350_LINKSYSWRT150_BROADCOM
, 3)==0)||
550 (memcmp(PeerMacAddr
, NETGEAR834Bv2_BROADCOM
, 3)==0))
553 retValue
= 1; //Linksys disable EDCA turbo mode
560 /********************************************************************************************************************
561 *function: Check whether we need to use OFDM to sned MGNT frame for broadcom AP
562 * input: struct ieee80211_network *network //current network we live
564 * return: return 1 if true
565 * *****************************************************************************************************************/
566 u8
HTIOTActIsMgntUseCCK6M(struct ieee80211_network
*network
)
570 // 2008/01/25 MH Judeg if we need to use OFDM to sned MGNT frame for broadcom AP.
571 // 2008/01/28 MH We must prevent that we select null bssid to link.
573 if(network
->broadcom_cap_exist
)
581 u8
HTIOTActIsCCDFsync(u8
* PeerMacAddr
)
584 if( (memcmp(PeerMacAddr
, UNKNOWN_BORADCOM
, 3)==0) ||
585 (memcmp(PeerMacAddr
, LINKSYSWRT330_LINKSYSWRT300_BROADCOM
, 3)==0) ||
586 (memcmp(PeerMacAddr
, LINKSYSWRT350_LINKSYSWRT150_BROADCOM
, 3) ==0))
595 // Send null data for to tell AP that we are awake.
598 HTIOTActIsNullDataPowerSaving(struct ieee80211_device
* ieee
,struct ieee80211_network
*network
)
600 bool retValue
= false;
602 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
604 if(pHTInfo
->IOTPeer
== HT_IOT_PEER_BROADCOM
) // ||(pBssDesc->Vender == HT_IOT_PEER_ATHEROS && pBssDesc->SubTypeOfVender == HT_IOT_PEER_ATHEROS_DIR635))
611 void HTResetIOTSetting(
612 PRT_HIGH_THROUGHPUT pHTInfo
615 pHTInfo
->IOTAction
= 0;
616 pHTInfo
->IOTPeer
= HT_IOT_PEER_UNKNOWN
;
620 /********************************************************************************************************************
621 *function: Construct Capablility Element in Beacon... if HTEnable is turned on
622 * input: struct ieee80211_device* ieee
623 * u8* posHTCap //pointer to store Capability Ele
624 * u8* len //store length of CE
625 * u8 IsEncrypt //whether encrypt, needed further
628 * notice: posHTCap can't be null and should be initialized before.
629 * *****************************************************************************************************************/
630 void HTConstructCapabilityElement(struct ieee80211_device
* ieee
, u8
* posHTCap
, u8
* len
, u8 IsEncrypt
)
632 PRT_HIGH_THROUGHPUT pHT
= ieee
->pHTInfo
;
633 PHT_CAPABILITY_ELE pCapELE
= NULL
;
634 //u8 bIsDeclareMCS13;
636 if ((posHTCap
== NULL
) || (pHT
== NULL
))
638 IEEE80211_DEBUG(IEEE80211_DL_ERR
, "posHTCap or pHTInfo can't be null in HTConstructCapabilityElement()\n");
641 memset(posHTCap
, 0, *len
);
642 if(pHT
->ePeerHTSpecVer
== HT_SPEC_VER_EWC
)
644 u8 EWC11NHTCap
[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily
645 memcpy(posHTCap
, EWC11NHTCap
, sizeof(EWC11NHTCap
));
646 pCapELE
= (PHT_CAPABILITY_ELE
)&(posHTCap
[4]);
649 pCapELE
= (PHT_CAPABILITY_ELE
)posHTCap
;
654 pCapELE
->AdvCoding
= 0; // This feature is not supported now!!
655 if (ieee
->GetHalfNmodeSupportByAPsHandler(ieee
))
657 pCapELE
->ChlWidth
= 0;
661 pCapELE
->ChlWidth
= (pHT
->bRegBW40MHz
?1:0);
664 // pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0);
665 pCapELE
->MimoPwrSave
= pHT
->SelfMimoPs
;
666 pCapELE
->GreenField
= 0; // This feature is not supported now!!
667 pCapELE
->ShortGI20Mhz
= 1; // We can receive Short GI!!
668 pCapELE
->ShortGI40Mhz
= 1; // We can receive Short GI!!
669 //DbgPrint("TX HT cap/info ele BW=%d SG20=%d SG40=%d\n\r",
670 //pCapELE->ChlWidth, pCapELE->ShortGI20Mhz, pCapELE->ShortGI40Mhz);
673 pCapELE
->DelayBA
= 0; // Do not support now!!
674 pCapELE
->MaxAMSDUSize
= (MAX_RECEIVE_BUFFER_SIZE
>=7935)?1:0;
675 pCapELE
->DssCCk
= ((pHT
->bRegBW40MHz
)?(pHT
->bRegSuppCCK
?1:0):0);
676 pCapELE
->PSMP
= 0; // Do not support now!!
677 pCapELE
->LSigTxopProtect
= 0; // Do not support now!!
680 //MAC HT parameters info
681 // TODO: Nedd to take care of this part
682 IEEE80211_DEBUG(IEEE80211_DL_HT
, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n", pCapELE
->ChlWidth
, pCapELE
->MaxAMSDUSize
, pCapELE
->DssCCk
);
686 pCapELE
->MPDUDensity
= 7; // 8us
687 pCapELE
->MaxRxAMPDUFactor
= 2; // 2 is for 32 K and 3 is 64K
691 pCapELE
->MaxRxAMPDUFactor
= 3; // 2 is for 32 K and 3 is 64K
692 pCapELE
->MPDUDensity
= 0; // no density
696 memcpy(pCapELE
->MCS
, ieee
->Regdot11HTOperationalRateSet
, 16);
697 if(pHT
->IOTAction
& HT_IOT_ACT_DISABLE_MCS15
)
698 pCapELE
->MCS
[1] &= 0x7f;
700 if(pHT
->IOTAction
& HT_IOT_ACT_DISABLE_MCS14
)
701 pCapELE
->MCS
[1] &= 0xbf;
703 if(pHT
->IOTAction
& HT_IOT_ACT_DISABLE_ALL_2SS
)
704 pCapELE
->MCS
[1] &= 0x00;
707 // For RTL819X, if pairwisekey = wep/tkip, ap is ralink, we support only MCS0~7.
708 if (ieee
->GetHalfNmodeSupportByAPsHandler(ieee
))
711 for(i
= 1; i
< 16; i
++)
715 //Extended HT Capability Info
716 memset(&pCapELE
->ExtHTCapInfo
, 0, 2);
720 memset(pCapELE
->TxBFCap
, 0, 4);
722 //Antenna Selection Capabilities
724 //add 2 to give space for element ID and len when construct frames
725 if(pHT
->ePeerHTSpecVer
== HT_SPEC_VER_EWC
)
730 /********************************************************************************************************************
731 *function: Construct Information Element in Beacon... if HTEnable is turned on
732 * input: struct ieee80211_device* ieee
733 * u8* posHTCap //pointer to store Information Ele
734 * u8* len //store len of
735 * u8 IsEncrypt //whether encrypt, needed further
738 * notice: posHTCap can't be null and be initialized before. only AP and IBSS sta should do this
739 * *****************************************************************************************************************/
740 void HTConstructInfoElement(struct ieee80211_device
* ieee
, u8
* posHTInfo
, u8
* len
, u8 IsEncrypt
)
742 PRT_HIGH_THROUGHPUT pHT
= ieee
->pHTInfo
;
743 PHT_INFORMATION_ELE pHTInfoEle
= (PHT_INFORMATION_ELE
)posHTInfo
;
744 if ((posHTInfo
== NULL
) || (pHTInfoEle
== NULL
))
746 IEEE80211_DEBUG(IEEE80211_DL_ERR
, "posHTInfo or pHTInfoEle can't be null in HTConstructInfoElement()\n");
750 memset(posHTInfo
, 0, *len
);
751 if ( (ieee
->iw_mode
== IW_MODE_ADHOC
) || (ieee
->iw_mode
== IW_MODE_MASTER
)) //ap mode is not currently supported
753 pHTInfoEle
->ControlChl
= ieee
->current_network
.channel
;
754 pHTInfoEle
->ExtChlOffset
= ((pHT
->bRegBW40MHz
== false)?HT_EXTCHNL_OFFSET_NO_EXT
:
755 (ieee
->current_network
.channel
<=6)?
756 HT_EXTCHNL_OFFSET_UPPER
:HT_EXTCHNL_OFFSET_LOWER
);
757 pHTInfoEle
->RecommemdedTxWidth
= pHT
->bRegBW40MHz
;
758 pHTInfoEle
->RIFS
= 0;
759 pHTInfoEle
->PSMPAccessOnly
= 0;
760 pHTInfoEle
->SrvIntGranularity
= 0;
761 pHTInfoEle
->OptMode
= pHT
->CurrentOpMode
;
762 pHTInfoEle
->NonGFDevPresent
= 0;
763 pHTInfoEle
->DualBeacon
= 0;
764 pHTInfoEle
->SecondaryBeacon
= 0;
765 pHTInfoEle
->LSigTxopProtectFull
= 0;
766 pHTInfoEle
->PcoActive
= 0;
767 pHTInfoEle
->PcoPhase
= 0;
769 memset(pHTInfoEle
->BasicMSC
, 0, 16);
772 *len
= 22 + 2; //same above
777 //STA should not generate High Throughput Information Element
783 * According to experiment, Realtek AP to STA (based on rtl8190) may achieve best performance
784 * if both STA and AP set limitation of aggregation size to 32K, that is, set AMPDU density to 2
785 * (Ref: IEEE 11n specification). However, if Realtek STA associates to other AP, STA should set
786 * limitation of aggregation size to 8K, otherwise, performance of traffic stream from STA to AP
787 * will be much less than the traffic stream from AP to STA if both of the stream runs concurrently
791 * Element ID Length OUI Type1 Reserved
792 * 1 byte 1 byte 3 bytes 1 byte 1 byte
794 * OUI = 0x00, 0xe0, 0x4c,
800 /********************************************************************************************************************
801 *function: Construct Information Element in Beacon... in RT2RT condition
802 * input: struct ieee80211_device* ieee
803 * u8* posRT2RTAgg //pointer to store Information Ele
804 * u8* len //store len
808 * *****************************************************************************************************************/
809 void HTConstructRT2RTAggElement(struct ieee80211_device
* ieee
, u8
* posRT2RTAgg
, u8
* len
)
811 if (posRT2RTAgg
== NULL
) {
812 IEEE80211_DEBUG(IEEE80211_DL_ERR
, "posRT2RTAgg can't be null in HTConstructRT2RTAggElement()\n");
815 memset(posRT2RTAgg
, 0, *len
);
816 *posRT2RTAgg
++ = 0x00;
817 *posRT2RTAgg
++ = 0xe0;
818 *posRT2RTAgg
++ = 0x4c;
819 *posRT2RTAgg
++ = 0x02;
820 *posRT2RTAgg
++ = 0x01;
821 *posRT2RTAgg
= 0x10;//*posRT2RTAgg = 0x02;
823 if(ieee
->bSupportRemoteWakeUp
) {
824 *posRT2RTAgg
|= 0x08;//RT_HT_CAP_USE_WOW;
830 #if(HAL_CODE_BASE == RTL8192 && DEV_BUS_TYPE == USB_INTERFACE)
832 //Emily. If it is required to Ask Realtek AP to send AMPDU during AES mode, enable this
834 if(IS_UNDER_11N_AES_MODE(Adapter))
836 posRT2RTAgg->Octet[5] |=RT_HT_CAP_USE_AMPDU;
839 posRT2RTAgg->Octet[5] &= 0xfb;
847 posRT2RTAgg
->Length
= 6;
856 /********************************************************************************************************************
857 *function: Pick the right Rate Adaptive table to use
858 * input: struct ieee80211_device* ieee
859 * u8* pOperateMCS //A pointer to MCS rate bitmap
860 * return: always we return true
862 * *****************************************************************************************************************/
863 u8
HT_PickMCSRate(struct ieee80211_device
* ieee
, u8
* pOperateMCS
)
866 if (pOperateMCS
== NULL
)
868 IEEE80211_DEBUG(IEEE80211_DL_ERR
, "pOperateMCS can't be null in HT_PickMCSRate()\n");
877 //legacy rate routine handled at selectedrate
885 case IEEE_N_24G
: //assume CCK rate ok
887 // Legacy part we only use 6, 5.5,2,1 for N_24G and 6 for N_5G.
888 // Legacy part shall be handled at SelectRateSet().
891 // TODO: may be different if we have different number of antenna
892 pOperateMCS
[0] &=RATE_ADPT_1SS_MASK
; //support MCS 0~7
893 pOperateMCS
[1] &=RATE_ADPT_2SS_MASK
;
894 pOperateMCS
[3] &=RATE_ADPT_MCS32_MASK
;
897 //should never reach here
909 * This function will get the highest speed rate in input MCS set.
911 * /param Adapter Pionter to Adapter entity
912 * pMCSRateSet Pointer to MCS rate bitmap
913 * pMCSFilter Pointer to MCS rate filter
915 * /return Highest MCS rate included in pMCSRateSet and filtered by pMCSFilter.
918 /********************************************************************************************************************
919 *function: This function will get the highest speed rate in input MCS set.
920 * input: struct ieee80211_device* ieee
921 * u8* pMCSRateSet //Pointer to MCS rate bitmap
922 * u8* pMCSFilter //Pointer to MCS rate filter
923 * return: Highest MCS rate included in pMCSRateSet and filtered by pMCSFilter
925 * *****************************************************************************************************************/
926 u8
HTGetHighestMCSRate(struct ieee80211_device
* ieee
, u8
* pMCSRateSet
, u8
* pMCSFilter
)
931 u8 availableMcsRate
[16];
932 if (pMCSRateSet
== NULL
|| pMCSFilter
== NULL
)
934 IEEE80211_DEBUG(IEEE80211_DL_ERR
, "pMCSRateSet or pMCSFilter can't be null in HTGetHighestMCSRate()\n");
938 availableMcsRate
[i
] = pMCSRateSet
[i
] & pMCSFilter
[i
];
940 for(i
= 0; i
< 16; i
++)
942 if(availableMcsRate
[i
] != 0)
948 for(i
= 0; i
< 16; i
++)
950 if(availableMcsRate
[i
] != 0)
952 bitMap
= availableMcsRate
[i
];
953 for(j
= 0; j
< 8; j
++)
957 if(HTMcsToDataRate(ieee
, (8*i
+j
)) > HTMcsToDataRate(ieee
, mcsRate
))
964 return (mcsRate
|0x80);
971 **1.Filter our operation rate set with AP's rate set
972 **2.shall reference channel bandwidth, STBC, Antenna number
973 **3.generate rate adative table for firmware
976 ** \pHTSupportedCap: the connected STA's supported rate Capability element
978 u8
HTFilterMCSRate( struct ieee80211_device
* ieee
, u8
* pSupportMCS
, u8
* pOperateMCS
)
983 // filter out operational rate set not supported by AP, the lenth of it is 16
985 pOperateMCS
[i
] = ieee
->Regdot11HTOperationalRateSet
[i
]&pSupportMCS
[i
];
989 // TODO: adjust our operational rate set according to our channel bandwidth, STBC and Antenna number
991 // TODO: fill suggested rate adaptive rate index and give firmware info using Tx command packet
992 // we also shall suggested the first start rate set according to our singal strength
993 HT_PickMCSRate(ieee
, pOperateMCS
);
995 // For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7.
996 if (ieee
->GetHalfNmodeSupportByAPsHandler(ieee
))
1000 // For RTL819X, we support only MCS0~15.
1001 // And also, we do not know how to use MCS32 now.
1003 for(i
=2; i
<=15; i
++)
1008 void HTSetConnectBwMode(struct ieee80211_device
* ieee
, HT_CHANNEL_WIDTH Bandwidth
, HT_EXTCHNL_OFFSET Offset
);
1009 void HTOnAssocRsp(struct ieee80211_device
*ieee
)
1011 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
1012 PHT_CAPABILITY_ELE pPeerHTCap
= NULL
;
1013 PHT_INFORMATION_ELE pPeerHTInfo
= NULL
;
1014 u16 nMaxAMSDUSize
= 0;
1015 u8
* pMcsFilter
= NULL
;
1017 static u8 EWC11NHTCap
[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily
1018 static u8 EWC11NHTInfo
[] = {0x00, 0x90, 0x4c, 0x34}; // For 11n EWC definition, 2007.07.17, by Emily
1020 if( pHTInfo
->bCurrentHTSupport
== false )
1022 IEEE80211_DEBUG(IEEE80211_DL_ERR
, "<=== HTOnAssocRsp(): HT_DISABLE\n");
1025 IEEE80211_DEBUG(IEEE80211_DL_HT
, "===> HTOnAssocRsp_wq(): HT_ENABLE\n");
1026 // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, pHTInfo->PeerHTCapBuf, sizeof(HT_CAPABILITY_ELE));
1027 // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, pHTInfo->PeerHTInfoBuf, sizeof(HT_INFORMATION_ELE));
1029 // HTDebugHTCapability(pHTInfo->PeerHTCapBuf,"HTOnAssocRsp_wq");
1030 // HTDebugHTInfo(pHTInfo->PeerHTInfoBuf,"HTOnAssocRsp_wq");
1032 if(!memcmp(pHTInfo
->PeerHTCapBuf
,EWC11NHTCap
, sizeof(EWC11NHTCap
)))
1033 pPeerHTCap
= (PHT_CAPABILITY_ELE
)(&pHTInfo
->PeerHTCapBuf
[4]);
1035 pPeerHTCap
= (PHT_CAPABILITY_ELE
)(pHTInfo
->PeerHTCapBuf
);
1037 if(!memcmp(pHTInfo
->PeerHTInfoBuf
, EWC11NHTInfo
, sizeof(EWC11NHTInfo
)))
1038 pPeerHTInfo
= (PHT_INFORMATION_ELE
)(&pHTInfo
->PeerHTInfoBuf
[4]);
1040 pPeerHTInfo
= (PHT_INFORMATION_ELE
)(pHTInfo
->PeerHTInfoBuf
);
1043 ////////////////////////////////////////////////////////
1045 ////////////////////////////////////////////////////////
1046 IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA
|IEEE80211_DL_HT
, pPeerHTCap
, sizeof(HT_CAPABILITY_ELE
));
1047 // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_HT, pPeerHTInfo, sizeof(HT_INFORMATION_ELE));
1048 // Config Supported Channel Width setting
1050 HTSetConnectBwMode(ieee
, (HT_CHANNEL_WIDTH
)(pPeerHTCap
->ChlWidth
), (HT_EXTCHNL_OFFSET
)(pPeerHTInfo
->ExtChlOffset
));
1052 // if(pHTInfo->bCurBW40MHz == true)
1053 pHTInfo
->bCurTxBW40MHz
= ((pPeerHTInfo
->RecommemdedTxWidth
== 1)?true:false);
1056 // Update short GI/ long GI setting
1059 pHTInfo
->bCurShortGI20MHz
=
1060 ((pHTInfo
->bRegShortGI20MHz
)?((pPeerHTCap
->ShortGI20Mhz
==1)?true:false):false);
1061 pHTInfo
->bCurShortGI40MHz
=
1062 ((pHTInfo
->bRegShortGI40MHz
)?((pPeerHTCap
->ShortGI40Mhz
==1)?true:false):false);
1065 // Config TX STBC setting
1070 // Config DSSS/CCK mode in 40MHz mode
1073 pHTInfo
->bCurSuppCCK
=
1074 ((pHTInfo
->bRegSuppCCK
)?((pPeerHTCap
->DssCCk
==1)?true:false):false);
1078 // Config and configure A-MSDU setting
1080 pHTInfo
->bCurrent_AMSDU_Support
= pHTInfo
->bAMSDU_Support
;
1081 if (ieee
->rtllib_ap_sec_type
&&
1082 (ieee
->rtllib_ap_sec_type(ieee
)&(SEC_ALG_WEP
|SEC_ALG_TKIP
))){
1083 if( (pHTInfo
->IOTPeer
== HT_IOT_PEER_ATHEROS
) ||
1084 (pHTInfo
->IOTPeer
== HT_IOT_PEER_UNKNOWN
) )
1085 pHTInfo
->bCurrentAMPDUEnable
= false;
1089 nMaxAMSDUSize
= (pPeerHTCap
->MaxAMSDUSize
==0)?3839:7935;
1091 if(pHTInfo
->nAMSDU_MaxSize
> nMaxAMSDUSize
)
1092 pHTInfo
->nCurrent_AMSDU_MaxSize
= nMaxAMSDUSize
;
1094 pHTInfo
->nCurrent_AMSDU_MaxSize
= pHTInfo
->nAMSDU_MaxSize
;
1098 // Config A-MPDU setting
1100 pHTInfo
->bCurrentAMPDUEnable
= pHTInfo
->bAMPDUEnable
;
1102 // <1> Decide AMPDU Factor
1105 if(!pHTInfo
->bRegRT2RTAggregation
)
1107 // Decide AMPDU Factor according to protocol handshake
1108 if(pHTInfo
->AMPDU_Factor
> pPeerHTCap
->MaxRxAMPDUFactor
)
1109 pHTInfo
->CurrentAMPDUFactor
= pPeerHTCap
->MaxRxAMPDUFactor
;
1111 pHTInfo
->CurrentAMPDUFactor
= pHTInfo
->AMPDU_Factor
;
1115 // Set MPDU density to 2 to Realtek AP, and set it to 0 for others
1116 // Replace MPDU factor declared in original association response frame format. 2007.08.20 by Emily
1118 osTmp
= PacketGetElement( asocpdu
, EID_Vendor
, OUI_SUB_REALTEK_AGG
, OUI_SUBTYPE_DONT_CARE
);
1119 if(osTmp
.Length
>= 5) //00:e0:4c:02:00
1121 if (ieee
->current_network
.bssht
.bdRT2RTAggregation
)
1123 if( ieee
->pairwise_key_type
!= KEY_TYPE_NA
)
1124 // Realtek may set 32k in security mode and 64k for others
1125 pHTInfo
->CurrentAMPDUFactor
= pPeerHTCap
->MaxRxAMPDUFactor
;
1127 pHTInfo
->CurrentAMPDUFactor
= HT_AGG_SIZE_64K
;
1130 if(pPeerHTCap
->MaxRxAMPDUFactor
< HT_AGG_SIZE_32K
)
1131 pHTInfo
->CurrentAMPDUFactor
= pPeerHTCap
->MaxRxAMPDUFactor
;
1133 pHTInfo
->CurrentAMPDUFactor
= HT_AGG_SIZE_32K
;
1137 // <2> Set AMPDU Minimum MPDU Start Spacing
1138 // 802.11n 3.0 section 9.7d.3
1140 if(pHTInfo
->MPDU_Density
> pPeerHTCap
->MPDUDensity
)
1141 pHTInfo
->CurrentMPDUDensity
= pHTInfo
->MPDU_Density
;
1143 pHTInfo
->CurrentMPDUDensity
= pPeerHTCap
->MPDUDensity
;
1144 if(ieee
->pairwise_key_type
!= KEY_TYPE_NA
)
1145 pHTInfo
->CurrentMPDUDensity
= 7; // 8us
1147 if(pHTInfo
->MPDU_Density
> pPeerHTCap
->MPDUDensity
)
1148 pHTInfo
->CurrentMPDUDensity
= pHTInfo
->MPDU_Density
;
1150 pHTInfo
->CurrentMPDUDensity
= pPeerHTCap
->MPDUDensity
;
1154 // Lanhsin: mark for tmp to avoid deauth by ap from s3
1155 //if(memcmp(pMgntInfo->Bssid, NETGEAR834Bv2_BROADCOM, 3)==0)
1159 pHTInfo
->bCurrentAMPDUEnable
= false;
1160 pHTInfo
->ForcedAMSDUMode
= HT_AGG_FORCE_ENABLE
;
1161 pHTInfo
->ForcedAMSDUMaxSize
= 7935;
1163 pHTInfo
->IOTAction
|= HT_IOT_ACT_TX_USE_AMSDU_8K
;
1166 // Rx Reorder Setting
1167 pHTInfo
->bCurRxReorderEnable
= pHTInfo
->bRegRxReorderEnable
;
1170 // Filter out unsupported HT rate for this AP
1171 // Update RATR table
1172 // This is only for 8190 ,8192 or later product which using firmware to handle rate adaptive mechanism.
1175 // Handle Ralink AP bad MCS rate set condition. Joseph.
1176 // This fix the bug of Ralink AP. This may be removed in the future.
1177 if(pPeerHTCap
->MCS
[0] == 0)
1178 pPeerHTCap
->MCS
[0] = 0xff;
1180 HTFilterMCSRate(ieee
, pPeerHTCap
->MCS
, ieee
->dot11HTOperationalRateSet
);
1183 // Config MIMO Power Save setting
1185 pHTInfo
->PeerMimoPs
= pPeerHTCap
->MimoPwrSave
;
1186 if(pHTInfo
->PeerMimoPs
== MIMO_PS_STATIC
)
1187 pMcsFilter
= MCS_FILTER_1SS
;
1189 pMcsFilter
= MCS_FILTER_ALL
;
1190 //WB add for MCS8 bug
1191 // pMcsFilter = MCS_FILTER_1SS;
1192 ieee
->HTHighestOperaRate
= HTGetHighestMCSRate(ieee
, ieee
->dot11HTOperationalRateSet
, pMcsFilter
);
1193 ieee
->HTCurrentOperaRate
= ieee
->HTHighestOperaRate
;
1196 // Config current operation mode.
1198 pHTInfo
->CurrentOpMode
= pPeerHTInfo
->OptMode
;
1204 void HTSetConnectBwModeCallback(struct ieee80211_device
* ieee
);
1205 /********************************************************************************************************************
1206 *function: initialize HT info(struct PRT_HIGH_THROUGHPUT)
1207 * input: struct ieee80211_device* ieee
1210 * notice: This function is called when * (1) MPInitialization Phase * (2) Receiving of Deauthentication from AP
1211 ********************************************************************************************************************/
1212 // TODO: Should this funciton be called when receiving of Disassociation?
1213 void HTInitializeHTInfo(struct ieee80211_device
* ieee
)
1215 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
1218 // These parameters will be reset when receiving deauthentication packet
1220 IEEE80211_DEBUG(IEEE80211_DL_HT
, "===========>%s()\n", __FUNCTION__
);
1221 pHTInfo
->bCurrentHTSupport
= false;
1223 // 40MHz channel support
1224 pHTInfo
->bCurBW40MHz
= false;
1225 pHTInfo
->bCurTxBW40MHz
= false;
1228 pHTInfo
->bCurShortGI20MHz
= false;
1229 pHTInfo
->bCurShortGI40MHz
= false;
1230 pHTInfo
->bForcedShortGI
= false;
1233 // This flag is set to true to support CCK rate by default.
1234 // It will be affected by "pHTInfo->bRegSuppCCK" and AP capabilities only when associate to
1236 pHTInfo
->bCurSuppCCK
= true;
1239 pHTInfo
->bCurrent_AMSDU_Support
= false;
1240 pHTInfo
->nCurrent_AMSDU_MaxSize
= pHTInfo
->nAMSDU_MaxSize
;
1243 pHTInfo
->CurrentMPDUDensity
= pHTInfo
->MPDU_Density
;
1244 pHTInfo
->CurrentAMPDUFactor
= pHTInfo
->AMPDU_Factor
;
1248 // Initialize all of the parameters related to 11n
1249 memset((void*)(&(pHTInfo
->SelfHTCap
)), 0, sizeof(pHTInfo
->SelfHTCap
));
1250 memset((void*)(&(pHTInfo
->SelfHTInfo
)), 0, sizeof(pHTInfo
->SelfHTInfo
));
1251 memset((void*)(&(pHTInfo
->PeerHTCapBuf
)), 0, sizeof(pHTInfo
->PeerHTCapBuf
));
1252 memset((void*)(&(pHTInfo
->PeerHTInfoBuf
)), 0, sizeof(pHTInfo
->PeerHTInfoBuf
));
1254 pHTInfo
->bSwBwInProgress
= false;
1255 pHTInfo
->ChnlOp
= CHNLOP_NONE
;
1257 // Set default IEEE spec for Draft N
1258 pHTInfo
->ePeerHTSpecVer
= HT_SPEC_VER_IEEE
;
1260 // Realtek proprietary aggregation mode
1261 pHTInfo
->bCurrentRT2RTAggregation
= false;
1262 pHTInfo
->bCurrentRT2RTLongSlotTime
= false;
1263 pHTInfo
->IOTPeer
= 0;
1264 pHTInfo
->IOTAction
= 0;
1266 //MCS rate initialized here
1268 u8
* RegHTSuppRateSets
= &(ieee
->RegHTSuppRateSet
[0]);
1269 RegHTSuppRateSets
[0] = 0xFF; //support MCS 0~7
1270 RegHTSuppRateSets
[1] = 0xFF; //support MCS 8~15
1271 RegHTSuppRateSets
[4] = 0x01; //support MCS 32
1274 /********************************************************************************************************************
1275 *function: initialize Bss HT structure(struct PBSS_HT)
1276 * input: PBSS_HT pBssHT //to be initialized
1279 * notice: This function is called when initialize network structure
1280 ********************************************************************************************************************/
1281 void HTInitializeBssDesc(PBSS_HT pBssHT
)
1284 pBssHT
->bdSupportHT
= false;
1285 memset(pBssHT
->bdHTCapBuf
, 0, sizeof(pBssHT
->bdHTCapBuf
));
1286 pBssHT
->bdHTCapLen
= 0;
1287 memset(pBssHT
->bdHTInfoBuf
, 0, sizeof(pBssHT
->bdHTInfoBuf
));
1288 pBssHT
->bdHTInfoLen
= 0;
1290 pBssHT
->bdHTSpecVer
= HT_SPEC_VER_IEEE
;
1292 pBssHT
->bdRT2RTAggregation
= false;
1293 pBssHT
->bdRT2RTLongSlotTime
= false;
1296 //below function has merged into ieee80211_network_init() in ieee80211_rx.c
1298 HTParsingHTCapElement(
1299 IN PADAPTER Adapter
,
1300 IN OCTET_STRING HTCapIE
,
1301 OUT PRT_WLAN_BSS pBssDesc
1304 PMGNT_INFO pMgntInfo
= &Adapter
->MgntInfo
;
1306 if( HTCapIE
.Length
> sizeof(pBssDesc
->BssHT
.bdHTCapBuf
) )
1308 RT_TRACE( COMP_HT
, DBG_LOUD
, ("HTParsingHTCapElement(): HT Capability Element length is too long!\n") );
1312 // TODO: Check the correctness of HT Cap
1313 //Print each field in detail. Driver should not print out this message by default
1314 if(!pMgntInfo
->mActingAsAp
&& !pMgntInfo
->mAssoc
)
1315 HTDebugHTCapability(DBG_TRACE
, Adapter
, &HTCapIE
, (pu8
)"HTParsingHTCapElement()");
1317 HTCapIE
.Length
= HTCapIE
.Length
> sizeof(pBssDesc
->BssHT
.bdHTCapBuf
)?\
1318 sizeof(pBssDesc
->BssHT
.bdHTCapBuf
):HTCapIE
.Length
; //prevent from overflow
1320 CopyMem(pBssDesc
->BssHT
.bdHTCapBuf
, HTCapIE
.Octet
, HTCapIE
.Length
);
1321 pBssDesc
->BssHT
.bdHTCapLen
= HTCapIE
.Length
;
1327 HTParsingHTInfoElement(
1329 OCTET_STRING HTInfoIE
,
1330 PRT_WLAN_BSS pBssDesc
1333 PMGNT_INFO pMgntInfo
= &Adapter
->MgntInfo
;
1335 if( HTInfoIE
.Length
> sizeof(pBssDesc
->BssHT
.bdHTInfoBuf
))
1337 RT_TRACE( COMP_HT
, DBG_LOUD
, ("HTParsingHTInfoElement(): HT Information Element length is too long!\n") );
1341 // TODO: Check the correctness of HT Info
1342 //Print each field in detail. Driver should not print out this message by default
1343 if(!pMgntInfo
->mActingAsAp
&& !pMgntInfo
->mAssoc
)
1344 HTDebugHTInfo(DBG_TRACE
, Adapter
, &HTInfoIE
, (pu8
)"HTParsingHTInfoElement()");
1346 HTInfoIE
.Length
= HTInfoIE
.Length
> sizeof(pBssDesc
->BssHT
.bdHTInfoBuf
)?\
1347 sizeof(pBssDesc
->BssHT
.bdHTInfoBuf
):HTInfoIE
.Length
; //prevent from overflow
1349 CopyMem( pBssDesc
->BssHT
.bdHTInfoBuf
, HTInfoIE
.Octet
, HTInfoIE
.Length
);
1350 pBssDesc
->BssHT
.bdHTInfoLen
= HTInfoIE
.Length
;
1354 * Get HT related information from beacon and save it in BssDesc
1356 * (1) Parse HTCap, and HTInfo, and record whether it is 11n AP
1357 * (2) If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT()
1358 * (3) Check whether peer is Realtek AP (for Realtek proprietary aggregation mode).
1366 void HTGetValueFromBeaconOrProbeRsp(
1368 POCTET_STRING pSRCmmpdu
,
1369 PRT_WLAN_BSS bssDesc
1372 PMGNT_INFO pMgntInfo
= &Adapter
->MgntInfo
;
1373 PRT_HIGH_THROUGHPUT pHTInfo
= GET_HT_INFO(pMgntInfo
);
1374 OCTET_STRING HTCapIE
, HTInfoIE
, HTRealtekAgg
, mmpdu
;
1375 OCTET_STRING BroadcomElement
, CiscoElement
;
1377 mmpdu
.Octet
= pSRCmmpdu
->Octet
;
1378 mmpdu
.Length
= pSRCmmpdu
->Length
;
1381 // Mark for IOT testing using Linksys WRT350N, This AP does not contain WMM IE when
1382 // it is configured at pure-N mode.
1383 // if(bssDesc->BssQos.bdQoSMode & QOS_WMM)
1386 HTInitializeBssDesc (&bssDesc
->BssHT
);
1388 //2<1> Parse HTCap, and HTInfo
1389 // Get HT Capability IE: (1) Get IEEE Draft N IE or (2) Get EWC IE
1390 HTCapIE
= PacketGetElement(mmpdu
, EID_HTCapability
, OUI_SUB_DONT_CARE
, OUI_SUBTYPE_DONT_CARE
);
1391 if(HTCapIE
.Length
== 0)
1393 HTCapIE
= PacketGetElement(mmpdu
, EID_Vendor
, OUI_SUB_11N_EWC_HT_CAP
, OUI_SUBTYPE_DONT_CARE
);
1394 if(HTCapIE
.Length
!= 0)
1395 bssDesc
->BssHT
.bdHTSpecVer
= HT_SPEC_VER_EWC
;
1397 if(HTCapIE
.Length
!= 0)
1398 HTParsingHTCapElement(Adapter
, HTCapIE
, bssDesc
);
1400 // Get HT Information IE: (1) Get IEEE Draft N IE or (2) Get EWC IE
1401 HTInfoIE
= PacketGetElement(mmpdu
, EID_HTInfo
, OUI_SUB_DONT_CARE
, OUI_SUBTYPE_DONT_CARE
);
1402 if(HTInfoIE
.Length
== 0)
1404 HTInfoIE
= PacketGetElement(mmpdu
, EID_Vendor
, OUI_SUB_11N_EWC_HT_INFO
, OUI_SUBTYPE_DONT_CARE
);
1405 if(HTInfoIE
.Length
!= 0)
1406 bssDesc
->BssHT
.bdHTSpecVer
= HT_SPEC_VER_EWC
;
1408 if(HTInfoIE
.Length
!= 0)
1409 HTParsingHTInfoElement(Adapter
, HTInfoIE
, bssDesc
);
1411 //2<2>If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT()
1412 if(HTCapIE
.Length
!= 0)
1414 bssDesc
->BssHT
.bdSupportHT
= true;
1415 if(bssDesc
->BssQos
.bdQoSMode
== QOS_DISABLE
)
1416 QosSetLegacyWMMParamWithHT(Adapter
, bssDesc
);
1420 bssDesc
->BssHT
.bdSupportHT
= false;
1423 //2<3>Check whether the peer is Realtek AP/STA
1424 if(pHTInfo
->bRegRT2RTAggregation
)
1426 if(bssDesc
->BssHT
.bdSupportHT
)
1428 HTRealtekAgg
= PacketGetElement(mmpdu
, EID_Vendor
, OUI_SUB_REALTEK_AGG
, OUI_SUBTYPE_DONT_CARE
);
1429 if(HTRealtekAgg
.Length
>=5 )
1431 bssDesc
->BssHT
.bdRT2RTAggregation
= true;
1433 if((HTRealtekAgg
.Octet
[4]==1) && (HTRealtekAgg
.Octet
[5] & 0x02))
1434 bssDesc
->BssHT
.bdRT2RTLongSlotTime
= true;
1440 // 2008/01/25 MH Get Broadcom AP IE for manamgent frame CCK rate problem.
1441 // AP can not receive CCK managemtn from from 92E.
1444 // Initialize every new bss broadcom cap exist as false..
1445 bssDesc
->bBroadcomCapExist
= false;
1447 if(HTCapIE
.Length
!= 0 || HTInfoIE
.Length
!= 0)
1451 FillOctetString(BroadcomElement
, NULL
, 0);
1453 BroadcomElement
= PacketGetElement( mmpdu
, EID_Vendor
, OUI_SUB_BROADCOM_IE_1
, OUI_SUBTYPE_DONT_CARE
);
1454 Length
+= BroadcomElement
.Length
;
1455 BroadcomElement
= PacketGetElement( mmpdu
, EID_Vendor
, OUI_SUB_BROADCOM_IE_2
, OUI_SUBTYPE_DONT_CARE
);
1456 Length
+= BroadcomElement
.Length
;
1457 BroadcomElement
= PacketGetElement( mmpdu
, EID_Vendor
, OUI_SUB_BROADCOM_IE_3
, OUI_SUBTYPE_DONT_CARE
);
1458 Length
+= BroadcomElement
.Length
;
1461 bssDesc
->bBroadcomCapExist
= true;
1465 // For Cisco IOT issue
1466 CiscoElement
= PacketGetElement( mmpdu
, EID_Vendor
, OUI_SUB_CISCO_IE
, OUI_SUBTYPE_DONT_CARE
);
1467 if(CiscoElement
.Length
!= 0){ // 3: 0x00, 0x40, 0x96 ....
1468 bssDesc
->bCiscoCapExist
= true;
1470 bssDesc
->bCiscoCapExist
= false;
1476 /********************************************************************************************************************
1477 *function: initialize Bss HT structure(struct PBSS_HT)
1478 * input: struct ieee80211_device *ieee
1479 * struct ieee80211_network *pNetwork //usually current network we are live in
1482 * notice: This function should ONLY be called before association
1483 ********************************************************************************************************************/
1484 void HTResetSelfAndSavePeerSetting(struct ieee80211_device
* ieee
, struct ieee80211_network
* pNetwork
)
1486 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
1487 // u16 nMaxAMSDUSize;
1488 // PHT_CAPABILITY_ELE pPeerHTCap = (PHT_CAPABILITY_ELE)pNetwork->bssht.bdHTCapBuf;
1489 // PHT_INFORMATION_ELE pPeerHTInfo = (PHT_INFORMATION_ELE)pNetwork->bssht.bdHTInfoBuf;
1494 // Save Peer Setting before Association
1496 IEEE80211_DEBUG(IEEE80211_DL_HT
, "==============>%s()\n", __FUNCTION__
);
1497 /*unmark bEnableHT flag here is the same reason why unmarked in function ieee80211_softmac_new_net. WB 2008.09.10*/
1498 // if( pHTInfo->bEnableHT && pNetwork->bssht.bdSupportHT)
1499 if (pNetwork
->bssht
.bdSupportHT
)
1501 pHTInfo
->bCurrentHTSupport
= true;
1502 pHTInfo
->ePeerHTSpecVer
= pNetwork
->bssht
.bdHTSpecVer
;
1504 // Save HTCap and HTInfo information Element
1505 if(pNetwork
->bssht
.bdHTCapLen
> 0 && pNetwork
->bssht
.bdHTCapLen
<= sizeof(pHTInfo
->PeerHTCapBuf
))
1506 memcpy(pHTInfo
->PeerHTCapBuf
, pNetwork
->bssht
.bdHTCapBuf
, pNetwork
->bssht
.bdHTCapLen
);
1508 if(pNetwork
->bssht
.bdHTInfoLen
> 0 && pNetwork
->bssht
.bdHTInfoLen
<= sizeof(pHTInfo
->PeerHTInfoBuf
))
1509 memcpy(pHTInfo
->PeerHTInfoBuf
, pNetwork
->bssht
.bdHTInfoBuf
, pNetwork
->bssht
.bdHTInfoLen
);
1511 // Check whether RT to RT aggregation mode is enabled
1512 if(pHTInfo
->bRegRT2RTAggregation
)
1514 pHTInfo
->bCurrentRT2RTAggregation
= pNetwork
->bssht
.bdRT2RTAggregation
;
1515 pHTInfo
->bCurrentRT2RTLongSlotTime
= pNetwork
->bssht
.bdRT2RTLongSlotTime
;
1519 pHTInfo
->bCurrentRT2RTAggregation
= false;
1520 pHTInfo
->bCurrentRT2RTLongSlotTime
= false;
1523 // Determine the IOT Peer Vendor.
1524 HTIOTPeerDetermine(ieee
);
1526 // Decide IOT Action
1527 // Must be called after the parameter of pHTInfo->bCurrentRT2RTAggregation is decided
1528 pHTInfo
->IOTAction
= 0;
1529 bIOTAction
= HTIOTActIsDisableMCS14(ieee
, pNetwork
->bssid
);
1531 pHTInfo
->IOTAction
|= HT_IOT_ACT_DISABLE_MCS14
;
1532 bIOTAction
= HTIOTActIsForcedCTS2Self(ieee
, pNetwork
);
1534 pHTInfo
->IOTAction
|= HT_IOT_ACT_FORCED_CTS2SELF
;
1536 bIOTAction
= HTIOTActIsDisableMCS15(ieee
);
1538 pHTInfo
->IOTAction
|= HT_IOT_ACT_DISABLE_MCS15
;
1540 bIOTAction
= HTIOTActIsDisableMCSTwoSpatialStream(ieee
, pNetwork
->bssid
);
1542 pHTInfo
->IOTAction
|= HT_IOT_ACT_DISABLE_ALL_2SS
;
1545 bIOTAction
= HTIOTActIsDisableEDCATurbo(ieee
, pNetwork
->bssid
);
1547 pHTInfo
->IOTAction
|= HT_IOT_ACT_DISABLE_EDCA_TURBO
;
1549 bIOTAction
= HTIOTActIsMgntUseCCK6M(pNetwork
);
1551 pHTInfo
->IOTAction
|= HT_IOT_ACT_MGNT_USE_CCK_6M
;
1553 bIOTAction
= HTIOTActIsCCDFsync(pNetwork
->bssid
);
1555 pHTInfo
->IOTAction
|= HT_IOT_ACT_CDD_FSYNC
;
1557 bIOTAction
= HTIOTActIsNullDataPowerSaving(ieee
, pNetwork
);
1559 pHTInfo
->IOTAction
|= HT_IOT_ACT_NULL_DATA_POWER_SAVING
;
1564 pHTInfo
->bCurrentHTSupport
= false;
1565 pHTInfo
->bCurrentRT2RTAggregation
= false;
1566 pHTInfo
->bCurrentRT2RTLongSlotTime
= false;
1568 pHTInfo
->IOTAction
= 0;
1573 void HTUpdateSelfAndPeerSetting(struct ieee80211_device
* ieee
, struct ieee80211_network
* pNetwork
)
1575 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
1576 // PHT_CAPABILITY_ELE pPeerHTCap = (PHT_CAPABILITY_ELE)pNetwork->bssht.bdHTCapBuf;
1577 PHT_INFORMATION_ELE pPeerHTInfo
= (PHT_INFORMATION_ELE
)pNetwork
->bssht
.bdHTInfoBuf
;
1579 if(pHTInfo
->bCurrentHTSupport
)
1582 // Config current operation mode.
1584 if(pNetwork
->bssht
.bdHTInfoLen
!= 0)
1585 pHTInfo
->CurrentOpMode
= pPeerHTInfo
->OptMode
;
1588 // <TODO: Config according to OBSS non-HT STA present!!>
1593 void HTUseDefaultSetting(struct ieee80211_device
* ieee
)
1595 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
1598 if(pHTInfo
->bEnableHT
)
1600 pHTInfo
->bCurrentHTSupport
= true;
1602 pHTInfo
->bCurSuppCCK
= pHTInfo
->bRegSuppCCK
;
1604 pHTInfo
->bCurBW40MHz
= pHTInfo
->bRegBW40MHz
;
1606 pHTInfo
->bCurShortGI20MHz
= pHTInfo
->bRegShortGI20MHz
;
1608 pHTInfo
->bCurShortGI40MHz
= pHTInfo
->bRegShortGI40MHz
;
1610 pHTInfo
->bCurrent_AMSDU_Support
= pHTInfo
->bAMSDU_Support
;
1612 pHTInfo
->nCurrent_AMSDU_MaxSize
= pHTInfo
->nAMSDU_MaxSize
;
1614 pHTInfo
->bCurrentAMPDUEnable
= pHTInfo
->bAMPDUEnable
;
1616 pHTInfo
->CurrentAMPDUFactor
= pHTInfo
->AMPDU_Factor
;
1618 pHTInfo
->CurrentMPDUDensity
= pHTInfo
->CurrentMPDUDensity
;
1620 // Set BWOpMode register
1622 //update RATR index0
1623 HTFilterMCSRate(ieee
, ieee
->Regdot11HTOperationalRateSet
, ieee
->dot11HTOperationalRateSet
);
1624 //function below is not implemented at all. WB
1626 Adapter
->HalFunc
.InitHalRATRTableHandler( Adapter
, &pMgntInfo
->dot11OperationalRateSet
, pMgntInfo
->dot11HTOperationalRateSet
);
1628 ieee
->HTHighestOperaRate
= HTGetHighestMCSRate(ieee
, ieee
->dot11HTOperationalRateSet
, MCS_FILTER_ALL
);
1629 ieee
->HTCurrentOperaRate
= ieee
->HTHighestOperaRate
;
1634 pHTInfo
->bCurrentHTSupport
= false;
1637 /********************************************************************************************************************
1638 *function: check whether HT control field exists
1639 * input: struct ieee80211_device *ieee
1640 * u8* pFrame //coming skb->data
1642 * return: return true if HT control field exists(false otherwise)
1644 ********************************************************************************************************************/
1645 u8
HTCCheck(struct ieee80211_device
* ieee
, u8
* pFrame
)
1647 if(ieee
->pHTInfo
->bCurrentHTSupport
)
1649 if( (IsQoSDataFrame(pFrame
) && Frame_Order(pFrame
)) == 1)
1651 IEEE80211_DEBUG(IEEE80211_DL_HT
, "HT CONTROL FILED EXIST!!\n");
1659 // This function set bandwidth mode in protocol layer.
1661 void HTSetConnectBwMode(struct ieee80211_device
* ieee
, HT_CHANNEL_WIDTH Bandwidth
, HT_EXTCHNL_OFFSET Offset
)
1663 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
1666 if(pHTInfo
->bRegBW40MHz
== false)
1671 // To reduce dummy operation
1672 // if((pHTInfo->bCurBW40MHz==false && Bandwidth==HT_CHANNEL_WIDTH_20) ||
1673 // (pHTInfo->bCurBW40MHz==true && Bandwidth==HT_CHANNEL_WIDTH_20_40 && Offset==pHTInfo->CurSTAExtChnlOffset))
1676 // spin_lock_irqsave(&(ieee->bw_spinlock), flags);
1677 if(pHTInfo
->bSwBwInProgress
) {
1678 // spin_unlock_irqrestore(&(ieee->bw_spinlock), flags);
1681 //if in half N mode, set to 20M bandwidth please 09.08.2008 WB.
1682 if (Bandwidth
==HT_CHANNEL_WIDTH_20_40
&& (!ieee
->GetHalfNmodeSupportByAPsHandler(ieee
)))
1684 // Handle Illegal extension channel offset!!
1685 if(ieee
->current_network
.channel
<2 && Offset
==HT_EXTCHNL_OFFSET_LOWER
)
1686 Offset
= HT_EXTCHNL_OFFSET_NO_EXT
;
1687 if(Offset
==HT_EXTCHNL_OFFSET_UPPER
|| Offset
==HT_EXTCHNL_OFFSET_LOWER
) {
1688 pHTInfo
->bCurBW40MHz
= true;
1689 pHTInfo
->CurSTAExtChnlOffset
= Offset
;
1691 pHTInfo
->bCurBW40MHz
= false;
1692 pHTInfo
->CurSTAExtChnlOffset
= HT_EXTCHNL_OFFSET_NO_EXT
;
1695 pHTInfo
->bCurBW40MHz
= false;
1696 pHTInfo
->CurSTAExtChnlOffset
= HT_EXTCHNL_OFFSET_NO_EXT
;
1699 pHTInfo
->bSwBwInProgress
= true;
1701 // TODO: 2007.7.13 by Emily Wait 2000ms in order to guarantee that switching
1702 // bandwidth is executed after scan is finished. It is a temporal solution
1703 // because software should ganrantee the last operation of switching bandwidth
1704 // is executed properlly.
1705 HTSetConnectBwModeCallback(ieee
);
1707 // spin_unlock_irqrestore(&(ieee->bw_spinlock), flags);
1710 void HTSetConnectBwModeCallback(struct ieee80211_device
* ieee
)
1712 PRT_HIGH_THROUGHPUT pHTInfo
= ieee
->pHTInfo
;
1714 IEEE80211_DEBUG(IEEE80211_DL_HT
, "======>%s()\n", __FUNCTION__
);
1716 if(pHTInfo
->bCurBW40MHz
)
1718 if(pHTInfo
->CurSTAExtChnlOffset
==HT_EXTCHNL_OFFSET_UPPER
)
1719 ieee
->set_chan(ieee
, ieee
->current_network
.channel
+2);
1720 else if(pHTInfo
->CurSTAExtChnlOffset
==HT_EXTCHNL_OFFSET_LOWER
)
1721 ieee
->set_chan(ieee
, ieee
->current_network
.channel
-2);
1723 ieee
->set_chan(ieee
, ieee
->current_network
.channel
);
1725 ieee
->SetBWModeHandler(ieee
, HT_CHANNEL_WIDTH_20_40
, pHTInfo
->CurSTAExtChnlOffset
);
1727 ieee
->set_chan(ieee
, ieee
->current_network
.channel
);
1728 ieee
->SetBWModeHandler(ieee
, HT_CHANNEL_WIDTH_20
, HT_EXTCHNL_OFFSET_NO_EXT
);
1731 pHTInfo
->bSwBwInProgress
= false;