[dpdk-dev] [RFC PATCH 0/3] Add rte_eth_read_clock API

Tom Barbette barbette at kth.se
Wed Nov 28 10:52:09 CET 2018


Some NICs allows to timestamp packets, but do not support the full
PTP synchronization process. Hence, the value set in the mbuf
timestamp field is only the raw value of an internal clock.

To make sense of this value, one at least needs to be able to query
the current hardware clock value. As with the TSC, from there
a frequency can be derieved by querying multiple time the current value of the
internal clock with some known delay between the queries.

This RFC patch series adds support for MLX5.

An example is provided in the rxtx_callback application.
It has been updated to display, on top of the software latency
in cycles, the total latency since the packet was received in hardware.
The API is used to compute a delta in the TX callback. The raw amount of
ticks is converted to cycles using the technique describe above.

Aside from offloading timestamping, which relieve the
software from a few operations, this allows to get much more precision
when studying the source of the latency in a system.
Eg. in our 100G, CX5 setup the rxtx callback application shows
SW latency is around 74 cycles (TSC is 3.2Ghz), but the latency 
including NIC processing, PCIe, and queuing is around 196 cycles.

The RFC lacks the documentation update for the sample application. I wanted
further validation before doing so. I'm not sure if it's fine to
update an example to show a "double feature". At the same time a full app for
this would be overkill, and the information nicely complements the one
in rxtx_callback.

Tom Barbette (3):
  rte_ethdev: Add API function to read dev clock
  mlx5: Implement support for read_clock
  rxtx_callbacks: Add support for HW timestamp

 doc/guides/nics/features.rst             |  1 +
 drivers/net/mlx5/mlx5.c                  |  1 +
 drivers/net/mlx5/mlx5.h                  |  1 +
 drivers/net/mlx5/mlx5_ethdev.c           | 31 +++++++++
 drivers/net/mlx5/mlx5_glue.c             |  8 +++
 drivers/net/mlx5/mlx5_glue.h             |  2 +
 examples/rxtx_callbacks/Makefile         |  2 +
 examples/rxtx_callbacks/main.c           | 87 ++++++++++++++++++++++--
 examples/rxtx_callbacks/meson.build      |  1 +
 lib/librte_ethdev/rte_ethdev.c           | 13 ++++
 lib/librte_ethdev/rte_ethdev.h           | 23 +++++++
 lib/librte_ethdev/rte_ethdev_core.h      |  6 ++
 lib/librte_ethdev/rte_ethdev_version.map |  1 +
 lib/librte_mbuf/rte_mbuf.h               |  2 +
 14 files changed, 175 insertions(+), 4 deletions(-)

-- 
2.17.1



More information about the dev mailing list