netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sagar Arun Kamble <sagar.a.kamble@intel.com>
To: linux-kernel@vger.kernel.org
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	Matan Barak <matanb@mellanox.com>,
	Leon Romanovsky <leonro@mellanox.com>,
	Eugenia Emantayev <eugenia@mellanox.com>,
	Eitan Rabin <rabin@mellanox.com>,
	Feras Daoud <ferasda@mellanox.com>,
	Miroslav Lichvar <mlichvar@redhat.com>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: [PATCH 12/27] net/mlx5: Use timecounter_initialize interface
Date: Fri, 15 Dec 2017 13:08:27 +0530	[thread overview]
Message-ID: <1513323522-15021-13-git-send-email-sagar.a.kamble@intel.com> (raw)
In-Reply-To: <1513323522-15021-1-git-send-email-sagar.a.kamble@intel.com>

With new interface timecounter_initialize we can initialize timecounter
fields and underlying cyclecounter together. Update mlx5 timecounter
init with this new function.

Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>
Cc: Matan Barak <matanb@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>
Cc: Eugenia Emantayev <eugenia@mellanox.com>
Cc: Eitan Rabin <rabin@mellanox.com>
Cc: Feras Daoud <ferasda@mellanox.com>
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Miroslav Lichvar <mlichvar@redhat.com>
Cc: netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
index 8cb6838..071f78a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
@@ -458,6 +458,7 @@ void mlx5_init_clock(struct mlx5_core_dev *mdev)
 	u64 ns;
 	u64 frac = 0;
 	u32 dev_freq;
+	u32 mult, shift;
 
 	dev_freq = MLX5_CAP_GEN(mdev, device_frequency_khz);
 	if (!dev_freq) {
@@ -465,13 +466,16 @@ void mlx5_init_clock(struct mlx5_core_dev *mdev)
 		return;
 	}
 	rwlock_init(&clock->lock);
-	cc->read = read_internal_timer;
-	cc->shift = MLX5_CYCLES_SHIFT;
-	cc->mult = clocksource_khz2mult(dev_freq, cc->shift);
-	clock->nominal_c_mult = cc->mult;
-	cc->mask = CLOCKSOURCE_MASK(41);
-
-	timecounter_init(&clock->tc, ktime_to_ns(ktime_get_real()));
+	shift = MLX5_CYCLES_SHIFT;
+	mult = clocksource_khz2mult(dev_freq, shift);
+	clock->nominal_c_mult = mult;
+
+	timecounter_initialize(&clock->tc,
+			       read_internal_timer,
+			       CLOCKSOURCE_MASK(41),
+			       mult,
+			       shift,
+			       ktime_to_ns(ktime_get_real()));
 
 	/* Calculate period in seconds to call the overflow watchdog - to make
 	 * sure counter is checked at least once every wrap around.
-- 
1.9.1

  parent reply	other threads:[~2017-12-15  7:35 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1513323522-15021-1-git-send-email-sagar.a.kamble@intel.com>
2017-12-15  7:38 ` [PATCH 01/27] timecounter: Make cyclecounter struct part of timecounter struct Sagar Arun Kamble
     [not found]   ` <1513323522-15021-2-git-send-email-sagar.a.kamble-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-01-08 22:20     ` [Intel-wired-lan] " Brown, Aaron F
2018-01-09  9:01       ` Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 05/27] amd-xgbe: Use timecounter_initialize interface Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 06/27] bnx2x: " Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 07/27] fec: " Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 08/27] e1000e: " Sagar Arun Kamble
2018-01-06  4:31   ` [Intel-wired-lan] " Brown, Aaron F
2017-12-15  7:38 ` [PATCH 09/27] igb: " Sagar Arun Kamble
2018-01-06  5:14   ` [Intel-wired-lan] " Brown, Aaron F
2017-12-15  7:38 ` [PATCH 10/27] ixgbe: " Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 11/27] net/mlx4: " Sagar Arun Kamble
2017-12-15  7:38 ` Sagar Arun Kamble [this message]
2017-12-15  7:38 ` [PATCH 13/27] qede: " Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 14/27] net: cpts: " Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 17/27] amd-xgbe: Use timecounter_reset interface Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 18/27] bnx2x: " Sagar Arun Kamble
2017-12-18 14:13   ` Kalluru, Sudarsana
2017-12-15  7:38 ` [PATCH 19/27] net: fec: ptp: " Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 20/27] e1000e: " Sagar Arun Kamble
2018-01-06  4:30   ` [Intel-wired-lan] " Brown, Aaron F
2017-12-15  7:38 ` [PATCH 21/27] igb: " Sagar Arun Kamble
2018-01-06  4:33   ` [Intel-wired-lan] " Brown, Aaron F
2017-12-15  7:38 ` [PATCH 22/27] ixgbe: " Sagar Arun Kamble
2018-01-06  4:33   ` [Intel-wired-lan] " Brown, Aaron F
2018-01-06  5:11   ` Brown, Aaron F
2017-12-15  7:38 ` [PATCH 23/27] net/mlx4: " Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 24/27] net/mlx5: " Sagar Arun Kamble
2017-12-15  7:38 ` [PATCH 25/27] qede: " Sagar Arun Kamble
2017-12-18 14:13   ` Kalluru, Sudarsana
2017-12-15  7:38 ` [PATCH 26/27] net: cpts: " Sagar Arun Kamble

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513323522-15021-13-git-send-email-sagar.a.kamble@intel.com \
    --to=sagar.a.kamble@intel.com \
    --cc=eugenia@mellanox.com \
    --cc=ferasda@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matanb@mellanox.com \
    --cc=mlichvar@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=rabin@mellanox.com \
    --cc=richardcochran@gmail.com \
    --cc=saeedm@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).