All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [SCSI] bfa: Use boottime
@ 2015-08-11 16:10 Abhilash Jindal
  0 siblings, 0 replies; only message in thread
From: Abhilash Jindal @ 2015-08-11 16:10 UTC (permalink / raw)
  To: linux-scsi; +Cc: sudarsana.kalluru, anil.gurumurthy, Abhilash Jindal

Wall time obtained from do_gettimeofday is susceptible to sudden jumps due to
user setting the time or due to NTP.  Boot time is constantly increasing time
better suited for comparing two timestamps.

Signed-off-by: Abhilash Jindal <klock.android@gmail.com>
---
 drivers/scsi/bfa/bfa_svc.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index 625225f..a4f59c7 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -307,8 +307,8 @@ static u64
 bfa_get_log_time(void)
 {
 	u64 system_time = 0;
-	struct timeval tv;
-	do_gettimeofday(&tv);
+	struct timespec tv;
+	getboottime(&tv);
 
 	/* We are interested in seconds only. */
 	system_time = tv.tv_sec;
@@ -3092,7 +3092,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
 	struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
 	struct bfa_port_cfg_s *port_cfg = &fcport->cfg;
 	struct bfa_fcport_ln_s *ln = &fcport->ln;
-	struct timeval tv;
+	struct timespec tv;
 
 	fcport->bfa = bfa;
 	ln->fcport = fcport;
@@ -3105,7 +3105,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
 	/*
 	 * initialize time stamp for stats reset
 	 */
-	do_gettimeofday(&tv);
+	getboottime(&tv);
 	fcport->stats_reset_time = tv.tv_sec;
 	fcport->stats_dma_ready = BFA_FALSE;
 
@@ -3358,9 +3358,9 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete)
 	union bfa_fcport_stats_u *ret;
 
 	if (complete) {
-		struct timeval tv;
+		struct timespec tv;
 		if (fcport->stats_status == BFA_STATUS_OK)
-			do_gettimeofday(&tv);
+			getboottime(&tv);
 
 		list_for_each_safe(qe, qen, &fcport->stats_pending_q) {
 			bfa_q_deq(&fcport->stats_pending_q, &qe);
@@ -3436,12 +3436,12 @@ __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete)
 	struct list_head *qe, *qen;
 
 	if (complete) {
-		struct timeval tv;
+		struct timespec tv;
 
 		/*
 		 * re-initialize time stamp for stats reset
 		 */
-		do_gettimeofday(&tv);
+		getboottime(&tv);
 		fcport->stats_reset_time = tv.tv_sec;
 		list_for_each_safe(qe, qen, &fcport->statsclr_pending_q) {
 			bfa_q_deq(&fcport->statsclr_pending_q, &qe);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-11 16:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-11 16:10 [PATCH] [SCSI] bfa: Use boottime Abhilash Jindal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.