net/pcap: support Tx nanosecond timestamps
authorVivien Didelot <vivien.didelot@gmail.com>
Tue, 9 Jun 2020 19:07:19 +0000 (15:07 -0400)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jun 2020 17:21:07 +0000 (19:21 +0200)
commita7d42145cc187adaa336e48f1bdd83a6f5673773
tree30a4578ef2c9ebd7bd38d281a961fd3d6341267a
parent3efac8085e2c596ce469b45349f85f2929b6aba4
net/pcap: support Tx nanosecond timestamps

When capturing packets into a PCAP file, DPDK currently uses
microseconds for the timestamps. But libpcap supports interpreting
tv_usec as nanoseconds depending on the file timestamp precision,
as of commit ba89e4a18e8b ("Make timestamps precision configurable").

To support this, use PCAP_TSTAMP_PRECISION_NANO when creating the
empty PCAP file as specified by PCAP_OPEN_DEAD(3PCAP) and implement
nanosecond timeval addition. This also ensures that the precision
reported by capinfos is nanoseconds (9).

Note that NSEC_PER_SEC is defined as 1000000000L instead of 1e9 since
the latter might be interpreted as floating point.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
doc/guides/rel_notes/release_20_08.rst
drivers/net/pcap/rte_eth_pcap.c