diff options
Diffstat (limited to 'drivers/staging/rt2860')
34 files changed, 194 insertions, 7288 deletions
diff --git a/drivers/staging/rt2860/2860_main_dev.c b/drivers/staging/rt2860/2860_main_dev.c index c7038e03a4d..c2f02963f91 100644 --- a/drivers/staging/rt2860/2860_main_dev.c +++ b/drivers/staging/rt2860/2860_main_dev.c @@ -99,6 +99,13 @@ static struct pci_device_id rt2860_pci_tbl[] __devinitdata = {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2760_PCI_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2790_PCIe_DEVICE_ID)}, {PCI_DEVICE(VEN_AWT_PCI_VENDOR_ID, VEN_AWT_PCIe_DEVICE_ID)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7708)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7728)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7758)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7727)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7738)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7748)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7768)}, {0,} // terminate list }; diff --git a/drivers/staging/rt2860/ap.h b/drivers/staging/rt2860/ap.h index a814d55abef..fcdb35847b1 100644 --- a/drivers/staging/rt2860/ap.h +++ b/drivers/staging/rt2860/ap.h @@ -40,290 +40,8 @@ #ifndef __AP_H__ #define __AP_H__ - - -// ========================= AP RTMP.h ================================ - - - -// ============================================================= -// Function Prototypes -// ============================================================= - -// ap_data.c - -BOOLEAN APBridgeToWirelessSta( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader, - IN UINT HdrLen, - IN PUCHAR pData, - IN UINT DataLen, - IN ULONG fromwdsidx); - -BOOLEAN APHandleRxDoneInterrupt( - IN PRTMP_ADAPTER pAd); - -VOID APSendPackets( - IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET ppPacketArray, - IN UINT NumberOfPackets); - -NDIS_STATUS APSendPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - - -NDIS_STATUS APHardTransmit( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR QueIdx); - -VOID APRxEAPOLFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -NDIS_STATUS APCheckRxError( - IN PRTMP_ADAPTER pAd, - IN PRT28XX_RXD_STRUC pRxD, - IN UCHAR Wcid); - -BOOLEAN APCheckClass2Class3Error( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN PHEADER_802_11 pHeader); - -VOID APHandleRxPsPoll( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN USHORT Aid, - IN BOOLEAN isActive); - -VOID RTMPDescriptorEndianChange( - IN PUCHAR pData, - IN ULONG DescriptorType); - -VOID RTMPFrameEndianChange( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG Dir, - IN BOOLEAN FromRxDoneInt); - -// ap_assoc.c - -VOID APAssocStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID APPeerAssocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerReassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerDisassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MbssKickOutStas( - IN PRTMP_ADAPTER pAd, - IN INT apidx, - IN USHORT Reason); - -VOID APMlmeKickOutSta( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pStaAddr, - IN UCHAR Wcid, - IN USHORT Reason); - -VOID APMlmeDisassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APCls3errAction( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN PHEADER_802_11 pHeader); - - -USHORT APBuildAssociation( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN USHORT CapabilityInfo, - IN UCHAR MaxSupportedRateIn500Kbps, - IN UCHAR *RSN, - IN UCHAR *pRSNLen, - IN BOOLEAN bWmmCapable, - IN ULONG RalinkIe, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - OUT USHORT *pAid); - -// ap_auth.c - -void APAuthStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID APMlmeDeauthReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APCls2errAction( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN PHEADER_802_11 pHeader); - -// ap_authrsp.c - -VOID APAuthRspStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN PSTATE_MACHINE Sm, - IN STATE_MACHINE_FUNC Trans[]); - -VOID APPeerAuthAtAuthRspIdleAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerDeauthReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerAuthSimpleRspGenAndSend( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHdr80211, - IN USHORT Alg, - IN USHORT Seq, - IN USHORT StatusCode); - -// ap_connect.c - -BOOLEAN BeaconTransmitRequired( - IN PRTMP_ADAPTER pAd, - IN INT apidx); - -VOID APMakeBssBeacon( - IN PRTMP_ADAPTER pAd, - IN INT apidx); - -VOID APUpdateBeaconFrame( - IN PRTMP_ADAPTER pAd, - IN INT apidx); - -VOID APMakeAllBssBeacon( - IN PRTMP_ADAPTER pAd); - -VOID APUpdateAllBeaconFrame( - IN PRTMP_ADAPTER pAd); - - -// ap_sync.c - -VOID APSyncStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID APScanTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID APInvalidStateWhenScan( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APScanTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerProbeReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerBeaconAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APMlmeScanReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerBeaconAtScanAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APScanCnclAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID ApSiteSurvey( - IN PRTMP_ADAPTER pAd); - -VOID SupportRate( - IN PUCHAR SupRate, - IN UCHAR SupRateLen, - IN PUCHAR ExtRate, - IN UCHAR ExtRateLen, - OUT PUCHAR *Rates, - OUT PUCHAR RatesLen, - OUT PUCHAR pMaxSupportRate); - - -BOOLEAN ApScanRunning( - IN PRTMP_ADAPTER pAd); - -// ap_wpa.c - -VOID APWpaStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - // ap_mlme.c -VOID APMlmePeriodicExec( - IN PRTMP_ADAPTER pAd); - -VOID APMlmeSelectTxRateTable( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR *ppTable, - IN PUCHAR pTableSize, - IN PUCHAR pInitTxRateIdx); - -VOID APMlmeSetTxRate( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PRTMP_TX_RATE_SWITCH pTxRate); - -VOID APMlmeDynamicTxRateSwitching( - IN PRTMP_ADAPTER pAd); - -VOID APQuickResponeForRateUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -BOOLEAN APMsgTypeSubst( - IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, - OUT INT *Machine, - OUT INT *MsgType); - -VOID APQuickResponeForRateUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - #ifdef RT2870 VOID BeaconUpdateExec( IN PVOID SystemSpecific1, @@ -336,34 +54,8 @@ VOID RTMPSetPiggyBack( IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack); -VOID APAsicEvaluateRxAnt( - IN PRTMP_ADAPTER pAd); - -VOID APAsicRxAntEvalTimeout( - IN PRTMP_ADAPTER pAd); - // ap.c -VOID APSwitchChannel( - IN PRTMP_ADAPTER pAd, - IN INT Channel); - -NDIS_STATUS APInitialize( - IN PRTMP_ADAPTER pAd); - -VOID APShutdown( - IN PRTMP_ADAPTER pAd); - -VOID APStartUp( - IN PRTMP_ADAPTER pAd); - -VOID APStop( - IN PRTMP_ADAPTER pAd); - -VOID APCleanupPsQueue( - IN PRTMP_ADAPTER pAd, - IN PQUEUE_HEADER pQueue); - VOID MacTableReset( IN PRTMP_ADAPTER pAd); @@ -382,150 +74,5 @@ MAC_TABLE_ENTRY *MacTableLookup( IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr); -VOID MacTableMaintenance( - IN PRTMP_ADAPTER pAd); - -UINT32 MacTableAssocStaNumGet( - IN PRTMP_ADAPTER pAd); - -MAC_TABLE_ENTRY *APSsPsInquiry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - OUT SST *Sst, - OUT USHORT *Aid, - OUT UCHAR *PsMode, - OUT UCHAR *Rate); - -BOOLEAN APPsIndicate( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN ULONG Wcid, - IN UCHAR Psm); - -VOID ApLogEvent( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN USHORT Event); - -VOID APUpdateOperationMode( - IN PRTMP_ADAPTER pAd); - -VOID APUpdateCapabilityAndErpIe( - IN PRTMP_ADAPTER pAd); - -BOOLEAN ApCheckAccessControlList( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR Apidx); - -VOID ApUpdateAccessControlList( - IN PRTMP_ADAPTER pAd, - IN UCHAR Apidx); - -VOID ApEnqueueNullFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR TxRate, - IN UCHAR PID, - IN UCHAR apidx, - IN BOOLEAN bQosNull, - IN BOOLEAN bEOSP, - IN UCHAR OldUP); - -VOID ApSendFrame( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuffer, - IN ULONG Length, - IN UCHAR TxRate, - IN UCHAR PID); - -VOID ApEnqueueAckFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR TxRate, - IN UCHAR apidx); - -UCHAR APAutoSelectChannel( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN Optimal); - -// ap_sanity.c - - -BOOLEAN PeerAssocReqCmmSanity( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN isRessoc, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pListenInterval, - OUT PUCHAR pApAddr, - OUT UCHAR *pSsidLen, - OUT char *Ssid, - OUT UCHAR *pRatesLen, - OUT UCHAR Rates[], - OUT UCHAR *RSN, - OUT UCHAR *pRSNLen, - OUT BOOLEAN *pbWmmCapable, - OUT ULONG *pRalinkIe, - OUT UCHAR *pHtCapabilityLen, - OUT HT_CAPABILITY_IE *pHtCapability); - -BOOLEAN PeerDisassocReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *Reason); - -BOOLEAN PeerDeauthReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *Reason); - -BOOLEAN APPeerAuthSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr1, - OUT PUCHAR pAddr2, - OUT USHORT *Alg, - OUT USHORT *Seq, - OUT USHORT *Status, - CHAR *ChlgText); - -BOOLEAN APPeerProbeReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT CHAR Ssid[], - OUT UCHAR *SsidLen); - -BOOLEAN APPeerBeaconAndProbeRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT PUCHAR pBssid, - OUT CHAR Ssid[], - OUT UCHAR *SsidLen, - OUT UCHAR *BssType, - OUT USHORT *BeaconPeriod, - OUT UCHAR *Channel, - OUT LARGE_INTEGER *Timestamp, - OUT USHORT *CapabilityInfo, - OUT UCHAR Rate[], - OUT UCHAR *RateLen, - OUT BOOLEAN *ExtendedRateIeExist, - OUT UCHAR *Erp); - - -// ================== end of AP RTMP.h ======================== - - #endif // __AP_H__ diff --git a/drivers/staging/rt2860/chlist.h b/drivers/staging/rt2860/chlist.h index 1ad26b57408..f49a35c95de 100644 --- a/drivers/staging/rt2860/chlist.h +++ b/drivers/staging/rt2860/chlist.h @@ -524,12 +524,7 @@ static CH_REGION ChRegion[] = JAP, { { 1, 14, 20, BOTH, FALSE}, // 2.4 G, ch 1~14 -#ifndef RT30xx { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 -#endif -#ifdef RT30xx - { 34, 4, 23, IDOR, FALSE}, // 5G, ch 34~46 -#endif { 0}, // end } }, diff --git a/drivers/staging/rt2860/common/action.c b/drivers/staging/rt2860/common/action.c index a4d9fdc0736..256cb67e059 100644 --- a/drivers/staging/rt2860/common/action.c +++ b/drivers/staging/rt2860/common/action.c @@ -528,15 +528,8 @@ VOID SendRefreshBAR( sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); - if (1) // Now we always send BAR. - { -#ifndef RT30xx - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); -#endif -#ifdef RT30xx - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); -#endif - } + MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); + MlmeFreeMemory(pAd, pOutBuffer); } } diff --git a/drivers/staging/rt2860/common/ba_action.c b/drivers/staging/rt2860/common/ba_action.c index b95a341caac..b7bbe99d4d5 100644 --- a/drivers/staging/rt2860/common/ba_action.c +++ b/drivers/staging/rt2860/common/ba_action.c @@ -531,12 +531,10 @@ VOID BAOriSessionSetUp( pBAEntry->TimeOutValue = TimeOut; pBAEntry->pAdapter = pAd; -#ifdef RT30xx DBGPRINT(RT_DEBUG_TRACE,("Send AddBA to %02x:%02x:%02x:%02x:%02x:%02x Tid:%d isForced:%d Wcid:%d\n" ,pEntry->Addr[0],pEntry->Addr[1],pEntry->Addr[2] ,pEntry->Addr[3],pEntry->Addr[4],pEntry->Addr[5] ,TID,isForced,pEntry->Aid)); -#endif if (!(pEntry->TXBAbitmap & (1<<TID))) { @@ -869,6 +867,8 @@ VOID BAOriSessionTearDown( // force send specified TID DelBA MLME_DELBA_REQ_STRUCT DelbaReq; MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); + if (Elem == NULL) + return; NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); @@ -902,6 +902,8 @@ VOID BAOriSessionTearDown( { MLME_DELBA_REQ_STRUCT DelbaReq; MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); + if (Elem == NULL) + return; NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); @@ -1078,16 +1080,11 @@ VOID BAOriSessionSetupTimeout( AddbaReq.Token = pBAEntry->Token; MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ADD_BA_CATE, sizeof(MLME_ADDBA_REQ_STRUCT), (PVOID)&AddbaReq); RT28XX_MLME_HANDLER(pAd); -#ifndef RT30xx - DBGPRINT(RT_DEBUG_TRACE,("BA Ori Session Timeout(%d) : Send ADD BA again\n", pBAEntry->Token)); -#endif -#ifdef RT30xx DBGPRINT(RT_DEBUG_TRACE,("BA Ori Session Timeout(%d) to %02x:%02x:%02x:%02x:%02x:%02x Tid:%d Wcid:%d\n" ,pBAEntry->Token ,pEntry->Addr[0],pEntry->Addr[1],pEntry->Addr[2] ,pEntry->Addr[3],pEntry->Addr[4],pEntry->Addr[5] ,pBAEntry->TID,pEntry->Aid)); -#endif pBAEntry->Token++; RTMPSetTimer(&pBAEntry->ORIBATimer, ORI_BA_SESSION_TIMEOUT); } @@ -1391,10 +1388,8 @@ VOID SendPSMPAction( //ULONG Idx; FRAME_PSMP_ACTION Frame; ULONG FrameLen; -#ifdef RT30xx UCHAR bbpdata=0; UINT32 macdata; -#endif // RT30xx // NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory if (NStatus != NDIS_STATUS_SUCCESS) @@ -1410,7 +1405,6 @@ VOID SendPSMPAction( switch (Psmp) { case MMPS_ENABLE: -#ifdef RT30xx if (IS_RT3090(pAd)) { // disable MMPS BBP control register @@ -1423,11 +1417,9 @@ VOID SendPSMPAction( macdata &= ~(0x09); //bit 0, 3 RTMP_IO_WRITE32(pAd, 0x1210, macdata); } -#endif // RT30xx // Frame.Psmp = 0; break; case MMPS_DYNAMIC: -#ifdef RT30xx if (IS_RT3090(pAd)) { // enable MMPS BBP control register @@ -1440,11 +1432,9 @@ VOID SendPSMPAction( macdata |= 0x09; //bit 0, 3 RTMP_IO_WRITE32(pAd, 0x1210, macdata); } -#endif // RT30xx // Frame.Psmp = 3; break; case MMPS_STATIC: -#ifdef RT30xx if (IS_RT3090(pAd)) { // enable MMPS BBP control register @@ -1457,7 +1447,6 @@ VOID SendPSMPAction( macdata |= 0x09; //bit 0, 3 RTMP_IO_WRITE32(pAd, 0x1210, macdata); } -#endif // RT30xx // Frame.Psmp = 1; break; } diff --git a/drivers/staging/rt2860/common/cmm_data.c b/drivers/staging/rt2860/common/cmm_data.c index 66eca202eae..774fabb0be4 100644 --- a/drivers/staging/rt2860/common/cmm_data.c +++ b/drivers/staging/rt2860/common/cmm_data.c @@ -252,114 +252,6 @@ NDIS_STATUS MiniportMMRequestUnlock( return Status; } #endif -#ifdef RT30xx -NDIS_STATUS MlmeDataHardTransmit( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket); - -#define MAX_DATAMM_RETRY 3 -/* - ======================================================================== - - Routine Description: - API for MLME to transmit management frame to AP (BSS Mode) - or station (IBSS Mode) - - Arguments: - pAd Pointer to our adapter - pData Pointer to the outgoing 802.11 frame - Length Size of outgoing management frame - - Return Value: - NDIS_STATUS_FAILURE - NDIS_STATUS_PENDING - NDIS_STATUS_SUCCESS - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -NDIS_STATUS MiniportDataMMRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PUCHAR pData, - IN UINT Length) -{ - PNDIS_PACKET pPacket; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - ULONG FreeNum; - int retry = 0; - UCHAR IrqState; - UCHAR rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; //RTMP_HW_HDR_LEN]; - - ASSERT(Length <= MGMT_DMA_BUFFER_SIZE); - - // 2860C use Tx Ring - IrqState = pAd->irq_disabled; - - do - { - // Reset is in progress, stop immediately - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)|| - !RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) - { - Status = NDIS_STATUS_FAILURE; - break; - } - - // Check Free priority queue - // Since we use PBF Queue2 for management frame. Its corresponding DMA ring should be using TxRing. - - // 2860C use Tx Ring - - // free Tx(QueIdx) resources - FreeNum = GET_TXRING_FREENO(pAd, QueIdx); - - if ((FreeNum > 0)) - { - // We need to reserve space for rtmp hardware header. i.e., TxWI for RT2860 and TxInfo+TxWI for RT2870 - NdisZeroMemory(&rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE)); - Status = RTMPAllocateNdisPacket(pAd, &pPacket, (PUCHAR)&rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE), pData, Length); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_WARN, ("MiniportMMRequest (error:: can't allocate NDIS PACKET)\n")); - break; - } - - //pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; - //pAd->CommonCfg.MlmeRate = RATE_2; - - - Status = MlmeDataHardTransmit(pAd, QueIdx, pPacket); - if (Status != NDIS_STATUS_SUCCESS) - RTMPFreeNdisPacket(pAd, pPacket); - retry = MAX_DATAMM_RETRY; - } - else - { - retry ++; - - printk("retry %d\n", retry); - pAd->RalinkCounters.MgmtRingFullCount++; - - if (retry >= MAX_DATAMM_RETRY) - { - DBGPRINT(RT_DEBUG_ERROR, ("Qidx(%d), not enough space in DataRing, MgmtRingFullCount=%ld!\n", - QueIdx, pAd->RalinkCounters.MgmtRingFullCount)); - } - } - - } while (retry < MAX_DATAMM_RETRY); - - - return Status; -} -#endif /* RT30xx */ /* ======================================================================== @@ -588,24 +480,6 @@ NDIS_STATUS MlmeHardTransmitTxRing( } #endif /* RT2860 */ -#ifdef RT30xx -NDIS_STATUS MlmeDataHardTransmit( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) -{ - if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) - ) - { - return NDIS_STATUS_FAILURE; - } - -#ifdef RT2870 - return MlmeHardTransmitMgmtRing(pAd,QueIdx,pPacket); -#endif // RT2870 // -} -#endif /* RT30xx */ - NDIS_STATUS MlmeHardTransmitMgmtRing( IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx, @@ -1013,11 +887,6 @@ BOOLEAN RTMP_FillTxBlkInfo( } return TRUE; - -#ifdef RT30xx -FillTxBlkErr: - return FALSE; -#endif } @@ -1096,10 +965,6 @@ VOID RTMPDeQueuePacket( TX_BLK TxBlk; TX_BLK *pTxBlk; -#ifdef DBG_DIAGNOSE - BOOLEAN firstRound; - RtmpDiagStruct *pDiagStruct = &pAd->DiagStruct; -#endif if (QIdx == NUM_OF_TX_RING) @@ -1119,9 +984,6 @@ VOID RTMPDeQueuePacket( RT28XX_START_DEQUEUE(pAd, QueIdx, IrqFlags); -#ifdef DBG_DIAGNOSE - firstRound = ((QueIdx == 0) ? TRUE : FALSE); -#endif // DBG_DIAGNOSE // while (1) { @@ -1141,31 +1003,12 @@ VOID RTMPDeQueuePacket( DEQUEUE_LOCK(&pAd->irq_lock, bIntContext, IrqFlags); if (&pAd->TxSwQueue[QueIdx] == NULL) { -#ifdef DBG_DIAGNOSE - if (firstRound == TRUE) - pDiagStruct->TxSWQueCnt[pDiagStruct->ArrayCurIdx][0]++; -#endif // DBG_DIAGNOSE // DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); break; } #ifdef RT2860 FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); -#ifdef DBG_DIAGNOSE - if (firstRound == TRUE) - { - UCHAR txDescNumLevel, txSwQNumLevel; - - txDescNumLevel = (TX_RING_SIZE - FreeNumber[QueIdx]); // Number of occupied hw desc. - txDescNumLevel = ((txDescNumLevel <=15) ? txDescNumLevel : 15); - pDiagStruct->TxDescCnt[pDiagStruct->ArrayCurIdx][txDescNumLevel]++; - - txSwQNumLevel = ((pAd->TxSwQueue[QueIdx].Number <=7) ? pAd->TxSwQueue[QueIdx].Number : 8); - pDiagStruct->TxSWQueCnt[pDiagStruct->ArrayCurIdx][txSwQNumLevel]++; - - firstRound = FALSE; - } -#endif // DBG_DIAGNOSE // if (FreeNumber[QueIdx] <= 5) { @@ -1533,13 +1376,6 @@ VOID RTMPWriteTxWI_Data( } } -#ifdef DBG_DIAGNOSE - if (pTxBlk->QueIdx== 0) - { - pAd->DiagStruct.TxDataCnt[pAd->DiagStruct.ArrayCurIdx]++; - pAd->DiagStruct.TxMcsCnt[pAd->DiagStruct.ArrayCurIdx][pTxWI->MCS]++; - } -#endif // DBG_DIAGNOSE // // for rate adapation pTxWI->PacketId = pTxWI->MCS; @@ -1598,13 +1434,6 @@ VOID RTMPWriteTxWI_Cache( } } -#ifdef DBG_DIAGNOSE - if (pTxBlk->QueIdx== 0) - { - pAd->DiagStruct.TxDataCnt[pAd->DiagStruct.ArrayCurIdx]++; - pAd->DiagStruct.TxMcsCnt[pAd->DiagStruct.ArrayCurIdx][pTxWI->MCS]++; - } -#endif // DBG_DIAGNOSE // pTxWI->MPDUtotalByteCount = pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; @@ -2062,119 +1891,6 @@ VOID RTMPHandleRxCoherentInterrupt( DBGPRINT(RT_DEBUG_TRACE, ("<== RTMPHandleRxCoherentInterrupt \n")); } - - -VOID DBGPRINT_TX_RING( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx) -{ - UINT32 Ac0Base; - UINT32 Ac0HwIdx = 0, Ac0SwIdx = 0, AC0freeIdx; - int i; - PULONG ptemp; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("=====================================================\n " )); - switch (QueIdx) - { - case QID_AC_BE: - RTMP_IO_READ32(pAd, TX_BASE_PTR0, &Ac0Base); - RTMP_IO_READ32(pAd, TX_CTX_IDX0, &Ac0SwIdx); - RTMP_IO_READ32(pAd, TX_DTX_IDX0, &Ac0HwIdx); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("All QID_AC_BE DESCRIPTOR \n " )); - for (i=0;i<TX_RING_SIZE;i++) - { - ptemp= (PULONG)pAd->TxRing[QID_AC_BE].Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08lx: %08lx: %08lx: %08lx\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, (" \n " )); - break; - case QID_AC_BK: - RTMP_IO_READ32(pAd, TX_BASE_PTR1, &Ac0Base); - RTMP_IO_READ32(pAd, TX_CTX_IDX1, &Ac0SwIdx); - RTMP_IO_READ32(pAd, TX_DTX_IDX1, &Ac0HwIdx); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("All QID_AC_BK DESCRIPTOR \n " )); - for (i=0;i<TX_RING_SIZE;i++) - { - ptemp= (PULONG)pAd->TxRing[QID_AC_BK].Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08lx: %08lx: %08lx: %08lx\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, (" \n " )); - break; - case QID_AC_VI: - RTMP_IO_READ32(pAd, TX_BASE_PTR2, &Ac0Base); - RTMP_IO_READ32(pAd, TX_CTX_IDX2, &Ac0SwIdx); - RTMP_IO_READ32(pAd, TX_DTX_IDX2, &Ac0HwIdx); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("All QID_AC_VI DESCRIPTOR \n " )); - for (i=0;i<TX_RING_SIZE;i++) - { - ptemp= (PULONG)pAd->TxRing[QID_AC_VI].Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08lx: %08lx: %08lx: %08lx\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, (" \n " )); - break; - case QID_AC_VO: - RTMP_IO_READ32(pAd, TX_BASE_PTR3, &Ac0Base); - RTMP_IO_READ32(pAd, TX_CTX_IDX3, &Ac0SwIdx); - RTMP_IO_READ32(pAd, TX_DTX_IDX3, &Ac0HwIdx); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("All QID_AC_VO DESCRIPTOR \n " )); - for (i=0;i<TX_RING_SIZE;i++) - { - ptemp= (PULONG)pAd->TxRing[QID_AC_VO].Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08lx: %08lx: %08lx: %08lx\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, (" \n " )); - break; - case QID_MGMT: - RTMP_IO_READ32(pAd, TX_BASE_PTR5, &Ac0Base); - RTMP_IO_READ32(pAd, TX_CTX_IDX5, &Ac0SwIdx); - RTMP_IO_READ32(pAd, TX_DTX_IDX5, &Ac0HwIdx); - DBGPRINT_RAW(RT_DEBUG_TRACE, (" All QID_MGMT DESCRIPTOR \n " )); - for (i=0;i<MGMT_RING_SIZE;i++) - { - ptemp= (PULONG)pAd->MgmtRing.Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08lx: %08lx: %08lx: %08lx\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, (" \n " )); - break; - - default: - DBGPRINT_ERR(("DBGPRINT_TX_RING(Ring %d) not supported\n", QueIdx)); - break; - } - AC0freeIdx = pAd->TxRing[QueIdx].TxSwFreeIdx; - - DBGPRINT(RT_DEBUG_TRACE,("TxRing%d, TX_DTX_IDX=%d, TX_CTX_IDX=%d\n", QueIdx, Ac0HwIdx, Ac0SwIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE,(" TxSwFreeIdx[%d]", AC0freeIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE,(" pending-NDIS=%ld\n", pAd->RalinkCounters.PendingNdisPacketCount)); - - -} - - -VOID DBGPRINT_RX_RING( - IN PRTMP_ADAPTER pAd) -{ - UINT32 Ac0Base; - UINT32 Ac0HwIdx = 0, Ac0SwIdx = 0, AC0freeIdx; - int i; - UINT32 *ptemp; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("=====================================================\n " )); - RTMP_IO_READ32(pAd, RX_BASE_PTR, &Ac0Base); - RTMP_IO_READ32(pAd, RX_CRX_IDX, &Ac0SwIdx); - RTMP_IO_READ32(pAd, RX_DRX_IDX, &Ac0HwIdx); - AC0freeIdx = pAd->RxRing.RxSwReadIdx; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("All RX DSP \n " )); - for (i=0;i<RX_RING_SIZE;i++) - { - ptemp = (UINT32 *)pAd->RxRing.Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08x: %08x: %08x: %08x\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT(RT_DEBUG_TRACE,("RxRing, RX_DRX_IDX=%d, RX_CRX_IDX=%d \n", Ac0HwIdx, Ac0SwIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE,(" RxSwReadIdx [%d]=", AC0freeIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE,(" pending-NDIS=%ld\n", pAd->RalinkCounters.PendingNdisPacketCount)); -} #endif /* RT2860 */ /* @@ -2235,7 +1951,6 @@ VOID RTMPResumeMsduTransmission( { DBGPRINT(RT_DEBUG_TRACE,("SCAN done, resume MSDU transmission ...\n")); -#ifdef RT30xx // After finish BSS_SCAN_IN_PROGRESS, we need to restore Current R66 value // R66 should not be 0 if (pAd->BbpTuning.R66CurrentValue == 0) @@ -2243,7 +1958,7 @@ VOID RTMPResumeMsduTransmission( pAd->BbpTuning.R66CurrentValue = 0x38; DBGPRINT_ERR(("RTMPResumeMsduTransmission, R66CurrentValue=0...\n")); } -#endif + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, pAd->BbpTuning.R66CurrentValue); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); @@ -2296,6 +2011,8 @@ UINT deaggregate_AMSDU_announce( { // avoid local heap overflow, use dyanamic allocation MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); + if (Elem == NULL) + return; memmove(Elem->Msg+(LENGTH_802_11 + LENGTH_802_1_H), pPayload, PayloadSize); Elem->MsgLen = LENGTH_802_11 + LENGTH_802_1_H + PayloadSize; WpaEAPOLKeyAction(pAd, Elem); @@ -2617,11 +2334,12 @@ BOOLEAN MacTableDeleteEntry( if (pAd->MacTab.Size == 0) { pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode = 0; -#ifndef RT30xx +#ifdef RT2860 AsicUpdateProtect(pAd, 0 /*pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode*/, (ALLN_SETPROTECT), TRUE, 0 /*pAd->MacTab.fAnyStationNonGF*/); -#endif -#ifdef RT30xx - RT28XX_UPDATE_PROTECT(pAd); // edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet +#else + // edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet + // Set MAC register value according operation mode + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_UPDATE_PROTECT, NULL, 0); #endif } diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c index 306c3a21f90..9d589c240ed 100644 --- a/drivers/staging/rt2860/common/cmm_info.c +++ b/drivers/staging/rt2860/common/cmm_info.c @@ -1419,17 +1419,6 @@ VOID RTMPSetHT( pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0; } -#ifndef RT30xx -#ifdef RT2870 - /* Frank recommend ,If not, Tx maybe block in high power. Rx has no problem*/ - if(IS_RT3070(pAd) && ((pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020))) - { - pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 0; - pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0; - } -#endif // RT2870 // -#endif - if(pHTPhyMode->SHORTGI == GI_400) { pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1; @@ -2491,24 +2480,19 @@ INT Set_HtAutoBa_Proc( if (Value == 0) { pAd->CommonCfg.BACapability.field.AutoBA = FALSE; -#ifdef RT30xx pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE; -#endif } else if (Value == 1) { pAd->CommonCfg.BACapability.field.AutoBA = TRUE; -#ifdef RT30xx pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; -#endif } else return FALSE; //Invalid argument pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA; -#ifdef RT30xx pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy; -#endif + SetCommonHT(pAd); DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA)); @@ -2725,9 +2709,6 @@ PCHAR RTMPGetRalinkAuthModeStr( { case Ndis802_11AuthModeOpen: return "OPEN"; -#if defined(RT2860) || defined(RT30xx) - default: -#endif case Ndis802_11AuthModeWPAPSK: return "WPAPSK"; case Ndis802_11AuthModeShared: @@ -2742,14 +2723,10 @@ PCHAR RTMPGetRalinkAuthModeStr( return "WPAPSKWPA2PSK"; case Ndis802_11AuthModeWPA1WPA2: return "WPA1WPA2"; -#ifndef RT30xx case Ndis802_11AuthModeWPANone: return "WPANONE"; -#ifdef RT2870 default: return "UNKNOW"; -#endif -#endif } } diff --git a/drivers/staging/rt2860/common/cmm_sanity.c b/drivers/staging/rt2860/common/cmm_sanity.c index 843e44e41ab..85855f7f38c 100644 --- a/drivers/staging/rt2860/common/cmm_sanity.c +++ b/drivers/staging/rt2860/common/cmm_sanity.c @@ -1052,187 +1052,3 @@ NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity( return NetWorkType; } - -/* - ========================================================================== - Description: - WPA message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== - */ -BOOLEAN PeerWpaMessageSanity( - IN PRTMP_ADAPTER pAd, - IN PEAPOL_PACKET pMsg, - IN ULONG MsgLen, - IN UCHAR MsgType, - IN MAC_TABLE_ENTRY *pEntry) -{ - UCHAR mic[LEN_KEY_DESC_MIC], digest[80], KEYDATA[MAX_LEN_OF_RSNIE]; - BOOLEAN bReplayDiff = FALSE; - BOOLEAN bWPA2 = FALSE; - KEY_INFO EapolKeyInfo; - UCHAR GroupKeyIndex = 0; - - - NdisZeroMemory(mic, sizeof(mic)); - NdisZeroMemory(digest, sizeof(digest)); - NdisZeroMemory(KEYDATA, sizeof(KEYDATA)); - NdisZeroMemory((PUCHAR)&EapolKeyInfo, sizeof(EapolKeyInfo)); - - NdisMoveMemory((PUCHAR)&EapolKeyInfo, (PUCHAR)&pMsg->KeyDesc.KeyInfo, sizeof(KEY_INFO)); - - *((USHORT *)&EapolKeyInfo) = cpu2le16(*((USHORT *)&EapolKeyInfo)); - - // Choose WPA2 or not - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) - bWPA2 = TRUE; - - // 0. Check MsgType - if ((MsgType > EAPOL_GROUP_MSG_2) || (MsgType < EAPOL_PAIR_MSG_1)) - { - DBGPRINT(RT_DEBUG_ERROR, ("The message type is invalid(%d)! \n", MsgType)); - return FALSE; - } - - // 1. Replay counter check - if (MsgType == EAPOL_PAIR_MSG_1 || MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1) // For supplicant - { - // First validate replay counter, only accept message with larger replay counter. - // Let equal pass, some AP start with all zero replay counter - UCHAR ZeroReplay[LEN_KEY_DESC_REPLAY]; - - NdisZeroMemory(ZeroReplay, LEN_KEY_DESC_REPLAY); - if ((RTMPCompareMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY) != 1) && - (RTMPCompareMemory(pMsg->KeyDesc.ReplayCounter, ZeroReplay, LEN_KEY_DESC_REPLAY) != 0)) - { - bReplayDiff = TRUE; - } - } - else if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) // For authenticator - { - // check Replay Counter coresponds to MSG from authenticator, otherwise discard - if (!NdisEqualMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY)) - { - bReplayDiff = TRUE; - } - } - - // Replay Counter different condition - if (bReplayDiff) - { - // send wireless event - for replay counter different - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_REPLAY_COUNTER_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - if (MsgType < EAPOL_GROUP_MSG_1) - { - DBGPRINT(RT_DEBUG_ERROR, ("Replay Counter Different in pairwise msg %d of 4-way handshake!\n", MsgType)); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("Replay Counter Different in group msg %d of 2-way handshake!\n", (MsgType - EAPOL_PAIR_MSG_4))); - } - - hex_dump("Receive replay counter ", pMsg->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - hex_dump("Current replay counter ", pEntry->R_Counter, LEN_KEY_DESC_REPLAY); - return FALSE; - } - - // 2. Verify MIC except Pairwise Msg1 - if (MsgType != EAPOL_PAIR_MSG_1) - { - UCHAR rcvd_mic[LEN_KEY_DESC_MIC]; - - // Record the received MIC for check later - NdisMoveMemory(rcvd_mic, pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - - if (pEntry->WepStatus == Ndis802_11Encryption2Enabled) // TKIP - { - hmac_md5(pEntry->PTK, LEN_EAP_MICK, (PUCHAR)pMsg, MsgLen, mic); - } - else if (pEntry->WepStatus == Ndis802_11Encryption3Enabled) // AES - { - HMAC_SHA1((PUCHAR)pMsg, MsgLen, pEntry->PTK, LEN_EAP_MICK, digest); - NdisMoveMemory(mic, digest, LEN_KEY_DESC_MIC); - } - - if (!NdisEqualMemory(rcvd_mic, mic, LEN_KEY_DESC_MIC)) - { - // send wireless event - for MIC different - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_MIC_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - if (MsgType < EAPOL_GROUP_MSG_1) - { - DBGPRINT(RT_DEBUG_ERROR, ("MIC Different in pairwise msg %d of 4-way handshake!\n", MsgType)); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("MIC Different in group msg %d of 2-way handshake!\n", (MsgType - EAPOL_PAIR_MSG_4))); - } - - hex_dump("Received MIC", rcvd_mic, LEN_KEY_DESC_MIC); - hex_dump("Desired MIC", mic, LEN_KEY_DESC_MIC); - - return FALSE; - } - } - - // Extract the context of the Key Data field if it exist - // The field in pairwise_msg_2_WPA1(WPA2) & pairwise_msg_3_WPA1 is un-encrypted. - // The field in group_msg_1_WPA1(WPA2) & pairwise_msg_3_WPA2 is encrypted. - if (pMsg->KeyDesc.KeyDataLen[1] > 0) - { - // Decrypt this field - if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) - { - if(pEntry->WepStatus == Ndis802_11Encryption3Enabled) - { - // AES - AES_GTK_KEY_UNWRAP(&pEntry->PTK[16], KEYDATA, pMsg->KeyDesc.KeyDataLen[1],pMsg->KeyDesc.KeyData); - } - else - { - INT i; - UCHAR Key[32]; - // Decrypt TKIP GTK - // Construct 32 bytes RC4 Key - NdisMoveMemory(Key, pMsg->KeyDesc.KeyIv, 16); - NdisMoveMemory(&Key[16], &pEntry->PTK[16], 16); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, Key, 32); - //discard first 256 bytes - for(i = 0; i < 256; i++) - ARCFOUR_BYTE(&pAd->PrivateInfo.WEPCONTEXT); - // Decrypt GTK. Becareful, there is no ICV to check the result is correct or not - ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, KEYDATA, pMsg->KeyDesc.KeyData, pMsg->KeyDesc.KeyDataLen[1]); - } - - if (!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)) - GroupKeyIndex = EapolKeyInfo.KeyIndex; - - } - else if ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3 && !bWPA2)) - { - NdisMoveMemory(KEYDATA, pMsg->KeyDesc.KeyData, pMsg->KeyDesc.KeyDataLen[1]); - } - else - { - - return TRUE; - } - - // Parse Key Data field to - // 1. verify RSN IE for pairwise_msg_2_WPA1(WPA2) ,pairwise_msg_3_WPA1(WPA2) - // 2. verify KDE format for pairwise_msg_3_WPA2, group_msg_1_WPA2 - // 3. update shared key for pairwise_msg_3_WPA2, group_msg_1_WPA1(WPA2) - if (!RTMPParseEapolKeyData(pAd, KEYDATA, pMsg->KeyDesc.KeyDataLen[1], GroupKeyIndex, MsgType, bWPA2, pEntry)) - { - return FALSE; - } - } - - return TRUE; - -} diff --git a/drivers/staging/rt2860/common/cmm_wpa.c b/drivers/staging/rt2860/common/cmm_wpa.c index bda69e76867..2de29fde2c4 100644 --- a/drivers/staging/rt2860/common/cmm_wpa.c +++ b/drivers/staging/rt2860/common/cmm_wpa.c @@ -39,14 +39,10 @@ // WPA OUI UCHAR OUI_WPA_NONE_AKM[4] = {0x00, 0x50, 0xF2, 0x00}; UCHAR OUI_WPA_VERSION[4] = {0x00, 0x50, 0xF2, 0x01}; -#ifndef RT30xx UCHAR OUI_WPA_WEP40[4] = {0x00, 0x50, 0xF2, 0x01}; -#endif UCHAR OUI_WPA_TKIP[4] = {0x00, 0x50, 0xF2, 0x02}; UCHAR OUI_WPA_CCMP[4] = {0x00, 0x50, 0xF2, 0x04}; -#ifndef RT30xx UCHAR OUI_WPA_WEP104[4] = {0x00, 0x50, 0xF2, 0x05}; -#endif UCHAR OUI_WPA_8021X_AKM[4] = {0x00, 0x50, 0xF2, 0x01}; UCHAR OUI_WPA_PSK_AKM[4] = {0x00, 0x50, 0xF2, 0x02}; // WPA2 OUI @@ -55,9 +51,7 @@ UCHAR OUI_WPA2_TKIP[4] = {0x00, 0x0F, 0xAC, 0x02}; UCHAR OUI_WPA2_CCMP[4] = {0x00, 0x0F, 0xAC, 0x04}; UCHAR OUI_WPA2_8021X_AKM[4] = {0x00, 0x0F, 0xAC, 0x01}; UCHAR OUI_WPA2_PSK_AKM[4] = {0x00, 0x0F, 0xAC, 0x02}; -#ifndef RT30xx UCHAR OUI_WPA2_WEP104[4] = {0x00, 0x0F, 0xAC, 0x05}; -#endif // MSA OUI UCHAR OUI_MSA_8021X_AKM[4] = {0x00, 0x0F, 0xAC, 0x05}; // Not yet final - IEEE 802.11s-D1.06 UCHAR OUI_MSA_PSK_AKM[4] = {0x00, 0x0F, 0xAC, 0x06}; // Not yet final - IEEE 802.11s-D1.06 @@ -376,7 +370,6 @@ static VOID RTMPInsertRsnIeCipher( break; } -#ifndef RT30xx if ((pAd->OpMode == OPMODE_STA) && (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) @@ -392,7 +385,7 @@ static VOID RTMPInsertRsnIeCipher( break; } } -#endif + // swap for big-endian platform pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); @@ -453,7 +446,6 @@ static VOID RTMPInsertRsnIeCipher( break; } -#ifndef RT30xx if ((pAd->OpMode == OPMODE_STA) && (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) @@ -469,7 +461,7 @@ static VOID RTMPInsertRsnIeCipher( break; } } -#endif + // swap for big-endian platform pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); @@ -771,70 +763,6 @@ BOOLEAN RTMPCheckWPAframe( return TRUE; } - -/* - ========================================================================== - Description: - ENCRYPT AES GTK before sending in EAPOL frame. - AES GTK length = 128 bit, so fix blocks for aes-key-wrap as 2 in this function. - This function references to RFC 3394 for aes key wrap algorithm. - Return: - ========================================================================== -*/ -VOID AES_GTK_KEY_WRAP( - IN UCHAR *key, - IN UCHAR *plaintext, - IN UCHAR p_len, - OUT UCHAR *ciphertext) -{ - UCHAR A[8], BIN[16], BOUT[16]; - UCHAR R[512]; - INT num_blocks = p_len/8; // unit:64bits - INT i, j; - aes_context aesctx; - UCHAR xor; - - rtmp_aes_set_key(&aesctx, key, 128); - - // Init IA - for (i = 0; i < 8; i++) - A[i] = 0xa6; - - //Input plaintext - for (i = 0; i < num_blocks; i++) - { - for (j = 0 ; j < 8; j++) - R[8 * (i + 1) + j] = plaintext[8 * i + j]; - } - - // Key Mix - for (j = 0; j < 6; j++) - { - for(i = 1; i <= num_blocks; i++) - { - //phase 1 - NdisMoveMemory(BIN, A, 8); - NdisMoveMemory(&BIN[8], &R[8 * i], 8); - rtmp_aes_encrypt(&aesctx, BIN, BOUT); - - NdisMoveMemory(A, &BOUT[0], 8); - xor = num_blocks * j + i; - A[7] = BOUT[7] ^ xor; - NdisMoveMemory(&R[8 * i], &BOUT[8], 8); - } - } - - // Output ciphertext - NdisMoveMemory(ciphertext, A, 8); - - for (i = 1; i <= num_blocks; i++) - { - for (j = 0 ; j < 8; j++) - ciphertext[8 * i + j] = R[8 * i + j]; - } -} - - /* ======================================================================== @@ -906,733 +834,3 @@ VOID AES_GTK_KEY_UNWRAP( os_free_mem(NULL, R); } - -/* - ========================================================================== - Description: - Report the EAP message type - - Arguments: - msg - EAPOL_PAIR_MSG_1 - EAPOL_PAIR_MSG_2 - EAPOL_PAIR_MSG_3 - EAPOL_PAIR_MSG_4 - EAPOL_GROUP_MSG_1 - EAPOL_GROUP_MSG_2 - - Return: - message type string - - ========================================================================== -*/ -CHAR *GetEapolMsgType(CHAR msg) -{ - if(msg == EAPOL_PAIR_MSG_1) - return "Pairwise Message 1"; - else if(msg == EAPOL_PAIR_MSG_2) - return "Pairwise Message 2"; - else if(msg == EAPOL_PAIR_MSG_3) - return "Pairwise Message 3"; - else if(msg == EAPOL_PAIR_MSG_4) - return "Pairwise Message 4"; - else if(msg == EAPOL_GROUP_MSG_1) - return "Group Message 1"; - else if(msg == EAPOL_GROUP_MSG_2) - return "Group Message 2"; - else - return "Invalid Message"; -} - - -/* - ======================================================================== - - Routine Description: - Check Sanity RSN IE of EAPoL message - - Arguments: - - Return Value: - - - ======================================================================== -*/ -BOOLEAN RTMPCheckRSNIE( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN UCHAR DataLen, - IN MAC_TABLE_ENTRY *pEntry, - OUT UCHAR *Offset) -{ - PUCHAR pVIE; - UCHAR len; - PEID_STRUCT pEid; - BOOLEAN result = FALSE; - - pVIE = pData; - len = DataLen; - *Offset = 0; - - while (len > sizeof(RSNIE2)) - { - pEid = (PEID_STRUCT) pVIE; - // WPA RSN IE - if ((pEid->Eid == IE_WPA) && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4))) - { - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA || pEntry->AuthMode == Ndis802_11AuthModeWPAPSK) && - (NdisEqualMemory(pVIE, pEntry->RSN_IE, pEntry->RSNIE_Len)) && - (pEntry->RSNIE_Len == (pEid->Len + 2))) - { - result = TRUE; - } - - *Offset += (pEid->Len + 2); - } - // WPA2 RSN IE - else if ((pEid->Eid == IE_RSN) && (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3))) - { - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2 || pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) && - (NdisEqualMemory(pVIE, pEntry->RSN_IE, pEntry->RSNIE_Len)) && - (pEntry->RSNIE_Len == (pEid->Len + 2))/* ToDo-AlbertY for mesh*/) - { - result = TRUE; - } - - *Offset += (pEid->Len + 2); - } - else - { - break; - } - - pVIE += (pEid->Len + 2); - len -= (pEid->Len + 2); - } - - - return result; - -} - - -/* - ======================================================================== - - Routine Description: - Parse KEYDATA field. KEYDATA[] May contain 2 RSN IE and optionally GTK. - GTK is encaptulated in KDE format at p.83 802.11i D10 - - Arguments: - - Return Value: - - Note: - 802.11i D10 - - ======================================================================== -*/ -BOOLEAN RTMPParseEapolKeyData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN UCHAR GroupKeyIndex, - IN UCHAR MsgType, - IN BOOLEAN bWPA2, - IN MAC_TABLE_ENTRY *pEntry) -{ - PKDE_ENCAP pKDE = NULL; - PUCHAR pMyKeyData = pKeyData; - UCHAR KeyDataLength = KeyDataLen; - UCHAR GTKLEN = 0; - UCHAR DefaultIdx = 0; - UCHAR skip_offset; - - // Verify The RSN IE contained in pairewise_msg_2 && pairewise_msg_3 and skip it - if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_3) - { - // Check RSN IE whether it is WPA2/WPA2PSK - if (!RTMPCheckRSNIE(pAd, pKeyData, KeyDataLen, pEntry, &skip_offset)) - { - // send wireless event - for RSN IE different - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_RSNIE_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - DBGPRINT(RT_DEBUG_ERROR, ("RSN_IE Different in msg %d of 4-way handshake!\n", MsgType)); - hex_dump("Receive RSN_IE ", pKeyData, KeyDataLen); - hex_dump("Desired RSN_IE ", pEntry->RSN_IE, pEntry->RSNIE_Len); - - return FALSE; - } - else - { - if (bWPA2 && MsgType == EAPOL_PAIR_MSG_3) - { - // skip RSN IE - pMyKeyData += skip_offset; - KeyDataLength -= skip_offset; - DBGPRINT(RT_DEBUG_TRACE, ("RTMPParseEapolKeyData ==> WPA2/WPA2PSK RSN IE matched in Msg 3, Length(%d) \n", skip_offset)); - } - else - return TRUE; - } - } - - DBGPRINT(RT_DEBUG_TRACE,("RTMPParseEapolKeyData ==> KeyDataLength %d without RSN_IE \n", KeyDataLength)); - - // Parse EKD format in pairwise_msg_3_WPA2 && group_msg_1_WPA2 - if (bWPA2 && (MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1)) - { - if (KeyDataLength >= 8) // KDE format exclude GTK length - { - pKDE = (PKDE_ENCAP) pMyKeyData; - - - DefaultIdx = pKDE->GTKEncap.Kid; - - // Sanity check - KED length - if (KeyDataLength < (pKDE->Len + 2)) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: The len from KDE is too short \n")); - return FALSE; - } - - // Get GTK length - refer to IEEE 802.11i-2004 p.82 - GTKLEN = pKDE->Len -6; - if (GTKLEN < LEN_AES_KEY) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key length is too short (%d) \n", GTKLEN)); - return FALSE; - } - - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: KDE format length is too short \n")); - return FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("GTK in KDE format ,DefaultKeyID=%d, KeyLen=%d \n", DefaultIdx, GTKLEN)); - // skip it - pMyKeyData += 8; - KeyDataLength -= 8; - - } - else if (!bWPA2 && MsgType == EAPOL_GROUP_MSG_1) - { - DefaultIdx = GroupKeyIndex; - DBGPRINT(RT_DEBUG_TRACE, ("GTK DefaultKeyID=%d \n", DefaultIdx)); - } - - // Sanity check - shared key index must be 1 ~ 3 - if (DefaultIdx < 1 || DefaultIdx > 3) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key index(%d) is invalid in %s %s \n", DefaultIdx, ((bWPA2) ? "WPA2" : "WPA"), GetEapolMsgType(MsgType))); - return FALSE; - } - - return TRUE; - -} - - -/* - ======================================================================== - - Routine Description: - Construct EAPoL message for WPA handshaking - Its format is below, - - +--------------------+ - | Protocol Version | 1 octet - +--------------------+ - | Protocol Type | 1 octet - +--------------------+ - | Body Length | 2 octets - +--------------------+ - | Descriptor Type | 1 octet - +--------------------+ - | Key Information | 2 octets - +--------------------+ - | Key Length | 1 octet - +--------------------+ - | Key Repaly Counter | 8 octets - +--------------------+ - | Key Nonce | 32 octets - +--------------------+ - | Key IV | 16 octets - +--------------------+ - | Key RSC | 8 octets - +--------------------+ - | Key ID or Reserved | 8 octets - +--------------------+ - | Key MIC | 16 octets - +--------------------+ - | Key Data Length | 2 octets - +--------------------+ - | Key Data | n octets - +--------------------+ - - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID ConstructEapolMsg( - IN PRTMP_ADAPTER pAd, - IN UCHAR AuthMode, - IN UCHAR WepStatus, - IN UCHAR GroupKeyWepStatus, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR *ReplayCounter, - IN UCHAR *KeyNonce, - IN UCHAR *TxRSC, - IN UCHAR *PTK, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_Len, - OUT PEAPOL_PACKET pMsg) -{ - BOOLEAN bWPA2 = FALSE; - - // Choose WPA2 or not - if ((AuthMode == Ndis802_11AuthModeWPA2) || (AuthMode == Ndis802_11AuthModeWPA2PSK)) - bWPA2 = TRUE; - - // Init Packet and Fill header - pMsg->ProVer = EAPOL_VER; - pMsg->ProType = EAPOLKey; - - // Default 95 bytes, the EAPoL-Key descriptor exclude Key-data field - pMsg->Body_Len[1] = LEN_EAPOL_KEY_MSG; - - // Fill in EAPoL descriptor - if (bWPA2) - pMsg->KeyDesc.Type = WPA2_KEY_DESC; - else - pMsg->KeyDesc.Type = WPA1_KEY_DESC; - - // Fill in Key information, refer to IEEE Std 802.11i-2004 page 78 - // When either the pairwise or the group cipher is AES, the DESC_TYPE_AES(2) shall be used. - pMsg->KeyDesc.KeyInfo.KeyDescVer = - (((WepStatus == Ndis802_11Encryption3Enabled) || (GroupKeyWepStatus == Ndis802_11Encryption3Enabled)) ? (DESC_TYPE_AES) : (DESC_TYPE_TKIP)); - - // Specify Key Type as Group(0) or Pairwise(1) - if (MsgType >= EAPOL_GROUP_MSG_1) - pMsg->KeyDesc.KeyInfo.KeyType = GROUPKEY; - else - pMsg->KeyDesc.KeyInfo.KeyType = PAIRWISEKEY; - - // Specify Key Index, only group_msg1_WPA1 - if (!bWPA2 && (MsgType >= EAPOL_GROUP_MSG_1)) - pMsg->KeyDesc.KeyInfo.KeyIndex = DefaultKeyIdx; - - if (MsgType == EAPOL_PAIR_MSG_3) - pMsg->KeyDesc.KeyInfo.Install = 1; - - if ((MsgType == EAPOL_PAIR_MSG_1) || (MsgType == EAPOL_PAIR_MSG_3) || (MsgType == EAPOL_GROUP_MSG_1)) - pMsg->KeyDesc.KeyInfo.KeyAck = 1; - - if (MsgType != EAPOL_PAIR_MSG_1) - pMsg->KeyDesc.KeyInfo.KeyMic = 1; - - if ((bWPA2 && (MsgType >= EAPOL_PAIR_MSG_3)) || (!bWPA2 && (MsgType >= EAPOL_GROUP_MSG_1))) - { - pMsg->KeyDesc.KeyInfo.Secure = 1; - } - - if (bWPA2 && ((MsgType == EAPOL_PAIR_MSG_3) || (MsgType == EAPOL_GROUP_MSG_1))) - { - pMsg->KeyDesc.KeyInfo.EKD_DL = 1; - } - - // key Information element has done. - *(USHORT *)(&pMsg->KeyDesc.KeyInfo) = cpu2le16(*(USHORT *)(&pMsg->KeyDesc.KeyInfo)); - - // Fill in Key Length - { - if (MsgType >= EAPOL_GROUP_MSG_1) - { - // the length of group key cipher - pMsg->KeyDesc.KeyLength[1] = ((GroupKeyWepStatus == Ndis802_11Encryption2Enabled) ? TKIP_GTK_LENGTH : LEN_AES_KEY); - } - else - { - // the length of pairwise key cipher - pMsg->KeyDesc.KeyLength[1] = ((WepStatus == Ndis802_11Encryption2Enabled) ? LEN_TKIP_KEY : LEN_AES_KEY); - } - } - - // Fill in replay counter - NdisMoveMemory(pMsg->KeyDesc.ReplayCounter, ReplayCounter, LEN_KEY_DESC_REPLAY); - - // Fill Key Nonce field - // ANonce : pairwise_msg1 & pairwise_msg3 - // SNonce : pairwise_msg2 - // GNonce : group_msg1_wpa1 - if ((MsgType <= EAPOL_PAIR_MSG_3) || ((!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)))) - NdisMoveMemory(pMsg->KeyDesc.KeyNonce, KeyNonce, LEN_KEY_DESC_NONCE); - - // Fill key IV - WPA2 as 0, WPA1 as random - if (!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)) - { - // Suggest IV be random number plus some number, - NdisMoveMemory(pMsg->KeyDesc.KeyIv, &KeyNonce[16], LEN_KEY_DESC_IV); - pMsg->KeyDesc.KeyIv[15] += 2; - } - - // Fill Key RSC field - // It contains the RSC for the GTK being installed. - if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) - { - NdisMoveMemory(pMsg->KeyDesc.KeyRsc, TxRSC, 6); - } - - // Clear Key MIC field for MIC calculation later - NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - - ConstructEapolKeyData(pAd, - AuthMode, - WepStatus, - GroupKeyWepStatus, - MsgType, - DefaultKeyIdx, - bWPA2, - PTK, - GTK, - RSNIE, - RSNIE_Len, - pMsg); - - // Calculate MIC and fill in KeyMic Field except Pairwise Msg 1. - if (MsgType != EAPOL_PAIR_MSG_1) - { - CalculateMIC(pAd, WepStatus, PTK, pMsg); - } - - DBGPRINT(RT_DEBUG_TRACE, ("===> ConstructEapolMsg for %s %s\n", ((bWPA2) ? "WPA2" : "WPA"), GetEapolMsgType(MsgType))); - DBGPRINT(RT_DEBUG_TRACE, (" Body length = %d \n", pMsg->Body_Len[1])); - DBGPRINT(RT_DEBUG_TRACE, (" Key length = %d \n", pMsg->KeyDesc.KeyLength[1])); - - -} - -/* - ======================================================================== - - Routine Description: - Construct the Key Data field of EAPoL message - - Arguments: - pAd Pointer to our adapter - Elem Message body - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID ConstructEapolKeyData( - IN PRTMP_ADAPTER pAd, - IN UCHAR AuthMode, - IN UCHAR WepStatus, - IN UCHAR GroupKeyWepStatus, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN BOOLEAN bWPA2Capable, - IN UCHAR *PTK, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_LEN, - OUT PEAPOL_PACKET pMsg) -{ - UCHAR *mpool, *Key_Data, *Rc4GTK; - UCHAR ekey[(LEN_KEY_DESC_IV+LEN_EAP_EK)]; - UCHAR data_offset; - - - if (MsgType == EAPOL_PAIR_MSG_1 || MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) - return; - - // allocate memory pool - os_alloc_mem(pAd, (PUCHAR *)&mpool, 1500); - - if (mpool == NULL) - return; - - /* Rc4GTK Len = 512 */ - Rc4GTK = (UCHAR *) ROUND_UP(mpool, 4); - /* Key_Data Len = 512 */ - Key_Data = (UCHAR *) ROUND_UP(Rc4GTK + 512, 4); - - NdisZeroMemory(Key_Data, 512); - pMsg->KeyDesc.KeyDataLen[1] = 0; - data_offset = 0; - - // Encapsulate RSNIE in pairwise_msg2 & pairwise_msg3 - if (RSNIE_LEN && ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3))) - { - if (bWPA2Capable) - Key_Data[data_offset + 0] = IE_WPA2; - else - Key_Data[data_offset + 0] = IE_WPA; - - Key_Data[data_offset + 1] = RSNIE_LEN; - NdisMoveMemory(&Key_Data[data_offset + 2], RSNIE, RSNIE_LEN); - data_offset += (2 + RSNIE_LEN); - } - - // Encapsulate KDE format in pairwise_msg3_WPA2 & group_msg1_WPA2 - if (bWPA2Capable && ((MsgType == EAPOL_PAIR_MSG_3) || (MsgType == EAPOL_GROUP_MSG_1))) - { - // Key Data Encapsulation (KDE) format - 802.11i-2004 Figure-43w and Table-20h - Key_Data[data_offset + 0] = 0xDD; - - if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) - { - Key_Data[data_offset + 1] = 0x16;// 4+2+16(OUI+DataType+DataField) - } - else - { - Key_Data[data_offset + 1] = 0x26;// 4+2+32(OUI+DataType+DataField) - } - - Key_Data[data_offset + 2] = 0x00; - Key_Data[data_offset + 3] = 0x0F; - Key_Data[data_offset + 4] = 0xAC; - Key_Data[data_offset + 5] = 0x01; - - // GTK KDE format - 802.11i-2004 Figure-43x - Key_Data[data_offset + 6] = (DefaultKeyIdx & 0x03); - Key_Data[data_offset + 7] = 0x00; // Reserved Byte - - data_offset += 8; - } - - - // Encapsulate GTK and encrypt the key-data field with KEK. - // Only for pairwise_msg3_WPA2 and group_msg1 - if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2Capable) || (MsgType == EAPOL_GROUP_MSG_1)) - { - // Fill in GTK - if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) - { - NdisMoveMemory(&Key_Data[data_offset], GTK, LEN_AES_KEY); - data_offset += LEN_AES_KEY; - } - else - { - NdisMoveMemory(&Key_Data[data_offset], GTK, TKIP_GTK_LENGTH); - data_offset += TKIP_GTK_LENGTH; - } - - // Still dont know why, but if not append will occur "GTK not include in MSG3" - // Patch for compatibility between zero config and funk - if (MsgType == EAPOL_PAIR_MSG_3 && bWPA2Capable) - { - if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) - { - Key_Data[data_offset + 0] = 0xDD; - Key_Data[data_offset + 1] = 0; - data_offset += 2; - } - else - { - Key_Data[data_offset + 0] = 0xDD; - Key_Data[data_offset + 1] = 0; - Key_Data[data_offset + 2] = 0; - Key_Data[data_offset + 3] = 0; - Key_Data[data_offset + 4] = 0; - Key_Data[data_offset + 5] = 0; - data_offset += 6; - } - } - - // Encrypt the data material in key data field - if (WepStatus == Ndis802_11Encryption3Enabled) - { - AES_GTK_KEY_WRAP(&PTK[16], Key_Data, data_offset, Rc4GTK); - // AES wrap function will grow 8 bytes in length - data_offset += 8; - } - else - { - // PREPARE Encrypted "Key DATA" field. (Encrypt GTK with RC4, usinf PTK[16]->[31] as Key, IV-field as IV) - // put TxTsc in Key RSC field - pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. - - // ekey is the contanetion of IV-field, and PTK[16]->PTK[31] - NdisMoveMemory(ekey, pMsg->KeyDesc.KeyIv, LEN_KEY_DESC_IV); - NdisMoveMemory(&ekey[LEN_KEY_DESC_IV], &PTK[16], LEN_EAP_EK); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, ekey, sizeof(ekey)); //INIT SBOX, KEYLEN+3(IV) - pAd->PrivateInfo.FCSCRC32 = RTMP_CALC_FCS32(pAd->PrivateInfo.FCSCRC32, Key_Data, data_offset); - WPAARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, Rc4GTK, Key_Data, data_offset); - } - - NdisMoveMemory(pMsg->KeyDesc.KeyData, Rc4GTK, data_offset); - } - else - { - NdisMoveMemory(pMsg->KeyDesc.KeyData, Key_Data, data_offset); - } - - // set key data length field and total length - pMsg->KeyDesc.KeyDataLen[1] = data_offset; - pMsg->Body_Len[1] += data_offset; - - os_free_mem(pAd, mpool); - -} - -/* - ======================================================================== - - Routine Description: - Calcaulate MIC. It is used during 4-ways handsharking. - - Arguments: - pAd - pointer to our pAdapter context - PeerWepStatus - indicate the encryption type - - Return Value: - - Note: - - ======================================================================== -*/ -VOID CalculateMIC( - IN PRTMP_ADAPTER pAd, - IN UCHAR PeerWepStatus, - IN UCHAR *PTK, - OUT PEAPOL_PACKET pMsg) -{ - UCHAR *OutBuffer; - ULONG FrameLen = 0; - UCHAR mic[LEN_KEY_DESC_MIC]; - UCHAR digest[80]; - - // allocate memory for MIC calculation - os_alloc_mem(pAd, (PUCHAR *)&OutBuffer, 512); - - if (OutBuffer == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("!!!CalculateMIC: no memory!!!\n")); - return; - } - - // make a frame for calculating MIC. - MakeOutgoingFrame(OutBuffer, &FrameLen, - pMsg->Body_Len[1] + 4, pMsg, - END_OF_ARGS); - - NdisZeroMemory(mic, sizeof(mic)); - - // Calculate MIC - if (PeerWepStatus == Ndis802_11Encryption3Enabled) - { - HMAC_SHA1(OutBuffer, FrameLen, PTK, LEN_EAP_MICK, digest); - NdisMoveMemory(mic, digest, LEN_KEY_DESC_MIC); - } - else - { - hmac_md5(PTK, LEN_EAP_MICK, OutBuffer, FrameLen, mic); - } - - // store the calculated MIC - NdisMoveMemory(pMsg->KeyDesc.KeyMic, mic, LEN_KEY_DESC_MIC); - - os_free_mem(pAd, OutBuffer); -} - -/* - ======================================================================== - - Routine Description: - Some received frames can't decrypt by Asic, so decrypt them by software. - - Arguments: - pAd - pointer to our pAdapter context - PeerWepStatus - indicate the encryption type - - Return Value: - NDIS_STATUS_SUCCESS - decryption successful - NDIS_STATUS_FAILURE - decryption failure - - ======================================================================== -*/ -NDIS_STATUS RTMPSoftDecryptBroadCastData( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, - IN PCIPHER_KEY pShard_key) -{ - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - - - - // handle WEP decryption - if (GroupCipher == Ndis802_11Encryption1Enabled) - { - if (RTMPSoftDecryptWEP(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, pShard_key)) - { - - //Minus IV[4] & ICV[4] - pRxWI->MPDUtotalByteCount -= 8; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR : Software decrypt WEP data fails.\n")); - // give up this frame - return NDIS_STATUS_FAILURE; - } - } - // handle TKIP decryption - else if (GroupCipher == Ndis802_11Encryption2Enabled) - { - if (RTMPSoftDecryptTKIP(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, 0, pShard_key)) - { - - //Minus 8 bytes MIC, 8 bytes IV/EIV, 4 bytes ICV - pRxWI->MPDUtotalByteCount -= 20; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR : RTMPSoftDecryptTKIP Failed\n")); - // give up this frame - return NDIS_STATUS_FAILURE; - } - } - // handle AES decryption - else if (GroupCipher == Ndis802_11Encryption3Enabled) - { - if (RTMPSoftDecryptAES(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount , pShard_key)) - { - - //8 bytes MIC, 8 bytes IV/EIV (CCMP Header) - pRxWI->MPDUtotalByteCount -= 16; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR : RTMPSoftDecryptAES Failed\n")); - // give up this frame - return NDIS_STATUS_FAILURE; - } - } - else - { - // give up this frame - return NDIS_STATUS_FAILURE; - } - - return NDIS_STATUS_SUCCESS; - -} - diff --git a/drivers/staging/rt2860/common/eeprom.c b/drivers/staging/rt2860/common/eeprom.c index 9729323baca..ffcb4ce1a03 100644 --- a/drivers/staging/rt2860/common/eeprom.c +++ b/drivers/staging/rt2860/common/eeprom.c @@ -73,16 +73,12 @@ USHORT ShiftInBits( RaiseClock(pAd, &x); RTMP_IO_READ32(pAd, E2PROM_CSR, &x); -#ifdef RT30xx - LowerClock(pAd, &x); //prevent read failed -#endif + + LowerClock(pAd, &x); /* prevent read failed */ + x &= ~(EEDI); if(x & EEDO) data |= 1; - -#ifndef RT30xx - LowerClock(pAd, &x); -#endif } return data; @@ -185,14 +181,11 @@ USHORT RTMP_EEPROM_READ16( UINT32 x; USHORT data; -#ifdef RT30xx +#ifdef RT2870 if (pAd->NicConfig2.field.AntDiversity) { pAd->EepromAccess = TRUE; } -//2008/09/11:KH add to support efuse<-- -//2008/09/11:KH add to support efuse--> -{ #endif Offset /= 2; // reset bits and set EECS @@ -201,17 +194,13 @@ USHORT RTMP_EEPROM_READ16( x |= EECS; RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); -#ifdef RT30xx // patch can not access e-Fuse issue if (!IS_RT3090(pAd)) { -#endif // kick a pulse RaiseClock(pAd, &x); LowerClock(pAd, &x); -#ifdef RT30xx } -#endif // output the read_opcode and register number in that order ShiftOutBits(pAd, EEPROM_READ_OPCODE, 3); @@ -222,7 +211,7 @@ USHORT RTMP_EEPROM_READ16( EEpromCleanup(pAd); -#ifdef RT30xx +#ifdef RT2870 // Antenna and EEPROM access are both using EESK pin, // Therefor we should avoid accessing EESK at the same time // Then restore antenna after EEPROM access @@ -231,7 +220,6 @@ USHORT RTMP_EEPROM_READ16( pAd->EepromAccess = FALSE; AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); } -} #endif return data; } //ReadEEprom @@ -243,14 +231,11 @@ VOID RTMP_EEPROM_WRITE16( { UINT32 x; -#ifdef RT30xx +#ifdef RT2870 if (pAd->NicConfig2.field.AntDiversity) { pAd->EepromAccess = TRUE; } - //2008/09/11:KH add to support efuse<-- -//2008/09/11:KH add to support efuse--> - { #endif Offset /= 2; @@ -262,17 +247,13 @@ VOID RTMP_EEPROM_WRITE16( x |= EECS; RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); -#ifdef RT30xx // patch can not access e-Fuse issue if (!IS_RT3090(pAd)) { -#endif // kick a pulse RaiseClock(pAd, &x); LowerClock(pAd, &x); -#ifdef RT30xx } -#endif // output the read_opcode ,register number and data in that order ShiftOutBits(pAd, EEPROM_WRITE_OPCODE, 3); @@ -290,7 +271,7 @@ VOID RTMP_EEPROM_WRITE16( EEpromCleanup(pAd); -#ifdef RT30xx +#ifdef RT2870 // Antenna and EEPROM access are both using EESK pin, // Therefor we should avoid accessing EESK at the same time // Then restore antenna after EEPROM access @@ -299,12 +280,10 @@ VOID RTMP_EEPROM_WRITE16( pAd->EepromAccess = FALSE; AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); } -} #endif } -//2008/09/11:KH add to support efuse<-- -#ifdef RT30xx +#ifdef RT2870 /* ======================================================================== @@ -1038,7 +1017,7 @@ INT set_eFuseLoadFromBin_Proc( { CHAR *src; struct file *srcf; - INT retval, orgfsuid, orgfsgid; + INT retval; mm_segment_t orgfs; UCHAR *buffer; UCHAR BinFileSize=0; @@ -1078,12 +1057,7 @@ INT set_eFuseLoadFromBin_Proc( kfree(buffer); return FALSE; } - /* Don't change to uid 0, let the file be opened as the "normal" user */ -#if 0 - orgfsuid = current->fsuid; - orgfsgid = current->fsgid; - current->fsuid=current->fsgid = 0; -#endif + orgfs = get_fs(); set_fs(KERNEL_DS); @@ -1146,10 +1120,7 @@ INT set_eFuseLoadFromBin_Proc( DBGPRINT(RT_DEBUG_TRACE, ("--> Error %d closing %s\n", -retval, src)); } set_fs(orgfs); -#if 0 - current->fsuid = orgfsuid; - current->fsgid = orgfsgid; -#endif + for(j=0;j<i;j++) { DBGPRINT(RT_DEBUG_TRACE, ("%02X ",buffer[j])); @@ -1505,6 +1476,4 @@ NTSTATUS eFuseWriteRegistersFromBin( return TRUE; } - -#endif // RT30xx // -//2008/09/11:KH add to support efuse--> +#endif diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c index bb6fccbdca4..61a2a4eb714 100644 --- a/drivers/staging/rt2860/common/mlme.c +++ b/drivers/staging/rt2860/common/mlme.c @@ -43,7 +43,6 @@ UCHAR CISCO_OUI[] = {0x00, 0x40, 0x96}; UCHAR WPA_OUI[] = {0x00, 0x50, 0xf2, 0x01}; UCHAR RSN_OUI[] = {0x00, 0x0f, 0xac}; -UCHAR WAPI_OUI[] = {0x00, 0x14, 0x72}; UCHAR WME_INFO_ELEM[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01}; UCHAR WME_PARM_ELEM[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; UCHAR Ccx2QosInfo[] = {0x00, 0x40, 0x96, 0x04}; @@ -338,9 +337,6 @@ UCHAR WpaIe = IE_WPA; UCHAR Wpa2Ie = IE_WPA2; UCHAR IbssIe = IE_IBSS_PARM; UCHAR Ccx2Ie = IE_CCX_V2; -#ifdef RT2870 -UCHAR WapiIe = IE_WAPI; -#endif extern UCHAR WPA_OUI[]; @@ -449,13 +445,7 @@ FREQUENCY_ITEM FreqItems3020[] = {13, 247, 2, 2}, {14, 248, 2, 4}, }; -#ifndef RT30xx -#define NUM_OF_3020_CHNL (sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM)) -#endif -#ifdef RT30xx -//2008/07/10:KH Modified to share this variable UCHAR NUM_OF_3020_CHNL=(sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM)); -#endif /* ========================================================================== @@ -1576,12 +1566,7 @@ VOID MlmeSelectTxRateTable( } //else if ((pAd->StaActive.SupRateLen == 4) && (pAd->StaActive.ExtRateLen == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->RateLen == 4) -#ifndef RT30xx -//Iverson mark for Adhoc b mode,sta will use rate 54 Mbps when connect with sta b/g/n mode - && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) -#endif - ) + if (pEntry->RateLen == 4) {// B only AP *ppTable = RateSwitchTable11B; *pTableSize = RateSwitchTable11B[0]; @@ -2777,43 +2762,16 @@ VOID MlmeCheckPsmChange( (pAd->StaCfg.Psm == PWR_ACTIVE) && #ifdef RT2860 RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP)) -#endif -#if !defined(RT2860) && !defined(RT30xx) +#else (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE)) #endif -#ifndef RT30xx - { - NdisGetSystemUpTime(&pAd->Mlme.LastSendNULLpsmTime); - pAd->RalinkCounters.RxCountSinceLastNULL = 0; - MlmeSetPsmBit(pAd, PWR_SAVE); - if (!(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) - { - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, FALSE); - } - else - { - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); - } - } -#endif -#ifdef RT30xx -// (! RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) /*&& - (pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && - (pAd->RalinkCounters.OneSecTxRetryOkCount == 0)*/) { // add by johnli, use Rx OK data count per second to calculate throughput // If Ttraffic is too high ( > 400 Rx per second), don't go to sleep mode. If tx rate is low, use low criteria // Mode=CCK/MCS=3 => 11 Mbps, Mode=OFDM/MCS=3 => 18 Mbps if (((pAd->StaCfg.HTPhyMode.field.MCS <= 3) && -/* Iverson mark - (pAd->StaCfg.HTPhyMode.field.MODE <= MODE_OFDM) && -*/ (pAd->RalinkCounters.OneSecRxOkDataCnt < (ULONG)100)) || ((pAd->StaCfg.HTPhyMode.field.MCS > 3) && -/* Iverson mark - (pAd->StaCfg.HTPhyMode.field.MODE > MODE_OFDM) && -*/ (pAd->RalinkCounters.OneSecRxOkDataCnt < (ULONG)400))) { // Get this time @@ -2830,7 +2788,6 @@ VOID MlmeCheckPsmChange( } } } -#endif } // IRQL = PASSIVE_LEVEL @@ -2845,9 +2802,8 @@ VOID MlmeSetPsmBit( RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); csr4.field.AckCtsPsmBit = (psm == PWR_SAVE)? 1:0; RTMP_IO_WRITE32(pAd, AUTO_RSP_CFG, csr4.word); -#ifndef RT30xx + DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetPsmBit = %d\n", psm)); -#endif } // IRQL = DISPATCH_LEVEL @@ -3877,18 +3833,14 @@ ULONG BssTableSetEntry( } else { -#ifdef RT30xx /* avoid Hidden SSID form beacon to overwirite correct SSID from probe response */ if ((SSID_EQUAL(Ssid, SsidLen, Tab->BssEntry[Idx].Ssid, Tab->BssEntry[Idx].SsidLen)) || (NdisEqualMemory(Tab->BssEntry[Idx].Ssid, ZeroSsid, Tab->BssEntry[Idx].SsidLen))) { -#endif BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod,CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); -#ifdef RT30xx } -#endif } return Idx; @@ -3949,14 +3901,9 @@ VOID BssTableSsidSort( continue; // check group cipher -#ifndef RT30xx - if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) && - (pInBss->WPA.GroupCipher != Ndis802_11GroupWEP40Enabled) && - (pInBss->WPA.GroupCipher != Ndis802_11GroupWEP104Enabled)) -#endif -#ifdef RT30xx - if (pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) -#endif + if (pInBss->WPA.GroupCipher != Ndis802_11GroupWEP40Enabled && + pInBss->WPA.GroupCipher != Ndis802_11GroupWEP104Enabled && + pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) continue; // check pairwise cipher, skip if none matched @@ -3975,14 +3922,9 @@ VOID BssTableSsidSort( continue; // check group cipher -#ifndef RT30xx - if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) && - (pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP40Enabled) && - (pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP104Enabled)) -#endif -#ifdef RT30xx - if (pAd->StaCfg.WepStatus < pInBss->WPA2.GroupCipher) -#endif + if (pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP40Enabled && + pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP104Enabled && + pAd->StaCfg.WepStatus < pInBss->WPA2.GroupCipher) continue; // check pairwise cipher, skip if none matched @@ -4260,16 +4202,10 @@ VOID BssCipherParse( switch (*pTmp) { case 1: -#ifndef RT30xx pBss->WPA.GroupCipher = Ndis802_11GroupWEP40Enabled; break; case 5: pBss->WPA.GroupCipher = Ndis802_11GroupWEP104Enabled; -#endif -#ifdef RT30xx - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway - pBss->WPA.GroupCipher = Ndis802_11Encryption1Enabled; -#endif break; case 2: pBss->WPA.GroupCipher = Ndis802_11Encryption2Enabled; @@ -4385,16 +4321,10 @@ VOID BssCipherParse( switch (pCipher->Type) { case 1: -#ifndef RT30xx pBss->WPA2.GroupCipher = Ndis802_11GroupWEP40Enabled; break; case 5: pBss->WPA2.GroupCipher = Ndis802_11GroupWEP104Enabled; -#endif -#ifdef RT30xx - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway - pBss->WPA2.GroupCipher = Ndis802_11Encryption1Enabled; -#endif break; case 2: pBss->WPA2.GroupCipher = Ndis802_11Encryption2Enabled; @@ -5635,119 +5565,7 @@ VOID AsicUpdateProtect( } } -#ifdef RT30xx -/* - ======================================================================== - - Routine Description: Write RT30xx RF register through MAC - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ -NTSTATUS RT30xxWriteRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR RegID, - IN UCHAR Value) -{ - RF_CSR_CFG_STRUC rfcsr; - UINT i = 0; - - do - { - RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word); - - if (!rfcsr.field.RF_CSR_KICK) - break; - i++; - } - while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); - - if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n")); - return STATUS_UNSUCCESSFUL; - } - - rfcsr.field.RF_CSR_WR = 1; - rfcsr.field.RF_CSR_KICK = 1; - rfcsr.field.TESTCSR_RFACC_REGNUM = RegID; - rfcsr.field.RF_CSR_DATA = Value; - - RTMP_IO_WRITE32(pAd, RF_CSR_CFG, rfcsr.word); - - return STATUS_SUCCESS; -} - - -/* - ======================================================================== - - Routine Description: Read RT30xx RF register through MAC - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ -NTSTATUS RT30xxReadRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR RegID, - IN PUCHAR pValue) -{ - RF_CSR_CFG_STRUC rfcsr; - UINT i=0, k=0; - - for (i=0; i<MAX_BUSY_COUNT; i++) - { - RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word); - - if (rfcsr.field.RF_CSR_KICK == BUSY) - { - continue; - } - rfcsr.word = 0; - rfcsr.field.RF_CSR_WR = 0; - rfcsr.field.RF_CSR_KICK = 1; - rfcsr.field.TESTCSR_RFACC_REGNUM = RegID; - RTMP_IO_WRITE32(pAd, RF_CSR_CFG, rfcsr.word); - for (k=0; k<MAX_BUSY_COUNT; k++) - { - RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word); - - if (rfcsr.field.RF_CSR_KICK == IDLE) - break; - } - if ((rfcsr.field.RF_CSR_KICK == IDLE) && - (rfcsr.field.TESTCSR_RFACC_REGNUM == RegID)) - { - *pValue = (UCHAR)rfcsr.field.RF_CSR_DATA; - break; - } - } - if (rfcsr.field.RF_CSR_KICK == BUSY) - { - DBGPRINT_ERR(("RF read R%d=0x%x fail, i[%d], k[%d]\n", RegID, rfcsr.word,i,k)); - return STATUS_UNSUCCESSFUL; - } - - return STATUS_SUCCESS; -} -#endif // RT30xx // - -#ifdef RT30xx -// add by johnli, RF power sequence setup +#ifdef RT2870 /* ========================================================================== Description: @@ -5902,8 +5720,7 @@ VOID RT30xxReverseRFSleepModeSetup( RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); } } -// end johnli -#endif // RT30xx // +#endif /* ========================================================================== @@ -5926,7 +5743,6 @@ VOID AsicSwitchChannel( RTMP_RF_REGS *RFRegTable; // Search Tx power value -#ifdef RT30xx // We can't use ChannelList to search channel, since some central channl's txpowr doesn't list // in ChannelList, so use TxPower array instead. // @@ -5939,38 +5755,15 @@ VOID AsicSwitchChannel( break; } } -#endif -#ifndef RT30xx - for (index = 0; index < pAd->ChannelListNum; index++) - { - if (Channel == pAd->ChannelList[index].Channel) - { - TxPwer = pAd->ChannelList[index].Power; - TxPwer2 = pAd->ChannelList[index].Power2; - break; - } - } -#endif if (index == MAX_NUM_OF_CHANNELS) - { -#ifndef RT30xx - DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: Cant find the Channel#%d \n", Channel)); -#endif -#ifdef RT30xx DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: Can't find the Channel#%d \n", Channel)); -#endif - } #ifdef RT2870 // The RF programming sequence is difference between 3xxx and 2xxx -#ifdef RT30xx - if ((IS_RT3070(pAd) || IS_RT3090(pAd)) && ((pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020) || - (pAd->RfIcType == RFIC_3021) || (pAd->RfIcType == RFIC_3022))) -#endif -#ifndef RT30xx - if (IS_RT3070(pAd) && ((pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020))) -#endif + if ((IS_RT3070(pAd) || IS_RT3090(pAd)) && ( + (pAd->RfIcType == RFIC_3022) || (pAd->RfIcType == RFIC_3021) || + (pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020))) { /* modify by WY for Read RF Reg. error */ UCHAR RFValue; @@ -5983,22 +5776,6 @@ VOID AsicSwitchChannel( RT30xxWriteRFRegister(pAd, RF_R02, FreqItems3020[index].N); RT30xxWriteRFRegister(pAd, RF_R03, FreqItems3020[index].K); -#ifndef RT30xx - RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RFValue); - RFValue = (RFValue & 0xFC) | FreqItems3020[index].R; - RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RFValue); - - // Set Tx Power - RT30xxReadRFRegister(pAd, RF_R12, (PUCHAR)&RFValue); - RFValue = (RFValue & 0xE0) | TxPwer; - RT30xxWriteRFRegister(pAd, RF_R12, (UCHAR)RFValue); - - // Set RF offset - RT30xxReadRFRegister(pAd, RF_R23, (PUCHAR)&RFValue); - RFValue = (RFValue & 0x80) | pAd->RfFreqOffset; - RT30xxWriteRFRegister(pAd, RF_R23, (UCHAR)RFValue); -#endif -#ifdef RT30xx RT30xxReadRFRegister(pAd, RF_R06, &RFValue); RFValue = (RFValue & 0xFC) | FreqItems3020[index].R; RT30xxWriteRFRegister(pAd, RF_R06, RFValue); @@ -6032,7 +5809,6 @@ VOID AsicSwitchChannel( RT30xxReadRFRegister(pAd, RF_R23, &RFValue); RFValue = (RFValue & 0x80) | pAd->RfFreqOffset; RT30xxWriteRFRegister(pAd, RF_R23, RFValue); -#endif // Set BW if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) @@ -6044,18 +5820,6 @@ VOID AsicSwitchChannel( { RFValue = pAd->Mlme.CaliBW20RfR24; } -#ifndef RT30xx - RT30xxWriteRFRegister(pAd, RF_R24, (UCHAR)RFValue); - - // Enable RF tuning - RT30xxReadRFRegister(pAd, RF_R07, (PUCHAR)&RFValue); - RFValue = RFValue | 0x1; - RT30xxWriteRFRegister(pAd, RF_R07, (UCHAR)RFValue); - - // latch channel for future usage. - pAd->LatchRfRegs.Channel = Channel; -#endif -#ifdef RT30xx RT30xxWriteRFRegister(pAd, RF_R24, RFValue); RT30xxWriteRFRegister(pAd, RF_R31, RFValue); @@ -6076,13 +5840,10 @@ VOID AsicSwitchChannel( FreqItems3020[index].N, FreqItems3020[index].K, FreqItems3020[index].R)); -#endif - break; } } -#ifndef RT30xx DBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%d, Pwr1=%d, %dT), N=0x%02X, K=0x%02X, R=0x%02X\n", Channel, pAd->RfIcType, @@ -6092,7 +5853,6 @@ VOID AsicSwitchChannel( FreqItems3020[index].N, FreqItems3020[index].K, FreqItems3020[index].R)); -#endif } else #endif // RT2870 // @@ -6336,98 +6096,6 @@ VOID AsicLockChannel( { } -/* - ========================================================================== - Description: - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicAntennaSelect( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) -{ -#ifdef RT30xx - if (pAd->Mlme.OneSecPeriodicRound % 2 == 1) - { - // patch for AsicSetRxAnt failed - pAd->RxAnt.EvaluatePeriod = 0; - - // check every 2 second. If rcv-beacon less than 5 in the past 2 second, then AvgRSSI is no longer a - // valid indication of the distance between this AP and its clients. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - SHORT realavgrssi1; - - // if no traffic then reset average rssi to trigger evaluation - if (pAd->StaCfg.NumOfAvgRssiSample < 5) - { - pAd->RxAnt.Pair1LastAvgRssi = (-99); - pAd->RxAnt.Pair2LastAvgRssi = (-99); - DBGPRINT(RT_DEBUG_TRACE, ("MlmePeriodicExec: no traffic/beacon, reset RSSI\n")); - } - - pAd->StaCfg.NumOfAvgRssiSample = 0; - realavgrssi1 = (pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1PrimaryRxAnt] >> 3); - - DBGPRINT(RT_DEBUG_TRACE,("Ant-realrssi0(%d), Lastrssi0(%d), EvaluateStableCnt=%d\n", realavgrssi1, pAd->RxAnt.Pair1LastAvgRssi, pAd->RxAnt.EvaluateStableCnt)); - - // if the difference between two rssi is larger or less than 5, then evaluate the other antenna - if ((pAd->RxAnt.EvaluateStableCnt < 2) || (realavgrssi1 > (pAd->RxAnt.Pair1LastAvgRssi + 5)) || (realavgrssi1 < (pAd->RxAnt.Pair1LastAvgRssi - 5))) - { - pAd->RxAnt.Pair1LastAvgRssi = realavgrssi1; - AsicEvaluateRxAnt(pAd); - } - } - else - { - // if not connected, always switch antenna to try to connect - UCHAR temp; - - temp = pAd->RxAnt.Pair1PrimaryRxAnt; - pAd->RxAnt.Pair1PrimaryRxAnt = pAd->RxAnt.Pair1SecondaryRxAnt; - pAd->RxAnt.Pair1SecondaryRxAnt = temp; - - DBGPRINT(RT_DEBUG_TRACE, ("MlmePeriodicExec: no connect, switch to another one to try connection\n")); - - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - } - } -#endif /* RT30xx */ -} - -/* - ======================================================================== - - Routine Description: - Antenna miscellaneous setting. - - Arguments: - pAd Pointer to our adapter - BandState Indicate current Band State. - - Return Value: - None - - IRQL <= DISPATCH_LEVEL - - Note: - 1.) Frame End type control - only valid for G only (RF_2527 & RF_2529) - 0: means DPDT, set BBP R4 bit 5 to 1 - 1: means SPDT, set BBP R4 bit 5 to 0 - - - ======================================================================== -*/ -VOID AsicAntennaSetting( - IN PRTMP_ADAPTER pAd, - IN ABGBAND_STATE BandState) -{ -} - VOID AsicRfTuningExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, @@ -7150,13 +6818,13 @@ VOID AsicSetEdcaParm( Ac2Cfg.field.AcTxop = 5; } -#ifdef RT30xx +#ifdef RT2870 if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) { // Tuning for WiFi WMM S3-T07: connexant legacy sta ==> broadcom 11n sta. Ac2Cfg.field.Aifsn = 5; } -#endif // RT30xx // +#endif } Ac3Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_VO]; @@ -7237,11 +6905,10 @@ VOID AsicSetEdcaParm( } AifsnCsr.field.Aifsn3 = Ac3Cfg.field.Aifsn - 1; //pEdcaParm->Aifsn[QID_AC_VO]; //for TGn wifi test -#ifdef RT30xx +#ifdef RT2870 if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) AifsnCsr.field.Aifsn2 = 0x2; //pEdcaParm->Aifsn[QID_AC_VI]; //for WiFi WMM S4-T04. -#endif // RT30xx // - +#endif RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, AifsnCsr.word); NdisMoveMemory(&pAd->CommonCfg.APEdcaParm, pEdcaParm, sizeof(EDCA_PARM)); @@ -7303,7 +6970,6 @@ VOID AsicSetSlotTime( SlotTime = (bUseShortSlotTime)? 9 : 20; { -#ifndef RT30xx // force using short SLOT time for FAE to demo performance when TxBurst is ON if (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED))) || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)) @@ -7313,10 +6979,6 @@ VOID AsicSetSlotTime( // And we will not set to short slot when bEnableTxBurst is TRUE. } else if (pAd->CommonCfg.bEnableTxBurst) -#endif -#ifdef RT30xx - if (pAd->CommonCfg.bEnableTxBurst) -#endif SlotTime = 9; } @@ -8331,7 +7993,7 @@ CHAR RTMPMaxRssi( return larger; } -#ifdef RT30xx +#ifdef RT2870 // Antenna divesity use GPIO3 and EESK pin for control // Antenna and EEPROM access are both using EESK pin, // Therefor we should avoid accessing EESK at the same time @@ -8340,7 +8002,6 @@ VOID AsicSetRxAnt( IN PRTMP_ADAPTER pAd, IN UCHAR Ant) { -#ifdef RT30xx UINT32 Value; UINT32 x; @@ -8379,9 +8040,8 @@ VOID AsicSetRxAnt( RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n")); } -#endif // RT30xx // } -#endif /* RT30xx */ +#endif /* ======================================================================== @@ -8401,78 +8061,19 @@ VOID AsicEvaluateRxAnt( { UCHAR BBPR3 = 0; -#ifndef RT30xx - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_NIC_NOT_EXIST | - fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - return; - - if (pAd->StaCfg.Psm == PWR_SAVE) - return; - } - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); - BBPR3 &= (~0x18); - if(pAd->Antenna.field.RxPath == 3) - { - BBPR3 |= (0x10); - } - else if(pAd->Antenna.field.RxPath == 2) - { - BBPR3 |= (0x8); - } - else if(pAd->Antenna.field.RxPath == 1) - { - BBPR3 |= (0x0); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); - -#ifdef RT2860 - pAd->StaCfg.BBPR3 = BBPR3; -#endif + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_RADIO_OFF | + fRTMP_ADAPTER_NIC_NOT_EXIST | + fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) + || OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) #ifdef RT2870 - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) - ) - { - ULONG TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; - - if (TxTotalCnt > 50) - { - RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 20); - pAd->Mlme.bLowThroughput = FALSE; - } - else - { - RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 300); - pAd->Mlme.bLowThroughput = TRUE; - } - } + || (pAd->EepromAccess) #endif -#endif /* RT30xx */ -#ifdef RT30xx - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_NIC_NOT_EXIST | - fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) || - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) -#ifdef RT30xx - || (pAd->EepromAccess) -#endif // RT30xx // - ) - return; - - - { - //if (pAd->StaCfg.Psm == PWR_SAVE) - // return; - } + ) + return; +#ifdef RT30xx // two antenna selection mechanism- one is antenna diversity, the other is failed antenna remove // one is antenna diversity:there is only one antenna can rx and tx // the other is failed antenna remove:two physical antenna can rx and tx @@ -8495,6 +8096,7 @@ VOID AsicEvaluateRxAnt( RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 300); } else +#endif { if (pAd->StaCfg.Psm == PWR_SAVE) return; @@ -8514,8 +8116,11 @@ VOID AsicEvaluateRxAnt( BBPR3 |= (0x0); } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); + +#ifdef RT2860 + pAd->StaCfg.BBPR3 = BBPR3; +#endif } -#endif /* RT30xx */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) ) @@ -8561,85 +8166,19 @@ VOID AsicRxAntEvalTimeout( UCHAR BBPR3 = 0; CHAR larger = -127, rssi0, rssi1, rssi2; -#ifndef RT30xx - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - if (pAd->StaCfg.Psm == PWR_SAVE) - return; - - - // if the traffic is low, use average rssi as the criteria - if (pAd->Mlme.bLowThroughput == TRUE) - { - rssi0 = pAd->StaCfg.RssiSample.LastRssi0; - rssi1 = pAd->StaCfg.RssiSample.LastRssi1; - rssi2 = pAd->StaCfg.RssiSample.LastRssi2; - } - else - { - rssi0 = pAd->StaCfg.RssiSample.AvgRssi0; - rssi1 = pAd->StaCfg.RssiSample.AvgRssi1; - rssi2 = pAd->StaCfg.RssiSample.AvgRssi2; - } - - if(pAd->Antenna.field.RxPath == 3) - { - larger = max(rssi0, rssi1); - - if (larger > (rssi2 + 20)) - pAd->Mlme.RealRxPath = 2; - else - pAd->Mlme.RealRxPath = 3; - } - else if(pAd->Antenna.field.RxPath == 2) - { - if (rssi0 > (rssi1 + 20)) - pAd->Mlme.RealRxPath = 1; - else - pAd->Mlme.RealRxPath = 2; - } - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); - BBPR3 &= (~0x18); - if(pAd->Mlme.RealRxPath == 3) - { - BBPR3 |= (0x10); - } - else if(pAd->Mlme.RealRxPath == 2) - { - BBPR3 |= (0x8); - } - else if(pAd->Mlme.RealRxPath == 1) - { - BBPR3 |= (0x0); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); -#ifdef RT2860 - pAd->StaCfg.BBPR3 = BBPR3; -#endif - } -#endif /* RT30xx */ -#ifdef RT30xx if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_NIC_NOT_EXIST) || - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) -#ifdef RT30xx + fRTMP_ADAPTER_NIC_NOT_EXIST) + || OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) +#ifdef RT2870 || (pAd->EepromAccess) -#endif // RT30xx // +#endif ) return; { - //if (pAd->StaCfg.Psm == PWR_SAVE) - // return; - +#ifdef RT30xx if (pAd->NicConfig2.field.AntDiversity) { if ((pAd->RxAnt.RcvPktNumWhenEvaluate != 0) && (pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1SecondaryRxAnt] >= pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1PrimaryRxAnt])) @@ -8671,6 +8210,7 @@ VOID AsicRxAntEvalTimeout( pAd->RxAnt.Pair1PrimaryRxAnt, (pAd->RxAnt.Pair1AvgRssi[0] >> 3), (pAd->RxAnt.Pair1AvgRssi[1] >> 3), pAd->RxAnt.RcvPktNumWhenEvaluate)); } else +#endif { if (pAd->StaCfg.Psm == PWR_SAVE) return; @@ -8721,13 +8261,13 @@ VOID AsicRxAntEvalTimeout( BBPR3 |= (0x0); } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); +#ifdef RT2860 + pAd->StaCfg.BBPR3 = BBPR3; +#endif } } -#endif /* RT30xx */ } - - VOID APSDPeriodicExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, @@ -8942,38 +8482,19 @@ VOID AsicStaBbpTuning( #ifdef RT2870 // RT3070 is a no LNA solution, it should have different control regarding to AGC gain control // Otherwise, it will have some throughput side effect when low RSSI -#ifndef RT30xx - if (IS_RT3070(pAd)) -#endif -#ifdef RT30xx if (IS_RT30xx(pAd)) -#endif { if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) { R66 = 0x1C + 2*GET_LNA_GAIN(pAd) + 0x20; if (OrigR66Value != R66) - { -#ifndef RT30xx - RTUSBWriteBBPRegister(pAd, BBP_R66, R66); -#endif -#ifdef RT30xx RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); -#endif - } } else { R66 = 0x1C + 2*GET_LNA_GAIN(pAd); if (OrigR66Value != R66) - { -#ifndef RT30xx - RTUSBWriteBBPRegister(pAd, BBP_R66, R66); -#endif -#ifdef RT30xx RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); -#endif - } } } else @@ -9182,15 +8703,13 @@ VOID AsicTurnOffRFClk( UCHAR index; RTMP_RF_REGS *RFRegTable; -#ifdef RT30xx // The RF programming sequence is difference between 3xxx and 2xxx if (IS_RT3090(pAd)) { RT30xxLoadRFSleepModeSetup(pAd); // add by johnli, RF power sequence setup, load RF sleep-mode setup + return; } - else - { -#endif // RT30xx // + RFRegTable = RF2850RegTable; switch (pAd->RfIcType) @@ -9232,10 +8751,6 @@ VOID AsicTurnOffRFClk( default: break; } -#ifdef RT30xx - } -#endif // RT30xx // - } @@ -9249,14 +8764,10 @@ VOID AsicTurnOnRFClk( UCHAR index; RTMP_RF_REGS *RFRegTable; -#ifdef RT30xx // The RF programming sequence is difference between 3xxx and 2xxx if (IS_RT3090(pAd)) - { - } - else - { -#endif // RT30xx // + return; + RFRegTable = RF2850RegTable; switch (pAd->RfIcType) @@ -9303,14 +8814,9 @@ VOID AsicTurnOnRFClk( break; } -#ifndef RT30xx DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOnRFClk#%d(RF=%d, ) , R2=0x%08x\n", Channel, pAd->RfIcType, R2)); -#endif -#ifdef RT30xx - } -#endif // RT30xx // } diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 004f53023b0..20c2ce26bc9 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -38,16 +38,12 @@ Jan Lee 2006-09-15 RT2860. Change for 802.11n , EEPROM, Led, BA, HT. */ #include "../rt_config.h" -#ifndef RT30xx #ifdef RT2860 #include "firmware.h" #include <linux/bitrev.h> #endif #ifdef RT2870 -#include "../../rt2870/common/firmware.h" -#endif -#endif -#ifdef RT30xx +/* New firmware handles both RT2870 and RT3070. */ #include "../../rt3070/firmware.h" #endif @@ -63,59 +59,6 @@ ULONG BIT32[] = {0x00000001, 0x00000002, 0x00000004, 0x00000008, char* CipherName[] = {"none","wep64","wep128","TKIP","AES","CKIP64","CKIP128"}; -const unsigned short ccitt_16Table[] = { - 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, - 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, - 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, - 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, - 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485, - 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D, - 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4, - 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC, - 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823, - 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B, - 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12, - 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A, - 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41, - 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49, - 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70, - 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78, - 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F, - 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067, - 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E, - 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256, - 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D, - 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, - 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C, - 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634, - 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB, - 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3, - 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A, - 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92, - 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9, - 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1, - 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8, - 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0 -}; -#define ByteCRC16(v, crc) \ - (unsigned short)((crc << 8) ^ ccitt_16Table[((crc >> 8) ^ (v)) & 255]) - -#ifdef RT2870 -unsigned char BitReverse(unsigned char x) -{ - int i; - unsigned char Temp=0; - for(i=0; ; i++) - { - if(x & 0x80) Temp |= 0x80; - if(i==7) break; - x <<= 1; - Temp >>= 1; - } - return Temp; -} -#endif - // // BBP register initialization set // @@ -147,12 +90,7 @@ REG_PAIR RT30xx_RFRegTable[] = { {RF_R06, 0x02}, {RF_R07, 0x70}, {RF_R09, 0x0F}, -#ifndef RT30xx - {RF_R10, 0x71}, -#endif -#ifdef RT30xx {RF_R10, 0x41}, -#endif {RF_R11, 0x21}, {RF_R12, 0x7B}, {RF_R14, 0x90}, @@ -165,9 +103,6 @@ REG_PAIR RT30xx_RFRegTable[] = { {RF_R21, 0xDB}, {RF_R24, 0x16}, {RF_R25, 0x01}, -#ifndef RT30xx - {RF_R27, 0x03}, -#endif {RF_R29, 0x1F}, }; #define NUM_RF_REG_PARMS (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR)) @@ -1099,145 +1034,6 @@ NDIS_STATUS NICReadRegParameters( ======================================================================== */ -#ifndef RT30xx -VOID RTUSBFilterCalibration( - IN PRTMP_ADAPTER pAd) -{ - UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue; - UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0; - UCHAR RF_R24_Value = 0; - - // Give bbp filter initial value - pAd->Mlme.CaliBW20RfR24 = 0x16; - pAd->Mlme.CaliBW40RfR24 = 0x36; //Bit[5] must be 1 for BW 40 - - do - { - if (loop == 1) //BandWidth = 40 MHz - { - // Write 0x27 to RF_R24 to program filter - RF_R24_Value = 0x27; - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - FilterTarget = 0x19; - - // when calibrate BW40, BBP mask must set to BW40. - RTUSBReadBBPRegister(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - BBPValue|= (0x10); - RTUSBWriteBBPRegister(pAd, BBP_R4, BBPValue); - } - else //BandWidth = 20 MHz - { - // Write 0x07 to RF_R24 to program filter - RF_R24_Value = 0x07; - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - FilterTarget = 0x16; - } - - // Write 0x01 to RF_R22 to enable baseband loopback mode - RT30xxReadRFRegister(pAd, RF_R22, &value); - value |= 0x01; - RT30xxWriteRFRegister(pAd, RF_R22, value); - - // Write 0x00 to BBP_R24 to set power & frequency of passband test tone - RTUSBWriteBBPRegister(pAd, BBP_R24, 0); - - do - { - // Write 0x90 to BBP_R25 to transmit test tone - RTUSBWriteBBPRegister(pAd, BBP_R25, 0x90); - - RTMPusecDelay(1000); - // Read BBP_R55[6:0] for received power, set R55x = BBP_R55[6:0] - RTUSBReadBBPRegister(pAd, BBP_R55, &value); - R55x = value & 0xFF; - - } while ((ReTry++ < 100) && (R55x == 0)); - - // Write 0x06 to BBP_R24 to set power & frequency of stopband test tone - RTUSBWriteBBPRegister(pAd, BBP_R24, 0x06); - - while(TRUE) - { - // Write 0x90 to BBP_R25 to transmit test tone - RTUSBWriteBBPRegister(pAd, BBP_R25, 0x90); - - //We need to wait for calibration - RTMPusecDelay(1000); - RTUSBReadBBPRegister(pAd, BBP_R55, &value); - value &= 0xFF; - if ((R55x - value) < FilterTarget) - { - RF_R24_Value ++; - } - else if ((R55x - value) == FilterTarget) - { - RF_R24_Value ++; - count ++; - } - else - { - break; - } - - // prevent infinite loop cause driver hang. - if (loopcnt++ > 100) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTUSBFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt)); - break; - } - - // Write RF_R24 to program filter - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - } - - if (count > 0) - { - RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0)); - } - - // Store for future usage - if (loopcnt < 100) - { - if (loop++ == 0) - { - //BandWidth = 20 MHz - pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value; - } - else - { - //BandWidth = 40 MHz - pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value; - break; - } - } - else - break; - - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - - // reset count - count = 0; - } while(TRUE); - - // - // Set back to initial state - // - RTUSBWriteBBPRegister(pAd, BBP_R24, 0); - - RT30xxReadRFRegister(pAd, RF_R22, &value); - value &= ~(0x01); - RT30xxWriteRFRegister(pAd, RF_R22, value); - - // set BBP back to BW20 - RTUSBReadBBPRegister(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - RTUSBWriteBBPRegister(pAd, BBP_R4, BBPValue); - - DBGPRINT(RT_DEBUG_TRACE, ("RTUSBFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24)); -} -#endif /* RT30xx */ -#ifdef RT30xx VOID RTMPFilterCalibration( IN PRTMP_ADAPTER pAd) { @@ -1246,9 +1042,13 @@ VOID RTMPFilterCalibration( UCHAR RF_R24_Value = 0; // Give bbp filter initial value +#ifndef RT2870 + pAd->Mlme.CaliBW20RfR24 = 0x16; + pAd->Mlme.CaliBW40RfR24 = 0x36; //Bit[5] must be 1 for BW 40 +#else pAd->Mlme.CaliBW20RfR24 = 0x1F; pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40 - +#endif do { if (loop == 1) //BandWidth = 40 MHz @@ -1266,11 +1066,12 @@ VOID RTMPFilterCalibration( BBPValue&= (~0x18); BBPValue|= (0x10); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - +#ifdef RT2870 // set to BW40 RT30xxReadRFRegister(pAd, RF_R31, &value); value |= 0x20; RT30xxWriteRFRegister(pAd, RF_R31, value); +#endif } else //BandWidth = 20 MHz { @@ -1281,11 +1082,12 @@ VOID RTMPFilterCalibration( FilterTarget = 0x13; else FilterTarget = 0x16; - +#ifdef RT2870 // set to BW20 RT30xxReadRFRegister(pAd, RF_R31, &value); value &= (~0x20); RT30xxWriteRFRegister(pAd, RF_R31, value); +#endif } // Write 0x01 to RF_R22 to enable baseband loopback mode @@ -1390,37 +1192,12 @@ VOID RTMPFilterCalibration( DBGPRINT(RT_DEBUG_TRACE, ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24)); } -#endif /* RT30xx */ VOID NICInitRT30xxRFRegisters(IN PRTMP_ADAPTER pAd) { INT i; // Driver must read EEPROM to get RfIcType before initial RF registers // Initialize RF register to default value -#ifndef RT30xx - if (IS_RT3070(pAd) && ((pAd->RfIcType == RFIC_3020) ||(pAd->RfIcType == RFIC_2020))) - { - // Init RF calibration - // Driver should toggle RF R30 bit7 before init RF registers - ULONG RfReg = 0; - RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg); - RfReg |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); - RTMPusecDelay(1000); - RfReg &= 0x7F; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); - - // Initialize RF register to default value - for (i = 0; i < NUM_RF_REG_PARMS; i++) - { - RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); - } - - //For RF filter Calibration - RTUSBFilterCalibration(pAd); - } -#endif -#ifdef RT30xx if (IS_RT3070(pAd) || IS_RT3071(pAd)) { // Init RF calibration @@ -1441,7 +1218,6 @@ VOID NICInitRT30xxRFRegisters(IN PRTMP_ADAPTER pAd) RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); } - // add by johnli if (IS_RT3070(pAd)) { // Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate @@ -1498,7 +1274,6 @@ VOID NICInitRT30xxRFRegisters(IN PRTMP_ADAPTER pAd) RT30xxLoadRFNormalModeSetup(pAd); } } -#endif } #endif // RT2870 // @@ -1675,7 +1450,6 @@ VOID NICReadEEPROMParameters( Antenna.word = pAd->EEPROMDefaultValue[0]; if (Antenna.word == 0xFFFF) { -#ifdef RT30xx if(IS_RT3090(pAd)) { Antenna.word = 0; @@ -1685,15 +1459,12 @@ VOID NICReadEEPROMParameters( } else { -#endif // RT30xx // Antenna.word = 0; Antenna.field.RfIcType = RFIC_2820; Antenna.field.TxPath = 1; Antenna.field.RxPath = 2; DBGPRINT(RT_DEBUG_WARN, ("E2PROM error, hard code as 0x%04x\n", Antenna.word)); -#ifdef RT30xx } -#endif // RT30xx // } // Choose the desired Tx&Rx stream. @@ -1722,9 +1493,6 @@ VOID NICReadEEPROMParameters( NicConfig2.word = pAd->EEPROMDefaultValue[1]; { -#ifndef RT30xx - NicConfig2.word = 0; -#endif if ((NicConfig2.word & 0x00ff) == 0xff) { NicConfig2.word &= 0xff00; @@ -1917,14 +1685,6 @@ VOID NICReadEEPROMParameters( RTMPReadTxPwrPerRate(pAd); -#ifdef RT30xx - if (IS_RT30xx(pAd)) - { - eFusePhysicalReadRegisters(pAd, EFUSE_TAG, 2, &value); - pAd->EFuseTag = (value & 0xff); - } -#endif // RT30xx // - DBGPRINT(RT_DEBUG_TRACE, ("<-- NICReadEEPROMParameters\n")); } @@ -1969,10 +1729,9 @@ VOID NICInitAsicFromEEPROM( } } -#ifndef RT30xx +#ifndef RT2870 Antenna.word = pAd->Antenna.word; -#endif -#ifdef RT30xx +#else Antenna.word = pAd->EEPROMDefaultValue[0]; if (Antenna.word == 0xFFFF) { @@ -1983,7 +1742,7 @@ VOID NICInitAsicFromEEPROM( pAd->Mlme.RealRxPath = (UCHAR) Antenna.field.RxPath; pAd->RfIcType = (UCHAR) Antenna.field.RfIcType; -#ifdef RT30xx +#ifdef RT2870 DBGPRINT(RT_DEBUG_WARN, ("pAd->RfIcType = %d, RealRxPath=%d, TxPath = %d\n", pAd->RfIcType, pAd->Mlme.RealRxPath,Antenna.field.TxPath)); // Save the antenna for future use @@ -1991,7 +1750,7 @@ VOID NICInitAsicFromEEPROM( #endif NicConfig2.word = pAd->EEPROMDefaultValue[1]; -#ifdef RT30xx +#ifdef RT2870 { if ((NicConfig2.word & 0x00ff) == 0xff) { @@ -2007,7 +1766,7 @@ VOID NICInitAsicFromEEPROM( // Save the antenna for future use pAd->NicConfig2.word = NicConfig2.word; -#ifdef RT30xx +#ifdef RT2870 // set default antenna as main if (pAd->RfIcType == RFIC_3020) AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); @@ -2078,10 +1837,8 @@ VOID NICInitAsicFromEEPROM( pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = TRUE; else pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = FALSE; - // - // Since BBP has been progamed, to make sure BBP setting will be - // upate inside of AsicAntennaSelect, so reset to UNKNOWN_BAND!! - // + + /* BBP has been programmed so reset to UNKNOWN_BAND */ pAd->CommonCfg.BandState = UNKNOWN_BAND; RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); @@ -2351,10 +2108,8 @@ NDIS_STATUS NICInitializeAsic( UINT32 MacCsr0 = 0; NTSTATUS Status; UCHAR Value = 0xff; -#endif // RT2870 // -#ifdef RT30xx UINT32 eFuseCtrl; -#endif // RT30xx // +#endif USHORT KeyIdx; INT i,apidx; @@ -2418,21 +2173,8 @@ NDIS_STATUS NICInitializeAsic( #endif // RT3070 // RTMP_IO_WRITE32(pAd, (USHORT)MACRegTable[Index].Register, MACRegTable[Index].Value); } - -#ifndef RT30xx - if(IS_RT3070(pAd)) - { - // According to Frank Hsu (from Gary Tsao) - RTMP_IO_WRITE32(pAd, (USHORT)TX_SW_CFG0, 0x00000400); - - // Initialize RT3070 serial MAC registers which is different from RT2870 serial - RTUSBWriteMACRegister(pAd, TX_SW_CFG1, 0); - RTUSBWriteMACRegister(pAd, TX_SW_CFG2, 0); - } -#endif #endif // RT2870 // - { for (Index = 0; Index < NUM_STA_MAC_REG_PARMS; Index++) { @@ -2445,7 +2187,6 @@ NDIS_STATUS NICInitializeAsic( } } -#ifdef RT30xx // Initialize RT3070 serial MAc registers which is different from RT2870 serial if (IS_RT3090(pAd)) { @@ -2468,6 +2209,7 @@ NDIS_STATUS NICInitializeAsic( RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0); } } +#ifdef RT2870 else if (IS_RT3070(pAd)) { RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0); @@ -2514,22 +2256,11 @@ NDIS_STATUS NICInitializeAsic( RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBPRegTable[Index].Register, BBPRegTable[Index].Value); } -#ifndef RT30xx +#ifndef RT2870 // for rt2860E and after, init BBP_R84 with 0x19. This is for extension channel overlapping IOT. if ((pAd->MACVersion&0xffff) != 0x0101) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R84, 0x19); - -#ifdef RT2870 - //write RT3070 BBP wchich different with 2870 after write RT2870 BBP - if (IS_RT3070(pAd)) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0a); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R84, 0x99); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R105, 0x05); - } -#endif // RT2870 // -#endif -#ifdef RT30xx +#else // for rt2860E and after, init BBP_R84 with 0x19. This is for extension channel overlapping IOT. // RT3090 should not program BBP R84 to 0x19, otherwise TX will block. if (((pAd->MACVersion&0xffff) != 0x0101) && (!IS_RT30xx(pAd))) @@ -2666,8 +2397,7 @@ NDIS_STATUS NICInitializeAsic( Counter&=0xffffff00; Counter|=0x000001e; RTMP_IO_WRITE32(pAd, USB_CYC_CFG, Counter); -#endif // RT2870 // -#ifdef RT30xx + pAd->bUseEfuse=FALSE; RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrl); pAd->bUseEfuse = ( (eFuseCtrl & 0x80000000) == 0x80000000) ? 1 : 0; @@ -2678,9 +2408,8 @@ NDIS_STATUS NICInitializeAsic( else { DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n")); - } -#endif // RT30xx // +#endif { // for rt2860E and after, init TXOP_CTRL_CFG with 0x583f. This is for extension channel overlapping IOT. @@ -3160,73 +2889,6 @@ VOID NICUpdateRawCounters( pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt7.field.AggSize16Count / 16); } -#ifdef DBG_DIAGNOSE - { - RtmpDiagStruct *pDiag; - COUNTER_RALINK *pRalinkCounters; - UCHAR ArrayCurIdx, i; - - pDiag = &pAd->DiagStruct; - pRalinkCounters = &pAd->RalinkCounters; - ArrayCurIdx = pDiag->ArrayCurIdx; - - if (pDiag->inited == 0) - { - NdisZeroMemory(pDiag, sizeof(struct _RtmpDiagStrcut_)); - pDiag->ArrayStartIdx = pDiag->ArrayCurIdx = 0; - pDiag->inited = 1; - } - else - { - // Tx - pDiag->TxFailCnt[ArrayCurIdx] = TxStaCnt0.field.TxFailCount; - pDiag->TxAggCnt[ArrayCurIdx] = TxAggCnt.field.AggTxCount; - pDiag->TxNonAggCnt[ArrayCurIdx] = TxAggCnt.field.NonAggTxCount; - pDiag->TxAMPDUCnt[ArrayCurIdx][0] = TxAggCnt0.field.AggSize1Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][1] = TxAggCnt0.field.AggSize2Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][2] = TxAggCnt1.field.AggSize3Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][3] = TxAggCnt1.field.AggSize4Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][4] = TxAggCnt2.field.AggSize5Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][5] = TxAggCnt2.field.AggSize6Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][6] = TxAggCnt3.field.AggSize7Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][7] = TxAggCnt3.field.AggSize8Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][8] = TxAggCnt4.field.AggSize9Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][9] = TxAggCnt4.field.AggSize10Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][10] = TxAggCnt5.field.AggSize11Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][11] = TxAggCnt5.field.AggSize12Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][12] = TxAggCnt6.field.AggSize13Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][13] = TxAggCnt6.field.AggSize14Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][14] = TxAggCnt7.field.AggSize15Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][15] = TxAggCnt7.field.AggSize16Count; - - pDiag->RxCrcErrCnt[ArrayCurIdx] = RxStaCnt0.field.CrcErr; - - INC_RING_INDEX(pDiag->ArrayCurIdx, DIAGNOSE_TIME); - ArrayCurIdx = pDiag->ArrayCurIdx; - for (i =0; i < 9; i++) - { - pDiag->TxDescCnt[ArrayCurIdx][i]= 0; - pDiag->TxSWQueCnt[ArrayCurIdx][i] =0; - pDiag->TxMcsCnt[ArrayCurIdx][i] = 0; - pDiag->RxMcsCnt[ArrayCurIdx][i] = 0; - } - pDiag->TxDataCnt[ArrayCurIdx] = 0; - pDiag->TxFailCnt[ArrayCurIdx] = 0; - pDiag->RxDataCnt[ArrayCurIdx] = 0; - pDiag->RxCrcErrCnt[ArrayCurIdx] = 0; - for (i = 9; i < 24; i++) // 3*3 - { - pDiag->TxDescCnt[ArrayCurIdx][i] = 0; - pDiag->TxMcsCnt[ArrayCurIdx][i] = 0; - pDiag->RxMcsCnt[ArrayCurIdx][i] = 0; -} - - if (pDiag->ArrayCurIdx == pDiag->ArrayStartIdx) - INC_RING_INDEX(pDiag->ArrayStartIdx, DIAGNOSE_TIME); - } - - } -#endif // DBG_DIAGNOSE // } @@ -3652,7 +3314,7 @@ VOID UserCfgInit( } } -#ifdef RT30xx +#ifdef RT2870 pAd->EepromAccess = FALSE; #endif pAd->Antenna.word = 0; diff --git a/drivers/staging/rt2860/common/spectrum.c b/drivers/staging/rt2860/common/spectrum.c index 101c2923ca3..c658bf3082c 100644 --- a/drivers/staging/rt2860/common/spectrum.c +++ b/drivers/staging/rt2860/common/spectrum.c @@ -1570,12 +1570,7 @@ static VOID PeerMeasureReportAction( if ((pMeasureReportInfo = kmalloc(sizeof(MEASURE_RPI_REPORT), GFP_ATOMIC)) == NULL) { -#ifndef RT30xx DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for measure report buffer (size=%zu).\n", __func__, sizeof(MEASURE_RPI_REPORT))); -#endif -#ifdef RT30xx - DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for measure report buffer (size=%d).\n", __func__, sizeof(MEASURE_RPI_REPORT))); -#endif return; } diff --git a/drivers/staging/rt2860/dfs.h b/drivers/staging/rt2860/dfs.h index 752a6352d9d..f34f6183625 100644 --- a/drivers/staging/rt2860/dfs.h +++ b/drivers/staging/rt2860/dfs.h @@ -77,18 +77,6 @@ ULONG RTMPReadRadarDuration( VOID RTMPCleanRadarDuration( IN PRTMP_ADAPTER pAd); -VOID RTMPPrepareRDCTSFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN ULONG Duration, - IN UCHAR RTSRate, - IN ULONG CTSBaseAddr, - IN UCHAR FrameGap); - -VOID RTMPPrepareRadarDetectParams( - IN PRTMP_ADAPTER pAd); - - INT Set_ChMovingTime_Proc( IN PRTMP_ADAPTER pAd, IN PUCHAR arg); diff --git a/drivers/staging/rt2860/link_list.h b/drivers/staging/rt2860/link_list.h deleted file mode 100644 index f6521133fd5..00000000000 --- a/drivers/staging/rt2860/link_list.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - -#ifndef __LINK_LIST_H__ -#define __LINK_LIST_H__ - -typedef struct _LIST_ENTRY -{ - struct _LIST_ENTRY *pNext; -} LIST_ENTRY, *PLIST_ENTRY; - -typedef struct _LIST_HEADR -{ - PLIST_ENTRY pHead; - PLIST_ENTRY pTail; - UCHAR size; -} LIST_HEADER, *PLIST_HEADER; - -static inline VOID initList( - IN PLIST_HEADER pList) -{ - pList->pHead = pList->pTail = NULL; - pList->size = 0; - return; -} - -static inline VOID insertTailList( - IN PLIST_HEADER pList, - IN PLIST_ENTRY pEntry) -{ - pEntry->pNext = NULL; - if (pList->pTail) - pList->pTail->pNext = pEntry; - else - pList->pHead = pEntry; - pList->pTail = pEntry; - pList->size++; - - return; -} - -static inline PLIST_ENTRY removeHeadList( - IN PLIST_HEADER pList) -{ - PLIST_ENTRY pNext; - PLIST_ENTRY pEntry; - - pEntry = pList->pHead; - if (pList->pHead != NULL) - { - pNext = pList->pHead->pNext; - pList->pHead = pNext; - if (pNext == NULL) - pList->pTail = NULL; - pList->size--; - } - return pEntry; -} - -static inline int getListSize( - IN PLIST_HEADER pList) -{ - return pList->size; -} - -static inline PLIST_ENTRY delEntryList( - IN PLIST_HEADER pList, - IN PLIST_ENTRY pEntry) -{ - PLIST_ENTRY pCurEntry; - PLIST_ENTRY pPrvEntry; - - if(pList->pHead == NULL) - return NULL; - - if(pEntry == pList->pHead) - { - pCurEntry = pList->pHead; - pList->pHead = pCurEntry->pNext; - - if(pList->pHead == NULL) - pList->pTail = NULL; - - pList->size--; - return pCurEntry; - } - - pPrvEntry = pList->pHead; - pCurEntry = pPrvEntry->pNext; - while(pCurEntry != NULL) - { - if (pEntry == pCurEntry) - { - pPrvEntry->pNext = pCurEntry->pNext; - - if(pEntry == pList->pTail) - pList->pTail = pPrvEntry; - - pList->size--; - break; - } - pPrvEntry = pCurEntry; - pCurEntry = pPrvEntry->pNext; - } - - return pCurEntry; -} - -#endif // ___LINK_LIST_H__ // - diff --git a/drivers/staging/rt2860/md4.h b/drivers/staging/rt2860/md4.h deleted file mode 100644 index f1e5b526350..00000000000 --- a/drivers/staging/rt2860/md4.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - -#ifndef __MD4_H__ -#define __MD4_H__ - -/* MD4 context. */ -typedef struct _MD4_CTX_ { - ULONG state[4]; /* state (ABCD) */ - ULONG count[2]; /* number of bits, modulo 2^64 (lsb first) */ - UCHAR buffer[64]; /* input buffer */ -} MD4_CTX; - -VOID MD4Init (MD4_CTX *); -VOID MD4Update (MD4_CTX *, PUCHAR, UINT); -VOID MD4Final (UCHAR [16], MD4_CTX *); - -#endif //__MD4_H__
\ No newline at end of file diff --git a/drivers/staging/rt2860/oid.h b/drivers/staging/rt2860/oid.h index 8519afccd97..0227c4a38f9 100644 --- a/drivers/staging/rt2860/oid.h +++ b/drivers/staging/rt2860/oid.h @@ -92,136 +92,31 @@ // #define OID_GET_SET_TOGGLE 0x8000 -#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0103 -#define OID_802_11_NETWORK_TYPE_IN_USE 0x0104 -#define OID_802_11_RSSI_TRIGGER 0x0107 -#define RT_OID_802_11_RSSI 0x0108 //rt2860 only , kathy -#define RT_OID_802_11_RSSI_1 0x0109 //rt2860 only , kathy -#define RT_OID_802_11_RSSI_2 0x010A //rt2860 only , kathy -#define OID_802_11_NUMBER_OF_ANTENNAS 0x010B -#define OID_802_11_RX_ANTENNA_SELECTED 0x010C -#define OID_802_11_TX_ANTENNA_SELECTED 0x010D -#define OID_802_11_SUPPORTED_RATES 0x010E -#define OID_802_11_ADD_WEP 0x0112 -#define OID_802_11_REMOVE_WEP 0x0113 -#define OID_802_11_DISASSOCIATE 0x0114 -#define OID_802_11_PRIVACY_FILTER 0x0118 -#define OID_802_11_ASSOCIATION_INFORMATION 0x011E -#define OID_802_11_TEST 0x011F -#define RT_OID_802_11_COUNTRY_REGION 0x0507 -#define OID_802_11_BSSID_LIST_SCAN 0x0508 -#define OID_802_11_SSID 0x0509 -#define OID_802_11_BSSID 0x050A -#define RT_OID_802_11_RADIO 0x050B -#define RT_OID_802_11_PHY_MODE 0x050C -#define RT_OID_802_11_STA_CONFIG 0x050D -#define OID_802_11_DESIRED_RATES 0x050E -#define RT_OID_802_11_PREAMBLE 0x050F -#define OID_802_11_WEP_STATUS 0x0510 -#define OID_802_11_AUTHENTICATION_MODE 0x0511 -#define OID_802_11_INFRASTRUCTURE_MODE 0x0512 -#define RT_OID_802_11_RESET_COUNTERS 0x0513 -#define OID_802_11_RTS_THRESHOLD 0x0514 -#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0515 -#define OID_802_11_POWER_MODE 0x0516 -#define OID_802_11_TX_POWER_LEVEL 0x0517 -#define RT_OID_802_11_ADD_WPA 0x0518 -#define OID_802_11_REMOVE_KEY 0x0519 -#define OID_802_11_ADD_KEY 0x0520 -#define OID_802_11_CONFIGURATION 0x0521 -#define OID_802_11_TX_PACKET_BURST 0x0522 -#define RT_OID_802_11_QUERY_NOISE_LEVEL 0x0523 -#define RT_OID_802_11_EXTRA_INFO 0x0524 -#ifdef DBG -#define RT_OID_802_11_HARDWARE_REGISTER 0x0525 -#endif -#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS -#define OID_802_11_DEAUTHENTICATION 0x0526 -#define OID_802_11_DROP_UNENCRYPTED 0x0527 -#define OID_802_11_MIC_FAILURE_REPORT_FRAME 0x0528 - -// For 802.1x daemin using to require current driver configuration -#define OID_802_11_RADIUS_QUERY_SETTING 0x0540 +#define OID_802_11_ADD_WEP 0x0112 +#define OID_802_11_DISASSOCIATE 0x0114 +#define OID_802_11_BSSID_LIST_SCAN 0x0508 +#define OID_802_11_SSID 0x0509 +#define OID_802_11_BSSID 0x050A +#define OID_802_11_MIC_FAILURE_REPORT_FRAME 0x0528 #define RT_OID_DEVICE_NAME 0x0607 #define RT_OID_VERSION_INFO 0x0608 -#define OID_802_11_BSSID_LIST 0x0609 -#define OID_802_3_CURRENT_ADDRESS 0x060A #define OID_GEN_MEDIA_CONNECT_STATUS 0x060B -#define RT_OID_802_11_QUERY_LINK_STATUS 0x060C -#define OID_802_11_RSSI 0x060D -#define OID_802_11_STATISTICS 0x060E #define OID_GEN_RCV_OK 0x060F #define OID_GEN_RCV_NO_BUFFER 0x0610 -#define RT_OID_802_11_QUERY_EEPROM_VERSION 0x0611 -#define RT_OID_802_11_QUERY_FIRMWARE_VERSION 0x0612 -#define RT_OID_802_11_QUERY_LAST_RX_RATE 0x0613 -#define RT_OID_802_11_TX_POWER_LEVEL_1 0x0614 -#define RT_OID_802_11_QUERY_PIDVID 0x0615 #define OID_SET_COUNTERMEASURES 0x0616 -#define OID_802_11_SET_IEEE8021X 0x0617 -#define OID_802_11_SET_IEEE8021X_REQUIRE_KEY 0x0618 -#define OID_802_11_PMKID 0x0620 #define RT_OID_WPA_SUPPLICANT_SUPPORT 0x0621 #define RT_OID_WE_VERSION_COMPILED 0x0622 #define RT_OID_NEW_DRIVER 0x0623 - //rt2860 , kathy -#define RT_OID_802_11_SNR_0 0x0630 -#define RT_OID_802_11_SNR_1 0x0631 -#define RT_OID_802_11_QUERY_LAST_TX_RATE 0x0632 -#define RT_OID_802_11_QUERY_HT_PHYMODE 0x0633 -#define RT_OID_802_11_SET_HT_PHYMODE 0x0634 -#define OID_802_11_RELOAD_DEFAULTS 0x0635 -#define RT_OID_802_11_QUERY_APSD_SETTING 0x0636 -#define RT_OID_802_11_SET_APSD_SETTING 0x0637 -#define RT_OID_802_11_QUERY_APSD_PSM 0x0638 -#define RT_OID_802_11_SET_APSD_PSM 0x0639 -#define RT_OID_802_11_QUERY_DLS 0x063A -#define RT_OID_802_11_SET_DLS 0x063B -#define RT_OID_802_11_QUERY_DLS_PARAM 0x063C -#define RT_OID_802_11_SET_DLS_PARAM 0x063D -#define RT_OID_802_11_QUERY_WMM 0x063E -#define RT_OID_802_11_SET_WMM 0x063F -#define RT_OID_802_11_QUERY_IMME_BA_CAP 0x0640 -#define RT_OID_802_11_SET_IMME_BA_CAP 0x0641 -#define RT_OID_802_11_QUERY_BATABLE 0x0642 -#define RT_OID_802_11_ADD_IMME_BA 0x0643 -#define RT_OID_802_11_TEAR_IMME_BA 0x0644 #define RT_OID_DRIVER_DEVICE_NAME 0x0645 -#define RT_OID_802_11_QUERY_DAT_HT_PHYMODE 0x0646 #define RT_OID_QUERY_MULTIPLE_CARD_SUPPORT 0x0647 // Ralink defined OIDs // Dennis Lee move to platform specific -#define RT_OID_802_11_BSSID (OID_GET_SET_TOGGLE | OID_802_11_BSSID) -#define RT_OID_802_11_SSID (OID_GET_SET_TOGGLE | OID_802_11_SSID) -#define RT_OID_802_11_INFRASTRUCTURE_MODE (OID_GET_SET_TOGGLE | OID_802_11_INFRASTRUCTURE_MODE) -#define RT_OID_802_11_ADD_WEP (OID_GET_SET_TOGGLE | OID_802_11_ADD_WEP) -#define RT_OID_802_11_ADD_KEY (OID_GET_SET_TOGGLE | OID_802_11_ADD_KEY) -#define RT_OID_802_11_REMOVE_WEP (OID_GET_SET_TOGGLE | OID_802_11_REMOVE_WEP) -#define RT_OID_802_11_REMOVE_KEY (OID_GET_SET_TOGGLE | OID_802_11_REMOVE_KEY) -#define RT_OID_802_11_DISASSOCIATE (OID_GET_SET_TOGGLE | OID_802_11_DISASSOCIATE) -#define RT_OID_802_11_AUTHENTICATION_MODE (OID_GET_SET_TOGGLE | OID_802_11_AUTHENTICATION_MODE) -#define RT_OID_802_11_PRIVACY_FILTER (OID_GET_SET_TOGGLE | OID_802_11_PRIVACY_FILTER) -#define RT_OID_802_11_BSSID_LIST_SCAN (OID_GET_SET_TOGGLE | OID_802_11_BSSID_LIST_SCAN) -#define RT_OID_802_11_WEP_STATUS (OID_GET_SET_TOGGLE | OID_802_11_WEP_STATUS) -#define RT_OID_802_11_RELOAD_DEFAULTS (OID_GET_SET_TOGGLE | OID_802_11_RELOAD_DEFAULTS) -#define RT_OID_802_11_NETWORK_TYPE_IN_USE (OID_GET_SET_TOGGLE | OID_802_11_NETWORK_TYPE_IN_USE) -#define RT_OID_802_11_TX_POWER_LEVEL (OID_GET_SET_TOGGLE | OID_802_11_TX_POWER_LEVEL) -#define RT_OID_802_11_RSSI_TRIGGER (OID_GET_SET_TOGGLE | OID_802_11_RSSI_TRIGGER) -#define RT_OID_802_11_FRAGMENTATION_THRESHOLD (OID_GET_SET_TOGGLE | OID_802_11_FRAGMENTATION_THRESHOLD) -#define RT_OID_802_11_RTS_THRESHOLD (OID_GET_SET_TOGGLE | OID_802_11_RTS_THRESHOLD) -#define RT_OID_802_11_RX_ANTENNA_SELECTED (OID_GET_SET_TOGGLE | OID_802_11_RX_ANTENNA_SELECTED) -#define RT_OID_802_11_TX_ANTENNA_SELECTED (OID_GET_SET_TOGGLE | OID_802_11_TX_ANTENNA_SELECTED) -#define RT_OID_802_11_SUPPORTED_RATES (OID_GET_SET_TOGGLE | OID_802_11_SUPPORTED_RATES) -#define RT_OID_802_11_DESIRED_RATES (OID_GET_SET_TOGGLE | OID_802_11_DESIRED_RATES) -#define RT_OID_802_11_CONFIGURATION (OID_GET_SET_TOGGLE | OID_802_11_CONFIGURATION) -#define RT_OID_802_11_POWER_MODE (OID_GET_SET_TOGGLE | OID_802_11_POWER_MODE) - typedef enum _NDIS_802_11_STATUS_TYPE { Ndis802_11StatusType_Authentication, @@ -535,10 +430,8 @@ typedef enum _NDIS_802_11_WEP_STATUS Ndis802_11Encryption3KeyAbsent, Ndis802_11Encryption4Enabled, // TKIP or AES mix Ndis802_11Encryption4KeyAbsent, -#ifndef RT30xx Ndis802_11GroupWEP40Enabled, Ndis802_11GroupWEP104Enabled, -#endif } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; @@ -626,27 +519,9 @@ typedef struct _NDIS_802_11_CAPABILITY NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1]; } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY; -#if WIRELESS_EXT <= 11 -#ifndef SIOCDEVPRIVATE -#define SIOCDEVPRIVATE 0x8BE0 -#endif -#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE -#endif - -#ifdef RT30xx #define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon -#endif #define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02) -#ifdef DBG -#define RTPRIV_IOCTL_BBP (SIOCIWFIRSTPRIV + 0x03) -#define RTPRIV_IOCTL_MAC (SIOCIWFIRSTPRIV + 0x05) -#ifdef RT30xx -#define RTPRIV_IOCTL_RF (SIOCIWFIRSTPRIV + 0x13) -#endif -#define RTPRIV_IOCTL_E2P (SIOCIWFIRSTPRIV + 0x07) -#endif - #define RTPRIV_IOCTL_STATISTICS (SIOCIWFIRSTPRIV + 0x09) #define RTPRIV_IOCTL_ADD_PMKID_CACHE (SIOCIWFIRSTPRIV + 0x0A) #define RTPRIV_IOCTL_RADIUS_DATA (SIOCIWFIRSTPRIV + 0x0C) @@ -667,42 +542,11 @@ enum { RAIO_OFF = 10, RAIO_ON = 11, SHOW_CFG_VALUE = 20, -#if !defined(RT2860) && !defined(RT30xx) +#if !defined(RT2860) SHOW_ADHOC_ENTRY_INFO = 21, #endif }; -#define OID_802_11_BUILD_CHANNEL_EX 0x0714 -#define OID_802_11_GET_CH_LIST 0x0715 -#define OID_802_11_GET_COUNTRY_CODE 0x0716 -#define OID_802_11_GET_CHANNEL_GEOGRAPHY 0x0717 - -#ifdef RT30xx -#define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk -#define RT_OID_WSC_DRIVER_AUTO_CONNECT 0x0741 -#define RT_OID_WSC_QUERY_DEFAULT_PROFILE 0x0742 -#define RT_OID_WSC_SET_CONN_BY_PROFILE_INDEX 0x0743 -#define RT_OID_WSC_SET_ACTION 0x0744 -#define RT_OID_WSC_SET_SSID 0x0745 -#define RT_OID_WSC_SET_PIN_CODE 0x0746 -#define RT_OID_WSC_SET_MODE 0x0747 // PIN or PBC -#define RT_OID_WSC_SET_CONF_MODE 0x0748 // Enrollee or Registrar -#define RT_OID_WSC_SET_PROFILE 0x0749 - -#define RT_OID_802_11_WSC_QUERY_PROFILE 0x0750 -// for consistency with RT61 -#define RT_OID_WSC_QUERY_STATUS 0x0751 -#define RT_OID_WSC_PIN_CODE 0x0752 -#define RT_OID_WSC_UUID 0x0753 -#define RT_OID_WSC_SET_SELECTED_REGISTRAR 0x0754 -#define RT_OID_WSC_EAPMSG 0x0755 -#define RT_OID_WSC_MANUFACTURER 0x0756 -#define RT_OID_WSC_MODEL_NAME 0x0757 -#define RT_OID_WSC_MODEL_NO 0x0758 -#define RT_OID_WSC_SERIAL_NO 0x0759 -#define RT_OID_WSC_MAC_ADDRESS 0x0760 -#endif - #ifdef LLTD_SUPPORT // for consistency with RT61 #define RT_OID_GET_PHY_MODE 0x761 diff --git a/drivers/staging/rt2860/rt2860.h b/drivers/staging/rt2860/rt2860.h index 4fbec906e10..ed28fe5757c 100644 --- a/drivers/staging/rt2860/rt2860.h +++ b/drivers/staging/rt2860/rt2860.h @@ -292,6 +292,8 @@ rt2860_interrupt(int irq, void *dev_instance); #define VEN_AWT_PCIe_DEVICE_ID 0x1059 #define VEN_AWT_PCI_VENDOR_ID 0x1A3B +#define EDIMAX_PCI_VENDOR_ID 0x1432 + // For RTMPPCIePowerLinkCtrlRestore () function #define RESTORE_HALT 1 #define RESTORE_WAKEUP 2 diff --git a/drivers/staging/rt2860/rt28xx.h b/drivers/staging/rt2860/rt28xx.h index 6e71acb16dc..c08525002cc 100644 --- a/drivers/staging/rt2860/rt28xx.h +++ b/drivers/staging/rt2860/rt28xx.h @@ -47,14 +47,9 @@ #define PCI_EECTRL 0x0004 #define PCI_MCUCTRL 0x0008 -#ifdef RT30xx -#define OPT_14 0x114 +typedef int NTSTATUS; -typedef int NTSTATUS; -#define RETRY_LIMIT 10 -#define STATUS_SUCCESS 0x00 -#define STATUS_UNSUCCESSFUL 0x01 -#endif +#define OPT_14 0x114 // // SCH/DMA registers - base address 0x0200 @@ -291,7 +286,6 @@ typedef union _USB_DMA_CFG_STRUC { #define PBF_DBG 0x043c #define PBF_CAP_CTRL 0x0440 -#ifdef RT30xx // eFuse registers #define EFUSE_CTRL 0x0580 #define EFUSE_DATA0 0x0590 @@ -319,7 +313,6 @@ typedef union _EFUSE_CTRL_STRUC { #define LDO_CFG0 0x05d4 #define GPIO_SWITCH 0x05dc -#endif /* RT30xx */ // // 4 MAC registers @@ -1136,9 +1129,7 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry #define BBP_R22 22 #define BBP_R24 24 #define BBP_R25 25 -#ifdef RT30xx #define BBP_R31 31 -#endif #define BBP_R49 49 //TSSI #define BBP_R50 50 #define BBP_R51 51 @@ -1156,10 +1147,8 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry #define BBP_R73 73 #define BBP_R75 75 #define BBP_R77 77 -#ifdef RT30xx #define BBP_R79 79 #define BBP_R80 80 -#endif #define BBP_R81 81 #define BBP_R82 82 #define BBP_R83 83 @@ -1181,9 +1170,7 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry #define BBP_R121 121 #define BBP_R122 122 #define BBP_R123 123 -#ifdef RT30xx #define BBP_R138 138 // add by johnli, RF power sequence setup, ADC dynamic on/off control -#endif // RT30xx // #define BBPR94_DEFAULT 0x06 // Add 1 value will gain 1db @@ -1607,15 +1594,10 @@ typedef union _EEPROM_NIC_CINFIG2_STRUC { USHORT EnableWPSPBC:1; // WPS PBC Control bit USHORT BW40MAvailForG:1; // 0:enable, 1:disable USHORT BW40MAvailForA:1; // 0:enable, 1:disable -#ifndef RT30xx - USHORT Rsv2:6; // must be 0 -#endif -#ifdef RT30xx USHORT Rsv1:1; // must be 0 USHORT AntDiversity:1; // Antenna diversity USHORT Rsv2:3; // must be 0 USHORT DACTestBit:1; // control if driver should patch the DAC issue -#endif } field; USHORT word; } EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC; diff --git a/drivers/staging/rt2860/rt_config.h b/drivers/staging/rt2860/rt_config.h index a19cbe1dede..2093a80b19d 100644 --- a/drivers/staging/rt2860/rt_config.h +++ b/drivers/staging/rt2860/rt_config.h @@ -68,9 +68,5 @@ #include "igmp_snoop.h" #endif // IGMP_SNOOP_SUPPORT // -#ifdef IKANOS_VX_1X0 -#include "vr_ikans.h" -#endif // IKANOS_VX_1X0 // - #endif // __RT_CONFIG_H__ diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index 80176b20db0..b396a9b570e 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -537,9 +537,9 @@ PNDIS_PACKET duplicate_pkt( if ((skb = __dev_alloc_skb(HdrLen + DataSize + 2, MEM_ALLOC_FLAG)) != NULL) { skb_reserve(skb, 2); - NdisMoveMemory(skb->tail, pHeader802_3, HdrLen); + NdisMoveMemory(skb_tail_pointer(skb), pHeader802_3, HdrLen); skb_put(skb, HdrLen); - NdisMoveMemory(skb->tail, pData, DataSize); + NdisMoveMemory(skb_tail_pointer(skb), pData, DataSize); skb_put(skb, DataSize); skb->dev = get_netdev_from_bssid(pAd, FromWhichBSSID); pPacket = OSPKT_TO_RTPKT(skb); @@ -662,13 +662,9 @@ void announce_802_3_packet( pRxPkt = RTPKT_TO_OSPKT(pPacket); /* Push up the protocol stack */ -#ifdef IKANOS_VX_1X0 - IKANOS_DataFrameRx(pAd, pRxPkt->dev, pRxPkt, pRxPkt->len); -#else pRxPkt->protocol = eth_type_trans(pRxPkt, pRxPkt->dev); netif_rx(pRxPkt); -#endif // IKANOS_VX_1X0 // } @@ -728,7 +724,6 @@ VOID RTMPSendWirelessEvent( IN UCHAR BssIdx, IN CHAR Rssi) { -#if WIRELESS_EXT >= 15 union iwreq_data wrqu; PUCHAR pBuf = NULL, pBufPtr = NULL; @@ -776,7 +771,7 @@ VOID RTMPSendWirelessEvent( if (pAddr) pBufPtr += sprintf(pBufPtr, "(RT2860) STA(%02x:%02x:%02x:%02x:%02x:%02x) ", PRINT_MAC(pAddr)); else if (BssIdx < MAX_MBSSID_NUM) - pBufPtr += sprintf(pBufPtr, "(RT2860) BSS(ra%d) ", BssIdx); + pBufPtr += sprintf(pBufPtr, "(RT2860) BSS(wlan%d) ", BssIdx); else pBufPtr += sprintf(pBufPtr, "(RT2860) "); @@ -805,9 +800,6 @@ VOID RTMPSendWirelessEvent( } else DBGPRINT(RT_DEBUG_ERROR, ("%s : Can't allocate memory for wireless event.\n", __func__)); -#else - DBGPRINT(RT_DEBUG_ERROR, ("%s : The Wireless Extension MUST be v15 or newer.\n", __func__)); -#endif /* WIRELESS_EXT >= 15 */ } void send_monitor_packets( @@ -834,12 +826,7 @@ void send_monitor_packets( if (pRxBlk->DataSize + sizeof(wlan_ng_prism2_header) > RX_BUFFER_AGGRESIZE) { -#ifndef RT30xx DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too large! (%zu)\n", __func__, pRxBlk->DataSize + sizeof(wlan_ng_prism2_header))); -#endif -#ifdef RT30xx - DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too large! (%d)\n", __func__, pRxBlk->DataSize + sizeof(wlan_ng_prism2_header))); -#endif goto err_free_sk_buff; } diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index 25b53ac3f82..e8d64c30b90 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -63,10 +63,6 @@ #include <linux/ctype.h> #include <linux/vmalloc.h> - -#ifdef RT30xx -#include <linux/wireless.h> -#endif #include <net/iw_handler.h> // load firmware @@ -90,22 +86,23 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_ // add by kathy -#ifdef RT2860 -#define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat" -#define STA_RTMP_FIRMWARE_FILE_NAME "/etc/Wireless/RT2860STA/RT2860STA.bin" -#define STA_NIC_DEVICE_NAME "RT2860STA" -#define STA_DRIVER_VERSION "1.8.1.1" -#endif -#ifdef RT2870 -#define STA_PROFILE_PATH "/etc/Wireless/RT2870STA/RT2870STA.dat" -#define STA_RT2870_IMAGE_FILE_NAME "/etc/Wireless/RT2870STA/rt2870.bin" -#define STA_NIC_DEVICE_NAME "RT2870STA" -#ifndef RT30xx -#define STA_DRIVER_VERSION "1.4.0.0" -#endif -#ifdef RT30xx -#define STA_DRIVER_VERSION "2.0.1.0" -#endif +/* order of "if defined()" is important, because for 3070 driver + both RT2870 and RT3070 are defined */ +#if defined(RT2860) + #define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat" + #define STA_RTMP_FIRMWARE_FILE_NAME "/etc/Wireless/RT2860STA/RT2860STA.bin" + #define STA_NIC_DEVICE_NAME "RT2860STA" + #define STA_DRIVER_VERSION "1.8.1.1" +#elif defined(RT3070) + #define STA_PROFILE_PATH "/etc/Wireless/RT3070STA/RT3070STA.dat" + #define STA_RT2870_IMAGE_FILE_NAME "/etc/Wireless/RT3070STA/rt2870.bin" + #define STA_NIC_DEVICE_NAME "RT3070STA" + #define STA_DRIVER_VERSION "2.0.1.0" +#elif defined(RT2870) + #define STA_PROFILE_PATH "/etc/Wireless/RT2870STA/RT2870STA.dat" + #define STA_RT2870_IMAGE_FILE_NAME "/etc/Wireless/RT2870STA/rt2870.bin" + #define STA_NIC_DEVICE_NAME "RT2870STA" + #define STA_DRIVER_VERSION "1.4.0.0" #endif #ifdef RT2860 @@ -161,15 +158,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_ #define NDIS_PACKET_TYPE_BROADCAST 2 #define NDIS_PACKET_TYPE_ALL_MULTICAST 3 -#ifndef RT30xx -typedef struct pid * THREAD_PID; -#define THREAD_PID_INIT_VALUE NULL -#define GET_PID(_v) find_get_pid(_v) -#define GET_PID_NUMBER(_v) pid_nr(_v) -#define CHECK_PID_LEGALITY(_pid) if (pid_nr(_pid) >= 0) -#define KILL_THREAD_PID(_A, _B, _C) kill_pid(_A, _B, _C) -#endif - struct os_lock { spinlock_t lock; unsigned long flags; @@ -185,16 +173,9 @@ struct os_cookie { #ifdef RT2870 struct usb_device *pUsb_Dev; -#ifndef RT30xx - THREAD_PID MLMEThr_pid; - THREAD_PID RTUSBCmdThr_pid; - THREAD_PID TimerQThr_pid; -#endif -#ifdef RT30xx struct pid *MLMEThr_pid; struct pid *RTUSBCmdThr_pid; struct pid *TimerQThr_pid; -#endif #endif // RT2870 // struct tasklet_struct rx_done_task; @@ -219,12 +200,6 @@ struct os_cookie { INT ioctl_if; }; -typedef struct _VIRTUAL_ADAPTER -{ - struct net_device *RtmpDev; - struct net_device *VirtualDev; -} VIRTUAL_ADAPTER, PVIRTUAL_ADAPTER; - #undef ASSERT #define ASSERT(x) @@ -444,51 +419,6 @@ extern ULONG RTDebugLevel; } #ifdef RT2860 -#if defined(INF_TWINPASS) || defined(INF_DANUBE) || defined(IKANOS_VX_1X0) -//Patch for ASIC turst read/write bug, needs to remove after metel fix -#define RTMP_IO_READ32(_A, _R, _pV) \ -{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R)))); \ - (*_pV = SWAP32(*((UINT32 *)(_pV)))); \ - } \ -} -#define RTMP_IO_FORCE_READ32(_A, _R, _pV) \ -{ \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R)))); \ - (*_pV = SWAP32(*((UINT32 *)(_pV)))); \ -} -#define RTMP_IO_READ8(_A, _R, _pV) \ -{ \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ - (*_pV = readb((void *)((_A)->CSRBaseAddress + (_R)))); \ -} -#define RTMP_IO_WRITE32(_A, _R, _V) \ -{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - UINT32 _Val; \ - _Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - _Val = SWAP32(_V); \ - writel(_Val, (void *)((_A)->CSRBaseAddress + (_R))); \ - } \ -} -#define RTMP_IO_WRITE8(_A, _R, _V) \ -{ \ - UINT Val; \ - Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R))); \ -} -#define RTMP_IO_WRITE16(_A, _R, _V) \ -{ \ - UINT Val; \ - Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writew(SWAP16((_V)), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \ -} -#else //Patch for ASIC turst read/write bug, needs to remove after metel fix #define RTMP_IO_READ32(_A, _R, _pV) \ { \ @@ -519,32 +449,18 @@ extern ULONG RTDebugLevel; writel(_V, (void *)((_A)->CSRBaseAddress + (_R))); \ } \ } -#if defined(BRCM_6358) -#define RTMP_IO_WRITE8(_A, _R, _V) \ -{ \ - ULONG Val; \ - UCHAR _i; \ - _i = (_R & 0x3); \ - Val = readl((void *)((_A)->CSRBaseAddress + (_R - _i))); \ - Val = Val & (~(0x000000ff << ((_i)*8))); \ - Val = Val | ((ULONG)_V << ((_i)*8)); \ - writel((Val), (void *)((_A)->CSRBaseAddress + (_R - _i))); \ -} -#else #define RTMP_IO_WRITE8(_A, _R, _V) \ { \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R))); \ } -#endif #define RTMP_IO_WRITE16(_A, _R, _V) \ { \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writew((_V), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \ } -#endif #endif /* RT2860 */ #ifdef RT2870 //Patch for ASIC turst read/write bug, needs to remove after metel fix diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 35c59d5aa99..22f37cfbefb 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -74,11 +74,9 @@ static void CfgInitHook(PRTMP_ADAPTER pAd); extern const struct iw_handler_def rt28xx_iw_handler_def; -#if WIRELESS_EXT >= 12 // This function will be called when query /proc struct iw_statistics *rt28xx_get_wireless_stats( IN struct net_device *net_dev); -#endif struct net_device_stats *RT28xx_get_ether_stats( IN struct net_device *net_dev); @@ -190,7 +188,7 @@ int rt28xx_close(IN PNET_DEV dev) BOOLEAN Cancelled = FALSE; UINT32 i = 0; #ifdef RT2870 - DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup); + DECLARE_WAIT_QUEUE_HEAD_ONSTACK(unlink_wakeup); DECLARE_WAITQUEUE(wait, current); //RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); @@ -517,9 +515,6 @@ static int rt28xx_init(IN struct net_device *net_dev) NICInitRT30xxRFRegisters(pAd); #endif // RT2870 // -#ifdef IKANOS_VX_1X0 - VR_IKANOS_FP_Init(pAd->ApCfg.BssidNum, pAd->PermanentAddress); -#endif // IKANOS_VX_1X0 // // // Initialize RF register to default value @@ -527,7 +522,7 @@ static int rt28xx_init(IN struct net_device *net_dev) AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); -#ifndef RT30xx +#ifndef RT2870 // 8051 firmware require the signal during booting time. AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00); #endif @@ -675,16 +670,12 @@ err: static const struct net_device_ops rt2860_netdev_ops = { .ndo_open = MainVirtualIF_open, .ndo_stop = MainVirtualIF_close, - .ndo_do_ioctl = rt28xx_ioctl, + .ndo_do_ioctl = rt28xx_sta_ioctl, .ndo_get_stats = RT28xx_get_ether_stats, .ndo_validate_addr = NULL, .ndo_set_mac_address = eth_mac_addr, .ndo_change_mtu = eth_change_mtu, -#ifdef IKANOS_VX_1X0 - .ndo_start_xmit = IKANOS_DataFramesTx, -#else .ndo_start_xmit = rt28xx_send_packets, -#endif }; /* Must not be called for mdev and apdev */ @@ -695,22 +686,17 @@ static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER p CHAR slot_name[IFNAMSIZ]; struct net_device *device; -#if WIRELESS_EXT >= 12 if (pAd->OpMode == OPMODE_STA) { dev->wireless_handlers = &rt28xx_iw_handler_def; } -#endif //WIRELESS_EXT >= 12 -#if WIRELESS_EXT < 21 - dev->get_wireless_stats = rt28xx_get_wireless_stats; -#endif dev->priv_flags = INT_MAIN; dev->netdev_ops = &rt2860_netdev_ops; // find available device name for (i = 0; i < 8; i++) { - sprintf(slot_name, "ra%d", i); + sprintf(slot_name, "wlan%d", i); device = dev_get_by_name(dev_net(dev), slot_name); if (device != NULL) @@ -727,7 +713,7 @@ static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER p } else { - sprintf(dev->name, "ra%d", i); + sprintf(dev->name, "wlan%d", i); Status = NDIS_STATUS_SUCCESS; } @@ -791,6 +777,8 @@ INT __devinit rt28xx_probe( // Allocate RTMP_ADAPTER miniport adapter structure handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); + if (handle == NULL) + goto err_out_free_netdev;; RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p); status = RTMPAllocAdapterBlock(handle, &pAd); @@ -942,7 +930,6 @@ void CfgInitHook(PRTMP_ADAPTER pAd) } /* End of CfgInitHook */ -#if WIRELESS_EXT >= 12 // This function will be called when query /proc struct iw_statistics *rt28xx_get_wireless_stats( IN struct net_device *net_dev) @@ -976,7 +963,6 @@ struct iw_statistics *rt28xx_get_wireless_stats( DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n")); return &pAd->iw_stats; } /* End of rt28xx_get_wireless_stats */ -#endif // WIRELESS_EXT // @@ -986,37 +972,6 @@ void tbtt_tasklet(unsigned long data) } -INT rt28xx_ioctl( - IN struct net_device *net_dev, - IN OUT struct ifreq *rq, - IN INT cmd) -{ - VIRTUAL_ADAPTER *pVirtualAd = NULL; - RTMP_ADAPTER *pAd = NULL; - INT ret = 0; - - if (net_dev->priv_flags == INT_MAIN) - { - pAd = net_dev->ml_priv; - } - else - { - pVirtualAd = net_dev->ml_priv; - pAd = pVirtualAd->RtmpDev->ml_priv; - } - - if (pAd == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - ret = rt28xx_sta_ioctl(net_dev, rq, cmd); - - return ret; -} - /* ======================================================================== diff --git a/drivers/staging/rt2860/rt_profile.c b/drivers/staging/rt2860/rt_profile.c index d92b14328d4..3bc41f83f62 100644 --- a/drivers/staging/rt2860/rt_profile.c +++ b/drivers/staging/rt2860/rt_profile.c @@ -710,7 +710,7 @@ static int rtmp_parse_key_buffer_from_file(IN PRTMP_ADAPTER pAd,IN char *buffe CipherAlg = CIPHER_WEP128; pAd->SharedKey[i][idx].CipherAlg = CipherAlg; - DBGPRINT(RT_DEBUG_TRACE, ("I/F(ra%d) Key%dStr=%s and type=%s\n", i, idx+1, keybuff, (KeyType == 0) ? "Hex":"Ascii")); + DBGPRINT(RT_DEBUG_TRACE, ("I/F(wlan%d) Key%dStr=%s and type=%s\n", i, idx+1, keybuff, (KeyType == 0) ? "Hex":"Ascii")); return 1; } else @@ -731,12 +731,12 @@ static int rtmp_parse_key_buffer_from_file(IN PRTMP_ADAPTER pAd,IN char *buffe CipherAlg = CIPHER_WEP128; pAd->SharedKey[i][idx].CipherAlg = CipherAlg; - DBGPRINT(RT_DEBUG_TRACE, ("I/F(ra%d) Key%dStr=%s and type=%s\n", i, idx+1, keybuff, (KeyType == 0) ? "Hex":"Ascii")); + DBGPRINT(RT_DEBUG_TRACE, ("I/F(wlan%d) Key%dStr=%s and type=%s\n", i, idx+1, keybuff, (KeyType == 0) ? "Hex":"Ascii")); return 1; } else {//Invalid key length - DBGPRINT(RT_DEBUG_ERROR, ("I/F(ra%d) Key%dStr is Invalid key length! KeyLen = %ld!\n", i, idx+1, KeyLen)); + DBGPRINT(RT_DEBUG_ERROR, ("I/F(wlan%d) Key%dStr is Invalid key length! KeyLen = %ld!\n", i, idx+1, KeyLen)); return 0; } } @@ -860,7 +860,7 @@ NDIS_STATUS RTMPReadParametersHook( { PUCHAR src = NULL; struct file *srcf; - INT retval, orgfsuid, orgfsgid; + INT retval; mm_segment_t orgfs; CHAR *buffer; CHAR *tmpbuf; @@ -884,15 +884,6 @@ NDIS_STATUS RTMPReadParametersHook( src = STA_PROFILE_PATH; - // Save uid and gid used for filesystem access. - // Set user and group to 0 (root) -#ifndef RT30xx - orgfsuid = current_fsuid(); - orgfsgid = current_fsgid(); - /* Hm, can't really do this nicely anymore, so rely on these files - * being set to the proper permission to read them... */ - /* current->cred->fsuid = current->cred->fsgid = 0; */ -#endif orgfs = get_fs(); set_fs(KERNEL_DS); @@ -1230,14 +1221,10 @@ NDIS_STATUS RTMPReadParametersHook( //WirelessEvent if(RTMPGetKeyParameter("WirelessEvent", tmpbuf, 10, buffer)) { -#if WIRELESS_EXT >= 15 if(simple_strtol(tmpbuf, 0, 10) != 0) pAd->CommonCfg.bWirelessEvent = simple_strtol(tmpbuf, 0, 10); else pAd->CommonCfg.bWirelessEvent = 0; // disable -#else - pAd->CommonCfg.bWirelessEvent = 0; // disable -#endif DBGPRINT(RT_DEBUG_TRACE, ("WirelessEvent=%d\n", pAd->CommonCfg.bWirelessEvent)); } if(RTMPGetKeyParameter("WiFiTest", tmpbuf, 10, buffer)) @@ -1442,23 +1429,6 @@ NDIS_STATUS RTMPReadParametersHook( DBGPRINT(RT_DEBUG_TRACE, ("TGnWifiTest=%d\n", pAd->StaCfg.bTGnWifiTest)); } } - -#ifdef RT30xx - { - if(RTMPGetKeyParameter("AntDiversity", tmpbuf, 10, buffer)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - if(simple_strtol(macptr, 0, 10) != 0) //Enable - pAd->CommonCfg.bRxAntDiversity = TRUE; - else //Disable - pAd->CommonCfg.bRxAntDiversity = FALSE; - - DBGPRINT(RT_DEBUG_ERROR, ("AntDiversity=%d\n", pAd->CommonCfg.bRxAntDiversity)); - } - } - } -#endif // RT30xx // } } else @@ -1571,21 +1541,15 @@ static void HTParametersHook( if (Value == 0) { pAd->CommonCfg.BACapability.field.AutoBA = FALSE; -#ifdef RT30xx pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE; -#endif } else { pAd->CommonCfg.BACapability.field.AutoBA = TRUE; -#ifdef RT30xx pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; -#endif } pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA; -#ifdef RT30xx pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy; -#endif DBGPRINT(RT_DEBUG_TRACE, ("HT: Auto BA = %s\n", (Value==0) ? "Disable" : "Enable")); } diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 25c31998d07..3f498f6f3ff 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -40,13 +40,10 @@ #ifndef __RTMP_H__ #define __RTMP_H__ -#include "link_list.h" #include "spectrum_def.h" #include "aironet.h" -//#define DBG_DIAGNOSE 1 - #define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++) #define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--) #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt) @@ -234,15 +231,9 @@ extern UCHAR WpaIe; extern UCHAR Wpa2Ie; extern UCHAR IbssIe; extern UCHAR Ccx2Ie; -#ifdef RT30xx -extern UCHAR WapiIe; -#endif extern UCHAR WPA_OUI[]; extern UCHAR RSN_OUI[]; -#ifdef RT30xx -extern UCHAR WAPI_OUI[]; -#endif extern UCHAR WME_INFO_ELEM[]; extern UCHAR WME_PARM_ELEM[]; extern UCHAR Ccx2QosInfo[]; @@ -400,15 +391,15 @@ typedef struct _QUEUE_HEADER { (_idx) = (_idx+1) % (_RingSize); \ } -#ifdef RT30xx +#ifdef RT2870 // We will have a cost down version which mac version is 0x3090xxxx #define IS_RT3090(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30710000) || (((_pAd)->MACVersion & 0xffff0000) == 0x30900000)) +#else +#define IS_RT3090(_pAd) 0 #endif #define IS_RT3070(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30700000) -#ifdef RT30xx +#ifdef RT2870 #define IS_RT3071(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30710000) -#define IS_RT2070(_pAd) (((_pAd)->RfIcType == RFIC_2020) || ((_pAd)->EFuseTag == 0x27)) - #define IS_RT30xx(_pAd) (((_pAd)->MACVersion & 0xfff00000) == 0x30700000) #endif @@ -664,11 +655,6 @@ typedef struct _QUEUE_HEADER { #define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV) #endif // RT2870 // -#ifdef RT30xx -#define RTMP_RF_IO_READ8_BY_REG_ID(_A, _I, _pV) RT30xxReadRFRegister(_A, _I, _pV) -#define RTMP_RF_IO_WRITE8_BY_REG_ID(_A, _I, _V) RT30xxWriteRFRegister(_A, _I, _V) -#endif // RT30xx // - #define MAP_CHANNEL_ID_TO_KHZ(ch, khz) { \ switch (ch) \ { \ @@ -935,7 +921,6 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { } #endif // RT2870 // -#ifdef RT30xx //Need to collect each ant's rssi concurrently //rssi1 is report to pair2 Ant and rss2 is reprot to pair1 Ant when 4 Ant #define COLLECT_RX_ANTENNA_AVERAGE_RSSI(_pAd, _rssi1, _rssi2) \ @@ -967,8 +952,6 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { _pAd->RxAnt.RcvPktNumWhenEvaluate++; \ } \ } -#endif // RT30xx // - #define NDIS_QUERY_BUFFER(_NdisBuf, _ppVA, _pBufLen) \ NdisQueryBuffer(_NdisBuf, _ppVA, _pBufLen) @@ -1312,7 +1295,7 @@ typedef struct _BBP_TUNING_STRUCT { typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status -#ifdef RT30xx +#ifdef RT2870 UCHAR EvaluateStableCnt; #endif UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2 @@ -1916,9 +1899,6 @@ typedef struct _COMMON_CONFIG { BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode. -#ifdef RT30xx - BOOLEAN bRxAntDiversity; // 0:disable, 1:enable Software Rx Antenna Diversity. -#endif // IEEE802.11H--DFS. RADAR_DETECT_STRUCT RadarDetect; @@ -2532,43 +2512,6 @@ typedef struct _INF_USB_CONFIG }INF_USB_CONFIG; -#ifdef IKANOS_VX_1X0 - typedef void (*IkanosWlanTxCbFuncP)(void *, void *); - - struct IKANOS_TX_INFO - { - struct net_device *netdev; - IkanosWlanTxCbFuncP *fp; - }; -#endif // IKANOS_VX_1X0 // - -#ifdef DBG_DIAGNOSE -#define DIAGNOSE_TIME 10 // 10 sec -typedef struct _RtmpDiagStrcut_ -{ // Diagnosis Related element - unsigned char inited; - unsigned char qIdx; - unsigned char ArrayStartIdx; - unsigned char ArrayCurIdx; - // Tx Related Count - USHORT TxDataCnt[DIAGNOSE_TIME]; - USHORT TxFailCnt[DIAGNOSE_TIME]; - USHORT TxDescCnt[DIAGNOSE_TIME][24]; // 3*3 // TxDesc queue length in scale of 0~14, >=15 - USHORT TxMcsCnt[DIAGNOSE_TIME][24]; // 3*3 - USHORT TxSWQueCnt[DIAGNOSE_TIME][9]; // TxSwQueue length in scale of 0, 1, 2, 3, 4, 5, 6, 7, >=8 - - USHORT TxAggCnt[DIAGNOSE_TIME]; - USHORT TxNonAggCnt[DIAGNOSE_TIME]; - USHORT TxAMPDUCnt[DIAGNOSE_TIME][24]; // 3*3 // 10 sec, TxDMA APMDU Aggregation count in range from 0 to 15, in setp of 1. - USHORT TxRalinkCnt[DIAGNOSE_TIME]; // TxRalink Aggregation Count in 1 sec scale. - USHORT TxAMSDUCnt[DIAGNOSE_TIME]; // TxAMSUD Aggregation Count in 1 sec scale. - - // Rx Related Count - USHORT RxDataCnt[DIAGNOSE_TIME]; // Rx Total Data count. - USHORT RxCrcErrCnt[DIAGNOSE_TIME]; - USHORT RxMcsCnt[DIAGNOSE_TIME][24]; // 3*3 -}RtmpDiagStruct; -#endif // DBG_DIAGNOSE // // @@ -2721,9 +2664,8 @@ typedef struct _RTMP_ADAPTER ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused UCHAR EEPROMAddressNum; // 93c46=6 93c66=8 USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; -#ifdef RT30xx +#ifdef RT2870 BOOLEAN EepromAccess; - UCHAR EFuseTag; #endif ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused. @@ -2972,9 +2914,7 @@ typedef struct _RTMP_ADAPTER ULONG OneSecondnonBEpackets; // record non BE packets per second -#if WIRELESS_EXT >= 12 struct iw_statistics iw_stats; -#endif struct net_device_stats stats; @@ -2991,25 +2931,13 @@ typedef struct _RTMP_ADAPTER UCHAR flg_be_adjust; ULONG be_adjust_last_time; -#ifdef IKANOS_VX_1X0 - struct IKANOS_TX_INFO IkanosTxInfo; - struct IKANOS_TX_INFO IkanosRxInfo[MAX_MBSSID_NUM + MAX_WDS_ENTRY + MAX_APCLI_NUM + MAX_MESH_NUM]; -#endif // IKANOS_VX_1X0 // - - -#ifdef DBG_DIAGNOSE - RtmpDiagStruct DiagStruct; -#endif // DBG_DIAGNOSE // UINT8 PM_FlgSuspend; -#ifdef RT30xx -//======efuse +#ifdef RT2870 BOOLEAN bUseEfuse; - BOOLEAN bEEPROMFile; -#endif // RT30xx // - +#endif } RTMP_ADAPTER, *PRTMP_ADAPTER; // @@ -3235,14 +3163,6 @@ static inline VOID ConvertMulticastIP2MAC( } #endif /* RT2860 */ -BOOLEAN RTMPCheckForHang( - IN NDIS_HANDLE MiniportAdapterContext - ); - -VOID RTMPHalt( - IN NDIS_HANDLE MiniportAdapterContext - ); - // // Private routines in rtmp_init.c // @@ -3255,11 +3175,6 @@ NDIS_STATUS RTMPAllocTxRxRingMemory( IN PRTMP_ADAPTER pAd ); -NDIS_STATUS RTMPFindAdapter( - IN PRTMP_ADAPTER pAd, - IN NDIS_HANDLE WrapperConfigurationContext - ); - NDIS_STATUS RTMPReadParametersHook( IN PRTMP_ADAPTER pAd ); @@ -3306,13 +3221,6 @@ VOID RTMPRingCleanUp( IN PRTMP_ADAPTER pAd, IN UCHAR RingType); -VOID RxTest( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS DbgSendPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - VOID UserCfgInit( IN PRTMP_ADAPTER pAd); @@ -3366,26 +3274,6 @@ UCHAR BtoH( VOID RTMPPatchMacBbpBug( IN PRTMP_ADAPTER pAd); -VOID RTMPPatchCardBus( - IN PRTMP_ADAPTER pAdapter); - -VOID RTMPPatchRalinkCardBus( - IN PRTMP_ADAPTER pAdapter, - IN ULONG Bus); - -ULONG RTMPReadCBConfig( - IN ULONG Bus, - IN ULONG Slot, - IN ULONG Func, - IN ULONG Offset); - -VOID RTMPWriteCBConfig( - IN ULONG Bus, - IN ULONG Slot, - IN ULONG Func, - IN ULONG Offset, - IN ULONG Value); - VOID RTMPInitTimer( IN PRTMP_ADAPTER pAd, IN PRALINK_TIMER_STRUCT pTimer, @@ -3474,14 +3362,6 @@ VOID PeerPublicAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); -VOID StaPublicAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Bss2040Coexist); - -VOID PeerBSSTranAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - VOID PeerHTAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); @@ -3523,39 +3403,18 @@ VOID InsertActField( IN UINT8 Category, IN UINT8 ActCode); -BOOLEAN QosBADataParse( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bAMSDU, - IN PUCHAR p8023Header, - IN UCHAR WCID, - IN UCHAR TID, - IN USHORT Sequence, - IN UCHAR DataOffset, - IN USHORT Datasize, - IN UINT CurRxIndex); - BOOLEAN CntlEnqueueForRecv( IN PRTMP_ADAPTER pAd, IN ULONG Wcid, IN ULONG MsgLen, IN PFRAME_BA_REQ pMsg); -VOID BaAutoManSwitch( - IN PRTMP_ADAPTER pAd); - -VOID HTIOTCheck( - IN PRTMP_ADAPTER pAd, - IN UCHAR BatRecIdx); - // // Private routines in rtmp_data.c // BOOLEAN RTMPHandleRxDoneInterrupt( IN PRTMP_ADAPTER pAd); -VOID RTMPHandleTxDoneInterrupt( - IN PRTMP_ADAPTER pAd); - BOOLEAN RTMPHandleTxRingDmaDoneInterrupt( IN PRTMP_ADAPTER pAd, IN INT_SOURCE_CSR_STRUC TxRingBitmap); @@ -3697,13 +3556,7 @@ NDIS_STATUS MiniportMMRequest( IN UCHAR QueIdx, IN PUCHAR pData, IN UINT Length); -#ifdef RT2870 -NDIS_STATUS MiniportDataMMRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PUCHAR pData, - IN UINT Length); -#endif + VOID RTMPSendNullFrame( IN PRTMP_ADAPTER pAd, IN UCHAR TxRate, @@ -3722,12 +3575,6 @@ VOID RTMPSendRTSFrame( IN UCHAR QueIdx, IN UCHAR FrameGap); - -NDIS_STATUS RTMPApplyPacketFilter( - IN PRTMP_ADAPTER pAd, - IN PRT28XX_RXD_STRUC pRxD, - IN PHEADER_802_11 pHeader); - PQUEUE_HEADER RTMPCheckTxSwQueue( IN PRTMP_ADAPTER pAd, OUT UCHAR *QueIdx); @@ -3778,10 +3625,6 @@ BOOLEAN RTMPCheckEtherType( IN PNDIS_PACKET pPacket); -VOID RTMPCckBbpTuning( - IN PRTMP_ADAPTER pAd, - IN UINT TxRate); - // // Private routines in rtmp_wep.c // @@ -3798,12 +3641,6 @@ VOID RTMPEncryptData( IN PUCHAR pDest, IN UINT Len); -BOOLEAN RTMPDecryptData( - IN PRTMP_ADAPTER pAdapter, - IN PUCHAR pSrc, - IN UINT Len, - IN UINT idx); - BOOLEAN RTMPSoftDecryptWEP( IN PRTMP_ADAPTER pAd, IN PUCHAR pData, @@ -3870,14 +3707,6 @@ VOID AsicLockChannel( IN PRTMP_ADAPTER pAd, IN UCHAR Channel) ; -VOID AsicAntennaSelect( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel); - -VOID AsicAntennaSetting( - IN PRTMP_ADAPTER pAd, - IN ABGBAND_STATE BandState); - VOID AsicRfTuningExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, @@ -4051,23 +3880,6 @@ VOID BATableDeleteORIEntry( IN OUT PRTMP_ADAPTER pAd, IN BA_ORI_ENTRY *pBAORIEntry); -VOID BATableDeleteRECEntry( - IN OUT PRTMP_ADAPTER pAd, - IN BA_REC_ENTRY *pBARECEntry); - -VOID BATableTearORIEntry( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR TID, - IN UCHAR Wcid, - IN BOOLEAN bForceDelete, - IN BOOLEAN ALL); - -VOID BATableTearRECEntry( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR TID, - IN UCHAR WCID, - IN BOOLEAN ALL); - VOID BssEntrySet( IN PRTMP_ADAPTER pAd, OUT PBSS_ENTRY pBss, @@ -4243,10 +4055,6 @@ VOID DisassocTimeout( IN PVOID SystemSpecific3); //---------------------------------------------- -VOID MlmeDisassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - VOID MlmeAssocReqAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); @@ -4410,10 +4218,6 @@ VOID ScanTimeout( IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -VOID MlmeScanReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - VOID InvalidStateWhenScan( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); @@ -4426,10 +4230,6 @@ VOID InvalidStateWhenStart( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); -VOID PeerBeacon( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - VOID EnqueueProbeRequest( IN PRTMP_ADAPTER pAd); @@ -4727,13 +4527,6 @@ BOOLEAN PeerDisassocSanity( OUT PUCHAR pAddr2, OUT USHORT *Reason); -BOOLEAN PeerWpaMessageSanity( - IN PRTMP_ADAPTER pAd, - IN PEAPOL_PACKET pMsg, - IN ULONG MsgLen, - IN UCHAR MsgType, - IN MAC_TABLE_ENTRY *pEntry); - BOOLEAN PeerDeauthSanity( IN PRTMP_ADAPTER pAd, IN VOID *Msg, @@ -4803,12 +4596,6 @@ VOID LinkDownExec( IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -VOID LinkUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - VOID STAMlmePeriodicExec( PRTMP_ADAPTER pAd); @@ -4895,12 +4682,6 @@ VOID StaQuickResponeForRateUpExec( IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -VOID AsicBbpTuning1( - IN PRTMP_ADAPTER pAd); - -VOID AsicBbpTuning2( - IN PRTMP_ADAPTER pAd); - VOID RTMPUpdateMlmeRate( IN PRTMP_ADAPTER pAd); @@ -4910,11 +4691,9 @@ CHAR RTMPMaxRssi( IN CHAR Rssi1, IN CHAR Rssi2); -#ifdef RT30xx VOID AsicSetRxAnt( IN PRTMP_ADAPTER pAd, IN UCHAR Ant); -#endif VOID AsicEvaluateRxAnt( IN PRTMP_ADAPTER pAd); @@ -4972,31 +4751,6 @@ VOID ChangeToCellPowerLimit( IN PRTMP_ADAPTER pAd, IN UCHAR AironetCellPowerLimit); -VOID RaiseClock( - IN PRTMP_ADAPTER pAd, - IN UINT32 *x); - -VOID LowerClock( - IN PRTMP_ADAPTER pAd, - IN UINT32 *x); - -USHORT ShiftInBits( - IN PRTMP_ADAPTER pAd); - -VOID ShiftOutBits( - IN PRTMP_ADAPTER pAd, - IN USHORT data, - IN USHORT count); - -VOID EEpromCleanup( - IN PRTMP_ADAPTER pAd); - -VOID EWDS( - IN PRTMP_ADAPTER pAd); - -VOID EWEN( - IN PRTMP_ADAPTER pAd); - USHORT RTMP_EEPROM_READ16( IN PRTMP_ADAPTER pAd, IN USHORT Offset); @@ -5122,12 +4876,6 @@ VOID RTMPIoctlGetMacTable( IN PRTMP_ADAPTER pAd, IN struct iwreq *wrq); -VOID RTMPIndicateWPA2Status( - IN PRTMP_ADAPTER pAdapter); - -VOID RTMPOPModeSwitching( - IN PRTMP_ADAPTER pAd); - VOID RTMPAddBSSIDCipher( IN PRTMP_ADAPTER pAd, IN UCHAR Aid, @@ -5149,11 +4897,6 @@ VOID RTMPSendWirelessEvent( IN UCHAR BssIdx, IN CHAR Rssi); -VOID NICUpdateCntlCounters( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN UCHAR SubType, - IN PRXWI_STRUC pRxWI); // // prototype in wpa.c // @@ -5305,25 +5048,11 @@ VOID AironetAddBeaconReport( VOID AironetCreateBeaconReportFromBssTable( IN PRTMP_ADAPTER pAd); -VOID DBGPRINT_TX_RING( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx); - -VOID DBGPRINT_RX_RING( - IN PRTMP_ADAPTER pAd); - CHAR ConvertToRssi( IN PRTMP_ADAPTER pAd, IN CHAR Rssi, IN UCHAR RssiNumber); -VOID APAsicEvaluateRxAnt( - IN PRTMP_ADAPTER pAd); - - -VOID APAsicRxAntEvalTimeout( - IN PRTMP_ADAPTER pAd); - // // function prototype in cmm_wpa.c // @@ -5340,64 +5069,6 @@ VOID AES_GTK_KEY_UNWRAP( IN UCHAR c_len, IN UCHAR *ciphertext); -BOOLEAN RTMPCheckRSNIE( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN UCHAR DataLen, - IN MAC_TABLE_ENTRY *pEntry, - OUT UCHAR *Offset); - -BOOLEAN RTMPParseEapolKeyData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN UCHAR GroupKeyIndex, - IN UCHAR MsgType, - IN BOOLEAN bWPA2, - IN MAC_TABLE_ENTRY *pEntry); - -VOID ConstructEapolMsg( - IN PRTMP_ADAPTER pAd, - IN UCHAR PeerAuthMode, - IN UCHAR PeerWepStatus, - IN UCHAR MyGroupKeyWepStatus, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR *ReplayCounter, - IN UCHAR *KeyNonce, - IN UCHAR *TxRSC, - IN UCHAR *PTK, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_Len, - OUT PEAPOL_PACKET pMsg); - -VOID CalculateMIC( - IN PRTMP_ADAPTER pAd, - IN UCHAR PeerWepStatus, - IN UCHAR *PTK, - OUT PEAPOL_PACKET pMsg); - -NDIS_STATUS RTMPSoftDecryptBroadCastData( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, - IN PCIPHER_KEY pShard_key); - -VOID ConstructEapolKeyData( - IN PRTMP_ADAPTER pAd, - IN UCHAR PeerAuthMode, - IN UCHAR PeerWepStatus, - IN UCHAR GroupKeyWepStatus, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN BOOLEAN bWPA2Capable, - IN UCHAR *PTK, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_LEN, - OUT PEAPOL_PACKET pMsg); - VOID RTMPMakeRSNIE( IN PRTMP_ADAPTER pAd, IN UINT AuthMode, @@ -5408,192 +5079,10 @@ VOID RTMPMakeRSNIE( // function prototype in ap_wpa.c // -BOOLEAN APWpaMsgTypeSubst( - IN UCHAR EAPType, - OUT INT *MsgType) ; - -MAC_TABLE_ENTRY *PACInquiry( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid); - -BOOLEAN RTMPCheckMcast( - IN PRTMP_ADAPTER pAd, - IN PEID_STRUCT eid_ptr, - IN MAC_TABLE_ENTRY *pEntry); - -BOOLEAN RTMPCheckUcast( - IN PRTMP_ADAPTER pAd, - IN PEID_STRUCT eid_ptr, - IN MAC_TABLE_ENTRY *pEntry); - -BOOLEAN RTMPCheckAUTH( - IN PRTMP_ADAPTER pAd, - IN PEID_STRUCT eid_ptr, - IN MAC_TABLE_ENTRY *pEntry); - -VOID WPAStart4WayHS( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN ULONG TimeInterval); - -VOID WPAStart2WayGroupHS( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); - -VOID APWpaEAPPacketAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APWpaEAPOLStartAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APWpaEAPOLLogoffAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APWpaEAPOLKeyAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APWpaEAPOLASFAlertAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - VOID HandleCounterMeasure( IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY *pEntry); -VOID PeerPairMsg2Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerPairMsg4Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID CMTimerExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID WPARetryExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID EnqueueStartForPSKExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID RTMPHandleSTAKey( - IN PRTMP_ADAPTER pAdapter, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerGroupMsg2Action( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN VOID *Msg, - IN UINT MsgLen); - -VOID PairDisAssocAction( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN USHORT Reason); - -VOID MlmeDeAuthAction( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN USHORT Reason); - -VOID GREKEYPeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID CountGTK( - IN UCHAR *PMK, - IN UCHAR *GNonce, - IN UCHAR *AA, - OUT UCHAR *output, - IN UINT len); - -VOID GetSmall( - IN PVOID pSrc1, - IN PVOID pSrc2, - OUT PUCHAR out, - IN ULONG Length); - -VOID GetLarge( - IN PVOID pSrc1, - IN PVOID pSrc2, - OUT PUCHAR out, - IN ULONG Length); - -VOID APGenRandom( - IN PRTMP_ADAPTER pAd, - OUT UCHAR *random); - -VOID AES_GTK_KEY_WRAP( - IN UCHAR *key, - IN UCHAR *plaintext, - IN UCHAR p_len, - OUT UCHAR *ciphertext); - -VOID WpaSend( - IN PRTMP_ADAPTER pAdapter, - IN PUCHAR pPacket, - IN ULONG Len); - -VOID APToWirelessSta( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN UINT DataLen, - IN BOOLEAN bClearFrame); - -VOID RTMPAddPMKIDCache( - IN PRTMP_ADAPTER pAd, - IN INT apidx, - IN PUCHAR pAddr, - IN UCHAR *PMKID, - IN UCHAR *PMK); - -INT RTMPSearchPMKIDCache( - IN PRTMP_ADAPTER pAd, - IN INT apidx, - IN PUCHAR pAddr); - -VOID RTMPDeletePMKIDCache( - IN PRTMP_ADAPTER pAd, - IN INT apidx, - IN INT idx); - -VOID RTMPMaintainPMKIDCache( - IN PRTMP_ADAPTER pAd); - -VOID RTMPSendTriggerFrame( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuffer, - IN ULONG Length, - IN UCHAR TxRate, - IN BOOLEAN bQosNull); - -#ifdef RT30xx -VOID RTMPFilterCalibration( - IN PRTMP_ADAPTER pAd); -#endif // RT30xx // - /* timeout -- ms */ VOID RTMP_SetPeriodicTimer( IN NDIS_MINIPORT_TIMER *pTimer, @@ -5728,23 +5217,6 @@ UINT BA_Reorder_AMSDU_Annnounce( IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); - -UINT Handle_AMSDU_Packet( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataSize, - IN UCHAR FromWhichBSSID); - - -void convert_802_11_to_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR p8023hdr, - IN PUCHAR pData, - IN ULONG DataSize, - IN UCHAR FromWhichBSSID); - - PNET_DEV get_netdev_from_bssid( IN PRTMP_ADAPTER pAd, IN UCHAR FromWhichBSSID); @@ -5763,27 +5235,6 @@ PNDIS_PACKET duplicate_pkt_with_TKIP_MIC( IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pOldPkt); -PNDIS_PACKET duplicate_pkt_with_VLAN( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, - IN UCHAR FromWhichBSSID); - -PNDIS_PACKET duplicate_pkt_with_WPI( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UINT32 ext_head_len, - IN UINT32 ext_tail_len); - -UCHAR VLAN_8023_Header_Copy( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - OUT PUCHAR pData, - IN UCHAR FromWhichBSSID); - void ba_flush_reordering_timeout_mpdus( IN PRTMP_ADAPTER pAd, IN PBA_REC_ENTRY pBAEntry, @@ -5828,29 +5279,6 @@ VOID BARecSessionTearDown( BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num); void ba_reordering_resource_release(PRTMP_ADAPTER pAd); -ULONG AutoChBssInsertEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR ChannelNo, - IN CHAR Rssi); - -void AutoChBssTableInit( - IN PRTMP_ADAPTER pAd); - -void ChannelInfoInit( - IN PRTMP_ADAPTER pAd); - -void AutoChBssTableDestroy( - IN PRTMP_ADAPTER pAd); - -void ChannelInfoDestroy( - IN PRTMP_ADAPTER pAd); - -UCHAR New_ApAutoSelectChannel( - IN PRTMP_ADAPTER pAd); - BOOLEAN rtstrmactohex( IN char *s1, IN char *s2); @@ -6049,16 +5477,6 @@ INT Set_HtTxBASize_Proc( IN PRTMP_ADAPTER pAd, IN PUCHAR arg); -//Dls , kathy -VOID RTMPSendDLSTearDownFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA); - -//Block ACK -VOID QueryBATABLE( - IN PRTMP_ADAPTER pAd, - OUT PQUERYBA_TABLE pBAT); - INT WpaCheckEapCode( IN PRTMP_ADAPTER pAd, IN PUCHAR pFrame, @@ -6069,22 +5487,9 @@ VOID WpaSendMicFailureToWpaSupplicant( IN PRTMP_ADAPTER pAd, IN BOOLEAN bUnicast); -VOID SendAssocIEsToWpaSupplicant( - IN PRTMP_ADAPTER pAd); - int wext_notify_event_assoc( IN RTMP_ADAPTER *pAd); -VOID Handle_BSS_Width_Trigger_Events( - IN PRTMP_ADAPTER pAd); - -void build_ext_channel_switch_ie( - IN PRTMP_ADAPTER pAd, - IN HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE *pIE); - -BOOLEAN APRxDoneInterruptHandle( - IN PRTMP_ADAPTER pAd); - BOOLEAN STARxDoneInterruptHandle( IN PRTMP_ADAPTER pAd, IN BOOLEAN argc); @@ -6160,16 +5565,6 @@ UINT deaggregate_AMSDU_announce( _pRxBlk->DataSize, _pRemovedLLCSNAP); \ } -BOOLEAN APFowardWirelessStaToWirelessSta( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN ULONG FromWhichBSSID); - -VOID Announce_or_Forward_802_3_Packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID); - VOID Sta_Announce_or_Forward_802_3_Packet( IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, @@ -6209,12 +5604,6 @@ VOID Update_Rssi_Sample( IN RSSI_SAMPLE *pRssi, IN PRXWI_STRUC pRxWI); -PNDIS_PACKET GetPacketFromRxRing( - IN PRTMP_ADAPTER pAd, - OUT PRT28XX_RXD_STRUC pSaveRxD, - OUT BOOLEAN *pbReschedule, - IN OUT UINT32 *pRxPending); - PNDIS_PACKET RTMPDeFragmentDataFrame( IN PRTMP_ADAPTER pAd, IN RX_BLK *pRxBlk); @@ -6323,11 +5712,9 @@ void send_monitor_packets( IN PRTMP_ADAPTER pAd, IN RX_BLK *pRxBlk); -#if WIRELESS_EXT >= 12 // This function will be called when query /proc struct iw_statistics *rt28xx_get_wireless_stats( IN struct net_device *net_dev); -#endif VOID RTMPSetDesiredRates( IN PRTMP_ADAPTER pAdapter, @@ -6404,22 +5791,11 @@ VOID RT28xx_UpdateBeaconToAsic( IN ULONG BeaconLen, IN ULONG UpdatePos); -INT rt28xx_ioctl( - IN struct net_device *net_dev, - IN OUT struct ifreq *rq, - IN INT cmd); - INT rt28xx_sta_ioctl( IN struct net_device *net_dev, IN OUT struct ifreq *rq, IN INT cmd); -BOOLEAN RT28XXSecurityKeyAdd( - IN PRTMP_ADAPTER pAd, - IN ULONG apidx, - IN ULONG KeyIdx, - IN MAC_TABLE_ENTRY *pEntry); - //////////////////////////////////////// PNDIS_PACKET GetPacketFromRxRing( IN PRTMP_ADAPTER pAd, @@ -6555,7 +5931,6 @@ VOID AsicTurnOnRFClk( IN PRTMP_ADAPTER pAd, IN UCHAR Channel); -#ifdef RT30xx NTSTATUS RT30xxWriteRFRegister( IN PRTMP_ADAPTER pAd, IN UCHAR RegID, @@ -6566,7 +5941,6 @@ NTSTATUS RT30xxReadRFRegister( IN UCHAR RegID, IN PUCHAR pValue); -//2008/09/11:KH add to support efuse<-- UCHAR eFuseReadRegisters( IN PRTMP_ADAPTER pAd, IN USHORT Offset, @@ -6637,16 +6011,6 @@ VOID eFusePhysicalReadRegisters( IN USHORT Length, OUT USHORT* pData); -NDIS_STATUS NICLoadEEPROM( - IN PRTMP_ADAPTER pAd); - -BOOLEAN bNeedLoadEEPROM( - IN PRTMP_ADAPTER pAd); -//2008/09/11:KH add to support efuse--> -#endif // RT30xx // - -#ifdef RT30xx -// add by johnli, RF power sequence setup VOID RT30xxLoadRFNormalModeSetup( IN PRTMP_ADAPTER pAd); @@ -6655,8 +6019,6 @@ VOID RT30xxLoadRFSleepModeSetup( VOID RT30xxReverseRFSleepModeSetup( IN PRTMP_ADAPTER pAd); -// end johnli -#endif // RT30xx // #ifdef RT2870 // @@ -6675,10 +6037,6 @@ VOID RTUSBInitHTTxDesc( IN ULONG BulkOutSize, IN usb_complete_t Func); -VOID RTUSBInitRxDesc( - IN PRTMP_ADAPTER pAd, - IN PRX_CONTEXT pRxContext); - VOID RTUSBCleanUpDataBulkOutQueue( IN PRTMP_ADAPTER pAd); @@ -6725,9 +6083,6 @@ VOID RTUSBInitRxDesc( IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); -VOID RTUSBBulkRxHandle( - IN unsigned long data); - // // Function Prototype in rtusb_io.c // @@ -6762,18 +6117,6 @@ NTSTATUS RTUSBWriteRFRegister( IN PRTMP_ADAPTER pAd, IN UINT32 Value); -#ifndef RT30xx -NTSTATUS RT30xxWriteRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR RegID, - IN UCHAR Value); - -NTSTATUS RT30xxReadRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR RegID, - IN PUCHAR pValue); -#endif - NTSTATUS RTUSB_VendorRequest( IN PRTMP_ADAPTER pAd, IN UINT32 TransferFlags, @@ -6887,14 +6230,6 @@ NTSTATUS RTUSBFirmwareOpmode( NTSTATUS RTUSBVenderReset( IN PRTMP_ADAPTER pAd); -NDIS_STATUS RTUSBSetHardWareRegister( - IN PRTMP_ADAPTER pAdapter, - IN PVOID pBuf); - -NDIS_STATUS RTUSBQueryHardWareRegister( - IN PRTMP_ADAPTER pAdapter, - IN PVOID pBuf); - VOID CMDHandler( IN PRTMP_ADAPTER pAd); @@ -6917,31 +6252,12 @@ NDIS_STATUS RTMPWPAAddKeyProc( VOID AsicRxAntEvalAction( IN PRTMP_ADAPTER pAd); -void append_pkt( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, - OUT PNDIS_PACKET *ppPacket); - -UINT deaggregate_AMSDU_announce( - IN PRTMP_ADAPTER pAd, - PNDIS_PACKET pPacket, - IN PUCHAR pData, - IN ULONG DataSize); - NDIS_STATUS RTMPCheckRxError( IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHeader, IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxINFO); - -VOID RTUSBMlmeHardTransmit( - IN PRTMP_ADAPTER pAd, - IN PMGMT_STRUC pMgmt); - INT MlmeThread( IN PVOID Context); @@ -7043,19 +6359,6 @@ VOID RT28xxUsbMlmeRadioOFF( IN PRTMP_ADAPTER pAd); #endif // RT2870 // -//////////////////////////////////////// - -VOID QBSS_LoadInit( - IN RTMP_ADAPTER *pAd); - -UINT32 QBSS_LoadElementAppend( - IN RTMP_ADAPTER *pAd, - OUT UINT8 *buf_p); - -VOID QBSS_LoadUpdate( - IN RTMP_ADAPTER *pAd); - -/////////////////////////////////////// INT RTMPShowCfgValue( IN PRTMP_ADAPTER pAd, IN PUCHAR pName, @@ -7066,7 +6369,6 @@ PCHAR RTMPGetRalinkAuthModeStr( PCHAR RTMPGetRalinkEncryModeStr( IN USHORT encryMode); -////////////////////////////////////// VOID AsicStaBbpTuning( IN PRTMP_ADAPTER pAd); @@ -7109,9 +6411,6 @@ int rt28xx_open(IN PNET_DEV dev); __inline INT VIRTUAL_IF_UP(PRTMP_ADAPTER pAd) { -extern VOID MeshMakeBeacon(IN PRTMP_ADAPTER pAd, IN UCHAR idx); -extern VOID MeshUpdateBeaconFrame(IN PRTMP_ADAPTER pAd, IN UCHAR idx); - if (VIRTUAL_IF_NUM(pAd) == 0) { if (rt28xx_open(pAd->net_dev) != 0) diff --git a/drivers/staging/rt2860/rtmp_ckipmic.h b/drivers/staging/rt2860/rtmp_ckipmic.h index a3d949a39d3..39955b914de 100644 --- a/drivers/staging/rt2860/rtmp_ckipmic.h +++ b/drivers/staging/rt2860/rtmp_ckipmic.h @@ -46,24 +46,6 @@ typedef struct _MIC_CONTEXT { UCHAR part[4]; /* for conversion of message to u32 for mmh */ } MIC_CONTEXT, *PMIC_CONTEXT; -VOID CKIP_key_permute( - OUT UCHAR *PK, /* output permuted key */ - IN UCHAR *CK, /* input CKIP key */ - IN UCHAR toDsFromDs, /* input toDs/FromDs bits */ - IN UCHAR *piv); /* input pointer to IV */ - -VOID RTMPCkipMicInit( - IN PMIC_CONTEXT pContext, - IN PUCHAR CK); - -VOID RTMPMicUpdate( - IN PMIC_CONTEXT pContext, - IN PUCHAR pOctets, - IN INT len); - -ULONG RTMPMicGetCoefficient( - IN PMIC_CONTEXT pContext); - VOID xor_128( IN PUCHAR a, IN PUCHAR b, @@ -93,21 +75,4 @@ VOID mix_column( IN PUCHAR in, OUT PUCHAR out); -VOID RTMPAesEncrypt( - IN PUCHAR key, - IN PUCHAR data, - IN PUCHAR ciphertext); - -VOID RTMPMicFinal( - IN PMIC_CONTEXT pContext, - OUT UCHAR digest[4]); - -VOID RTMPCkipInsertCMIC( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pMIC, - IN PUCHAR p80211hdr, - IN PNDIS_PACKET pPacket, - IN PCIPHER_KEY pKey, - IN PUCHAR mic_snap); - #endif //__RTMP_CKIPMIC_H__ diff --git a/drivers/staging/rt2860/rtmp_def.h b/drivers/staging/rt2860/rtmp_def.h index 5dde860cbbd..f5fee57fbe3 100644 --- a/drivers/staging/rt2860/rtmp_def.h +++ b/drivers/staging/rt2860/rtmp_def.h @@ -148,11 +148,7 @@ #define MAX_PACKETS_IN_PS_QUEUE 128 //32 #define WMM_NUM_OF_AC 4 /* AC0, AC1, AC2, and AC3 */ -#ifdef RT30xx -//2008/09/11:KH add to support efuse<-- #define MAX_EEPROM_BIN_FILE_SIZE 1024 -//2008/09/11:KH add to support efuse--> -#endif // RxFilter #define STANORMAL 0x17f97 @@ -573,9 +569,6 @@ // For 802.11n D3.03 //#define IE_NEW_EXT_CHA_OFFSET 62 // 802.11n d1. New extension channel offset elemet #define IE_SECONDARY_CH_OFFSET 62 // 802.11n D3.03 Secondary Channel Offset element -#ifdef RT2870 -#define IE_WAPI 68 // WAPI information element -#endif #define IE_2040_BSS_COEXIST 72 // 802.11n D3.0.3 #define IE_2040_BSS_INTOLERANT_REPORT 73 // 802.11n D3.03 #define IE_OVERLAPBSS_SCAN_PARM 74 // 802.11n D3.03 @@ -624,11 +617,6 @@ #define AP_CNTL_STATE_MACHINE 15 #define AP_WPA_STATE_MACHINE 16 -#ifdef RT30xx -#define WSC_STATE_MACHINE 17 -#define WSC_UPNP_STATE_MACHINE 18 -#endif - // // STA's CONTROL/CONNECT state machine: states, events, total function # // @@ -1215,10 +1203,8 @@ #define RFIC_2750 4 // 2.4G/5G 1T2R #define RFIC_3020 5 // 2.4G 1T1R #define RFIC_2020 6 // 2.4G B/G -#ifdef RT30xx #define RFIC_3021 7 // 2.4G 1T2R #define RFIC_3022 8 // 2.4G 2T2R -#endif // LED Status. #define LED_LINK_DOWN 0 diff --git a/drivers/staging/rt2860/sta/assoc.c b/drivers/staging/rt2860/sta/assoc.c index a0734c65bc2..1a587153c75 100644 --- a/drivers/staging/rt2860/sta/assoc.c +++ b/drivers/staging/rt2860/sta/assoc.c @@ -454,11 +454,7 @@ VOID MlmeAssocReqAction( RSNIe = IE_WPA2; } -#ifdef RT30xx -#ifdef SIOCSIWGENIE if (pAd->StaCfg.WpaSupplicantUP != 1) -#endif // SIOCSIWGENIE // -#endif RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, BSS0); // Check for WPA PMK cache list @@ -485,8 +481,6 @@ VOID MlmeAssocReqAction( } } -#ifdef RT30xx -#ifdef SIOCSIWGENIE if (pAd->StaCfg.WpaSupplicantUP == 1) { MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, @@ -494,8 +488,6 @@ VOID MlmeAssocReqAction( END_OF_ARGS); } else -#endif -#endif { MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, 1, &RSNIe, @@ -506,11 +498,7 @@ VOID MlmeAssocReqAction( FrameLen += tmp; -#ifdef RT30xx -#ifdef SIOCSIWGENIE if (pAd->StaCfg.WpaSupplicantUP != 1) -#endif -#endif { // Append Variable IE NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &RSNIe, 1); @@ -1503,7 +1491,6 @@ int wext_notify_event_assoc( union iwreq_data wrqu; char custom[IW_CUSTOM_MAX] = {0}; -#if WIRELESS_EXT > 17 if (pAd->StaCfg.ReqVarIELen <= IW_CUSTOM_MAX) { wrqu.data.length = pAd->StaCfg.ReqVarIELen; @@ -1512,19 +1499,6 @@ int wext_notify_event_assoc( } else DBGPRINT(RT_DEBUG_TRACE, ("pAd->StaCfg.ReqVarIELen > MAX_CUSTOM_LEN\n")); -#else - if (((pAd->StaCfg.ReqVarIELen*2) + 17) <= IW_CUSTOM_MAX) - { - UCHAR idx; - wrqu.data.length = (pAd->StaCfg.ReqVarIELen*2) + 17; - sprintf(custom, "ASSOCINFO(ReqIEs="); - for (idx=0; idx<pAd->StaCfg.ReqVarIELen; idx++) - sprintf(custom + strlen(custom), "%02x", pAd->StaCfg.ReqVarIEs[idx]); - wireless_send_event(pAd->net_dev, IWEVCUSTOM, &wrqu, custom); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("(pAd->StaCfg.ReqVarIELen*2) + 17 > MAX_CUSTOM_LEN\n")); -#endif return 0; diff --git a/drivers/staging/rt2860/sta/connect.c b/drivers/staging/rt2860/sta/connect.c index ac713518666..7bc75ab971f 100644 --- a/drivers/staging/rt2860/sta/connect.c +++ b/drivers/staging/rt2860/sta/connect.c @@ -1171,7 +1171,6 @@ VOID LinkUp( OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADHOC_ON); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); -#ifdef RT30xx if ((pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth == BW_40) && (pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset == EXTCHA_ABOVE)) { @@ -1183,7 +1182,6 @@ VOID LinkUp( { pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 2; } -#endif #ifdef RT2870 if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) AdhocTurnOnQos(pAd); @@ -1585,9 +1583,7 @@ VOID LinkUp( pAd->MacTab.Size = 1; // infra mode always set MACtab size =1. pAd->MacTab.Content[BSSID_WCID].Sst = SST_ASSOC; pAd->MacTab.Content[BSSID_WCID].AuthState = SST_ASSOC; -#ifdef RT30xx pAd->MacTab.Content[BSSID_WCID].AuthMode = pAd->StaCfg.AuthMode; -#endif pAd->MacTab.Content[BSSID_WCID].WepStatus = pAd->StaCfg.WepStatus; NdisReleaseSpinLock(&pAd->MacTabLock); @@ -1711,15 +1707,10 @@ VOID LinkUp( // Txop can only be modified when RDG is off, WMM is disable and TxBurst is enable // // if 1. Legacy AP WMM on, or 2. 11n AP, AMPDU disable. Force turn off burst no matter what bEnableTxBurst is. -#ifdef RT30xx - if (!((pAd->CommonCfg.RxStream == 1)&&(pAd->CommonCfg.TxStream == 1)) && + if ( + !(pAd->CommonCfg.RxStream == 1 && pAd->CommonCfg.TxStream == 1) && (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED)) || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)))) -#endif -#ifndef RT30xx - if (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED))) - || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE))) -#endif { RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); Data &= 0xFFFFFF00; @@ -2101,7 +2092,6 @@ VOID LinkDown( wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); } -#ifdef RT30xx if (IS_RT3090(pAd)) { UINT32 macdata; @@ -2115,7 +2105,6 @@ VOID LinkDown( macdata &= ~(0x09); //bit 0, 3 RTMP_IO_WRITE32(pAd, 0x1210, macdata); } -#endif // RT30xx // } /* diff --git a/drivers/staging/rt2860/sta/rtmp_data.c b/drivers/staging/rt2860/sta/rtmp_data.c index b41ce230c50..f751ab61c43 100644 --- a/drivers/staging/rt2860/sta/rtmp_data.c +++ b/drivers/staging/rt2860/sta/rtmp_data.c @@ -575,21 +575,16 @@ VOID STAHandleRxMgmtFrame( { // We should collect RSSI not only U2M data but also my beacon -#ifdef RT30xx - if ((pHeader->FC.SubType == SUBTYPE_BEACON) && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)) - && (pAd->RxAnt.EvaluatePeriod == 0)) -#endif -#ifndef RT30xx - if ((pHeader->FC.SubType == SUBTYPE_BEACON) && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2))) -#endif - { + if (pAd->RxAnt.EvaluatePeriod == 0 && + pHeader->FC.SubType == SUBTYPE_BEACON && + MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)) { Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI); pAd->StaCfg.LastSNR0 = (UCHAR)(pRxWI->SNR0); pAd->StaCfg.LastSNR1 = (UCHAR)(pRxWI->SNR1); } -#ifdef RT30xx +#ifdef RT2870 // collect rssi information for antenna diversity if (pAd->NicConfig2.field.AntDiversity) { @@ -599,7 +594,7 @@ VOID STAHandleRxMgmtFrame( pAd->StaCfg.NumOfAvgRssiSample ++; } } -#endif // RT30xx // +#endif // First check the size, it MUST not exceed the mlme queue size if (pRxWI->MPDUtotalByteCount > MGMT_DMA_BUFFER_SIZE) diff --git a/drivers/staging/rt2860/sta/sync.c b/drivers/staging/rt2860/sta/sync.c index 87b5e49cec5..a6e4362fc5c 100644 --- a/drivers/staging/rt2860/sta/sync.c +++ b/drivers/staging/rt2860/sta/sync.c @@ -1116,10 +1116,8 @@ VOID PeerBeacon( // Add the safeguard against the mismatch of adhoc wep status if (pAd->StaCfg.WepStatus != pAd->ScanTab.BssEntry[Bssidx].WepStatus) { -#ifdef RT30xx DBGPRINT(RT_DEBUG_TRACE, ("SYNC - Not matched wep status %d %d\n", pAd->StaCfg.WepStatus, pAd->ScanTab.BssEntry[Bssidx].WepStatus)); DBGPRINT(RT_DEBUG_TRACE, ("bssid=%s\n", pAd->ScanTab.BssEntry[Bssidx].Bssid)); -#endif return; } diff --git a/drivers/staging/rt2860/sta/wpa.c b/drivers/staging/rt2860/sta/wpa.c index 58274364d78..8c34e39f386 100644 --- a/drivers/staging/rt2860/sta/wpa.c +++ b/drivers/staging/rt2860/sta/wpa.c @@ -1384,12 +1384,10 @@ VOID WpaGroupMsg1Action( pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_TKIP; else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_AES; -#ifndef RT30xx else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled) pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_WEP64; else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_WEP128; -#endif //hex_dump("Group Key :", pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, LEN_TKIP_EK); } @@ -1766,12 +1764,7 @@ BOOLEAN ParseKeyData( // Get GTK length - refer to IEEE 802.11i-2004 p.82 GTKLEN = pKDE->Len -6; -#ifdef RT30xx if (GTKLEN < LEN_AES_KEY) -#endif -#ifndef RT30xx - if (GTKLEN < MIN_LEN_OF_GTK) -#endif { DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key length is too short (%d) \n", GTKLEN)); return FALSE; @@ -1797,12 +1790,10 @@ BOOLEAN ParseKeyData( pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_TKIP; else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_AES; -#ifndef RT30xx else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled) pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_WEP64; else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_WEP128; -#endif return TRUE; diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index eb0109ad2fc..c0e04251e12 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -87,29 +87,8 @@ struct iw_priv_args privtab[] = { 0, 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" }, -#if !defined(RT2860) && !defined(RT30xx) - { SHOW_ADHOC_ENTRY_INFO, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "adhocEntry" }, -#endif /* --- sub-ioctls relations --- */ -#ifdef DBG -{ RTPRIV_IOCTL_BBP, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - "bbp"}, -{ RTPRIV_IOCTL_MAC, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024, - "mac"}, -#ifdef RT30xx -{ RTPRIV_IOCTL_RF, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - "rf"}, -#endif // RT30xx // -{ RTPRIV_IOCTL_E2P, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024, - "e2p"}, -#endif /* DBG */ - { RTPRIV_IOCTL_STATISTICS, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "stat"}, @@ -173,29 +152,6 @@ INT Set_Wpa_Support( IN PRTMP_ADAPTER pAd, IN PUCHAR arg); -#ifdef DBG -#if !defined(RT2860) && !defined(RT30xx) -VOID RTMPIoctlBBP( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); -#endif - -VOID RTMPIoctlMAC( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); - -VOID RTMPIoctlE2PROM( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); - -#ifdef RT30xx -VOID RTMPIoctlRF( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); -#endif // RT30xx // -#endif // DBG // - - NDIS_STATUS RTMPWPANoneAddKeyProc( IN PRTMP_ADAPTER pAd, IN PVOID pBuf); @@ -216,12 +172,6 @@ INT Set_ShortRetryLimit_Proc( IN PRTMP_ADAPTER pAdapter, IN PUCHAR arg); -#if !defined(RT2860) && !defined(RT30xx) -INT Show_Adhoc_MacTable_Proc( - IN PRTMP_ADAPTER pAd, - IN PCHAR extra); -#endif - static struct { CHAR *name; INT (*set_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg); @@ -279,13 +229,11 @@ static struct { {"ForceGF", Set_ForceGF_Proc}, {"LongRetry", Set_LongRetryLimit_Proc}, {"ShortRetry", Set_ShortRetryLimit_Proc}, -//2008/09/11:KH add to support efuse<-- -#ifdef RT30xx +#ifdef RT2870 {"efuseFreeNumber", set_eFuseGetFreeBlockCount_Proc}, {"efuseDump", set_eFusedump_Proc}, {"efuseLoadFromBin", set_eFuseLoadFromBin_Proc}, -#endif // RT30xx // -//2008/09/11:KH add to support efuse--> +#endif {NULL,} }; @@ -531,12 +479,7 @@ rt_ioctl_giwname(struct net_device *dev, char *name, char *extra) { // PRTMP_ADAPTER pAdapter = dev->ml_priv; -#ifdef RT2860 - strncpy(name, "RT2860 Wireless", IFNAMSIZ); -#endif -#ifdef RT2870 - strncpy(name, "RT2870 Wireless", IFNAMSIZ); -#endif // RT2870 // + strncpy(name, RT28xx_CHIP_NAME " Wireless", IFNAMSIZ); return 0; } @@ -577,38 +520,10 @@ int rt_ioctl_giwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *freq, char *extra) { - VIRTUAL_ADAPTER *pVirtualAd = NULL; -#ifndef RT30xx - PRTMP_ADAPTER pAdapter = NULL; -#endif -#ifdef RT30xx - PRTMP_ADAPTER pAdapter; -#endif - UCHAR ch; + PRTMP_ADAPTER pAdapter = dev->ml_priv; + UCHAR ch = pAdapter->CommonCfg.Channel; ULONG m; - if (dev->priv_flags == INT_MAIN) - { - pAdapter = dev->ml_priv; - } - else - { - pVirtualAd = dev->ml_priv; -#ifndef RT30xx - if (pVirtualAd && pVirtualAd->RtmpDev) -#endif - pAdapter = pVirtualAd->RtmpDev->ml_priv; - } - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - ch = pAdapter->CommonCfg.Channel; - DBGPRINT(RT_DEBUG_TRACE,("==>rt_ioctl_giwfreq %d\n", ch)); MAP_CHANNEL_ID_TO_KHZ(ch, m); @@ -656,31 +571,7 @@ int rt_ioctl_giwmode(struct net_device *dev, struct iw_request_info *info, __u32 *mode, char *extra) { -#ifndef RT30xx - PRTMP_ADAPTER pAdapter = NULL; - VIRTUAL_ADAPTER *pVirtualAd = NULL; - - if (dev->priv_flags == INT_MAIN) - { - pAdapter = dev->ml_priv; - } - else - { - pVirtualAd = dev->ml_priv; - if (pVirtualAd && pVirtualAd->RtmpDev) - pAdapter = pVirtualAd->RtmpDev->ml_priv; - } - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } -#endif -#ifdef RT30xx PRTMP_ADAPTER pAdapter = dev->ml_priv; -#endif if (ADHOC_ON(pAdapter)) *mode = IW_MODE_ADHOC; @@ -724,37 +615,11 @@ int rt_ioctl_giwrange(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) { -#ifndef RT30xx - PRTMP_ADAPTER pAdapter = NULL; - VIRTUAL_ADAPTER *pVirtualAd = NULL; -#endif -#ifdef RT30xx PRTMP_ADAPTER pAdapter = dev->ml_priv; -#endif struct iw_range *range = (struct iw_range *) extra; u16 val; int i; -#ifndef RT30xx - if (dev->priv_flags == INT_MAIN) - { - pAdapter = dev->ml_priv; - } - else - { - pVirtualAd = dev->ml_priv; - if (pVirtualAd && pVirtualAd->RtmpDev) - pAdapter = pVirtualAd->RtmpDev->ml_priv; - } - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } -#endif - DBGPRINT(RT_DEBUG_TRACE ,("===>rt_ioctl_giwrange\n")); data->length = sizeof(struct iw_range); memset(range, 0, sizeof(struct iw_range)); @@ -820,11 +685,9 @@ int rt_ioctl_giwrange(struct net_device *dev, range->min_frag = 256; range->max_frag = 2346; -#if WIRELESS_EXT > 17 /* IW_ENC_CAPA_* bit field */ range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; -#endif return 0; } @@ -873,31 +736,7 @@ int rt_ioctl_giwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *ap_addr, char *extra) { -#ifndef RT30xx - PRTMP_ADAPTER pAdapter = NULL; - VIRTUAL_ADAPTER *pVirtualAd = NULL; - - if (dev->priv_flags == INT_MAIN) - { - pAdapter = dev->ml_priv; - } - else - { - pVirtualAd = dev->ml_priv; - if (pVirtualAd && pVirtualAd->RtmpDev) - pAdapter = pVirtualAd->RtmpDev->ml_priv; - } - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } -#endif -#ifdef RT30xx PRTMP_ADAPTER pAdapter = dev->ml_priv; -#endif if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) { @@ -994,7 +833,6 @@ int rt_ioctl_iwaplist(struct net_device *dev, return 0; } -#ifdef SIOCGIWSCAN int rt_ioctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) @@ -1091,9 +929,6 @@ int rt_ioctl_giwscan(struct net_device *dev, char *current_ev = extra, *previous_ev = extra; char *end_buf; char *current_val, custom[MAX_CUSTOM_LEN] = {0}; -#ifndef IWEVGENIE - char idx; -#endif // IWEVGENIE // struct iw_event iwe; if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) @@ -1115,25 +950,15 @@ int rt_ioctl_giwscan(struct net_device *dev, return 0; } -#if WIRELESS_EXT >= 17 if (data->length > 0) end_buf = extra + data->length; else end_buf = extra + IW_SCAN_MAX_DATA; -#else - end_buf = extra + IW_SCAN_MAX_DATA; -#endif for (i = 0; i < pAdapter->ScanTab.BssNr; i++) { if (current_ev >= end_buf) - { -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - } + return -E2BIG; //MAC address //================================ @@ -1144,13 +969,8 @@ int rt_ioctl_giwscan(struct net_device *dev, previous_ev = current_ev; current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); -#ifdef RT30xx if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif + return -E2BIG; /* Protocol: @@ -1224,13 +1044,8 @@ int rt_ioctl_giwscan(struct net_device *dev, previous_ev = current_ev; current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); -#endif /* RT30xx */ if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif + return -E2BIG; //ESSID //================================ @@ -1242,11 +1057,7 @@ int rt_ioctl_giwscan(struct net_device *dev, previous_ev = current_ev; current_ev = iwe_stream_add_point(info, current_ev,end_buf, &iwe, pAdapter->ScanTab.BssEntry[i].Ssid); if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif + return -E2BIG; //Network Type //================================ @@ -1269,11 +1080,7 @@ int rt_ioctl_giwscan(struct net_device *dev, previous_ev = current_ev; current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN); if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif + return -E2BIG; //Channel and Frequency //================================ @@ -1289,11 +1096,7 @@ int rt_ioctl_giwscan(struct net_device *dev, previous_ev = current_ev; current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif + return -E2BIG; //Add quality statistics //================================ @@ -1304,11 +1107,7 @@ int rt_ioctl_giwscan(struct net_device *dev, set_quality(pAdapter, &iwe.u.qual, pAdapter->ScanTab.BssEntry[i].Rssi); current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif + return -E2BIG; //Encyption key //================================ @@ -1322,11 +1121,7 @@ int rt_ioctl_giwscan(struct net_device *dev, previous_ev = current_ev; current_ev = iwe_stream_add_point(info, current_ev, end_buf,&iwe, (char *)pAdapter->SharedKey[BSS0][(iwe.u.data.flags & IW_ENCODE_INDEX)-1].Key); if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif + return -E2BIG; //Bit Rate //================================ @@ -1355,14 +1150,9 @@ int rt_ioctl_giwscan(struct net_device *dev, if((current_val-current_ev)>IW_EV_LCP_LEN) current_ev = current_val; else -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif + return -E2BIG; } -#ifdef IWEVGENIE //WPA IE if (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen > 0) { @@ -1374,11 +1164,7 @@ int rt_ioctl_giwscan(struct net_device *dev, iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].WpaIE.IELen; current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, custom); if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif + return -E2BIG; } //WPA2 IE @@ -1392,54 +1178,8 @@ int rt_ioctl_giwscan(struct net_device *dev, iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].RsnIE.IELen; current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, custom); if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - } -#else - //WPA IE - //================================ - if (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen > 0) - { - NdisZeroMemory(&iwe, sizeof(iwe)); - memset(&custom[0], 0, MAX_CUSTOM_LEN); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen * 2) + 7; - NdisMoveMemory(custom, "wpa_ie=", 7); - for (idx = 0; idx < pAdapter->ScanTab.BssEntry[i].WpaIE.IELen; idx++) - sprintf(custom + strlen(custom), "%02x", pAdapter->ScanTab.BssEntry[i].WpaIE.IE[idx]); - previous_ev = current_ev; - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, custom); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - } - - //WPA2 IE - if (pAdapter->ScanTab.BssEntry[i].RsnIE.IELen > 0) - { - NdisZeroMemory(&iwe, sizeof(iwe)); - memset(&custom[0], 0, MAX_CUSTOM_LEN); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = (pAdapter->ScanTab.BssEntry[i].RsnIE.IELen * 2) + 7; - NdisMoveMemory(custom, "rsn_ie=", 7); - for (idx = 0; idx < pAdapter->ScanTab.BssEntry[i].RsnIE.IELen; idx++) - sprintf(custom + strlen(custom), "%02x", pAdapter->ScanTab.BssEntry[i].RsnIE.IE[idx]); - previous_ev = current_ev; - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, custom); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif + return -E2BIG; } -#endif // IWEVGENIE // } data->length = current_ev - extra; @@ -1447,7 +1187,6 @@ int rt_ioctl_giwscan(struct net_device *dev, DBGPRINT(RT_DEBUG_ERROR ,("===>rt_ioctl_giwscan. %d(%d) BSS returned, data->length = %d\n",i , pAdapter->ScanTab.BssNr, data->length)); return 0; } -#endif int rt_ioctl_siwessid(struct net_device *dev, struct iw_request_info *info, @@ -1494,31 +1233,7 @@ int rt_ioctl_giwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *essid) { -#ifndef RT30xx - PRTMP_ADAPTER pAdapter = NULL; - VIRTUAL_ADAPTER *pVirtualAd = NULL; - - if (dev->priv_flags == INT_MAIN) - { - pAdapter = dev->ml_priv; - } - else - { - pVirtualAd = dev->ml_priv; - if (pVirtualAd && pVirtualAd->RtmpDev) - pAdapter = pVirtualAd->RtmpDev->ml_priv; - } - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } -#endif -#ifdef RT30xx PRTMP_ADAPTER pAdapter = dev->ml_priv; -#endif data->flags = 1; if (MONITOR_ON(pAdapter)) @@ -1578,31 +1293,7 @@ int rt_ioctl_giwnickn(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *nickname) { -#ifndef RT30xx - PRTMP_ADAPTER pAdapter = NULL; - VIRTUAL_ADAPTER *pVirtualAd = NULL; - - if (dev->priv_flags == INT_MAIN) - { - pAdapter = dev->ml_priv; - } - else - { - pVirtualAd = dev->ml_priv; - if (pVirtualAd && pVirtualAd->RtmpDev) - pAdapter = pVirtualAd->RtmpDev->ml_priv; - } - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } -#endif -#ifdef RT30xx PRTMP_ADAPTER pAdapter = dev->ml_priv; -#endif if (data->length > strlen(pAdapter->nickname) + 1) data->length = strlen(pAdapter->nickname) + 1; @@ -1646,31 +1337,7 @@ int rt_ioctl_giwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *rts, char *extra) { -#ifndef RT30xx - PRTMP_ADAPTER pAdapter = NULL; - VIRTUAL_ADAPTER *pVirtualAd = NULL; - - if (dev->priv_flags == INT_MAIN) - { - pAdapter = dev->ml_priv; - } - else - { - pVirtualAd = dev->ml_priv; - if (pVirtualAd && pVirtualAd->RtmpDev) - pAdapter = pVirtualAd->RtmpDev->ml_priv; - } - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } -#endif -#ifdef RT30xx PRTMP_ADAPTER pAdapter = dev->ml_priv; -#endif //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1702,8 +1369,8 @@ int rt_ioctl_siwfrag(struct net_device *dev, if (frag->disabled) val = MAX_FRAG_THRESHOLD; - else if (frag->value >= MIN_FRAG_THRESHOLD || frag->value <= MAX_FRAG_THRESHOLD) - val = __cpu_to_le16(frag->value & ~0x1); /* even numbers only */ + else if (frag->value >= MIN_FRAG_THRESHOLD && frag->value <= MAX_FRAG_THRESHOLD) + val = __cpu_to_le16(frag->value & ~0x1); /* even numbers only */ else if (frag->value == 0) val = MAX_FRAG_THRESHOLD; else @@ -1717,31 +1384,7 @@ int rt_ioctl_giwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *frag, char *extra) { -#ifndef RT30xx - PRTMP_ADAPTER pAdapter = NULL; - VIRTUAL_ADAPTER *pVirtualAd = NULL; - - if (dev->priv_flags == INT_MAIN) - { - pAdapter = dev->ml_priv; - } - else - { - pVirtualAd = dev->ml_priv; - if (pVirtualAd && pVirtualAd->RtmpDev) - pAdapter = pVirtualAd->RtmpDev->ml_priv; - } - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } -#endif -#ifdef RT30xx PRTMP_ADAPTER pAdapter = dev->ml_priv; -#endif //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1781,15 +1424,8 @@ int rt_ioctl_siwencode(struct net_device *dev, pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; goto done; - } -#ifndef RT30xx - else if ((erq->length == 0) && - (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN)) -#endif -#ifdef RT30xx - else if (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN) -#endif - { + } else if ( + (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN)) { STA_PORT_SECURED(pAdapter); pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; @@ -1799,9 +1435,6 @@ int rt_ioctl_siwencode(struct net_device *dev, pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; else pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; -#ifndef RT30xx - goto done; -#endif } if (erq->length > 0) @@ -1820,12 +1453,8 @@ int rt_ioctl_siwencode(struct net_device *dev, //Using default key keyIdx = pAdapter->StaCfg.DefaultKeyId; } -#ifdef RT30xx else - { pAdapter->StaCfg.DefaultKeyId=keyIdx; - } -#endif NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); @@ -1877,32 +1506,8 @@ rt_ioctl_giwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *erq, char *key) { -#ifdef RT30xx PRTMP_ADAPTER pAdapter = dev->ml_priv; -#endif int kid; -#ifndef RT30xx - PRTMP_ADAPTER pAdapter = NULL; - VIRTUAL_ADAPTER *pVirtualAd = NULL; - - if (dev->priv_flags == INT_MAIN) - { - pAdapter = dev->ml_priv; - } - else - { - pVirtualAd = dev->ml_priv; - if (pVirtualAd && pVirtualAd->RtmpDev) - pAdapter = pVirtualAd->RtmpDev->ml_priv; - } - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } -#endif //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1959,31 +1564,12 @@ static int rt_ioctl_setparam(struct net_device *dev, struct iw_request_info *info, void *w, char *extra) { - VIRTUAL_ADAPTER *pVirtualAd = NULL; - PRTMP_ADAPTER pAdapter; - POS_COOKIE pObj; + PRTMP_ADAPTER pAdapter = dev->ml_priv; + POS_COOKIE pObj = (POS_COOKIE)pAdapter->OS_Cookie; char *this_char = extra; char *value; int Status=0; - if (dev->priv_flags == INT_MAIN) - { - pAdapter = dev->ml_priv; - } - else - { - pVirtualAd = dev->ml_priv; - pAdapter = pVirtualAd->RtmpDev->ml_priv; - } - pObj = (POS_COOKIE) pAdapter->OS_Cookie; - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } - { pObj->ioctl_if_type = INT_MAIN; pObj->ioctl_if = MAIN_MBSSID; @@ -2127,27 +1713,10 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { INT Status = 0; - VIRTUAL_ADAPTER *pVirtualAd = NULL; - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; + PRTMP_ADAPTER pAd = dev->ml_priv; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; u32 subcmd = wrq->flags; - if (dev->priv_flags == INT_MAIN) - pAd = dev->ml_priv; - else - { - pVirtualAd = dev->ml_priv; - pAd = pVirtualAd->RtmpDev->ml_priv; - } - pObj = (POS_COOKIE) pAd->OS_Cookie; - - if (pAd == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } - if (extra == NULL) { wrq->length = 0; @@ -2265,12 +1834,6 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info, wrq->length = strlen(extra) + 1; // 1: size of '\0' } break; -#if !defined(RT2860) && !defined(RT30xx) - case SHOW_ADHOC_ENTRY_INFO: - Show_Adhoc_MacTable_Proc(pAd, extra); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; -#endif default: DBGPRINT(RT_DEBUG_TRACE, ("%s - unknow subcmd = %d\n", __func__, subcmd)); break; @@ -2279,7 +1842,6 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info, return Status; } -#ifdef SIOCSIWMLME int rt_ioctl_siwmlme(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, @@ -2335,9 +1897,7 @@ int rt_ioctl_siwmlme(struct net_device *dev, return 0; } -#endif // SIOCSIWMLME // -#if WIRELESS_EXT > 17 int rt_ioctl_siwauth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -2626,7 +2186,6 @@ int rt_ioctl_siwencodeext(struct net_device *dev, NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, ext->key_len); -#ifndef RT30xx if (pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled || pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) { @@ -2641,7 +2200,6 @@ int rt_ioctl_siwencodeext(struct net_device *dev, // Indicate Connected for GUI pAdapter->IndicateMediaState = NdisMediaStateConnected; } -#endif break; case IW_ENCODE_ALG_TKIP: DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_TKIP - keyIdx = %d, ext->key_len = %d\n", __func__, keyIdx, ext->key_len)); @@ -2773,7 +2331,6 @@ rt_ioctl_giwencodeext(struct net_device *dev, return 0; } -#ifdef SIOCSIWGENIE int rt_ioctl_siwgenie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -2797,7 +2354,6 @@ int rt_ioctl_siwgenie(struct net_device *dev, return 0; } -#endif // SIOCSIWGENIE // int rt_ioctl_giwgenie(struct net_device *dev, struct iw_request_info *info, @@ -2812,7 +2368,6 @@ int rt_ioctl_giwgenie(struct net_device *dev, return 0; } -#ifdef SIOCSIWGENIE if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) { if (wrqu->data.length < pAd->StaCfg.RSNIE_Len) @@ -2822,7 +2377,6 @@ int rt_ioctl_giwgenie(struct net_device *dev, memcpy(extra, &pAd->StaCfg.RSN_IE[0], pAd->StaCfg.RSNIE_Len); } else -#endif // SIOCSIWGENIE // { UCHAR RSNIe = IE_WPA; @@ -2916,139 +2470,6 @@ int rt_ioctl_siwpmksa(struct net_device *dev, return 0; } -#endif // #if WIRELESS_EXT > 17 - -#ifdef DBG -static int -rt_private_ioctl_bbp(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, char *extra) - { - CHAR *this_char; - CHAR *value = NULL; - UCHAR regBBP = 0; - UINT32 bbpId; - UINT32 bbpValue; - BOOLEAN bIsPrintAllBBP = FALSE; - INT Status = 0; - PRTMP_ADAPTER pAdapter = dev->ml_priv; - - - memset(extra, 0x00, IW_PRIV_SIZE_MASK); - - if (wrq->length > 1) //No parameters. - { - sprintf(extra, "\n"); - - //Parsing Read or Write - this_char = wrq->pointer; - DBGPRINT(RT_DEBUG_TRACE, ("this_char=%s\n", this_char)); - if (!*this_char) - goto next; - - if ((value = rtstrchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value || !*value) - { //Read - DBGPRINT(RT_DEBUG_TRACE, ("this_char=%s, value=%s\n", this_char, value)); - if (sscanf(this_char, "%d", &(bbpId)) == 1) - { -#ifndef RT30xx - if (bbpId <= 136) -#endif // RT30xx // -#ifdef RT30xx - if (bbpId <= 138) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control -#endif // RT30xx // - { - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - } - sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X\n", bbpId, bbpId*2, regBBP); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - DBGPRINT(RT_DEBUG_TRACE, ("msg=%s\n", extra)); - } - else - {//Invalid parametes, so default printk all bbp - bIsPrintAllBBP = TRUE; - goto next; - } - } - else - { //Invalid parametes, so default printk all bbp - bIsPrintAllBBP = TRUE; - goto next; - } - } - else - { //Write - if ((sscanf(this_char, "%d", &(bbpId)) == 1) && (sscanf(value, "%x", &(bbpValue)) == 1)) - { -#ifndef RT30xx - if (bbpId <= 136) -#endif // RT30xx // -#ifdef RT30xx - if (bbpId <= 138) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control -#endif // RT30xx // - { - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, bbpId, bbpValue); - //Read it back for showing - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - } - sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X\n", bbpId, bbpId*2, regBBP); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - DBGPRINT(RT_DEBUG_TRACE, ("msg=%s\n", extra)); - } - else - {//Invalid parametes, so default printk all bbp - bIsPrintAllBBP = TRUE; - goto next; - } - } - else - { //Invalid parametes, so default printk all bbp - bIsPrintAllBBP = TRUE; - goto next; - } - } - } - else - bIsPrintAllBBP = TRUE; - -next: - if (bIsPrintAllBBP) - { - memset(extra, 0x00, IW_PRIV_SIZE_MASK); - sprintf(extra, "\n"); -#ifndef RT30xx - for (bbpId = 0; bbpId <= 136; bbpId++) -#endif // RT30xx // -#ifdef RT30xx - for (bbpId = 0; bbpId <= 138; bbpId++) // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control -#endif // RT30xx // - { - if (strlen(extra) >= (IW_PRIV_SIZE_MASK - 10)) - break; - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); -#ifndef RT30xx - sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X ", bbpId, bbpId*2, regBBP); - if (bbpId%5 == 4) - sprintf(extra+strlen(extra), "\n"); -#endif -#ifdef RT30xx - sprintf(extra+strlen(extra), "%03d = %02X\n", bbpId, regBBP); // edit by johnli, change display format -#endif - } - - wrq->length = strlen(extra) + 1; // 1: size of '\0' - DBGPRINT(RT_DEBUG_TRACE, ("wrq->length = %d\n", wrq->length)); - } - - DBGPRINT(RT_DEBUG_TRACE, ("<==rt_private_ioctl_bbp\n\n")); - - return Status; -} -#endif // DBG // int rt_ioctl_siwrate(struct net_device *dev, struct iw_request_info *info, @@ -3184,19 +2605,10 @@ static const iw_handler rt_handler[] = (iw_handler) NULL, /* SIOCGIWTHRSPY */ (iw_handler) rt_ioctl_siwap, /* SIOCSIWAP */ (iw_handler) rt_ioctl_giwap, /* SIOCGIWAP */ -#ifdef SIOCSIWMLME (iw_handler) rt_ioctl_siwmlme, /* SIOCSIWMLME */ -#else - (iw_handler) NULL, /* SIOCSIWMLME */ -#endif // SIOCSIWMLME // (iw_handler) rt_ioctl_iwaplist, /* SIOCGIWAPLIST */ -#ifdef SIOCGIWSCAN (iw_handler) rt_ioctl_siwscan, /* SIOCSIWSCAN */ (iw_handler) rt_ioctl_giwscan, /* SIOCGIWSCAN */ -#else - (iw_handler) NULL, /* SIOCSIWSCAN */ - (iw_handler) NULL, /* SIOCGIWSCAN */ -#endif /* SIOCGIWSCAN */ (iw_handler) rt_ioctl_siwessid, /* SIOCSIWESSID */ (iw_handler) rt_ioctl_giwessid, /* SIOCGIWESSID */ (iw_handler) rt_ioctl_siwnickn, /* SIOCSIWNICKN */ @@ -3219,7 +2631,6 @@ static const iw_handler rt_handler[] = (iw_handler) NULL, /* SIOCGIWPOWER */ (iw_handler) NULL, /* -- hole -- */ (iw_handler) NULL, /* -- hole -- */ -#if WIRELESS_EXT > 17 (iw_handler) rt_ioctl_siwgenie, /* SIOCSIWGENIE */ (iw_handler) rt_ioctl_giwgenie, /* SIOCGIWGENIE */ (iw_handler) rt_ioctl_siwauth, /* SIOCSIWAUTH */ @@ -3227,18 +2638,13 @@ static const iw_handler rt_handler[] = (iw_handler) rt_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ (iw_handler) rt_ioctl_giwencodeext, /* SIOCGIWENCODEEXT */ (iw_handler) rt_ioctl_siwpmksa, /* SIOCSIWPMKSA */ -#endif }; static const iw_handler rt_priv_handlers[] = { (iw_handler) NULL, /* + 0x00 */ (iw_handler) NULL, /* + 0x01 */ (iw_handler) rt_ioctl_setparam, /* + 0x02 */ -#ifdef DBG - (iw_handler) rt_private_ioctl_bbp, /* + 0x03 */ -#else (iw_handler) NULL, /* + 0x03 */ -#endif (iw_handler) NULL, /* + 0x04 */ (iw_handler) NULL, /* + 0x05 */ (iw_handler) NULL, /* + 0x06 */ @@ -3274,1888 +2680,16 @@ const struct iw_handler_def rt28xx_iw_handler_def = #endif }; -INT RTMPSetInformation( - IN PRTMP_ADAPTER pAdapter, - IN OUT struct ifreq *rq, - IN INT cmd) -{ - struct iwreq *wrq = (struct iwreq *) rq; - NDIS_802_11_SSID Ssid; - NDIS_802_11_MAC_ADDRESS Bssid; - RT_802_11_PHY_MODE PhyMode; - RT_802_11_STA_CONFIG StaConfig; - NDIS_802_11_RATES aryRates; - RT_802_11_PREAMBLE Preamble; - NDIS_802_11_WEP_STATUS WepStatus; - NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeMax; - NDIS_802_11_NETWORK_INFRASTRUCTURE BssType; - NDIS_802_11_RTS_THRESHOLD RtsThresh; - NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh; - NDIS_802_11_POWER_MODE PowerMode; - PNDIS_802_11_KEY pKey = NULL; - PNDIS_802_11_WEP pWepKey =NULL; - PNDIS_802_11_REMOVE_KEY pRemoveKey = NULL; - NDIS_802_11_CONFIGURATION Config, *pConfig = NULL; - NDIS_802_11_NETWORK_TYPE NetType; - ULONG Now; - UINT KeyIdx = 0; - INT Status = NDIS_STATUS_SUCCESS, MaxPhyMode = PHY_11G; - ULONG PowerTemp; - BOOLEAN RadioState; - BOOLEAN StateMachineTouched = FALSE; - OID_SET_HT_PHYMODE HT_PhyMode; //11n ,kathy - PNDIS_802_11_PMKID pPmkId = NULL; - BOOLEAN IEEE8021xState = FALSE; - BOOLEAN IEEE8021x_required_keys = FALSE; - UCHAR wpa_supplicant_enable = 0; - - MaxPhyMode = PHY_11N_5G; - - DBGPRINT(RT_DEBUG_TRACE, ("-->RTMPSetInformation(), 0x%08x\n", cmd&0x7FFF)); - switch(cmd & 0x7FFF) { - case RT_OID_802_11_COUNTRY_REGION: - if (wrq->u.data.length < sizeof(UCHAR)) - Status = -EINVAL; - // Only avaliable when EEPROM not programming - else if (!(pAdapter->CommonCfg.CountryRegion & 0x80) && !(pAdapter->CommonCfg.CountryRegionForABand & 0x80)) - { - ULONG Country; - UCHAR TmpPhy; - - Status = copy_from_user(&Country, wrq->u.data.pointer, wrq->u.data.length); - pAdapter->CommonCfg.CountryRegion = (UCHAR)(Country & 0x000000FF); - pAdapter->CommonCfg.CountryRegionForABand = (UCHAR)((Country >> 8) & 0x000000FF); - TmpPhy = pAdapter->CommonCfg.PhyMode; - pAdapter->CommonCfg.PhyMode = 0xff; - // Build all corresponding channel information - RTMPSetPhyMode(pAdapter, TmpPhy); - SetCommonHT(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_COUNTRY_REGION (A:%d B/G:%d)\n", pAdapter->CommonCfg.CountryRegionForABand, - pAdapter->CommonCfg.CountryRegion)); - } - break; - case OID_802_11_BSSID_LIST_SCAN: - Now = jiffies; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_BSSID_LIST_SCAN, TxCnt = %d \n", pAdapter->RalinkCounters.LastOneSecTotalTxCount)); - - if (MONITOR_ON(pAdapter)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); - break; - } - - //Benson add 20080527, when radio off, sta don't need to scan - if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_RADIO_OFF)) - break; - - if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is scanning now !!!\n")); - pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; - Status = NDIS_STATUS_SUCCESS; - break; - } - - if (pAdapter->RalinkCounters.LastOneSecTotalTxCount > 100) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Link UP, ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); - Status = NDIS_STATUS_SUCCESS; - pAdapter->StaCfg.ScanCnt = 99; // Prevent auto scan triggered by this OID - break; - } - - if ((OPSTATUS_TEST_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED)) && - ((pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || - (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) && - (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Link UP, Port Not Secured! ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); - Status = NDIS_STATUS_SUCCESS; - pAdapter->StaCfg.ScanCnt = 99; // Prevent auto scan triggered by this OID - break; - } - - - if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RT28XX_MLME_RESET_STATE_MACHINE(pAdapter); - 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. - pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; - // Reset allowed scan retries - pAdapter->StaCfg.ScanCnt = 0; - pAdapter->StaCfg.LastScanTime = Now; - - pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; - RTMP_SET_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); - MlmeEnqueue(pAdapter, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID_LIST_SCAN, - 0, - NULL); - - Status = NDIS_STATUS_SUCCESS; - StateMachineTouched = TRUE; - break; - case OID_802_11_SSID: - if (wrq->u.data.length != sizeof(NDIS_802_11_SSID)) - Status = -EINVAL; - else - { - PCHAR pSsidString = NULL; - Status = copy_from_user(&Ssid, wrq->u.data.pointer, wrq->u.data.length); - - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SSID (Len=%d,Ssid=%s)\n", Ssid.SsidLength, Ssid.Ssid)); - if (Ssid.SsidLength > MAX_LEN_OF_SSID) - Status = -EINVAL; - else - { - if (Ssid.SsidLength == 0) - { - Set_SSID_Proc(pAdapter, ""); - } - else - { - pSsidString = (CHAR *) kmalloc(MAX_LEN_OF_SSID+1, MEM_ALLOC_FLAG); - if (pSsidString) - { - NdisZeroMemory(pSsidString, MAX_LEN_OF_SSID+1); - NdisMoveMemory(pSsidString, Ssid.Ssid, Ssid.SsidLength); - Set_SSID_Proc(pAdapter, pSsidString); - kfree(pSsidString); - } - else - Status = -ENOMEM; - } - } - } - break; - case OID_802_11_BSSID: - if (wrq->u.data.length != sizeof(NDIS_802_11_MAC_ADDRESS)) - Status = -EINVAL; - else - { - Status = copy_from_user(&Bssid, wrq->u.data.pointer, wrq->u.data.length); - - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. - pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; - - // Prevent to connect AP again in STAMlmePeriodicExec - pAdapter->MlmeAux.AutoReconnectSsidLen= 32; - - // Reset allowed scan retries - pAdapter->StaCfg.ScanCnt = 0; - - if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RT28XX_MLME_RESET_STATE_MACHINE(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - MlmeEnqueue(pAdapter, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID, - sizeof(NDIS_802_11_MAC_ADDRESS), - (VOID *)&Bssid); - Status = NDIS_STATUS_SUCCESS; - StateMachineTouched = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", - Bssid[0], Bssid[1], Bssid[2], Bssid[3], Bssid[4], Bssid[5])); - } - break; - case RT_OID_802_11_RADIO: - if (wrq->u.data.length != sizeof(BOOLEAN)) - Status = -EINVAL; - else - { - Status = copy_from_user(&RadioState, wrq->u.data.pointer, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_RADIO (=%d)\n", RadioState)); - if (pAdapter->StaCfg.bSwRadio != RadioState) - { - pAdapter->StaCfg.bSwRadio = RadioState; - if (pAdapter->StaCfg.bRadio != (pAdapter->StaCfg.bHwRadio && pAdapter->StaCfg.bSwRadio)) - { - pAdapter->StaCfg.bRadio = (pAdapter->StaCfg.bHwRadio && pAdapter->StaCfg.bSwRadio); - if (pAdapter->StaCfg.bRadio == TRUE) - { - MlmeRadioOn(pAdapter); - // Update extra information - pAdapter->ExtraInfo = EXTRA_INFO_CLEAR; - } - else - { - MlmeRadioOff(pAdapter); - // Update extra information - pAdapter->ExtraInfo = SW_RADIO_OFF; - } - } - } - } - break; - case RT_OID_802_11_PHY_MODE: - if (wrq->u.data.length != sizeof(RT_802_11_PHY_MODE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&PhyMode, wrq->u.data.pointer, wrq->u.data.length); - if (PhyMode <= MaxPhyMode) - { - RTMPSetPhyMode(pAdapter, PhyMode); - SetCommonHT(pAdapter); - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_PHY_MODE (=%d)\n", PhyMode)); - } - break; - case RT_OID_802_11_STA_CONFIG: - if (wrq->u.data.length != sizeof(RT_802_11_STA_CONFIG)) - Status = -EINVAL; - else - { - Status = copy_from_user(&StaConfig, wrq->u.data.pointer, wrq->u.data.length); - pAdapter->CommonCfg.bEnableTxBurst = StaConfig.EnableTxBurst; - pAdapter->CommonCfg.UseBGProtection = StaConfig.UseBGProtection; - pAdapter->CommonCfg.bUseShortSlotTime = 1; // 2003-10-30 always SHORT SLOT capable - if ((pAdapter->CommonCfg.PhyMode != StaConfig.AdhocMode) && - (StaConfig.AdhocMode <= MaxPhyMode)) - { - // allow dynamic change of "USE OFDM rate or not" in ADHOC mode - // if setting changed, need to reset current TX rate as well as BEACON frame format -#ifdef RT30xx - pAdapter->CommonCfg.PhyMode = StaConfig.AdhocMode; -#endif - if (pAdapter->StaCfg.BssType == BSS_ADHOC) - { -#ifndef RT30xx - pAdapter->CommonCfg.PhyMode = StaConfig.AdhocMode; -#endif - RTMPSetPhyMode(pAdapter, PhyMode); - MlmeUpdateTxRates(pAdapter, FALSE, 0); - MakeIbssBeacon(pAdapter); // re-build BEACON frame - AsicEnableIbssSync(pAdapter); // copy to on-chip memory - } - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_STA_CONFIG (Burst=%d, Protection=%ld,ShortSlot=%d\n", - pAdapter->CommonCfg.bEnableTxBurst, - pAdapter->CommonCfg.UseBGProtection, - pAdapter->CommonCfg.bUseShortSlotTime)); - } - break; - case OID_802_11_DESIRED_RATES: - if (wrq->u.data.length != sizeof(NDIS_802_11_RATES)) - Status = -EINVAL; - else - { - Status = copy_from_user(&aryRates, wrq->u.data.pointer, wrq->u.data.length); - NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); - NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES)); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DESIRED_RATES (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n", - pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1], - pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3], - pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5], - pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] )); - // Changing DesiredRate may affect the MAX TX rate we used to TX frames out - MlmeUpdateTxRates(pAdapter, FALSE, 0); - } - break; - case RT_OID_802_11_PREAMBLE: - if (wrq->u.data.length != sizeof(RT_802_11_PREAMBLE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&Preamble, wrq->u.data.pointer, wrq->u.data.length); - if (Preamble == Rt802_11PreambleShort) - { - pAdapter->CommonCfg.TxPreamble = Preamble; - MlmeSetTxPreamble(pAdapter, Rt802_11PreambleShort); - } - else if ((Preamble == Rt802_11PreambleLong) || (Preamble == Rt802_11PreambleAuto)) - { - // if user wants AUTO, initialize to LONG here, then change according to AP's - // capability upon association. - pAdapter->CommonCfg.TxPreamble = Preamble; - MlmeSetTxPreamble(pAdapter, Rt802_11PreambleLong); - } - else - { - Status = -EINVAL; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_PREAMBLE (=%d)\n", Preamble)); - } - break; - case OID_802_11_WEP_STATUS: - if (wrq->u.data.length != sizeof(NDIS_802_11_WEP_STATUS)) - Status = -EINVAL; - else - { - Status = copy_from_user(&WepStatus, wrq->u.data.pointer, wrq->u.data.length); - // Since TKIP, AES, WEP are all supported. It should not have any invalid setting - if (WepStatus <= Ndis802_11Encryption3KeyAbsent) - { - if (pAdapter->StaCfg.WepStatus != WepStatus) - { - // Config has changed - pAdapter->bConfigChanged = TRUE; - } - pAdapter->StaCfg.WepStatus = WepStatus; - pAdapter->StaCfg.OrigWepStatus = WepStatus; - pAdapter->StaCfg.PairCipher = WepStatus; - pAdapter->StaCfg.GroupCipher = WepStatus; - } - else - { - Status = -EINVAL; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_WEP_STATUS (=%d)\n",WepStatus)); - } - break; - case OID_802_11_AUTHENTICATION_MODE: - if (wrq->u.data.length != sizeof(NDIS_802_11_AUTHENTICATION_MODE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&AuthMode, wrq->u.data.pointer, wrq->u.data.length); - if (AuthMode > Ndis802_11AuthModeMax) - { - Status = -EINVAL; - break; - } - else - { - if (pAdapter->StaCfg.AuthMode != AuthMode) - { - // Config has changed - pAdapter->bConfigChanged = TRUE; - } - pAdapter->StaCfg.AuthMode = AuthMode; - } - pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_AUTHENTICATION_MODE (=%d) \n",pAdapter->StaCfg.AuthMode)); - } - break; - case OID_802_11_INFRASTRUCTURE_MODE: - if (wrq->u.data.length != sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&BssType, wrq->u.data.pointer, wrq->u.data.length); - - if (BssType == Ndis802_11IBSS) - Set_NetworkType_Proc(pAdapter, "Adhoc"); - else if (BssType == Ndis802_11Infrastructure) - Set_NetworkType_Proc(pAdapter, "Infra"); - else if (BssType == Ndis802_11Monitor) - Set_NetworkType_Proc(pAdapter, "Monitor"); - else - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_INFRASTRUCTURE_MODE (unknown)\n")); - } - } - break; - case OID_802_11_REMOVE_WEP: - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_WEP\n")); - if (wrq->u.data.length != sizeof(NDIS_802_11_KEY_INDEX)) - { - Status = -EINVAL; - } - else - { - KeyIdx = *(NDIS_802_11_KEY_INDEX *) wrq->u.data.pointer; - - if (KeyIdx & 0x80000000) - { - // Should never set default bit when remove key - Status = -EINVAL; - } - else - { - KeyIdx = KeyIdx & 0x0fffffff; - if (KeyIdx >= 4){ - Status = -EINVAL; - } - else - { - pAdapter->SharedKey[BSS0][KeyIdx].KeyLen = 0; - pAdapter->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAdapter, 0, (UCHAR)KeyIdx); - } - } - } - break; - case RT_OID_802_11_RESET_COUNTERS: - NdisZeroMemory(&pAdapter->WlanCounters, sizeof(COUNTER_802_11)); - NdisZeroMemory(&pAdapter->Counters8023, sizeof(COUNTER_802_3)); - NdisZeroMemory(&pAdapter->RalinkCounters, sizeof(COUNTER_RALINK)); - pAdapter->Counters8023.RxNoBuffer = 0; - pAdapter->Counters8023.GoodReceives = 0; - pAdapter->Counters8023.RxNoBuffer = 0; -#ifdef RT2870 - pAdapter->BulkOutComplete = 0; - pAdapter->BulkOutCompleteOther= 0; - pAdapter->BulkOutCompleteCancel = 0; - pAdapter->BulkOutReq = 0; - pAdapter->BulkInReq= 0; - pAdapter->BulkInComplete = 0; - pAdapter->BulkInCompleteFail = 0; -#endif // RT2870 // - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_RESET_COUNTERS \n")); - break; - case OID_802_11_RTS_THRESHOLD: - if (wrq->u.data.length != sizeof(NDIS_802_11_RTS_THRESHOLD)) - Status = -EINVAL; - else - { - Status = copy_from_user(&RtsThresh, wrq->u.data.pointer, wrq->u.data.length); - if (RtsThresh > MAX_RTS_THRESHOLD) - Status = -EINVAL; - else - pAdapter->CommonCfg.RtsThreshold = (USHORT)RtsThresh; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_RTS_THRESHOLD (=%ld)\n",RtsThresh)); - break; - case OID_802_11_FRAGMENTATION_THRESHOLD: - if (wrq->u.data.length != sizeof(NDIS_802_11_FRAGMENTATION_THRESHOLD)) - Status = -EINVAL; - else - { - Status = copy_from_user(&FragThresh, wrq->u.data.pointer, wrq->u.data.length); - pAdapter->CommonCfg.bUseZeroToDisableFragment = FALSE; - if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD) - { - if (FragThresh == 0) - { - pAdapter->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD; - pAdapter->CommonCfg.bUseZeroToDisableFragment = TRUE; - } - else - Status = -EINVAL; - } - else - pAdapter->CommonCfg.FragmentThreshold = (USHORT)FragThresh; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_FRAGMENTATION_THRESHOLD (=%ld) \n",FragThresh)); - break; - case OID_802_11_POWER_MODE: - if (wrq->u.data.length != sizeof(NDIS_802_11_POWER_MODE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&PowerMode, wrq->u.data.pointer, wrq->u.data.length); - if (PowerMode == Ndis802_11PowerModeCAM) - Set_PSMode_Proc(pAdapter, "CAM"); - else if (PowerMode == Ndis802_11PowerModeMAX_PSP) - Set_PSMode_Proc(pAdapter, "Max_PSP"); - else if (PowerMode == Ndis802_11PowerModeFast_PSP) - Set_PSMode_Proc(pAdapter, "Fast_PSP"); - else if (PowerMode == Ndis802_11PowerModeLegacy_PSP) - Set_PSMode_Proc(pAdapter, "Legacy_PSP"); - else - Status = -EINVAL; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_POWER_MODE (=%d)\n",PowerMode)); - break; - case RT_OID_802_11_TX_POWER_LEVEL_1: - if (wrq->u.data.length < sizeof(ULONG)) - Status = -EINVAL; - else - { - Status = copy_from_user(&PowerTemp, wrq->u.data.pointer, wrq->u.data.length); - if (PowerTemp > 100) - PowerTemp = 0xffffffff; // AUTO - pAdapter->CommonCfg.TxPowerDefault = PowerTemp; //keep current setting. - pAdapter->CommonCfg.TxPowerPercentage = pAdapter->CommonCfg.TxPowerDefault; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_TX_POWER_LEVEL_1 (=%ld)\n", pAdapter->CommonCfg.TxPowerPercentage)); - } - break; - case OID_802_11_NETWORK_TYPE_IN_USE: - if (wrq->u.data.length != sizeof(NDIS_802_11_NETWORK_TYPE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&NetType, wrq->u.data.pointer, wrq->u.data.length); - - if (NetType == Ndis802_11DS) - RTMPSetPhyMode(pAdapter, PHY_11B); - else if (NetType == Ndis802_11OFDM24) - RTMPSetPhyMode(pAdapter, PHY_11BG_MIXED); - else if (NetType == Ndis802_11OFDM5) - RTMPSetPhyMode(pAdapter, PHY_11A); - else - Status = -EINVAL; - - if (Status == NDIS_STATUS_SUCCESS) - SetCommonHT(pAdapter); - - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_NETWORK_TYPE_IN_USE (=%d)\n",NetType)); - } - break; - // For WPA PSK PMK key - case RT_OID_802_11_ADD_WPA: - pKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - if(pKey == NULL) - { - Status = -ENOMEM; - break; - } - - Status = copy_from_user(pKey, wrq->u.data.pointer, wrq->u.data.length); - if (pKey->Length != wrq->u.data.length) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA, Failed!!\n")); - } - else - { - if ((pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && - (pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && - (pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) ) - { - Status = -EOPNOTSUPP; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA, Failed!! [AuthMode != WPAPSK/WPA2PSK/WPANONE]\n")); - } - else if ((pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || - (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) ) // Only for WPA PSK mode - { - NdisMoveMemory(pAdapter->StaCfg.PMK, &pKey->KeyMaterial, pKey->KeyLength); - // Use RaConfig as PSK agent. - // Start STA supplicant state machine - if (pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) - pAdapter->StaCfg.WpaState = SS_START; - - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength)); - } - else - { - pAdapter->StaCfg.WpaState = SS_NOTUSE; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength)); - } - } - kfree(pKey); - break; - case OID_802_11_REMOVE_KEY: - pRemoveKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - if(pRemoveKey == NULL) - { - Status = -ENOMEM; - break; - } - - Status = copy_from_user(pRemoveKey, wrq->u.data.pointer, wrq->u.data.length); - if (pRemoveKey->Length != wrq->u.data.length) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!\n")); - } - else - { - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - RTMPWPARemoveKeyProc(pAdapter, pRemoveKey); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Remove WPA Key!!\n")); - } - else - { - KeyIdx = pRemoveKey->KeyIndex; - - if (KeyIdx & 0x80000000) - { - // Should never set default bit when remove key - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!(Should never set default bit when remove key)\n")); - } - else - { - KeyIdx = KeyIdx & 0x0fffffff; - if (KeyIdx > 3) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!(KeyId[%d] out of range)\n", KeyIdx)); - } - else - { - pAdapter->SharedKey[BSS0][KeyIdx].KeyLen = 0; - pAdapter->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAdapter, 0, (UCHAR)KeyIdx); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY (id=0x%x, Len=%d-byte)\n", pRemoveKey->KeyIndex, pRemoveKey->Length)); - } - } - } - } - kfree(pRemoveKey); - break; - // New for WPA - case OID_802_11_ADD_KEY: - pKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - if(pKey == NULL) - { - Status = -ENOMEM; - break; - } - Status = copy_from_user(pKey, wrq->u.data.pointer, wrq->u.data.length); - if (pKey->Length != wrq->u.data.length) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_KEY, Failed!!\n")); - } - else - { - RTMPAddKey(pAdapter, pKey); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_KEY (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength)); - } - kfree(pKey); - break; - case OID_802_11_CONFIGURATION: - if (wrq->u.data.length != sizeof(NDIS_802_11_CONFIGURATION)) - Status = -EINVAL; - else - { - Status = copy_from_user(&Config, wrq->u.data.pointer, wrq->u.data.length); - pConfig = &Config; - - if ((pConfig->BeaconPeriod >= 20) && (pConfig->BeaconPeriod <=400)) - pAdapter->CommonCfg.BeaconPeriod = (USHORT) pConfig->BeaconPeriod; - - pAdapter->StaActive.AtimWin = (USHORT) pConfig->ATIMWindow; - MAP_KHZ_TO_CHANNEL_ID(pConfig->DSConfig, pAdapter->CommonCfg.Channel); - // - // Save the channel on MlmeAux for CntlOidRTBssidProc used. - // - pAdapter->MlmeAux.Channel = pAdapter->CommonCfg.Channel; - - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_CONFIGURATION (BeacnPeriod=%ld,AtimW=%ld,Ch=%d)\n", - pConfig->BeaconPeriod, pConfig->ATIMWindow, pAdapter->CommonCfg.Channel)); - // Config has changed - pAdapter->bConfigChanged = TRUE; - } - break; - case RT_OID_802_11_SET_HT_PHYMODE: - if (wrq->u.data.length != sizeof(OID_SET_HT_PHYMODE)) - Status = -EINVAL; - else - { - POID_SET_HT_PHYMODE pHTPhyMode = &HT_PhyMode; - - Status = copy_from_user(&HT_PhyMode, wrq->u.data.pointer, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Set::pHTPhyMode (PhyMode = %d,TransmitNo = %d, HtMode = %d, ExtOffset = %d , MCS = %d, BW = %d, STBC = %d, SHORTGI = %d) \n", - pHTPhyMode->PhyMode, pHTPhyMode->TransmitNo,pHTPhyMode->HtMode,pHTPhyMode->ExtOffset, - pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->SHORTGI)); - if (pAdapter->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - RTMPSetHT(pAdapter, pHTPhyMode); - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_HT_PHYMODE(MCS=%d,BW=%d,SGI=%d,STBC=%d)\n", - pAdapter->StaCfg.HTPhyMode.field.MCS, pAdapter->StaCfg.HTPhyMode.field.BW, pAdapter->StaCfg.HTPhyMode.field.ShortGI, - pAdapter->StaCfg.HTPhyMode.field.STBC)); - break; - case RT_OID_802_11_SET_APSD_SETTING: - if (wrq->u.data.length != sizeof(ULONG)) - Status = -EINVAL; - else - { - ULONG apsd ; - Status = copy_from_user(&apsd, wrq->u.data.pointer, wrq->u.data.length); - - /*------------------------------------------------------------------- - |B31~B7 | B6~B5 | B4 | B3 | B2 | B1 | B0 | - --------------------------------------------------------------------- - | Rsvd | Max SP Len | AC_VO | AC_VI | AC_BK | AC_BE | APSD Capable | - ---------------------------------------------------------------------*/ - pAdapter->CommonCfg.bAPSDCapable = (apsd & 0x00000001) ? TRUE : FALSE; - pAdapter->CommonCfg.bAPSDAC_BE = ((apsd & 0x00000002) >> 1) ? TRUE : FALSE; - pAdapter->CommonCfg.bAPSDAC_BK = ((apsd & 0x00000004) >> 2) ? TRUE : FALSE; - pAdapter->CommonCfg.bAPSDAC_VI = ((apsd & 0x00000008) >> 3) ? TRUE : FALSE; - pAdapter->CommonCfg.bAPSDAC_VO = ((apsd & 0x00000010) >> 4) ? TRUE : FALSE; - pAdapter->CommonCfg.MaxSPLength = (UCHAR)((apsd & 0x00000060) >> 5); - - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_APSD_SETTING (apsd=0x%lx, APSDCap=%d, [BE,BK,VI,VO]=[%d/%d/%d/%d], MaxSPLen=%d)\n", apsd, pAdapter->CommonCfg.bAPSDCapable, - pAdapter->CommonCfg.bAPSDAC_BE, pAdapter->CommonCfg.bAPSDAC_BK, pAdapter->CommonCfg.bAPSDAC_VI, pAdapter->CommonCfg.bAPSDAC_VO, pAdapter->CommonCfg.MaxSPLength)); - } - break; - - case RT_OID_802_11_SET_APSD_PSM: - if (wrq->u.data.length != sizeof(ULONG)) - Status = -EINVAL; - else - { - // Driver needs to notify AP when PSM changes - Status = copy_from_user(&pAdapter->CommonCfg.bAPSDForcePowerSave, wrq->u.data.pointer, wrq->u.data.length); - if (pAdapter->CommonCfg.bAPSDForcePowerSave != pAdapter->StaCfg.Psm) - { - MlmeSetPsmBit(pAdapter, pAdapter->CommonCfg.bAPSDForcePowerSave); - RTMPSendNullFrame(pAdapter, pAdapter->CommonCfg.TxRate, TRUE); - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_APSD_PSM (bAPSDForcePowerSave:%d)\n", pAdapter->CommonCfg.bAPSDForcePowerSave)); - } - break; - - case RT_OID_802_11_SET_WMM: - if (wrq->u.data.length != sizeof(BOOLEAN)) - Status = -EINVAL; - else - { - Status = copy_from_user(&pAdapter->CommonCfg.bWmmCapable, wrq->u.data.pointer, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_WMM (=%d) \n", pAdapter->CommonCfg.bWmmCapable)); - } - break; - - case OID_802_11_DISASSOCIATE: - // - // Set NdisRadioStateOff to TRUE, instead of called MlmeRadioOff. - // Later on, NDIS_802_11_BSSID_LIST_EX->NumberOfItems should be 0 - // when query OID_802_11_BSSID_LIST. - // - // TRUE: NumberOfItems will set to 0. - // FALSE: NumberOfItems no change. - // - pAdapter->CommonCfg.NdisRadioStateOff = TRUE; - // Set to immediately send the media disconnect event - pAdapter->MlmeAux.CurrReqIsFromNdis = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DISASSOCIATE \n")); - - if (INFRA_ON(pAdapter)) - { - if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RT28XX_MLME_RESET_STATE_MACHINE(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - - MlmeEnqueue(pAdapter, - MLME_CNTL_STATE_MACHINE, - OID_802_11_DISASSOCIATE, - 0, - NULL); - - StateMachineTouched = TRUE; - } - break; - case RT_OID_802_11_SET_IMME_BA_CAP: - if (wrq->u.data.length != sizeof(OID_BACAP_STRUC)) - Status = -EINVAL; - else - { - OID_BACAP_STRUC Orde ; - Status = copy_from_user(&Orde, wrq->u.data.pointer, wrq->u.data.length); - if (Orde.Policy > BA_NOTUSE) - { - Status = NDIS_STATUS_INVALID_DATA; - } - else if (Orde.Policy == BA_NOTUSE) - { - pAdapter->CommonCfg.BACapability.field.Policy = BA_NOTUSE; - pAdapter->CommonCfg.BACapability.field.MpduDensity = Orde.MpduDensity; - pAdapter->CommonCfg.DesiredHtPhy.MpduDensity = Orde.MpduDensity; - pAdapter->CommonCfg.DesiredHtPhy.AmsduEnable = Orde.AmsduEnable; - pAdapter->CommonCfg.DesiredHtPhy.AmsduSize= Orde.AmsduSize; - pAdapter->CommonCfg.DesiredHtPhy.MimoPs= Orde.MMPSmode; - pAdapter->CommonCfg.BACapability.field.MMPSmode = Orde.MMPSmode; - // UPdata to HT IE - pAdapter->CommonCfg.HtCapability.HtCapInfo.MimoPs = Orde.MMPSmode; - pAdapter->CommonCfg.HtCapability.HtCapInfo.AMsduSize = Orde.AmsduSize; - pAdapter->CommonCfg.HtCapability.HtCapParm.MpduDensity = Orde.MpduDensity; - } - else - { - pAdapter->CommonCfg.BACapability.field.AutoBA = Orde.AutoBA; - pAdapter->CommonCfg.BACapability.field.Policy = IMMED_BA; // we only support immediate BA. - pAdapter->CommonCfg.BACapability.field.MpduDensity = Orde.MpduDensity; - pAdapter->CommonCfg.DesiredHtPhy.MpduDensity = Orde.MpduDensity; - pAdapter->CommonCfg.DesiredHtPhy.AmsduEnable = Orde.AmsduEnable; - pAdapter->CommonCfg.DesiredHtPhy.AmsduSize= Orde.AmsduSize; - pAdapter->CommonCfg.DesiredHtPhy.MimoPs = Orde.MMPSmode; - pAdapter->CommonCfg.BACapability.field.MMPSmode = Orde.MMPSmode; - - // UPdata to HT IE - pAdapter->CommonCfg.HtCapability.HtCapInfo.MimoPs = Orde.MMPSmode; - pAdapter->CommonCfg.HtCapability.HtCapInfo.AMsduSize = Orde.AmsduSize; - pAdapter->CommonCfg.HtCapability.HtCapParm.MpduDensity = Orde.MpduDensity; - - if (pAdapter->CommonCfg.BACapability.field.RxBAWinLimit > MAX_RX_REORDERBUF) - pAdapter->CommonCfg.BACapability.field.RxBAWinLimit = MAX_RX_REORDERBUF; - - } - - pAdapter->CommonCfg.REGBACapability.word = pAdapter->CommonCfg.BACapability.word; - DBGPRINT(RT_DEBUG_TRACE, ("Set::(Orde.AutoBA = %d) (Policy=%d)(ReBAWinLimit=%d)(TxBAWinLimit=%d)(AutoMode=%d)\n",Orde.AutoBA, pAdapter->CommonCfg.BACapability.field.Policy, - pAdapter->CommonCfg.BACapability.field.RxBAWinLimit,pAdapter->CommonCfg.BACapability.field.TxBAWinLimit, pAdapter->CommonCfg.BACapability.field.AutoBA)); - DBGPRINT(RT_DEBUG_TRACE, ("Set::(MimoPs = %d)(AmsduEnable = %d) (AmsduSize=%d)(MpduDensity=%d)\n",pAdapter->CommonCfg.DesiredHtPhy.MimoPs, pAdapter->CommonCfg.DesiredHtPhy.AmsduEnable, - pAdapter->CommonCfg.DesiredHtPhy.AmsduSize, pAdapter->CommonCfg.DesiredHtPhy.MpduDensity)); - } - - break; - case RT_OID_802_11_ADD_IMME_BA: - DBGPRINT(RT_DEBUG_TRACE, (" Set :: RT_OID_802_11_ADD_IMME_BA \n")); - if (wrq->u.data.length != sizeof(OID_ADD_BA_ENTRY)) - Status = -EINVAL; - else - { - UCHAR index; - OID_ADD_BA_ENTRY BA; - MAC_TABLE_ENTRY *pEntry; - - Status = copy_from_user(&BA, wrq->u.data.pointer, wrq->u.data.length); - if (BA.TID > 15) - { - Status = NDIS_STATUS_INVALID_DATA; - break; - } - else - { - //BATableInsertEntry - //As ad-hoc mode, BA pair is not limited to only BSSID. so add via OID. - index = BA.TID; - // in ad hoc mode, when adding BA pair, we should insert this entry into MACEntry too - pEntry = MacTableLookup(pAdapter, BA.MACAddr); - if (!pEntry) - { - DBGPRINT(RT_DEBUG_TRACE, ("RT_OID_802_11_ADD_IMME_BA. break on no connection.----:%x:%x\n", BA.MACAddr[4], BA.MACAddr[5])); - break; - } - if (BA.IsRecipient == FALSE) - { - if (pEntry->bIAmBadAtheros == TRUE) - pAdapter->CommonCfg.BACapability.field.RxBAWinLimit = 0x10; - - BAOriSessionSetUp(pAdapter, pEntry, index, 0, 100, TRUE); - } - else - { - //BATableInsertEntry(pAdapter, pEntry->Aid, BA.MACAddr, 0, 0xffff, BA.TID, BA.nMSDU, BA.IsRecipient); - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_IMME_BA. Rec = %d. Mac = %x:%x:%x:%x:%x:%x . \n", - BA.IsRecipient, BA.MACAddr[0], BA.MACAddr[1], BA.MACAddr[2], BA.MACAddr[2] - , BA.MACAddr[4], BA.MACAddr[5])); - } - } - break; - - case RT_OID_802_11_TEAR_IMME_BA: - DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA \n")); - if (wrq->u.data.length != sizeof(OID_ADD_BA_ENTRY)) - Status = -EINVAL; - else - { - POID_ADD_BA_ENTRY pBA; - MAC_TABLE_ENTRY *pEntry; - - pBA = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - - if (pBA == NULL) - { - DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA kmalloc() can't allocate enough memory\n")); - Status = NDIS_STATUS_FAILURE; - } - else - { - Status = copy_from_user(pBA, wrq->u.data.pointer, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA(TID=%d, bAllTid=%d)\n", pBA->TID, pBA->bAllTid)); - - if (!pBA->bAllTid && (pBA->TID > NUM_OF_TID)) - { - Status = NDIS_STATUS_INVALID_DATA; - break; - } - - if (pBA->IsRecipient == FALSE) - { - pEntry = MacTableLookup(pAdapter, pBA->MACAddr); - DBGPRINT(RT_DEBUG_TRACE, (" pBA->IsRecipient == FALSE\n")); - if (pEntry) - { - DBGPRINT(RT_DEBUG_TRACE, (" pBA->pEntry\n")); - BAOriSessionTearDown(pAdapter, pEntry->Aid, pBA->TID, FALSE, TRUE); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("Set :: Not found pEntry \n")); - } - else - { - pEntry = MacTableLookup(pAdapter, pBA->MACAddr); - if (pEntry) - { - BARecSessionTearDown( pAdapter, (UCHAR)pEntry->Aid, pBA->TID, TRUE); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("Set :: Not found pEntry \n")); - } - kfree(pBA); - } - } - break; - // For WPA_SUPPLICANT to set static wep key - case OID_802_11_ADD_WEP: - pWepKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - - if(pWepKey == NULL) - { - Status = -ENOMEM; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed!!\n")); - break; - } - Status = copy_from_user(pWepKey, wrq->u.data.pointer, wrq->u.data.length); - if (Status) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed (length mismatch)!!\n")); - } - else - { - KeyIdx = pWepKey->KeyIndex & 0x0fffffff; - // KeyIdx must be 0 ~ 3 - if (KeyIdx > 4) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed (KeyIdx must be smaller than 4)!!\n")); - } - else - { - UCHAR CipherAlg = 0; - PUCHAR Key; - - // set key material and key length - NdisZeroMemory(pAdapter->SharedKey[BSS0][KeyIdx].Key, 16); - pAdapter->SharedKey[BSS0][KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength; - NdisMoveMemory(pAdapter->SharedKey[BSS0][KeyIdx].Key, &pWepKey->KeyMaterial, pWepKey->KeyLength); - - switch(pWepKey->KeyLength) - { - case 5: - CipherAlg = CIPHER_WEP64; - break; - case 13: - CipherAlg = CIPHER_WEP128; - break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, only support CIPHER_WEP64(len:5) & CIPHER_WEP128(len:13)!!\n")); - Status = -EINVAL; - break; - } - pAdapter->SharedKey[BSS0][KeyIdx].CipherAlg = CipherAlg; - - // Default key for tx (shared key) - if (pWepKey->KeyIndex & 0x80000000) - { - // set key material and key length - NdisZeroMemory(pAdapter->StaCfg.DesireSharedKey[KeyIdx].Key, 16); - pAdapter->StaCfg.DesireSharedKey[KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength; - NdisMoveMemory(pAdapter->StaCfg.DesireSharedKey[KeyIdx].Key, &pWepKey->KeyMaterial, pWepKey->KeyLength); - pAdapter->StaCfg.DesireSharedKeyId = KeyIdx; - pAdapter->StaCfg.DesireSharedKey[KeyIdx].CipherAlg = CipherAlg; - pAdapter->StaCfg.DefaultKeyId = (UCHAR) KeyIdx; - } -#ifndef RT30xx -#ifdef RT2860 - if ((pAdapter->StaCfg.WpaSupplicantUP != 0) && -#endif -#ifdef RT2870 - if ((pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) && -#endif - (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)) - { - Key = pWepKey->KeyMaterial; - - // Set Group key material to Asic - AsicAddSharedKeyEntry(pAdapter, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL); - - // Update WCID attribute table and IVEIV table for this group key table - RTMPAddWcidAttributeEntry(pAdapter, BSS0, KeyIdx, CipherAlg, NULL); - - STA_PORT_SECURED(pAdapter); - - // Indicate Connected for GUI - pAdapter->IndicateMediaState = NdisMediaStateConnected; - } - else if (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) -#endif -#ifdef RT30xx - if (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) -#endif - { - Key = pAdapter->SharedKey[BSS0][KeyIdx].Key; - - // Set key material and cipherAlg to Asic - AsicAddSharedKeyEntry(pAdapter, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL); - - if (pWepKey->KeyIndex & 0x80000000) - { - PMAC_TABLE_ENTRY pEntry = &pAdapter->MacTab.Content[BSSID_WCID]; - // Assign group key info - RTMPAddWcidAttributeEntry(pAdapter, BSS0, KeyIdx, CipherAlg, NULL); - // Assign pairwise key info - RTMPAddWcidAttributeEntry(pAdapter, BSS0, KeyIdx, CipherAlg, pEntry); - } - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP (id=0x%x, Len=%d-byte), %s\n", pWepKey->KeyIndex, pWepKey->KeyLength, (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) ? "Port Secured":"Port NOT Secured")); - } - } - kfree(pWepKey); - break; - case OID_SET_COUNTERMEASURES: - if (wrq->u.data.length != sizeof(int)) - Status = -EINVAL; - else - { - int enabled = 0; - Status = copy_from_user(&enabled, wrq->u.data.pointer, wrq->u.data.length); - if (enabled == 1) - pAdapter->StaCfg.bBlockAssoc = TRUE; - else - // WPA MIC error should block association attempt for 60 seconds - pAdapter->StaCfg.bBlockAssoc = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_SET_COUNTERMEASURES bBlockAssoc=%s\n", pAdapter->StaCfg.bBlockAssoc ? "TRUE":"FALSE")); - } - break; - case RT_OID_WPA_SUPPLICANT_SUPPORT: - if (wrq->u.data.length != sizeof(UCHAR)) - Status = -EINVAL; - else - { - Status = copy_from_user(&wpa_supplicant_enable, wrq->u.data.pointer, wrq->u.data.length); - pAdapter->StaCfg.WpaSupplicantUP = wpa_supplicant_enable; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_WPA_SUPPLICANT_SUPPORT (=%d)\n", pAdapter->StaCfg.WpaSupplicantUP)); - } - break; - case OID_802_11_DEAUTHENTICATION: - if (wrq->u.data.length != sizeof(MLME_DEAUTH_REQ_STRUCT)) - Status = -EINVAL; - else - { - MLME_DEAUTH_REQ_STRUCT *pInfo; - MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - - pInfo = (MLME_DEAUTH_REQ_STRUCT *) MsgElem->Msg; - Status = copy_from_user(pInfo, wrq->u.data.pointer, wrq->u.data.length); - MlmeDeauthReqAction(pAdapter, MsgElem); - kfree(MsgElem); - - if (INFRA_ON(pAdapter)) - { - LinkDown(pAdapter, FALSE); - pAdapter->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DEAUTHENTICATION (Reason=%d)\n", pInfo->Reason)); - } - break; - case OID_802_11_DROP_UNENCRYPTED: - if (wrq->u.data.length != sizeof(int)) - Status = -EINVAL; - else - { - int enabled = 0; - Status = copy_from_user(&enabled, wrq->u.data.pointer, wrq->u.data.length); - if (enabled == 1) - pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - else - pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - NdisAcquireSpinLock(&pAdapter->MacTabLock); - pAdapter->MacTab.Content[BSSID_WCID].PortSecured = pAdapter->StaCfg.PortSecured; - NdisReleaseSpinLock(&pAdapter->MacTabLock); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DROP_UNENCRYPTED (=%d)\n", enabled)); - } - break; - case OID_802_11_SET_IEEE8021X: - if (wrq->u.data.length != sizeof(BOOLEAN)) - Status = -EINVAL; - else - { - Status = copy_from_user(&IEEE8021xState, wrq->u.data.pointer, wrq->u.data.length); - pAdapter->StaCfg.IEEE8021X = IEEE8021xState; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_IEEE8021X (=%d)\n", IEEE8021xState)); - } - break; - case OID_802_11_SET_IEEE8021X_REQUIRE_KEY: - if (wrq->u.data.length != sizeof(BOOLEAN)) - Status = -EINVAL; - else - { - Status = copy_from_user(&IEEE8021x_required_keys, wrq->u.data.pointer, wrq->u.data.length); - pAdapter->StaCfg.IEEE8021x_required_keys = IEEE8021x_required_keys; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_IEEE8021X_REQUIRE_KEY (%d)\n", IEEE8021x_required_keys)); - } - break; - case OID_802_11_PMKID: - pPmkId = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - - if(pPmkId == NULL) { - Status = -ENOMEM; - break; - } - Status = copy_from_user(pPmkId, wrq->u.data.pointer, wrq->u.data.length); - - // check the PMKID information - if (pPmkId->BSSIDInfoCount == 0) - NdisZeroMemory(pAdapter->StaCfg.SavedPMK, sizeof(BSSID_INFO)*PMKID_NO); - else - { - PBSSID_INFO pBssIdInfo; - UINT BssIdx; - UINT CachedIdx; - - for (BssIdx = 0; BssIdx < pPmkId->BSSIDInfoCount; BssIdx++) - { - // point to the indexed BSSID_INFO structure - pBssIdInfo = (PBSSID_INFO) ((PUCHAR) pPmkId + 2 * sizeof(UINT) + BssIdx * sizeof(BSSID_INFO)); - // Find the entry in the saved data base. - for (CachedIdx = 0; CachedIdx < pAdapter->StaCfg.SavedPMKNum; CachedIdx++) - { - // compare the BSSID - if (NdisEqualMemory(pBssIdInfo->BSSID, pAdapter->StaCfg.SavedPMK[CachedIdx].BSSID, sizeof(NDIS_802_11_MAC_ADDRESS))) - break; - } - - // Found, replace it - if (CachedIdx < PMKID_NO) - { - DBGPRINT(RT_DEBUG_OFF, ("Update OID_802_11_PMKID, idx = %d\n", CachedIdx)); - NdisMoveMemory(&pAdapter->StaCfg.SavedPMK[CachedIdx], pBssIdInfo, sizeof(BSSID_INFO)); - pAdapter->StaCfg.SavedPMKNum++; - } - // Not found, replace the last one - else - { - // Randomly replace one - CachedIdx = (pBssIdInfo->BSSID[5] % PMKID_NO); - DBGPRINT(RT_DEBUG_OFF, ("Update OID_802_11_PMKID, idx = %d\n", CachedIdx)); - NdisMoveMemory(&pAdapter->StaCfg.SavedPMK[CachedIdx], pBssIdInfo, sizeof(BSSID_INFO)); - } - } - } - if(pPmkId) - kfree(pPmkId); - break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("Set::unknown IOCTL's subcmd = 0x%08x\n", cmd)); - Status = -EOPNOTSUPP; - break; - } - - - return Status; -} - -INT RTMPQueryInformation( - IN PRTMP_ADAPTER pAdapter, - IN OUT struct ifreq *rq, - IN INT cmd) -{ - struct iwreq *wrq = (struct iwreq *) rq; - NDIS_802_11_BSSID_LIST_EX *pBssidList = NULL; - PNDIS_WLAN_BSSID_EX pBss; - NDIS_802_11_SSID Ssid; - NDIS_802_11_CONFIGURATION *pConfiguration = NULL; - RT_802_11_LINK_STATUS *pLinkStatus = NULL; - RT_802_11_STA_CONFIG *pStaConfig = NULL; - NDIS_802_11_STATISTICS *pStatistics = NULL; - NDIS_802_11_RTS_THRESHOLD RtsThresh; - NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh; - NDIS_802_11_POWER_MODE PowerMode; - NDIS_802_11_NETWORK_INFRASTRUCTURE BssType; - RT_802_11_PREAMBLE PreamType; - NDIS_802_11_AUTHENTICATION_MODE AuthMode; - NDIS_802_11_WEP_STATUS WepStatus; - NDIS_MEDIA_STATE MediaState; - ULONG BssBufSize, ulInfo=0, NetworkTypeList[4], apsd = 0; - USHORT BssLen = 0; - PUCHAR pBuf = NULL, pPtr; - INT Status = NDIS_STATUS_SUCCESS; - UINT we_version_compiled; - UCHAR i, Padding = 0; - BOOLEAN RadioState; - UCHAR driverVersion[8]; - OID_SET_HT_PHYMODE *pHTPhyMode = NULL; - - switch(cmd) - { - case RT_OID_DEVICE_NAME: - wrq->u.data.length = sizeof(STA_NIC_DEVICE_NAME); - Status = copy_to_user(wrq->u.data.pointer, STA_NIC_DEVICE_NAME, wrq->u.data.length); - break; - case RT_OID_VERSION_INFO: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_VERSION_INFO \n")); - wrq->u.data.length = 8*sizeof(UCHAR); - sprintf(&driverVersion[0], "%s", STA_DRIVER_VERSION); - driverVersion[7] = '\0'; - if (copy_to_user(wrq->u.data.pointer, &driverVersion, wrq->u.data.length)) - { - Status = -EFAULT; - } - break; - case OID_802_11_BSSID_LIST: - if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - /* - * Still scanning, indicate the caller should try again. - */ - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID_LIST (Still scanning)\n")); - return -EAGAIN; - } - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID_LIST (%d BSS returned)\n",pAdapter->ScanTab.BssNr)); - pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; - // Claculate total buffer size required - BssBufSize = sizeof(ULONG); - - for (i = 0; i < pAdapter->ScanTab.BssNr; i++) - { - // Align pointer to 4 bytes boundary. - //Padding = 4 - (pAdapter->ScanTab.BssEntry[i].VarIELen & 0x0003); - //if (Padding == 4) - // Padding = 0; - BssBufSize += (sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs) + pAdapter->ScanTab.BssEntry[i].VarIELen + Padding); - } - - // For safety issue, we add 256 bytes just in case - BssBufSize += 256; - // Allocate the same size as passed from higher layer - pBuf = kmalloc(BssBufSize, MEM_ALLOC_FLAG); - if(pBuf == NULL) - { - Status = -ENOMEM; - break; - } - // Init 802_11_BSSID_LIST_EX structure - NdisZeroMemory(pBuf, BssBufSize); - pBssidList = (PNDIS_802_11_BSSID_LIST_EX) pBuf; - pBssidList->NumberOfItems = pAdapter->ScanTab.BssNr; - - // Calculate total buffer length - BssLen = 4; // Consist of NumberOfItems - // Point to start of NDIS_WLAN_BSSID_EX - // pPtr = pBuf + sizeof(ULONG); - pPtr = (PUCHAR) &pBssidList->Bssid[0]; - for (i = 0; i < pAdapter->ScanTab.BssNr; i++) - { - pBss = (PNDIS_WLAN_BSSID_EX) pPtr; - NdisMoveMemory(&pBss->MacAddress, &pAdapter->ScanTab.BssEntry[i].Bssid, MAC_ADDR_LEN); - if ((pAdapter->ScanTab.BssEntry[i].Hidden == 1) && (pAdapter->StaCfg.bShowHiddenSSID == FALSE)) - { - // - // We must return this SSID during 4way handshaking, otherwise Aegis will failed to parse WPA infomation - // and then failed to send EAPOl farame. - // - if ((pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) && (pAdapter->StaCfg.PortSecured != WPA_802_1X_PORT_SECURED)) - { - pBss->Ssid.SsidLength = pAdapter->ScanTab.BssEntry[i].SsidLen; - NdisMoveMemory(pBss->Ssid.Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen); - } - else - pBss->Ssid.SsidLength = 0; - } - else - { - pBss->Ssid.SsidLength = pAdapter->ScanTab.BssEntry[i].SsidLen; - NdisMoveMemory(pBss->Ssid.Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen); - } - pBss->Privacy = pAdapter->ScanTab.BssEntry[i].Privacy; - pBss->Rssi = pAdapter->ScanTab.BssEntry[i].Rssi - pAdapter->BbpRssiToDbmDelta; - pBss->NetworkTypeInUse = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]); - pBss->Configuration.Length = sizeof(NDIS_802_11_CONFIGURATION); - pBss->Configuration.BeaconPeriod = pAdapter->ScanTab.BssEntry[i].BeaconPeriod; - pBss->Configuration.ATIMWindow = pAdapter->ScanTab.BssEntry[i].AtimWin; - - MAP_CHANNEL_ID_TO_KHZ(pAdapter->ScanTab.BssEntry[i].Channel, pBss->Configuration.DSConfig); - - if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_INFRA) - pBss->InfrastructureMode = Ndis802_11Infrastructure; - else - pBss->InfrastructureMode = Ndis802_11IBSS; - - NdisMoveMemory(pBss->SupportedRates, pAdapter->ScanTab.BssEntry[i].SupRate, pAdapter->ScanTab.BssEntry[i].SupRateLen); - NdisMoveMemory(pBss->SupportedRates + pAdapter->ScanTab.BssEntry[i].SupRateLen, - pAdapter->ScanTab.BssEntry[i].ExtRate, - pAdapter->ScanTab.BssEntry[i].ExtRateLen); - - if (pAdapter->ScanTab.BssEntry[i].VarIELen == 0) - { - pBss->IELength = sizeof(NDIS_802_11_FIXED_IEs); - NdisMoveMemory(pBss->IEs, &pAdapter->ScanTab.BssEntry[i].FixIEs, sizeof(NDIS_802_11_FIXED_IEs)); - pPtr = pPtr + sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs); - } - else - { - pBss->IELength = (ULONG)(sizeof(NDIS_802_11_FIXED_IEs) + pAdapter->ScanTab.BssEntry[i].VarIELen); - pPtr = pPtr + sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs); - NdisMoveMemory(pBss->IEs, &pAdapter->ScanTab.BssEntry[i].FixIEs, sizeof(NDIS_802_11_FIXED_IEs)); - NdisMoveMemory(pBss->IEs + sizeof(NDIS_802_11_FIXED_IEs), pAdapter->ScanTab.BssEntry[i].VarIEs, pAdapter->ScanTab.BssEntry[i].VarIELen); - pPtr += pAdapter->ScanTab.BssEntry[i].VarIELen; - } - pBss->Length = (ULONG)(sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs) + pAdapter->ScanTab.BssEntry[i].VarIELen + Padding); - -#if WIRELESS_EXT < 17 - if ((BssLen + pBss->Length) < wrq->u.data.length) - BssLen += pBss->Length; - else - { - pBssidList->NumberOfItems = i; - break; - } -#else - BssLen += pBss->Length; -#endif - } - -#if WIRELESS_EXT < 17 - wrq->u.data.length = BssLen; -#else - if (BssLen > wrq->u.data.length) - { - kfree(pBssidList); - return -E2BIG; - } - else - wrq->u.data.length = BssLen; -#endif - Status = copy_to_user(wrq->u.data.pointer, pBssidList, BssLen); - kfree(pBssidList); - break; - case OID_802_3_CURRENT_ADDRESS: - wrq->u.data.length = MAC_ADDR_LEN; - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CurrentAddress, wrq->u.data.length); - break; - case OID_GEN_MEDIA_CONNECT_STATUS: - if (pAdapter->IndicateMediaState == NdisMediaStateConnected) - MediaState = NdisMediaStateConnected; - else - MediaState = NdisMediaStateDisconnected; - - wrq->u.data.length = sizeof(NDIS_MEDIA_STATE); - Status = copy_to_user(wrq->u.data.pointer, &MediaState, wrq->u.data.length); - break; - case OID_802_11_BSSID: - if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) - { - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.Bssid, sizeof(NDIS_802_11_MAC_ADDRESS)); - - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID(=EMPTY)\n")); - Status = -ENOTCONN; - } - break; - case OID_802_11_SSID: - NdisZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); - NdisZeroMemory(Ssid.Ssid, MAX_LEN_OF_SSID); - Ssid.SsidLength = pAdapter->CommonCfg.SsidLen; - memcpy(Ssid.Ssid, pAdapter->CommonCfg.Ssid, Ssid.SsidLength); - wrq->u.data.length = sizeof(NDIS_802_11_SSID); - Status = copy_to_user(wrq->u.data.pointer, &Ssid, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_SSID (Len=%d, ssid=%s)\n", Ssid.SsidLength,Ssid.Ssid)); - break; - case RT_OID_802_11_QUERY_LINK_STATUS: - pLinkStatus = (RT_802_11_LINK_STATUS *) kmalloc(sizeof(RT_802_11_LINK_STATUS), MEM_ALLOC_FLAG); - if (pLinkStatus) - { - pLinkStatus->CurrTxRate = RateIdTo500Kbps[pAdapter->CommonCfg.TxRate]; // unit : 500 kbps - pLinkStatus->ChannelQuality = pAdapter->Mlme.ChannelQuality; - pLinkStatus->RxByteCount = pAdapter->RalinkCounters.ReceivedByteCount; - pLinkStatus->TxByteCount = pAdapter->RalinkCounters.TransmittedByteCount; - pLinkStatus->CentralChannel = pAdapter->CommonCfg.CentralChannel; - wrq->u.data.length = sizeof(RT_802_11_LINK_STATUS); - Status = copy_to_user(wrq->u.data.pointer, pLinkStatus, wrq->u.data.length); - kfree(pLinkStatus); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LINK_STATUS\n")); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LINK_STATUS(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case OID_802_11_CONFIGURATION: - pConfiguration = (NDIS_802_11_CONFIGURATION *) kmalloc(sizeof(NDIS_802_11_CONFIGURATION), MEM_ALLOC_FLAG); - if (pConfiguration) - { - pConfiguration->Length = sizeof(NDIS_802_11_CONFIGURATION); - pConfiguration->BeaconPeriod = pAdapter->CommonCfg.BeaconPeriod; - pConfiguration->ATIMWindow = pAdapter->StaActive.AtimWin; - MAP_CHANNEL_ID_TO_KHZ(pAdapter->CommonCfg.Channel, pConfiguration->DSConfig); - wrq->u.data.length = sizeof(NDIS_802_11_CONFIGURATION); - Status = copy_to_user(wrq->u.data.pointer, pConfiguration, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_CONFIGURATION(BeaconPeriod=%ld,AtimW=%ld,Channel=%d) \n", - pConfiguration->BeaconPeriod, pConfiguration->ATIMWindow, pAdapter->CommonCfg.Channel)); - kfree(pConfiguration); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_CONFIGURATION(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case RT_OID_802_11_SNR_0: - if ((pAdapter->StaCfg.LastSNR0 > 0)) - { - ulInfo = ((0xeb - pAdapter->StaCfg.LastSNR0) * 3) / 16 ; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_SNR_0(0x=%lx)\n", ulInfo)); - } - else - Status = -EFAULT; - break; - case RT_OID_802_11_SNR_1: - if ((pAdapter->Antenna.field.RxPath > 1) && - (pAdapter->StaCfg.LastSNR1 > 0)) - { - ulInfo = ((0xeb - pAdapter->StaCfg.LastSNR1) * 3) / 16 ; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE,("Query::RT_OID_802_11_SNR_1(0x=%lx)\n",ulInfo)); - } - else - Status = -EFAULT; - DBGPRINT(RT_DEBUG_TRACE,("Query::RT_OID_802_11_SNR_1(pAdapter->StaCfg.LastSNR1=%d)\n",pAdapter->StaCfg.LastSNR1)); - break; - case OID_802_11_RSSI_TRIGGER: - ulInfo = pAdapter->StaCfg.RssiSample.LastRssi0 - pAdapter->BbpRssiToDbmDelta; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_RSSI_TRIGGER(=%ld)\n", ulInfo)); - break; - case OID_802_11_RSSI: - case RT_OID_802_11_RSSI: - ulInfo = pAdapter->StaCfg.RssiSample.LastRssi0; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case RT_OID_802_11_RSSI_1: - ulInfo = pAdapter->StaCfg.RssiSample.LastRssi1; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case RT_OID_802_11_RSSI_2: - ulInfo = pAdapter->StaCfg.RssiSample.LastRssi2; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case OID_802_11_STATISTICS: - pStatistics = (NDIS_802_11_STATISTICS *) kmalloc(sizeof(NDIS_802_11_STATISTICS), MEM_ALLOC_FLAG); - if (pStatistics) - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_STATISTICS \n")); - // add the most up-to-date h/w raw counters into software counters - NICUpdateRawCounters(pAdapter); - - // Sanity check for calculation of sucessful count - if (pAdapter->WlanCounters.TransmittedFragmentCount.QuadPart < pAdapter->WlanCounters.RetryCount.QuadPart) - pAdapter->WlanCounters.TransmittedFragmentCount.QuadPart = pAdapter->WlanCounters.RetryCount.QuadPart; - - pStatistics->TransmittedFragmentCount.QuadPart = pAdapter->WlanCounters.TransmittedFragmentCount.QuadPart; - pStatistics->MulticastTransmittedFrameCount.QuadPart = pAdapter->WlanCounters.MulticastTransmittedFrameCount.QuadPart; - pStatistics->FailedCount.QuadPart = pAdapter->WlanCounters.FailedCount.QuadPart; - pStatistics->RetryCount.QuadPart = pAdapter->WlanCounters.RetryCount.QuadPart; - pStatistics->MultipleRetryCount.QuadPart = pAdapter->WlanCounters.MultipleRetryCount.QuadPart; - pStatistics->RTSSuccessCount.QuadPart = pAdapter->WlanCounters.RTSSuccessCount.QuadPart; - pStatistics->RTSFailureCount.QuadPart = pAdapter->WlanCounters.RTSFailureCount.QuadPart; - pStatistics->ACKFailureCount.QuadPart = pAdapter->WlanCounters.ACKFailureCount.QuadPart; - pStatistics->FrameDuplicateCount.QuadPart = pAdapter->WlanCounters.FrameDuplicateCount.QuadPart; - pStatistics->ReceivedFragmentCount.QuadPart = pAdapter->WlanCounters.ReceivedFragmentCount.QuadPart; - pStatistics->MulticastReceivedFrameCount.QuadPart = pAdapter->WlanCounters.MulticastReceivedFrameCount.QuadPart; -#ifdef DBG - pStatistics->FCSErrorCount = pAdapter->RalinkCounters.RealFcsErrCount; -#else - pStatistics->FCSErrorCount.QuadPart = pAdapter->WlanCounters.FCSErrorCount.QuadPart; - pStatistics->FrameDuplicateCount.u.LowPart = pAdapter->WlanCounters.FrameDuplicateCount.u.LowPart / 100; -#endif - wrq->u.data.length = sizeof(NDIS_802_11_STATISTICS); - Status = copy_to_user(wrq->u.data.pointer, pStatistics, wrq->u.data.length); - kfree(pStatistics); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_STATISTICS(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case OID_GEN_RCV_OK: - ulInfo = pAdapter->Counters8023.GoodReceives; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case OID_GEN_RCV_NO_BUFFER: - ulInfo = pAdapter->Counters8023.RxNoBuffer; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case RT_OID_802_11_PHY_MODE: - ulInfo = (ULONG)pAdapter->CommonCfg.PhyMode; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PHY_MODE (=%ld)\n", ulInfo)); - break; - case RT_OID_802_11_STA_CONFIG: - pStaConfig = (RT_802_11_STA_CONFIG *) kmalloc(sizeof(RT_802_11_STA_CONFIG), MEM_ALLOC_FLAG); - if (pStaConfig) - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG\n")); - pStaConfig->EnableTxBurst = pAdapter->CommonCfg.bEnableTxBurst; - pStaConfig->EnableTurboRate = 0; - pStaConfig->UseBGProtection = pAdapter->CommonCfg.UseBGProtection; - pStaConfig->UseShortSlotTime = pAdapter->CommonCfg.bUseShortSlotTime; - //pStaConfig->AdhocMode = pAdapter->StaCfg.AdhocMode; - pStaConfig->HwRadioStatus = (pAdapter->StaCfg.bHwRadio == TRUE) ? 1 : 0; - pStaConfig->Rsv1 = 0; - pStaConfig->SystemErrorBitmap = pAdapter->SystemErrorBitmap; - wrq->u.data.length = sizeof(RT_802_11_STA_CONFIG); - Status = copy_to_user(wrq->u.data.pointer, pStaConfig, wrq->u.data.length); - kfree(pStaConfig); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case OID_802_11_RTS_THRESHOLD: - RtsThresh = pAdapter->CommonCfg.RtsThreshold; - wrq->u.data.length = sizeof(RtsThresh); - Status = copy_to_user(wrq->u.data.pointer, &RtsThresh, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_RTS_THRESHOLD(=%ld)\n", RtsThresh)); - break; - case OID_802_11_FRAGMENTATION_THRESHOLD: - FragThresh = pAdapter->CommonCfg.FragmentThreshold; - if (pAdapter->CommonCfg.bUseZeroToDisableFragment == TRUE) - FragThresh = 0; - wrq->u.data.length = sizeof(FragThresh); - Status = copy_to_user(wrq->u.data.pointer, &FragThresh, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_FRAGMENTATION_THRESHOLD(=%ld)\n", FragThresh)); - break; - case OID_802_11_POWER_MODE: - PowerMode = pAdapter->StaCfg.WindowsPowerMode; - wrq->u.data.length = sizeof(PowerMode); - Status = copy_to_user(wrq->u.data.pointer, &PowerMode, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_POWER_MODE(=%d)\n", PowerMode)); - break; - case RT_OID_802_11_RADIO: - RadioState = (BOOLEAN) pAdapter->StaCfg.bSwRadio; - wrq->u.data.length = sizeof(RadioState); - Status = copy_to_user(wrq->u.data.pointer, &RadioState, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_RADIO (=%d)\n", RadioState)); - break; - case OID_802_11_INFRASTRUCTURE_MODE: - if (pAdapter->StaCfg.BssType == BSS_ADHOC) - BssType = Ndis802_11IBSS; - else if (pAdapter->StaCfg.BssType == BSS_INFRA) - BssType = Ndis802_11Infrastructure; - else if (pAdapter->StaCfg.BssType == BSS_MONITOR) - BssType = Ndis802_11Monitor; - else - BssType = Ndis802_11AutoUnknown; - - wrq->u.data.length = sizeof(BssType); - Status = copy_to_user(wrq->u.data.pointer, &BssType, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_INFRASTRUCTURE_MODE(=%d)\n", BssType)); - break; - case RT_OID_802_11_PREAMBLE: - PreamType = pAdapter->CommonCfg.TxPreamble; - wrq->u.data.length = sizeof(PreamType); - Status = copy_to_user(wrq->u.data.pointer, &PreamType, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PREAMBLE(=%d)\n", PreamType)); - break; - case OID_802_11_AUTHENTICATION_MODE: - AuthMode = pAdapter->StaCfg.AuthMode; - wrq->u.data.length = sizeof(AuthMode); - Status = copy_to_user(wrq->u.data.pointer, &AuthMode, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_AUTHENTICATION_MODE(=%d)\n", AuthMode)); - break; - case OID_802_11_WEP_STATUS: - WepStatus = pAdapter->StaCfg.WepStatus; - wrq->u.data.length = sizeof(WepStatus); - Status = copy_to_user(wrq->u.data.pointer, &WepStatus, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_WEP_STATUS(=%d)\n", WepStatus)); - break; - case OID_802_11_TX_POWER_LEVEL: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.TxPower, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_TX_POWER_LEVEL %x\n",pAdapter->CommonCfg.TxPower)); - break; - case RT_OID_802_11_TX_POWER_LEVEL_1: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.TxPowerPercentage, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_TX_POWER_LEVEL_1 (=%ld)\n", pAdapter->CommonCfg.TxPowerPercentage)); - break; - case OID_802_11_NETWORK_TYPES_SUPPORTED: - if ((pAdapter->RfIcType == RFIC_2850) || (pAdapter->RfIcType == RFIC_2750)) - { - NetworkTypeList[0] = 3; // NumberOfItems = 3 - NetworkTypeList[1] = Ndis802_11DS; // NetworkType[1] = 11b - NetworkTypeList[2] = Ndis802_11OFDM24; // NetworkType[2] = 11g - NetworkTypeList[3] = Ndis802_11OFDM5; // NetworkType[3] = 11a - wrq->u.data.length = 16; - Status = copy_to_user(wrq->u.data.pointer, &NetworkTypeList[0], wrq->u.data.length); - } - else - { - NetworkTypeList[0] = 2; // NumberOfItems = 2 - NetworkTypeList[1] = Ndis802_11DS; // NetworkType[1] = 11b - NetworkTypeList[2] = Ndis802_11OFDM24; // NetworkType[2] = 11g - wrq->u.data.length = 12; - Status = copy_to_user(wrq->u.data.pointer, &NetworkTypeList[0], wrq->u.data.length); - } - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_NETWORK_TYPES_SUPPORTED\n")); - break; - case OID_802_11_NETWORK_TYPE_IN_USE: - wrq->u.data.length = sizeof(ULONG); - if (pAdapter->CommonCfg.PhyMode == PHY_11A) - ulInfo = Ndis802_11OFDM5; - else if ((pAdapter->CommonCfg.PhyMode == PHY_11BG_MIXED) || (pAdapter->CommonCfg.PhyMode == PHY_11G)) - ulInfo = Ndis802_11OFDM24; - else - ulInfo = Ndis802_11DS; - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case RT_OID_802_11_QUERY_LAST_RX_RATE: - ulInfo = (ULONG)pAdapter->LastRxRate; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LAST_RX_RATE (=%ld)\n", ulInfo)); - break; - case RT_OID_802_11_QUERY_LAST_TX_RATE: - //ulInfo = (ULONG)pAdapter->LastTxRate; - ulInfo = (ULONG)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.word; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LAST_TX_RATE (=%lx)\n", ulInfo)); - break; - case RT_OID_802_11_QUERY_EEPROM_VERSION: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->EepromVersion, wrq->u.data.length); - break; - case RT_OID_802_11_QUERY_FIRMWARE_VERSION: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->FirmwareVersion, wrq->u.data.length); - break; - case RT_OID_802_11_QUERY_NOISE_LEVEL: - wrq->u.data.length = sizeof(UCHAR); - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->BbpWriteLatch[66], wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_NOISE_LEVEL (=%d)\n", pAdapter->BbpWriteLatch[66])); - break; - case RT_OID_802_11_EXTRA_INFO: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->ExtraInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_EXTRA_INFO (=%ld)\n", pAdapter->ExtraInfo)); - break; - case RT_OID_WE_VERSION_COMPILED: - wrq->u.data.length = sizeof(UINT); - we_version_compiled = WIRELESS_EXT; - Status = copy_to_user(wrq->u.data.pointer, &we_version_compiled, wrq->u.data.length); - break; - case RT_OID_802_11_QUERY_APSD_SETTING: - apsd = (pAdapter->CommonCfg.bAPSDCapable | (pAdapter->CommonCfg.bAPSDAC_BE << 1) | (pAdapter->CommonCfg.bAPSDAC_BK << 2) - | (pAdapter->CommonCfg.bAPSDAC_VI << 3) | (pAdapter->CommonCfg.bAPSDAC_VO << 4) | (pAdapter->CommonCfg.MaxSPLength << 5)); - - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &apsd, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_APSD_SETTING (=0x%lx,APSDCap=%d,AC_BE=%d,AC_BK=%d,AC_VI=%d,AC_VO=%d,MAXSPLen=%d)\n", - apsd,pAdapter->CommonCfg.bAPSDCapable,pAdapter->CommonCfg.bAPSDAC_BE,pAdapter->CommonCfg.bAPSDAC_BK,pAdapter->CommonCfg.bAPSDAC_VI,pAdapter->CommonCfg.bAPSDAC_VO,pAdapter->CommonCfg.MaxSPLength)); - break; - case RT_OID_802_11_QUERY_APSD_PSM: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.bAPSDForcePowerSave, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_APSD_PSM (=%d)\n", pAdapter->CommonCfg.bAPSDForcePowerSave)); - break; - case RT_OID_802_11_QUERY_WMM: - wrq->u.data.length = sizeof(BOOLEAN); - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.bWmmCapable, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_WMM (=%d)\n", pAdapter->CommonCfg.bWmmCapable)); - break; - case RT_OID_NEW_DRIVER: - { - UCHAR enabled = 1; - wrq->u.data.length = sizeof(UCHAR); - Status = copy_to_user(wrq->u.data.pointer, &enabled, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_NEW_DRIVER (=%d)\n", enabled)); - } - break; - case RT_OID_WPA_SUPPLICANT_SUPPORT: - wrq->u.data.length = sizeof(UCHAR); - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->StaCfg.WpaSupplicantUP, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_WPA_SUPPLICANT_SUPPORT (=%d)\n", pAdapter->StaCfg.WpaSupplicantUP)); - break; - case RT_OID_DRIVER_DEVICE_NAME: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_DRIVER_DEVICE_NAME \n")); - wrq->u.data.length = 16; - if (copy_to_user(wrq->u.data.pointer, pAdapter->StaCfg.dev_name, wrq->u.data.length)) - { - Status = -EFAULT; - } - break; - case RT_OID_802_11_QUERY_HT_PHYMODE: - pHTPhyMode = (OID_SET_HT_PHYMODE *) kmalloc(sizeof(OID_SET_HT_PHYMODE), MEM_ALLOC_FLAG); - if (pHTPhyMode) - { - pHTPhyMode->PhyMode = pAdapter->CommonCfg.PhyMode; - pHTPhyMode->HtMode = (UCHAR)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE; - pHTPhyMode->BW = (UCHAR)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.field.BW; - pHTPhyMode->MCS= (UCHAR)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.field.MCS; - pHTPhyMode->SHORTGI= (UCHAR)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.field.ShortGI; - pHTPhyMode->STBC= (UCHAR)pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.field.STBC; - - pHTPhyMode->ExtOffset = ((pAdapter->CommonCfg.CentralChannel < pAdapter->CommonCfg.Channel) ? (EXTCHA_BELOW) : (EXTCHA_ABOVE)); - wrq->u.data.length = sizeof(OID_SET_HT_PHYMODE); - if (copy_to_user(wrq->u.data.pointer, pHTPhyMode, wrq->u.data.length)) - { - Status = -EFAULT; - } - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_HT_PHYMODE (PhyMode = %d, MCS =%d, BW = %d, STBC = %d, ExtOffset=%d)\n", - pHTPhyMode->HtMode, pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->ExtOffset)); - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (.word = %x )\n", pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.word)); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case RT_OID_802_11_COUNTRY_REGION: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_COUNTRY_REGION \n")); - wrq->u.data.length = sizeof(ulInfo); - ulInfo = pAdapter->CommonCfg.CountryRegionForABand; - ulInfo = (ulInfo << 8)|(pAdapter->CommonCfg.CountryRegion); - if (copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length)) - { - Status = -EFAULT; - } - break; - case RT_OID_802_11_QUERY_DAT_HT_PHYMODE: - pHTPhyMode = (OID_SET_HT_PHYMODE *) kmalloc(sizeof(OID_SET_HT_PHYMODE), MEM_ALLOC_FLAG); - if (pHTPhyMode) - { - pHTPhyMode->PhyMode = pAdapter->CommonCfg.PhyMode; - pHTPhyMode->HtMode = (UCHAR)pAdapter->CommonCfg.RegTransmitSetting.field.HTMODE; - pHTPhyMode->BW = (UCHAR)pAdapter->CommonCfg.RegTransmitSetting.field.BW; - pHTPhyMode->MCS= (UCHAR)pAdapter->StaCfg.DesiredTransmitSetting.field.MCS; - pHTPhyMode->SHORTGI= (UCHAR)pAdapter->CommonCfg.RegTransmitSetting.field.ShortGI; - pHTPhyMode->STBC= (UCHAR)pAdapter->CommonCfg.RegTransmitSetting.field.STBC; - - wrq->u.data.length = sizeof(OID_SET_HT_PHYMODE); - if (copy_to_user(wrq->u.data.pointer, pHTPhyMode, wrq->u.data.length)) - { - Status = -EFAULT; - } - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_HT_PHYMODE (PhyMode = %d, MCS =%d, BW = %d, STBC = %d, ExtOffset=%d)\n", - pHTPhyMode->HtMode, pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->ExtOffset)); - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (.word = %x )\n", pAdapter->MacTab.Content[BSSID_WCID].HTPhyMode.word)); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case RT_OID_QUERY_MULTIPLE_CARD_SUPPORT: - wrq->u.data.length = sizeof(UCHAR); - i = 0; - if (copy_to_user(wrq->u.data.pointer, &i, wrq->u.data.length)) - { - Status = -EFAULT; - } - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_QUERY_MULTIPLE_CARD_SUPPORT(=%d) \n", i)); - break; - - case OID_802_11_BUILD_CHANNEL_EX: - { - UCHAR value; - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BUILD_CHANNEL_EX \n")); - wrq->u.data.length = sizeof(UCHAR); - DBGPRINT(RT_DEBUG_TRACE, ("Doesn't support EXT_BUILD_CHANNEL_LIST.\n")); - value = 0; - Status = copy_to_user(wrq->u.data.pointer, &value, 1); - DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); - } - break; - - case OID_802_11_GET_CH_LIST: - { - PRT_CHANNEL_LIST_INFO pChListBuf; - - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_CH_LIST \n")); - if (pAdapter->ChannelListNum == 0) - { - wrq->u.data.length = 0; - break; - } - - pChListBuf = (RT_CHANNEL_LIST_INFO *) kmalloc(sizeof(RT_CHANNEL_LIST_INFO), MEM_ALLOC_FLAG); - if (pChListBuf == NULL) - { - wrq->u.data.length = 0; - break; - } - - pChListBuf->ChannelListNum = pAdapter->ChannelListNum; - for (i = 0; i < pChListBuf->ChannelListNum; i++) - pChListBuf->ChannelList[i] = pAdapter->ChannelList[i].Channel; - - wrq->u.data.length = sizeof(RT_CHANNEL_LIST_INFO); - Status = copy_to_user(wrq->u.data.pointer, pChListBuf, sizeof(RT_CHANNEL_LIST_INFO)); - DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); - - if (pChListBuf) - kfree(pChListBuf); - } - break; - - case OID_802_11_GET_COUNTRY_CODE: - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_COUNTRY_CODE \n")); - wrq->u.data.length = 2; - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.CountryCode, 2); - DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); - break; - - case OID_802_11_GET_CHANNEL_GEOGRAPHY: - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_CHANNEL_GEOGRAPHY \n")); - wrq->u.data.length = 1; - Status = copy_to_user(wrq->u.data.pointer, &pAdapter->CommonCfg.Geography, 1); - DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); - break; - - default: - DBGPRINT(RT_DEBUG_TRACE, ("Query::unknown IOCTL's subcmd = 0x%08x\n", cmd)); - Status = -EOPNOTSUPP; - break; - } - return Status; -} - INT rt28xx_sta_ioctl( IN struct net_device *net_dev, IN OUT struct ifreq *rq, IN INT cmd) { - POS_COOKIE pObj; - VIRTUAL_ADAPTER *pVirtualAd = NULL; - RTMP_ADAPTER *pAd = NULL; + RTMP_ADAPTER *pAd = net_dev->ml_priv; + POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; struct iwreq *wrq = (struct iwreq *) rq; BOOLEAN StateMachineTouched = FALSE; INT Status = NDIS_STATUS_SUCCESS; - USHORT subcmd; - - if (net_dev->priv_flags == INT_MAIN) - { - pAd = net_dev->ml_priv; - } - else - { - pVirtualAd = net_dev->ml_priv; - pAd = pVirtualAd->RtmpDev->ml_priv; - } - pObj = (POS_COOKIE) pAd->OS_Cookie; - - if (pAd == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->ml_priv will be NULL in 2rd open */ - return -ENETDOWN; - } //check if the interface is down if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -5300,17 +2834,9 @@ INT rt28xx_sta_ioctl( case SIOCGIWRANGE: //Get range of parameters case SIOCGIWRETRY: //get retry limits and lifetime case SIOCSIWRETRY: //set retry limits and lifetime - Status = -EOPNOTSUPP; - break; case RT_PRIV_IOCTL: -#ifdef RT30xx - case RT_PRIV_IOCTL_EXT: -#endif - subcmd = wrq->u.data.flags; - if( subcmd & OID_GET_SET_TOGGLE) - Status = RTMPSetInformation(pAd, rq, subcmd); - else - Status = RTMPQueryInformation(pAd, rq, subcmd); + case RT_PRIV_IOCTL_EXT: + Status = -EOPNOTSUPP; break; case SIOCGIWPRIV: if (wrq->u.data.pointer) @@ -5330,19 +2856,6 @@ INT rt28xx_sta_ioctl( case RTPRIV_IOCTL_GSITESURVEY: RTMPIoctlGetSiteSurvey(pAd, wrq); break; -#ifdef DBG - case RTPRIV_IOCTL_MAC: - RTMPIoctlMAC(pAd, wrq); - break; - case RTPRIV_IOCTL_E2P: - RTMPIoctlE2PROM(pAd, wrq); - break; -#ifdef RT30xx - case RTPRIV_IOCTL_RF: - RTMPIoctlRF(pAd, wrq); - break; -#endif // RT30xx // -#endif // DBG // case SIOCETHTOOL: break; default: @@ -6241,592 +3754,6 @@ INT Set_Wpa_Support( return TRUE; } -#ifdef DBG -/* - ========================================================================== - Description: - Read / Write MAC - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 mac 0 ==> read MAC where Addr=0x0 - 2.) iwpriv ra0 mac 0=12 ==> write MAC where Addr=0x0, value=12 - ========================================================================== -*/ -VOID RTMPIoctlMAC( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq) -{ - CHAR *this_char; - CHAR *value; - INT j = 0, k = 0; - CHAR msg[1024]; - CHAR arg[255]; - ULONG macAddr = 0; - UCHAR temp[16], temp2[16]; - UINT32 macValue = 0; - INT Status; -#ifdef RT30xx - BOOLEAN bIsPrintAllMAC = FALSE; -#endif - - memset(msg, 0x00, 1024); - if (wrq->u.data.length > 1) //No parameters. - { - Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length); - sprintf(msg, "\n"); - - //Parsing Read or Write - this_char = arg; - if (!*this_char) - goto next; - - if ((value = rtstrchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value || !*value) - { //Read - // Sanity check - if(strlen(this_char) > 4) - goto next; - - j = strlen(this_char); - while(j-- > 0) - { - if(this_char[j] > 'f' || this_char[j] < '0') - return; - } - - // Mac Addr - k = j = strlen(this_char); - while(j-- > 0) - { - this_char[4-k+j] = this_char[j]; - } - - while(k < 4) - this_char[3-k++]='0'; - this_char[4]='\0'; - - if(strlen(this_char) == 4) - { - AtoH(this_char, temp, 2); - macAddr = *temp*256 + temp[1]; - if (macAddr < 0xFFFF) - { - RTMP_IO_READ32(pAdapter, macAddr, &macValue); - DBGPRINT(RT_DEBUG_TRACE, ("MacAddr=%lx, MacValue=%x\n", macAddr, macValue)); - sprintf(msg+strlen(msg), "[0x%08lX]:%08X ", macAddr , macValue); - } - else -#ifndef RT30xx - {//Invalid parametes, so default printk all bbp -#endif -#ifdef RT30xx - {//Invalid parametes, so default printk all mac - bIsPrintAllMAC = TRUE; -#endif - goto next; - } - } - } - else - { //Write - memcpy(&temp2, value, strlen(value)); - temp2[strlen(value)] = '\0'; - - // Sanity check - if((strlen(this_char) > 4) || strlen(temp2) > 8) - goto next; - - j = strlen(this_char); - while(j-- > 0) - { - if(this_char[j] > 'f' || this_char[j] < '0') - return; - } - - j = strlen(temp2); - while(j-- > 0) - { - if(temp2[j] > 'f' || temp2[j] < '0') - return; - } - - //MAC Addr - k = j = strlen(this_char); - while(j-- > 0) - { - this_char[4-k+j] = this_char[j]; - } - - while(k < 4) - this_char[3-k++]='0'; - this_char[4]='\0'; - - //MAC value - k = j = strlen(temp2); - while(j-- > 0) - { - temp2[8-k+j] = temp2[j]; - } - - while(k < 8) - temp2[7-k++]='0'; - temp2[8]='\0'; - - { - AtoH(this_char, temp, 2); - macAddr = *temp*256 + temp[1]; - - AtoH(temp2, temp, 4); - macValue = *temp*256*256*256 + temp[1]*256*256 + temp[2]*256 + temp[3]; - - // debug mode - if (macAddr == (HW_DEBUG_SETTING_BASE + 4)) - { - // 0x2bf4: byte0 non-zero: enable R17 tuning, 0: disable R17 tuning - if (macValue & 0x000000ff) - { - pAdapter->BbpTuning.bEnable = TRUE; - DBGPRINT(RT_DEBUG_TRACE,("turn on R17 tuning\n")); - } - else - { - UCHAR R66; - pAdapter->BbpTuning.bEnable = FALSE; - R66 = 0x26 + GET_LNA_GAIN(pAdapter); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R66, (0x26 + GET_LNA_GAIN(pAdapter))); - DBGPRINT(RT_DEBUG_TRACE,("turn off R17 tuning, restore to 0x%02x\n", R66)); - } - return; - } - - DBGPRINT(RT_DEBUG_TRACE, ("MacAddr=%02lx, MacValue=0x%x\n", macAddr, macValue)); - - RTMP_IO_WRITE32(pAdapter, macAddr, macValue); - sprintf(msg+strlen(msg), "[0x%08lX]:%08X ", macAddr, macValue); - } - } - } -#ifdef RT30xx - else - bIsPrintAllMAC = TRUE; -#endif -next: -#ifdef RT30xx - if (bIsPrintAllMAC) - { - struct file *file_w; - PCHAR fileName = "MacDump.txt"; - mm_segment_t orig_fs; - - orig_fs = get_fs(); - set_fs(KERNEL_DS); - - // open file - file_w = filp_open(fileName, O_WRONLY|O_CREAT, 0); - if (IS_ERR(file_w)) - { - DBGPRINT(RT_DEBUG_TRACE, ("-->2) %s: Error %ld opening %s\n", __func__, -PTR_ERR(file_w), fileName)); - } - else - { - if (file_w->f_op && file_w->f_op->write) - { - file_w->f_pos = 0; - macAddr = 0x1000; - - while (macAddr <= 0x1800) - { - RTMP_IO_READ32(pAdapter, macAddr, &macValue); - sprintf(msg, "%08lx = %08X\n", macAddr, macValue); - - // write data to file - file_w->f_op->write(file_w, msg, strlen(msg), &file_w->f_pos); - - printk("%s", msg); - macAddr += 4; - } - sprintf(msg, "\nDump all MAC values to %s\n", fileName); - } - filp_close(file_w, NULL); - } - set_fs(orig_fs); - } -#endif /* RT30xx */ - if(strlen(msg) == 1) - sprintf(msg+strlen(msg), "===>Error command format!"); - - // Copy the information into the user buffer - wrq->u.data.length = strlen(msg); - Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); - - DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlMAC\n\n")); -} - -/* - ========================================================================== - Description: - Read / Write E2PROM - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 e2p 0 ==> read E2PROM where Addr=0x0 - 2.) iwpriv ra0 e2p 0=1234 ==> write E2PROM where Addr=0x0, value=1234 - ========================================================================== -*/ -VOID RTMPIoctlE2PROM( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq) -{ - CHAR *this_char; - CHAR *value; - INT j = 0, k = 0; - CHAR msg[1024]; - CHAR arg[255]; - USHORT eepAddr = 0; - UCHAR temp[16], temp2[16]; - USHORT eepValue; - int Status; -#ifdef RT30xx - BOOLEAN bIsPrintAllE2P = FALSE; -#endif - - memset(msg, 0x00, 1024); - if (wrq->u.data.length > 1) //No parameters. - { - Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length); - sprintf(msg, "\n"); - - //Parsing Read or Write - this_char = arg; - - - if (!*this_char) - goto next; - - if ((value = rtstrchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value || !*value) - { //Read - - // Sanity check - if(strlen(this_char) > 4) - goto next; - - j = strlen(this_char); - while(j-- > 0) - { - if(this_char[j] > 'f' || this_char[j] < '0') - return; - } - - // E2PROM addr - k = j = strlen(this_char); - while(j-- > 0) - { - this_char[4-k+j] = this_char[j]; - } - - while(k < 4) - this_char[3-k++]='0'; - this_char[4]='\0'; - - if(strlen(this_char) == 4) - { - AtoH(this_char, temp, 2); - eepAddr = *temp*256 + temp[1]; - if (eepAddr < 0xFFFF) - { - RT28xx_EEPROM_READ16(pAdapter, eepAddr, eepValue); - sprintf(msg+strlen(msg), "[0x%04X]:0x%04X ", eepAddr , eepValue); - } - else - {//Invalid parametes, so default printk all bbp -#ifdef RT30xx - bIsPrintAllE2P = TRUE; -#endif - goto next; - } - } - } - else - { //Write - memcpy(&temp2, value, strlen(value)); - temp2[strlen(value)] = '\0'; - - // Sanity check - if((strlen(this_char) > 4) || strlen(temp2) > 8) - goto next; - - j = strlen(this_char); - while(j-- > 0) - { - if(this_char[j] > 'f' || this_char[j] < '0') - return; - } - j = strlen(temp2); - while(j-- > 0) - { - if(temp2[j] > 'f' || temp2[j] < '0') - return; - } - - //MAC Addr - k = j = strlen(this_char); - while(j-- > 0) - { - this_char[4-k+j] = this_char[j]; - } - - while(k < 4) - this_char[3-k++]='0'; - this_char[4]='\0'; - - //MAC value - k = j = strlen(temp2); - while(j-- > 0) - { - temp2[4-k+j] = temp2[j]; - } - - while(k < 4) - temp2[3-k++]='0'; - temp2[4]='\0'; - - AtoH(this_char, temp, 2); - eepAddr = *temp*256 + temp[1]; - - AtoH(temp2, temp, 2); - eepValue = *temp*256 + temp[1]; - - RT28xx_EEPROM_WRITE16(pAdapter, eepAddr, eepValue); - sprintf(msg+strlen(msg), "[0x%02X]:%02X ", eepAddr, eepValue); - } - } -#ifdef RT30xx - else - bIsPrintAllE2P = TRUE; -#endif -next: -#ifdef RT30xx - if (bIsPrintAllE2P) - { - struct file *file_w; - PCHAR fileName = "EEPROMDump.txt"; - mm_segment_t orig_fs; - - orig_fs = get_fs(); - set_fs(KERNEL_DS); - - // open file - file_w = filp_open(fileName, O_WRONLY|O_CREAT, 0); - if (IS_ERR(file_w)) - { - DBGPRINT(RT_DEBUG_TRACE, ("-->2) %s: Error %ld opening %s\n", __func__, -PTR_ERR(file_w), fileName)); - } - else - { - if (file_w->f_op && file_w->f_op->write) - { - file_w->f_pos = 0; - eepAddr = 0x00; - - while (eepAddr <= 0xFE) - { - RT28xx_EEPROM_READ16(pAdapter, eepAddr, eepValue); - sprintf(msg, "%08x = %04x\n", eepAddr , eepValue); - - // write data to file - file_w->f_op->write(file_w, msg, strlen(msg), &file_w->f_pos); - - printk("%s", msg); - eepAddr += 2; - } - sprintf(msg, "\nDump all EEPROM values to %s\n", fileName); - } - filp_close(file_w, NULL); - } - set_fs(orig_fs); - } -#endif /* RT30xx */ - if(strlen(msg) == 1) - sprintf(msg+strlen(msg), "===>Error command format!"); - - - // Copy the information into the user buffer - wrq->u.data.length = strlen(msg); - Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); - - DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlE2PROM\n")); -} -#ifdef RT30xx -/* - ========================================================================== - Description: - Read / Write RF register -Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 rf ==> read all RF registers - 2.) iwpriv ra0 rf 1 ==> read RF where RegID=1 - 3.) iwpriv ra0 rf 1=10 ==> write RF R1=0x10 - ========================================================================== -*/ -VOID RTMPIoctlRF( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq) -{ - CHAR *this_char; - CHAR *value; - UCHAR regRF = 0; - CHAR msg[2048]; - CHAR arg[255]; - INT rfId; - LONG rfValue; - int Status; - BOOLEAN bIsPrintAllRF = FALSE; - - - memset(msg, 0x00, 2048); - if (wrq->u.data.length > 1) //No parameters. - { - Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length); - sprintf(msg, "\n"); - - //Parsing Read or Write - this_char = arg; - if (!*this_char) - goto next; - - if ((value = strchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value || !*value) - { //Read - if (sscanf(this_char, "%d", &(rfId)) == 1) - { - if (rfId <= 31) - { - // In RT2860 ATE mode, we do not load 8051 firmware. - //We must access RF directly. - // For RT2870 ATE mode, ATE_RF_IO_WRITE8(/READ8)_BY_REG_ID are redefined. - // according to Andy, Gary, David require. - // the command rf shall read rf register directly for dubug. - // BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - RT30xxReadRFRegister(pAdapter, rfId, ®RF); - - sprintf(msg+strlen(msg), "R%02d[0x%02x]:%02X ", rfId, rfId*2, regRF); - } - else - {//Invalid parametes, so default printk all RF - bIsPrintAllRF = TRUE; - goto next; - } - } - else - { //Invalid parametes, so default printk all RF - bIsPrintAllRF = TRUE; - goto next; - } - } - else - { //Write - if ((sscanf(this_char, "%d", &(rfId)) == 1) && (sscanf(value, "%lx", &(rfValue)) == 1)) - { - if (rfId <= 31) - { - // In RT2860 ATE mode, we do not load 8051 firmware. - // We should access RF registers directly. - // For RT2870 ATE mode, ATE_RF_IO_WRITE8/READ8_BY_REG_ID are redefined. - { - // according to Andy, Gary, David require. - // the command RF shall read/write RF register directly for dubug. - //BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - //BBP_IO_WRITE8_BY_REG_ID(pAdapter, (UCHAR)bbpId,(UCHAR) bbpValue); - RT30xxReadRFRegister(pAdapter, rfId, ®RF); - RT30xxWriteRFRegister(pAdapter, (UCHAR)rfId,(UCHAR) rfValue); - //Read it back for showing - //BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - RT30xxReadRFRegister(pAdapter, rfId, ®RF); - sprintf(msg+strlen(msg), "R%02d[0x%02X]:%02X\n", rfId, rfId*2, regRF); - } - } - else - {//Invalid parametes, so default printk all RF - bIsPrintAllRF = TRUE; - } - } - else - { //Invalid parametes, so default printk all RF - bIsPrintAllRF = TRUE; - } - } - } - else - bIsPrintAllRF = TRUE; -next: - if (bIsPrintAllRF) - { - memset(msg, 0x00, 2048); - sprintf(msg, "\n"); - for (rfId = 0; rfId <= 31; rfId++) - { - // according to Andy, Gary, David require. - // the command RF shall read/write RF register directly for dubug. - RT30xxReadRFRegister(pAdapter, rfId, ®RF); - sprintf(msg+strlen(msg), "%03d = %02X\n", rfId, regRF); - } - // Copy the information into the user buffer - DBGPRINT(RT_DEBUG_TRACE, ("strlen(msg)=%d\n", (UINT32)strlen(msg))); - wrq->u.data.length = strlen(msg); - if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length)) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__)); - } - } - else - { - if(strlen(msg) == 1) - sprintf(msg+strlen(msg), "===>Error command format!"); - - DBGPRINT(RT_DEBUG_TRACE, ("copy to user [msg=%s]\n", msg)); - // Copy the information into the user buffer - DBGPRINT(RT_DEBUG_TRACE, ("strlen(msg) =%d\n", (UINT32)strlen(msg))); - - // Copy the information into the user buffer - wrq->u.data.length = strlen(msg); - Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); - } - - DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlRF\n\n")); -} -#endif // RT30xx // -#endif // DBG // - - - - INT Set_TGnWifiTest_Proc( IN PRTMP_ADAPTER pAd, IN PUCHAR arg) @@ -6867,48 +3794,3 @@ INT Set_ShortRetryLimit_Proc( DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); return TRUE; } - -#if !defined(RT2860) && !defined(RT30xx) -INT Show_Adhoc_MacTable_Proc( - IN PRTMP_ADAPTER pAd, - IN PCHAR 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; -} -#endif /* RT2870 */ diff --git a/drivers/staging/rt2860/wpa.h b/drivers/staging/rt2860/wpa.h index e6716748adf..7006e389e32 100644 --- a/drivers/staging/rt2860/wpa.h +++ b/drivers/staging/rt2860/wpa.h @@ -90,9 +90,6 @@ #define TKIP_AP_RXMICK_OFFSET (TKIP_AP_TXMICK_OFFSET+LEN_TKIP_TXMICK) #define TKIP_GTK_LENGTH ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK)) #define LEN_PTK ((LEN_EAP_KEY)+(LEN_TKIP_KEY)) -#ifndef RT30xx -#define MIN_LEN_OF_GTK 5 -#endif // RSN IE Length definition #define MAX_LEN_OF_RSNIE 90 |