DPDK patches and discussions
 help / color / mirror / Atom feed
* [RFC 00/13] Packet capture using port mirroring
@ 2025-04-11 23:44 Stephen Hemminger
  2025-04-11 23:44 ` [RFC 01/13] app/testpmd: revert auto attach/detach Stephen Hemminger
                   ` (13 more replies)
  0 siblings, 14 replies; 25+ messages in thread
From: Stephen Hemminger @ 2025-04-11 23:44 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

This is a rework of how packet capture is done in DPDK.
The existing mechanism using callbacks has a number of problems;
the main one is that any packets sent/received in a secondary process
are not visible. The root cause is that callbacks can not function
across process boundaries, they are specific to the role.

The new mechanism builds on the concept of port mirroring used
in Linux/FreeBSD and also router vendors (SPAN ports). The infrastructure
is built around a new ethdev call to mirror a port.

The internals of dumpcap are redone but the program command
syntax is unchanged (no doc change needed). Usingthe new mirror mechanism,
the dumpcap program creates a port using ring PMD and
then directs mirror to that. Then the packets are extracted from the ring.
If capturing on multiple devices, they all get mirrored to
the same ring PMD.

Doing this uncovered a bunch of additional missing features and bugs.
The first is that test-pmd auto attach introduced in 24.11 breaks this
(and it broke old pdump as well) so it is removed.

The dumpcap program needs to be able to start the ring PMD it created
but the existing ethdev API is broken when used from secondary process.
So fix that.

The mirror API has a restriction that the port being mirrored to must allow
lock free transmit. This is because both rx and tx as well as multiple
queues need to go over the same transmit queue. Although it might be possible
to have some complex mapping between multiple ports/queues being mirrored
to multiple transmit queues, that gets to be a lot of overhead in API's
and implementation. Fixing the ring and null PMD to allow lockeless
transmit is good enough.

Added tests for the new features.
The performance has not been measured but the overhead of checking for
mirror port is no more that the overhead of looking at the callback list.

TODO items:
  - need release notes for new features
  - more through testing on real hardware
  - mark old pdump API and application for deprecation in 25.07 and removal in 25.11
  - more cleanup of patch wording and docs needed.

Stephen Hemminger (13):
  app/testpmd: revert auto attach/detach
  ethdev: allow start/stop from secondary process
  test: add test for hotplug and secondary process operations
  net/ring: allow lockfree transmit if ring supports it
  net/ring: add argument to attach existing ring
  net/ring: add timestamp devargs
  net/null: all lockfree transmit
  mbuf: add fields for mirroring
  ethdev: add port mirror capability
  pcapng: split packet copy from header insertion
  test: add tests for ethdev mirror
  app/testpmd: support for port mirroring
  app/dumpcap: use port mirror instead of pdump

 app/dumpcap/main.c                          | 361 +++++++++++++++-----
 app/dumpcap/meson.build                     |   2 +-
 app/test-pmd/cmdline.c                      |   1 +
 app/test-pmd/cmdline_mirror.c               | 120 +++++++
 app/test-pmd/cmdline_mirror.h               |  12 +
 app/test-pmd/meson.build                    |   1 +
 app/test-pmd/testpmd.c                      |  77 ++---
 app/test/meson.build                        |   1 +
 app/test/test_ethdev_mirror.c               | 286 ++++++++++++++++
 app/test/test_mp_secondary.c                |  51 ++-
 config/rte_config.h                         |   2 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  15 +
 drivers/net/null/rte_eth_null.c             |   1 +
 drivers/net/ring/rte_eth_ring.c             |  91 ++++-
 lib/ethdev/ethdev_driver.c                  |  11 +-
 lib/ethdev/ethdev_driver.h                  |   3 +
 lib/ethdev/ethdev_private.c                 |  80 +++++
 lib/ethdev/ethdev_private.h                 |  23 ++
 lib/ethdev/ethdev_trace.h                   |  14 +
 lib/ethdev/ethdev_trace_points.c            |   6 +
 lib/ethdev/rte_ethdev.c                     | 275 +++++++++++++--
 lib/ethdev/rte_ethdev.h                     |  81 +++++
 lib/ethdev/rte_ethdev_core.h                |   6 +-
 lib/mbuf/rte_mbuf_core.h                    |   8 +
 lib/pcapng/rte_pcapng.c                     | 178 +++++-----
 lib/pcapng/rte_pcapng.h                     |  27 +-
 26 files changed, 1468 insertions(+), 265 deletions(-)
 create mode 100644 app/test-pmd/cmdline_mirror.c
 create mode 100644 app/test-pmd/cmdline_mirror.h
 create mode 100644 app/test/test_ethdev_mirror.c

-- 
2.47.2


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2025-04-16  0:06 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-11 23:44 [RFC 00/13] Packet capture using port mirroring Stephen Hemminger
2025-04-11 23:44 ` [RFC 01/13] app/testpmd: revert auto attach/detach Stephen Hemminger
2025-04-15 13:28   ` lihuisong (C)
2025-04-16  0:06     ` Stephen Hemminger
2025-04-11 23:44 ` [RFC 02/13] ethdev: allow start/stop from secondary process Stephen Hemminger
2025-04-15  0:19   ` Stephen Hemminger
2025-04-11 23:44 ` [RFC 03/13] test: add test for hotplug and secondary process operations Stephen Hemminger
2025-04-11 23:44 ` [RFC 04/13] net/ring: allow lockfree transmit if ring supports it Stephen Hemminger
2025-04-11 23:44 ` [RFC 05/13] net/ring: add argument to attach existing ring Stephen Hemminger
2025-04-11 23:44 ` [RFC 06/13] net/ring: add timestamp devargs Stephen Hemminger
2025-04-11 23:44 ` [RFC 07/13] net/null: all lockfree transmit Stephen Hemminger
2025-04-11 23:44 ` [RFC 08/13] mbuf: add fields for mirroring Stephen Hemminger
2025-04-12  9:59   ` Morten Brørup
2025-04-12 16:56     ` Stephen Hemminger
2025-04-13  7:00       ` Morten Brørup
2025-04-13 14:31         ` Stephen Hemminger
2025-04-13 14:44           ` Morten Brørup
2025-04-11 23:44 ` [RFC 09/13] ethdev: add port mirror capability Stephen Hemminger
2025-04-11 23:44 ` [RFC 10/13] pcapng: split packet copy from header insertion Stephen Hemminger
2025-04-11 23:44 ` [RFC 11/13] test: add tests for ethdev mirror Stephen Hemminger
2025-04-11 23:44 ` [RFC 12/13] app/testpmd: support for port mirroring Stephen Hemminger
2025-04-11 23:44 ` [RFC 13/13] app/dumpcap: use port mirror instead of pdump Stephen Hemminger
2025-04-12 11:06 ` [RFC 00/13] Packet capture using port mirroring Morten Brørup
2025-04-12 17:04   ` Stephen Hemminger
2025-04-13  9:26     ` Morten Brørup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).