DPDK patches and discussions
 help / color / mirror / Atom feed
From: Reshma Pattan <reshma.pattan@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v10 0/7] add packet capture framework
Date: Wed, 15 Jun 2016 15:06:17 +0100	[thread overview]
Message-ID: <1465999584-6343-1-git-send-email-reshma.pattan@intel.com> (raw)
In-Reply-To: <1465897108-26548-1-git-send-email-reshma.pattan@intel.com>

This patch set include below changes

1)Changes to librte_ether.
2)A new library librte_pdump added for packet capture framework.
3)A 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:
----------
The librte_pdump 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 uninitialize the packet capture framework.

The librte_pdump library works on a client/server model. The server is responsible for enabling or
disabling the packet capture and the clients are responsible for requesting the enabling or disabling of
the packet capture.

The packet capture framework, as part of its initialization, creates the pthread and the server socket in
the pthread. The application that calls the framework initialization will have the server socket created,
either under the path that the application has passed or under the default path i.e. either ''/var/run'' for
root user or ''$HOME'' for non root user.

Applications that request enabling or disabling of the packet capture will have the client socket created
either under the path that the application has passed or under the default path i.e. either ''/var/run/''
for root users or ''$HOME'' for not root users to send the requests to the server.
The server socket will listen for client requests for enabling or 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 dequeue 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()
rte_pdump_set_socket_dir()

2)app/pdump tool
================
Tool app/pdump is designed based on librte_pdump for packet capturing in DPDK.
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
librte_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 server serves
the client request to enable Ethernet rxtx call-backs for a 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 the device that is passed in rx-dev|tx-dev.

*Once the pdump tool is terminated with SIGINT it will disable the 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'

v10:
fixed commit messages description.
fixed compilation issue when CONFIG_RTE_LIBRTE_PDUMP is disabled.
removed wrong config option CONFIG_RTE_EXEC_ENV_LINUXAPP inside app/Makefile
for pdump tool.
moved document changes to appropriate patches.

v9:
added a support in rte_pdump_set_socket_dir() to set server and client socket paths
==> http://dpdk.org/dev/patchwork/patch/13450/
updated the documentation for the new changes.
updated the commit messages.

v8:
added server socket argument to rte_pdump_init() API ==> http://dpdk.org/dev/patchwork/patch/13402/
added rte_pdump_set_socket_dir() API.
updated documentation for new changes.

v7:
fixed lines over 90 characters.

v6:
removed below deprecation notice patch from patch set.
http://dpdk.org/dev/patchwork/patch/13372/

