summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgaolez <gaolez@codeaurora.org>2017-10-30 15:29:59 +0800
committersnandini <snandini@codeaurora.org>2017-10-30 02:02:26 -0700
commitec9ff0b924ca00ceade26c27de2506aa216ece22 (patch)
tree3919b6fd280534e8c65308174ee8cafd59384cc7
parent92dfa0c5c6269243c3cc2b1840ed79e17402eebf (diff)
qcacld-2.0: reduce the interval of cap-tsf timer
hdd_get_hosttime_from_targettime() will get wrong host time when it's longer than WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC from last TSF-HOST update. To fix this, TSF-HOST should be updated in at most WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC, it couldn't be achieved if the timer interval is also WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC, due to processing or scheduling delay. So deduct several seconds from WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC. Change-Id: Icce41c74568370d98509a2ebe69ae62e99ad2ce8 CRs-Fixed: 2104915
-rw-r--r--CORE/HDD/src/wlan_hdd_tsf.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/CORE/HDD/src/wlan_hdd_tsf.c b/CORE/HDD/src/wlan_hdd_tsf.c
index eb916dc52cd5..4049f2bc6afa 100644
--- a/CORE/HDD/src/wlan_hdd_tsf.c
+++ b/CORE/HDD/src/wlan_hdd_tsf.c
@@ -262,14 +262,14 @@ static enum hdd_tsf_op_result hdd_indicate_tsf_internal(
#ifdef WLAN_FEATURE_TSF_PLUS
/* unit for target time: us; host time: ns */
#define HOST_TO_TARGET_TIME_RATIO NSEC_PER_USEC
-#define MAX_ALLOWED_DEVIATION_NS (20 * NSEC_PER_MSEC)
+#define MAX_ALLOWED_DEVIATION_NS (100 * NSEC_PER_USEC)
#define MAX_CONTINUOUS_ERROR_CNT 3
/**
* to distinguish 32-bit overflow case, this inverval should:
* equal or less than (1/2 * OVERFLOW_INDICATOR32 us)
*/
-#define WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC 500
+#define WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC 10
#define WLAN_HDD_CAPTURE_TSF_INIT_INTERVAL_MS 100
#define NORMAL_INTERVAL_TARGET \
((int64_t)((int64_t)WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC * \
@@ -277,6 +277,7 @@ static enum hdd_tsf_op_result hdd_indicate_tsf_internal(
#define OVERFLOW_INDICATOR32 (((int64_t)0x1) << 32)
#define MAX_UINT64 ((uint64_t)0xffffffffffffffff)
#define MASK_UINT32 0xffffffff
+#define CAP_TSF_TIMER_FIX_SEC 1
/**
* TS_STATUS - timestamp status
@@ -465,8 +466,19 @@ static void hdd_update_timestamp(hdd_adapter_t *adapter,
FL("ts-pair updated: target: %llu; host: %llu"),
adapter->last_target_time,
adapter->last_host_time);
- interval = WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC *
- MSEC_PER_SEC;
+
+ /* TSF-HOST need to be updated in at most
+ * WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC, it couldn't be achieved
+ * if the timer interval is also
+ * WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC, due to processing or
+ * schedule delay. So deduct several seconds from
+ * WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC.
+ * Without this change, hdd_get_hosttime_from_targettime() will
+ * get wrong host time when it's longer than
+ * WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC from last
+ * TSF-HOST update. */
+ interval = (WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC -
+ CAP_TSF_TIMER_FIX_SEC) * MSEC_PER_SEC;
adapter->continuous_error_count = 0;
break;
case HDD_TS_STATUS_WAITING: