📄 cmm_info.c
字号:
IRQL = DISPATCH_LEVEL Note: ========================================================================*/#ifdef CONFIG_STA_SUPPORTVOID 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_STATUS RTMPWPARemoveKeyProc( IN PRTMP_ADAPTER pAd, IN PVOID pBuf){ PNDIS_802_11_REMOVE_KEY pKey; ULONG KeyIdx; NDIS_STATUS Status = NDIS_STATUS_FAILURE; BOOLEAN bTxKey; // Set the key as transmit key BOOLEAN bPairwise; // Indicate the key is pairwise key BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value. // Otherwise, it will set by the NIC. BOOLEAN bAuthenticator; // indicate key is set by authenticator. INT i; DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n")); pKey = (PNDIS_802_11_REMOVE_KEY) pBuf; KeyIdx = pKey->KeyIndex & 0xff; // Bit 31 of Add-key, Tx Key bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE; // Bit 30 of Add-key PairwiseKey bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE; // Bit 29 of Add-key KeyRSC bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE; // Bit 28 of Add-key Authenticator bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE; // 1. If bTx is TRUE, return failure information if (bTxKey == TRUE) return(NDIS_STATUS_INVALID_DATA); // 2. Check Pairwise Key if (bPairwise) { // a. If BSSID is broadcast, remove all pairwise keys. // b. If not broadcast, remove the pairwise specified by BSSID for (i = 0; i < SHARE_KEY_NUM; i++) { if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID)) { DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i)); pAd->SharedKey[BSS0][i].KeyLen = 0; pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE; AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i); Status = NDIS_STATUS_SUCCESS; break; } } } // 3. Group Key else { // a. If BSSID is broadcast, remove all group keys indexed // b. If BSSID matched, delete the group key indexed. DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx)); pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0; pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE; AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx); Status = NDIS_STATUS_SUCCESS; } return (Status);}#endif // CONFIG_STA_SUPPORT //#ifdef CONFIG_STA_SUPPORT/* ======================================================================== Routine Description: Remove All WPA Keys Arguments: pAd Pointer to our adapter Return Value: None IRQL = DISPATCH_LEVEL Note: ========================================================================*/VOID RTMPWPARemoveAllKeys( IN PRTMP_ADAPTER pAd){ UCHAR i; DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus)); // 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. if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA) return; // For WPA-None, 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. if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) return; // set BSSID wcid entry of the Pair-wise Key table as no-security mode 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)); NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY)); AsicRemoveSharedKeyEntry(pAd, BSS0, i); }}#endif // CONFIG_STA_SUPPORT // /* ======================================================================== Routine Description: As STA's BSSID is a WC too, it uses shared key table. This function write correct unicast TX key to ASIC WCID. And we still make a copy in our MacTab.Content[BSSID_WCID].PairwiseKey. Caller guarantee TKIP/AES always has keyidx = 0. (pairwise key) Caller guarantee WEP calls this function when set Txkey, default key index=0~3. Arguments: pAd Pointer to our adapter pKey Pointer to the where the key stored Return Value: NDIS_SUCCESS Add key successfully IRQL = DISPATCH_LEVEL Note: ========================================================================*//* ======================================================================== Routine Description: Change NIC PHY mode. Re-association may be necessary. possible settings include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED Arguments: pAd - Pointer to our adapter phymode - IRQL = PASSIVE_LEVEL IRQL = DISPATCH_LEVEL ========================================================================*/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; DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));#ifdef EXT_BUILD_CHANNEL_LIST BuildChannelListEx(pAd);#else BuildChannelList(pAd);#endif // EXT_BUILD_CHANNEL_LIST // // sanity check user setting for (i = 0; i < pAd->ChannelListNum; i++) { if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel) break; } if (i == pAd->ChannelListNum) {#ifdef CONFIG_STA_SUPPORT IF_DEV_CONFIG_OPMODE_ON_STA(pAd) pAd->CommonCfg.Channel = FirstChannel(pAd);#endif // CONFIG_STA_SUPPORT // 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:#ifdef DOT11_N_SUPPORT case PHY_11N_2_4G: case PHY_11ABGN_MIXED: case PHY_11BGN_MIXED: case PHY_11GN_MIXED:#endif // DOT11_N_SUPPORT // 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:#ifdef DOT11_N_SUPPORT case PHY_11AN_MIXED: case PHY_11AGN_MIXED: case PHY_11N_5G:#endif // DOT11_N_SUPPORT // 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -