From: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx> --- drivers/staging/rt2860/common/cmm_info.c | 2448 ------------------------------ drivers/staging/rt2860/rtmp.h | 204 --- drivers/staging/rt2860/sta_ioctl.c | 1305 +---------------- 3 files changed, 1 insertions(+), 3956 deletions(-) diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c index 0f4aab9..3c47b81 100644 --- a/drivers/staging/rt2860/common/cmm_info.c +++ b/drivers/staging/rt2860/common/cmm_info.c @@ -28,801 +28,6 @@ #include <linux/sched.h> #include "../rt_config.h" -INT Show_SSID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Channel_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_CountryCode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -#ifdef AGGREGATION_SUPPORT -INT Show_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); -#endif // AGGREGATION_SUPPORT // - -#ifdef WMM_SUPPORT -INT Show_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); -#endif // WMM_SUPPORT // - -INT Show_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_NetworkType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_AuthMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_EncrypType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key1_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key2_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key3_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key4_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_WPAPSK_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -static struct { - PSTRING name; - INT (*show_proc)(PRTMP_ADAPTER pAdapter, PSTRING arg); -} *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = { - {"SSID", Show_SSID_Proc}, - {"WirelessMode", Show_WirelessMode_Proc}, - {"TxBurst", Show_TxBurst_Proc}, - {"TxPreamble", Show_TxPreamble_Proc}, - {"TxPower", Show_TxPower_Proc}, - {"Channel", Show_Channel_Proc}, - {"BGProtection", Show_BGProtection_Proc}, - {"RTSThreshold", Show_RTSThreshold_Proc}, - {"FragThreshold", Show_FragThreshold_Proc}, - {"HtBw", Show_HtBw_Proc}, - {"HtMcs", Show_HtMcs_Proc}, - {"HtGi", Show_HtGi_Proc}, - {"HtOpMode", Show_HtOpMode_Proc}, - {"HtExtcha", Show_HtExtcha_Proc}, - {"HtMpduDensity", Show_HtMpduDensity_Proc}, - {"HtBaWinSize", Show_HtBaWinSize_Proc}, - {"HtRdg", Show_HtRdg_Proc}, - {"HtAmsdu", Show_HtAmsdu_Proc}, - {"HtAutoBa", Show_HtAutoBa_Proc}, - {"CountryRegion", Show_CountryRegion_Proc}, - {"CountryRegionABand", Show_CountryRegionABand_Proc}, - {"CountryCode", Show_CountryCode_Proc}, -#ifdef AGGREGATION_SUPPORT - {"PktAggregate", Show_PktAggregate_Proc}, -#endif - -#ifdef WMM_SUPPORT - {"WmmCapable", Show_WmmCapable_Proc}, -#endif - {"IEEE80211H", Show_IEEE80211H_Proc}, - {"NetworkType", Show_NetworkType_Proc}, - {"AuthMode", Show_AuthMode_Proc}, - {"EncrypType", Show_EncrypType_Proc}, - {"DefaultKeyID", Show_DefaultKeyID_Proc}, - {"Key1", Show_Key1_Proc}, - {"Key2", Show_Key2_Proc}, - {"Key3", Show_Key3_Proc}, - {"Key4", Show_Key4_Proc}, - {"WPAPSK", Show_WPAPSK_Proc}, - {NULL, NULL} -}; - -/* - ========================================================================== - Description: - Get Driver version. - - Return: - ========================================================================== -*/ -INT Set_DriverVersion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Country Region. - This command will not work, if the field of CountryRegion in eeprom is programmed. - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int retval; - - - retval = RT_CfgSetCountryRegion(pAd, arg, BAND_24G); - if (retval == FALSE) - return FALSE; - - // if set country region, driver needs to be reset - BuildChannelList(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegion)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Country Region for A band. - This command will not work, if the field of CountryRegion in eeprom is programmed. - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int retval; - - - retval = RT_CfgSetCountryRegion(pAd, arg, BAND_5G); - if (retval == FALSE) - return FALSE; - - // if set country region, driver needs to be reset - BuildChannelList(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegionABand_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegionForABand)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Wireless Mode - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - INT success = TRUE; - - success = RT_CfgSetWirelessMode(pAd, arg); - if (success) - { - { - LONG WirelessMode = pAd->CommonCfg.PhyMode; - - RTMPSetPhyMode(pAd, WirelessMode); - if (WirelessMode >= PHY_11ABGN_MIXED) - { - pAd->CommonCfg.BACapability.field.AutoBA = TRUE; - pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE; - } - else - { - pAd->CommonCfg.BACapability.field.AutoBA = FALSE; - pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE; - } - - // Set AdhocMode rates - if (pAd->StaCfg.BssType == BSS_ADHOC) - { - MlmeUpdateTxRates(pAd, FALSE, 0); - MakeIbssBeacon(pAd); // re-build BEACON frame - AsicEnableIbssSync(pAd); // copy to on-chip memory - } - } - - // it is needed to set SSID to take effect - SetCommonHT(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%d)\n", pAd->CommonCfg.PhyMode)); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n")); - } - - return success; -} - -/* - ========================================================================== - Description: - Set Channel - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Channel_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - INT success = TRUE; - UCHAR Channel; - - Channel = (UCHAR) simple_strtol(arg, 0, 10); - - // check if this channel is valid - if (ChannelSanity(pAd, Channel) == TRUE) - { - { - pAd->CommonCfg.Channel = Channel; - - if (MONITOR_ON(pAd)) - { - N_ChannelCheck(pAd); - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && - pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) - { - N_SetCenCh(pAd); - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n", - pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel)); - } - else - { - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel)); - } - } - } - success = TRUE; - } - else - { - success = FALSE; - } - - - if (success == TRUE) - DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel)); - - return success; -} - -/* - ========================================================================== - Description: - Set Short Slot Time Enable or Disable - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_ShortSlot_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int retval; - - retval = RT_CfgSetShortSlot(pAd, arg); - if (retval == TRUE) - DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime)); - - return retval; -} - - -/* - ========================================================================== - Description: - Set Tx power - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG TxPower; - INT success = FALSE; - - TxPower = simple_strtol(arg, 0, 10); - if (TxPower <= 100) - { - { - pAd->CommonCfg.TxPowerDefault = TxPower; - pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; - } - success = TRUE; - } - else - success = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage)); - - return success; -} - -/* - ========================================================================== - Description: - Set 11B/11G Protection - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - switch (simple_strtol(arg, 0, 10)) - { - case 0: //AUTO - pAd->CommonCfg.UseBGProtection = 0; - break; - case 1: //Always On - pAd->CommonCfg.UseBGProtection = 1; - break; - case 2: //Always OFF - pAd->CommonCfg.UseBGProtection = 2; - break; - default: //Invalid argument - return FALSE; - } - - - DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set TxPreamble - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - RT_802_11_PREAMBLE Preamble; - - Preamble = simple_strtol(arg, 0, 10); - - - switch (Preamble) - { - case Rt802_11PreambleShort: - pAd->CommonCfg.TxPreamble = Preamble; - - MlmeSetTxPreamble(pAd, Rt802_11PreambleShort); - break; - case Rt802_11PreambleLong: - case Rt802_11PreambleAuto: - // if user wants AUTO, initialize to LONG here, then change according to AP's - // capability upon association. - pAd->CommonCfg.TxPreamble = Preamble; - - MlmeSetTxPreamble(pAd, Rt802_11PreambleLong); - break; - default: //Invalid argument - return FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set RTS Threshold - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - NDIS_802_11_RTS_THRESHOLD RtsThresh; - - RtsThresh = simple_strtol(arg, 0, 10); - - if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD)) - pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh; - else if (RtsThresh == 0) - pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Fragment Threshold - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh; - - FragThresh = simple_strtol(arg, 0, 10); - - if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD) - { - //Illegal FragThresh so we set it to default - pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD; - } - else if (FragThresh % 2 == 1) - { - // The length of each fragment shall always be an even number of octets, except for the last fragment - // of an MSDU or MMPDU, which may be either an even or an odd number of octets. - pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1); - } - else - { - pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh; - } - - { - if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD) - pAd->CommonCfg.bUseZeroToDisableFragment = TRUE; - else - pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set TxBurst - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG TxBurst; - - TxBurst = simple_strtol(arg, 0, 10); - if (TxBurst == 1) - pAd->CommonCfg.bEnableTxBurst = TRUE; - else if (TxBurst == 0) - pAd->CommonCfg.bEnableTxBurst = FALSE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst)); - - return TRUE; -} - -#ifdef AGGREGATION_SUPPORT -/* - ========================================================================== - Description: - Set TxBurst - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG aggre; - - aggre = simple_strtol(arg, 0, 10); - - if (aggre == 1) - pAd->CommonCfg.bAggregationCapable = TRUE; - else if (aggre == 0) - pAd->CommonCfg.bAggregationCapable = FALSE; - else - return FALSE; //Invalid argument - - - DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable)); - - return TRUE; -} -#endif - -/* - ========================================================================== - Description: - Set IEEE80211H. - This parameter is 1 when needs radar detection, otherwise 0 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG ieee80211h; - - ieee80211h = simple_strtol(arg, 0, 10); - - if (ieee80211h == 1) - pAd->CommonCfg.bIEEE80211H = TRUE; - else if (ieee80211h == 0) - pAd->CommonCfg.bIEEE80211H = FALSE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H)); - - return TRUE; -} - - -#ifdef DBG -/* - ========================================================================== - Description: - For Debug information - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Debug_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n")); - - if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD) - RTDebugLevel = simple_strtol(arg, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel)); - - return TRUE; -} -#endif - -INT Show_DescInfo_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ -#ifdef RTMP_MAC_PCI - INT i, QueIdx=0; -// ULONG RegValue; - PRT28XX_RXD_STRUC pRxD; - PTXD_STRUC pTxD; - PRTMP_TX_RING pTxRing = &pAd->TxRing[QueIdx]; - PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; - PRTMP_RX_RING pRxRing = &pAd->RxRing; - - for(i=0;i<TX_RING_SIZE;i++) - { - pTxD = (PTXD_STRUC) pTxRing->Cell[i].AllocVa; - DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); - hex_dump("Tx Descriptor", (PUCHAR)pTxD, 16); - DBGPRINT(RT_DEBUG_OFF, ("pTxD->DMADONE = %x\n", pTxD->DMADONE)); - } - DBGPRINT(RT_DEBUG_OFF, ("---------------------------------------------------\n")); - for(i=0;i<MGMT_RING_SIZE;i++) - { - pTxD = (PTXD_STRUC) pMgmtRing->Cell[i].AllocVa; - DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); - hex_dump("Mgmt Descriptor", (PUCHAR)pTxD, 16); - DBGPRINT(RT_DEBUG_OFF, ("pMgmt->DMADONE = %x\n", pTxD->DMADONE)); - } - DBGPRINT(RT_DEBUG_OFF, ("---------------------------------------------------\n")); - for(i=0;i<RX_RING_SIZE;i++) - { - pRxD = (PRT28XX_RXD_STRUC) pRxRing->Cell[i].AllocVa; - DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); - hex_dump("Rx Descriptor", (PUCHAR)pRxD, 16); - DBGPRINT(RT_DEBUG_OFF, ("pRxD->DDONE = %x\n", pRxD->DDONE)); - } -#endif // RTMP_MAC_PCI // - - return TRUE; -} - -/* - ========================================================================== - Description: - Reset statistics counter - - Arguments: - pAdapter Pointer to our adapter - arg - - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_ResetStatCounter_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - //UCHAR i; - //MAC_TABLE_ENTRY *pEntry; - - DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n")); - - // add the most up-to-date h/w raw counters into software counters - NICUpdateRawCounters(pAd); - - NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11)); - NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3)); - NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK)); - - // Reset HotSpot counter - - - return TRUE; -} - -/* - ======================================================================== - - Routine Description: - Add WPA key process. - In Adhoc WPANONE, bPairwise = 0; KeyIdx = 0; - - Arguments: - pAd Pointer to our adapter - pBuf Pointer to the where the key stored - - Return Value: - NDIS_SUCCESS Add key successfully - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ - -BOOLEAN RTMPCheckStrPrintAble( - IN CHAR *pInPutStr, - IN UCHAR strLen) -{ - UCHAR i=0; - - for (i=0; i<strLen; i++) - { - if ((pInPutStr[i] < 0x21) || - (pInPutStr[i] > 0x7E)) - return FALSE; - } - - return TRUE; -} - /* ======================================================================== @@ -991,70 +196,6 @@ VOID RTMPSetDesiredRates( 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); -} - /* ======================================================================== @@ -1773,1004 +914,6 @@ PSTRING GetAuthMode(CHAR auth) return "UNKNOW"; } -/* - ========================================================================== - Description: - Get site survey results - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) UI needs to wait 4 seconds after issue a site survey command - 2.) iwpriv ra0 get_site_survey - 3.) UI needs to prepare at least 4096bytes to get the results - ========================================================================== -*/ -#define LINE_LEN (4+33+20+23+9+7+7+3) // Channel+SSID+Bssid+Security+Signal+WiressMode+ExtCh+NetworkType -VOID RTMPCommSiteSurveyData( - IN PSTRING msg, - IN PBSS_ENTRY pBss) -{ - INT Rssi = 0; - UINT Rssi_Quality = 0; - NDIS_802_11_NETWORK_TYPE wireless_mode; - CHAR Ssid[MAX_LEN_OF_SSID +1]; - STRING SecurityStr[32] = {0}; - NDIS_802_11_ENCRYPTION_STATUS ap_cipher = Ndis802_11EncryptionDisabled; - NDIS_802_11_AUTHENTICATION_MODE ap_auth_mode = Ndis802_11AuthModeOpen; - - memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1)); - - //Channel - sprintf(msg+strlen(msg),"%-4d", pBss->Channel); - //SSID - memcpy(Ssid, pBss->Ssid, pBss->SsidLen); - Ssid[pBss->SsidLen] = '\0'; - sprintf(msg+strlen(msg),"%-33s", Ssid); - //BSSID - sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ", - pBss->Bssid[0], - pBss->Bssid[1], - pBss->Bssid[2], - pBss->Bssid[3], - pBss->Bssid[4], - pBss->Bssid[5]); - - //Security - if ((Ndis802_11AuthModeWPA <= pBss->AuthMode) && - (pBss->AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) - { - if (pBss->AuthModeAux == Ndis802_11AuthModeWPANone) - { - ap_auth_mode = pBss->AuthMode; - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - ap_cipher = pBss->WPA.PairCipher; - else - ap_cipher = Ndis802_11Encryption4Enabled; - } - else if (pBss->AuthModeAux == Ndis802_11AuthModeOpen) - { - ap_auth_mode = pBss->AuthMode; - if ((ap_auth_mode == Ndis802_11AuthModeWPA) || - (ap_auth_mode == Ndis802_11AuthModeWPAPSK)) - { - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - ap_cipher = pBss->WPA.PairCipher; - else - ap_cipher = Ndis802_11Encryption4Enabled; - } - else if ((ap_auth_mode == Ndis802_11AuthModeWPA2) || - (ap_auth_mode == Ndis802_11AuthModeWPA2PSK)) - { - if (pBss->WPA2.PairCipherAux == Ndis802_11WEPDisabled) - ap_cipher = pBss->WPA2.PairCipher; - else - ap_cipher = Ndis802_11Encryption4Enabled; - } - } - else if ((pBss->AuthMode == Ndis802_11AuthModeWPAPSK) || - (pBss->AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - if ((pBss->AuthModeAux == Ndis802_11AuthModeWPAPSK) || - (pBss->AuthModeAux == Ndis802_11AuthModeWPA2PSK)) - ap_auth_mode = Ndis802_11AuthModeWPA1PSKWPA2PSK; - else - ap_auth_mode = pBss->AuthMode; - - if (pBss->WPA.PairCipher != pBss->WPA2.PairCipher) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux != pBss->WPA2.PairCipherAux)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux != Ndis802_11WEPDisabled)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled)) - ap_cipher = pBss->WPA.PairCipher; - } - else if ((pBss->AuthMode == Ndis802_11AuthModeWPA) || - (pBss->AuthMode == Ndis802_11AuthModeWPA2)) - { - if ((pBss->AuthModeAux == Ndis802_11AuthModeWPA) || - (pBss->AuthMode == Ndis802_11AuthModeWPA2)) - ap_auth_mode = Ndis802_11AuthModeWPA1WPA2; - else - ap_auth_mode = pBss->AuthMode; - - if (pBss->WPA.PairCipher != pBss->WPA2.PairCipher) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux != pBss->WPA2.PairCipherAux)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux != Ndis802_11WEPDisabled)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled)) - ap_cipher = pBss->WPA.PairCipher; - } - - sprintf(SecurityStr, "%s/%s", GetAuthMode((CHAR)ap_auth_mode), GetEncryptType((CHAR)ap_cipher)); - } - else - { - ap_auth_mode = pBss->AuthMode; - ap_cipher = pBss->WepStatus; - if (ap_cipher == Ndis802_11WEPDisabled) - sprintf(SecurityStr, "NONE"); - else if (ap_cipher == Ndis802_11WEPEnabled) - sprintf(SecurityStr, "WEP"); - else - sprintf(SecurityStr, "%s/%s", GetAuthMode((CHAR)ap_auth_mode), GetEncryptType((CHAR)ap_cipher)); - } - - sprintf(msg+strlen(msg), "%-23s", SecurityStr); - - // Rssi - Rssi = (INT)pBss->Rssi; - if (Rssi >= -50) - Rssi_Quality = 100; - else if (Rssi >= -80) // between -50 ~ -80dbm - Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10); - else if (Rssi >= -90) // between -80 ~ -90dbm - Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10); - else // < -84 dbm - Rssi_Quality = 0; - sprintf(msg+strlen(msg),"%-9d", Rssi_Quality); - // Wireless Mode - wireless_mode = NetworkTypeInUseSanity(pBss); - if (wireless_mode == Ndis802_11FH || - wireless_mode == Ndis802_11DS) - sprintf(msg+strlen(msg),"%-7s", "11b"); - else if (wireless_mode == Ndis802_11OFDM5) - sprintf(msg+strlen(msg),"%-7s", "11a"); - else if (wireless_mode == Ndis802_11OFDM5_N) - sprintf(msg+strlen(msg),"%-7s", "11a/n"); - else if (wireless_mode == Ndis802_11OFDM24) - sprintf(msg+strlen(msg),"%-7s", "11b/g"); - else if (wireless_mode == Ndis802_11OFDM24_N) - sprintf(msg+strlen(msg),"%-7s", "11b/g/n"); - else - sprintf(msg+strlen(msg),"%-7s", "unknow"); - - // Ext Channel - if (pBss->AddHtInfoLen > 0) - { - if (pBss->AddHtInfo.AddHtInfo.ExtChanOffset == EXTCHA_ABOVE) - sprintf(msg+strlen(msg),"%-7s", " ABOVE"); - else if (pBss->AddHtInfo.AddHtInfo.ExtChanOffset == EXTCHA_BELOW) - sprintf(msg+strlen(msg),"%-7s", " BELOW"); - else - sprintf(msg+strlen(msg),"%-7s", " NONE"); - } - else - { - sprintf(msg+strlen(msg),"%-7s", " NONE"); - } - - //Network Type - if (pBss->BssType == BSS_ADHOC) - sprintf(msg+strlen(msg),"%-3s", " Ad"); - else - sprintf(msg+strlen(msg),"%-3s", " In"); - - sprintf(msg+strlen(msg),"\n"); - - return; -} - -#define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate -VOID RTMPIoctlGetMacTable( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq) -{ - INT i; - RT_802_11_MAC_TABLE MacTab; - char *msg; - - MacTab.Num = 0; - for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++) - { - if (pAd->MacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC)) - { - COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr); - MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid; - MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode; - MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode; - - // Fill in RSSI per entry - MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0; - MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1; - MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2; - - // the connected time per entry - MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime; - MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS; - MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW; - MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI; - MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC; - MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv; - MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE; - MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word; - - MacTab.Num += 1; - } - } - wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE); - if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length)) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__)); - } - - msg = kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG); - if (msg == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():Alloc memory failed\n", __func__)); - return; - } - memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN ); - sprintf(msg,"%s","\n"); - sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n", - "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR"); - - for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++) - { - PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i]; - if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC)) - { - if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) ) - break; - sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ", - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], - pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]); - sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid); - sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode); - sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo - sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo - sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo - sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]); - sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo - } - } - // for compatible with old API just do the printk to console - //wrq->u.data.length = strlen(msg); - //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length)) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s", msg)); - } - - kfree(msg); -} - - -INT Set_BASetup_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], tid; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - -/* - The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the tid value. -*/ - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); - - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - tid = (UCHAR) simple_strtol((token+1), 0, 10); - if (tid > 15) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - - pEntry = MacTableLookup(pAd, (PUCHAR) mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nSetup BA Session: Tid = %d\n", tid)); - BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE); - } - - return TRUE; - } - - return FALSE; - -} - -INT Set_BADecline_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG bBADecline; - - bBADecline = simple_strtol(arg, 0, 10); - - if (bBADecline == 0) - { - pAd->CommonCfg.bBADecline = FALSE; - } - else if (bBADecline == 1) - { - pAd->CommonCfg.bBADecline = TRUE; - } - else - { - return FALSE; //Invalid argument - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline)); - - return TRUE; -} - -INT Set_BAOriTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], tid; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); -/* - The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the tid value. -*/ - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - tid = simple_strtol((token+1), 0, 10); - if (tid > NUM_OF_TID) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - - pEntry = MacTableLookup(pAd, (PUCHAR) mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nTear down Ori BA Session: Tid = %d\n", tid)); - BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE); - } - - return TRUE; - } - - return FALSE; - -} - -INT Set_BARecTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], tid; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); -/* - The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the tid value. -*/ - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - tid = simple_strtol((token+1), 0, 10); - if (tid > NUM_OF_TID) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - - pEntry = MacTableLookup(pAd, (PUCHAR) mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nTear down Rec BA Session: Tid = %d\n", tid)); - BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE); - } - - return TRUE; - } - - return FALSE; - -} - -INT Set_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG HtBw; - - HtBw = simple_strtol(arg, 0, 10); - if (HtBw == BW_40) - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; - else if (HtBw == BW_20) - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW)); - - return TRUE; -} - -INT Set_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG HtMcs, Mcs_tmp; - BOOLEAN bAutoRate = FALSE; - - Mcs_tmp = simple_strtol(arg, 0, 10); - - if (Mcs_tmp <= 15 || Mcs_tmp == 32) - HtMcs = Mcs_tmp; - else - HtMcs = MCS_AUTO; - - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs; - pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n", - pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch)); - - if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) || - (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX)) - { - if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) && - (HtMcs >= 0 && HtMcs <= 3) && - (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK)) - { - RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000)); - } - else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) && - (HtMcs >= 0 && HtMcs <= 7) && - (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM)) - { - RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000)); - } - else - bAutoRate = TRUE; - - if (bAutoRate) - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - RTMPSetDesiredRates(pAd, -1); - } - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode)); - } - if (ADHOC_ON(pAd)) - return TRUE; - } - - SetCommonHT(pAd); - - return TRUE; -} - -INT Set_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG HtGi; - - HtGi = simple_strtol(arg, 0, 10); - - if ( HtGi == GI_400) - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400; - else if ( HtGi == GI_800 ) - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI)); - - return TRUE; -} - - -INT Set_HtTxBASize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR Size; - - Size = simple_strtol(arg, 0, 10); - - if (Size <=0 || Size >=64) - { - Size = 8; - } - pAd->CommonCfg.TxBASize = Size-1; - DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size)); - - return TRUE; -} - -INT Set_HtDisallowTKIP_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == 1) - { - pAd->CommonCfg.HT_DisallowTKIP = TRUE; - } - else - { - pAd->CommonCfg.HT_DisallowTKIP = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtDisallowTKIP_Proc ::%s\n", - (pAd->CommonCfg.HT_DisallowTKIP == TRUE) ? "enabled" : "disabled")); - - return TRUE; -} - -INT Set_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == HTMODE_GF) - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF; - else if ( Value == HTMODE_MM ) - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE)); - - return TRUE; - -} - -INT Set_HtStbc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == STBC_USE) - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE; - else if ( Value == STBC_NONE ) - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC)); - - return TRUE; -} - -INT Set_HtHtc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->HTCEnable = FALSE; - else if ( Value ==1 ) - pAd->HTCEnable = TRUE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable)); - - return TRUE; -} - -INT Set_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == 0) - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; - else if ( Value ==1 ) - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)); - - return TRUE; -} - -INT Set_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value <=7 && Value >= 0) - pAd->CommonCfg.BACapability.field.MpduDensity = Value; - else - pAd->CommonCfg.BACapability.field.MpduDensity = 4; - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity)); - - return TRUE; -} - -INT Set_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - - if (Value >=1 && Value <= 64) - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value; - } - else - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; - } - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit)); - - return TRUE; -} - -INT Set_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == 0) - pAd->CommonCfg.bRdg = FALSE; - else if ( Value ==1 ) - { - pAd->HTCEnable = TRUE; - pAd->CommonCfg.bRdg = TRUE; - } - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg)); - - return TRUE; -} - -INT Set_HtLinkAdapt_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->bLinkAdapt = FALSE; - else if ( Value ==1 ) - { - pAd->HTCEnable = TRUE; - pAd->bLinkAdapt = TRUE; - } - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt)); - - return TRUE; -} - -INT Set_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE; - else if ( Value == 1 ) - pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable)); - - return TRUE; -} - -INT Set_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.BACapability.field.AutoBA = FALSE; - pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE; - } - else if (Value == 1) - { - pAd->CommonCfg.BACapability.field.AutoBA = TRUE; - pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; - } - else - return FALSE; //Invalid argument - - pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA; - pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy; - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA)); - - return TRUE; - -} - -INT Set_HtProtect_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->CommonCfg.bHTProtect = FALSE; - else if (Value == 1) - pAd->CommonCfg.bHTProtect = TRUE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect)); - - return TRUE; -} - -INT Set_SendPSMPAction_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], mode; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); -/* - The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the mode value. -*/ - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - mode = simple_strtol((token+1), 0, 10); - if (mode > MMPS_ENABLE) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mode)); - - pEntry = MacTableLookup(pAd, mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nSendPSMPAction MIPS mode = %d\n", mode)); - SendPSMPAction(pAd, pEntry->Aid, mode); - } - - return TRUE; - } - - return FALSE; - - -} - -INT Set_HtMIMOPSmode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value <=3 && Value >= 0) - pAd->CommonCfg.BACapability.field.MMPSmode = Value; - else - pAd->CommonCfg.BACapability.field.MMPSmode = 3; - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode)); - - return TRUE; -} - - -INT Set_ForceShortGI_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->WIFItestbed.bShortGI = FALSE; - else if (Value == 1) - pAd->WIFItestbed.bShortGI = TRUE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI)); - - return TRUE; -} - - - -INT Set_ForceGF_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->WIFItestbed.bGreenField = FALSE; - else if (Value == 1) - pAd->WIFItestbed.bGreenField = TRUE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField)); - - return TRUE; -} - -INT Set_HtMimoPs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->CommonCfg.bMIMOPSEnable = FALSE; - else if (Value == 1) - pAd->CommonCfg.bMIMOPSEnable = TRUE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable)); - - return TRUE; -} - INT SetCommonHT( IN PRTMP_ADAPTER pAd) { @@ -2793,106 +936,6 @@ INT SetCommonHT( return TRUE; } -INT Set_FixedTxMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR fix_tx_mode = FIXED_TXMODE_HT; - - if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0) - { - fix_tx_mode = FIXED_TXMODE_OFDM; - } - else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0) - { - fix_tx_mode = FIXED_TXMODE_CCK; - } - - pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode)); - - return TRUE; -} - -#if defined(RT305x)||defined(RT3070) -INT Set_HiPower_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - pAdapter->CommonCfg.HighPowerPatchDisabled = !(simple_strtol(arg, 0, 10)); - - if (pAdapter->CommonCfg.HighPowerPatchDisabled != 0) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R82, 0x62); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R67, 0x20); -#ifdef RT3070 - if ((IS_RT3070(pAdapter) && ((pAdapter->MACVersion & 0xffff) < 0x0201))) -#endif // RT3070 // - RT30xxWriteRFRegister(pAdapter, RF_R27, 0x23); - } - return TRUE; -} -#endif - -INT Set_LongRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - TX_RTY_CFG_STRUC tx_rty_cfg; - UCHAR LongRetryLimit = (UCHAR)simple_strtol(arg, 0, 10); - - RTMP_IO_READ32(pAdapter, TX_RTY_CFG, &tx_rty_cfg.word); - tx_rty_cfg.field.LongRtyLimit = LongRetryLimit; - RTMP_IO_WRITE32(pAdapter, TX_RTY_CFG, tx_rty_cfg.word); - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_LongRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); - return TRUE; -} - -INT Set_ShortRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - TX_RTY_CFG_STRUC tx_rty_cfg; - UCHAR ShortRetryLimit = (UCHAR)simple_strtol(arg, 0, 10); - - RTMP_IO_READ32(pAdapter, TX_RTY_CFG, &tx_rty_cfg.word); - tx_rty_cfg.field.ShortRtyLimit = ShortRetryLimit; - RTMP_IO_WRITE32(pAdapter, TX_RTY_CFG, tx_rty_cfg.word); - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); - return TRUE; -} - - -///////////////////////////////////////////////////////////////////////// -PSTRING RTMPGetRalinkAuthModeStr( - IN NDIS_802_11_AUTHENTICATION_MODE authMode) -{ - switch(authMode) - { - case Ndis802_11AuthModeOpen: - return "OPEN"; - case Ndis802_11AuthModeWPAPSK: - return "WPAPSK"; - case Ndis802_11AuthModeShared: - return "SHARED"; - case Ndis802_11AuthModeWPA: - return "WPA"; - case Ndis802_11AuthModeWPA2: - return "WPA2"; - case Ndis802_11AuthModeWPA2PSK: - return "WPA2PSK"; - case Ndis802_11AuthModeWPA1PSKWPA2PSK: - return "WPAPSKWPA2PSK"; - case Ndis802_11AuthModeWPA1WPA2: - return "WPA1WPA2"; - case Ndis802_11AuthModeWPANone: - return "WPANONE"; - default: - return "UNKNOW"; - } -} - PSTRING RTMPGetRalinkEncryModeStr( IN USHORT encryMode) { @@ -2912,494 +955,3 @@ PSTRING RTMPGetRalinkEncryModeStr( return "UNKNOW"; } } - -INT RTMPShowCfgValue( - IN PRTMP_ADAPTER pAd, - IN PSTRING pName, - IN PSTRING pBuf) -{ - INT Status = 0; - - for (PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC = RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC++) - { - if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name)) - { - if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf)) - Status = -EINVAL; - break; //Exit for loop. - } - } - - if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL) - { - sprintf(pBuf, "\n"); - for (PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC = RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC++) - sprintf(pBuf + strlen(pBuf), "%s\n", PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name); - } - - return Status; -} - -INT Show_SSID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid); - return 0; -} - -INT Show_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.PhyMode) - { - case PHY_11BG_MIXED: - sprintf(pBuf, "\t11B/G"); - break; - case PHY_11B: - sprintf(pBuf, "\t11B"); - break; - case PHY_11A: - sprintf(pBuf, "\t11A"); - break; - case PHY_11ABG_MIXED: - sprintf(pBuf, "\t11A/B/G"); - break; - case PHY_11G: - sprintf(pBuf, "\t11G"); - break; - case PHY_11ABGN_MIXED: - sprintf(pBuf, "\t11A/B/G/N"); - break; - case PHY_11N_2_4G: - sprintf(pBuf, "\t11N only with 2.4G"); - break; - case PHY_11GN_MIXED: - sprintf(pBuf, "\t11G/N"); - break; - case PHY_11AN_MIXED: - sprintf(pBuf, "\t11A/N"); - break; - case PHY_11BGN_MIXED: - sprintf(pBuf, "\t11B/G/N"); - break; - case PHY_11AGN_MIXED: - sprintf(pBuf, "\t11A/G/N"); - break; - case PHY_11N_5G: - sprintf(pBuf, "\t11N only with 5G"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode); - break; - } - return 0; -} - - -INT Show_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE"); - return 0; -} - -INT Show_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.TxPreamble) - { - case Rt802_11PreambleShort: - sprintf(pBuf, "\tShort"); - break; - case Rt802_11PreambleLong: - sprintf(pBuf, "\tLong"); - break; - case Rt802_11PreambleAuto: - sprintf(pBuf, "\tAuto"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble); - break; - } - - return 0; -} - -INT Show_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage); - return 0; -} - -INT Show_Channel_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel); - return 0; -} - -INT Show_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.UseBGProtection) - { - case 1: //Always On - sprintf(pBuf, "\tON"); - break; - case 2: //Always OFF - sprintf(pBuf, "\tOFF"); - break; - case 0: //AUTO - sprintf(pBuf, "\tAuto"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection); - break; - } - return 0; -} - -INT Show_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold); - return 0; -} - -INT Show_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold); - return 0; -} - -INT Show_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) - { - sprintf(pBuf, "\t40 MHz"); - } - else - { - sprintf(pBuf, "\t20 MHz"); - } - return 0; -} - -INT Show_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS); - return 0; -} - -INT Show_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI) - { - case GI_400: - sprintf(pBuf, "\tGI_400"); - break; - case GI_800: - sprintf(pBuf, "\tGI_800"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI); - break; - } - return 0; -} - -INT Show_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE) - { - case HTMODE_GF: - sprintf(pBuf, "\tGF"); - break; - case HTMODE_MM: - sprintf(pBuf, "\tMM"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE); - break; - } - return 0; -} - -INT Show_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA) - { - case EXTCHA_BELOW: - sprintf(pBuf, "\tBelow"); - break; - case EXTCHA_ABOVE: - sprintf(pBuf, "\tAbove"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA); - break; - } - return 0; -} - - -INT Show_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity); - return 0; -} - -INT Show_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit); - return 0; -} - -INT Show_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE"); - return 0; -} - -INT Show_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE"); - return 0; -} - -INT Show_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE"); - return 0; -} - -INT Show_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion); - return 0; -} - -INT Show_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand); - return 0; -} - -INT Show_CountryCode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode); - return 0; -} - -#ifdef AGGREGATION_SUPPORT -INT Show_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE"); - return 0; -} -#endif // AGGREGATION_SUPPORT // - -#ifdef WMM_SUPPORT -INT Show_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE"); - - return 0; -} -#endif // WMM_SUPPORT // - -INT Show_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE"); - return 0; -} - -INT Show_NetworkType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->StaCfg.BssType) - { - case BSS_ADHOC: - sprintf(pBuf, "\tAdhoc"); - break; - case BSS_INFRA: - sprintf(pBuf, "\tInfra"); - break; - case BSS_ANY: - sprintf(pBuf, "\tAny"); - break; - case BSS_MONITOR: - sprintf(pBuf, "\tMonitor"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType); - break; - } - return 0; -} - - - -INT Show_AuthMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen; - - AuthMode = pAd->StaCfg.AuthMode; - - if ((AuthMode >= Ndis802_11AuthModeOpen) && - (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) - sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode)); - else - sprintf(pBuf, "\tUnknow Value(%d)", AuthMode); - - return 0; -} - -INT Show_EncrypType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled; - - WepStatus = pAd->StaCfg.WepStatus; - - if ((WepStatus >= Ndis802_11WEPEnabled) && - (WepStatus <= Ndis802_11Encryption4KeyAbsent)) - sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus)); - else - sprintf(pBuf, "\tUnknow Value(%d)", WepStatus); - - return 0; -} - -INT Show_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - UCHAR DefaultKeyId = 0; - - DefaultKeyId = pAd->StaCfg.DefaultKeyId; - - sprintf(pBuf, "\t%d", DefaultKeyId); - - return 0; -} - -INT Show_WepKey_Proc( - IN PRTMP_ADAPTER pAd, - IN INT KeyIdx, - OUT PSTRING pBuf) -{ - UCHAR Key[16] = {0}, KeyLength = 0; - INT index = BSS0; - - KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen; - NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength); - - //check key string is ASCII or not - if (RTMPCheckStrPrintAble((PCHAR)Key, KeyLength)) - sprintf(pBuf, "\t%s", Key); - else - { - int idx; - sprintf(pBuf, "\t"); - for (idx = 0; idx < KeyLength; idx++) - sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]); - } - return 0; -} - -INT Show_Key1_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - Show_WepKey_Proc(pAd, 0, pBuf); - return 0; -} - -INT Show_Key2_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - Show_WepKey_Proc(pAd, 1, pBuf); - return 0; -} - -INT Show_Key3_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - Show_WepKey_Proc(pAd, 2, pBuf); - return 0; -} - -INT Show_Key4_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - Show_WepKey_Proc(pAd, 3, pBuf); - return 0; -} - -INT Show_WPAPSK_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - INT idx; - UCHAR PMK[32] = {0}; - - NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32); - - sprintf(pBuf, "\tPMK = "); - for (idx = 0; idx < 32; idx++) - sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]); - - return 0; -} - diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 32e553a..59fd05b 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -4237,17 +4237,9 @@ INT RT_CfgSetWPAPSKKey( // // Prototypes of function definition in cmm_info.c // -NDIS_STATUS RTMPWPARemoveKeyProc( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuf); - VOID RTMPWPARemoveAllKeys( IN PRTMP_ADAPTER pAd); -BOOLEAN RTMPCheckStrPrintAble( - IN CHAR *pInPutStr, - IN UCHAR strLen); - VOID RTMPSetPhyMode( IN PRTMP_ADAPTER pAd, IN ULONG phymode); @@ -4683,183 +4675,9 @@ int rtinet_aton( unsigned int *addr); ////////// common ioctl functions ////////// -INT Set_DriverVersion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_Channel_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ShortSlot_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef AGGREGATION_SUPPORT -INT Set_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif // AGGREGATION_SUPPORT // - -INT Set_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef DBG -INT Set_Debug_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif - -INT Show_DescInfo_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ResetStatCounter_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BASetup_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BADecline_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BAOriTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BARecTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtStbc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtHtc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtLinkAdapt_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtProtect_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMimoPs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -INT Set_ForceShortGI_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ForceGF_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - INT SetCommonHT( IN PRTMP_ADAPTER pAd); -INT Set_SendPSMPAction_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMIMOPSmode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -INT Set_HtTxBASize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtDisallowTKIP_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - INT WpaCheckEapCode( IN PRTMP_ADAPTER pAd, IN PUCHAR pFrame, @@ -5103,15 +4921,6 @@ INT Set_FixedTxMode_Proc( IN PRTMP_ADAPTER pAd, IN PSTRING arg); - -INT Set_LongRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_ShortRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - BOOLEAN RT28XXChipsetCheck( IN void *_dev_p); @@ -5661,19 +5470,6 @@ void RtmpTimerQInit( IN RTMP_ADAPTER *pAd); #endif // RTMP_TIMER_TASK_SUPPORT // -/////////////////////////////////////// -INT RTMPShowCfgValue( - IN PRTMP_ADAPTER pAd, - IN PSTRING pName, - IN PSTRING pBuf); - -PSTRING RTMPGetRalinkAuthModeStr( - IN NDIS_802_11_AUTHENTICATION_MODE authMode); - -PSTRING RTMPGetRalinkEncryModeStr( - IN USHORT encryMode); -////////////////////////////////////// - VOID AsicStaBbpTuning( IN PRTMP_ADAPTER pAd); diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index a3aeb1e..df6130c 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -61,42 +61,6 @@ typedef struct PACKED _RT_VERSION_INFO{ UINT DriverBuildDay; } RT_VERSION_INFO, *PRT_VERSION_INFO; -struct iw_priv_args privtab[] = { -{ RTPRIV_IOCTL_SET, - IW_PRIV_TYPE_CHAR | 1024, 0, - "set"}, - -{ RTPRIV_IOCTL_SHOW, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - ""}, -/* --- sub-ioctls definitions --- */ - { SHOW_CONN_STATUS, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "connStatus" }, - { SHOW_DRVIER_VERION, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "driverVer" }, - { SHOW_BA_INFO, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "bainfo" }, - { SHOW_DESC_INFO, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "descinfo" }, - { RAIO_OFF, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_off" }, - { RAIO_ON, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_on" }, - { SHOW_CFG_VALUE, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "show" }, - { SHOW_ADHOC_ENTRY_INFO, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "adhocEntry" }, -/* --- sub-ioctls relations --- */ - -{ RTPRIV_IOCTL_STATISTICS, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - "stat"}, -{ RTPRIV_IOCTL_GSITESURVEY, - 0, IW_PRIV_TYPE_CHAR | 1024, - "get_site_survey"}, - - -}; - static __s32 ralinkrate[] = {2, 4, 11, 22, // CCK 12, 18, 24, 36, 48, 72, 96, 108, // OFDM @@ -113,190 +77,10 @@ INT Set_SSID_Proc( IN PRTMP_ADAPTER pAdapter, IN PSTRING arg); -#ifdef WMM_SUPPORT -INT Set_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif - INT Set_NetworkType_Proc( IN PRTMP_ADAPTER pAdapter, IN PSTRING arg); -INT Set_AuthMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_EncrypType_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key1_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key2_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key3_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key4_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_WPAPSK_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - - -INT Set_PSMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -#ifdef RT3090 -INT Set_PCIePSLevel_Proc( -IN PRTMP_ADAPTER pAdapter, -IN PUCHAR arg); -#endif // RT3090 // - -INT Set_Wpa_Support( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -NDIS_STATUS RTMPWPANoneAddKeyProc( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuf); - -INT Set_FragTest_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_TGnWifiTest_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_LongRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_ShortRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - - - -INT Show_Adhoc_MacTable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING extra); - -INT Set_BeaconLostTime_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_AutoRoaming_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_SiteSurvey_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ForceTxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -static struct { - PSTRING name; - INT (*set_proc)(PRTMP_ADAPTER pAdapter, PSTRING arg); -} *PRTMP_PRIVATE_SET_PROC, RTMP_PRIVATE_SUPPORT_PROC[] = { - {"DriverVersion", Set_DriverVersion_Proc}, - {"CountryRegion", Set_CountryRegion_Proc}, - {"CountryRegionABand", Set_CountryRegionABand_Proc}, - {"SSID", Set_SSID_Proc}, - {"WirelessMode", Set_WirelessMode_Proc}, - {"TxBurst", Set_TxBurst_Proc}, - {"TxPreamble", Set_TxPreamble_Proc}, - {"TxPower", Set_TxPower_Proc}, - {"Channel", Set_Channel_Proc}, - {"BGProtection", Set_BGProtection_Proc}, - {"RTSThreshold", Set_RTSThreshold_Proc}, - {"FragThreshold", Set_FragThreshold_Proc}, - {"HtBw", Set_HtBw_Proc}, - {"HtMcs", Set_HtMcs_Proc}, - {"HtGi", Set_HtGi_Proc}, - {"HtOpMode", Set_HtOpMode_Proc}, - {"HtExtcha", Set_HtExtcha_Proc}, - {"HtMpduDensity", Set_HtMpduDensity_Proc}, - {"HtBaWinSize", Set_HtBaWinSize_Proc}, - {"HtRdg", Set_HtRdg_Proc}, - {"HtAmsdu", Set_HtAmsdu_Proc}, - {"HtAutoBa", Set_HtAutoBa_Proc}, - {"HtBaDecline", Set_BADecline_Proc}, - {"HtProtect", Set_HtProtect_Proc}, - {"HtMimoPs", Set_HtMimoPs_Proc}, - {"HtDisallowTKIP", Set_HtDisallowTKIP_Proc}, -#ifdef AGGREGATION_SUPPORT - {"PktAggregate", Set_PktAggregate_Proc}, -#endif // AGGREGATION_SUPPORT // - -#ifdef WMM_SUPPORT - {"WmmCapable", Set_WmmCapable_Proc}, -#endif - {"IEEE80211H", Set_IEEE80211H_Proc}, - {"NetworkType", Set_NetworkType_Proc}, - {"AuthMode", Set_AuthMode_Proc}, - {"EncrypType", Set_EncrypType_Proc}, - {"DefaultKeyID", Set_DefaultKeyID_Proc}, - {"Key1", Set_Key1_Proc}, - {"Key2", Set_Key2_Proc}, - {"Key3", Set_Key3_Proc}, - {"Key4", Set_Key4_Proc}, - {"WPAPSK", Set_WPAPSK_Proc}, - {"ResetCounter", Set_ResetStatCounter_Proc}, - {"PSMode", Set_PSMode_Proc}, -#ifdef DBG - {"Debug", Set_Debug_Proc}, -#endif // DBG // - - - {"WpaSupport", Set_Wpa_Support}, - - - - - - {"FixedTxMode", Set_FixedTxMode_Proc}, - {"TGnWifiTest", Set_TGnWifiTest_Proc}, - {"ForceGF", Set_ForceGF_Proc}, - {"LongRetry", Set_LongRetryLimit_Proc}, - {"ShortRetry", Set_ShortRetryLimit_Proc}, - -//2008/09/11:KH add to support efuse<-- -#ifdef RT30xx -#ifdef RTMP_EFUSE_SUPPORT - {"efuseFreeNumber", set_eFuseGetFreeBlockCount_Proc}, - {"efuseDump", set_eFusedump_Proc}, - {"efuseLoadFromBin", set_eFuseLoadFromBin_Proc}, - {"efuseBufferModeWriteBack", set_eFuseBufferModeWriteBack_Proc}, -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // -//2008/09/11:KH add to support efuse--> - {"BeaconLostTime", Set_BeaconLostTime_Proc}, - {"AutoRoaming", Set_AutoRoaming_Proc}, - {"SiteSurvey", Set_SiteSurvey_Proc}, - {"ForceTxBurst", Set_ForceTxBurst_Proc}, - - {NULL,} -}; - - VOID RTMPAddKey( IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) @@ -1656,117 +1440,6 @@ rt_ioctl_giwencode(struct net_device *dev, } -static int -rt_ioctl_setparam(struct net_device *dev, struct iw_request_info *info, - void *w, char *extra) -{ - PRTMP_ADAPTER pAdapter; - POS_COOKIE pObj; - PSTRING this_char = extra; - PSTRING value; - int Status=0; - - GET_PAD_FROM_NET_DEV(pAdapter, dev); - - pObj = (POS_COOKIE) pAdapter->OS_Cookie; - { - pObj->ioctl_if_type = INT_MAIN; - pObj->ioctl_if = MAIN_MBSSID; - } - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (!*this_char) - return -EINVAL; - - if ((value = rtstrchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value && (strcmp(this_char, "SiteSurvey") != 0)) - return -EINVAL; - else - goto SET_PROC; - - // reject setting nothing besides ANY ssid(ssidLen=0) - if (!*value && (strcmp(this_char, "SSID") != 0)) - return -EINVAL; - -SET_PROC: - for (PRTMP_PRIVATE_SET_PROC = RTMP_PRIVATE_SUPPORT_PROC; PRTMP_PRIVATE_SET_PROC->name; PRTMP_PRIVATE_SET_PROC++) - { - if (strcmp(this_char, PRTMP_PRIVATE_SET_PROC->name) == 0) - { - if(!PRTMP_PRIVATE_SET_PROC->set_proc(pAdapter, value)) - { //FALSE:Set private failed then return Invalid argument - Status = -EINVAL; - } - break; //Exit for loop. - } - } - - if(PRTMP_PRIVATE_SET_PROC->name == NULL) - { //Not found argument - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_setparam:: (iwpriv) Not Support Set Command [%s=%s]\n", this_char, value)); - } - - return Status; -} - - -static int -rt_private_get_statistics(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, char *extra) -{ - INT Status = 0; - PRTMP_ADAPTER pAd = NULL; - - GET_PAD_FROM_NET_DEV(pAd, dev); - - if (extra == NULL) - { - wrq->length = 0; - return -EIO; - } - - memset(extra, 0x00, IW_PRIV_SIZE_MASK); - sprintf(extra, "\n\n"); - - { - sprintf(extra+strlen(extra), "Tx success = %ld\n", (ULONG)pAd->WlanCounters.TransmittedFragmentCount.QuadPart); - sprintf(extra+strlen(extra), "Tx success without retry = %ld\n", (ULONG)pAd->WlanCounters.TransmittedFragmentCount.QuadPart - (ULONG)pAd->WlanCounters.RetryCount.QuadPart); - } - sprintf(extra+strlen(extra), "Tx success after retry = %ld\n", (ULONG)pAd->WlanCounters.RetryCount.QuadPart); - sprintf(extra+strlen(extra), "Tx fail to Rcv ACK after retry = %ld\n", (ULONG)pAd->WlanCounters.FailedCount.QuadPart); - sprintf(extra+strlen(extra), "RTS Success Rcv CTS = %ld\n", (ULONG)pAd->WlanCounters.RTSSuccessCount.QuadPart); - sprintf(extra+strlen(extra), "RTS Fail Rcv CTS = %ld\n", (ULONG)pAd->WlanCounters.RTSFailureCount.QuadPart); - - sprintf(extra+strlen(extra), "Rx success = %ld\n", (ULONG)pAd->WlanCounters.ReceivedFragmentCount.QuadPart); - sprintf(extra+strlen(extra), "Rx with CRC = %ld\n", (ULONG)pAd->WlanCounters.FCSErrorCount.QuadPart); - sprintf(extra+strlen(extra), "Rx drop due to out of resource = %ld\n", (ULONG)pAd->Counters8023.RxNoBuffer); - sprintf(extra+strlen(extra), "Rx duplicate frame = %ld\n", (ULONG)pAd->WlanCounters.FrameDuplicateCount.QuadPart); - - sprintf(extra+strlen(extra), "False CCA (one second) = %ld\n", (ULONG)pAd->RalinkCounters.OneSecFalseCCACnt); - { - sprintf(extra+strlen(extra), "RSSI-A = %ld\n", (LONG)(pAd->StaCfg.RssiSample.LastRssi0 - pAd->BbpRssiToDbmDelta)); - sprintf(extra+strlen(extra), "RSSI-B (if available) = %ld\n", (LONG)(pAd->StaCfg.RssiSample.LastRssi1 - pAd->BbpRssiToDbmDelta)); - sprintf(extra+strlen(extra), "RSSI-C (if available) = %ld\n\n", (LONG)(pAd->StaCfg.RssiSample.LastRssi2 - pAd->BbpRssiToDbmDelta)); - } - sprintf(extra+strlen(extra), "WpaSupplicantUP = %d\n\n", pAd->StaCfg.WpaSupplicantUP); - - - - wrq->length = strlen(extra) + 1; // 1: size of '\0' - DBGPRINT(RT_DEBUG_TRACE, ("<== rt_private_get_statistics, wrq->length = %d\n", wrq->length)); - - return Status; -} - void getBaInfo( IN PRTMP_ADAPTER pAd, IN PSTRING pOutBuf) @@ -1814,143 +1487,6 @@ void getBaInfo( return; } -static int -rt_private_show(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, PSTRING extra) -{ - INT Status = 0; - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; - u32 subcmd = wrq->flags; - - GET_PAD_FROM_NET_DEV(pAd, dev); - - pObj = (POS_COOKIE) pAd->OS_Cookie; - if (extra == NULL) - { - wrq->length = 0; - return -EIO; - } - memset(extra, 0x00, IW_PRIV_SIZE_MASK); - - { - pObj->ioctl_if_type = INT_MAIN; - pObj->ioctl_if = MAIN_MBSSID; - } - - switch(subcmd) - { - - case SHOW_CONN_STATUS: - if (MONITOR_ON(pAd)) - { - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && - pAd->CommonCfg.RegTransmitSetting.field.BW) - sprintf(extra, "Monitor Mode(CentralChannel %d)\n", pAd->CommonCfg.CentralChannel); - else - sprintf(extra, "Monitor Mode(Channel %d)\n", pAd->CommonCfg.Channel); - } - else - { - if (pAd->IndicateMediaState == NdisMediaStateConnected) - { - if (INFRA_ON(pAd)) - { - sprintf(extra, "Connected(AP: %s[%02X:%02X:%02X:%02X:%02X:%02X])\n", - pAd->CommonCfg.Ssid, - pAd->CommonCfg.Bssid[0], - pAd->CommonCfg.Bssid[1], - pAd->CommonCfg.Bssid[2], - pAd->CommonCfg.Bssid[3], - pAd->CommonCfg.Bssid[4], - pAd->CommonCfg.Bssid[5]); - DBGPRINT(RT_DEBUG_TRACE ,("Ssid=%s ,Ssidlen = %d\n",pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)); - } - else if (ADHOC_ON(pAd)) - sprintf(extra, "Connected\n"); - } - else - { - sprintf(extra, "Disconnected\n"); - DBGPRINT(RT_DEBUG_TRACE ,("ConnStatus is not connected\n")); - } - } - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - case SHOW_DRVIER_VERION: - sprintf(extra, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ ); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - case SHOW_BA_INFO: - getBaInfo(pAd, extra); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - case SHOW_DESC_INFO: - { - Show_DescInfo_Proc(pAd, NULL); - wrq->length = 0; // 1: size of '\0' - } - break; - case RAIO_OFF: - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - } - pAd->StaCfg.bSwRadio = FALSE; - if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) - { - pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio); - if (pAd->StaCfg.bRadio == FALSE) - { - MlmeRadioOff(pAd); - // Update extra information - pAd->ExtraInfo = SW_RADIO_OFF; - } - } - sprintf(extra, "Radio Off\n"); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - case RAIO_ON: - pAd->StaCfg.bSwRadio = TRUE; - //if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) - { - pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio); - if (pAd->StaCfg.bRadio == TRUE) - { - MlmeRadioOn(pAd); - // Update extra information - pAd->ExtraInfo = EXTRA_INFO_CLEAR; - } - } - sprintf(extra, "Radio On\n"); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - - - - case SHOW_CFG_VALUE: - { - Status = RTMPShowCfgValue(pAd, (PSTRING) wrq->pointer, extra); - if (Status == 0) - wrq->length = strlen(extra) + 1; // 1: size of '\0' - } - break; - case SHOW_ADHOC_ENTRY_INFO: - Show_Adhoc_MacTable_Proc(pAd, extra); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("%s - unknow subcmd = %d\n", __func__, subcmd)); - break; - } - - return Status; -} - int rt_ioctl_siwmlme(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, @@ -2774,43 +2310,10 @@ static const iw_handler rt_handler[] = (iw_handler) rt_ioctl_siwpmksa, /* SIOCSIWPMKSA */ }; -static const iw_handler rt_priv_handlers[] = { - (iw_handler) NULL, /* + 0x00 */ - (iw_handler) NULL, /* + 0x01 */ - (iw_handler) rt_ioctl_setparam, /* + 0x02 */ - (iw_handler) NULL, /* + 0x03 */ - (iw_handler) NULL, /* + 0x04 */ - (iw_handler) NULL, /* + 0x05 */ - (iw_handler) NULL, /* + 0x06 */ - (iw_handler) NULL, /* + 0x07 */ - (iw_handler) NULL, /* + 0x08 */ - (iw_handler) rt_private_get_statistics, /* + 0x09 */ - (iw_handler) NULL, /* + 0x0A */ - (iw_handler) NULL, /* + 0x0B */ - (iw_handler) NULL, /* + 0x0C */ - (iw_handler) NULL, /* + 0x0D */ - (iw_handler) NULL, /* + 0x0E */ - (iw_handler) NULL, /* + 0x0F */ - (iw_handler) NULL, /* + 0x10 */ - (iw_handler) rt_private_show, /* + 0x11 */ - (iw_handler) NULL, /* + 0x12 */ - (iw_handler) NULL, /* + 0x13 */ - (iw_handler) NULL, /* + 0x14 */ - (iw_handler) NULL, /* + 0x15 */ - (iw_handler) NULL, /* + 0x16 */ - (iw_handler) NULL, /* + 0x17 */ - (iw_handler) NULL, /* + 0x18 */ -}; - const struct iw_handler_def rt28xx_iw_handler_def = { -#define N(a) (sizeof (a) / sizeof (a[0])) .standard = (iw_handler *) rt_handler, .num_standard = sizeof(rt_handler) / sizeof(iw_handler), - .private = (iw_handler *) rt_priv_handlers, - .num_private = N(rt_priv_handlers), - .private_args = (struct iw_priv_args *) privtab, - .num_private_args = N(privtab), #if IW_HANDLER_VERSION >= 7 .get_wireless_stats = rt28xx_get_wireless_stats, #endif @@ -2980,17 +2483,8 @@ INT rt28xx_sta_ioctl( case RT_PRIV_IOCTL_EXT: case RTPRIV_IOCTL_SET: case RTPRIV_IOCTL_GSITESURVEY: - Status = -EOPNOTSUPP; - break; case SIOCGIWPRIV: - if (wrq->u.data.pointer) - { - if ( access_ok(VERIFY_WRITE, wrq->u.data.pointer, sizeof(privtab)) != TRUE) - break; - wrq->u.data.length = sizeof(privtab) / sizeof(privtab[0]); - if (copy_to_user(wrq->u.data.pointer, privtab, sizeof(privtab))) - Status = -EFAULT; - } + Status = -EOPNOTSUPP; break; case SIOCETHTOOL: break; @@ -3087,41 +2581,6 @@ INT Set_SSID_Proc( return success; } -#ifdef WMM_SUPPORT -/* - ========================================================================== - Description: - Set WmmCapable Enable or Disable - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - BOOLEAN bWmmCapable; - - bWmmCapable = simple_strtol(arg, 0, 10); - - if ((bWmmCapable == 1) -#ifdef RTMP_MAC_USB - && (pAd->NumberOfPipes >= 5) -#endif // RTMP_MAC_USB // - ) - pAd->CommonCfg.bWmmCapable = TRUE; - else if (bWmmCapable == 0) - pAd->CommonCfg.bWmmCapable = FALSE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_WmmCapable_Proc::(bWmmCapable=%d)\n", - pAd->CommonCfg.bWmmCapable)); - - return TRUE; -} -#endif // WMM_SUPPORT // - /* ========================================================================== Description: @@ -3306,765 +2765,3 @@ INT Set_NetworkType_Proc( return TRUE; } - -/* - ========================================================================== - Description: - Set Authentication mode - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_AuthMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - if ((strcmp(arg, "WEPAUTO") == 0) || (strcmp(arg, "wepauto") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeAutoSwitch; - else if ((strcmp(arg, "OPEN") == 0) || (strcmp(arg, "open") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - else if ((strcmp(arg, "SHARED") == 0) || (strcmp(arg, "shared") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; - else if ((strcmp(arg, "WPAPSK") == 0) || (strcmp(arg, "wpapsk") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPAPSK; - else if ((strcmp(arg, "WPANONE") == 0) || (strcmp(arg, "wpanone") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPANone; - else if ((strcmp(arg, "WPA2PSK") == 0) || (strcmp(arg, "wpa2psk") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2PSK; - else if ((strcmp(arg, "WPA") == 0) || (strcmp(arg, "wpa") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA; - else if ((strcmp(arg, "WPA2") == 0) || (strcmp(arg, "wpa2") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2; - else - return FALSE; - - pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_AuthMode_Proc::(AuthMode=%d)\n", pAdapter->StaCfg.AuthMode)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Encryption Type - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_EncrypType_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - if ((strcmp(arg, "NONE") == 0) || (strcmp(arg, "none") == 0)) - { - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; - } - else if ((strcmp(arg, "WEP") == 0) || (strcmp(arg, "wep") == 0)) - { - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11WEPEnabled; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; - } - else if ((strcmp(arg, "TKIP") == 0) || (strcmp(arg, "tkip") == 0)) - { - if (pAdapter->StaCfg.AuthMode < Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11Encryption2Enabled; - pAdapter->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11Encryption2Enabled; - } - else if ((strcmp(arg, "AES") == 0) || (strcmp(arg, "aes") == 0)) - { - if (pAdapter->StaCfg.AuthMode < Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11Encryption3Enabled; - pAdapter->StaCfg.PairCipher = Ndis802_11Encryption3Enabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11Encryption3Enabled; - } - else - return FALSE; - - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_EncrypType_Proc::(EncrypType=%d)\n", pAdapter->StaCfg.WepStatus)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Default Key ID - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - ULONG KeyIdx; - - KeyIdx = simple_strtol(arg, 0, 10); - if((KeyIdx >= 1 ) && (KeyIdx <= 4)) - pAdapter->StaCfg.DefaultKeyId = (UCHAR) (KeyIdx - 1 ); - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_DefaultKeyID_Proc::(DefaultKeyID=%d)\n", pAdapter->StaCfg.DefaultKeyId)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set WEP KEY1 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key1_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][0].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Ascii")); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][0].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Hex")); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][0].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Ascii")); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][0].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Hex")); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - - pAdapter->SharedKey[BSS0][0].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 0, - pAdapter->SharedKey[BSS0][0].CipherAlg, - pAdapter->SharedKey[BSS0][0].Key, - NULL, - NULL); - } - - return TRUE; -} -/* - ========================================================================== - - Description: - Set WEP KEY2 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key2_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][1].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Ascii")); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][1].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Hex")); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][1].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Ascii")); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][1].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Hex")); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - pAdapter->SharedKey[BSS0][1].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 1, - pAdapter->SharedKey[BSS0][1].CipherAlg, - pAdapter->SharedKey[BSS0][1].Key, - NULL, - NULL); - } - - return TRUE; -} -/* - ========================================================================== - Description: - Set WEP KEY3 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key3_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][2].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Ascii)\n", arg)); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][2].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Hex)\n", arg)); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][2].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Ascii)\n", arg)); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][2].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Hex)\n", arg)); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - pAdapter->SharedKey[BSS0][2].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 2, - pAdapter->SharedKey[BSS0][2].CipherAlg, - pAdapter->SharedKey[BSS0][2].Key, - NULL, - NULL); - } - - return TRUE; -} -/* - ========================================================================== - Description: - Set WEP KEY4 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key4_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][3].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Ascii")); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][3].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Hex")); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][3].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Ascii")); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][3].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Hex")); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - pAdapter->SharedKey[BSS0][3].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 3, - pAdapter->SharedKey[BSS0][3].CipherAlg, - pAdapter->SharedKey[BSS0][3].Key, - NULL, - NULL); - } - - return TRUE; -} - -/* - ========================================================================== - Description: - Set WPA PSK key - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_WPAPSK_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int status; - - if ((pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) - ) - return TRUE; // do nothing - - DBGPRINT(RT_DEBUG_TRACE, ("Set_WPAPSK_Proc::(WPAPSK=%s)\n", arg)); - - status = RT_CfgSetWPAPSKKey(pAd, arg, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, pAd->StaCfg.PMK); - if (status == FALSE) - { - DBGPRINT(RT_DEBUG_TRACE, ("Set_WPAPSK_Proc(): Set key failed!\n")); - return FALSE; - } - NdisZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); - NdisMoveMemory(pAd->StaCfg.WpaPassPhrase, arg, strlen(arg)); - pAd->StaCfg.WpaPassPhraseLen = (UINT)strlen(arg); - - - - if(pAd->StaCfg.BssType == BSS_ADHOC && - pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - pAd->StaCfg.WpaState = SS_NOTUSE; - } - else - { - // Start STA supplicant state machine - pAd->StaCfg.WpaState = SS_START; - } - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Power Saving mode - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_PSMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - if (pAdapter->StaCfg.BssType == BSS_INFRA) - { - if ((strcmp(arg, "Max_PSP") == 0) || - (strcmp(arg, "max_psp") == 0) || - (strcmp(arg, "MAX_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() - // to exclude certain situations. - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeMAX_PSP; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeMAX_PSP; - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - pAdapter->StaCfg.DefaultListenCount = 5; - - } - else if ((strcmp(arg, "Fast_PSP") == 0) || - (strcmp(arg, "fast_psp") == 0) || - (strcmp(arg, "FAST_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() - // to exclude certain situations. - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeFast_PSP; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeFast_PSP; - pAdapter->StaCfg.DefaultListenCount = 3; - } - else if ((strcmp(arg, "Legacy_PSP") == 0) || - (strcmp(arg, "legacy_psp") == 0) || - (strcmp(arg, "LEGACY_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() - // to exclude certain situations. - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAdapter->StaCfg.DefaultListenCount = 3; - } - else - { - //Default Ndis802_11PowerModeCAM - // clear PSM bit immediately - RTMP_SET_PSM_BIT(pAdapter, PWR_ACTIVE); - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeCAM; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeCAM; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_PSMode_Proc::(PSMode=%ld)\n", pAdapter->StaCfg.WindowsPowerMode)); - } - else - return FALSE; - - - return TRUE; -} - -/* - ========================================================================== - Description: - Set WpaSupport flag. - Value: - 0: Driver ignore wpa_supplicant. - 1: wpa_supplicant initiates scanning and AP selection. - 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters. - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Wpa_Support( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - if ( simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE; - else if ( simple_strtol(arg, 0, 10) == 1) - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_ENABLE; - else if ( simple_strtol(arg, 0, 10) == 2) - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_ENABLE_WITH_WEB_UI; - else - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_Wpa_Support::(WpaSupplicantUP=%d)\n", pAd->StaCfg.WpaSupplicantUP)); - - return TRUE; -} - -INT Set_TGnWifiTest_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.bTGnWifiTest = FALSE; - else - pAd->StaCfg.bTGnWifiTest = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_TGnWifiTest_Proc::(bTGnWifiTest=%d)\n", pAd->StaCfg.bTGnWifiTest)); - return TRUE; -} - - - - -INT Show_Adhoc_MacTable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING extra) -{ - INT i; - - sprintf(extra, "\n"); - - sprintf(extra + strlen(extra), "HT Operating Mode : %d\n", pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode); - - sprintf(extra + strlen(extra), "\n%-19s%-4s%-4s%-7s%-7s%-7s%-10s%-6s%-6s%-6s%-6s\n", - "MAC", "AID", "BSS", "RSSI0", "RSSI1", "RSSI2", "PhMd", "BW", "MCS", "SGI", "STBC"); - - for (i=1; i<MAX_LEN_OF_MAC_TABLE; i++) - { - PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i]; - - if (strlen(extra) > (IW_PRIV_SIZE_MASK - 30)) - break; - if ((pEntry->ValidAsCLI || pEntry->ValidAsApCli) && (pEntry->Sst == SST_ASSOC)) - { - sprintf(extra + strlen(extra), "%02X:%02X:%02X:%02X:%02X:%02X ", - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], - pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]); - sprintf(extra + strlen(extra), "%-4d", (int)pEntry->Aid); - sprintf(extra + strlen(extra), "%-4d", (int)pEntry->apidx); - sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi0); - sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi1); - sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi2); - sprintf(extra + strlen(extra), "%-10s", GetPhyMode(pEntry->HTPhyMode.field.MODE)); - sprintf(extra + strlen(extra), "%-6s", GetBW(pEntry->HTPhyMode.field.BW)); - sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.MCS); - sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.ShortGI); - sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.STBC); - sprintf(extra + strlen(extra), "%-10d, %d, %d%%\n", pEntry->DebugFIFOCount, pEntry->DebugTxCount, - (pEntry->DebugTxCount) ? ((pEntry->DebugTxCount-pEntry->DebugFIFOCount)*100/pEntry->DebugTxCount) : 0); - sprintf(extra, "%s\n", extra); - } - } - - return TRUE; -} - - -INT Set_BeaconLostTime_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG ltmp = (ULONG)simple_strtol(arg, 0, 10); - - if ((ltmp != 0) && (ltmp <= 60)) - pAd->StaCfg.BeaconLostTime = (ltmp * OS_HZ); - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_BeaconLostTime_Proc::(BeaconLostTime=%ld)\n", pAd->StaCfg.BeaconLostTime)); - return TRUE; -} - -INT Set_AutoRoaming_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.bAutoRoaming = FALSE; - else - pAd->StaCfg.bAutoRoaming = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_AutoRoaming_Proc::(bAutoRoaming=%d)\n", pAd->StaCfg.bAutoRoaming)); - return TRUE; -} - - -/* - ========================================================================== - Description: - Issue a site survey command to driver - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 set site_survey - ========================================================================== -*/ -INT Set_SiteSurvey_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - NDIS_802_11_SSID Ssid; - - //check if the interface is down - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (MONITOR_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); - return -EINVAL; - } - - RTMPZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); - Ssid.SsidLength = 0; - if ((arg != NULL) && - (strlen(arg) <= MAX_LEN_OF_SSID)) - { - RTMPMoveMemory(Ssid.Ssid, arg, strlen(arg)); - Ssid.SsidLength = strlen(arg); - } - - pAd->StaCfg.bScanReqIsFromWebUI = TRUE; - - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. - pAd->MlmeAux.CurrReqIsFromNdis = FALSE; - // Reset allowed scan retries - pAd->StaCfg.ScanCnt = 0; - NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); - - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID_LIST_SCAN, - Ssid.SsidLength, - Ssid.Ssid); - - RTMP_MLME_HANDLER(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_SiteSurvey_Proc\n")); - - return TRUE; -} - -INT Set_ForceTxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.bForceTxBurst = FALSE; - else - pAd->StaCfg.bForceTxBurst = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ForceTxBurst_Proc::(bForceTxBurst=%d)\n", pAd->StaCfg.bForceTxBurst)); - return TRUE; -} -- 1.6.5.5 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel