summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgaolez <gaolez@codeaurora.org>2017-10-30 15:29:59 +0800
committernshrivas <nshrivas@codeaurora.org>2018-04-02 19:47:21 -0700
commit5ef773d3044df64d3c7eeafab9dfdbc6358fca92 (patch)
tree17d8a44f7ee1f01f91cd614e5ea6dc8de7a1a719
parent387550c8632ce1e42b48b15f17b5a0ee8cc3a80d (diff)
qcacld-3.0: reduce the interval of cap-tsf timer
qcacld-2.0 to qcacld-3.0 propagation 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.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/core/hdd/src/wlan_hdd_tsf.c b/core/hdd/src/wlan_hdd_tsf.c
index a9ef1a231960..5bacd90cf155 100644
--- a/core/hdd/src/wlan_hdd_tsf.c
+++ b/core/hdd/src/wlan_hdd_tsf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -274,18 +274,19 @@ 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 * \
NSEC_PER_SEC / HOST_TO_TARGET_TIME_RATIO))
#define OVERFLOW_INDICATOR32 (((int64_t)0x1) << 32)
+#define CAP_TSF_TIMER_FIX_SEC 1
/**
* TS_STATUS - timestamp status
@@ -466,8 +467,21 @@ static void hdd_update_timestamp(hdd_adapter_t *adapter,
hdd_info("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: