netutils/ptpd: refuse to start when -H has no hardware timestamp support.

When ptpd runs over IEEE 802.3 (-2) with hardware timestamping and
ETHTOOL_GET_TS_INFO does not report SOF_TIMESTAMPING_TX_HARDWARE,
SOF_TIMESTAMPING_RX_HARDWARE and SOF_TIMESTAMPING_RAW_HARDWARE for the
interface, refuse to start instead of logging a warning and running in
software - the same way linuxptp/ptp4l refuses to start when hardware
timestamping is configured but not reported as supported by ethtool,
rather than silently degrading. The error message names the missing
capability and points to -S, and the usage text documents the
requirement.

Hardware RX timestamps are required as well: without them the receive
timestamps come from the system clock while the transmit ones come from
the MAC, and the two cannot be combined into a meaningful delay.

The check is limited to the 802.3 transport, the only one on which ptpd
retrieves hardware TX timestamps. -H is the default with
CONFIG_NET_TIMESTAMP, so applying it to the UDP transports would make a
plain "ptpd" refuse to start on any interface whose driver does not
report hardware timestamping, although it never needs that capability.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
This commit is contained in:
Daniel P. Carvalho 2026-09-24 11:31:11 -03:00 • committed by Xiang Xiao
parent 269bdf0440
commit df19cbe26b
2 changed files with 35 additions and 7 deletions

View file

@ -157,6 +157,8 @@ static void usage(FAR const char *progname)
" -6 UDP IPV6\n"
" Time Stamping:\n"
" -H HARDWARE (default) depends on NET_TIMESTAMP\n"
" with -2, requires hardware RX and TX\n"
" timestamp support from the interface\n"
" -S SOFTWARE\n"
" -B The best master clock algorithm is used\n"
" -r synchronize system (realtime) clock\n"