doc: add note for pdump initialization
[dpdk.git] / doc / guides / tools / pdump.rst
1 ..  BSD LICENSE
2     Copyright(c) 2016 Intel Corporation. All rights reserved.
3     All rights reserved.
4
5     Redistribution and use in source and binary forms, with or without
6     modification, are permitted provided that the following conditions
7     are met:
8
9     * Redistributions of source code must retain the above copyright
10     notice, this list of conditions and the following disclaimer.
11     * Redistributions in binary form must reproduce the above copyright
12     notice, this list of conditions and the following disclaimer in
13     the documentation and/or other materials provided with the
14     distribution.
15     * Neither the name of Intel Corporation nor the names of its
16     contributors may be used to endorse or promote products derived
17     from this software without specific prior written permission.
18
19     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22     A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23     OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31
32 dpdk-pdump Application
33 ======================
34
35 The ``dpdk-pdump`` tool is a Data Plane Development Kit (DPDK) tool that runs as
36 a DPDK secondary process and is capable of enabling packet capture on dpdk ports.
37
38    .. Note::
39       * The ``dpdk-pdump`` tool can only be used in conjunction with a primary
40         application which has the packet capture framework initialized already.
41         In dpdk, only the ``testpmd`` is modified to initialize packet capture
42         framework, other applications remain untouched. So, if the ``dpdk-pdump``
43         tool has to be used with any application other than the testpmd, user
44         needs to explicitly modify that application to call packet capture
45         framework initialization code. Refer ``app/test-pmd/testpmd.c``
46         code to see how this is done.
47
48       * The ``dpdk-pdump`` tool depends on libpcap based PMD which is disabled
49         by default in the build configuration files,
50         owing to an external dependency on the libpcap development files
51         which must be installed on the board.
52         Once the libpcap development files are installed, the libpcap based PMD
53         can be enabled by setting CONFIG_RTE_LIBRTE_PMD_PCAP=y and recompiling the DPDK.
54
55
56 Running the Application
57 -----------------------
58
59 The tool has a number of command line options:
60
61 .. code-block:: console
62
63    ./build/app/dpdk-pdump --
64                           --pdump '(port=<port id> | device_id=<pci id or vdev name>),
65                                    (queue=<queue_id>),
66                                    (rx-dev=<iface or pcap file> |
67                                     tx-dev=<iface or pcap file>),
68                                    [ring-size=<ring size>],
69                                    [mbuf-size=<mbuf data size>],
70                                    [total-num-mbufs=<number of mbufs>]'
71                           [--server-socket-path=<server socket dir>]
72                           [--client-socket-path=<client socket dir>]
73
74 The ``--pdump`` command line option is mandatory and it takes various sub arguments which are described in
75 below section.
76
77    .. Note::
78
79       * Parameters inside the parentheses represents mandatory parameters.
80
81       * Parameters inside the square brackets represents optional parameters.
82
83       * Multiple instances of ``--pdump`` can be passed to capture packets on different port and queue combinations.
84
85 The ``--server-socket-path`` command line option is optional. This represents the server socket directory.
86 If no value is passed default values are used i.e. ``/var/run/.dpdk/`` for root users and ``~/.dpdk/``
87 for non root users.
88
89 The ``--client-socket-path`` command line option is optional. This represents the client socket directory.
90 If no value is passed default values are used i.e. ``/var/run/.dpdk/`` for root users and ``~/.dpdk/``
91 for non root users.
92
93
94 The ``--pdump`` parameters
95 ~~~~~~~~~~~~~~~~~~~~~~~~~~
96
97 ``port``:
98 Port id of the eth device on which packets should be captured.
99
100 ``device_id``:
101 PCI address (or) name of the eth device on which packets should be captured.
102
103    .. Note::
104
105       * As of now the ``dpdk-pdump`` tool cannot capture the packets of virtual devices
106         in the primary process due to a bug in the ethdev library. Due to this bug, in a multi process context,
107         when the primary and secondary have different ports set, then the secondary process
108         (here the ``dpdk-pdump`` tool) overwrites the ``rte_eth_devices[]`` entries of the primary process.
109
110 ``queue``:
111 Queue id of the eth device on which packets should be captured. The user can pass a queue value of ``*`` to enable
112 packet capture on all queues of the eth device.
113
114 ``rx-dev``:
115 Can be either a pcap file name or any Linux iface.
116
117 ``tx-dev``:
118 Can be either a pcap file name or any Linux iface.
119
120    .. Note::
121
122       * To receive ingress packets only, ``rx-dev`` should be passed.
123
124       * To receive egress packets only, ``tx-dev`` should be passed.
125
126       * To receive ingress and egress packets separately ``rx-dev`` and ``tx-dev``
127         should both be passed with the different file names or the Linux iface names.
128
129       * To receive ingress and egress packets together, ``rx-dev`` and ``tx-dev``
130         should both be passed with the same file name or the same Linux iface name.
131
132 ``ring-size``:
133 Size of the ring. This value is used internally for ring creation. The ring will be used to enqueue the packets from
134 the primary application to the secondary. This is an optional parameter with default size 16384.
135
136 ``mbuf-size``:
137 Size of the mbuf data. This is used internally for mempool creation. Ideally this value must be same as
138 the primary application's mempool's mbuf data size which is used for packet RX. This is an optional parameter with
139 default size 2176.
140
141 ``total-num-mbufs``:
142 Total number mbufs in mempool. This is used internally for mempool creation. This is an optional parameter with default
143 value 65535.
144
145
146 Example
147 -------
148
149 .. code-block:: console
150
151    $ sudo ./build/app/dpdk-pdump -- --pdump 'port=0,queue=*,rx-dev=/tmp/rx.pcap'