diff options
Diffstat (limited to 'drivers/staging/vt6655/wcmd.c')
-rw-r--r-- | drivers/staging/vt6655/wcmd.c | 126 |
1 files changed, 49 insertions, 77 deletions
diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c index 72caaa203ddc..a689645fa012 100644 --- a/drivers/staging/vt6655/wcmd.c +++ b/drivers/staging/vt6655/wcmd.c @@ -60,7 +60,6 @@ /*--------------------- Static Variables --------------------------*/ static int msglevel = MSG_LEVEL_INFO; -//static int msglevel =MSG_LEVEL_DEBUG; /*--------------------- Static Functions --------------------------*/ static @@ -128,14 +127,13 @@ vAdHocBeaconStop(PSDevice pDevice) (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { bStop = true; } - if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) { + if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) bStop = true; - } + } - if (bStop) { + if (bStop) MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX); - } } /* vAdHocBeaconStop */ /* @@ -197,13 +195,13 @@ s_vProbeChannel( PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int ii; - if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { + if (pDevice->eCurrentPHYType == PHY_TYPE_11A) pbyRate = &abyCurrSuppRatesA[0]; - } else if (pDevice->eCurrentPHYType == PHY_TYPE_11B) { + else if (pDevice->eCurrentPHYType == PHY_TYPE_11B) pbyRate = &abyCurrSuppRatesB[0]; - } else { + else pbyRate = &abyCurrSuppRatesG[0]; - } + // build an assocreq frame and send it pTxPacket = s_MgrMakeProbeRequest ( @@ -217,11 +215,10 @@ s_vProbeChannel( if (pTxPacket != NULL) { for (ii = 0; ii < 2; ii++) { - if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { + if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n"); - } else { + else DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n"); - } } } } @@ -360,11 +357,11 @@ vCommandTimer( // Set channel back set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); - if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC); - } else { + else CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE); - } + vAdHocBeaconRestart(pDevice); s_bCommandComplete(pDevice); @@ -377,7 +374,6 @@ vCommandTimer( return; } if (pMgmt->uScanChannel == pDevice->byMinChannel) { - //pMgmt->eScanType = WMAC_SCAN_ACTIVE; pMgmt->abyScanBSSID[0] = 0xFF; pMgmt->abyScanBSSID[1] = 0xFF; pMgmt->abyScanBSSID[2] = 0xFF; @@ -385,19 +381,17 @@ vCommandTimer( pMgmt->abyScanBSSID[4] = 0xFF; pMgmt->abyScanBSSID[5] = 0xFF; pItemSSID->byElementID = WLAN_EID_SSID; - // clear bssid list - // BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); pMgmt->eScanState = WMAC_IS_SCANNING; } vAdHocBeaconStop(pDevice); - if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel)) { + if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel)) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SCAN Channel: %d\n", pMgmt->uScanChannel); - } else { + else DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel); - } + CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_UNKNOWN); pMgmt->uScanChannel++; //2008-8-4 <modify> by chester @@ -430,11 +424,10 @@ vCommandTimer( // Set channel back set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); - if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC); - } else { + else CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE); - } pMgmt->eScanState = WMAC_NO_SCANNING; vAdHocBeaconRestart(pDevice); @@ -468,7 +461,6 @@ vCommandTimer( memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->sNodeDBTable[0].bActive = false; -// pDevice->bBeaconBufReady = false; } netif_stop_queue(pDevice->dev); pDevice->eCommandState = WLAN_DISASSOCIATE_WAIT; @@ -480,7 +472,6 @@ vCommandTimer( } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " CARDbRadioPowerOff\n"); //2008-09-02 <mark> by chester - // CARDbRadioPowerOff(pDevice); s_bCommandComplete(pDevice); break; @@ -492,7 +483,6 @@ vCommandTimer( return; } //2008-09-02 <mark> by chester - // CARDbRadioPowerOff(pDevice); s_bCommandComplete(pDevice); break; @@ -504,8 +494,6 @@ vCommandTimer( return; } printk("chester-abyDesireSSID=%s\n", ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID); - //memcpy(pMgmt->abyAdHocSSID,pMgmt->abyDesireSSID, - //((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " cmd: desire ssid = %s\n", pItemSSID->abySSID); @@ -543,9 +531,9 @@ vCommandTimer( if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) { // Call mgr to begin the deauthentication // reason = (3) because sta has left ESS - if (pMgmt->eCurrState >= WMAC_STATE_AUTH) { + if (pMgmt->eCurrState >= WMAC_STATE_AUTH) vMgrDeAuthenBeginSta((void *)pDevice, pMgmt, pMgmt->abyCurrBSSID, (3), &Status); - } + // Call mgr to begin the authentication vMgrAuthenBeginSta((void *)pDevice, pMgmt, &Status); if (Status == CMD_STATUS_SUCCESS) { @@ -560,9 +548,9 @@ vCommandTimer( // if Adhoc mode else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { - if (netif_queue_stopped(pDevice->dev)) { + if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); - } + pDevice->bLinkPass = true; pMgmt->sNodeDBTable[0].bActive = true; @@ -571,9 +559,9 @@ vCommandTimer( } else { // start own IBSS vMgrCreateOwnIBSS((void *)pDevice, &Status); - if (Status != CMD_STATUS_SUCCESS) { + if (Status != CMD_STATUS_SUCCESS) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail ! \n"); - } + BSSvAddMulticastNode(pDevice); } } @@ -583,13 +571,13 @@ vCommandTimer( pMgmt->eConfigMode == WMAC_CONFIG_AUTO) { // start own IBSS vMgrCreateOwnIBSS((void *)pDevice, &Status); - if (Status != CMD_STATUS_SUCCESS) { + if (Status != CMD_STATUS_SUCCESS) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail ! \n"); - } + BSSvAddMulticastNode(pDevice); - if (netif_queue_stopped(pDevice->dev)) { + if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); - } + pDevice->bLinkPass = true; } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); @@ -641,12 +629,12 @@ vCommandTimer( case WLAN_ASSOCIATE_WAIT: if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCurrState == WMAC_STATE_ASSOC\n"); - if (pDevice->ePSMode != WMAC_POWER_CAM) { + if (pDevice->ePSMode != WMAC_POWER_CAM) PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval); - } - if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) { + + if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) KeybRemoveAllKey(&(pDevice->sKey), pDevice->abyBSSID, pDevice->PortOffset); - } + pDevice->bLinkPass = true; pDevice->byLinkWaitCount = 0; pDevice->byReAssocCount = 0; @@ -655,9 +643,9 @@ vCommandTimer( BBvSetFOE(pDevice->PortOffset); PSbSendNullPacket(pDevice); } - if (netif_queue_stopped(pDevice->dev)) { + if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); - } + #ifdef TxInSleep if (pDevice->IsTxDataTrigger) { //TxDataTimer is not triggered at the first time del_timer(&pDevice->sTimerTxData); @@ -667,8 +655,8 @@ vCommandTimer( pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback pDevice->fTxDataInSleep = false; pDevice->nTxDataTimeCout = 0; - } else { } + pDevice->IsTxDataTrigger = true; add_timer(&pDevice->sTimerTxData); #endif @@ -703,17 +691,17 @@ vCommandTimer( pDevice->bFixRate = false; vMgrCreateOwnIBSS((void *)pDevice, &Status); - if (Status != CMD_STATUS_SUCCESS) { + if (Status != CMD_STATUS_SUCCESS) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail ! \n"); - } + // alway turn off unicast bit MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_UNICAST); pDevice->byRxMode &= ~RCR_UNICAST; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode); BSSvAddMulticastNode(pDevice); - if (netif_queue_stopped(pDevice->dev)) { + if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); - } + pDevice->bLinkPass = true; add_timer(&pMgmt->sTimerSecondCallback); } @@ -730,9 +718,9 @@ vCommandTimer( } else { pDevice->bMoreData = true; } - if (!device_dma0_xmit(pDevice, skb, 0)) { + if (!device_dma0_xmit(pDevice, skb, 0)) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n"); - } + pMgmt->sNodeDBTable[0].wEnQueueCnt--; } } @@ -752,9 +740,9 @@ vCommandTimer( } else { pDevice->bMoreData = true; } - if (!device_dma0_xmit(pDevice, skb, ii)) { + if (!device_dma0_xmit(pDevice, skb, ii)) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n"); - } + pMgmt->sNodeDBTable[ii].wEnQueueCnt--; // check if sta ps enabled, and wait next pspoll. // if sta ps disable, then send all pending buffers. @@ -785,7 +773,6 @@ vCommandTimer( break; case WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE: - //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_CHECK_BBSENSITIVITY_START\n"); // wait all TD complete if (pDevice->iTDUsed[TYPE_AC0DMA] != 0) { vCommandTimerWait((void *)pDevice, 10); @@ -820,7 +807,6 @@ s_bCommandComplete( { PWLAN_IE_SSID pSSID; bool bRadioCmd = false; - //unsigned short wDeAuthenReason = 0; bool bForceSCAN = true; PSMgmtObject pMgmt = pDevice->pMgmt; @@ -842,19 +828,11 @@ s_bCommandComplete( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_BSSID_SCAN\n"); pDevice->eCommandState = WLAN_CMD_SCAN_START; pMgmt->uScanChannel = 0; - if (pSSID->len != 0) { + if (pSSID->len != 0) memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - } else { + else memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - } -/* - if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) { - if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && - (!memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { - pDevice->eCommandState = WLAN_CMD_IDLE; - } - } -*/ + break; case WLAN_CMD_SSID: pDevice->eCommandState = WLAN_CMD_SSID_START; @@ -900,9 +878,9 @@ bool bScheduleCommand( { PSDevice pDevice = (PSDevice)hDeviceContext; - if (pDevice->cbFreeCmdQueue == 0) { + if (pDevice->cbFreeCmdQueue == 0) return false; - } + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand; pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true; memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); @@ -923,11 +901,6 @@ bool bScheduleCommand( case WLAN_CMD_DISASSOCIATE: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0); break; -/* - case WLAN_CMD_DEAUTH: - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((unsigned short *)pbyItem0); - break; -*/ case WLAN_CMD_RX_PSPOLL: break; @@ -948,10 +921,9 @@ bool bScheduleCommand( ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); pDevice->cbFreeCmdQueue--; - if (!pDevice->bCmdRunning) { + if (!pDevice->bCmdRunning) s_bCommandComplete(pDevice); - } else { - } + return true; } |