[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1366657270.16391.87.camel@edumazet-glaptop>
Date: Mon, 22 Apr 2013 12:01:10 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Amir Vadai <amirv@...lanox.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Richard Cochran <richardcochran@...il.com>,
Or Gerlitz <ogerlitz@...lanox.com>,
Eugenia Emantayev <eugenia@...lanox.com>
Subject: Re: [PATCH net-next V2 5/5] net/mlx4_en: Add a service task
On Mon, 2013-04-22 at 14:56 +0300, Amir Vadai wrote:
> Add a service task to run tasks that needed to be executed periodically.
> Currently the only task is a watchdog to catch NIC clock overflow, to make
> timestamping accurate.
> Will move the statistics task into this framework in a later patch.
>
> Signed-off-by: Amir Vadai <amirv@...lanox.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/en_clock.c | 20 ++++++++++++++++++++
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 24 ++++++++++++++++++++++++
> drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 4 ++++
> 3 files changed, 48 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
> index 6d8227d..c1982a4 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
> @@ -126,4 +126,24 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
>
> timecounter_init(&mdev->clock, &mdev->cycles,
> ktime_to_ns(ktime_get_real()));
> +
> + /* Calculate period in seconds to call the overflow watchdog. Doing
> + * that, by dividing the maximal cycles value in nano-seconds, convert
> + * it to seconds, and divide by 2 - to make sure counter is checked at
> + * least once every wrap around.
> + */
> + mdev->overflow_period =
> + cyclecounter_cyc2ns(&mdev->cycles,
> + mdev->cycles.mask) / 1000000 / 2;
> +}
> +
So this 1000000 looks like NSEC_PER_SEC/HZ ?
What if HZ=100 ?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists