From patchwork Tue Sep 19 10:20:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Jarry X-Patchwork-Id: 131620 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 29E7F42601; Tue, 19 Sep 2023 12:20:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AE72B40A6D; Tue, 19 Sep 2023 12:20:28 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 40B27406B8 for ; Tue, 19 Sep 2023 12:20:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695118826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wgfeuH3N54lk8JaNfnExneTsCDwhxAwUjwdF4ycThfE=; b=CzIf4LLbuDaHFXtdx3uTOn69MpHm0ozANzX7dbNGvjxHrEUuByEOO10BQ7axAafMbkibRF hfmi8bqwkF+b0lIXXmsgOyc9RsLT+SdKTTgUpkD6SleD0W5sDLGsN0YeO+MkeeLvSZLcEV 39R9q4KobptI7ns+2NrBsrLQAGBbw3E= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-80-kAWrgHEQM6GClAAYfBcsow-1; Tue, 19 Sep 2023 06:20:25 -0400 X-MC-Unique: kAWrgHEQM6GClAAYfBcsow-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BADEB3801EEC; Tue, 19 Sep 2023 10:20:24 +0000 (UTC) Received: from ringo.redhat.com (unknown [10.39.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id E96A320268CB; Tue, 19 Sep 2023 10:20:23 +0000 (UTC) From: Robin Jarry To: dev@dpdk.org Cc: Robin Jarry , stable@dpdk.org Subject: [PATCH] usertools/pmdinfo: fix usage typos Date: Tue, 19 Sep 2023 12:20:13 +0200 Message-ID: <20230919102012.419201-2-rjarry@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Reviewed-by: David Marchand --- doc/guides/tools/pmdinfo.rst | 2 +- usertools/dpdk-pmdinfo.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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