usertools/pmdinfo: fix usage typos

Message ID 20230919102012.419201-2-rjarry@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series usertools/pmdinfo: fix usage typos |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing fail Testing issues
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Robin Jarry Sept. 19, 2023, 10:20 a.m. UTC
  The docs and script usages are not consistent.

There is no .devices, .vendor_id nor .device_id fields. Fix usage to the
correct field names.

Some drivers do not expose any pci_ids, show how to use the []? jq
operator to avoid spurious errors.

Fixes: 0ce3cf4afd04 ("usertools/pmdinfo: rewrite simpler script")
Cc: stable@dpdk.org

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 doc/guides/tools/pmdinfo.rst | 2 +-
 usertools/dpdk-pmdinfo.py    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

David Marchand Sept. 27, 2023, 7:56 a.m. UTC | #1
On Tue, Sep 19, 2023 at 12:20 PM Robin Jarry <rjarry@redhat.com> wrote:
>
> The docs and script usages are not consistent.
>
> There is no .devices, .vendor_id nor .device_id fields. Fix usage to the
> correct field names.
>
> Some drivers do not expose any pci_ids, show how to use the []? jq
> operator to avoid spurious errors.
>
> Fixes: 0ce3cf4afd04 ("usertools/pmdinfo: rewrite simpler script")
> Cc: stable@dpdk.org
>
> Signed-off-by: Robin Jarry <rjarry@redhat.com>

My jq-ryu was not enough, thanks for the fix :-).
Reviewed-by: David Marchand <david.marchand@redhat.com>
  
Thomas Monjalon Nov. 22, 2023, 11:19 p.m. UTC | #2
27/09/2023 09:56, David Marchand:
> On Tue, Sep 19, 2023 at 12:20 PM Robin Jarry <rjarry@redhat.com> wrote:
> >
> > The docs and script usages are not consistent.
> >
> > There is no .devices, .vendor_id nor .device_id fields. Fix usage to the
> > correct field names.
> >
> > Some drivers do not expose any pci_ids, show how to use the []? jq
> > operator to avoid spurious errors.
> >
> > Fixes: 0ce3cf4afd04 ("usertools/pmdinfo: rewrite simpler script")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Robin Jarry <rjarry@redhat.com>
> 
> My jq-ryu was not enough, thanks for the fix :-).
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.
  

Patch

diff --git a/doc/guides/tools/pmdinfo.rst b/doc/guides/tools/pmdinfo.rst
index a9217de4eef2..fdb90301715e 100644
--- a/doc/guides/tools/pmdinfo.rst
+++ b/doc/guides/tools/pmdinfo.rst
@@ -82,5 +82,5 @@  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'
+       jq '.[] | select(.pci_ids[]? | .vendor == "15b3" and .device == "1013").kmod'
    "* ib_uverbs & mlx5_core & mlx5_ib"
diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py
index 67d023a04711..2c728de7b8be 100755
--- a/usertools/dpdk-pmdinfo.py
+++ b/usertools/dpdk-pmdinfo.py
@@ -23,7 +23,7 @@ 
 Get only the required kernel modules for a given device:
 
   %(prog)s dpdk-testpmd | \
-  jq '.[] | select(.devices[] | .vendor_id == "15b3" and .device_id == "1013").kmod'
+  jq '.[] | select(.pci_ids[]? | .vendor == "15b3" and .device == "1013").kmod'
 """
 
 import argparse