wlan: Wlan Scan results aging based on Timing mechansim.
Added a new feature to support aging out of scan results based on timer.
Change-Id: Ibbedb5efe2eaca0a31607da28739644587bc9523
CR-Fixed: 426964
diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h
index e0e2034..f0ba338 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg.h
@@ -1470,6 +1470,15 @@
#define CFG_ACTIVEMODE_OFFLOAD_ENABLE_MAX ( 1 )
#define CFG_ACTIVEMODE_OFFLOAD_ENABLE_DEFAULT ( 0 )
#endif
+
+/*
+ * Scan Aging timeout value in seconds
+ */
+#define CFG_SCAN_AGING_PARAM_NAME "gScanAgingTime"
+#define CFG_SCAN_AGING_PARAM_MIN ( 0 )
+#define CFG_SCAN_AGING_PARAM_MAX ( 200 )
+#define CFG_SCAN_AGING_PARAM_DEFAULT ( 60 )
+
/*---------------------------------------------------------------------------
Type declarations
-------------------------------------------------------------------------*/
@@ -1791,6 +1800,7 @@
#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
v_BOOL_t fEnableActiveModeOffload;
#endif
+ v_U8_t scanAgingTimeout;
} hdd_config_t;
/*---------------------------------------------------------------------------
Function declarations and documenation
diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c
index 6fb0e31..02a3b9a 100644
--- a/CORE/HDD/src/wlan_hdd_cfg.c
+++ b/CORE/HDD/src/wlan_hdd_cfg.c
@@ -1778,6 +1778,13 @@
CFG_ACTIVEMODE_OFFLOAD_ENABLE_MIN,
CFG_ACTIVEMODE_OFFLOAD_ENABLE_MAX ),
#endif
+
+REG_VARIABLE( CFG_SCAN_AGING_PARAM_NAME, WLAN_PARAM_Integer,
+ hdd_config_t, scanAgingTimeout,
+ VAR_FLAGS_OPTIONAL,
+ CFG_SCAN_AGING_PARAM_DEFAULT,
+ CFG_SCAN_AGING_PARAM_MIN,
+ CFG_SCAN_AGING_PARAM_MAX ),
};
/*
@@ -3353,6 +3360,9 @@
smeConfig.csrConfig.fEnableMCCMode = pConfig->enableMCC;
smeConfig.csrConfig.fAllowMCCGODiffBI = pConfig->allowMCCGODiffBI;
+ //Scan Results Aging Time out value
+ smeConfig.csrConfig.scanCfgAgingTime = pConfig->scanAgingTimeout;
+
halStatus = sme_UpdateConfig( pHddCtx->hHal, &smeConfig);
if ( !HAL_STATUS_SUCCESS( halStatus ) )
{
diff --git a/CORE/SME/inc/csrApi.h b/CORE/SME/inc/csrApi.h
index f7ce9f3..38245b7 100644
--- a/CORE/SME/inc/csrApi.h
+++ b/CORE/SME/inc/csrApi.h
@@ -1057,7 +1057,7 @@
#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
tANI_BOOLEAN nRoamPrefer5GHz;
#endif
-
+ tANI_U8 scanCfgAgingTime;
}tCsrConfigParam;
//Tush
diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h
index 0c30bf9..b513e18 100644
--- a/CORE/SME/inc/csrInternal.h
+++ b/CORE/SME/inc/csrInternal.h
@@ -661,9 +661,11 @@
#endif
tPalTimerHandle hTimerIdleScan;
tPalTimerHandle hTimerResultAging;
+ tPalTimerHandle hTimerResultCfgAging;
tPalTimerHandle hTimerBgScan;
//changes on every scan, it is used as a flag for whether 11d info is found on every scan
- tANI_U8 channelOf11dInfo;
+ tANI_U8 channelOf11dInfo;
+ tANI_U8 scanResultCfgAgingTime;
//changes on every scan, a flag to tell whether conflict 11d info found on each BSS
tANI_BOOLEAN fAmbiguous11dInfoFound;
//Tush: changes on every scan, a flag to tell whether the applied 11d info present in one of the scan results
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c
index f56bfdd..f773fd4 100644
--- a/CORE/SME/src/csr/csrApiRoam.c
+++ b/CORE/SME/src/csr/csrApiRoam.c
@@ -530,6 +530,12 @@
csrInitBGScanChannelList(pMac);
/* HDD issues the init scan */
csrScanStartResultAgingTimer(pMac);
+ /* If the gScanAgingTime is set to '0' then scan results aging timeout
+ based on timer feature is not enabled*/
+ if(0 != pMac->scan.scanResultCfgAgingTime )
+ {
+ csrScanStartResultCfgAgingTimer(pMac);
+ }
//Store the AC weights in TL for later use
WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights);
status = csrInitChannelList( pMac );
@@ -1333,6 +1339,7 @@
pMac->scan.fValidateList = pParam->fValidateList;
pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d;
pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan;
+ pMac->scan.scanResultCfgAgingTime = pParam->scanCfgAgingTime;
pMac->roam.configParam.fScanTwice = pParam->fScanTwice;
pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl;
/* This parameter is not available in cfg and not passed from upper layers. Instead it is initialized here
diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c
index 98084a5..d15c46f 100644
--- a/CORE/SME/src/csr/csrApiScan.c
+++ b/CORE/SME/src/csr/csrApiScan.c
@@ -120,6 +120,7 @@
void csrScanGetResultTimerHandler(void *);
void csrScanResultAgingTimerHandler(void *pv);
+static void csrScanResultCfgAgingTimerHandler(void *pv);
void csrScanIdleScanTimerHandler(void *);
static void csrSetDefaultScanTiming( tpAniSirGlobal pMac, tSirScanType scanType, tCsrScanRequest *pScanRequest);
#ifdef WLAN_AP_STA_CONCURRENCY
@@ -311,6 +312,13 @@
smsLog(pMac, LOGE, FL("cannot allocate memory for ResultAging timer\n"));
break;
}
+ status = palTimerAlloc(pMac->hHdd, &pMac->scan.hTimerResultCfgAging,
+ csrScanResultCfgAgingTimerHandler, pMac);
+ if(!HAL_STATUS_SUCCESS(status))
+ {
+ smsLog(pMac, LOGE, FL("cannot allocate memory for CFG ResultAging timer\n"));
+ break;
+ }
}while(0);
return (status);
@@ -340,6 +348,7 @@
csrLLClose(&pMac->scan.channelPowerInfoList5G);
csrScanDisable(pMac);
palTimerFree(pMac->hHdd, pMac->scan.hTimerResultAging);
+ palTimerFree(pMac->hHdd, pMac->scan.hTimerResultCfgAging);
palTimerFree(pMac->hHdd, pMac->scan.hTimerGetResult);
#ifdef WLAN_AP_STA_CONCURRENCY
palTimerFree(pMac->hHdd, pMac->scan.hTimerStaApConcTimer);
@@ -5488,6 +5497,11 @@
csrScanStopResultAgingTimer(pMac);
csrScanStopIdleScanTimer(pMac);
csrScanStopGetResultTimer(pMac);
+ if(0 != pMac->scan.scanResultCfgAgingTime )
+ {
+ csrScanStopResultCfgAgingTimer(pMac);
+ }
+
}
@@ -5638,26 +5652,36 @@
eHalStatus csrScanStartResultAgingTimer(tpAniSirGlobal pMac)
{
- eHalStatus status;
+ eHalStatus status = eHAL_STATUS_FAILURE;
if(pMac->scan.fScanEnable)
{
status = palTimerStart(pMac->hHdd, pMac->scan.hTimerResultAging, CSR_SCAN_RESULT_AGING_INTERVAL, eANI_BOOLEAN_TRUE);
}
- else
- {
- status = eHAL_STATUS_FAILURE;
- }
-
return (status);
}
+eHalStatus csrScanStartResultCfgAgingTimer(tpAniSirGlobal pMac)
+{
+ eHalStatus status = eHAL_STATUS_FAILURE;
+
+ if(pMac->scan.fScanEnable)
+ {
+ status = palTimerStart(pMac->hHdd, pMac->scan.hTimerResultCfgAging,
+ CSR_SCAN_RESULT_CFG_AGING_INTERVAL, eANI_BOOLEAN_TRUE);
+ }
+ return (status);
+}
eHalStatus csrScanStopResultAgingTimer(tpAniSirGlobal pMac)
{
return (palTimerStop(pMac->hHdd, pMac->scan.hTimerResultAging));
}
+eHalStatus csrScanStopResultCfgAgingTimer(tpAniSirGlobal pMac)
+{
+ return (palTimerStop(pMac->hHdd, pMac->scan.hTimerResultCfgAging));
+}
//This function returns the maximum time a BSS is allowed in the scan result.
//The time varies base on connection and power saving factors.
@@ -5756,6 +5780,29 @@
}
}
+static void csrScanResultCfgAgingTimerHandler(void *pv)
+{
+ tpAniSirGlobal pMac = PMAC_STRUCT( pv );
+ tListElem *pEntry, *tmpEntry;
+ tCsrScanResult *pResult;
+ tANI_TIMESTAMP ageOutTime = pMac->scan.scanResultCfgAgingTime * PAL_TICKS_PER_SECOND;
+ tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
+
+ csrLLLock(&pMac->scan.scanResultList);
+ pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
+ while( pEntry )
+ {
+ tmpEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK);
+ pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
+ if((curTime - pResult->Result.BssDescriptor.nReceivedTime) > ageOutTime)
+ {
+ smsLog(pMac, LOGW, " age out due to time out");
+ csrScanAgeOutBss(pMac, pResult);
+ }
+ pEntry = tmpEntry;
+ }
+ csrLLUnlock(&pMac->scan.scanResultList);
+}
eHalStatus csrScanStartIdleScanTimer(tpAniSirGlobal pMac, tANI_U32 interval)
{
diff --git a/CORE/SME/src/csr/csrInsideApi.h b/CORE/SME/src/csr/csrInsideApi.h
index f01d833..66130d3 100644
--- a/CORE/SME/src/csr/csrInsideApi.h
+++ b/CORE/SME/src/csr/csrInsideApi.h
@@ -96,6 +96,7 @@
#define CSR_MIC_ERROR_TIMEOUT (60 * PAL_TIMER_TO_SEC_UNIT) //60 seconds
#define CSR_TKIP_COUNTER_MEASURE_TIMEOUT (60 * PAL_TIMER_TO_SEC_UNIT) //60 seconds
#define CSR_SCAN_RESULT_AGING_INTERVAL (5 * PAL_TIMER_TO_SEC_UNIT) //5 seconds
+#define CSR_SCAN_RESULT_CFG_AGING_INTERVAL (PAL_TIMER_TO_SEC_UNIT) // 1 second
//the following defines are NOT used by palTimer
#define CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS 50 //50 seconds
#define CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS 300 //300 seconds
@@ -260,6 +261,8 @@
eHalStatus csrScanStopGetResultTimer(tpAniSirGlobal pMac);
eHalStatus csrScanStartResultAgingTimer(tpAniSirGlobal pMac);
eHalStatus csrScanStopResultAgingTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanStartResultCfgAgingTimer(tpAniSirGlobal pMac);
+eHalStatus csrScanStopResultCfgAgingTimer(tpAniSirGlobal pMac);
eHalStatus csrScanBGScanEnable(tpAniSirGlobal pMac);
eHalStatus csrScanStartIdleScanTimer(tpAniSirGlobal pMac, tANI_U32 interval);
eHalStatus csrScanStopIdleScanTimer(tpAniSirGlobal pMac);
diff --git a/firmware_bin/WCNSS_qcom_cfg.ini b/firmware_bin/WCNSS_qcom_cfg.ini
index 59c3925..3dc419a 100644
--- a/firmware_bin/WCNSS_qcom_cfg.ini
+++ b/firmware_bin/WCNSS_qcom_cfg.ini
@@ -366,6 +366,11 @@
# Enable Active mode offload
gEnableActiveModeOffload=0
+#Enable Scan Results Aging based on timer
+#Timer value is in seconds
+#If Set to 0 it will not enable the feature
+gScanAgingTime=0
+
END
# Note: Configuration parser would not read anything past the END marker