xref: /dpdk/doc/guides/tools/pdump.rst (revision 95fcf7bff48eedcf645bcbfe7d9d9e0eabfd2784)
15630257fSFerruh Yigit..  SPDX-License-Identifier: BSD-3-Clause
25630257fSFerruh Yigit    Copyright(c) 2016 Intel Corporation.
3d6448863SChristian Ehrhardt
4629122b8SReshma Pattan.. _pdump_tool:
5d6448863SChristian Ehrhardt
6d6448863SChristian Ehrhardtdpdk-pdump Application
7d6448863SChristian Ehrhardt======================
8d6448863SChristian Ehrhardt
9d6448863SChristian EhrhardtThe ``dpdk-pdump`` tool is a Data Plane Development Kit (DPDK) tool that runs as
10d6448863SChristian Ehrhardta DPDK secondary process and is capable of enabling packet capture on dpdk ports.
11d6448863SChristian Ehrhardt
12d6448863SChristian Ehrhardt   .. Note::
13d6448863SChristian Ehrhardt      * The ``dpdk-pdump`` tool can only be used in conjunction with a primary
14d6448863SChristian Ehrhardt        application which has the packet capture framework initialized already.
1599ad488bSReshma Pattan        In dpdk, only the ``testpmd`` is modified to initialize packet capture
1699ad488bSReshma Pattan        framework, other applications remain untouched. So, if the ``dpdk-pdump``
1799ad488bSReshma Pattan        tool has to be used with any application other than the testpmd, user
1899ad488bSReshma Pattan        needs to explicitly modify that application to call packet capture
1999ad488bSReshma Pattan        framework initialization code. Refer ``app/test-pmd/testpmd.c``
2099ad488bSReshma Pattan        code to see how this is done.
21d6448863SChristian Ehrhardt
22*95fcf7bfSCiara Power      * The ``dpdk-pdump`` tool depends on DPDK pcap PMD, so the system should
23*95fcf7bfSCiara Power        have libpcap development files installed and the pcap PMD not disabled
24*95fcf7bfSCiara Power        in the build.
25d6448863SChristian Ehrhardt
26a99a311bSSuanming Mou      * The ``dpdk-pdump`` tool runs as a DPDK secondary process. It exits when
27a99a311bSSuanming Mou        the primary application exits.
28a99a311bSSuanming Mou
29d6448863SChristian Ehrhardt
30d6448863SChristian EhrhardtRunning the Application
31d6448863SChristian Ehrhardt-----------------------
32d6448863SChristian Ehrhardt
33d6448863SChristian EhrhardtThe tool has a number of command line options:
34d6448863SChristian Ehrhardt
35d6448863SChristian Ehrhardt.. code-block:: console
36d6448863SChristian Ehrhardt
37*95fcf7bfSCiara Power   ./<build_dir>/app/dpdk-pdump --
38b2854d53SVipin Varghese                          [--multi]
39d6448863SChristian Ehrhardt                          --pdump '(port=<port id> | device_id=<pci id or vdev name>),
40d6448863SChristian Ehrhardt                                   (queue=<queue_id>),
41d6448863SChristian Ehrhardt                                   (rx-dev=<iface or pcap file> |
42d6448863SChristian Ehrhardt                                    tx-dev=<iface or pcap file>),
43d6448863SChristian Ehrhardt                                   [ring-size=<ring size>],
44d6448863SChristian Ehrhardt                                   [mbuf-size=<mbuf data size>],
45d6448863SChristian Ehrhardt                                   [total-num-mbufs=<number of mbufs>]'
46d6448863SChristian Ehrhardt
47b2854d53SVipin VargheseThe ``--multi`` command line option is optional argument. If passed, capture
48b2854d53SVipin Varghesewill be running on unique cores for all ``--pdump`` options. If ignored,
49b2854d53SVipin Varghesecapture will be running on single core for all ``--pdump`` options.
50b2854d53SVipin Varghese
51d6448863SChristian EhrhardtThe ``--pdump`` command line option is mandatory and it takes various sub arguments which are described in
52d6448863SChristian Ehrhardtbelow section.
53d6448863SChristian Ehrhardt
54d6448863SChristian Ehrhardt   .. Note::
55d6448863SChristian Ehrhardt
56d6448863SChristian Ehrhardt      * Parameters inside the parentheses represents mandatory parameters.
57d6448863SChristian Ehrhardt
58d6448863SChristian Ehrhardt      * Parameters inside the square brackets represents optional parameters.
59d6448863SChristian Ehrhardt
60d6448863SChristian Ehrhardt      * Multiple instances of ``--pdump`` can be passed to capture packets on different port and queue combinations.
61d6448863SChristian Ehrhardt
62d6448863SChristian Ehrhardt
63d6448863SChristian EhrhardtThe ``--pdump`` parameters
64d6448863SChristian Ehrhardt~~~~~~~~~~~~~~~~~~~~~~~~~~
65d6448863SChristian Ehrhardt
66d6448863SChristian Ehrhardt``port``:
67d6448863SChristian EhrhardtPort id of the eth device on which packets should be captured.
68d6448863SChristian Ehrhardt
69d6448863SChristian Ehrhardt``device_id``:
70d6448863SChristian EhrhardtPCI address (or) name of the eth device on which packets should be captured.
71d6448863SChristian Ehrhardt
72d6448863SChristian Ehrhardt   .. Note::
73d6448863SChristian Ehrhardt
74d6448863SChristian Ehrhardt      * As of now the ``dpdk-pdump`` tool cannot capture the packets of virtual devices
75d6448863SChristian Ehrhardt        in the primary process due to a bug in the ethdev library. Due to this bug, in a multi process context,
76d6448863SChristian Ehrhardt        when the primary and secondary have different ports set, then the secondary process
77d6448863SChristian Ehrhardt        (here the ``dpdk-pdump`` tool) overwrites the ``rte_eth_devices[]`` entries of the primary process.
78d6448863SChristian Ehrhardt
79d6448863SChristian Ehrhardt``queue``:
80d6448863SChristian EhrhardtQueue id of the eth device on which packets should be captured. The user can pass a queue value of ``*`` to enable
81d6448863SChristian Ehrhardtpacket capture on all queues of the eth device.
82d6448863SChristian Ehrhardt
83d6448863SChristian Ehrhardt``rx-dev``:
84d6448863SChristian EhrhardtCan be either a pcap file name or any Linux iface.
85d6448863SChristian Ehrhardt
86d6448863SChristian Ehrhardt``tx-dev``:
87d6448863SChristian EhrhardtCan be either a pcap file name or any Linux iface.
88d6448863SChristian Ehrhardt
89d6448863SChristian Ehrhardt   .. Note::
90d6448863SChristian Ehrhardt
91d6448863SChristian Ehrhardt      * To receive ingress packets only, ``rx-dev`` should be passed.
92d6448863SChristian Ehrhardt
93d6448863SChristian Ehrhardt      * To receive egress packets only, ``tx-dev`` should be passed.
94d6448863SChristian Ehrhardt
95d6448863SChristian Ehrhardt      * To receive ingress and egress packets separately ``rx-dev`` and ``tx-dev``
96d6448863SChristian Ehrhardt        should both be passed with the different file names or the Linux iface names.
97d6448863SChristian Ehrhardt
98d6448863SChristian Ehrhardt      * To receive ingress and egress packets together, ``rx-dev`` and ``tx-dev``
99d6448863SChristian Ehrhardt        should both be passed with the same file name or the same Linux iface name.
100d6448863SChristian Ehrhardt
101d6448863SChristian Ehrhardt``ring-size``:
102d6448863SChristian EhrhardtSize of the ring. This value is used internally for ring creation. The ring will be used to enqueue the packets from
103d6448863SChristian Ehrhardtthe primary application to the secondary. This is an optional parameter with default size 16384.
104d6448863SChristian Ehrhardt
105d6448863SChristian Ehrhardt``mbuf-size``:
106d6448863SChristian EhrhardtSize of the mbuf data. This is used internally for mempool creation. Ideally this value must be same as
107d6448863SChristian Ehrhardtthe primary application's mempool's mbuf data size which is used for packet RX. This is an optional parameter with
108d6448863SChristian Ehrhardtdefault size 2176.
109d6448863SChristian Ehrhardt
110d6448863SChristian Ehrhardt``total-num-mbufs``:
111d6448863SChristian EhrhardtTotal number mbufs in mempool. This is used internally for mempool creation. This is an optional parameter with default
112d6448863SChristian Ehrhardtvalue 65535.
113d6448863SChristian Ehrhardt
114d6448863SChristian Ehrhardt
115d6448863SChristian EhrhardtExample
116d6448863SChristian Ehrhardt-------
117d6448863SChristian Ehrhardt
118d6448863SChristian Ehrhardt.. code-block:: console
119d6448863SChristian Ehrhardt
120*95fcf7bfSCiara Power   $ sudo ./<build_dir>/app/dpdk-pdump -l 3 -- --pdump 'port=0,queue=*,rx-dev=/tmp/rx.pcap'
121*95fcf7bfSCiara Power   $ 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