Re: [PATCH net-next 0/3] net: stmmac: Add support for coarse timestamping

Kory Maincent
2025-10-15T12:55:28Z

On Wed, 15 Oct 2025 12:27:20 +0200
Maxime Chevallier <maxime.chevallier@bootlin.com> wrote:

> Hello everyone,
>
> This is another attempt to support the fine vs coarse timestamping modes
> in stmmac.
>
> This mode allows trading off PTP clock frequency adjustment precision
> versus timestamping precision.
>
> In coarse mode, we lose the ability to fine-tune the PTP clock
> frequency, but get better timestamping precision instead. This is
> especially useful when acting as a PTP Grand Master, where the PTP clock
> in sync'd to a high-precision GPS clock through PPS inputs.
>
> This has been submitted before as a dedicated ioctl() back in 2020 [1].
> Since then, we now have a better representation of timestamp providers
> with a dedicated qualifier (approx vs precise).
>
> This series attempts to map these new qualifiers to stmmac's
> timestamping modes, see patch 2 for details.
>
> The main drawback IMO is that the qualifiers don't map very well to our
> timestamping modes, as the "approx" qualifier actually maps to stmmac's
> "coars" mode, but we actually gain in timestamping precision (while
> losing frequency precision).

https://elixir.bootlin.com/linux/v6.17.1/source/include/uapi/linux/net_tstamp.h#L16
"approx" was initially added for DMA timestamp point.
Maybe we should add a new enum value here with a more suitable name.

Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering