From patchwork Tue Aug 11 16:06:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhilash Jindal X-Patchwork-Id: 6993411 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 16D749F358 for ; Tue, 11 Aug 2015 16:06:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0073E205BC for ; Tue, 11 Aug 2015 16:06:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 112F6205B8 for ; Tue, 11 Aug 2015 16:06:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965310AbbHKQGs (ORCPT ); Tue, 11 Aug 2015 12:06:48 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:38156 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965202AbbHKQGr (ORCPT ); Tue, 11 Aug 2015 12:06:47 -0400 Received: by igfj19 with SMTP id j19so75291604igf.1 for ; Tue, 11 Aug 2015 09:06:47 -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=S6fAmEBhqO1YVC8xLU1Vn5Np4ZwO8/yroIl4JlATVus=; b=x55pYNKng6QGq1VOvEnCf4zCiEMBxSboYf33WNH5zgnltK7eoFk2W6t6jasJMilZQY 9zDLcrJkx5sYgfC581MGP2SIQuTjXk57Kouh5JbXdQCOT+8uAqMXLvNjjo7g60qIHLFm oCqxhvUJagrpxlKyqrZcj8JgMEAS7j/v38veXL4nvJFD+NJlLGFYjC2+x43TYHDUq3pl Jum5P3Z8t+pPx4XOXphcssVVix6ySftnJnPOuxH5eLGUoSUjoS2+6K6hDkCTUryJ8O8H aqBdfF88Lg5ua16to54B8pHqh6rFU1y5HHu//MJPSnMsofjDh/ZQyBfKnqvCRGqb608W T/7A== X-Received: by 10.50.61.197 with SMTP id s5mr17641656igr.51.1439309207231; Tue, 11 Aug 2015 09:06:47 -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 i123sm1796788ioi.13.2015.08.11.09.06.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Aug 2015 09:06:46 -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 monotonic clock Date: Tue, 11 Aug 2015 12:06:45 -0400 Message-Id: <1439309205-9337-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. Monotonic time is constantly increasing time better suited for comparing two timestamps. Signed-off-by: Abhilash Jindal --- drivers/scsi/bfa/bfa_port.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/bfa/bfa_port.c b/drivers/scsi/bfa/bfa_port.c index 8ea7697..179ab23 100644 --- a/drivers/scsi/bfa/bfa_port.c +++ b/drivers/scsi/bfa/bfa_port.c @@ -95,13 +95,13 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status) port->stats_busy = BFA_FALSE; if (status == BFA_STATUS_OK) { - struct timeval tv; + struct timespec tv; memcpy(port->stats, port->stats_dma.kva, sizeof(union bfa_port_stats_u)); bfa_port_stats_swap(port, port->stats); - do_gettimeofday(&tv); + ktime_get_ts(&tv); port->stats->fc.secs_reset = tv.tv_sec - port->stats_reset_time; } @@ -123,7 +123,7 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status) static void bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status) { - struct timeval tv; + struct timespec tv; port->stats_status = status; port->stats_busy = BFA_FALSE; @@ -131,7 +131,7 @@ bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status) /* * re-initialize time stamp for stats reset */ - do_gettimeofday(&tv); + ktime_get_ts(&tv); port->stats_reset_time = tv.tv_sec; if (port->stats_cbfn) { @@ -470,7 +470,7 @@ void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, void *dev, struct bfa_trc_mod_s *trcmod) { - struct timeval tv; + struct timespec tv; WARN_ON(!port); @@ -493,7 +493,7 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, /* * initialize time stamp for stats reset */ - do_gettimeofday(&tv); + ktime_get_ts(&tv); port->stats_reset_time = tv.tv_sec; bfa_trc(port, 0);