Re: Extending socket timestamping API for NTP
From: Denny Page <hidden>
Date: 2017-02-08 06:20:51
On Feb 07, 2017, at 06:01, Miroslav Lichvar [off-list ref] wrote: 1) new rx_filter for NTP Some NICs can't timestamp all received packets and are currently unusable for NTP with HW timestamping. The new filter would allow NTP support in new NICs and adding support to existing NICs with firmware/driver updates. The filter would apply to IPv4 and IPv6 UDP packets received from or sent to the port number 123.
I think this is a good idea. Even if the hardware doesn’t support it, the filtering could be done in the kernel. Save a huge number of context switches.
4) allow sockets to use both SW and HW TX timestamping at the same time When using a socket which is not bound to a specific interface, it would be nice to get transmit SW timestamps when HW timestamps are missing. I suspect it's difficult to predict if a HW timestamp will be available. Maybe it would be acceptable to get from the error queue two messages per transmission if the interface supports both SW and HW timestamping?
Highly agreed. The current interface pretty much forces a socket per physical interface, which should not be necessary.
5) new SO_TIMESTAMPING options to get transposed RX timestamps PTP uses preamble RX timestamps, but NTP works with trailer RX timestamps. This means NTP implementations currently need to transpose HW RX timestamps. The calculation requires the link speed and the length of the packet at layer 2. It seems this can be reliably done only using raw sockets. It would be very nice if the kernel could tranpose the timestamps automatically. The existing SOF_TIMESTAMPING_RX_HARDWARE flag could be aliased to SOF_TIMESTAMPING_RX_HARDWARE_PREAMBLE and the new flag could be SOF_TIMESTAMPING_RX_HARDWARE_TRAILER. PTP has a similar problem with SW RX timestamps, which are closer to the trailer timestamps rather than preamble timestamps. A new SOF_TIMESTAMPING_RX_SOFTWARE_PREAMBLE flag could be added for PTP implementations to get transposed timestamps in order to improve accuracy.
Also highly agreed. Denny