lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1513323522-15021-13-git-send-email-sagar.a.kamble@intel.com>
Date:   Fri, 15 Dec 2017 13:08:27 +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>,
        Saeed Mahameed <saeedm@...lanox.com>,
        Matan Barak <matanb@...lanox.com>,
        Leon Romanovsky <leonro@...lanox.com>,
        Eugenia Emantayev <eugenia@...lanox.com>,
        Eitan Rabin <rabin@...lanox.com>,
        Feras Daoud <ferasda@...lanox.com>,
        Miroslav Lichvar <mlichvar@...hat.com>, netdev@...r.kernel.org,
        linux-rdma@...r.kernel.org
Subject: [PATCH 12/27] net/mlx5: Use timecounter_initialize interface

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@...el.com>
Cc: Richard Cochran <richardcochran@...il.com>
Cc: Saeed Mahameed <saeedm@...lanox.com>
Cc: Matan Barak <matanb@...lanox.com>
Cc: Leon Romanovsky <leonro@...lanox.com>
Cc: Eugenia Emantayev <eugenia@...lanox.com>
Cc: Eitan Rabin <rabin@...lanox.com>
Cc: Feras Daoud <ferasda@...lanox.com>
Cc: Sagar Arun Kamble <sagar.a.kamble@...el.com>
Cc: Miroslav Lichvar <mlichvar@...hat.com>
Cc: netdev@...r.kernel.org
Cc: linux-rdma@...r.kernel.org
Cc: linux-kernel@...r.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