Преглед изворни кода

qcacmn: Include device sleep time in the NOL timeout value

'jiffies' does not include the device sleep time.
Use qdf_get_monotonic_boottime to monitor lapse of time for nol.

Change-Id: I6e00e003b8ee3d456ac4ec62b23fdaa02d577672
CRs-Fixed: 2652692
bings пре 5 година
родитељ
комит
868ce7c912
3 измењених фајлова са 20 додато и 21 уклоњено
  1. 2 2
      umac/dfs/core/src/dfs.h
  2. 16 17
      umac/dfs/core/src/misc/dfs_nol.c
  3. 2 2
      umac/dfs/dispatcher/inc/wlan_dfs_ioctl.h

+ 2 - 2
umac/dfs/core/src/dfs.h

@@ -752,7 +752,7 @@ struct dfs_state {
  * @nol_dfs           Back pointer to dfs object.
  * @nol_freq:         Centre frequency.
  * @nol_chwidth:      Event width (MHz).
- * @nol_start_ticks:  NOL start time in OS ticks.
+ * @nol_start_us:     NOL start time in us.
  * @nol_timeout_ms:   NOL timeout value in msec.
  * @nol_timer:        Per element NOL timer.
  * @nol_next:         Next element pointer.
@@ -762,7 +762,7 @@ struct dfs_nolelem {
 	struct wlan_dfs *nol_dfs;
 	uint32_t       nol_freq;
 	uint32_t       nol_chwidth;
-	unsigned long  nol_start_ticks;
+	uint64_t       nol_start_us;
 	uint32_t       nol_timeout_ms;
 	qdf_timer_t    nol_timer;
 	struct dfs_nolelem *nol_next;

+ 16 - 17
umac/dfs/core/src/misc/dfs_nol.c

@@ -370,16 +370,16 @@ void dfs_print_nol(struct wlan_dfs *dfs)
 	nol = dfs->dfs_nol;
 	dfs_debug(dfs, WLAN_DEBUG_DFS_NOL, "NOL");
 	while (nol) {
-		diff_ms = qdf_system_ticks_to_msecs(qdf_system_ticks() -
-				nol->nol_start_ticks);
+		diff_ms = qdf_do_div(qdf_get_monotonic_boottime() -
+				     nol->nol_start_us, 1000);
 		diff_ms = (nol->nol_timeout_ms - diff_ms);
 		remaining_sec = diff_ms / 1000; /* Convert to seconds */
 		dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS,
-			"nol:%d channel=%d MHz width=%d MHz time left=%u seconds nol starttick=%llu",
+			"nol:%d channel=%d MHz width=%d MHz time left=%u seconds nol start_us=%llu",
 			i++, nol->nol_freq,
 			nol->nol_chwidth,
 			remaining_sec,
-			(uint64_t)nol->nol_start_ticks);
+			nol->nol_start_us);
 		nol = nol->nol_next;
 	}
 }
