> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Vivien Didelot > Sent: Thursday, June 25, 2020 9:01 PM > > This series allows to capture packets from a Mellanox ConnectX-5 > interface > into a PCAP file with support for hardware timestamps. Since libibverbs > already provides timestamp conversion to nanoseconds for mlx5, the > necessary > glue is added before writing the driver's timestamps into the PCAP > headers.
Which clock source is the nanosecond timestamps output from this function using? CLOCK_REALTIME, the NIC clock, the CPU clock, or something else? If it is the NIC clock, I guess a simple scaling factor could be used instead, for performance reasons. The driver could expose the scaling factor (or for even better resolution: its clock frequency), e.g. through the capabilities API, so the application can cache it and convert to nanoseconds by multiplying a scaling factor and adding an offset. The application would have to handle clock drift between the NIC clock and CLOCK_REALTIME (or some other preferred reference clock source) anyway.