New upstream version 18.02
[deb_dpdk.git] / doc / guides / tools / pdump.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2016 Intel Corporation.
3
4 .. _pdump_tool:
5
6 dpdk-pdump Application
7 ======================
8
9 The ``dpdk-pdump`` tool is a Data Plane Development Kit (DPDK) tool that runs as
10 a DPDK secondary process and is capable of enabling packet capture on dpdk ports.
11
12    .. Note::
13       * The ``dpdk-pdump`` tool can only be used in conjunction with a primary
14         application which has the packet capture framework initialized already.
15         In dpdk, only the ``testpmd`` is modified to initialize packet capture
16         framework, other applications remain untouched. So, if the ``dpdk-pdump``
17         tool has to be used with any application other than the testpmd, user
18         needs to explicitly modify that application to call packet capture
19         framework initialization code. Refer ``app/test-pmd/testpmd.c``
20         code to see how this is done.
21
22       * The ``dpdk-pdump`` tool depends on libpcap based PMD which is disabled
23         by default in the build configuration files,
24         owing to an external dependency on the libpcap development files
25         which must be installed on the board.
26         Once the libpcap development files are installed, the libpcap based PMD
27         can be enabled by setting CONFIG_RTE_LIBRTE_PMD_PCAP=y and recompiling the DPDK.
28
29
30 Running the Application
31 -----------------------
32
33 The tool has a number of command line options:
34
35 .. code-block:: console
36
37    ./build/app/dpdk-pdump --
38                           --pdump '(port=<port id> | device_id=<pci id or vdev name>),
39                                    (queue=<queue_id>),
40                                    (rx-dev=<iface or pcap file> |
41                                     tx-dev=<iface or pcap file>),
42                                    [ring-size=<ring size>],
43                                    [mbuf-size=<mbuf data size>],
44                                    [total-num-mbufs=<number of mbufs>]'
45                           [--server-socket-path=<server socket dir>]
46                           [--client-socket-path=<client socket dir>]
47
48 The ``--pdump`` command line option is mandatory and it takes various sub arguments which are described in
49 below section.
50
51    .. Note::
52
53       * Parameters inside the parentheses represents mandatory parameters.
54
55       * Parameters inside the square brackets represents optional parameters.
56
57       * Multiple instances of ``--pdump`` can be passed to capture packets on different port and queue combinations.
58
59 The ``--server-socket-path`` command line option is optional. This represents the server socket directory.
60 If no value is passed default values are used i.e. ``/var/run/.dpdk/`` for root users and ``~/.dpdk/``
61 for non root users.
62
63 The ``--client-socket-path`` command line option is optional. This represents the client socket directory.
64 If no value is passed default values are used i.e. ``/var/run/.dpdk/`` for root users and ``~/.dpdk/``
65 for non root users.
66
67
68 The ``--pdump`` parameters
69 ~~~~~~~~~~~~~~~~~~~~~~~~~~
70
71 ``port``:
72 Port id of the eth device on which packets should be captured.
73
74 ``device_id``:
75 PCI address (or) name of the eth device on which packets should be captured.
76
77    .. Note::
78
79       * As of now the ``dpdk-pdump`` tool cannot capture the packets of virtual devices
80         in the primary process due to a bug in the ethdev library. Due to this bug, in a multi process context,
81         when the primary and secondary have different ports set, then the secondary process
82         (here the ``dpdk-pdump`` tool) overwrites the ``rte_eth_devices[]`` entries of the primary process.
83
84 ``queue``:
85 Queue id of the eth device on which packets should be captured. The user can pass a queue value of ``*`` to enable
86 packet capture on all queues of the eth device.
87
88 ``rx-dev``:
89 Can be either a pcap file name or any Linux iface.
90
91 ``tx-dev``:
92 Can be either a pcap file name or any Linux iface.
93
94    .. Note::
95
96       * To receive ingress packets only, ``rx-dev`` should be passed.
97
98       * To receive egress packets only, ``tx-dev`` should be passed.
99
100       * To receive ingress and egress packets separately ``rx-dev`` and ``tx-dev``
101         should both be passed with the different file names or the Linux iface names.
102
103       * To receive ingress and egress packets together, ``rx-dev`` and ``tx-dev``
104         should both be passed with the same file name or the same Linux iface name.
105
106 ``ring-size``:
107 Size of the ring. This value is used internally for ring creation. The ring will be used to enqueue the packets from
108 the primary application to the secondary. This is an optional parameter with default size 16384.
109
110 ``mbuf-size``:
111 Size of the mbuf data. This is used internally for mempool creation. Ideally this value must be same as
112 the primary application's mempool's mbuf data size which is used for packet RX. This is an optional parameter with
113 default size 2176.
114
115 ``total-num-mbufs``:
116 Total number mbufs in mempool. This is used internally for mempool creation. This is an optional parameter with default
117 value 65535.
118
119
120 Example
121 -------
122
123 .. code-block:: console
124
125    $ sudo ./build/app/dpdk-pdump -- --pdump 'port=0,queue=*,rx-dev=/tmp/rx.pcap'