All of lore.kernel.org
 help / color / mirror / Atom feed
From: Reshma Pattan <reshma.pattan@intel.com>
To: dev@dpdk.org
Subject: [PATCH v4 0/9] add packet capture framework
Date: Mon, 23 May 2016 22:38:23 +0100	[thread overview]
Message-ID: <1464039512-2683-1-git-send-email-reshma.pattan@intel.com> (raw)
In-Reply-To: <1463503030-10318-1-git-send-email-reshma.pattan@intel.com>

This patchset include below changes

1)Changes to librte_ether.
2)New library librte_pdump added for packet capture framework.
3)New app/pdump tool added for packet capturing.
4)Test pmd changes done to initialize packet capture framework.
5)Documentation update.

1)librte_pdump
==============
To support packet capturing on dpdk ethernet devices, a new library librte_pdump
is added.Users can develop their own packet capturing application using new library APIs.

Operation:
----------
Pdump library provides APIs to support packet capturing on dpdk ethernet devices.
Library provides APIs to initialize the packet capture framework, enable/disable
the packet capture and un initialize the packet capture framework.

Pdump library works on server and client based model.

Sever is responsible for enabling/disabling the packet captures.
Clients are responsible for requesting enable/disable of the
packet captures.

As part of packet capture framework initialization, pthread and
the server socket is created. Only one server socket is allowed on the system.
As part of enabling/disabling the packet capture, client sockets are created
and multiple client sockets are allowed.
Who ever calls initialization first they will succeed with the initialization,
next subsequent calls of initialization are not allowed. So next users can only
request enabling/disabling the packet capture.

Applications using below APIs need to pass port/device_id, queue, mempool and
ring parameters. Library uses user provided ring and mempool to mirror the rx/tx
packets of the port for users. Users need to deque the rings and write the packets
to vdev(pcap/tuntap) to view the packets using any standard tools.

Note:
Mempool and Ring should be mc/mp supportable.
Mempool mbuf size should be big enough to handle the rx/tx packets of a port.

APIs:
-----
rte_pdump_init()
rte_pdump_enable()
rte_pdump_enable_by_deviceid()
rte_pdump_disable()
rte_pdump_disable_by_deviceid()
rte_pdump_uninit()

2)app/pdump tool
================
Tool app/pdump is based on librte_pdump for packet capturing.
This tool by default runs as secondary process, and provides the support for
the command line options for packet capture.

./build/app/dpdk_pdump --
                       --pdump '(port=<port id> | device_id=<pci id or vdev name>),
                                (queue=<queue id>),
                                (rx-dev=<iface or pcap file> |
                                 tx-dev=<iface or pcap file>),
                                [ring-size=<ring size>],
                                [mbuf-size=<mbuf data size>],
                                [total-num-mbufs=<number of mbufs>]'

Parameters inside the parenthesis represents the mandatory parameters.
Parameters inside the square brackets represents optional parameters.
User has to pass on packet capture parameters under --pdump parameters, multiples of
--pdump can be passed to capture packets on different port and queue combinations

Operation:
----------
*Tool parse the user command line arguments,
creates the mempool, ring and the PCAP PMD vdev with 'tx_stream' as either
of the device passed in rx-dev|tx-dev parameters.

*Then calls the APIs of librte_pdump i.e. rte_pdump_enable()/rte_pdump_enable_by_deviceid()
to enable packet capturing on a specific port/device_id and queue by passing on
port|device_id, queue, mempool and ring info.

*Tool runs in while loop to dequeue the packets from the ring and write them to pcap device.

*Tool can be stopped using SIGINT, upon which tool calls
rte_pdump_disable()/rte_pdump_disable_by_deviceid() and free the allocated resources.

Note:
CONFIG_RTE_LIBRTE_PMD_PCAP flag should be set to yes to compile and run the pdump tool.

3)Test-pmd changes
==================
Changes are done to test-pmd application to initialize/uninitialize the packet capture framework.
So app/pdump tool can be run to see packets of dpdk ports that are used by test-pmd.

Similarly any application which needs packet capture should call initialize/uninitialize apis of
librate_pdump and use pdump tool to start the capture.

4)Packet capture flow between pdump tool and librte_pdump
=========================================================
* Pdump tool (Secondary process) requests packet capture
for specific port|device_id and queue combinations.

*Library in secondary process context creates client socket and communicates
the port|device_id, queue, ring and mempool to server.

*Library initializes server in primary process 'test-pmd' context and serves client
request to enable ethernet rxtx call-backs for given port|device_id and queue.·

