xref: /dpdk/doc/guides/tools/pdump.rst (revision 95fcf7bff48eedcf645bcbfe7d9d9e0eabfd2784)
1..  SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2016 Intel Corporation.
3
4.. _pdump_tool:
5
6dpdk-pdump Application
7======================
8
9The ``dpdk-pdump`` tool is a Data Plane Development Kit (DPDK) tool that runs as
10a 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 DPDK pcap PMD, so the system should
23        have libpcap development files installed and the pcap PMD not disabled
24        in the build.
25
26      * The ``dpdk-pdump`` tool runs as a DPDK secondary process. It exits when
27        the primary application exits.
28
29
30Running the Application
31-----------------------
32
33The tool has a number of command line options:
34
35.. code-block:: console
36
37   ./<build_dir>/app/dpdk-pdump --
38                          [--multi]
39                          --pdump '(port=<port id> | device_id=<pci id or vdev name>),
40                                   (queue=<queue_id>),
41                                   (rx-dev=<iface or pcap file> |
42                                    tx-dev=<iface or pcap file>),
43                                   [ring-size=<ring size>],
44                                   [mbuf-size=<mbuf data size>],
45                                   [total-num-mbufs=<number of mbufs>]'
46
47The ``--multi`` command line option is optional argument. If passed, capture
48will be running on unique cores for all ``--pdump`` options. If ignored,
49capture will be running on single core for all ``--pdump`` options.
50
51The ``--pdump`` command line option is mandatory and it takes various sub arguments which are described in
52below section.
53
54   .. Note::
55
56      * Parameters inside the parentheses represents mandatory parameters.
57
58      * Parameters inside the square brackets represents optional parameters.
59
60      * Multiple instances of ``--pdump`` can be passed to capture packets on different port and queue combinations.
61
62
63The ``--pdump`` parameters
64~~~~~~~~~~~~~~~~~~~~~~~~~~
65
66``port``:
67Port id of the eth device on which packets should be captured.
68
69``device_id``:
70PCI address (or) name of the eth device on which packets should be captured.
71
72   .. Note::
73
74      * As of now the ``dpdk-pdump`` tool cannot capture the packets of virtual devices
75        in the primary process due to a bug in the ethdev library. Due to this bug, in a multi process context,
76        when the primary and secondary have different ports set, then the secondary process
77        (here the ``dpdk-pdump`` tool) overwrites the ``rte_eth_devices[]`` entries of the primary process.
78
79``queue``:
80Queue id of the eth device on which packets should be captured. The user can pass a queue value of ``*`` to enable
81packet capture on all queues of the eth device.
82
83``rx-dev``:
84Can be either a pcap file name or any Linux iface.
85
86``tx-dev``:
87Can be either a pcap file name or any Linux iface.
88
89   .. Note::
90
91      * To receive ingress packets only, ``rx-dev`` should be passed.
92
93      * To receive egress packets only, ``tx-dev`` should be passed.
94
95      * To receive ingress and egress packets separately ``rx-dev`` and ``tx-dev``
96        should both be passed with the different file names or the Linux iface names.
97
98      * To receive ingress and egress packets together, ``rx-dev`` and ``tx-dev``
99        should both be passed with the same file name or the same Linux iface name.
100
101``ring-size``:
102Size of the ring. This value is used internally for ring creation. The ring will be used to enqueue the packets from
103the primary application to the secondary. This is an optional parameter with default size 16384.
104
105``mbuf-size``:
106Size of the mbuf data. This is used internally for mempool creation. Ideally this value must be same as
107the primary application's mempool's mbuf data size which is used for packet RX. This is an optional parameter with
108default size 2176.
109
110``total-num-mbufs``:
111Total number mbufs in mempool. This is used internally for mempool creation. This is an optional parameter with default
112value 65535.
113
114
115Example
116-------
117
118.. code-block:: console
119
120   $ sudo ./<build_dir>/app/dpdk-pdump -l 3 -- --pdump 'port=0,queue=*,rx-dev=/tmp/rx.pcap'
121   $ sudo ./<build_dir>/app/dpdk-pdump -l 3,4,5 -- --multi --pdump 'port=0,queue=*,rx-dev=/tmp/rx-1.pcap' --pdump 'port=1,queue=*,rx-dev=/tmp/rx-2.pcap'
122