DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 0/7] pcapng: fixes, timestamps and stdio output
Date: Tue,  1 Dec 2026 14:41:33 -0800	[thread overview]
Message-ID: <20261201224258.1962108-1-stephen@networkplumber.org> (raw)

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	other threads:[~2026-12-01 22:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 22:41 Stephen Hemminger [this message]
2026-12-01 22:41 ` [PATCH 1/7] graph: fix double close of pcapng file Stephen Hemminger
2026-12-01 22:41 ` [PATCH 2/7] pcapng: call writev as needed on highly segmented mbuf Stephen Hemminger
2026-12-01 22:41 ` [PATCH 3/7] eal: add function to convert TSC to epoch time Stephen Hemminger
2026-12-01 22:41 ` [PATCH 4/7] pcapng: use EAL TSC to epoch conversion Stephen Hemminger
2026-12-01 22:41 ` [PATCH 5/7] pcapng: add user-supplied timestamp support Stephen Hemminger
2026-12-01 22:41 ` [PATCH 6/7] test/pcapng: compare timestamps in one clock domain Stephen Hemminger
2026-12-01 22:41 ` [PATCH 7/7] pcapng: use stdio for output Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201224258.1962108-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox