diff options
author | Eugenia Emantayev <eugenia@mellanox.com> | 2015-12-17 16:35:38 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-18 22:48:04 +0300 |
commit | 90683061dd50b0d70f01466c2d694f4e928a86f3 (patch) | |
tree | 130d1c049e345443cfd8048971fa7cdce28ed04f /drivers/net/ethernet/mellanox/mlx4/en_clock.c | |
parent | fc9f5ea9b4ecbe9b7839c92f0a54261809c723d3 (diff) | |
download | linux-90683061dd50b0d70f01466c2d694f4e928a86f3.tar.xz |
net/mlx4_en: Fix HW timestamp init issue upon system startup
mlx4_en_init_timestamp was called before creation of netdev and port
init, thus used uninitialized values. Specifically - NIC frequency was
incorrect causing wrong calculations and later wrong HW timestamps.
Fixes: 1ec4864b1017 ('net/mlx4_en: Fixed crash when port type is changed')
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Marina Varshaver <marinav@mellanox.com>
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_clock.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_clock.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c index 8a083d73efdb..038f9ce391e6 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c @@ -242,6 +242,13 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev) unsigned long flags; u64 ns, zero = 0; + /* mlx4_en_init_timestamp is called for each netdev. + * mdev->ptp_clock is common for all ports, skip initialization if + * was done for other port. + */ + if (mdev->ptp_clock) + return; + rwlock_init(&mdev->clock_lock); memset(&mdev->cycles, 0, sizeof(mdev->cycles)); |