From patchwork Tue Aug 11 16:10:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhilash Jindal X-Patchwork-Id: 6993421 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B0E949F358 for ; Tue, 11 Aug 2015 16:10:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB1B6205B8 for ; Tue, 11 Aug 2015 16:10:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA78B2055C for ; Tue, 11 Aug 2015 16:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965102AbbHKQKN (ORCPT ); Tue, 11 Aug 2015 12:10:13 -0400 Received: from mail-io0-f175.google.com ([209.85.223.175]:33088 "EHLO mail-io0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752728AbbHKQKM (ORCPT ); Tue, 11 Aug 2015 12:10:12 -0400 Received: by iods203 with SMTP id s203so10210034iod.0 for ; Tue, 11 Aug 2015 09:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=IPhXvo6BWIGmMpKDqHYIj7h2pICtWhdmZwi2/LfV+8U=; b=Id6P3rbrrN6Rkxl8dK1ysHKn/iP8Ck3P1av8wq7oQzhpB0n80i6DyRgfCeYMwZ9Zjy V2cYrFFG8V2s5dRp5rVABEEXL9c0P94E8xbysIQo4HW3jZvCSr2cBZrTLnAfeH0oqeSM 72lMeOIrQ1/6W9LHDwN+eU5cLMHAVRnKJSSd2ty3TBn7Fx/pO32IkKf1/QxUNC+Pjl07 jQlRTIrHfkHtQlKRUa5EVp5LWIcd1/sKa4vMU2wwAiqV4kq+DdN6vkVJij2OHTYqWctH PpdWXA3Zz3osbTyyld2wvXxqkVghmfeYLwECFeqWMJX6CsX5997dshCKGiTz9RKnk00f I4SQ== X-Received: by 10.107.47.152 with SMTP id v24mr28261061iov.180.1439309411569; Tue, 11 Aug 2015 09:10:11 -0700 (PDT) Received: from sp12.ecn.purdue.edu.ecn.purdue.edu (eprof.ecn.purdue.edu. [128.46.101.56]) by smtp.gmail.com with ESMTPSA id os9sm2981773igb.11.2015.08.11.09.10.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Aug 2015 09:10:11 -0700 (PDT) From: Abhilash Jindal To: linux-scsi@vger.kernel.org Cc: sudarsana.kalluru@qlogic.com, anil.gurumurthy@qlogic.com, Abhilash Jindal Subject: [PATCH] [SCSI] bfa: Use boottime Date: Tue, 11 Aug 2015 12:10:09 -0400 Message-Id: <1439309409-10158-1-git-send-email-klock.android@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);