From c2dac1c92bdf2da890b804212640e297ec012232 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Tue, 7 May 2019 10:16:53 +0530 Subject: [PATCH] qcacmn: Add filter logic according to timestamp in scan Currently the driver does not have any mechanism to filter out the scan results according to the age. Add a logic in the scan filter API, to filter out the scan result according to the age threshold, so that APs which are older than a particular value are filtered out. Change-Id: If3f4b372b28a0f75b1d70915df4e3e1a7e518931 CRs-Fixed: 2447988 --- umac/scan/core/src/wlan_scan_cache_db.c | 6 +++--- umac/scan/core/src/wlan_scan_filter.c | 4 ++++ umac/scan/core/src/wlan_scan_main.h | 2 +- umac/scan/dispatcher/inc/wlan_scan_public_structs.h | 2 +- umac/scan/dispatcher/inc/wlan_scan_utils_api.h | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index dd9e96245fba..e4a3d2268ebb 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -312,11 +312,11 @@ scm_get_next_node(struct scan_dbs *scan_db, */ static void scm_check_and_age_out(struct scan_dbs *scan_db, struct scan_cache_node *node, - uint32_t scan_aging_time) + qdf_time_t scan_aging_time) { if (util_scan_entry_age(node->entry) >= scan_aging_time) { - scm_debug("Aging out BSSID: %pM with age %d ms", + scm_debug("Aging out BSSID: %pM with age %lu ms", node->entry->bssid.bytes, util_scan_entry_age(node->entry)); qdf_spin_lock_bh(&scan_db->scan_db_lock); @@ -401,7 +401,7 @@ static QDF_STATUS scm_flush_oldest_entry(struct scan_dbs *scan_db) } if (oldest_node) { - scm_debug("Flush oldest BSSID: %pM with age %d ms", + scm_debug("Flush oldest BSSID: %pM with age %lu ms", oldest_node->entry->bssid.bytes, util_scan_entry_age(oldest_node->entry)); /* Release ref_cnt taken for oldest_node and delete it */ diff --git a/umac/scan/core/src/wlan_scan_filter.c b/umac/scan/core/src/wlan_scan_filter.c index abf9dbd4c407..648ad781c4a2 100644 --- a/umac/scan/core/src/wlan_scan_filter.c +++ b/umac/scan/core/src/wlan_scan_filter.c @@ -1150,6 +1150,10 @@ bool scm_filter_match(struct wlan_objmgr_psoc *psoc, roam_params = &def_param->roam_params; + if (filter->age_threshold && filter->age_threshold < + util_scan_entry_age(db_entry)) + return false; + if (filter->p2p_results && !db_entry->is_p2p) return false; diff --git a/umac/scan/core/src/wlan_scan_main.h b/umac/scan/core/src/wlan_scan_main.h index dd003a958748..421080ee4aa2 100644 --- a/umac/scan/core/src/wlan_scan_main.h +++ b/umac/scan/core/src/wlan_scan_main.h @@ -380,7 +380,7 @@ struct scan_default_params { uint32_t burst_duration; uint32_t max_scan_time; uint32_t num_probes; - uint32_t scan_cache_aging_time; + qdf_time_t scan_cache_aging_time; uint32_t select_5ghz_margin; bool enable_mac_spoofing; bool is_bssid_hint_priority; diff --git a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h index 52d46e695243..246719db06c9 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h +++ b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h @@ -566,7 +566,7 @@ struct fils_filter_info { struct scan_filter { bool bss_scoring_required; bool enable_adaptive_11r; - uint32_t age_threshold; + qdf_time_t age_threshold; uint32_t p2p_results; uint32_t rrm_measurement_filter; uint32_t num_of_bssid; diff --git a/umac/scan/dispatcher/inc/wlan_scan_utils_api.h b/umac/scan/dispatcher/inc/wlan_scan_utils_api.h index 720135556e04..579ec76bf0d0 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_utils_api.h +++ b/umac/scan/dispatcher/inc/wlan_scan_utils_api.h @@ -1140,10 +1140,10 @@ util_scan_entry_wmeparam(struct scan_cache_entry *scan_entry) * * Return: age in ms */ -static inline uint32_t +static inline qdf_time_t util_scan_entry_age(struct scan_cache_entry *scan_entry) { - unsigned long ts = scan_entry->scan_entry_time; + qdf_time_t ts = scan_entry->scan_entry_time; return qdf_mc_timer_get_system_time() - ts; }