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 46BAAA0032; Tue, 13 Sep 2022 22:54:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D884A4021D; Tue, 13 Sep 2022 22:54:48 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2049.outbound.protection.outlook.com [40.107.96.49]) by mails.dpdk.org (Postfix) with ESMTP id 9E8E040151 for ; Tue, 13 Sep 2022 22:54:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UkOkwFjfeq1D9OJnuG4MjDdDo2tOrb4xlPT01+Hz1lMfwUqwR+2/A66R4dPu9O1jdyfMbw+9wSi9vQWxLg2oBNjs1Z4hw4TtidUzquRH5hj8r6LDZjkizO4Ax0O2L61AfzJyD9pePkDaH3m3VBQV1v1AinJR4D5jV8ltfFCEZzLIRvfWDsT417XewMz/fLGA/tMe1AwF6YDLQphTAkBS5ljBHC4QOsIlUO88yGSQwTYfhGCo45EfvYlIKsgbj/o1Z3PLHFwfTHi+xdVZzKHuYz5Hw+37eJM0ULUbuV4mD6I2co9Icn4lTNDBq3tkaJwpRzfQdj9zVj6eOQcJhrupdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fuj2v99vz53LD3FopH8o/GVO4WGuWNkG+WzJDkdDMAo=; b=mahllQG8MVavlU8PRQV2JuECPkmndN/fvRmhqgiQSORZkArA7toLfaf6F4kqz+E9jgBgOsEtZi2/Uf1kvD6iTSCvfjiQzPJLhxyyVjXm02Ro3YNwoDLAMj2wk5uWu0veH6V+S05wnZFNg131gUgL8nA+jyFIxrZEnpuEhFQnKG/VFECtGE0ds8lQiom8YxmKxRbLiziOE2VgSeuZUOzSXGrYQ9prTQlOYhkQyGHGGJMSPA5XUfXbSKAuAQn5GZtnjRGukHFRI6I1rH5888IghjwvF8G8YnBLVfxYtn+QoXcbCSxdnUtOIxJIIBT+wVc6gZOA8Ye5WFugPw9Sv87iHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=redhat.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fuj2v99vz53LD3FopH8o/GVO4WGuWNkG+WzJDkdDMAo=; b=nTPacUVDsAM9KhuoFsG5gv2XIoARmjrXLoeXq93pLJh0C//Idscc424x2qPPAe9H5DgO73Ao2E9Eu8zTs1mXrw/3/jpRsyuH8Ta2Ptm7BUjaryL7pdY0tVVktnI/Lvw5zfNpk+xWjE1Xs/opjTgO2ifH2+CcWWhEcVCPqhRJX0o= Received: from SN6PR2101CA0024.namprd21.prod.outlook.com (2603:10b6:805:106::34) by SA2PR02MB7788.namprd02.prod.outlook.com (2603:10b6:806:135::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Tue, 13 Sep 2022 20:54:45 +0000 Received: from SN1NAM02FT0019.eop-nam02.prod.protection.outlook.com (2603:10b6:805:106:cafe::2d) by SN6PR2101CA0024.outlook.office365.com (2603:10b6:805:106::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.4 via Frontend Transport; Tue, 13 Sep 2022 20:54:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch01.xlnx.xilinx.com; pr=C Received: from xir-pvapexch01.xlnx.xilinx.com (149.199.80.198) by SN1NAM02FT0019.mail.protection.outlook.com (10.97.4.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5612.13 via Frontend Transport; Tue, 13 Sep 2022 20:54:44 +0000 Received: from xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 13 Sep 2022 21:54:31 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server id 15.1.2375.24 via Frontend Transport; Tue, 13 Sep 2022 21:54:31 +0100 Envelope-to: rjarry@redhat.com, olivier.matz@6wind.com, bruce.richardson@intel.com, dev@dpdk.org Received: from [10.71.194.74] (port=3386) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oYCvP-0005LI-1S; Tue, 13 Sep 2022 21:54:31 +0100 Message-ID: <133f24b5-9565-d274-dc5b-c6942ad7f356@xilinx.com> Date: Tue, 13 Sep 2022 21:54:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH v2] usertools: rewrite pmdinfo Content-Language: en-US To: Robin Jarry CC: Olivier Matz , Bruce Richardson , References: <20220913105811.84384-1-robin@jarry.cc> <20220913194208.125793-1-rjarry@redhat.com> From: Ferruh Yigit In-Reply-To: <20220913194208.125793-1-rjarry@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0019:EE_|SA2PR02MB7788:EE_ X-MS-Office365-Filtering-Correlation-Id: e1386ad3-f2cc-4e6a-a770-08da95ca3046 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tJgb2cPnTDBFYcrU6vvH9FpL3O9ufGx93a96wUQmZaIoiieQOpXKT5RLRu3hYFd0SxHCs3CRGKRxxsDo35bfNnwnfRTo/wZP5h94zW7PbbNM4LTB5rlUf94F/8yaR4/Dd4QyQcaRRIYAGwxrzz8tbe9Pk1xaum/Ps6GjnSyDW5xFXPgBZabLb9toFdbjVvEvbI6pelV9Fq6s33pXpdndBGsNdicSR3AgivxjktJI/UXHrGyiWOWb99a+9a09MSoGuWpjzsafZumL8THfR2XPYjuCr9CyCCXXlmL06+rvVGD1GPbC08VlyJJcP9uxTA46cYIqHOO9T9P5+lM3NTf1RNfaAPpCgAhNDwUbMvVCildogeDhXIlepSZy2qo4wtM9YuYbRQ31zo4UpHz0oj/lvuj/F90PPZmz2cX5tjjXBhT3UkBK9zIMrOzQ47+ZOiJ/ynz3nn8T0JgoSClvYkXNFgofZHKgcTpmjzpYP/yW3Nbet8/JUmWcmESqz40/EBgkNjvQBTOlYq6HE9VDOMi1LVNWS6dacGuAgeAnmWM2SZuAPN2I8jEukhlyO16ZpOVj8SSD36c0B0EwEN2OD37fJ2iWsY+A/kbTYp164cWqLYW4P+YAQb6jlof7vVWf4HVcnFMiAL3QDnFfjBawhnVfn8XY6fXsMQWYZBeoQuv2X2aApbAs67RXFtOTRrcr8IbWbF97pY59rbiDtBsdArNw6HOtTxSBlLScuzU6HOtSt6eG1ZDHZL7Dj6y7D414pnFe2u89S/awyRiSep/3TwjVrIZ0urjYwGoG8QwY24nD83VPRD7FnfK2gu4jtR24LhD++m5RkNtnWEMJ+lMnG7KLBg== X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch01.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(396003)(346002)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(53546011)(36756003)(7636003)(9786002)(6916009)(336012)(8676002)(356005)(44832011)(82740400003)(70586007)(70206006)(2906002)(83380400001)(4326008)(47076005)(5660300002)(186003)(40460700003)(478600001)(8936002)(2616005)(31686004)(426003)(40480700001)(31696002)(26005)(41300700001)(316002)(54906003)(36860700001)(82310400005)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2022 20:54:44.9872 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1386ad3-f2cc-4e6a-a770-08da95ca3046 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0019.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR02MB7788 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 9/13/2022 8:42 PM, 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", > "subsystem_vendor": "ffff", > "subsystem_device": "ffff" > } > ] > } > > 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 > string 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 Some of the drivers doesn't provide PCI ids, but script is listing them empty, like [1], is it better to omit the output for that case, as done to 'params' & 'kmod'? Except from above note, Tested-by: Ferruh Yigit [1] { "name": "net_enetfec", "pci_ids": [] },