netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Or Gerlitz <ogerlitz@mellanox.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	Eugenia Emantayev <eugenia@mellanox.com>
Subject: Re: [PATCH V1 3/3] net/mlx4_en: Add HW timestamping (TS) support
Date: Wed, 10 Oct 2012 05:37:03 +0200	[thread overview]
Message-ID: <20121010033703.GA2304@netboy.at.omicron.at> (raw)
In-Reply-To: <1349796013-31106-4-git-send-email-ogerlitz@mellanox.com>

On Tue, Oct 09, 2012 at 05:20:13PM +0200, Or Gerlitz wrote:

> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> index edd9cb8..ac78127 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c

...

> @@ -1542,6 +1611,7 @@ static const struct net_device_ops mlx4_netdev_ops = {
>  	.ndo_set_mac_address	= mlx4_en_set_mac,
>  	.ndo_validate_addr	= eth_validate_addr,
>  	.ndo_change_mtu		= mlx4_en_change_mtu,
> +	.ndo_do_ioctl		= mlx4_en_ioctl,
>  	.ndo_tx_timeout		= mlx4_en_tx_timeout,
>  	.ndo_vlan_rx_add_vid	= mlx4_en_vlan_rx_add_vid,
>  	.ndo_vlan_rx_kill_vid	= mlx4_en_vlan_rx_kill_vid,

You should also provide a get_ts_info function to let the users know
about the device's time stamping capabilities.

> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_timestamp.c b/drivers/net/ethernet/mellanox/mlx4/en_timestamp.c
> new file mode 100644
> index 0000000..783d493
> --- /dev/null
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_timestamp.c

...

> +void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
> +{
> +	struct mlx4_dev *dev = mdev->dev;
> +	u64 temp_mult;
> +
> +	memset(&mdev->cycles, 0, sizeof(mdev->cycles));
> +	mdev->cycles.read = mlx4_en_read_clock;
> +	mdev->cycles.mask = CLOCKSOURCE_MASK(48);
> +
> +	/* we have hca_core_clock in MHz, so to translate cycles to nsecs
> +	 * we need to divide cycles by freq and multiply by 1000;
> +	 * in order to get precise result we shift left the value,
> +	 * since we don't have floating point there;
> +	 * at the end shift result back
> +	 */
> +	temp_mult = ((1ull * 1000) << 29) / dev->caps.hca_core_clock;
> +	mdev->cycles.mult = (u32)temp_mult;
> +	mdev->cycles.shift = 29;
> +
> +	timecounter_init(&mdev->clock, &mdev->cycles,
> +			 ktime_to_ns(ktime_get_real()));

I didn't see any watchdog code to read this clock periodically, in
order to catch overflows.

Thanks,
Richard

  reply	other threads:[~2012-10-10  3:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09 15:20 [PATCH V1 0/3] net/mlx4: HW timestamping support Or Gerlitz
2012-10-09 15:20 ` [PATCH V1 1/3] net/mlx4_core: Add timestamping device capability Or Gerlitz
2012-10-09 15:20 ` [PATCH V1 2/3] net/mlx4_core: Read HCA frequency and map internal clock Or Gerlitz
2012-10-09 16:54   ` Joe Perches
2012-10-09 19:31     ` Or Gerlitz
2012-10-09 15:20 ` [PATCH V1 3/3] net/mlx4_en: Add HW timestamping (TS) support Or Gerlitz
2012-10-10  3:37   ` Richard Cochran [this message]
2012-10-10 14:06     ` Or Gerlitz

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=20121010033703.GA2304@netboy.at.omicron.at \
    --to=richardcochran@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eugenia@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.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;
as well as URLs for NNTP newsgroup(s).