From 9ba2ff816280bf2a568e6241d3d74bec07f72a4e Mon Sep 17 00:00:00 2001 From: Subrat Dash Date: Wed, 27 Nov 2019 18:36:45 +0530 Subject: [PATCH] qcacld-3.0: Add support to restart TSF cap when traffic resumes When the chip is in power save mode, it fails to report valid TSF in the WMI_VDEV_TSF_REPORT_EVENT_ID. Even the retry may fail. Fix this by restarting the capture when the Tx/Rx resumes. Change-Id: Ibd0aa9275583ba40e5f53a11910960351bb76e7d --- core/hdd/src/wlan_hdd_tsf.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/hdd/src/wlan_hdd_tsf.c b/core/hdd/src/wlan_hdd_tsf.c index c20537d4cc0d..7c0ae824b5e5 100644 --- a/core/hdd/src/wlan_hdd_tsf.c +++ b/core/hdd/src/wlan_hdd_tsf.c @@ -328,6 +328,22 @@ hdd_wlan_retry_tsf_cap(struct hdd_adapter *adapter) return (count * WLAN_HDD_CAPTURE_TSF_REQ_TIMEOUT_MS); } +static void +hdd_wlan_restart_tsf_cap(struct hdd_adapter *adapter) +{ + struct hdd_context *hddctx; + int count = adapter->continuous_cap_retry_count; + + hddctx = WLAN_HDD_GET_CTX(adapter); + if (count == MAX_CONTINUOUS_RETRY_CNT) { + hdd_debug("Restart TSF CAP"); + qdf_atomic_set(&hddctx->cap_tsf_flag, 0); + adapter->continuous_cap_retry_count = 0; + qdf_mc_timer_start(&adapter->host_target_sync_timer, + WLAN_HDD_CAPTURE_TSF_INIT_INTERVAL_MS); + } +} + static void hdd_update_host_time(struct hdd_adapter *adapter) { @@ -419,6 +435,11 @@ hdd_wlan_retry_tsf_cap(struct hdd_adapter *adapter) return 0; } +static void +hdd_wlan_restart_tsf_cap(struct hdd_adapter *adapter) +{ +} + static void hdd_tsf_gpio_sync_work_init(struct hdd_adapter *adapter) { @@ -805,6 +826,7 @@ static inline int32_t hdd_get_hosttime_from_targettime( if (in_cap_state) qdf_spin_lock_bh(&adapter->host_target_sync_lock); + hdd_wlan_restart_tsf_cap(adapter); /* at present, target_time is only 32bit in fact */ delta32_target = (int64_t)((target_time & U32_MAX) - (adapter->last_target_time & U32_MAX));