prima: Get timestamp in gscan_start and add it to cached results
Firmware gives the time from gscan_start to the time at which a
scan result is found as timestamp of that result. Get the system
timestamp in gscan_start in driver and add it to the timstamp
provided by firmware as framework expects the timestamp of the
cached result from system boot.
Change-Id: I7b1f7f671558daedb7513eb797b7bb918309fe8a
CRs-Fixed: 949324
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index 8060e44..e06eba2 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -1599,6 +1599,8 @@
/* tdls source timer to enable/disable TDLS on p2p listen */
vos_timer_t tdls_source_timer;
+
+ v_U64_t extscan_start_time_since_boot;
};
typedef enum {
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 9ef17c3..319d24b 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -2723,13 +2723,14 @@
pSirWifiScanResult = head_ptr + i;
/*
- * Firmware returns timestamp from WiFi turn ON till
- * BSSID was cached (in seconds). Add this with
- * time gap between system boot up to WiFi turn ON
+ * Firmware returns timestamp from extscan_start till
+ * BSSID was cached (in micro seconds). Add this with
+ * time gap between system boot up to extscan_start
* to derive the time since boot when the
* BSSID was cached.
*/
- pSirWifiScanResult->ts += pHddCtx->wifi_turn_on_time_since_boot;
+ pSirWifiScanResult->ts +=
+ pHddCtx->extscan_start_time_since_boot;
hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) "
"Ssid (%s)"
"Bssid: %pM "
@@ -4712,6 +4713,8 @@
goto fail;
}
+ pHddCtx->extscan_start_time_since_boot = vos_get_monotonic_boottime();
+
/* request was sent -- wait for the response */
rc = wait_for_completion_timeout(&context->response_event,
msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN));