bfa: Use boottime
Subsystems (2)
PATCH 1/1 bfa: Use boottime
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 <[email protected]>
--- drivers/scsi/bfa/bfa_svc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/scsi/bfa/bfa_svc.c +8 -8
@@ -307,8 +307,8 @@ static u64bfa_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);
Signature · 1 line
1.7.9.5