From: Vladimir Oltean <olteanv@gmail.com>
To: Luke Howard <lukeh@padl.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Vivien Didelot <vivien.didelot@gmail.com>,
Gregory CLEMENT <gregory.clement@bootlin.com>,
Andrew Lunn <andrew@lunn.ch>,
Richard Cochran <richardcochran@gmail.com>,
Cedric Jehasse <cedric.jehasse@gmail.com>,
Kieran Tyrrell <kieran@sienda.com>,
Max Holtmann <mh@rme-audio.de>, Max Hunter <max@huntershome.org>,
Christoph Mellauner <christoph.mellauner@joyned.at>,
Simon Gapp <simon.gapp@gapp-audio.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 0/2] net: dsa: mv88e6xxx: various hwstamp fixes
Date: Mon, 20 Jul 2026 01:57:01 +0300 [thread overview]
Message-ID: <20260719225701.okkvl2uhgsuwydfi@skbuf> (raw)
In-Reply-To: <92B1BC3E-6976-478B-8B34-043EFE63C3DA@padl.com>
On Sun, Jul 19, 2026 at 09:22:39PM +1000, Luke Howard wrote:
> Hi Vladimir,
>
> > ocelot_ptp_rx_timestamp() accesses MMIO-based registers, which can be
> > done atomically.
> > mv88e6xxx_ptp_clock_read() accesses MDIO bus registers, and the MDIO bus
> > is sleepable. Fundamental difference.
> >
> > Your hardware only provides 32 bits of partial timestamp, so
> > mv88e6xxx_ptp_clock_read() will always be needed one way or another, to
> > recover the full 64 bits. Either through tstamp_{cc,tc} or through
> > direct calls.
>
> This still happens from overflow_work().
Ok. My mistake.
> >> Deferring to the worker can reorder frames such that PTP general
> >> messages arrive before the timestamped event messages, which confuses
> >> some other PTP implementations such as gptp2d [1].
> >
> > True, this is a caveat, but event messages and general messages can
> > already take different network paths, especially with PTP over IP where
> > they go through different UDP ports (even if for gPTP that is not the case).
> > The PTP user space implementation needs to be prepared to handle this.
>
> Good point. So perhaps processing the embedded timestamp inline
> doesn’t confer much benefit. ptp4l (which we use) handles out-of-order
> messages fine.
If you're intending the in-band timestamps as a fix for gptp2d's
limitations, then no. As a general optimization - maybe.
> >> This optimisation of course only works for ArrTSMode because there is
> >> no MDIO read required.
> >
> > I don't understand this comment given the partial 32-bit timestamp
> > limitation.
>
> Better phrased as no MDIO read to recover the arrival timestamp.
Yeah, the timecounter/cyclecounter requires refreshes at least once
every 32-bit wraparound/2 time in order for the trick to work. But since
that is set up, it frees up the need to access MDIO per packet, since it
is guaranteed that cycle_now - tc->cycle_last is no larger than half the
wraparound time, which permits distinguishing timestamps taken by
hardware before tc->cycle_last from those taken after tc->cycle_last,
and correctly converting both to a valid 64-bit time base. Quite clever,
actually, I didn't fully understand the first time.
The only problem with timecounter/cyclecounter is that the hardware
clock remains free-running, which means you won't be able to apply a
time-synchronized taprio schedule (if the hw supports that).
next prev parent reply other threads:[~2026-07-19 22:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 6:43 [PATCH net-next v2 0/2] net: dsa: mv88e6xxx: various hwstamp fixes Luke Howard
2026-07-10 6:43 ` [PATCH net-next v2 1/2] net: dsa: mv88e6xxx: use ARRIVAL1 counter for all peer delay messages Luke Howard
2026-07-10 6:43 ` [PATCH net-next v2 2/2] net: dsa: mv88e6xxx: embedded PTP timestamp support Luke Howard
2026-07-19 10:12 ` Vladimir Oltean
2026-07-19 11:35 ` Luke Howard
2026-07-19 23:04 ` Vladimir Oltean
2026-07-20 1:16 ` Luke Howard
2026-07-16 10:57 ` [PATCH net-next v2 0/2] net: dsa: mv88e6xxx: various hwstamp fixes Simon Horman
2026-07-17 7:47 ` Luke Howard
2026-07-19 9:53 ` Vladimir Oltean
2026-07-19 11:22 ` Luke Howard
2026-07-19 22:57 ` Vladimir Oltean [this message]
2026-07-20 1:13 ` Luke Howard
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=20260719225701.okkvl2uhgsuwydfi@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=cedric.jehasse@gmail.com \
--cc=christoph.mellauner@joyned.at \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregory.clement@bootlin.com \
--cc=kieran@sienda.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukeh@padl.com \
--cc=max@huntershome.org \
--cc=mh@rme-audio.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=simon.gapp@gapp-audio.com \
--cc=vivien.didelot@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