public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Amir Vadai <amirv@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org,
	Richard Cochran <richardcochran@gmail.com>,
	Or Gerlitz <ogerlitz@mellanox.com>,
	Eugenia Emantayev <eugenia@mellanox.com>
Subject: Re: [PATCH net-next V2 5/5] net/mlx4_en: Add a service task
Date: Mon, 22 Apr 2013 12:01:10 -0700	[thread overview]
Message-ID: <1366657270.16391.87.camel@edumazet-glaptop> (raw)
In-Reply-To: <1366631767-16493-6-git-send-email-amirv@mellanox.com>

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@mellanox.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 ?

  reply	other threads:[~2013-04-22 19:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-22 11:56 [PATCH net-next V2 0/5] net/mlx4: HW timestamping support Amir Vadai
2013-04-22 11:56 ` [PATCH net-next V2 1/5] net/mlx4_core: Add timestamping device capability Amir Vadai
2013-04-22 17:10   ` Sergei Shtylyov
2013-04-23  7:01     ` Amir Vadai
2013-04-22 11:56 ` [PATCH net-next V2 2/5] net/mlx4_core: Read HCA frequency and map internal clock Amir Vadai
2013-04-22 11:56 ` [PATCH net-next V2 3/5] net/mlx4_en: Add HW timestamping (TS) support Amir Vadai
2013-04-22 11:56 ` [PATCH net-next V2 4/5] net/mlx4_en: Support software timestamping Amir Vadai
2013-04-22 11:56 ` [PATCH net-next V2 5/5] net/mlx4_en: Add a service task Amir Vadai
2013-04-22 19:01   ` Eric Dumazet [this message]
2013-04-23 13:56     ` Amir Vadai

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=1366657270.16391.87.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=eugenia@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=richardcochran@gmail.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