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
diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c
index dd9e962..e4a3d22 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 @@
*/
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 @@
}
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 abf9dbd..648ad78 100644
--- a/umac/scan/core/src/wlan_scan_filter.c
+++ b/umac/scan/core/src/wlan_scan_filter.c
@@ -1150,6 +1150,10 @@
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 dd003a9..421080e 100644
--- a/umac/scan/core/src/wlan_scan_main.h
+++ b/umac/scan/core/src/wlan_scan_main.h
@@ -380,7 +380,7 @@
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 52d46e6..246719d 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 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 7201355..579ec76 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 @@
*
* 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;
}