Re: [PATCH net-next] net: stmmac: ptp: switch to gettimex64() interface

From: Nicolai Buchwitz

Date: Tue Oct 06 2026 - 18:11:51 EST


Hi James

On 6.10.2026 12:36, James Clark wrote:
The stmmac PTP support currently implements the gettime64 callback to
retrieve the hardware clock time. Update the implementation to provide
the gettimex64 callback instead, adding support for the
PTP_SYS_OFFSET_EXTENDED ioctl.

The system clock readings are taken around the read of the nanoseconds
register in get_systime(), so get_systime() gains a ptp_system_timestamp
argument. rmb() is used to ensure proper ordering on weakly ordered
architectures.

Assisted-by: LLM
Signed-off-by: James Clark <jjc@xxxxxxxxxx>
---
Tested on a Radxa ZERO 3E (RK3566, DWMAC 4/5) running net-next.
Width of the interval between the two system clock readings
bracketing each PHC read (2000 calls of 25 samples each):

min median
Before patch (PTP_SYS_OFFSET): 875 ns 1167 ns
After patch (PTP_SYS_OFFSET_EXTENDED): 291 ns 584 ns

On this board the 24 MHz arch timer counter advances in steps of 7
(~292 ns), so all intervals are multiples of that.

[...]

(for the other patches you have prepared I will have a look later this week)

Reviewed-by: Nicolai Buchwitz <nb@xxxxxxxxxxx>

Thanks,
Nicolai