From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Konstantin Ananyev <konstantin.ananyev@huawei.com>
Subject: [PATCH v11 14/14] doc: add documentation for port mirroring
Date: Fri, 8 Aug 2025 09:55:52 -0700 [thread overview]
Message-ID: <20250808165843.39075-15-stephen@networkplumber.org> (raw)
In-Reply-To: <20250808165843.39075-1-stephen@networkplumber.org>
Add ethdev port mirror to documentation.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
doc/guides/prog_guide/bpf_lib.rst | 2 +
doc/guides/prog_guide/ethdev/index.rst | 1 +
doc/guides/prog_guide/ethdev/port_mirror.rst | 68 ++++++++++++++++++++
doc/guides/rel_notes/deprecation.rst | 5 ++
doc/guides/rel_notes/release_25_11.rst | 5 ++
5 files changed, 81 insertions(+)
create mode 100644 doc/guides/prog_guide/ethdev/port_mirror.rst
diff --git a/doc/guides/prog_guide/bpf_lib.rst b/doc/guides/prog_guide/bpf_lib.rst
index 8c820328b9..038da03360 100644
--- a/doc/guides/prog_guide/bpf_lib.rst
+++ b/doc/guides/prog_guide/bpf_lib.rst
@@ -1,6 +1,8 @@
.. SPDX-License-Identifier: BSD-3-Clause
Copyright(c) 2018 Intel Corporation.
+.. _bpf_library:
+
Berkeley Packet Filter (BPF) Library
====================================
diff --git a/doc/guides/prog_guide/ethdev/index.rst b/doc/guides/prog_guide/ethdev/index.rst
index 392ced0a2e..cb905b92f1 100644
--- a/doc/guides/prog_guide/ethdev/index.rst
+++ b/doc/guides/prog_guide/ethdev/index.rst
@@ -12,4 +12,5 @@ Ethernet Device Library
flow_offload
traffic_metering_and_policing
traffic_management
+ port_mirror
qos_framework
diff --git a/doc/guides/prog_guide/ethdev/port_mirror.rst b/doc/guides/prog_guide/ethdev/port_mirror.rst
new file mode 100644
index 0000000000..f270fb6627
--- /dev/null
+++ b/doc/guides/prog_guide/ethdev/port_mirror.rst
@@ -0,0 +1,68 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+ Copyright(c) 2025 Stephen Hemminger
+
+Port Mirroring API
+==================
+
+
+Overview
+--------
+
+The Ethdev port mirror API is a feature usefel for passive network analysis
+and monitoring. `Port mirroring`_ is a common feature of network switches;
+it is known as SPAN (Switch Port Analyzer) on Cisco terminology.
+Mirroring is a feature in the ethdev layer that copies
+some or all of the packets passing through a port.
+
+Port mirroring can be used for analyze and debugging packets or
+traffic analysis.
+
+Mirroring is implemented in the ethdev layer and copies packets
+before they are seen by the network driver (PMD).
+On transmit packets are copied after the transmit callbacks and
+just before passing to the network driver.
+On Receive packets are copied when they are received from
+the network driver before any receive callbacks.
+
+
+Implementation
+--------------
+
+Creating a port mirror is done by the *rte_eth_add_mirror()* function.
+The ``struct rte_eth_mirror_conf`` controls the settings of the new
+mirror.
+
+.. code-block:: c
+
+ struct rte_eth_mirror_conf {
+ struct rte_mempool *mp; /**< Memory pool for copies, If NULL then cloned. */
+ struct rte_bpf_prm *filter; /**< Optional packet filter */
+ uint32_t snaplen; /**< Upper limit on number of bytes to copy */
+ uint32_t flags; /**< bitmask of RTE_ETH_MIRROR_XXX_FLAG's */
+ uint16_t target; /**< Destination port */
+ };
+
+
+The ``target`` field is ethdev port which will be used as the output
+for the copied packets. The ``flags`` field is used to control whether
+packets are mirrored on transmit (egress), receive (ingress) or both.
+The ``filter`` is an optional BPF filter useful for selecting a subset
+of the packets to be mirrored.
+
+Limitations
+-----------
+
+There are some limitations to using port mirroring.
+
+- The port being used for mirroring should not be confused with active ports
+ used for other traffic. The port ownership API can be used to solve this.
+
+- There is some performance impact when using port mirroring. The overhead
+ of copying packets and sending on a the target port can be noticeable.
+
+- Some packets maybe lost if the target port can not keep up with the
+ mirrored traffic. This can be observed with the ``rte_eth_mirror_stats``.
+
+- The API restricts mirroring of target ports to prevent packet loops.
+
+.. _Port Mirroring: https://en.wikipedia.org/wiki/Port_mirroring
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index c91207cab2..7681ed93f2 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -175,3 +175,8 @@ Deprecation Notices
without relying on flow API.
Currently there is no alternative API
providing the same functionality as with ``repr_matching_en`` set to 0.
+
+* pdump: The packet dump library is deprecated and will be removed
+ in 26.11 release. The pdump library uses callbacks and therefore
+ is unable to capture packets sent or received by a secondary process.
+ It is superseded by the port mirroring API.
diff --git a/doc/guides/rel_notes/release_25_11.rst b/doc/guides/rel_notes/release_25_11.rst
index ccad6d89ff..0348889fe3 100644
--- a/doc/guides/rel_notes/release_25_11.rst
+++ b/doc/guides/rel_notes/release_25_11.rst
@@ -56,6 +56,11 @@ New Features
=======================================================
+* **Added port mirroring API.**
+
+ Added new API to ethdev to allow monitoring and collecting packets
+ using port mirroring.
+
Removed Items
-------------
--
2.47.2
prev parent reply other threads:[~2025-08-08 17:00 UTC|newest]
Thread overview: 153+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 23:44 [RFC 00/13] Packet capture using " 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-17 3:14 ` lihuisong (C)
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
2025-07-15 16:15 ` [PATCH v4 " Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 01/13] ethdev: allow start/stop from secondary process Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 02/13] ethdev: make sure all necessary headers included Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 03/13] test: add test for hotplug and secondary process operations Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 04/13] net/ring: allow lockfree transmit if ring supports it Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 05/13] net/ring: add new devarg to create vdev from existing ring Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 06/13] mbuf: add dynamic flag for use by port mirroring Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 07/13] ethdev: add port mirroring feature Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 08/13] pcapng: split packet copy from header insertion Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 09/13] pcapng: make queue optional Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 10/13] test: add tests for ethdev mirror Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 11/13] app/testpmd: support for port mirroring Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 12/13] app/dumpcap: use port mirror instead of pdump Stephen Hemminger
2025-07-15 16:15 ` [PATCH v4 13/13] pdump: mark API and application as deprecated Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 00/13] Packet capture using port mirroring Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 01/13] ethdev: allow start/stop from secondary process Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 02/13] ethdev: make sure all necessary headers included Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 03/13] test: add test for hotplug and secondary process operations Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 04/13] net/ring: allow lockfree transmit if ring supports it Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 05/13] net/ring: add new devarg to create vdev from existing ring Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 06/13] mbuf: add dynamic flag for use by port mirroring Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 07/13] ethdev: add port mirroring feature Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 08/13] pcapng: split packet copy from header insertion Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 09/13] pcapng: make queue optional Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 10/13] test: add tests for ethdev mirror Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 11/13] app/testpmd: support for port mirroring Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 12/13] app/dumpcap: use port mirror instead of pdump Stephen Hemminger
2025-07-18 16:28 ` [PATCH v5 13/13] pdump: mark API and application as deprecated Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 00/13] Packet capture using port mirroring Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 01/13] ethdev: allow start/stop from secondary process Stephen Hemminger
2025-07-23 1:08 ` Ivan Malov
2025-07-23 14:38 ` Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 02/13] ethdev: make sure all necessary headers included Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 03/13] test: add test for hotplug and secondary process operations Stephen Hemminger
2025-07-23 1:31 ` Ivan Malov
2025-07-23 15:09 ` Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 04/13] net/ring: allow lockfree transmit if ring supports it Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 05/13] net/ring: add new devarg to create vdev from existing ring Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 06/13] mbuf: add dynamic flag for use by port mirroring Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 07/13] ethdev: add port mirroring feature Stephen Hemminger
2025-07-23 2:13 ` Ivan Malov
2025-07-23 15:26 ` Stephen Hemminger
2025-07-23 15:30 ` Ivan Malov
2025-07-22 17:34 ` [PATCH v6 08/13] pcapng: split packet copy from header insertion Stephen Hemminger
2025-07-23 2:32 ` Ivan Malov
2025-07-23 3:18 ` Ivan Malov
2025-07-23 19:20 ` Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 09/13] pcapng: make queue optional Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 10/13] test: add tests for ethdev mirror Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 11/13] app/testpmd: support for port mirroring Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 12/13] app/dumpcap: use port mirror instead of pdump Stephen Hemminger
2025-07-23 3:16 ` Ivan Malov
2025-07-23 3:27 ` Ivan Malov
2025-07-23 19:26 ` Stephen Hemminger
2025-07-22 17:34 ` [PATCH v6 13/13] pdump: mark API and application as deprecated Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 00/12] Port mirroring for packet capture Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 01/12] ethdev: allow start/stop from secondary process Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 02/12] ethdev: make sure all necessary headers included Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 03/12] test: add test for hotplug and secondary process operations Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 04/12] net/ring: allow lockfree transmit if ring supports it Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 05/12] net/ring: add new devarg to create vdev from existing ring Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 06/12] mbuf: add dynamic flag for use by port mirroring Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 07/12] ethdev: add port mirroring feature Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 08/12] test: add tests for ethdev mirror Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 09/12] pcapng: split packet copy from header insertion Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 10/12] pcapng: make queue optional Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 11/12] app/testpmd: support for port mirroring Stephen Hemminger
2025-07-28 22:08 ` [PATCH v7 12/12] app/dumpcap: use port mirror instead of pdump Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 00/13] Packet capture using port mirroring Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 01/13] bpf: add ability to load bpf into a buffer Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 02/13] ethdev: allow start/stop from secondary process Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 03/13] ethdev: make sure all necessary headers included Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 04/13] ethdev: swap bpf and ethdev dependency Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 05/13] test: add test for hotplug and secondary process operations Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 06/13] net/ring: allow lockfree transmit if ring supports it Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 07/13] net/ring: add new devarg to create vdev from existing ring Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 08/13] mbuf: add dynamic flag for use by port mirroring Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 09/13] ethdev: add port mirroring feature Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 10/13] app/testpmd: support for port mirroring Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 11/13] pcapng: split packet copy from header insertion Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 12/13] pcapng: make queue optional Stephen Hemminger
2025-08-04 16:27 ` [PATCH v8 13/13] app/dumpcap: use port mirror instead of pdump Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 00/13] Packet capture using port mirroring Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 01/13] ethdev: allow start/stop from secondary process Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 02/13] ethdev: make sure all necessary headers included Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 03/13] ethdev: reorder bpf and ethdev dependency Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 04/13] bpf: add ability to load bpf into a buffer Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 05/13] test: add test for hotplug and secondary process operations Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 06/13] net/ring: allow lockfree transmit if ring supports it Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 07/13] net/ring: add new devarg to create vdev from existing ring Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 08/13] mbuf: add dynamic flag for use by port mirroring Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 09/13] ethdev: add port mirroring feature Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 10/13] app/testpmd: support for port mirroring Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 11/13] pcapng: split packet copy from header insertion Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 12/13] pcapng: make queue optional Stephen Hemminger
2025-08-06 21:40 ` [PATCH v9 13/13] app/dumpcap: use port mirror instead of pdump Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 00/14] Port mirroring feature Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 01/14] ethdev: allow start/stop from secondary process Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 02/14] ethdev: make sure all necessary headers included Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 03/14] ethdev: reorder bpf and ethdev dependency Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 04/14] bpf: add ability to load bpf into a buffer Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 05/14] test: add test for hotplug and secondary process operations Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 06/14] net/ring: allow lockfree transmit if ring supports it Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 07/14] net/ring: add new devarg to create vdev from existing ring Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 08/14] mbuf: add dynamic flag for use by port mirroring Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 09/14] ethdev: add port mirroring feature Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 10/14] app/testpmd: support for port mirroring Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 11/14] pcapng: split packet copy from header insertion Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 12/14] pcapng: make queue optional Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 13/14] app/dumpcap: use port mirror instead of pdump Stephen Hemminger
2025-08-07 17:33 ` [PATCH v10 14/14] doc: add documentation for port mirroring Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 00/14] Port mirroring for packet capture Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 01/14] ethdev: allow start/stop from secondary process Stephen Hemminger
2025-08-09 6:31 ` Khadem Ullah
2025-08-08 16:55 ` [PATCH v11 02/14] ethdev: make sure all necessary headers included Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 03/14] ethdev: reorder bpf and ethdev dependency Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 04/14] bpf: add ability to load bpf into a buffer Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 05/14] test: add test for hotplug and secondary process operations Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 06/14] net/ring: allow lockfree transmit if ring supports it Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 07/14] net/ring: add new devarg to create vdev from existing ring Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 08/14] mbuf: add dynamic flag for use by port mirroring Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 09/14] ethdev: add port mirroring feature Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 10/14] app/testpmd: support for port mirroring Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 11/14] pcapng: split packet copy from header insertion Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 12/14] pcapng: make queue optional Stephen Hemminger
2025-08-08 16:55 ` [PATCH v11 13/14] app/dumpcap: use port mirror instead of pdump Stephen Hemminger
2025-08-08 16:55 ` Stephen Hemminger [this message]
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=20250808165843.39075-15-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@huawei.com \
/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).