@@ -434,7 +434,7 @@ void dfs_get_nol(struct wlan_dfs *dfs,
 	while (nol) {
 		dfs_nol[*nchan].nol_freq = nol->nol_freq;
 		dfs_nol[*nchan].nol_chwidth = nol->nol_chwidth;
-		dfs_nol[*nchan].nol_start_ticks = nol->nol_start_ticks;
+		dfs_nol[*nchan].nol_start_us = nol->nol_start_us;
 		dfs_nol[*nchan].nol_timeout_ms = nol->nol_timeout_ms;
 		++(*nchan);
 		nol = nol->nol_next;
@@ -457,9 +457,8 @@ void dfs_set_nol(struct wlan_dfs *dfs,
 	}
 
 	for (i = 0; i < nchan; i++) {
-		nol_time_lft_ms =
-			qdf_system_ticks_to_msecs(qdf_system_ticks() -
-				dfs_nol[i].nol_start_ticks);
+		nol_time_lft_ms = qdf_do_div(qdf_get_monotonic_boottime() -
+					     dfs_nol[i].nol_start_us, 1000);
 
 		if (nol_time_lft_ms < dfs_nol[i].nol_timeout_ms) {
 			chan.dfs_ch_freq = dfs_nol[i].nol_freq;
@@ -496,9 +495,8 @@ void dfs_set_nol(struct wlan_dfs *dfs,
 	}
 
 	for (i = 0; i < nchan; i++) {
-		nol_time_left_ms =
-			qdf_system_ticks_to_msecs(qdf_system_ticks() -
-				dfs_nol[i].nol_start_ticks);
+		nol_time_left_ms = qdf_do_div(qdf_get_monotonic_boottime() -
+					      dfs_nol[i].nol_start_us, 1000);
 
 		if (nol_time_left_ms < dfs_nol[i].nol_timeout_ms) {
 			chan.dfs_ch_freq = dfs_nol[i].nol_freq;
@@ -540,7 +538,7 @@ void dfs_nol_addchan(struct wlan_dfs *dfs,
 	while (nol) {
 		if ((nol->nol_freq == freq) &&
 				(nol->nol_chwidth == ch_width)) {
-			nol->nol_start_ticks = qdf_system_ticks();
+			nol->nol_start_us = qdf_get_monotonic_boottime();
 			nol->nol_timeout_ms = dfs_nol_timeout * TIME_IN_MS;
 
 			dfs_debug(dfs, WLAN_DEBUG_DFS_NOL,
@@ -565,7 +563,7 @@ void dfs_nol_addchan(struct wlan_dfs *dfs,
 	elem->nol_dfs = dfs;
 	elem->nol_freq = freq;
 	elem->nol_chwidth = ch_width;
-	elem->nol_start_ticks = qdf_system_ticks();
+	elem->nol_start_us = qdf_get_monotonic_boottime();
 	elem->nol_timeout_ms = dfs_nol_timeout*TIME_IN_MS;
 	elem->nol_next = NULL;
 	if (prev) {
@@ -1005,9 +1003,9 @@ void dfs_save_dfs_nol_in_psoc(struct wlan_dfs *dfs,
 	num_chans = nolinfo->dfs_ch_nchans;
 	for (i = 0; i < tmp_nolinfo.dfs_ch_nchans; i++) {
 		/* Figure out the completed duration of each NOL. */
-		uint32_t nol_completed_ms =
-			qdf_system_ticks_to_msecs(qdf_system_ticks() -
-					tmp_nolinfo.dfs_nol[i].nol_start_ticks);
+		uint32_t nol_completed_ms = qdf_do_div(
+			qdf_get_monotonic_boottime() -
+			tmp_nolinfo.dfs_nol[i].nol_start_us, 1000);
 
 		nolinfo->dfs_nol[num_chans] = tmp_nolinfo.dfs_nol[i];
 		/* Remember the remaining NOL time in the timeout
@@ -1050,7 +1048,8 @@ void dfs_reinit_nol_from_psoc_copy(struct wlan_dfs *dfs,
 			 * current time to avoid losing entries which might
 			 * have timed out during the pause and resume mechanism.
 			 */
-			nol->dfs_nol[i].nol_start_ticks = qdf_system_ticks();
+			nol->dfs_nol[i].nol_start_us =
+				qdf_get_monotonic_boottime();
 			req_nol.dfs_nol[j++] = nol->dfs_nol[i];
 		}
 	}

+ 2 - 2
umac/dfs/dispatcher/inc/wlan_dfs_ioctl.h

@@ -84,14 +84,14 @@
  * struct dfsreq_nolelem - NOL elements.
  * @nol_freq:          NOL channel frequency.
  * @nol_chwidth:       NOL channel width.
- * @nol_start_ticks:   OS ticks when the NOL timer started.
+ * @nol_start_us:      OS microseconds when the NOL timer started.
  * @nol_timeout_ms:    Nol timeout value in msec.
  */
 
 struct dfsreq_nolelem {
 	uint16_t        nol_freq;
 	uint16_t        nol_chwidth;
-	unsigned long   nol_start_ticks;
+	uint64_t        nol_start_us;
 	uint32_t        nol_timeout_ms;
 };