All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Yuval Mintz <Yuval.Mintz@cavium.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	richardcochran@gmail.com, Sudarsana.Kalluru@cavium.com
Subject: Re: [PATCH net-next v7 1/2] qed: Add infrastructure for PTP support
Date: Thu, 16 Feb 2017 04:41:59 -0800	[thread overview]
Message-ID: <1487248919.1311.39.camel@edumazet-glaptop3.roam.corp.google.com> (raw)
In-Reply-To: <1487147051-14350-2-git-send-email-Yuval.Mintz@cavium.com>

On Wed, 2017-02-15 at 10:24 +0200, Yuval Mintz wrote:
> From: Sudarsana Reddy Kalluru <sudarsana.Kalluru@cavium.com>
> 
> The patch adds the required qed interfaces for configuring/reading
> the PTP clock on the adapter.


> +/* Read Phy Hardware Clock */
> +static int qed_ptp_hw_read_cc(struct qed_dev *cdev, u64 *phc_cycles)
> +{
> +	struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev);
> +	struct qed_ptt *p_ptt = p_hwfn->p_ptp_ptt;
> +	u32 temp = 0;
> +
> +	temp = qed_rd(p_hwfn, p_ptt, NIG_REG_TSGEN_SYNC_TIME_LSB);
> +	*phc_cycles = qed_rd(p_hwfn, p_ptt, NIG_REG_TSGEN_SYNC_TIME_MSB);
> +	*phc_cycles <<= 32;
> +	*phc_cycles |= temp;
> +
> +	return 0;
> +}

LSB and MSB being read non atomically, it looks like you could have an
error of (1<<32) cycles here.

(You read LSB value close to 0xFFFFFFFF right before it changes to 0,
while MSB got incremented.)

  reply	other threads:[~2017-02-16 12:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15  8:24 [PATCH net-next v7 0/2] qed*: Add support for PTP Yuval Mintz
2017-02-15  8:24 ` [PATCH net-next v7 1/2] qed: Add infrastructure for PTP support Yuval Mintz
2017-02-16 12:41   ` Eric Dumazet [this message]
2017-02-16 12:48     ` Mintz, Yuval
2017-02-15  8:24 ` [PATCH net-next v7 2/2] qede: Add driver support for PTP Yuval Mintz
2017-02-16 12:23   ` Eric Dumazet
2017-02-16 12:38     ` Mintz, Yuval
2017-02-16 12:45       ` Mintz, Yuval
2017-02-15 17:43 ` [PATCH net-next v7 0/2] qed*: Add " David Miller

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=1487248919.1311.39.camel@edumazet-glaptop3.roam.corp.google.com \
    --to=eric.dumazet@gmail.com \
    --cc=Sudarsana.Kalluru@cavium.com \
    --cc=Yuval.Mintz@cavium.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --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.