From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D1E97A04E7; Wed, 4 Nov 2020 00:54:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B302DBE3D; Wed, 4 Nov 2020 00:54:51 +0100 (CET) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 8FBCCBC62 for ; Wed, 4 Nov 2020 00:54:49 +0100 (CET) Received: by mail-pg1-f195.google.com with SMTP id r186so15014141pgr.0 for ; Tue, 03 Nov 2020 15:54:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/B3WCaTHFsTGZqmSiQkEoGYm7CzA6FlgSSPSi8ldz4k=; b=AtaOYaDBfwx87rJH75xEUI2pmF6cAutRweGtAB/IaaY+adL6K1g8NSi1Bh1JeAkLyw qc5JFJQ5q+wJBb2yhgxmx10W0844smvKD42sJKs4GDWj/fG5iIFL8p3hASbB+bdRZYlU s3JqLLzGHd/Omn3BrIAMxO7xhNqsv+42RtvpNC3PGXux7RGJYeIZdSh5wokXnyefai+Z WAZLfCsOgyUg+1dNcevG3fYhE5GKq4MiPaR2TBg7KV+cRYpBwnyiLkNfwguFD8Jtl5ei W1vSvpkv7HhS36yfzNyyWyFiif18FflmyAIQPz9FONmEvdBPzHHXwZgef5qtmDW2NDt7 o5ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/B3WCaTHFsTGZqmSiQkEoGYm7CzA6FlgSSPSi8ldz4k=; b=Ol26m+9DZFJoI5Q0oda84TVU+HonpR2oatv/dPrKUiSfHj3pyjznGXPLv1enjLTSM1 +8XLDj4TsW0nwJWrGqKBdZDlDANwIPs25/kCcEenOjnSkpG64CMH0kYY8sPL5vet2at9 WkiRadWdOhpjFET042ai11Ax5joo33ZkY2ZKA2L82zl5xj/qmbB534WH3wTFTLx6P2gk M7FQ5O9cb5pZs9vxtrko+84f2H+8PTTfetOEVvlKc8oplHpbryK1Uqp4BXH+8Ya/T25B jQ16XvZU6C8STwp18M81Tu3cO4dC0ih2tJCnMtGwZRYk4DhsQszNIRM35Wo0of2ZiYmx D0vg== X-Gm-Message-State: AOAM532N3JEor7tKwPeFUmG/q+KCLd2aMNYPTyj7q3qoSAnqydZAl4lt rXRCSAvqH4/BxBXJ5o1SuQ6OuQ== X-Google-Smtp-Source: ABdhPJymlV5qk5CfQ2nCsWyAlvd7w4ic5ZtCOcyp+90lCLlCP0nlzhsq1DBYkooKQaSR9wuOEHbjng== X-Received: by 2002:a63:8d4b:: with SMTP id z72mr11293079pgd.327.1604447687641; Tue, 03 Nov 2020 15:54:47 -0800 (PST) Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id z11sm234168pfk.52.2020.11.03.15.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 15:54:47 -0800 (PST) Date: Tue, 3 Nov 2020 15:54:39 -0800 From: Stephen Hemminger To: David Marchand Cc: Robin Jarry , dev , Bruce Richardson , Neil Horman , Rosen Xu , Andrew Rybchenko , Luca Boccassi Message-ID: <20201103155439.624bc17c@hermes.local> In-Reply-To: References: <20201103183906.8088-1-david.marchand@redhat.com> <20201103192750.zr6gh3oz3wjnbeys@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] usertools: fix pmdinfo parsing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, 3 Nov 2020 21:20:43 +0100 David Marchand wrote: > On Tue, Nov 3, 2020 at 8:27 PM Robin Jarry wrote: > > 2020-11-03, David Marchand: > > > This script was using the librte_pmd prefix has a filter to follow > > as* > > > > DT_NEEDED entries. > > > Now that we changed the driver names, update this heuristic with an > > > explicit list of device classes. > > > > > > Fixes: a20b2c01a7a1 ("build: standardize component names and defines") > > > > > > Signed-off-by: David Marchand > > > --- > > > usertools/dpdk-pmdinfo.py | 5 ++++- > > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > > > diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py > > > index 1661982791..687a9fd032 100755 > > > --- a/usertools/dpdk-pmdinfo.py > > > +++ b/usertools/dpdk-pmdinfo.py > > > @@ -450,7 +450,10 @@ def process_dt_needed_entries(self): > > > for tag in dynsec.iter_tags(): > > > # pyelftools may return byte-strings, force decode them > > > if force_unicode(tag.entry.d_tag) == 'DT_NEEDED': > > > - if 'librte_pmd' in force_unicode(tag.needed): > > > + words = force_unicode(tag.needed).split('_') > > > + if words and len(words) >= 3 and words[0] == 'librte' and \ > > > + words[1] in ['baseband', 'compress', 'crypto', 'event', > > > + 'net', 'raw', 'regex', 'vdpa']: > > > > This code is already ugly and I don't have much better to suggest... > > Less ugly with a regular expression? > > if re.match(r"^librte_(baseband|compress|crypto|event|net|raw|regex|vdpa)_", > force_unicode(tag.needed)): > > I prefer the list approach, much less error prone. The code would read better if the list of drivers was in a variable instead of a long line of code and the string processing was done separate from the test. Something like drivers = ['baseband', 'compress'... prefix = 'librte_pmd' name = force_unicode(tag.needed) if name.startswith(prefix): suffix = name[len(prefix):] if suffx in drivers: