diff options
| -rw-r--r-- | core/sme/src/csr/csr_api_scan.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index a810f1436f1d..8338b3f4b116 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -71,6 +71,7 @@ #define HIDDEN_TIMER (1*60*1000) #define CSR_SCAN_RESULT_RSSI_WEIGHT 80 /* must be less than 100, represent the persentage of new RSSI */ +#define CSR_PURGE_RSSI_THRESHOLD -70 #define MAX_ACTIVE_SCAN_FOR_ONE_CHANNEL 140 #define MIN_ACTIVE_SCAN_FOR_ONE_CHANNEL 120 @@ -2868,20 +2869,23 @@ static bool csr_process_bss_desc_for_bkid_list(tpAniSirGlobal pMac, #endif /** - * csr_purge_old_scan_results() - This function removes old scan entries + * csr_purge_scan_results() - This function removes scan entry based + * on RSSI or AGE * @mac_ctx: pointer to Global MAC structure * - * This function removes old scan entries + * This function removes scan entry based on RSSI or AGE. + * If an scan entry with RSSI less than CSR_PURGE_RSSI_THRESHOLD, + * the scan entry is removed else oldest entry is removed. * * Return: None */ - -static void csr_purge_old_scan_results(tpAniSirGlobal mac_ctx) +static void csr_purge_scan_results(tpAniSirGlobal mac_ctx) { tListElem *pentry, *tmp_entry; - tCsrScanResult *presult, *oldest_bss = NULL; + tCsrScanResult *presult, *oldest_bss = NULL, *weakest_bss = NULL; uint64_t oldest_entry = 0; uint64_t curr_time = (uint64_t)qdf_mc_timer_get_system_time(); + int8_t weakest_rssi = 0; csr_ll_unlock(&mac_ctx->scan.scanResultList); pentry = csr_ll_peek_head(&mac_ctx->scan.scanResultList, @@ -2896,19 +2900,31 @@ static void csr_purge_old_scan_results(tpAniSirGlobal mac_ctx) presult->Result.BssDescriptor.received_time; oldest_bss = presult; } + if (presult->Result.BssDescriptor.rssi < weakest_rssi) { + weakest_rssi = presult->Result.BssDescriptor.rssi; + weakest_bss = presult; + } pentry = tmp_entry; } if (oldest_bss) { + tCsrScanResult *bss_to_remove; + + if (weakest_rssi < CSR_PURGE_RSSI_THRESHOLD) + bss_to_remove = weakest_bss; + else + bss_to_remove = oldest_bss; /* Free the old BSS Entries */ if (csr_ll_remove_entry(&mac_ctx->scan.scanResultList, - &oldest_bss->Link, LL_ACCESS_NOLOCK)) { + &bss_to_remove->Link, LL_ACCESS_NOLOCK)) { sms_log(mac_ctx, LOGD, - FL("Current time delta (%llu) of BSSID to be removed" MAC_ADDRESS_STR), - (curr_time - - oldest_bss->Result.BssDescriptor.received_time), + FL("BSSID: "MAC_ADDRESS_STR" Removed, time delta (%llu) RSSI %d"), MAC_ADDR_ARRAY( - oldest_bss->Result.BssDescriptor.bssId)); - csr_free_scan_result_entry(mac_ctx, oldest_bss); + bss_to_remove->Result.BssDescriptor.bssId), + (curr_time - + bss_to_remove-> + Result.BssDescriptor.received_time), + bss_to_remove->Result.BssDescriptor.rssi); + csr_free_scan_result_entry(mac_ctx, bss_to_remove); } } csr_ll_unlock(&mac_ctx->scan.scanResultList); @@ -2958,7 +2974,7 @@ csr_remove_from_tmp_list(tpAniSirGlobal mac_ctx, */ if (CSR_SCAN_IS_OVER_BSS_LIMIT(mac_ctx)) { sms_log(mac_ctx, LOGD, FL("BSS Limit reached")); - csr_purge_old_scan_results(mac_ctx); + csr_purge_scan_results(mac_ctx); } /* check for duplicate scan results */ if (!dup_bss) { |
