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
diff --git a/core/hdd/src/wlan_hdd_tsf.c b/core/hdd/src/wlan_hdd_tsf.c
index cecce6d..ca207ab 100644
--- a/core/hdd/src/wlan_hdd_tsf.c
+++ b/core/hdd/src/wlan_hdd_tsf.c
@@ -275,18 +275,19 @@
 #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
@@ -467,8 +468,21 @@
 		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: