numam-dpdk/doc/guides/tools/pmdinfo.rst
Robin Jarry 0ce3cf4afd usertools/pmdinfo: rewrite simpler script
dpdk-pmdinfo.py does not produce any parseable output. The -r/--raw flag
merely prints multiple independent JSON lines which cannot be fed
directly to any JSON parser. Moreover, the script complexity is rather
high for such a simple task: extracting PMD_INFO_STRING from .rodata ELF
sections. Rewrite it so that it can produce valid JSON.

Remove the PCI database parsing for PCI-ID to Vendor-Device names
conversion. This should be done by external scripts (if really needed).

The script passes flake8, black, isort and pylint checks.

I have tested this with a matrix of python/pyelftools versions:

                                 pyelftools
               0.22  0.23  0.24  0.25  0.26  0.27  0.28  0.29
        3.6      ok    ok    ok    ok    ok    ok    ok    ok
        3.7      ok    ok    ok    ok    ok    ok    ok    ok
 Python 3.8      ok    ok    ok    ok    ok    ok    ok    ok
        3.9      ok    ok    ok    ok    ok   *ok    ok    ok
        3.10   fail  fail  fail  fail    ok    ok    ok    ok

                                     * Also tested on FreeBSD

All failures with python 3.10 are related to the same issue:

  File "elftools/construct/lib/container.py", line 5, in <module>
    from collections import MutableMapping
  ImportError: cannot import name 'MutableMapping' from 'collections'

Python 3.10 support is only available since pyelftools 0.26. The script
will only work with Python 3.6 and later.

Update the minimal system requirements, docs and release notes.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Tested-by: Ferruh Yigit <ferruh.yigit@amd.com>
Tested-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-10-11 02:11:33 +02:00

87 lines
1.9 KiB
ReStructuredText

.. SPDX-License-Identifier: BSD-3-Clause
Copyright(c) 2016 Canonical Limited. All rights reserved.
dpdk-pmdinfo Application
========================
The ``dpdk-pmdinfo.py`` tool is a Data Plane Development Kit (DPDK) utility that
can dump a PMDs hardware support info in the JSON format.
Synopsis
--------
::
dpdk-pmdinfo.py [-h] [-p] [-v] ELF_FILE [ELF_FILE ...]
Arguments
---------
.. program:: dpdk-pmdinfo.py
.. option:: -h, --help
Show the inline help.
.. option:: -p, --search-plugins
In addition of ``ELF_FILE``\s and their linked dynamic libraries,
also scan the DPDK plugins path.
.. option:: -v, --verbose
Display warnings due to linked libraries not found
or ELF/JSON parsing errors in these libraries.
Use twice to show debug messages.
.. option:: ELF_FILE
DPDK application binary or dynamic library.
Any linked ``librte_*.so`` library (as reported by ``ldd``) will also be analyzed.
Can be specified multiple times.
Environment Variables
---------------------
.. envvar:: LD_LIBRARY_PATH
If specified, the linked ``librte_*.so`` libraries will be looked up here first.
Examples
--------
Get the complete info for a given driver:
.. code-block:: console
$ dpdk-pmdinfo.py /usr/bin/dpdk-testpmd | \
jq '.[] | select(.name == "net_ice_dcf")'
{
"name": "net_ice_dcf",
"params": "cap=dcf",
"kmod": "* igb_uio | vfio-pci",
"pci_ids": [
{
"vendor": "8086",
"device": "1889"
}
]
}
Get only the required kernel modules for a given driver:
.. code-block:: console
$ dpdk-pmdinfo.py /usr/bin/dpdk-testpmd | \
jq '.[] | select(.name == "net_cn10k").kmod'
"vfio-pci"
Get only the required kernel modules for a given device:
.. code-block:: console
$ dpdk-pmdinfo.py /usr/bin/dpdk-testpmd | \
jq '.[] | select(.pci_ids[] | .vendor == "15b3" and .device == "1013").kmod'
"* ib_uverbs & mlx5_core & mlx5_ib"