All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Vadai <amirv@mellanox.com>
To: Eric Dumazet <eric.dumazet@gmail.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: Tue, 23 Apr 2013 16:56:43 +0300	[thread overview]
Message-ID: <5176931B.1010903@mellanox.com> (raw)
In-Reply-To: <1366657270.16391.87.camel@edumazet-glaptop>

On 22/04/2013 22:01, Eric Dumazet wrote:
> 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 ?
No. It is just a typo - used 10^6 instead of 10^9 for nano's.
But it is a good idea to have the HZ multiplied in the initialization of
overflow_period - will fix the calculation and change overflow_period
units to be jiffies, and not seconds.
> 
> What if HZ=100 ?
> 
> 
> 

Thanks,
Amir

      reply	other threads:[~2013-04-23 13:56 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
2013-04-23 13:56     ` Amir Vadai [this message]

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=5176931B.1010903@mellanox.com \
    --to=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.