Re: [dpdk-dev] mlx5 & pdump: convert HW timestamps to nanoseconds
From: PATRICK KEROULAS <hidden>
Date: 2020-05-22 18:43:19
quoted
quoted
quoted
mlx5 part of libibverbs includes a ts-to-ns converter which takes the instantaneous clock info. It's unused in dpdk so far. I've tested it in the device/port init routine and the result looks reliable. Since this approach looks very simple, compared to the time sync mechanism, I'm trying to integrate. The conversion should occur in the primary process (testpmd) I suppose. 1) The needed clock info derives from ethernet device. Is it possible to access that struct from a rx callback? 2) how to attach the nanosecond to mbuf so that `pdump` catches it? (workaround: copy `mbuf->udata64` in forwarded packets.) 3) any other idea?The timestamp is carried in mbuf. Then the conversion must be done by the ethdev caller (application or any other upper layer).What if the converter function needs a clock_info? https://github.com/linux-rdma/rdma-core/blob/7af01c79e00555207dee6132d72e7bfc1bb5485e/providers/mlx5/mlx5dv.h#L1201 I'm affraid this info may change by the time the converter is called by upper layer.Indeed, the clock in the device is not an atomic one :) We need to adjust the time conversion continuously. I am not an expert of time synchronization, so I add more people Cc who could help for having a precise timestamp.
Thanks Thomas. Not sure this is a synchronization issue. We have dedicated processes (linuxptp) to keep both NIC and sys clocks in sync with an external clock. It is "just" a matter of unit conversion. If it has to be performed in dpdk-pdump, I would need some help to retrieve mlx5_clock_info from inside a secondary process. Looking at mlx5_read_clock(), this info is extracted from ibv_context which looks reachable in a primary process only (segfault, if I try in pdump).