DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Stephen Hemminger" <stephen@networkplumber.org>, <dev@dpdk.org>
Subject: RE: [RFC 00/13] Packet capture using port mirroring
Date: Sat, 12 Apr 2025 13:06:55 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9FBC9@smartserver.smartshare.dk> (raw)
In-Reply-To: <20250411234927.114568-1-stephen@networkplumber.org>

> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Saturday, 12 April 2025 01.45
> 
> 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.

Here's some general feedback...

I very much like the concept of using a shared ring for carrying the mirrored packets.
It allows other types of future consumers to process the mirrored packets, e.g. encapsulating and forwarding them into an L2 or L3 tunnel, or Wireshark remote capture.

Using a Ring PMD instead of setting up a dedicated ring also has some advantages, such as the ability to set up multiple separate mirror target instances.
For performance reasons, we should ensure that a lightweight Ring PMD is available for mirroring, in case the Ring PMD is extended with new features affecting its performance.
Or maybe create a new type of mirror/capture virtual PMD. This would allow applications to enqueue packets from non-ethdev interfaces into it.

I'm not convinced you should undo the VLAN offloads when enqueueing a mirror packet... If you do, you should also undo QinQ offloads. Undoing offloads is never going to end.
And if you create a dedicated PMD type for carrying mirrored packets, you can ensure that the offload fields remain intact on dequeue.

You should consider sampling and VLAN filtering as typical mirroring features.
It would improve the performance if such filtering is done before copying the packets.

PS: I agree with your choice of copying (rather than cloning by refcount) when mirroring the packets.

> 
> 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.



  parent reply	other threads:[~2025-04-12 11:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 23:44 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 ` Morten Brørup [this message]
2025-04-12 17:04   ` [RFC 00/13] Packet capture using port mirroring Stephen Hemminger
2025-04-13  9:26     ` Morten Brørup

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=98CBD80474FA8B44BF855DF32C47DC35E9FBC9@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).