v5:
addressed code review comments for below patches
http://dpdk.org/dev/patchwork/patch/12955/
http://dpdk.org/dev/patchwork/patch/12951/

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 (7):
  ethdev: use locks to protect Rx/Tx callback lists
  ethdev: add new api to add Rx callback as head of the list
  ethdev: add new fields to ethdev info struct
  ethdev: make get port by name and get name by port public
  pdump: add new library for packet capturing support
  app/pdump: add pdump tool for packet capturing
  app/testpmd: add pdump initialization uninitialization

 MAINTAINERS                             |   7 +
 app/Makefile                            |   1 +
 app/pdump/Makefile                      |  49 ++
 app/pdump/main.c                        | 844 +++++++++++++++++++++++++++++
 app/test-pmd/testpmd.c                  |  12 +
 config/common_base                      |   5 +
 doc/guides/prog_guide/index.rst         |   1 +
 doc/guides/prog_guide/pdump_library.rst | 123 +++++
 doc/guides/rel_notes/release_16_07.rst  |  14 +
 doc/guides/sample_app_ug/index.rst      |   1 +
 doc/guides/sample_app_ug/pdump.rst      | 122 +++++
 lib/Makefile                            |   1 +
 lib/librte_ether/rte_ethdev.c           | 123 +++--
 lib/librte_ether/rte_ethdev.h           |  60 +++
 lib/librte_ether/rte_ether_version.map  |   9 +
 lib/librte_pdump/Makefile               |  55 ++
 lib/librte_pdump/rte_pdump.c            | 913 ++++++++++++++++++++++++++++++++
 lib/librte_pdump/rte_pdump.h            | 216 ++++++++
 lib/librte_pdump/rte_pdump_version.map  |  13 +
 mk/rte.app.mk                           |   1 +
 20 files changed, 2526 insertions(+), 44 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

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
-- 
2.5.0

  parent reply	other threads:[~2016-06-15 14:06 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1465487895-5870-1-git-send-email-reshma.pattan@intel.com>
2016-06-10 16:18 ` [dpdk-dev] [PATCH v8 0/8] " Reshma Pattan
2016-06-10 16:18   ` [dpdk-dev] [PATCH v8 1/8] librte_ether: protect add/remove of rxtx callbacks with spinlocks Reshma Pattan
2016-06-10 16:18   ` [dpdk-dev] [PATCH v8 2/8] librte_ether: add new api rte_eth_add_first_rx_callback Reshma Pattan
2016-06-10 16:18   ` [dpdk-dev] [PATCH v8 3/8] librte_ether: add new fields to rte_eth_dev_info struct Reshma Pattan
2016-06-10 16:18   ` [dpdk-dev] [PATCH v8 4/8] librte_ether: make rte_eth_dev_get_port_by_name rte_eth_dev_get_name_by_port public Reshma Pattan
2016-06-10 16:18   ` [dpdk-dev] [PATCH v8 5/8] lib/librte_pdump: add new library for packet capturing support Reshma Pattan
2016-06-10 18:48     ` Aaron Conole
2016-06-10 22:14       ` Pattan, Reshma
2016-06-13 13:28         ` Aaron Conole
2016-06-10 16:18   ` [dpdk-dev] [PATCH v8 6/8] app/pdump: add pdump tool for packet capturing Reshma Pattan
2016-06-10 16:18   ` [dpdk-dev] [PATCH v8 7/8] app/test-pmd: add pdump initialization uninitialization Reshma Pattan
2016-06-10 16:18   ` [dpdk-dev] [PATCH v8 8/8] doc: update doc for packet capture framework Reshma Pattan
2016-06-10 23:23   ` [dpdk-dev] [PATCH v8 0/8] add " Neil Horman
2016-06-13  8:47     ` Pattan, Reshma
2016-06-14  9:38   ` [dpdk-dev] [PATCH v9 " Reshma Pattan
2016-06-14  9:38     ` [dpdk-dev] [PATCH v9 1/8] ethdev: use locks to protect Rx/Tx callback lists Reshma Pattan
2016-06-14 19:59       ` Thomas Monjalon
2016-06-15  5:30         ` Pattan, Reshma
2016-06-15  8:19           ` Thomas Monjalon
2016-06-15  8:37             ` Ananyev, Konstantin
2016-06-15  8:48               ` Thomas Monjalon
2016-06-15  9:54                 ` Ananyev, Konstantin
2016-06-15 11:17                   ` Thomas Monjalon
2016-06-15 13:49                   ` Thomas Monjalon
2016-06-15 12:15                 ` Ivan Boule
2016-06-15 12:40                   ` Ananyev, Konstantin
2016-06-15 13:29                     ` Bruce Richardson
2016-06-15 14:07                       ` Ivan Boule
2016-06-15 14:19                         ` Bruce Richardson
2016-06-15 14:20                         ` Ananyev, Konstantin
2016-06-15 14:22                           ` Bruce Richardson
2016-06-15 14:27                             ` Ananyev, Konstantin
2016-06-15 15:33                               ` Ivan Boule
2016-06-14  9:38     ` [dpdk-dev] [PATCH v9 2/8] ethdev: add new api to add Rx callback as head of the list Reshma Pattan
2016-06-14 20:01       ` Thomas Monjalon
2016-06-14 21:43         ` Pattan, Reshma
2016-06-14  9:38     ` [dpdk-dev] [PATCH v9 3/8] ethdev: add new fields to ethdev info struct Reshma Pattan
2016-06-14 20:10       ` Thomas Monjalon
2016-06-14 21:57         ` Pattan, Reshma
2016-06-14  9:38     ` [dpdk-dev] [PATCH v9 4/8] ethdev: make get port by name and get name by port public Reshma Pattan
2016-06-14 20:23       ` Thomas Monjalon
2016-06-14 21:55         ` Pattan, Reshma
2016-06-14  9:38     ` [dpdk-dev] [PATCH v9 5/8] pdump: add new library for packet capturing support Reshma Pattan
2016-06-14 20:28       ` Thomas Monjalon
2016-06-14 21:59         ` Pattan, Reshma
2016-06-15  9:05         ` Mcnamara, John
2016-06-15  9:32           ` Thomas Monjalon
2016-06-15  9:43             ` Bruce Richardson
2016-06-15 15:44             ` Mcnamara, John
2016-06-14  9:38     ` [dpdk-dev] [PATCH v9 6/8] app/pdump: add pdump tool for packet capturing Reshma Pattan
2016-06-14 19:56       ` Thomas Monjalon
2016-06-14  9:38     ` [dpdk-dev] [PATCH v9 7/8] app/testpmd: add pdump initialization uninitialization Reshma Pattan
2016-06-14  9:38     ` [dpdk-dev] [PATCH v9 8/8] doc: update doc for packet capture framework Reshma Pattan
2016-06-14 20:41       ` Thomas Monjalon
2016-06-15  5:44         ` Pattan, Reshma
2016-06-15  8:24           ` Thomas Monjalon
2016-06-15 14:06     ` Reshma Pattan [this message]
2016-06-15 14:06       ` [dpdk-dev] [PATCH v10 1/7] ethdev: use locks to protect Rx/Tx callback lists Reshma Pattan
2016-06-15 14:06       ` [dpdk-dev] [PATCH v10 2/7] ethdev: add new api to add Rx callback as head of the list Reshma Pattan
2016-06-15 14:06       ` [dpdk-dev] [PATCH v10 3/7] ethdev: add new fields to ethdev info struct Reshma Pattan
2016-06-16 19:14         ` Thomas Monjalon
2016-06-15 14:06       ` [dpdk-dev] [PATCH v10 4/7] ethdev: make get port by name and get name by port public Reshma Pattan
2016-06-16 20:27         ` Thomas Monjalon
2016-06-15 14:06       ` [dpdk-dev] [PATCH v10 5/7] pdump: add new library for packet capturing support Reshma Pattan
2016-06-15 14:06       ` [dpdk-dev] [PATCH v10 6/7] app/pdump: add pdump tool for packet capturing Reshma Pattan
2016-06-15 14:06       ` [dpdk-dev] [PATCH v10 7/7] app/testpmd: add pdump initialization uninitialization Reshma Pattan
2016-06-16 21:55       ` [dpdk-dev] [PATCH v10 0/7] add packet capture framework Thomas Monjalon

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=1465999584-6343-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 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).