[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1513323522-15021-12-git-send-email-sagar.a.kamble@intel.com>
Date: Fri, 15 Dec 2017 13:08:26 +0530
From: Sagar Arun Kamble <sagar.a.kamble@...el.com>
To: linux-kernel@...r.kernel.org
Cc: Sagar Arun Kamble <sagar.a.kamble@...el.com>,
Richard Cochran <richardcochran@...il.com>,
Tariq Toukan <tariqt@...lanox.com>, netdev@...r.kernel.org,
linux-rdma@...r.kernel.org
Subject: [PATCH 11/27] net/mlx4: Use timecounter_initialize interface
With new interface timecounter_initialize we can initialize timecounter
fields and underlying cyclecounter together. Update mlx4 timecounter
init with this new function.
Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@...el.com>
Cc: Richard Cochran <richardcochran@...il.com>
Cc: Tariq Toukan <tariqt@...lanox.com>
Cc: netdev@...r.kernel.org
Cc: linux-rdma@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
---
drivers/net/ethernet/mellanox/mlx4/en_clock.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
index 35987b5..dd736cc 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
@@ -264,6 +264,7 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
{
struct mlx4_dev *dev = mdev->dev;
unsigned long flags;
+ u32 mult, shift;
/* mlx4_en_init_timestamp is called for each netdev.
* mdev->ptp_clock is common for all ports, skip initialization if
@@ -274,17 +275,17 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
seqlock_init(&mdev->clock_lock);
- memset(&mdev->clock.cc, 0, sizeof(mdev->clock.cc));
- mdev->clock.cc.read = mlx4_en_read_clock;
- mdev->clock.cc.mask = CLOCKSOURCE_MASK(48);
- mdev->clock.cc.shift = freq_to_shift(dev->caps.hca_core_clock);
- mdev->clock.cc.mult =
- clocksource_khz2mult(1000 * dev->caps.hca_core_clock,
- mdev->clock.cc.shift);
+ shift = freq_to_shift(dev->caps.hca_core_clock);
+ mult = clocksource_khz2mult(1000 * dev->caps.hca_core_clock, shift);
mdev->nominal_c_mult = mdev->clock.cc.mult;
write_seqlock_irqsave(&mdev->clock_lock, flags);
- timecounter_init(&mdev->clock, ktime_to_ns(ktime_get_real()));
+ timecounter_initialize(&mdev->clock,
+ mlx4_en_read_clock,
+ CLOCKSOURCE_MASK(48),
+ mult,
+ shift,
+ ktime_to_ns(ktime_get_real()));
write_sequnlock_irqrestore(&mdev->clock_lock, flags);
/* Configure the PHC */
--
1.9.1
Powered by blists - more mailing lists