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

Maxime Chevallier
2025-10-15T10:27:53Z

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).

Patch 1 is prep work for the stmmac driver,
Patch 2 adds the mode adjustment. Most of the plumbing to compute addend
values and sub-second increment is already there in the driver.

Patch 3 makes sure our NDO for timestamping provider reconfiguration is
called upon changing the qualifier.

Let me kow what you think of this approach,

Maxime

[1] : https://lore.kernel.org/netdev/20200514102808.31163-1-olivier.dautricourt@orolia.com/

Maxime Chevallier (3):
net: stmmac: Move subsecond increment configuration in dedicated
helper
net: stmmac: Allow supporting coarse adjustment mode
net: ethtool: tsconfig: Re-configure hwtstamp upon provider change

.../ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 62 +++++++++++++------
net/ethtool/tsconfig.c | 2 +-
3 files changed, 45 insertions(+), 21 deletions(-)

--
2.49.0