summaryrefslogtreecommitdiff
path: root/drivers/staging/rt2860/common/cmm_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/rt2860/common/cmm_info.c')
-rw-r--r--drivers/staging/rt2860/common/cmm_info.c1056
1 files changed, 527 insertions, 529 deletions
diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c
index 3c47b810355f..be01b07c543e 100644
--- a/drivers/staging/rt2860/common/cmm_info.c
+++ b/drivers/staging/rt2860/common/cmm_info.c
@@ -47,153 +47,174 @@
========================================================================
*/
-VOID RTMPSetDesiredRates(
- IN PRTMP_ADAPTER pAdapter,
- IN LONG Rates)
+VOID RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, IN LONG Rates)
{
- NDIS_802_11_RATES aryRates;
-
- memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
- switch (pAdapter->CommonCfg.PhyMode)
- {
- case PHY_11A: // A only
- switch (Rates)
- {
- case 6000000: //6M
- aryRates[0] = 0x0c; // 6M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
- break;
- case 9000000: //9M
- aryRates[0] = 0x12; // 9M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
- break;
- case 12000000: //12M
- aryRates[0] = 0x18; // 12M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
- break;
- case 18000000: //18M
- aryRates[0] = 0x24; // 18M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
- break;
- case 24000000: //24M
- aryRates[0] = 0x30; // 24M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
- break;
- case 36000000: //36M
- aryRates[0] = 0x48; // 36M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
- break;
- case 48000000: //48M
- aryRates[0] = 0x60; // 48M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
- break;
- case 54000000: //54M
- aryRates[0] = 0x6c; // 54M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
- break;
- case -1: //Auto
- default:
- aryRates[0] = 0x6c; // 54Mbps
- aryRates[1] = 0x60; // 48Mbps
- aryRates[2] = 0x48; // 36Mbps
- aryRates[3] = 0x30; // 24Mbps
- aryRates[4] = 0x24; // 18M
- aryRates[5] = 0x18; // 12M
- aryRates[6] = 0x12; // 9M
- aryRates[7] = 0x0c; // 6M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
- break;
- }
- break;
- case PHY_11BG_MIXED: // B/G Mixed
- case PHY_11B: // B only
- case PHY_11ABG_MIXED: // A/B/G Mixed
- default:
- switch (Rates)
- {
- case 1000000: //1M
- aryRates[0] = 0x02;
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
- break;
- case 2000000: //2M
- aryRates[0] = 0x04;
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
- break;
- case 5000000: //5.5M
- aryRates[0] = 0x0b; // 5.5M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
- break;
- case 11000000: //11M
- aryRates[0] = 0x16; // 11M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
- break;
- case 6000000: //6M
- aryRates[0] = 0x0c; // 6M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
- break;
- case 9000000: //9M
- aryRates[0] = 0x12; // 9M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
- break;
- case 12000000: //12M
- aryRates[0] = 0x18; // 12M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
- break;
- case 18000000: //18M
- aryRates[0] = 0x24; // 18M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
- break;
- case 24000000: //24M
- aryRates[0] = 0x30; // 24M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
- break;
- case 36000000: //36M
- aryRates[0] = 0x48; // 36M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
- break;
- case 48000000: //48M
- aryRates[0] = 0x60; // 48M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
- break;
- case 54000000: //54M
- aryRates[0] = 0x6c; // 54M
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
- break;
- case -1: //Auto
- default:
- if (pAdapter->CommonCfg.PhyMode == PHY_11B)
- { //B Only
- aryRates[0] = 0x16; // 11Mbps
- aryRates[1] = 0x0b; // 5.5Mbps
- aryRates[2] = 0x04; // 2Mbps
- aryRates[3] = 0x02; // 1Mbps
- }
- else
- { //(B/G) Mixed or (A/B/G) Mixed
- aryRates[0] = 0x6c; // 54Mbps
- aryRates[1] = 0x60; // 48Mbps
- aryRates[2] = 0x48; // 36Mbps
- aryRates[3] = 0x30; // 24Mbps
- aryRates[4] = 0x16; // 11Mbps
- aryRates[5] = 0x0b; // 5.5Mbps
- aryRates[6] = 0x04; // 2Mbps
- aryRates[7] = 0x02; // 1Mbps
- }
- pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
- break;
- }
- break;
- }
-
- NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
- NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES));
- DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
- pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1],
- pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3],
- pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5],
- pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] ));
- // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
- MlmeUpdateTxRates(pAdapter, FALSE, 0);
+ NDIS_802_11_RATES aryRates;
+
+ memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
+ switch (pAdapter->CommonCfg.PhyMode) {
+ case PHY_11A: // A only
+ switch (Rates) {
+ case 6000000: //6M
+ aryRates[0] = 0x0c; // 6M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_0;
+ break;
+ case 9000000: //9M
+ aryRates[0] = 0x12; // 9M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_1;
+ break;
+ case 12000000: //12M
+ aryRates[0] = 0x18; // 12M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_2;
+ break;
+ case 18000000: //18M
+ aryRates[0] = 0x24; // 18M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_3;
+ break;
+ case 24000000: //24M
+ aryRates[0] = 0x30; // 24M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_4;
+ break;
+ case 36000000: //36M
+ aryRates[0] = 0x48; // 36M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_5;
+ break;
+ case 48000000: //48M
+ aryRates[0] = 0x60; // 48M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_6;
+ break;
+ case 54000000: //54M
+ aryRates[0] = 0x6c; // 54M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_7;
+ break;
+ case -1: //Auto
+ default:
+ aryRates[0] = 0x6c; // 54Mbps
+ aryRates[1] = 0x60; // 48Mbps
+ aryRates[2] = 0x48; // 36Mbps
+ aryRates[3] = 0x30; // 24Mbps
+ aryRates[4] = 0x24; // 18M
+ aryRates[5] = 0x18; // 12M
+ aryRates[6] = 0x12; // 9M
+ aryRates[7] = 0x0c; // 6M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_AUTO;
+ break;
+ }
+ break;
+ case PHY_11BG_MIXED: // B/G Mixed
+ case PHY_11B: // B only
+ case PHY_11ABG_MIXED: // A/B/G Mixed
+ default:
+ switch (Rates) {
+ case 1000000: //1M
+ aryRates[0] = 0x02;
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_0;
+ break;
+ case 2000000: //2M
+ aryRates[0] = 0x04;
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_1;
+ break;
+ case 5000000: //5.5M
+ aryRates[0] = 0x0b; // 5.5M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_2;
+ break;
+ case 11000000: //11M
+ aryRates[0] = 0x16; // 11M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_3;
+ break;
+ case 6000000: //6M
+ aryRates[0] = 0x0c; // 6M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_0;
+ break;
+ case 9000000: //9M
+ aryRates[0] = 0x12; // 9M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_1;
+ break;
+ case 12000000: //12M
+ aryRates[0] = 0x18; // 12M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_2;
+ break;
+ case 18000000: //18M
+ aryRates[0] = 0x24; // 18M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_3;
+ break;
+ case 24000000: //24M
+ aryRates[0] = 0x30; // 24M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_4;
+ break;
+ case 36000000: //36M
+ aryRates[0] = 0x48; // 36M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_5;
+ break;
+ case 48000000: //48M
+ aryRates[0] = 0x60; // 48M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_6;
+ break;
+ case 54000000: //54M
+ aryRates[0] = 0x6c; // 54M
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_7;
+ break;
+ case -1: //Auto
+ default:
+ if (pAdapter->CommonCfg.PhyMode == PHY_11B) { //B Only
+ aryRates[0] = 0x16; // 11Mbps
+ aryRates[1] = 0x0b; // 5.5Mbps
+ aryRates[2] = 0x04; // 2Mbps
+ aryRates[3] = 0x02; // 1Mbps
+ } else { //(B/G) Mixed or (A/B/G) Mixed
+ aryRates[0] = 0x6c; // 54Mbps
+ aryRates[1] = 0x60; // 48Mbps
+ aryRates[2] = 0x48; // 36Mbps
+ aryRates[3] = 0x30; // 24Mbps
+ aryRates[4] = 0x16; // 11Mbps
+ aryRates[5] = 0x0b; // 5.5Mbps
+ aryRates[6] = 0x04; // 2Mbps
+ aryRates[7] = 0x02; // 1Mbps
+ }
+ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS =
+ MCS_AUTO;
+ break;
+ }
+ break;
+ }
+
+ NdisZeroMemory(pAdapter->CommonCfg.DesireRate,
+ MAX_LEN_OF_SUPPORTED_RATES);
+ NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates,
+ sizeof(NDIS_802_11_RATES));
+ DBGPRINT(RT_DEBUG_TRACE,
+ (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
+ pAdapter->CommonCfg.DesireRate[0],
+ pAdapter->CommonCfg.DesireRate[1],
+ pAdapter->CommonCfg.DesireRate[2],
+ pAdapter->CommonCfg.DesireRate[3],
+ pAdapter->CommonCfg.DesireRate[4],
+ pAdapter->CommonCfg.DesireRate[5],
+ pAdapter->CommonCfg.DesireRate[6],
+ pAdapter->CommonCfg.DesireRate[7]));
+ // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
+ MlmeUpdateTxRates(pAdapter, FALSE, 0);
}
/*
@@ -214,13 +235,14 @@ VOID RTMPSetDesiredRates(
========================================================================
*/
-VOID RTMPWPARemoveAllKeys(
- IN PRTMP_ADAPTER pAd)
+VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd)
{
- UCHAR i;
+ UCHAR i;
- DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n",
+ pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP);
// For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
// Link up. And it will be replaced if user changed it.
@@ -236,9 +258,10 @@ VOID RTMPWPARemoveAllKeys(
AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID);
// set all shared key mode as no-security.
- for (i = 0; i < SHARE_KEY_NUM; i++)
- {
- DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i));
+ for (i = 0; i < SHARE_KEY_NUM; i++) {
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("remove %s key #%d\n",
+ CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i));
NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY));
AsicRemoveSharedKeyEntry(pAd, BSS0, i);
@@ -246,7 +269,6 @@ VOID RTMPWPARemoveAllKeys(
RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP);
}
-
/*
========================================================================
@@ -285,120 +307,119 @@ VOID RTMPWPARemoveAllKeys(
========================================================================
*/
-VOID RTMPSetPhyMode(
- IN PRTMP_ADAPTER pAd,
- IN ULONG phymode)
+VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode)
{
INT i;
// the selected phymode must be supported by the RF IC encoded in E2PROM
// if no change, do nothing
/* bug fix
- if (pAd->CommonCfg.PhyMode == phymode)
- return;
- */
- pAd->CommonCfg.PhyMode = (UCHAR)phymode;
+ if (pAd->CommonCfg.PhyMode == phymode)
+ return;
+ */
+ pAd->CommonCfg.PhyMode = (UCHAR) phymode;
- DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("RTMPSetPhyMode : PhyMode=%d, channel=%d \n",
+ pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));
BuildChannelList(pAd);
// sanity check user setting
- for (i = 0; i < pAd->ChannelListNum; i++)
- {
+ for (i = 0; i < pAd->ChannelListNum; i++) {
if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel)
break;
}
- if (i == pAd->ChannelListNum)
- {
+ if (i == pAd->ChannelListNum) {
pAd->CommonCfg.Channel = FirstChannel(pAd);
- DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel));
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n",
+ pAd->CommonCfg.Channel));
}
NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES);
NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES);
NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
switch (phymode) {
- case PHY_11B:
- pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRateLen = 4;
- pAd->CommonCfg.ExtRateLen = 0;
- pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
- //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
- break;
-
- case PHY_11G:
- case PHY_11BG_MIXED:
- case PHY_11ABG_MIXED:
- case PHY_11N_2_4G:
- case PHY_11ABGN_MIXED:
- case PHY_11BGN_MIXED:
- case PHY_11GN_MIXED:
- pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.SupRateLen = 8;
- pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.ExtRateLen = 4;
- pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
- break;
-
- case PHY_11A:
- case PHY_11AN_MIXED:
- case PHY_11AGN_MIXED:
- case PHY_11N_5G:
- pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
- pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.SupRateLen = 8;
- pAd->CommonCfg.ExtRateLen = 0;
- pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
- pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
- //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
- break;
-
- default:
- break;
+ case PHY_11B:
+ pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRateLen = 4;
+ pAd->CommonCfg.ExtRateLen = 0;
+ pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
+ //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
+ break;
+
+ case PHY_11G:
+ case PHY_11BG_MIXED:
+ case PHY_11ABG_MIXED:
+ case PHY_11N_2_4G:
+ case PHY_11ABGN_MIXED:
+ case PHY_11BGN_MIXED:
+ case PHY_11GN_MIXED:
+ pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.SupRateLen = 8;
+ pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.ExtRateLen = 4;
+ pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
+ break;
+
+ case PHY_11A:
+ case PHY_11AN_MIXED:
+ case PHY_11AGN_MIXED:
+ case PHY_11N_5G:
+ pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
+ pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.SupRateLen = 8;
+ pAd->CommonCfg.ExtRateLen = 0;
+ pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
+ pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
+ //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
+ break;
+
+ default:
+ break;
}
-
pAd->CommonCfg.BandState = UNKNOWN_BAND;
}
@@ -414,34 +435,33 @@ VOID RTMPSetPhyMode(
========================================================================
*/
-VOID RTMPSetHT(
- IN PRTMP_ADAPTER pAd,
- IN OID_SET_HT_PHYMODE *pHTPhyMode)
+VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode)
{
- //ULONG *pmcs;
- UINT32 Value = 0;
- UCHAR BBPValue = 0;
- UCHAR BBP3Value = 0;
- UCHAR RxStream = pAd->CommonCfg.RxStream;
+ //ULONG *pmcs;
+ UINT32 Value = 0;
+ UCHAR BBPValue = 0;
+ UCHAR BBP3Value = 0;
+ UCHAR RxStream = pAd->CommonCfg.RxStream;
- DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
- pHTPhyMode->HtMode, pHTPhyMode->ExtOffset,
- pHTPhyMode->MCS, pHTPhyMode->BW,
- pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
+ pHTPhyMode->HtMode, pHTPhyMode->ExtOffset, pHTPhyMode->MCS,
+ pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
// Don't zero supportedHyPhy structure.
- RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability));
- RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo));
- RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset));
- RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy));
-
- if (pAd->CommonCfg.bRdg)
- {
+ RTMPZeroMemory(&pAd->CommonCfg.HtCapability,
+ sizeof(pAd->CommonCfg.HtCapability));
+ RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo,
+ sizeof(pAd->CommonCfg.AddHTInfo));
+ RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset,
+ sizeof(pAd->CommonCfg.NewExtChanOffset));
+ RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy,
+ sizeof(pAd->CommonCfg.DesiredHtPhy));
+
+ if (pAd->CommonCfg.bRdg) {
pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1;
pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1;
- }
- else
- {
+ } else {
pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0;
pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0;
}
@@ -449,89 +469,92 @@ VOID RTMPSetHT(
pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3;
pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3;
- DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit));
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("RTMPSetHT : RxBAWinLimit = %d\n",
+ pAd->CommonCfg.BACapability.field.RxBAWinLimit));
// Mimo power save, A-MSDU size,
- pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
- pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize;
- pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode;
- pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
-
- pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
- pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
- pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
-
- DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
- pAd->CommonCfg.DesiredHtPhy.AmsduSize,
- pAd->CommonCfg.DesiredHtPhy.MimoPs,
- pAd->CommonCfg.DesiredHtPhy.MpduDensity,
- pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor));
-
- if(pHTPhyMode->HtMode == HTMODE_GF)
- {
+ pAd->CommonCfg.DesiredHtPhy.AmsduEnable =
+ (USHORT) pAd->CommonCfg.BACapability.field.AmsduEnable;
+ pAd->CommonCfg.DesiredHtPhy.AmsduSize =
+ (UCHAR) pAd->CommonCfg.BACapability.field.AmsduSize;
+ pAd->CommonCfg.DesiredHtPhy.MimoPs =
+ (UCHAR) pAd->CommonCfg.BACapability.field.MMPSmode;
+ pAd->CommonCfg.DesiredHtPhy.MpduDensity =
+ (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity;
+
+ pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize =
+ (USHORT) pAd->CommonCfg.BACapability.field.AmsduSize;
+ pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs =
+ (USHORT) pAd->CommonCfg.BACapability.field.MMPSmode;
+ pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity =
+ (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity;
+
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
+ pAd->CommonCfg.DesiredHtPhy.AmsduSize,
+ pAd->CommonCfg.DesiredHtPhy.MimoPs,
+ pAd->CommonCfg.DesiredHtPhy.MpduDensity,
+ pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor));
+
+ if (pHTPhyMode->HtMode == HTMODE_GF) {
pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1;
pAd->CommonCfg.DesiredHtPhy.GF = 1;
- }
- else
+ } else
pAd->CommonCfg.DesiredHtPhy.GF = 0;
// Decide Rx MCSSet
- switch (RxStream)
- {
- case 1:
- pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
- pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00;
- break;
-
- case 2:
- pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
- pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
- break;
-
- case 3: // 3*3
- pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
- pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
- pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
- break;
+ switch (RxStream) {
+ case 1:
+ pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
+ pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00;
+ break;
+
+ case 2:
+ pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
+ pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
+ break;
+
+ case 3: // 3*3
+ pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
+ pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
+ pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
+ break;
}
- if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) )
- {
+ if (pAd->CommonCfg.bForty_Mhz_Intolerant
+ && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40)) {
pHTPhyMode->BW = BW_20;
pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1;
}
- if(pHTPhyMode->BW == BW_40)
- {
- pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
+ if (pHTPhyMode->BW == BW_40) {
+ pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1;
if (pAd->CommonCfg.Channel <= 14)
pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1;
pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1;
pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1;
- pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE;
+ pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset =
+ (pHTPhyMode->ExtOffset ==
+ EXTCHA_BELOW) ? (EXTCHA_BELOW) : EXTCHA_ABOVE;
// Set Regsiter for extension channel position.
RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value);
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value);
- if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW))
- {
+ if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW)) {
Value |= 0x1;
BBP3Value |= (0x20);
RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
- }
- else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE))
- {
+ } else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE)) {
Value &= 0xfe;
BBP3Value &= (~0x20);
RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
}
-
// Turn on BBP 40MHz mode now only as AP .
// Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd)
- )
- {
+ ) {
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
BBPValue &= (~0x18);
BBPValue |= 0x10;
@@ -540,9 +563,7 @@ VOID RTMPSetHT(
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value);
pAd->CommonCfg.BBPCurrentBW = BW_40;
}
- }
- else
- {
+ } else {
pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0;
pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0;
pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
@@ -557,28 +578,22 @@ VOID RTMPSetHT(
}
}
- if(pHTPhyMode->STBC == STBC_USE)
- {
+ if (pHTPhyMode->STBC == STBC_USE) {
pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1;
pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1;
pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1;
pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1;
- }
- else
- {
+ } else {
pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0;
}
- if(pHTPhyMode->SHORTGI == GI_400)
- {
+ if (pHTPhyMode->SHORTGI == GI_400) {
pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1;
pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1;
pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1;
pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1;
- }
- else
- {
+ } else {
pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0;
pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0;
pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0;
@@ -586,13 +601,12 @@ VOID RTMPSetHT(
}
// We support link adaptation for unsolicit MCS feedback, set to 2.
- pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
+ pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel;
// 1, the extension channel above the control channel.
// EDCA parameters used for AP's own transmission
- if (pAd->CommonCfg.APEdcaParm.bValid == FALSE)
- {
+ if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) {
pAd->CommonCfg.APEdcaParm.bValid = TRUE;
pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3;
pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7;
@@ -609,16 +623,16 @@ VOID RTMPSetHT(
pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4;
pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3;
- pAd->CommonCfg.APEdcaParm.Txop[0] = 0;
- pAd->CommonCfg.APEdcaParm.Txop[1] = 0;
- pAd->CommonCfg.APEdcaParm.Txop[2] = 94;
- pAd->CommonCfg.APEdcaParm.Txop[3] = 47;
+ pAd->CommonCfg.APEdcaParm.Txop[0] = 0;
+ pAd->CommonCfg.APEdcaParm.Txop[1] = 0;
+ pAd->CommonCfg.APEdcaParm.Txop[2] = 94;
+ pAd->CommonCfg.APEdcaParm.Txop[3] = 47;
}
AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm);
- {
- RTMPSetIndividualHT(pAd, 0);
- }
+ {
+ RTMPSetIndividualHT(pAd, 0);
+ }
}
@@ -634,112 +648,103 @@ VOID RTMPSetHT(
========================================================================
*/
-VOID RTMPSetIndividualHT(
- IN PRTMP_ADAPTER pAd,
- IN UCHAR apidx)
+VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx)
{
- PRT_HT_PHY_INFO pDesired_ht_phy = NULL;
- UCHAR TxStream = pAd->CommonCfg.TxStream;
- UCHAR DesiredMcs = MCS_AUTO;
+ PRT_HT_PHY_INFO pDesired_ht_phy = NULL;
+ UCHAR TxStream = pAd->CommonCfg.TxStream;
+ UCHAR DesiredMcs = MCS_AUTO;
- do
- {
+ do {
{
pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo;
- DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS;
+ DesiredMcs =
+ pAd->StaCfg.DesiredTransmitSetting.field.MCS;
//pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
- break;
+ break;
}
} while (FALSE);
- if (pDesired_ht_phy == NULL)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx));
+ if (pDesired_ht_phy == NULL) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx));
return;
}
RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO));
- DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
// Check the validity of MCS
- if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15)))
- {
- DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs));
+ if ((TxStream == 1)
+ && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15))) {
+ DBGPRINT(RT_DEBUG_WARN,
+ ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n",
+ DesiredMcs));
DesiredMcs = MCS_7;
}
- if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32))
- {
- DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
+ if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20)
+ && (DesiredMcs == MCS_32)) {
+ DBGPRINT(RT_DEBUG_WARN,
+ ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
DesiredMcs = MCS_0;
}
pDesired_ht_phy->bHtEnable = TRUE;
// Decide desired Tx MCS
- switch (TxStream)
- {
- case 1:
- if (DesiredMcs == MCS_AUTO)
- {
- pDesired_ht_phy->MCSSet[0]= 0xff;
- pDesired_ht_phy->MCSSet[1]= 0x00;
- }
- else if (DesiredMcs <= MCS_7)
- {
- pDesired_ht_phy->MCSSet[0]= 1<<DesiredMcs;
- pDesired_ht_phy->MCSSet[1]= 0x00;
- }
- break;
-
- case 2:
- if (DesiredMcs == MCS_AUTO)
- {
- pDesired_ht_phy->MCSSet[0]= 0xff;
- pDesired_ht_phy->MCSSet[1]= 0xff;
- }
- else if (DesiredMcs <= MCS_15)
- {
- ULONG mode;
-
- mode = DesiredMcs / 8;
- if (mode < 2)
- pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
- }
- break;
-
- case 3: // 3*3
- if (DesiredMcs == MCS_AUTO)
- {
- /* MCS0 ~ MCS23, 3 bytes */
- pDesired_ht_phy->MCSSet[0]= 0xff;
- pDesired_ht_phy->MCSSet[1]= 0xff;
- pDesired_ht_phy->MCSSet[2]= 0xff;
- }
- else if (DesiredMcs <= MCS_23)
- {
- ULONG mode;
-
- mode = DesiredMcs / 8;
- if (mode < 3)
- pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
- }
- break;
+ switch (TxStream) {
+ case 1:
+ if (DesiredMcs == MCS_AUTO) {
+ pDesired_ht_phy->MCSSet[0] = 0xff;
+ pDesired_ht_phy->MCSSet[1] = 0x00;
+ } else if (DesiredMcs <= MCS_7) {
+ pDesired_ht_phy->MCSSet[0] = 1 << DesiredMcs;
+ pDesired_ht_phy->MCSSet[1] = 0x00;
+ }
+ break;
+
+ case 2:
+ if (DesiredMcs == MCS_AUTO) {
+ pDesired_ht_phy->MCSSet[0] = 0xff;
+ pDesired_ht_phy->MCSSet[1] = 0xff;
+ } else if (DesiredMcs <= MCS_15) {
+ ULONG mode;
+
+ mode = DesiredMcs / 8;
+ if (mode < 2)
+ pDesired_ht_phy->MCSSet[mode] =
+ (1 << (DesiredMcs - mode * 8));
+ }
+ break;
+
+ case 3: // 3*3
+ if (DesiredMcs == MCS_AUTO) {
+ /* MCS0 ~ MCS23, 3 bytes */
+ pDesired_ht_phy->MCSSet[0] = 0xff;
+ pDesired_ht_phy->MCSSet[1] = 0xff;
+ pDesired_ht_phy->MCSSet[2] = 0xff;
+ } else if (DesiredMcs <= MCS_23) {
+ ULONG mode;
+
+ mode = DesiredMcs / 8;
+ if (mode < 3)
+ pDesired_ht_phy->MCSSet[mode] =
+ (1 << (DesiredMcs - mode * 8));
+ }
+ break;
}
- if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40)
- {
+ if (pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40) {
if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32)
pDesired_ht_phy->MCSSet[4] = 0x1;
}
-
// update HT Rate setting
- if (pAd->OpMode == OPMODE_STA)
- MlmeUpdateHtTxRates(pAd, BSS0);
- else
- MlmeUpdateHtTxRates(pAd, apidx);
+ if (pAd->OpMode == OPMODE_STA)
+ MlmeUpdateHtTxRates(pAd, BSS0);
+ else
+ MlmeUpdateHtTxRates(pAd, apidx);
}
-
/*
========================================================================
Routine Description:
@@ -748,36 +753,34 @@ VOID RTMPSetIndividualHT(
Arguments:
Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
-
========================================================================
*/
-VOID RTMPUpdateHTIE(
- IN RT_HT_CAPABILITY *pRtHt,
- IN UCHAR *pMcsSet,
- OUT HT_CAPABILITY_IE *pHtCapability,
- OUT ADD_HT_INFO_IE *pAddHtInfo)
+VOID RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt,
+ IN UCHAR * pMcsSet,
+ OUT HT_CAPABILITY_IE * pHtCapability,
+ OUT ADD_HT_INFO_IE * pAddHtInfo)
{
RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE));
RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE));
- pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth;
- pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs;
- pHtCapability->HtCapInfo.GF = pRtHt->GF;
- pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20;
- pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40;
- pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC;
- pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC;
- pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize;
- pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor;
- pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity;
-
- pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ;
- pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
- pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
- pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
- RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
-
- DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n"));
+ pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth;
+ pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs;
+ pHtCapability->HtCapInfo.GF = pRtHt->GF;
+ pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20;
+ pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40;
+ pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC;
+ pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC;
+ pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize;
+ pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor;
+ pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity;
+
+ pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset;
+ pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
+ pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
+ pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
+ RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet */ pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
+
+ DBGPRINT(RT_DEBUG_TRACE, ("RTMPUpdateHTIE <== \n"));
}
/*
@@ -787,29 +790,27 @@ VOID RTMPUpdateHTIE(
Return:
========================================================================
*/
-VOID RTMPAddWcidAttributeEntry(
- IN PRTMP_ADAPTER pAd,
- IN UCHAR BssIdx,
- IN UCHAR KeyIdx,
- IN UCHAR CipherAlg,
- IN MAC_TABLE_ENTRY *pEntry)
+VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd,
+ IN UCHAR BssIdx,
+ IN UCHAR KeyIdx,
+ IN UCHAR CipherAlg, IN MAC_TABLE_ENTRY * pEntry)
{
- UINT32 WCIDAttri = 0;
- USHORT offset;
- UCHAR IVEIV = 0;
- USHORT Wcid = 0;
+ UINT32 WCIDAttri = 0;
+ USHORT offset;
+ UCHAR IVEIV = 0;
+ USHORT Wcid = 0;
{
{
- if (BssIdx > BSS0)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx));
+ if (BssIdx > BSS0) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n",
+ BssIdx));
return;
}
-
- // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
- // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
- // the AID:2~ assign to mesh link entry.
+ // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
+ // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
+ // the AID:2~ assign to mesh link entry.
if (pEntry)
Wcid = pEntry->Aid;
else
@@ -822,39 +823,38 @@ VOID RTMPAddWcidAttributeEntry(
{
if (pEntry && pEntry->ValidAsMesh)
- WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE;
+ WCIDAttri = (CipherAlg << 1) | PAIRWISEKEYTABLE;
else
- WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE;
+ WCIDAttri = (CipherAlg << 1) | SHAREDKEYTABLE;
}
RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
-
// Update IV/EIV table
offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
// WPA mode
- if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES))
- {
+ if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC)
+ || (CipherAlg == CIPHER_AES)) {
// Eiv bit on. keyid always is 0 for pairwise key
- IVEIV = (KeyIdx <<6) | 0x20;
- }
- else
- {
+ IVEIV = (KeyIdx << 6) | 0x20;
+ } else {
// WEP KeyIdx is default tx key.
IVEIV = (KeyIdx << 6);
}
// For key index and ext IV bit, so only need to update the position(offset+3).
#ifdef RTMP_MAC_PCI
- RTMP_IO_WRITE8(pAd, offset+3, IVEIV);
+ RTMP_IO_WRITE8(pAd, offset + 3, IVEIV);
#endif // RTMP_MAC_PCI //
#ifdef RTMP_MAC_USB
- RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV);
+ RTUSBMultiWrite_OneByte(pAd, offset + 3, &IVEIV);
#endif // RTMP_MAC_USB //
- DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg]));
- DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri));
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",
+ Wcid, KeyIdx, CipherName[CipherAlg]));
+ DBGPRINT(RT_DEBUG_TRACE, (" WCIDAttri = 0x%x \n", WCIDAttri));
}
@@ -874,84 +874,82 @@ Arguments:
*/
PSTRING GetEncryptType(CHAR enc)
{
- if(enc == Ndis802_11WEPDisabled)
- return "NONE";
- if(enc == Ndis802_11WEPEnabled)
- return "WEP";
- if(enc == Ndis802_11Encryption2Enabled)
- return "TKIP";
- if(enc == Ndis802_11Encryption3Enabled)
- return "AES";
- if(enc == Ndis802_11Encryption4Enabled)
- return "TKIPAES";
- else
- return "UNKNOW";
+ if (enc == Ndis802_11WEPDisabled)
+ return "NONE";
+ if (enc == Ndis802_11WEPEnabled)
+ return "WEP";
+ if (enc == Ndis802_11Encryption2Enabled)
+ return "TKIP";
+ if (enc == Ndis802_11Encryption3Enabled)
+ return "AES";
+ if (enc == Ndis802_11Encryption4Enabled)
+ return "TKIPAES";
+ else
+ return "UNKNOW";
}
PSTRING GetAuthMode(CHAR auth)
{
- if(auth == Ndis802_11AuthModeOpen)
- return "OPEN";
- if(auth == Ndis802_11AuthModeShared)
- return "SHARED";
- if(auth == Ndis802_11AuthModeAutoSwitch)
- return "AUTOWEP";
- if(auth == Ndis802_11AuthModeWPA)
- return "WPA";
- if(auth == Ndis802_11AuthModeWPAPSK)
- return "WPAPSK";
- if(auth == Ndis802_11AuthModeWPANone)
- return "WPANONE";
- if(auth == Ndis802_11AuthModeWPA2)
- return "WPA2";
- if(auth == Ndis802_11AuthModeWPA2PSK)
- return "WPA2PSK";
- if(auth == Ndis802_11AuthModeWPA1WPA2)
- return "WPA1WPA2";
- if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK)
- return "WPA1PSKWPA2PSK";
-
- return "UNKNOW";
+ if (auth == Ndis802_11AuthModeOpen)
+ return "OPEN";
+ if (auth == Ndis802_11AuthModeShared)
+ return "SHARED";
+ if (auth == Ndis802_11AuthModeAutoSwitch)
+ return "AUTOWEP";
+ if (auth == Ndis802_11AuthModeWPA)
+ return "WPA";
+ if (auth == Ndis802_11AuthModeWPAPSK)
+ return "WPAPSK";
+ if (auth == Ndis802_11AuthModeWPANone)
+ return "WPANONE";
+ if (auth == Ndis802_11AuthModeWPA2)
+ return "WPA2";
+ if (auth == Ndis802_11AuthModeWPA2PSK)
+ return "WPA2PSK";
+ if (auth == Ndis802_11AuthModeWPA1WPA2)
+ return "WPA1WPA2";
+ if (auth == Ndis802_11AuthModeWPA1PSKWPA2PSK)
+ return "WPA1PSKWPA2PSK";
+
+ return "UNKNOW";
}
-INT SetCommonHT(
- IN PRTMP_ADAPTER pAd)
+INT SetCommonHT(IN PRTMP_ADAPTER pAd)
{
- OID_SET_HT_PHYMODE SetHT;
+ OID_SET_HT_PHYMODE SetHT;
if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED)
return FALSE;
SetHT.PhyMode = pAd->CommonCfg.PhyMode;
- SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath);
- SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
- SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
+ SetHT.TransmitNo = ((UCHAR) pAd->Antenna.field.TxPath);
+ SetHT.HtMode = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
+ SetHT.ExtOffset =
+ (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
SetHT.MCS = MCS_AUTO;
- SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW;
- SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC;
- SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
+ SetHT.BW = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.BW;
+ SetHT.STBC = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.STBC;
+ SetHT.SHORTGI = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
RTMPSetHT(pAd, &SetHT);
return TRUE;
}
-PSTRING RTMPGetRalinkEncryModeStr(
- IN USHORT encryMode)
+PSTRING RTMPGetRalinkEncryModeStr(IN USHORT encryMode)
{
- switch(encryMode)
- {
- case Ndis802_11WEPDisabled:
- return "NONE";
- case Ndis802_11WEPEnabled:
- return "WEP";
- case Ndis802_11Encryption2Enabled:
- return "TKIP";
- case Ndis802_11Encryption3Enabled:
- return "AES";
- case Ndis802_11Encryption4Enabled:
- return "TKIPAES";
- default:
- return "UNKNOW";
+ switch (encryMode) {
+ case Ndis802_11WEPDisabled:
+ return "NONE";
+ case Ndis802_11WEPEnabled:
+ return "WEP";
+ case Ndis802_11Encryption2Enabled:
+ return "TKIP";
+ case Ndis802_11Encryption3Enabled:
+ return "AES";
+ case Ndis802_11Encryption4Enabled:
+ return "TKIPAES";
+ default:
+ return "UNKNOW";
}
}