This covers the pcapng library, plus one EAL addition that the
timestamp changes build on.

The first two patches are independent bug fixes and are marked for stable,

The next four patches deal with time. The conversion from TSC to
nanoseconds since the epoch was living in pcapng, although nothing
about it is specific to packet capture. EAL now takes the reference
point at init and exposes rte_tsc_to_ns(), and pcapng uses that
instead of its own copy. The conversion now happens when the packet
is copied, so the timestamp in the mbuf is already epoch nanoseconds
and no longer has to come from the TSC. rte_pcapng_copy_ts() lets an
application pass the time of the packet directly, for example a
hardware Rx timestamp. The user-timestamp support is based on a patch
from Marek Kasiewicz and Dawid Wesierski.

The pcapng test was comparing file timestamps against
clock_gettime(CLOCK_REALTIME), which measures NTP slew against the
calibrated TSC rate rather than anything about pcapng. It now bounds
the window with rte_tsc_to_ns() so both sides come from the same
reference point, and also checks that timestamps never go backwards.

The last patch replaces writev with stdio. Writing to a FILE * makes
it possible to capture to a pipe or a compressed stream, and lets the
application decide on buffering and when to fflush, which matters for
a live reader like Wireshark. Writing packets also becomes
multi-thread safe because stdio does the locking.
rte_pcapng_fdopen() keeps its old behavior: the stream it creates is
flushed at the end of each write call, so data still reaches the file
before the call returns.

Dawid Wesierski (1):
  pcapng: add user-supplied timestamp support

Stephen Hemminger (6):
  graph: fix double close of pcapng file
  pcapng: call writev as needed on highly segmented mbuf
  eal: add function to convert TSC to epoch time
  pcapng: use EAL TSC to epoch conversion
  test/pcapng: compare timestamps in one clock domain
  pcapng: use stdio for output

 app/test/test_cycles.c                 |  34 +++
 app/test/test_pcapng.c                 | 356 +++++++++++++++----------
 doc/api/doxy-api-index.md              |   1 +
 doc/guides/prog_guide/pcapng_lib.rst   |   4 +
 doc/guides/rel_notes/release_27_03.rst |  19 ++
 lib/eal/common/eal_common_timer.c      |  59 ++++
 lib/eal/include/rte_time.h             |  34 +++
 lib/eal/windows/include/rte_os_shim.h  |   6 +
 lib/graph/graph_pcap.c                 |   4 +-
 lib/pcapng/rte_pcapng.c                | 314 +++++++++++-----------
 lib/pcapng/rte_pcapng.h                | 100 ++++++-
 11 files changed, 628 insertions(+), 303 deletions(-)

-- 
2.53.0

Reply via email to