/* ========================================================================== Description: Scan next channel ========================================================================== */ VOID ScanNextChannel( IN PRTMP_ADAPTER pAd, IN UCHAR OpMode) { UCHAR ScanType = pAd->MlmeAux.ScanType; UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; BOOLEAN ScanPending = FALSE; RALINK_TIMER_STRUCT *sc_timer; UINT stay_time = 0; #ifdef RALINK_ATE /* Nothing to do in ATE mode. */ if (ATE_ON(pAd)) return; #endif /* RALINK_ATE */ #ifdef CONFIG_STA_SUPPORT IF_DEV_CONFIG_OPMODE_ON_STA(pAd) { if (MONITOR_ON(pAd)) return; } ScanPending = ((pAd->StaCfg.bImprovedScan) && (pAd->StaCfg.ScanChannelCnt>=7)); #endif /* CONFIG_STA_SUPPORT */ #ifdef RT_CFG80211_SUPPORT #ifdef CONFIG_STA_SUPPORT if ( (pAd->pCfg80211ChanList != NULL) && (pAd->MlmeAux.Channel != 0)) { UINT32 ChanId; for ( ChanId = 0 ; ChanId <pAd->Cfg80211ChanListLan ; ChanId++ ) { if ( pAd->pCfg80211ChanList[ChanId] >= pAd->MlmeAux.Channel ) { pAd->MlmeAux.Channel = pAd->pCfg80211ChanList[ChanId]; break; } } } #endif /* CONFIG_STA_SUPPORT */ #endif /* RT_CFG80211_SUPPORT */ if ((pAd->MlmeAux.Channel == 0) || ScanPending) { scan_ch_restore(pAd, OpMode); } #ifdef RTMP_MAC_USB #ifdef CONFIG_STA_SUPPORT else if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) && (OpMode == OPMODE_STA)) { pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; MlmeCntlConfirm(pAd, MT2_SCAN_CONF, MLME_FAIL_NO_RESOURCE); } #endif /* CONFIG_STA_SUPPORT */ #endif /* RTMP_MAC_USB */ else { #ifdef CONFIG_STA_SUPPORT if (OpMode == OPMODE_STA) { /* BBP and RF are not accessible in PS mode, we has to wake them up first*/ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) AsicForceWakeup(pAd, TRUE); /* leave PSM during scanning. otherwise we may lost ProbeRsp & BEACON*/ if (pAd->StaCfg.Psm == PWR_SAVE) RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE); } #endif /* CONFIG_STA_SUPPORT */ AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, TRUE); AsicLockChannel(pAd, pAd->MlmeAux.Channel); #ifdef CONFIG_STA_SUPPORT if (OpMode == OPMODE_STA) { BOOLEAN bScanPassive = FALSE; if (pAd->MlmeAux.Channel > 14) { if ((pAd->CommonCfg.bIEEE80211H == 1) && RadarChannelCheck(pAd, pAd->MlmeAux.Channel)) bScanPassive = TRUE; } #ifdef CARRIER_DETECTION_SUPPORT if (pAd->CommonCfg.CarrierDetect.Enable == TRUE) bScanPassive = TRUE; #endif /* CARRIER_DETECTION_SUPPORT */ if (bScanPassive) { ScanType = SCAN_PASSIVE; ScanTimeIn5gChannel = MIN_CHANNEL_TIME; } } #endif /* CONFIG_STA_SUPPORT */ /* Check if channel if passive scan under current regulatory domain */ if (CHAN_PropertyCheck(pAd, pAd->MlmeAux.Channel, CHANNEL_PASSIVE_SCAN) == TRUE) ScanType = SCAN_PASSIVE; if (OpMode == OPMODE_AP) sc_timer = &pAd->MlmeAux.APScanTimer; else sc_timer = &pAd->MlmeAux.ScanTimer; /* We need to shorten active scan time in order for WZC connect issue */ /* Chnage the channel scan time for CISCO stuff based on its IAPP announcement */ if (ScanType == FAST_SCAN_ACTIVE) stay_time = FAST_ACTIVE_SCAN_TIME; else /* must be SCAN_PASSIVE or SCAN_ACTIVE*/ { #ifdef CONFIG_STA_SUPPORT pAd->StaCfg.ScanChannelCnt++; #endif /* CONFIG_STA_SUPPORT */ #ifdef CONFIG_AP_SUPPORT if ((OpMode == OPMODE_AP) && (pAd->ApCfg.bAutoChannelAtBootup)) stay_time = AUTO_CHANNEL_SEL_TIMEOUT; else #endif /* CONFIG_AP_SUPPORT */ if (WMODE_CAP_2G(pAd->CommonCfg.PhyMode) && WMODE_CAP_5G(pAd->CommonCfg.PhyMode)) { if (pAd->MlmeAux.Channel > 14) stay_time = ScanTimeIn5gChannel; else stay_time = MIN_CHANNEL_TIME; } else stay_time = MAX_CHANNEL_TIME; } RTMPSetTimer(sc_timer, stay_time); if (SCAN_MODE_ACT(ScanType)) { if (scan_active(pAd, OpMode, ScanType) == FALSE) return; } /* For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse*/ #ifdef CONFIG_STA_SUPPORT if (OpMode == OPMODE_STA) pAd->Mlme.SyncMachine.CurrState = SCAN_LISTEN; #endif /* CONFIG_STA_SUPPORT */ #ifdef CONFIG_AP_SUPPORT if (OpMode == OPMODE_AP) pAd->Mlme.ApSyncMachine.CurrState = AP_SCAN_LISTEN; #endif /* CONFIG_AP_SUPPORT */ } }
/* ========================================================================== Description: Scan next channel ========================================================================== */ VOID ScanNextChannel( IN PRTMP_ADAPTER pAd, IN UCHAR OpMode) { UCHAR ScanType = pAd->MlmeAux.ScanType; UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; BOOLEAN ScanPending = FALSE; RALINK_TIMER_STRUCT *sc_timer = NULL; UINT stay_time = 0; #ifdef RALINK_ATE /* Nothing to do in ATE mode. */ if (ATE_ON(pAd)) return; #endif /* RALINK_ATE */ #ifdef CONFIG_AP_SUPPORT ScanPending = ((pAd->ApCfg.bImprovedScan) && (pAd->ApCfg.ScanChannelCnt>=3));//7 #endif if ((pAd->MlmeAux.Channel == 0) || ScanPending) { scan_ch_restore(pAd, OpMode); } else { AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, TRUE); AsicLockChannel(pAd, pAd->MlmeAux.Channel); { BOOLEAN bScanPassive = FALSE; if (pAd->MlmeAux.Channel > 14) { if ((pAd->CommonCfg.bIEEE80211H == 1) && RadarChannelCheck(pAd, pAd->MlmeAux.Channel)) bScanPassive = TRUE; } #ifdef CARRIER_DETECTION_SUPPORT if (pAd->CommonCfg.CarrierDetect.Enable == TRUE) bScanPassive = TRUE; #endif /* CARRIER_DETECTION_SUPPORT */ if (bScanPassive) { ScanType = SCAN_PASSIVE; ScanTimeIn5gChannel = MIN_CHANNEL_TIME; } } /* Check if channel if passive scan under current regulatory domain */ if (CHAN_PropertyCheck(pAd, pAd->MlmeAux.Channel, CHANNEL_PASSIVE_SCAN) == TRUE) ScanType = SCAN_PASSIVE; if (OpMode == OPMODE_AP) sc_timer = &pAd->MlmeAux.APScanTimer; else sc_timer = &pAd->MlmeAux.ScanTimer; /* We need to shorten active scan time in order for WZC connect issue */ /* Chnage the channel scan time for CISCO stuff based on its IAPP announcement */ #ifdef CONFIG_AP_SUPPORT if (ScanType == FAST_SCAN_ACTIVE) { RTMPSetTimer(&pAd->MlmeAux.APScanTimer, MIN_CHANNEL_TIME);//Carter test MIN_CHANNEL_TIME instead of Fast_Scan_Time pAd->ApCfg.ScanChannelCnt++; } else /* must be SCAN_PASSIVE or SCAN_ACTIVE*/ #endif { #ifdef CONFIG_AP_SUPPORT pAd->ApCfg.ScanChannelCnt++; if ((OpMode == OPMODE_AP) && (pAd->ApCfg.bAutoChannelAtBootup)) stay_time = AUTO_CHANNEL_SEL_TIMEOUT; else #endif /* CONFIG_AP_SUPPORT */ if (WMODE_CAP_2G(pAd->CommonCfg.PhyMode) && WMODE_CAP_5G(pAd->CommonCfg.PhyMode)) { if (pAd->MlmeAux.Channel > 14) stay_time = ScanTimeIn5gChannel; else stay_time = MIN_CHANNEL_TIME; } else stay_time = MAX_CHANNEL_TIME; } RTMPSetTimer(sc_timer, stay_time); if (SCAN_MODE_ACT(ScanType)) { if (scan_active(pAd, OpMode, ScanType) == FALSE) return; } /* For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse*/ #ifdef CONFIG_AP_SUPPORT if (OpMode == OPMODE_AP) pAd->Mlme.ApSyncMachine.CurrState = AP_SCAN_LISTEN; #endif /* CONFIG_AP_SUPPORT */ } }
/* ========================================================================== Description: Scan next channel ========================================================================== */ VOID ScanNextChannel(RTMP_ADAPTER *pAd, UCHAR OpMode) { UCHAR ScanType = SCAN_TYPE_MAX; UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; BOOLEAN ScanPending = FALSE; RALINK_TIMER_STRUCT *sc_timer = NULL; UINT stay_time = 0; #ifdef CONFIG_ATE /* Nothing to do in ATE mode. */ if (ATE_ON(pAd)) return; #endif /* CONFIG_ATE */ #ifdef CONFIG_AP_SUPPORT if (OpMode == OPMODE_AP) ScanType = pAd->ScanCtrl.ScanType; #endif /* CONFIG_AP_SUPPORT */ if (ScanType == SCAN_TYPE_MAX) { DBGPRINT(RT_DEBUG_ERROR, ("%s():Incorrect ScanType!\n", __FUNCTION__)); return; } #ifdef RT_CFG80211_SUPPORT /* Since the Channel List is from Upper layer */ if (CFG80211DRV_OpsScanRunning(pAd)) pAd->ScanCtrl.Channel = CFG80211DRV_OpsScanGetNextChannel(pAd); #endif /* RT_CFG80211_SUPPORT */ if ((pAd->ScanCtrl.Channel == 0) || ScanPending) { scan_ch_restore(pAd, OpMode); } else { AsicSwitchChannel(pAd, pAd->ScanCtrl.Channel, TRUE); AsicLockChannel(pAd, pAd->ScanCtrl.Channel); /* Check if channel if passive scan under current regulatory domain */ if (CHAN_PropertyCheck(pAd, pAd->ScanCtrl.Channel, CHANNEL_PASSIVE_SCAN) == TRUE) ScanType = SCAN_PASSIVE; #if defined(DPA_T) || defined(WIFI_REGION32_HIDDEN_SSID_SUPPORT) /* Ch 12~14 is passive scan, No matter DFS and 80211H setting is y or n */ if ((pAd->ScanCtrl.Channel >= 12) && (pAd->ScanCtrl.Channel <= 14)) ScanType = SCAN_PASSIVE; #endif /* DPA_T */ #ifdef CONFIG_AP_SUPPORT if (OpMode == OPMODE_AP) sc_timer = &pAd->ScanCtrl.APScanTimer; #endif /* CONFIG_AP_SUPPORT */ if (!sc_timer) { DBGPRINT(RT_DEBUG_ERROR, ("%s():ScanTimer not assigned!\n", __FUNCTION__)); return; } /* We need to shorten active scan time in order for WZC connect issue */ /* Chnage the channel scan time for CISCO stuff based on its IAPP announcement */ if (ScanType == FAST_SCAN_ACTIVE) stay_time = FAST_ACTIVE_SCAN_TIME; else /* must be SCAN_PASSIVE or SCAN_ACTIVE*/ { #ifdef CONFIG_AP_SUPPORT if ((OpMode == OPMODE_AP) && (pAd->ApCfg.bAutoChannelAtBootup)) stay_time = AUTO_CHANNEL_SEL_TIMEOUT; else #endif /* CONFIG_AP_SUPPORT */ if (WMODE_CAP_2G(pAd->CommonCfg.PhyMode) && WMODE_CAP_5G(pAd->CommonCfg.PhyMode)) { if (pAd->ScanCtrl.Channel > 14) stay_time = ScanTimeIn5gChannel; else stay_time = MIN_CHANNEL_TIME; } else stay_time = MAX_CHANNEL_TIME; } #ifdef RT_CFG80211_SUPPORT //CFG_TODO: for testing. /* Since the Channel List is from Upper layer */ if (CFG80211DRV_OpsScanRunning(pAd) && (pAd->cfg80211_ctrl.Cfg80211ChanListLen == 1)) stay_time = 500; #endif /* RT_CFG80211_SUPPORT */ RTMPSetTimer(sc_timer, stay_time); if (SCAN_MODE_ACT(ScanType)) { if (scan_active(pAd, OpMode, ScanType) == FALSE) return; } /* For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse*/ #ifdef CONFIG_AP_SUPPORT if (OpMode == OPMODE_AP) pAd->Mlme.ApSyncMachine.CurrState = AP_SCAN_LISTEN; #endif /* CONFIG_AP_SUPPORT */ } }
/* ========================================================================== Description: Scan next channel ========================================================================== */ VOID ScanNextChannel( IN PRTMP_ADAPTER pAd, IN UCHAR OpMode) { UCHAR ScanType = pAd->MlmeAux.ScanType; UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; BOOLEAN ScanPending = FALSE; RALINK_TIMER_STRUCT *sc_timer; UINT stay_time = 0; #ifdef RALINK_ATE /* Nothing to do in ATE mode. */ if (ATE_ON(pAd)) return; #endif /* RALINK_ATE */ if ((pAd->MlmeAux.Channel == 0) || ScanPending) { scan_ch_restore(pAd, OpMode); } #ifdef RTMP_MAC_USB #endif /* RTMP_MAC_USB */ else { AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, TRUE); AsicLockChannel(pAd, pAd->MlmeAux.Channel); /* Check if channel if passive scan under current regulatory domain */ if (CHAN_PropertyCheck(pAd, pAd->MlmeAux.Channel, CHANNEL_PASSIVE_SCAN) == TRUE) ScanType = SCAN_PASSIVE; if (OpMode == OPMODE_AP) sc_timer = &pAd->MlmeAux.APScanTimer; else sc_timer = &pAd->MlmeAux.ScanTimer; /* We need to shorten active scan time in order for WZC connect issue */ /* Chnage the channel scan time for CISCO stuff based on its IAPP announcement */ if (ScanType == FAST_SCAN_ACTIVE) stay_time = FAST_ACTIVE_SCAN_TIME; else /* must be SCAN_PASSIVE or SCAN_ACTIVE*/ { #ifdef CONFIG_AP_SUPPORT if ((OpMode == OPMODE_AP) && (pAd->ApCfg.bAutoChannelAtBootup)) stay_time = AUTO_CHANNEL_SEL_TIMEOUT; else #endif /* CONFIG_AP_SUPPORT */ if (WMODE_CAP_2G(pAd->CommonCfg.PhyMode) && WMODE_CAP_5G(pAd->CommonCfg.PhyMode)) { if (pAd->MlmeAux.Channel > 14) stay_time = ScanTimeIn5gChannel; else stay_time = MIN_CHANNEL_TIME; } #ifdef WIFI_P2P_CONCURRENT_FAST_SCAN /* If this is not PASSIVE scan && Fast scan is enabled, we shorten the chanenl dwell time */ else if (ScanType != SCAN_PASSIVE && pAd->StaCfg.bImprovedScan) stay_time = FAST_ACTIVE_SCAN_TIME; #endif /* WIFI_P2P_CONCURRENT_FAST_SCAN */ else stay_time = MAX_CHANNEL_TIME; } RTMPSetTimer(sc_timer, stay_time); if (SCAN_MODE_ACT(ScanType)) { if (scan_active(pAd, OpMode, ScanType) == FALSE) return; } /* For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse*/ #ifdef CONFIG_AP_SUPPORT if (OpMode == OPMODE_AP) pAd->Mlme.ApSyncMachine.CurrState = AP_SCAN_LISTEN; #endif /* CONFIG_AP_SUPPORT */ } }