All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Organov <sorganov@gmail.com>
To: Richard Cochran <richardcochran@gmail.com>
Cc: Vladimir Oltean <olteanv@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Fugang Duan <fugang.duan@nxp.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH  3/5] net: fec: initialize clock with 0 rather than current kernel time
Date: Wed, 08 Jul 2020 20:18:49 +0300	[thread overview]
Message-ID: <87k0ze7wna.fsf@osv.gnss.ru> (raw)
In-Reply-To: <20200708144803.GB13374@hoboy> (Richard Cochran's message of "Wed, 8 Jul 2020 07:48:03 -0700")

Richard Cochran <richardcochran@gmail.com> writes:

> On Wed, Jul 08, 2020 at 03:37:29PM +0300, Sergey Organov wrote:
>> Richard Cochran <richardcochran@gmail.com> writes:
>> 
>> > On Mon, Jul 06, 2020 at 06:27:21PM +0300, Vladimir Oltean wrote:
>> >> There's no correct answer, I'm afraid. Whatever the default value of the
>> >> clock may be, it's bound to be confusing for some reason, _if_ the
>> >> reason why you're investigating it in the first place is a driver bug.
>> >> Also, I don't really see how your change to use Jan 1st 1970 makes it
>> >> any less confusing.
>> >
>> > +1
>> >
>> > For a PHC, the user of the clock must check the PTP stack's
>> > synchronization flags via the management interface to know the status
>> > of the time signal.
>> 
>> Actually, as I just realized, the right solution for my original problem
>> would rather be adding PTP clock ID that time stamped Ethernet packet to
>> the Ethernet hardware time stamp (see my previous reply as well).
>
> I think you misunderstood my point.  I wasn't commenting on the
> "stacked" MAC/PHY/DSA time stamp issue in the kernel.

I think I did. It's rather that initialization value of PHP clock has
consequences in MAC/PHY/DSA, and there is no way to check any flags
/there/. And it's exactly the place where I needed the info, see
background explanation below.

I understand what your point is, but I try to explain that it's
irrelevant for my particular use-case.

>
> I am talking about the question of whether to initialize the PHC time
> to zero (decades off from TAI) or ktime (likely about 37 seconds off
> from TAI).  It does not really matter, because the user must not guess
> whether the time is valid based on the value.  Instead, the user
> should query the relevant PTP data sets in a "live" online manner.

I'm implementing PTP master clock, and there are no PTP data sets (yet)
in my case, as it's me who will eventually create them.

>
> For example, to tell whether a PHC is synchronized to anything at all,
> you need to check PORT_DATA_SET.portState and probably also
> CURRENT_DATA_SET.offsetFromMaster depending on your needs.

These are fields of PTP stack software that is not running in my case.

>
> In addition, if you care about global time, you need to check:
>
> TIME_PROPERTIES_DATA_SET
>   currentUtcOffset
>   currentUtcOffsetValid
>   ptpTimescale
>   timeTraceable
>   frequencyTraceable

I'm going to become PTP master clock, I already have very precise
estimations of PTP time, I know UTC offset, all this independently from
any PTP stack. Moreover, I've already synchronized PHY clock to this
time scale with +-5ns accuracy, and then I suddenly get somewhat wrong
hardware time stamps for Ethernet packets that I send/receive. You see?

Setting initial value of PTP clock to 0 would allow me to figure what
happens (time stamp coming from /different/ PTP clock) half a day
earlier. Not a big deal, I agree, yet I wanted to help a little bit
somebody who might happen to run into a similar trouble in the future.

Thanks,
-- Sergey

  reply	other threads:[~2020-07-08 17:19 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06 14:26 [PATCH 0/5] net: fec: fix external PTP PHY support Sergey Organov
2020-07-06 14:26 ` [PATCH 1/5] net: fec: properly support external PTP PHY for hardware time stamping Sergey Organov
2020-07-06 15:08   ` Vladimir Oltean
2020-07-06 15:21     ` Sergey Organov
2020-07-06 15:47       ` Vladimir Oltean
2020-07-06 18:33         ` Sergey Organov
2020-07-07  7:04           ` Vladimir Oltean
2020-07-07 15:29             ` Sergey Organov
2020-07-08 11:00             ` Richard Cochran
2020-07-08 10:55           ` Richard Cochran
2020-07-06 14:26 ` [PATCH 2/5] net: fec: enable to use PPS feature without " Sergey Organov
2020-07-07  4:05   ` [EXT] " Andy Duan
2020-07-07 14:29     ` Sergey Organov
2020-07-06 14:26 ` [PATCH 3/5] net: fec: initialize clock with 0 rather than current kernel time Sergey Organov
2020-07-06 15:27   ` Vladimir Oltean
2020-07-06 18:24     ` Sergey Organov
2020-07-07  6:36       ` Vladimir Oltean
2020-07-07 16:07         ` Sergey Organov
2020-07-07 16:43           ` Vladimir Oltean
2020-07-07 17:09             ` Sergey Organov
2020-07-07 17:12               ` Vladimir Oltean
2020-07-07 17:56                 ` Sergey Organov
2020-07-08 11:15                   ` Richard Cochran
2020-07-08 12:14                     ` Sergey Organov
2020-07-08 11:11             ` Richard Cochran
2020-07-08 11:04     ` Richard Cochran
2020-07-08 12:24       ` Sergey Organov
2020-07-08 12:37       ` Sergey Organov
2020-07-08 14:48         ` Richard Cochran
2020-07-08 17:18           ` Sergey Organov [this message]
2020-07-06 14:26 ` [PATCH 4/5] net: fec: get rid of redundant code in fec_ptp_set() Sergey Organov
2020-07-07  4:08   ` [EXT] " Andy Duan
2020-07-07 14:43     ` Sergey Organov
2020-07-08  5:34       ` Andy Duan
2020-07-08  8:48         ` Sergey Organov
2020-07-08  8:57           ` Andy Duan
2020-07-08 12:26             ` Sergey Organov
2020-07-06 14:26 ` [PATCH 5/5] net: fec: replace snprintf() with strlcpy() in fec_ptp_init() Sergey Organov
2020-07-11 12:08 ` [PATCH v2 net] net: fec: fix hardware time stamping by external devices Sergey Organov
2020-07-11 23:19   ` Vladimir Oltean
2020-07-12 14:16     ` Sergey Organov
2020-07-12 14:47       ` Andrew Lunn
2020-07-12 15:01       ` Vladimir Oltean
2020-07-12 17:29         ` Sergey Organov
2020-07-12 19:33           ` Vladimir Oltean
2020-07-12 22:32             ` Sergey Organov
2020-07-12 23:15               ` Vladimir Oltean
2020-07-14 12:39                 ` Sergey Organov
2020-07-14 14:23                   ` Vladimir Oltean
2020-07-14 14:35                     ` Sergey Organov
2020-07-14 14:44                     ` Vladimir Oltean
2020-07-14 16:18                       ` Sergey Organov
2020-07-14 14:01   ` Richard Cochran
2020-07-14 14:27     ` Sergey Organov
2020-07-14 16:28 ` [PATCH v3 " Sergey Organov
2020-07-16 18:24   ` Jakub Kicinski
2020-07-16 20:38     ` Sergey Organov
2020-07-16 21:06       ` Jakub Kicinski
2020-07-16 21:18         ` Sergey Organov
2020-07-15 15:42 ` [PATCH net-next v2 0/4] net: fec: a few improvements Sergey Organov
2020-07-15 15:42   ` [PATCH net-next v2 1/4] net: fec: enable to use PPS feature without time stamping Sergey Organov
2020-07-15 15:42   ` [PATCH net-next v2 2/4] net: fec: initialize clock with 0 rather than current kernel time Sergey Organov
2020-07-15 15:42   ` [PATCH net-next v2 3/4] net: fec: get rid of redundant code in fec_ptp_set() Sergey Organov
2020-07-15 15:43   ` [PATCH net-next v2 4/4] net: fec: replace snprintf() with strlcpy() in fec_ptp_init() Sergey Organov
2020-07-16  3:00   ` [EXT] [PATCH net-next v2 0/4] net: fec: a few improvements Andy Duan
2020-07-16 18:37     ` Jakub Kicinski

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=87k0ze7wna.fsf@osv.gnss.ru \
    --to=sorganov@gmail.com \
    --cc=davem@davemloft.net \
    --cc=fugang.duan@nxp.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.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.