*Copy the rx/tx packets to passed mempool and enqueue the packets to ring for secondary process.

*Pdump tool will dequeue the packets from ring and writes them to PCAPMD vdev,
so ultimately packets will be seen on device passed in rx-dev|tx-dev.

*Once the pdump tool is terminated with SIGINT it will disable packet capturing.

*Library receives the disable packet capture request, communicate the info to server,
server will remove the ethernet rxtx call-backs.

*Packet capture can be seen using tcpdump command
"tcpdump -ni <iface>" (or) "tcpdump –nr <pcapfile>"

5)Example command line
======================
./build/app/dpdk_pdump -- --pdump 'device_id=0000:02:0.0,queue=*,tx-dev=/tmp/dt-file.pcap,rx-dev=/tmp/dr-file.pcap,ring-size=8192,mbuf-size=2176,total-num-mbufs=32768' --pdump 'device_id=0000:01:00.0,queue=*,rx-dev=/tmp/d-file.pcap,tx-dev=/tmp/d-file.pcap,ring-size=16384,mbuf-size=2176,total-num-mbufs=32768'

v4:
added missing deprecation notice for ABI changes of rte_eth_dev_info structure.
made doc changes as per doc guidelines.
replaced rte_eal_vdev_init with rte_eth_dev_attach in pdump tool.
removed rxtx-dev parameter from pdump tool command line.

v3:
app/pdump: Moved cleanup code from signal handler to main.
divided librte_ether changes into multiple patches.
example command changed in app/pdump application guide

v2:
fix compilation issues for 4.8.3
fix unnecessary #includes


Reshma Pattan (9):
  librte_ether: protect add/remove of rxtx callbacks with spinlocks
  librte_ether: add new api rte_eth_add_first_rx_callback
  librte_ether: add new fields to rte_eth_dev_info struct
  librte_ether: make rte_eth_dev_get_port_by_name api public
  lib/librte_pdump: add new library for packet capturing support
  app/pdump: add pdump tool for packet capturing
  app/test-pmd: add pdump initialization uninitialization
  doc: update doc for packet capture framework
  doc: announce ABI change for rte_eth_dev_info structure

 MAINTAINERS                             |   8 +
 app/Makefile                            |   1 +
 app/pdump/Makefile                      |  45 ++
 app/pdump/main.c                        | 888 ++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.c                  |   6 +
 config/common_base                      |   5 +
 doc/guides/prog_guide/index.rst         |   1 +
 doc/guides/prog_guide/pdump_library.rst | 106 ++++
 doc/guides/rel_notes/deprecation.rst    |   6 +
 doc/guides/rel_notes/release_16_07.rst  |  11 +
 doc/guides/sample_app_ug/index.rst      |   1 +
 doc/guides/sample_app_ug/pdump.rst      | 115 +++++
 lib/Makefile                            |   1 +
 lib/librte_ether/rte_ethdev.c           | 121 +++--
 lib/librte_ether/rte_ethdev.h           |  45 ++
 lib/librte_ether/rte_ether_version.map  |   8 +
 lib/librte_pdump/Makefile               |  55 ++
 lib/librte_pdump/rte_pdump.c            | 816 +++++++++++++++++++++++++++++
 lib/librte_pdump/rte_pdump.h            | 186 +++++++
 lib/librte_pdump/rte_pdump_version.map  |  12 +
 mk/rte.app.mk                           |   1 +
 21 files changed, 2395 insertions(+), 43 deletions(-)
 create mode 100644 app/pdump/Makefile
 create mode 100644 app/pdump/main.c
 create mode 100644 doc/guides/prog_guide/pdump_library.rst
 create mode 100644 doc/guides/sample_app_ug/pdump.rst
 create mode 100644 lib/librte_pdump/Makefile
 create mode 100644 lib/librte_pdump/rte_pdump.c
 create mode 100644 lib/librte_pdump/rte_pdump.h
 create mode 100644 lib/librte_pdump/rte_pdump_version.map

