Onload supports hardware timestamping of UDP and TCP packets transmitted over a supported interface. A timestamp is generated when the first byte enters the adapter.
Recent Linux kernels support hardware timestamps for TCP, and Onload 8.1 adds similar capability. To recover hardware timestamps for transmitted TCP packets that are similar to the Linux kernel, set the following socket options:
SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_SYS_HARDWARE | SOF_TIMESTAMPING_RAW_HARDWARE
Because older Linux kernels do not support hardware timestamps for TCP, Onload provides an extension to the standard
SO_TIMESTAMPING API with the ONLOAD_SOF_TIMESTAMPING_STREAM socket option to support this. To recover
hardware timestamps for transmitted TCP packets that use an Onload proprietary format, set the following socket options:
SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_SYS_HARDWARE | SOF_TIMESTAMPING_RAW_HARDWARE | ONLOAD_SOF_TIMESTAMPING_STREAM
To recover hardware timestamps for transmitted UDP packets, set the following socket options:
SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_SYS_HARDWARE | SOF_TIMESTAMPING_RAW_HARDWARE
From Onload 8.1 onwards, SOF_TIMESTAMPING_OPT_ID and SOF_TIMESTAMPING_OPT_TSONLY are also supported with Linux-style
timestamps.
Other socket flag combinations, not listed above, will be silently ignored.
To receive hardware transmit timestamps:
- You must set EF_TX_TIMESTAMPING on stacks where transmit timestamping is required.
- You must set EF_TIMESTAMPING_REPORTING to control the type of timestamp returned to the application. This is optional, by default Onload will report translated timestamps if the adapter clock has been fully synchronized to correct time by the Solarflare PTP daemon. In all cases Onload will always report raw timestamps. Refer to Parameter Reference for full details of the EF_TIMESTAMPING_REPORTING variable.
- Solarflare PTP (sfptpd) must be running if timestamps are to be synchronized with an external PTP master clock.
For details of the SO_TIMESTAMPING API refer to the Linux documentation:
https://www.kernel.org/doc/Documentation/networking/timestamping/