From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D82C0A00C3; Tue, 20 Sep 2022 16:08:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC33A40DFB; Tue, 20 Sep 2022 16:08:16 +0200 (CEST) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by mails.dpdk.org (Postfix) with ESMTP id 596D24069B for ; Tue, 20 Sep 2022 16:08:15 +0200 (CEST) Received: by mail-wm1-f49.google.com with SMTP id d12-20020a05600c3acc00b003b4c12e47f3so1737284wms.4 for ; Tue, 20 Sep 2022 07:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=eP8uVydd+gsctLHunDlC9KrHMCMSRqCsCSJHgm8NOLM=; b=YlQfKL4DfArptsX9H6q+DzbIAEvl3vh5fgQ9gJvcndKxev30OgZPwx0aHaVdjI/O15 +/xDEdZd1MnGDbvazFnuCOalc7VW7VDWakx8Wzaa8s7A+EgVcwN+WMIpPTQyhl6WIhqq Ztp+vnJF+zVNVeyMFHUZ0wk46UtjPqBjyL07NRUtUF6+2c6nzc7Vzkv6U0ntPCR1ppnB c9aqtrdWoGFShdVYdXvx4qhon4hkMz8gFM2GizzoZAusnWyqnnCP9qWC776iY162cwLI VD+4XEUtXZXirJWbM1jEt+DrkKimBI2gLqmmk7dzAgoP7RgI6C1polbeaLo+eJGrCWbW Bu6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=eP8uVydd+gsctLHunDlC9KrHMCMSRqCsCSJHgm8NOLM=; b=JVzQToBjNK86uY2ykoEatxSgyPCCr1dUmFut2wCAP0MIREjYWY2cghPq7WQxLXWJqa f1oBVYzuRuWzJ0yulN+47C5RNAWjM2fdxAhzYGmKIqPwxv+ojcLnEADB1FRBJQ0o3GPC vV4A2LJv/sr0E/HKc29XY5TTsZwutmVaqDrDXcL7JrUcA69hB0MM/INg+nsPzPrp62g3 wF0p02hxFGDF/fx+VLmv+3qYf3LwTAhopAgwgXlhBVSUayDSQbeG9QGk3C4jnRjuddq/ cG8SiO3ct9r9cwPjctlWe4eEKQ3QiRce/tEiRmzfwWv8jT3aYBYzhxiWVU34dHfz1MGA qEpQ== X-Gm-Message-State: ACrzQf1JRI4LHhM3yP+kX+KstAR+NlPXTBqPErhG1sJbxDyZC8AvQ542 gw/5asLGkrJVmSUdq7xfPkgbiQ== X-Google-Smtp-Source: AMsMyM5ZFbXqK1RcMmXRG5kz8XO2B9R45oCrJma3idFz7rPoNyffXb8QwLnyRI44M4+PtVSEcmyDfw== X-Received: by 2002:a05:600c:19ce:b0:3b4:c709:4307 with SMTP id u14-20020a05600c19ce00b003b4c7094307mr2558731wmq.182.1663682894984; Tue, 20 Sep 2022 07:08:14 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id h17-20020a05600c351100b003b491f99a25sm187747wmq.22.2022.09.20.07.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 07:08:14 -0700 (PDT) Date: Tue, 20 Sep 2022 16:08:13 +0200 From: Olivier Matz To: Robin Jarry Cc: dev@dpdk.org, Ferruh Yigit , Bruce Richardson Subject: Re: [PATCH v4] usertools: rewrite pmdinfo Message-ID: References: <20220913105811.84384-1-robin@jarry.cc> <20220920104212.476889-1-rjarry@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220920104212.476889-1-rjarry@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 On Tue, Sep 20, 2022 at 12:42:12PM +0200, Robin Jarry wrote: > 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). > > Here are some examples of use with jq: > > Get the complete info for a given driver: > > ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \ > jq '.[] | select(.name == "dmadev_idxd_pci")' > { > "name": "dmadev_idxd_pci", > "params": "max_queues=0", > "kmod": "vfio-pci", > "pci_ids": [ > { > "vendor": "8086", > "device": "0b25" > } > ] > } > > Get only the required kernel modules for a given driver: > > ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \ > jq '.[] | select(.name == "net_i40e").kmod' > "* igb_uio | uio_pci_generic | vfio-pci" > > Get only the required kernel modules for a given device: > > ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \ > jq '.[] | select(.pci_ids[] | .vendor == "15b3" and .device == "1013").kmod' > "* ib_uverbs & mlx5_core & mlx5_ib" > > Print the list of drivers which define multiple parameters without > space separators: > > ~$ usertools/dpdk-pmdinfo.py build/app/dpdk-testpmd | \ > jq '.[] | select(.params!=null and (.params|test("=[^ ]+="))) | {name, params}' > ... > > 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 > > All failures with python 3.10 are related to the same issue: > > File "elftools/construct/lib/container.py", line 5, in > 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 and release notes. > > NB: The output produced by the legacy -r/--raw flag can be obtained with > the following command: > > strings build/app/dpdk-testpmd | sed -n 's/^PMD_INFO_STRING= //p' > > Cc: Olivier Matz > Cc: Ferruh Yigit > Cc: Bruce Richardson > Signed-off-by: Robin Jarry Tested-by: Olivier Matz