2011-08-23 18:00:42 -06:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
* The full GNU General Public License is included in this distribution in the
|
|
|
|
* file called LICENSE.
|
|
|
|
*
|
|
|
|
* Contact Information:
|
|
|
|
* wlanfae <wlanfae@realtek.com>
|
|
|
|
******************************************************************************/
|
|
|
|
#include "rtllib.h"
|
|
|
|
#include "rtl819x_HT.h"
|
2011-08-25 10:48:17 -06:00
|
|
|
u8 MCS_FILTER_ALL[16] = {
|
|
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
|
|
0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
};
|
|
|
|
|
|
|
|
u8 MCS_FILTER_1SS[16] = {
|
|
|
|
0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
|
|
|
|
;
|
|
|
|
|
|
|
|
u16 MCS_DATA_RATE[2][2][77] = {
|
|
|
|
{{13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234,
|
|
|
|
260, 39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 312, 416,
|
|
|
|
468, 520, 0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 182,
|
|
|
|
182, 208, 156, 195, 195, 234, 273, 273, 312, 130, 156, 181, 156,
|
|
|
|
181, 208, 234, 208, 234, 260, 260, 286, 195, 234, 273, 234, 273,
|
2014-12-20 19:53:59 -07:00
|
|
|
312, 351, 312, 351, 390, 390, 429},
|
2011-08-25 10:48:17 -06:00
|
|
|
{14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 173, 231, 260, 289,
|
|
|
|
43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 231, 347, 462, 520,
|
|
|
|
578, 0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 202, 202, 231,
|
|
|
|
173, 217, 217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 260,
|
|
|
|
231, 260, 289, 289, 318, 217, 260, 303, 260, 303, 347, 390, 347, 390,
|
2014-12-20 19:53:59 -07:00
|
|
|
433, 433, 477} },
|
2011-08-25 10:48:17 -06:00
|
|
|
{{27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486,
|
|
|
|
540, 81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 432, 648,
|
|
|
|
864, 972, 1080, 12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324,
|
|
|
|
378, 378, 432, 324, 405, 405, 486, 567, 567, 648, 270, 324, 378, 324,
|
|
|
|
378, 432, 486, 432, 486, 540, 540, 594, 405, 486, 567, 486, 567, 648,
|
|
|
|
729, 648, 729, 810, 810, 891},
|
|
|
|
{30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540,
|
|
|
|
600, 90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 480, 720,
|
|
|
|
960, 1080, 1200, 13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360,
|
|
|
|
420, 420, 480, 360, 450, 450, 540, 630, 630, 720, 300, 360, 420, 360,
|
|
|
|
420, 480, 540, 480, 540, 600, 600, 660, 450, 540, 630, 540, 630, 720,
|
|
|
|
810, 720, 810, 900, 900, 990} }
|
|
|
|
};
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0x00, 0x1a, 0x70};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 LINKSYSWRT350_LINKSYSWRT150_BROADCOM[3] = {0x00, 0x1d, 0x7e};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 BELKINF5D8233V1_RALINK[3] = {0x00, 0x17, 0x3f};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 BELKINF5D82334V3_RALINK[3] = {0x00, 0x1c, 0xdf};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 PCI_RALINK[3] = {0x00, 0x90, 0xcc};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 EDIMAX_RALINK[3] = {0x00, 0x0e, 0x2e};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 AIRLINK_RALINK[3] = {0x00, 0x18, 0x02};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 DLINK_ATHEROS_1[3] = {0x00, 0x1c, 0xf0};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 DLINK_ATHEROS_2[3] = {0x00, 0x21, 0x91};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 CISCO_BROADCOM[3] = {0x00, 0x17, 0x94};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
static u8 LINKSYS_MARVELL_4400N[3] = {0x00, 0x14, 0xa4};
|
2011-08-25 10:48:17 -06:00
|
|
|
|
|
|
|
void HTUpdateDefaultSetting(struct rtllib_device *ieee)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
pHTInfo->bAcceptAddbaReq = 1;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfo->bRegShortGI20MHz = 1;
|
|
|
|
pHTInfo->bRegShortGI40MHz = 1;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
pHTInfo->bRegBW40MHz = 1;
|
|
|
|
|
|
|
|
if (pHTInfo->bRegBW40MHz)
|
|
|
|
pHTInfo->bRegSuppCCK = 1;
|
|
|
|
else
|
|
|
|
pHTInfo->bRegSuppCCK = true;
|
|
|
|
|
|
|
|
pHTInfo->nAMSDU_MaxSize = 7935UL;
|
|
|
|
pHTInfo->bAMSDU_Support = 0;
|
|
|
|
|
|
|
|
pHTInfo->bAMPDUEnable = 1;
|
|
|
|
pHTInfo->AMPDU_Factor = 2;
|
|
|
|
pHTInfo->MPDU_Density = 0;
|
|
|
|
|
|
|
|
pHTInfo->SelfMimoPs = 3;
|
|
|
|
if (pHTInfo->SelfMimoPs == 2)
|
|
|
|
pHTInfo->SelfMimoPs = 3;
|
|
|
|
ieee->bTxDisableRateFallBack = 0;
|
|
|
|
ieee->bTxUseDriverAssingedRate = 0;
|
|
|
|
|
|
|
|
ieee->bTxEnableFwCalcDur = 1;
|
|
|
|
|
|
|
|
pHTInfo->bRegRT2RTAggregation = 1;
|
|
|
|
|
|
|
|
pHTInfo->bRegRxReorderEnable = 1;
|
|
|
|
pHTInfo->RxReorderWinSize = 64;
|
|
|
|
pHTInfo->RxReorderPendingTime = 30;
|
|
|
|
}
|
2011-08-25 10:48:17 -06:00
|
|
|
|
|
|
|
u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
u8 is40MHz = (pHTInfo->bCurBW40MHz) ? 1 : 0;
|
|
|
|
u8 isShortGI = (pHTInfo->bCurBW40MHz) ?
|
|
|
|
((pHTInfo->bCurShortGI40MHz) ? 1 : 0) :
|
|
|
|
((pHTInfo->bCurShortGI20MHz) ? 1 : 0);
|
|
|
|
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate & 0x7f)];
|
2011-08-23 18:00:42 -06:00
|
|
|
}
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-08-25 10:48:17 -06:00
|
|
|
u16 CCKOFDMRate[12] = {0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18,
|
|
|
|
0x24, 0x30, 0x48, 0x60, 0x6c};
|
2011-08-23 18:00:42 -06:00
|
|
|
u8 is40MHz = 0;
|
|
|
|
u8 isShortGI = 0;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (nDataRate < 12) {
|
2011-08-23 18:00:42 -06:00
|
|
|
return CCKOFDMRate[nDataRate];
|
2011-08-25 10:48:17 -06:00
|
|
|
} else {
|
|
|
|
if (nDataRate >= 0x10 && nDataRate <= 0x1f) {
|
2011-08-23 18:00:42 -06:00
|
|
|
is40MHz = 0;
|
|
|
|
isShortGI = 0;
|
2011-08-25 10:48:17 -06:00
|
|
|
} else if (nDataRate >= 0x20 && nDataRate <= 0x2f) {
|
2011-08-23 18:00:42 -06:00
|
|
|
is40MHz = 1;
|
|
|
|
isShortGI = 0;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
} else if (nDataRate >= 0x30 && nDataRate <= 0x3f) {
|
2011-08-23 18:00:42 -06:00
|
|
|
is40MHz = 0;
|
|
|
|
isShortGI = 1;
|
2011-08-25 10:48:17 -06:00
|
|
|
} else if (nDataRate >= 0x40 && nDataRate <= 0x4f) {
|
2011-08-23 18:00:42 -06:00
|
|
|
is40MHz = 1;
|
|
|
|
isShortGI = 1;
|
|
|
|
}
|
|
|
|
return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
bool IsHTHalfNmodeAPs(struct rtllib_device *ieee)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
bool retValue = false;
|
2011-08-25 10:48:17 -06:00
|
|
|
struct rtllib_network *net = &ieee->current_network;
|
|
|
|
|
|
|
|
if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
|
|
|
|
(memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
|
|
|
|
(memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
|
|
|
|
(memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
|
|
|
|
(memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
|
|
|
|
(net->ralink_cap_exist))
|
|
|
|
retValue = true;
|
|
|
|
else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
|
|
|
|
!memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
|
|
|
|
!memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ||
|
|
|
|
(net->broadcom_cap_exist))
|
2011-08-23 18:00:42 -06:00
|
|
|
retValue = true;
|
|
|
|
else if (net->bssht.bdRT2RTAggregation)
|
|
|
|
retValue = true;
|
|
|
|
else
|
|
|
|
retValue = false;
|
|
|
|
|
|
|
|
return retValue;
|
|
|
|
}
|
|
|
|
|
2011-08-25 13:07:04 -06:00
|
|
|
static void HTIOTPeerDetermine(struct rtllib_device *ieee)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
2011-08-25 10:48:17 -06:00
|
|
|
struct rtllib_network *net = &ieee->current_network;
|
2014-08-22 04:27:52 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (net->bssht.bdRT2RTAggregation) {
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK;
|
2011-08-25 10:48:17 -06:00
|
|
|
if (net->bssht.RT2RT_HT_Mode & RT_HT_CAP_USE_92SE)
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK_92SE;
|
2011-08-25 10:48:17 -06:00
|
|
|
if (net->bssht.RT2RT_HT_Mode & RT_HT_CAP_USE_SOFTAP)
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_92U_SOFTAP;
|
2011-08-25 10:48:17 -06:00
|
|
|
} else if (net->broadcom_cap_exist)
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
|
2011-08-25 10:48:17 -06:00
|
|
|
else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
|
|
|
|
!memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
|
|
|
|
!memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3))
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
|
2011-08-25 10:48:17 -06:00
|
|
|
else if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
|
|
|
|
(memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
|
|
|
|
(memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
|
|
|
|
(memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
|
|
|
|
(memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
|
|
|
|
net->ralink_cap_exist)
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_RALINK;
|
2011-08-25 10:48:17 -06:00
|
|
|
else if ((net->atheros_cap_exist) ||
|
|
|
|
(memcmp(net->bssid, DLINK_ATHEROS_1, 3) == 0) ||
|
2011-08-23 18:00:42 -06:00
|
|
|
(memcmp(net->bssid, DLINK_ATHEROS_2, 3) == 0))
|
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS;
|
2011-08-25 10:48:17 -06:00
|
|
|
else if ((memcmp(net->bssid, CISCO_BROADCOM, 3) == 0) ||
|
|
|
|
net->cisco_cap_exist)
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_CISCO;
|
|
|
|
else if ((memcmp(net->bssid, LINKSYS_MARVELL_4400N, 3) == 0) ||
|
|
|
|
net->marvell_cap_exist)
|
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_MARVELL;
|
|
|
|
else if (net->airgo_cap_exist)
|
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_AIRGO;
|
|
|
|
else
|
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_IOT, "Joseph debug!! IOTPEER: %x\n",
|
|
|
|
pHTInfo->IOTPeer);
|
2011-08-23 18:00:42 -06:00
|
|
|
}
|
|
|
|
|
2011-08-25 13:07:04 -06:00
|
|
|
static u8 HTIOTActIsDisableMCS14(struct rtllib_device *ieee, u8 *PeerMacAddr)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
return 0;
|
2011-08-25 10:48:17 -06:00
|
|
|
}
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
|
2011-08-25 13:07:04 -06:00
|
|
|
static bool HTIOTActIsDisableMCS15(struct rtllib_device *ieee)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
bool retValue = false;
|
|
|
|
|
|
|
|
return retValue;
|
|
|
|
}
|
|
|
|
|
2011-08-25 13:07:04 -06:00
|
|
|
static bool HTIOTActIsDisableMCSTwoSpatialStream(struct rtllib_device *ieee)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-08-25 10:48:17 -06:00
|
|
|
return false;
|
2011-08-23 18:00:42 -06:00
|
|
|
}
|
|
|
|
|
2011-08-25 13:07:04 -06:00
|
|
|
static u8 HTIOTActIsDisableEDCATurbo(struct rtllib_device *ieee, u8 *PeerMacAddr)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-08-25 13:07:04 -06:00
|
|
|
static u8 HTIOTActIsMgntUseCCK6M(struct rtllib_device *ieee,
|
|
|
|
struct rtllib_network *network)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
u8 retValue = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM)
|
|
|
|
retValue = 1;
|
|
|
|
|
|
|
|
return retValue;
|
|
|
|
}
|
|
|
|
|
2011-08-25 13:07:04 -06:00
|
|
|
static u8 HTIOTActIsCCDFsync(struct rtllib_device *ieee)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
u8 retValue = 0;
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM)
|
|
|
|
retValue = 1;
|
|
|
|
return retValue;
|
|
|
|
}
|
|
|
|
|
2011-08-25 13:07:04 -06:00
|
|
|
static void HTIOTActDetermineRaFunc(struct rtllib_device *ieee, bool bPeerRx2ss)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
2014-08-22 04:27:52 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->IOTRaFunc &= HT_IOT_RAFUNC_DISABLE_ALL;
|
|
|
|
|
|
|
|
if (pHTInfo->IOTPeer == HT_IOT_PEER_RALINK && !bPeerRx2ss)
|
|
|
|
pHTInfo->IOTRaFunc |= HT_IOT_RAFUNC_PEER_1R;
|
|
|
|
|
|
|
|
if (pHTInfo->IOTAction & HT_IOT_ACT_AMSDU_ENABLE)
|
|
|
|
pHTInfo->IOTRaFunc |= HT_IOT_RAFUNC_TX_AMSDU;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
pHTInfo->IOTAction = 0;
|
|
|
|
pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
|
|
|
|
pHTInfo->IOTRaFunc = 0;
|
|
|
|
}
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap,
|
|
|
|
u8 *len, u8 IsEncrypt, bool bAssoc)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHT = ieee->pHTInfo;
|
2011-07-18 19:34:19 -06:00
|
|
|
struct ht_capab_ele *pCapELE = NULL;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if ((posHTCap == NULL) || (pHT == NULL)) {
|
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_ERR, "posHTCap or pHTInfo can't be "
|
|
|
|
"null in HTConstructCapabilityElement()\n");
|
2011-08-23 18:00:42 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
memset(posHTCap, 0, *len);
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if ((bAssoc) && (pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC)) {
|
2011-08-23 18:00:42 -06:00
|
|
|
u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
|
2014-08-22 04:27:52 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
|
2011-07-18 19:34:19 -06:00
|
|
|
pCapELE = (struct ht_capab_ele *)&(posHTCap[4]);
|
2011-08-23 18:00:42 -06:00
|
|
|
*len = 30 + 2;
|
2011-08-25 10:48:17 -06:00
|
|
|
} else {
|
2011-07-18 19:34:19 -06:00
|
|
|
pCapELE = (struct ht_capab_ele *)posHTCap;
|
2011-08-23 18:00:42 -06:00
|
|
|
*len = 26 + 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
pCapELE->AdvCoding = 0;
|
|
|
|
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
|
|
|
|
pCapELE->ChlWidth = 0;
|
|
|
|
else
|
2011-08-25 10:48:17 -06:00
|
|
|
pCapELE->ChlWidth = (pHT->bRegBW40MHz ? 1 : 0);
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
pCapELE->MimoPwrSave = pHT->SelfMimoPs;
|
|
|
|
pCapELE->GreenField = 0;
|
|
|
|
pCapELE->ShortGI20Mhz = 1;
|
|
|
|
pCapELE->ShortGI40Mhz = 1;
|
|
|
|
|
|
|
|
pCapELE->TxSTBC = 1;
|
|
|
|
pCapELE->RxSTBC = 0;
|
|
|
|
pCapELE->DelayBA = 0;
|
2011-08-25 10:48:17 -06:00
|
|
|
pCapELE->MaxAMSDUSize = (MAX_RECEIVE_BUFFER_SIZE >= 7935) ? 1 : 0;
|
|
|
|
pCapELE->DssCCk = ((pHT->bRegBW40MHz) ? (pHT->bRegSuppCCK ? 1 : 0) : 0);
|
|
|
|
pCapELE->PSMP = 0;
|
|
|
|
pCapELE->LSigTxopProtect = 0;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d "
|
|
|
|
"DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize,
|
|
|
|
pCapELE->DssCCk);
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (IsEncrypt) {
|
2011-08-23 18:00:42 -06:00
|
|
|
pCapELE->MPDUDensity = 7;
|
|
|
|
pCapELE->MaxRxAMPDUFactor = 2;
|
2011-08-25 10:48:17 -06:00
|
|
|
} else {
|
2011-08-23 18:00:42 -06:00
|
|
|
pCapELE->MaxRxAMPDUFactor = 3;
|
|
|
|
pCapELE->MPDUDensity = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(pCapELE->MCS, ieee->Regdot11HTOperationalRateSet, 16);
|
|
|
|
memset(&pCapELE->ExtHTCapInfo, 0, 2);
|
|
|
|
memset(pCapELE->TxBFCap, 0, 4);
|
|
|
|
|
|
|
|
pCapELE->ASCap = 0;
|
|
|
|
|
|
|
|
if (bAssoc) {
|
|
|
|
if (pHT->IOTAction & HT_IOT_ACT_DISABLE_MCS15)
|
|
|
|
pCapELE->MCS[1] &= 0x7f;
|
|
|
|
|
|
|
|
if (pHT->IOTAction & HT_IOT_ACT_DISABLE_MCS14)
|
|
|
|
pCapELE->MCS[1] &= 0xbf;
|
|
|
|
|
|
|
|
if (pHT->IOTAction & HT_IOT_ACT_DISABLE_ALL_2SS)
|
|
|
|
pCapELE->MCS[1] &= 0x00;
|
|
|
|
|
|
|
|
if (pHT->IOTAction & HT_IOT_ACT_DISABLE_RX_40MHZ_SHORT_GI)
|
|
|
|
pCapELE->ShortGI40Mhz = 0;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) {
|
2011-08-23 18:00:42 -06:00
|
|
|
pCapELE->ChlWidth = 0;
|
|
|
|
pCapELE->MCS[1] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-08-25 10:48:17 -06:00
|
|
|
|
|
|
|
void HTConstructInfoElement(struct rtllib_device *ieee, u8 *posHTInfo,
|
|
|
|
u8 *len, u8 IsEncrypt)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHT = ieee->pHTInfo;
|
2011-07-18 19:31:44 -06:00
|
|
|
struct ht_info_ele *pHTInfoEle = (struct ht_info_ele *)posHTInfo;
|
2014-08-22 04:27:52 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) {
|
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_ERR, "posHTInfo or pHTInfoEle can't be "
|
|
|
|
"null in HTConstructInfoElement()\n");
|
2011-08-23 18:00:42 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(posHTInfo, 0, *len);
|
2011-08-25 10:48:17 -06:00
|
|
|
if ((ieee->iw_mode == IW_MODE_ADHOC) ||
|
|
|
|
(ieee->iw_mode == IW_MODE_MASTER)) {
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfoEle->ControlChl = ieee->current_network.channel;
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfoEle->ExtChlOffset = ((pHT->bRegBW40MHz == false) ?
|
|
|
|
HT_EXTCHNL_OFFSET_NO_EXT :
|
|
|
|
(ieee->current_network.channel <= 6)
|
|
|
|
? HT_EXTCHNL_OFFSET_UPPER :
|
|
|
|
HT_EXTCHNL_OFFSET_LOWER);
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfoEle->RecommemdedTxWidth = pHT->bRegBW40MHz;
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfoEle->RIFS = 0;
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfoEle->PSMPAccessOnly = 0;
|
|
|
|
pHTInfoEle->SrvIntGranularity = 0;
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfoEle->OptMode = pHT->CurrentOpMode;
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfoEle->NonGFDevPresent = 0;
|
|
|
|
pHTInfoEle->DualBeacon = 0;
|
|
|
|
pHTInfoEle->SecondaryBeacon = 0;
|
|
|
|
pHTInfoEle->LSigTxopProtectFull = 0;
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfoEle->PcoActive = 0;
|
|
|
|
pHTInfoEle->PcoPhase = 0;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
memset(pHTInfoEle->BasicMSC, 0, 16);
|
|
|
|
|
|
|
|
|
|
|
|
*len = 22 + 2;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
} else {
|
2011-08-23 18:00:42 -06:00
|
|
|
*len = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
void HTConstructRT2RTAggElement(struct rtllib_device *ieee, u8 *posRT2RTAgg,
|
|
|
|
u8 *len)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
if (posRT2RTAgg == NULL) {
|
2011-08-25 10:48:17 -06:00
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_ERR, "posRT2RTAgg can't be null in "
|
|
|
|
"HTConstructRT2RTAggElement()\n");
|
2011-08-23 18:00:42 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
memset(posRT2RTAgg, 0, *len);
|
|
|
|
*posRT2RTAgg++ = 0x00;
|
|
|
|
*posRT2RTAgg++ = 0xe0;
|
|
|
|
*posRT2RTAgg++ = 0x4c;
|
|
|
|
*posRT2RTAgg++ = 0x02;
|
|
|
|
*posRT2RTAgg++ = 0x01;
|
|
|
|
|
|
|
|
*posRT2RTAgg = 0x30;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (ieee->bSupportRemoteWakeUp)
|
2011-08-23 18:00:42 -06:00
|
|
|
*posRT2RTAgg |= RT_HT_CAP_USE_WOW;
|
|
|
|
|
|
|
|
*len = 6 + 2;
|
|
|
|
}
|
|
|
|
|
2011-08-25 13:07:04 -06:00
|
|
|
static u8 HT_PickMCSRate(struct rtllib_device *ieee, u8 *pOperateMCS)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-08-25 10:48:17 -06:00
|
|
|
u8 i;
|
2014-08-22 04:27:52 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (pOperateMCS == NULL) {
|
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_ERR, "pOperateMCS can't be null"
|
|
|
|
" in HT_PickMCSRate()\n");
|
2011-08-23 18:00:42 -06:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (ieee->mode) {
|
|
|
|
case IEEE_A:
|
|
|
|
case IEEE_B:
|
|
|
|
case IEEE_G:
|
2011-08-25 10:48:17 -06:00
|
|
|
for (i = 0; i <= 15; i++)
|
|
|
|
pOperateMCS[i] = 0;
|
2011-08-23 18:00:42 -06:00
|
|
|
break;
|
|
|
|
case IEEE_N_24G:
|
|
|
|
case IEEE_N_5G:
|
2011-08-25 10:48:17 -06:00
|
|
|
pOperateMCS[0] &= RATE_ADPT_1SS_MASK;
|
|
|
|
pOperateMCS[1] &= RATE_ADPT_2SS_MASK;
|
|
|
|
pOperateMCS[3] &= RATE_ADPT_MCS32_MASK;
|
2011-08-23 18:00:42 -06:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet,
|
|
|
|
u8 *pMCSFilter)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
u8 i, j;
|
|
|
|
u8 bitMap;
|
|
|
|
u8 mcsRate = 0;
|
|
|
|
u8 availableMcsRate[16];
|
2014-08-22 04:27:52 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (pMCSRateSet == NULL || pMCSFilter == NULL) {
|
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_ERR, "pMCSRateSet or pMCSFilter can't "
|
|
|
|
"be null in HTGetHighestMCSRate()\n");
|
2011-08-23 18:00:42 -06:00
|
|
|
return false;
|
|
|
|
}
|
2011-08-25 10:48:17 -06:00
|
|
|
for (i = 0; i < 16; i++)
|
2011-08-23 18:00:42 -06:00
|
|
|
availableMcsRate[i] = pMCSRateSet[i] & pMCSFilter[i];
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
for (i = 0; i < 16; i++) {
|
2011-08-23 18:00:42 -06:00
|
|
|
if (availableMcsRate[i] != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i == 16)
|
|
|
|
return false;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
if (availableMcsRate[i] != 0) {
|
2011-08-23 18:00:42 -06:00
|
|
|
bitMap = availableMcsRate[i];
|
2011-08-25 10:48:17 -06:00
|
|
|
for (j = 0; j < 8; j++) {
|
|
|
|
if ((bitMap%2) != 0) {
|
|
|
|
if (HTMcsToDataRate(ieee, (8*i+j)) >
|
|
|
|
HTMcsToDataRate(ieee, mcsRate))
|
2011-08-23 18:00:42 -06:00
|
|
|
mcsRate = (8*i+j);
|
|
|
|
}
|
2015-02-26 02:40:50 -07:00
|
|
|
bitMap >>= 1;
|
2011-08-23 18:00:42 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-08-25 10:48:17 -06:00
|
|
|
return mcsRate | 0x80;
|
2011-08-23 18:00:42 -06:00
|
|
|
}
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
u8 HTFilterMCSRate(struct rtllib_device *ieee, u8 *pSupportMCS, u8 *pOperateMCS)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
u8 i;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
for (i = 0; i <= 15; i++)
|
|
|
|
pOperateMCS[i] = ieee->Regdot11TxHTOperationalRateSet[i] &
|
|
|
|
pSupportMCS[i];
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
HT_PickMCSRate(ieee, pOperateMCS);
|
|
|
|
|
|
|
|
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
|
|
|
|
pOperateMCS[1] = 0;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
for (i = 2; i <= 15; i++)
|
2011-08-23 18:00:42 -06:00
|
|
|
pOperateMCS[i] = 0;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-08-25 10:48:17 -06:00
|
|
|
|
|
|
|
void HTSetConnectBwMode(struct rtllib_device *ieee,
|
|
|
|
enum ht_channel_width Bandwidth,
|
|
|
|
enum ht_extchnl_offset Offset);
|
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
void HTOnAssocRsp(struct rtllib_device *ieee)
|
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
2011-07-18 19:34:19 -06:00
|
|
|
struct ht_capab_ele *pPeerHTCap = NULL;
|
2011-07-18 19:31:44 -06:00
|
|
|
struct ht_info_ele *pPeerHTInfo = NULL;
|
2011-08-25 10:48:17 -06:00
|
|
|
u16 nMaxAMSDUSize = 0;
|
|
|
|
u8 *pMcsFilter = NULL;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
|
|
|
|
static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (pHTInfo->bCurrentHTSupport == false) {
|
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_ERR, "<=== HTOnAssocRsp(): "
|
|
|
|
"HT_DISABLE\n");
|
2011-08-23 18:00:42 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n");
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (!memcmp(pHTInfo->PeerHTCapBuf, EWC11NHTCap, sizeof(EWC11NHTCap)))
|
2011-07-18 19:34:19 -06:00
|
|
|
pPeerHTCap = (struct ht_capab_ele *)(&pHTInfo->PeerHTCapBuf[4]);
|
2011-08-23 18:00:42 -06:00
|
|
|
else
|
2011-07-18 19:34:19 -06:00
|
|
|
pPeerHTCap = (struct ht_capab_ele *)(pHTInfo->PeerHTCapBuf);
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
if (!memcmp(pHTInfo->PeerHTInfoBuf, EWC11NHTInfo, sizeof(EWC11NHTInfo)))
|
2011-08-25 10:48:17 -06:00
|
|
|
pPeerHTInfo = (struct ht_info_ele *)
|
|
|
|
(&pHTInfo->PeerHTInfoBuf[4]);
|
2011-08-23 18:00:42 -06:00
|
|
|
else
|
2011-07-18 19:31:44 -06:00
|
|
|
pPeerHTInfo = (struct ht_info_ele *)(pHTInfo->PeerHTInfoBuf);
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA | RTLLIB_DL_HT, pPeerHTCap,
|
|
|
|
sizeof(struct ht_capab_ele));
|
|
|
|
HTSetConnectBwMode(ieee, (enum ht_channel_width)(pPeerHTCap->ChlWidth),
|
|
|
|
(enum ht_extchnl_offset)(pPeerHTInfo->ExtChlOffset));
|
|
|
|
pHTInfo->bCurTxBW40MHz = ((pPeerHTInfo->RecommemdedTxWidth == 1) ?
|
|
|
|
true : false);
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfo->bCurShortGI20MHz = ((pHTInfo->bRegShortGI20MHz) ?
|
|
|
|
((pPeerHTCap->ShortGI20Mhz == 1) ?
|
|
|
|
true : false) : false);
|
|
|
|
pHTInfo->bCurShortGI40MHz = ((pHTInfo->bRegShortGI40MHz) ?
|
|
|
|
((pPeerHTCap->ShortGI40Mhz == 1) ?
|
|
|
|
true : false) : false);
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfo->bCurSuppCCK = ((pHTInfo->bRegSuppCCK) ?
|
|
|
|
((pPeerHTCap->DssCCk == 1) ? true :
|
|
|
|
false) : false);
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize == 0) ? 3839 : 7935;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize)
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->nCurrent_AMSDU_MaxSize = nMaxAMSDUSize;
|
|
|
|
else
|
|
|
|
pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
|
|
|
|
|
|
|
|
pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable;
|
|
|
|
if (ieee->rtllib_ap_sec_type &&
|
2011-08-25 10:48:17 -06:00
|
|
|
(ieee->rtllib_ap_sec_type(ieee)&(SEC_ALG_WEP|SEC_ALG_TKIP))) {
|
|
|
|
if ((pHTInfo->IOTPeer == HT_IOT_PEER_ATHEROS) ||
|
|
|
|
(pHTInfo->IOTPeer == HT_IOT_PEER_UNKNOWN))
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->bCurrentAMPDUEnable = false;
|
|
|
|
}
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (!pHTInfo->bRegRT2RTAggregation) {
|
2011-08-23 18:00:42 -06:00
|
|
|
if (pHTInfo->AMPDU_Factor > pPeerHTCap->MaxRxAMPDUFactor)
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfo->CurrentAMPDUFactor =
|
|
|
|
pPeerHTCap->MaxRxAMPDUFactor;
|
2011-08-23 18:00:42 -06:00
|
|
|
else
|
|
|
|
pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
|
|
|
|
|
|
|
|
} else {
|
2011-08-25 10:48:17 -06:00
|
|
|
if (ieee->current_network.bssht.bdRT2RTAggregation) {
|
|
|
|
if (ieee->pairwise_key_type != KEY_TYPE_NA)
|
|
|
|
pHTInfo->CurrentAMPDUFactor =
|
|
|
|
pPeerHTCap->MaxRxAMPDUFactor;
|
2011-08-23 18:00:42 -06:00
|
|
|
else
|
|
|
|
pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_64K;
|
2011-08-25 10:48:17 -06:00
|
|
|
} else {
|
2011-08-23 18:00:42 -06:00
|
|
|
if (pPeerHTCap->MaxRxAMPDUFactor < HT_AGG_SIZE_32K)
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfo->CurrentAMPDUFactor =
|
|
|
|
pPeerHTCap->MaxRxAMPDUFactor;
|
2011-08-23 18:00:42 -06:00
|
|
|
else
|
|
|
|
pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_32K;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity)
|
|
|
|
pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
|
|
|
|
else
|
|
|
|
pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
|
2011-08-25 10:48:17 -06:00
|
|
|
if (pHTInfo->IOTAction & HT_IOT_ACT_TX_USE_AMSDU_8K) {
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->bCurrentAMPDUEnable = false;
|
|
|
|
pHTInfo->ForcedAMSDUMode = HT_AGG_FORCE_ENABLE;
|
|
|
|
pHTInfo->ForcedAMSDUMaxSize = 7935;
|
|
|
|
}
|
|
|
|
pHTInfo->bCurRxReorderEnable = pHTInfo->bRegRxReorderEnable;
|
|
|
|
|
|
|
|
if (pPeerHTCap->MCS[0] == 0)
|
|
|
|
pPeerHTCap->MCS[0] = 0xff;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
HTIOTActDetermineRaFunc(ieee, ((pPeerHTCap->MCS[1]) != 0));
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
HTFilterMCSRate(ieee, pPeerHTCap->MCS, ieee->dot11HTOperationalRateSet);
|
|
|
|
|
|
|
|
pHTInfo->PeerMimoPs = pPeerHTCap->MimoPwrSave;
|
|
|
|
if (pHTInfo->PeerMimoPs == MIMO_PS_STATIC)
|
|
|
|
pMcsFilter = MCS_FILTER_1SS;
|
|
|
|
else
|
|
|
|
pMcsFilter = MCS_FILTER_ALL;
|
2011-08-25 10:48:17 -06:00
|
|
|
ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee,
|
|
|
|
ieee->dot11HTOperationalRateSet, pMcsFilter);
|
2011-08-23 18:00:42 -06:00
|
|
|
ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate;
|
|
|
|
|
|
|
|
pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;
|
|
|
|
}
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
void HTInitializeHTInfo(struct rtllib_device *ieee)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_HT, "===========>%s()\n", __func__);
|
|
|
|
pHTInfo->bCurrentHTSupport = false;
|
|
|
|
|
|
|
|
pHTInfo->bCurBW40MHz = false;
|
|
|
|
pHTInfo->bCurTxBW40MHz = false;
|
|
|
|
|
|
|
|
pHTInfo->bCurShortGI20MHz = false;
|
|
|
|
pHTInfo->bCurShortGI40MHz = false;
|
|
|
|
pHTInfo->bForcedShortGI = false;
|
|
|
|
|
|
|
|
pHTInfo->bCurSuppCCK = true;
|
|
|
|
|
|
|
|
pHTInfo->bCurrent_AMSDU_Support = false;
|
|
|
|
pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
|
|
|
|
pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
|
|
|
|
pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
memset((void *)(&(pHTInfo->SelfHTCap)), 0,
|
|
|
|
sizeof(pHTInfo->SelfHTCap));
|
|
|
|
memset((void *)(&(pHTInfo->SelfHTInfo)), 0,
|
|
|
|
sizeof(pHTInfo->SelfHTInfo));
|
|
|
|
memset((void *)(&(pHTInfo->PeerHTCapBuf)), 0,
|
|
|
|
sizeof(pHTInfo->PeerHTCapBuf));
|
|
|
|
memset((void *)(&(pHTInfo->PeerHTInfoBuf)), 0,
|
|
|
|
sizeof(pHTInfo->PeerHTInfoBuf));
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
pHTInfo->bSwBwInProgress = false;
|
|
|
|
pHTInfo->ChnlOp = CHNLOP_NONE;
|
|
|
|
|
|
|
|
pHTInfo->ePeerHTSpecVer = HT_SPEC_VER_IEEE;
|
|
|
|
|
|
|
|
pHTInfo->bCurrentRT2RTAggregation = false;
|
|
|
|
pHTInfo->bCurrentRT2RTLongSlotTime = false;
|
2011-07-19 18:22:37 -06:00
|
|
|
pHTInfo->RT2RT_HT_Mode = (enum rt_ht_capability)0;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
pHTInfo->IOTPeer = 0;
|
|
|
|
pHTInfo->IOTAction = 0;
|
|
|
|
pHTInfo->IOTRaFunc = 0;
|
|
|
|
|
|
|
|
{
|
2011-08-25 10:48:17 -06:00
|
|
|
u8 *RegHTSuppRateSets = &(ieee->RegHTSuppRateSet[0]);
|
2014-08-22 04:27:52 -06:00
|
|
|
|
2011-08-23 18:00:42 -06:00
|
|
|
RegHTSuppRateSets[0] = 0xFF;
|
|
|
|
RegHTSuppRateSets[1] = 0xFF;
|
|
|
|
RegHTSuppRateSets[4] = 0x01;
|
|
|
|
}
|
|
|
|
}
|
2011-08-25 10:48:17 -06:00
|
|
|
|
2011-07-18 19:26:49 -06:00
|
|
|
void HTInitializeBssDesc(struct bss_ht *pBssHT)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
|
|
|
|
|
|
|
pBssHT->bdSupportHT = false;
|
|
|
|
memset(pBssHT->bdHTCapBuf, 0, sizeof(pBssHT->bdHTCapBuf));
|
|
|
|
pBssHT->bdHTCapLen = 0;
|
|
|
|
memset(pBssHT->bdHTInfoBuf, 0, sizeof(pBssHT->bdHTInfoBuf));
|
|
|
|
pBssHT->bdHTInfoLen = 0;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
pBssHT->bdHTSpecVer = HT_SPEC_VER_IEEE;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
pBssHT->bdRT2RTAggregation = false;
|
|
|
|
pBssHT->bdRT2RTLongSlotTime = false;
|
2011-07-19 18:22:37 -06:00
|
|
|
pBssHT->RT2RT_HT_Mode = (enum rt_ht_capability)0;
|
2011-08-23 18:00:42 -06:00
|
|
|
}
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,
|
|
|
|
struct rtllib_network *pNetwork)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
2011-08-23 18:00:42 -06:00
|
|
|
u8 bIOTAction = 0;
|
|
|
|
|
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__);
|
2011-08-25 10:48:17 -06:00
|
|
|
/* unmark bEnableHT flag here is the same reason why unmarked in
|
|
|
|
* function rtllib_softmac_new_net. WB 2008.09.10*/
|
|
|
|
if (pNetwork->bssht.bdSupportHT) {
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->bCurrentHTSupport = true;
|
|
|
|
pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (pNetwork->bssht.bdHTCapLen > 0 &&
|
|
|
|
pNetwork->bssht.bdHTCapLen <= sizeof(pHTInfo->PeerHTCapBuf))
|
|
|
|
memcpy(pHTInfo->PeerHTCapBuf,
|
|
|
|
pNetwork->bssht.bdHTCapBuf,
|
|
|
|
pNetwork->bssht.bdHTCapLen);
|
|
|
|
|
|
|
|
if (pNetwork->bssht.bdHTInfoLen > 0 &&
|
|
|
|
pNetwork->bssht.bdHTInfoLen <=
|
|
|
|
sizeof(pHTInfo->PeerHTInfoBuf))
|
|
|
|
memcpy(pHTInfo->PeerHTInfoBuf,
|
|
|
|
pNetwork->bssht.bdHTInfoBuf,
|
|
|
|
pNetwork->bssht.bdHTInfoLen);
|
|
|
|
|
|
|
|
if (pHTInfo->bRegRT2RTAggregation) {
|
|
|
|
pHTInfo->bCurrentRT2RTAggregation =
|
|
|
|
pNetwork->bssht.bdRT2RTAggregation;
|
|
|
|
pHTInfo->bCurrentRT2RTLongSlotTime =
|
|
|
|
pNetwork->bssht.bdRT2RTLongSlotTime;
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->RT2RT_HT_Mode = pNetwork->bssht.RT2RT_HT_Mode;
|
2011-08-25 10:48:17 -06:00
|
|
|
} else {
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->bCurrentRT2RTAggregation = false;
|
|
|
|
pHTInfo->bCurrentRT2RTLongSlotTime = false;
|
2011-07-19 18:22:37 -06:00
|
|
|
pHTInfo->RT2RT_HT_Mode = (enum rt_ht_capability)0;
|
2011-08-23 18:00:42 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
HTIOTPeerDetermine(ieee);
|
|
|
|
|
|
|
|
pHTInfo->IOTAction = 0;
|
|
|
|
bIOTAction = HTIOTActIsDisableMCS14(ieee, pNetwork->bssid);
|
|
|
|
if (bIOTAction)
|
|
|
|
pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_MCS14;
|
|
|
|
|
|
|
|
bIOTAction = HTIOTActIsDisableMCS15(ieee);
|
|
|
|
if (bIOTAction)
|
|
|
|
pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_MCS15;
|
|
|
|
|
|
|
|
bIOTAction = HTIOTActIsDisableMCSTwoSpatialStream(ieee);
|
|
|
|
if (bIOTAction)
|
|
|
|
pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_ALL_2SS;
|
|
|
|
|
|
|
|
|
|
|
|
bIOTAction = HTIOTActIsDisableEDCATurbo(ieee, pNetwork->bssid);
|
|
|
|
if (bIOTAction)
|
|
|
|
pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_EDCA_TURBO;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
bIOTAction = HTIOTActIsMgntUseCCK6M(ieee, pNetwork);
|
2011-08-23 18:00:42 -06:00
|
|
|
if (bIOTAction)
|
|
|
|
pHTInfo->IOTAction |= HT_IOT_ACT_MGNT_USE_CCK_6M;
|
|
|
|
bIOTAction = HTIOTActIsCCDFsync(ieee);
|
|
|
|
if (bIOTAction)
|
|
|
|
pHTInfo->IOTAction |= HT_IOT_ACT_CDD_FSYNC;
|
|
|
|
} else {
|
|
|
|
pHTInfo->bCurrentHTSupport = false;
|
|
|
|
pHTInfo->bCurrentRT2RTAggregation = false;
|
|
|
|
pHTInfo->bCurrentRT2RTLongSlotTime = false;
|
2011-07-19 18:22:37 -06:00
|
|
|
pHTInfo->RT2RT_HT_Mode = (enum rt_ht_capability)0;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
pHTInfo->IOTAction = 0;
|
|
|
|
pHTInfo->IOTRaFunc = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-30 13:18:52 -07:00
|
|
|
void HT_update_self_and_peer_setting(struct rtllib_device *ieee,
|
|
|
|
struct rtllib_network *pNetwork)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
2011-08-25 10:48:17 -06:00
|
|
|
struct ht_info_ele *pPeerHTInfo =
|
|
|
|
(struct ht_info_ele *)pNetwork->bssht.bdHTInfoBuf;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
if (pHTInfo->bCurrentHTSupport) {
|
2011-08-23 18:00:42 -06:00
|
|
|
if (pNetwork->bssht.bdHTInfoLen != 0)
|
|
|
|
pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;
|
|
|
|
}
|
|
|
|
}
|
2011-11-30 13:18:52 -07:00
|
|
|
EXPORT_SYMBOL(HT_update_self_and_peer_setting);
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
void HTUseDefaultSetting(struct rtllib_device *ieee)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-07-10 17:56:20 -06:00
|
|
|
if (pHTInfo->bEnableHT) {
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->bCurrentHTSupport = true;
|
|
|
|
pHTInfo->bCurSuppCCK = pHTInfo->bRegSuppCCK;
|
|
|
|
|
|
|
|
pHTInfo->bCurBW40MHz = pHTInfo->bRegBW40MHz;
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfo->bCurShortGI20MHz = pHTInfo->bRegShortGI20MHz;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfo->bCurShortGI40MHz = pHTInfo->bRegShortGI40MHz;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
if (ieee->iw_mode == IW_MODE_ADHOC)
|
2011-08-25 10:48:17 -06:00
|
|
|
ieee->current_network.qos_data.active =
|
|
|
|
ieee->current_network.qos_data.supported;
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support;
|
|
|
|
pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
|
|
|
|
|
|
|
|
pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable;
|
|
|
|
pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
|
|
|
|
|
|
|
|
pHTInfo->CurrentMPDUDensity = pHTInfo->CurrentMPDUDensity;
|
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
HTFilterMCSRate(ieee, ieee->Regdot11TxHTOperationalRateSet,
|
|
|
|
ieee->dot11HTOperationalRateSet);
|
|
|
|
ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee,
|
|
|
|
ieee->dot11HTOperationalRateSet,
|
|
|
|
MCS_FILTER_ALL);
|
2011-08-23 18:00:42 -06:00
|
|
|
ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate;
|
|
|
|
|
2011-07-10 17:56:20 -06:00
|
|
|
} else {
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->bCurrentHTSupport = false;
|
|
|
|
}
|
|
|
|
}
|
2011-07-10 17:56:20 -06:00
|
|
|
|
2011-08-25 10:48:17 -06:00
|
|
|
u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-08-25 10:48:17 -06:00
|
|
|
if (ieee->pHTInfo->bCurrentHTSupport) {
|
|
|
|
if ((IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1) {
|
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_HT, "HT CONTROL FILED "
|
|
|
|
"EXIST!!\n");
|
2011-08-23 18:00:42 -06:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-08-25 13:07:04 -06:00
|
|
|
static void HTSetConnectBwModeCallback(struct rtllib_device *ieee)
|
2011-08-25 10:48:17 -06:00
|
|
|
{
|
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
|
|
|
|
|
|
|
RTLLIB_DEBUG(RTLLIB_DL_HT, "======>%s()\n", __func__);
|
|
|
|
if (pHTInfo->bCurBW40MHz) {
|
|
|
|
if (pHTInfo->CurSTAExtChnlOffset == HT_EXTCHNL_OFFSET_UPPER)
|
|
|
|
ieee->set_chan(ieee->dev,
|
|
|
|
ieee->current_network.channel + 2);
|
|
|
|
else if (pHTInfo->CurSTAExtChnlOffset ==
|
|
|
|
HT_EXTCHNL_OFFSET_LOWER)
|
|
|
|
ieee->set_chan(ieee->dev,
|
|
|
|
ieee->current_network.channel - 2);
|
|
|
|
else
|
|
|
|
ieee->set_chan(ieee->dev,
|
|
|
|
ieee->current_network.channel);
|
|
|
|
|
|
|
|
ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20_40,
|
|
|
|
pHTInfo->CurSTAExtChnlOffset);
|
|
|
|
} else {
|
|
|
|
ieee->set_chan(ieee->dev, ieee->current_network.channel);
|
|
|
|
ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20,
|
|
|
|
HT_EXTCHNL_OFFSET_NO_EXT);
|
|
|
|
}
|
|
|
|
|
|
|
|
pHTInfo->bSwBwInProgress = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void HTSetConnectBwMode(struct rtllib_device *ieee,
|
|
|
|
enum ht_channel_width Bandwidth,
|
|
|
|
enum ht_extchnl_offset Offset)
|
2011-08-23 18:00:42 -06:00
|
|
|
{
|
2011-07-18 19:22:19 -06:00
|
|
|
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
if (pHTInfo->bRegBW40MHz == false)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
|
2011-08-25 10:48:17 -06:00
|
|
|
Bandwidth = HT_CHANNEL_WIDTH_20;
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
if (pHTInfo->bSwBwInProgress) {
|
2014-09-19 15:10:43 -06:00
|
|
|
pr_info("%s: bSwBwInProgress!!\n", __func__);
|
2011-08-23 18:00:42 -06:00
|
|
|
return;
|
|
|
|
}
|
2011-08-25 10:48:17 -06:00
|
|
|
if (Bandwidth == HT_CHANNEL_WIDTH_20_40) {
|
|
|
|
if (ieee->current_network.channel < 2 &&
|
|
|
|
Offset == HT_EXTCHNL_OFFSET_LOWER)
|
2011-08-23 18:00:42 -06:00
|
|
|
Offset = HT_EXTCHNL_OFFSET_NO_EXT;
|
2011-08-25 10:48:17 -06:00
|
|
|
if (Offset == HT_EXTCHNL_OFFSET_UPPER ||
|
|
|
|
Offset == HT_EXTCHNL_OFFSET_LOWER) {
|
2011-08-23 18:00:42 -06:00
|
|
|
pHTInfo->bCurBW40MHz = true;
|
|
|
|
pHTInfo->CurSTAExtChnlOffset = Offset;
|
|
|
|
} else {
|
|
|
|
pHTInfo->bCurBW40MHz = false;
|
|
|
|
pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
pHTInfo->bCurBW40MHz = false;
|
|
|
|
pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT;
|
|
|
|
}
|
|
|
|
|
2014-09-19 15:10:43 -06:00
|
|
|
pr_info("%s():pHTInfo->bCurBW40MHz:%x\n", __func__,
|
2011-08-25 10:48:17 -06:00
|
|
|
pHTInfo->bCurBW40MHz);
|
2011-08-23 18:00:42 -06:00
|
|
|
|
|
|
|
pHTInfo->bSwBwInProgress = true;
|
|
|
|
|
|
|
|
HTSetConnectBwModeCallback(ieee);
|
|
|
|
}
|