-- 
2.5.0

  parent reply	other threads:[~2016-05-23 21:41 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 10:55 [PATCH 0/5] add packet capture framework Reshma Pattan
2016-05-06 10:55 ` [PATCH 1/5] librte_ether: protect add/remove of rxtx callbacks with spinlocks Reshma Pattan
2016-05-06 10:55 ` [PATCH 2/5] lib/librte_pdump: add new library for packet capturing support Reshma Pattan
2016-05-06 10:55 ` [PATCH 3/5] app/pdump: add pdump tool for packet capturing Reshma Pattan
2016-05-06 10:55 ` [PATCH 4/5] app/test-pmd: add pdump initialization uninitialization Reshma Pattan
2016-05-06 10:55 ` [PATCH 5/5] doc: update doc for packet capture framework Reshma Pattan
2016-05-10  9:39 ` [PATCHv2 0/5] add " Reshma Pattan
2016-05-10  9:39   ` [PATCHv2 1/5] librte_ether: protect add/remove of rxtx callbacks with spinlocks Reshma Pattan
2016-05-10  9:39   ` [PATCHv2 2/5] lib/librte_pdump: add new library for packet capturing support Reshma Pattan
2016-05-10  9:40   ` [PATCHv2 3/5] app/pdump: add pdump tool for packet capturing Reshma Pattan
2016-05-10  9:40   ` [PATCHv2 4/5] app/test-pmd: add pdump initialization uninitialization Reshma Pattan
2016-05-10  9:40   ` [PATCHv2 5/5] doc: update doc for packet capture framework Reshma Pattan
2016-05-10 10:13   ` [PATCHv2 0/5] add " Remy Horton
2016-05-17 16:37   ` [PATCH v3 0/8] " Reshma Pattan
2016-05-17 16:37     ` [PATCH v3 1/8] librte_ether: protect add/remove of rxtx callbacks with spinlocks Reshma Pattan
2016-05-17 16:37     ` [PATCH v3 2/8] librte_ether: add new api rte_eth_add_first_rx_callback Reshma Pattan
2016-05-17 16:37     ` [PATCH v3 3/8] librte_ether: add new fields to rte_eth_dev_info struct Reshma Pattan
2016-05-17 16:37     ` [PATCH v3 4/8] librte_ether: make rte_eth_dev_get_port_by_name api public Reshma Pattan
2016-05-17 16:37     ` [PATCH v3 5/8] lib/librte_pdump: add new library for packet capturing support Reshma Pattan
2016-05-17 16:37     ` [PATCH v3 6/8] app/pdump: add pdump tool for packet capturing Reshma Pattan
2016-05-17 16:37     ` [PATCH v3 7/8] app/test-pmd: add pdump initialization uninitialization Reshma Pattan
2016-05-17 16:37     ` [PATCH v3 8/8] doc: update doc for packet capture framework Reshma Pattan
2016-05-23 21:38     ` Reshma Pattan [this message]
2016-05-23 21:38       ` [PATCH v4 1/9] librte_ether: protect add/remove of rxtx callbacks with spinlocks Reshma Pattan
2016-05-23 21:38       ` [PATCH v4 2/9] librte_ether: add new api rte_eth_add_first_rx_callback Reshma Pattan
2016-05-23 21:38       ` [PATCH v4 3/9] librte_ether: add new fields to rte_eth_dev_info struct Reshma Pattan
2016-05-23 22:24         ` Stephen Hemminger
2016-05-24  8:09           ` Pattan, Reshma
2016-05-23 21:38       ` [PATCH v4 4/9] librte_ether: make rte_eth_dev_get_port_by_name api public Reshma Pattan
2016-05-23 21:38       ` [PATCH v4 5/9] lib/librte_pdump: add new library for packet capturing support Reshma Pattan
2016-05-27 13:39         ` Ananyev, Konstantin
2016-05-27 14:54           ` Pattan, Reshma
2016-05-27 15:25             ` Ananyev, Konstantin
2016-05-31 14:55               ` Pattan, Reshma
2016-05-31 15:00           ` Pattan, Reshma
2016-05-23 21:38       ` [PATCH v4 6/9] app/pdump: add pdump tool for packet capturing Reshma Pattan
2016-05-27 15:21         ` Ananyev, Konstantin
2016-05-31 14:50           ` Pattan, Reshma
2016-05-31 17:21             ` Ananyev, Konstantin
2016-06-02 12:31               ` Pattan, Reshma
2016-06-02 14:22                 ` Ananyev, Konstantin
2016-05-23 21:38       ` [PATCH v4 7/9] app/test-pmd: add pdump initialization uninitialization Reshma Pattan
2016-05-23 21:38       ` [PATCH v4 8/9] doc: update doc for packet capture framework Reshma Pattan
2016-05-23 21:38       ` [PATCH v4 9/9] doc: announce ABI change for rte_eth_dev_info structure Reshma Pattan
2016-05-26  8:15       ` [PATCH v4 0/9] add packet capture framework Thomas Monjalon
2016-06-08 13:38       ` [PATCH v5 " Reshma Pattan
2016-06-08 13:38         ` [PATCH v5 1/9] librte_ether: protect add/remove of rxtx callbacks with spinlocks Reshma Pattan
2016-06-08 13:38         ` [PATCH v5 2/9] librte_ether: add new api rte_eth_add_first_rx_callback Reshma Pattan
2016-06-08 13:38         ` [PATCH v5 3/9] librte_ether: add new fields to rte_eth_dev_info struct Reshma Pattan
2016-06-08 13:38         ` [PATCH v5 4/9] librte_ether: make rte_eth_dev_get_port_by_name rte_eth_dev_get_name_by_port public Reshma Pattan
2016-06-08 13:38         ` [PATCH v5 5/9] lib/librte_pdump: add new library for packet capturing support Reshma Pattan
2016-06-08 13:38         ` [PATCH v5 6/9] app/pdump: add pdump tool for packet capturing Reshma Pattan
2016-06-08 13:38         ` [PATCH v5 7/9] app/test-pmd: add pdump initialization uninitialization Reshma Pattan
2016-06-08 13:38         ` [PATCH v5 8/9] doc: update doc for packet capture framework Reshma Pattan
2016-06-08 16:02           ` Mcnamara, John
2016-06-08 13:38         ` [PATCH v5 9/9] doc: announce ABI change for rte_eth_dev_info structure Reshma Pattan
2016-06-08 16:15           ` Mcnamara, John
2016-06-09  8:50         ` [PATCH v6 0/8] add packet capture framework Reshma Pattan
2016-06-09  8:50           ` [PATCH v6 1/8] librte_ether: protect add/remove of rxtx callbacks with spinlocks Reshma Pattan
2016-06-09  8:50           ` [PATCH v6 2/8] librte_ether: add new api rte_eth_add_first_rx_callback Reshma Pattan
2016-06-09  8:50           ` [PATCH v6 3/8] librte_ether: add new fields to rte_eth_dev_info struct Reshma Pattan
2016-06-09  8:50           ` [PATCH v6 4/8] librte_ether: make rte_eth_dev_get_port_by_name rte_eth_dev_get_name_by_port public Reshma Pattan
2016-06-09  8:50           ` [PATCH v6 5/8] lib/librte_pdump: add new library for packet capturing support Reshma Pattan
2016-06-09 15:59             ` Aaron Conole
2016-06-09 16:05               ` Ananyev, Konstantin
2016-06-09 17:23                 ` Aaron Conole
2016-06-09 19:32                   ` Ananyev, Konstantin
2016-06-09 19:56                     ` Aaron Conole
2016-06-10 16:22               ` Pattan, Reshma
2016-06-09  8:50           ` [PATCH v6 6/8] app/pdump: add pdump tool for packet capturing Reshma Pattan
2016-06-09  8:50           ` [PATCH v6 7/8] app/test-pmd: add pdump initialization uninitialization Reshma Pattan
2016-06-09  8:50           ` [PATCH v6 8/8] doc: update doc for packet capture framework Reshma Pattan
2016-06-09 16:10           ` [PATCH v7 0/8] add " Reshma Pattan
2016-06-09 16:10             ` [PATCH v7 1/8] librte_ether: protect add/remove of rxtx callbacks with spinlocks Reshma Pattan
2016-06-09 16:10             ` [PATCH v7 2/8] librte_ether: add new api rte_eth_add_first_rx_callback Reshma Pattan
2016-06-09 16:10             ` [PATCH v7 3/8] librte_ether: add new fields to rte_eth_dev_info struct Reshma Pattan
2016-06-09 16:10             ` [PATCH v7 4/8] librte_ether: make rte_eth_dev_get_port_by_name rte_eth_dev_get_name_by_port public Reshma Pattan
2016-06-09 16:10             ` [PATCH v7 5/8] lib/librte_pdump: add new library for packet capturing support Reshma Pattan
2016-06-09 16:10             ` [PATCH v7 6/8] app/pdump: add pdump tool for packet capturing Reshma Pattan
2016-06-09 16:10             ` [PATCH v7 7/8] app/test-pmd: add pdump initialization uninitialization Reshma Pattan
2016-06-09 16:10             ` [PATCH v7 8/8] doc: update doc for packet capture framework Reshma Pattan
2016-06-09 17:34             ` [PATCH v7 0/8] add " Ananyev, Konstantin

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=1464039512-2683-1-git-send-email-reshma.pattan@intel.com \
    --to=reshma.pattan@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.