From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id C69C74D3A for ; Thu, 15 Nov 2018 14:27:52 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Nov 2018 05:27:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,236,1539673200"; d="scan'208";a="86040730" Received: from dhunt5-mobl2.ger.corp.intel.com (HELO [10.237.221.115]) ([10.237.221.115]) by fmsmga007.fm.intel.com with ESMTP; 15 Nov 2018 05:27:50 -0800 To: Anatoly Burakov , dev@dpdk.org Cc: john.mcnamara@intel.com, thomas@monjalon.net, ferruh.yigit@intel.com References: <07b7c67be5adc770b028212ef8918d4ae8f11255.1542127066.git.anatoly.burakov@intel.com> From: "Hunt, David" Message-ID: Date: Thu, 15 Nov 2018 13:27:49 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <07b7c67be5adc770b028212ef8918d4ae8f11255.1542127066.git.anatoly.burakov@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH] devbind: don't display non-existent device categories 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: , X-List-Received-Date: Thu, 15 Nov 2018 13:27:53 -0000 Hi Anatoly, On 13/11/2018 4:42 PM, Anatoly Burakov wrote: > If there aren't any devices of a particular category on user's > system, we still display them, which is bad for usability. Fix > devbind to not print out a category unless there are devices in > it. > > Signed-off-by: Anatoly Burakov > --- > usertools/dpdk-devbind.py | 27 ++++++++++++++++++++------- > 1 file changed, 20 insertions(+), 7 deletions(-) > > diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py > index 7d564634c..9f190e227 100755 > --- a/usertools/dpdk-devbind.py > +++ b/usertools/dpdk-devbind.py > @@ -546,14 +546,27 @@ def show_device_status(devices_type, device_name): > else: > kernel_drv.append(devices[d]) > > + n_devs = len(dpdk_drv) + len(kernel_drv) + len(no_drv) > + > + # don't bother displaying anything if there are no devices > + if n_devs == 0: > + msg = "No '%s' devices detected" % device_name > + print("") > + print(msg) > + print("".join('=' * len(msg))) > + return > + > # print each category separately, so we can clearly see what's used by DPDK > - display_devices("%s devices using DPDK-compatible driver" % device_name, > - dpdk_drv, "drv=%(Driver_str)s unused=%(Module_str)s") > - display_devices("%s devices using kernel driver" % device_name, kernel_drv, > - "if=%(Interface)s drv=%(Driver_str)s " > - "unused=%(Module_str)s %(Active)s") > - display_devices("Other %s devices" % device_name, no_drv, > - "unused=%(Module_str)s") > + if len(dpdk_drv) != 0: > + display_devices("%s devices using DPDK-compatible driver" % device_name, > + dpdk_drv, "drv=%(Driver_str)s unused=%(Module_str)s") > + if len(kernel_drv) != 0: > + display_devices("%s devices using kernel driver" % device_name, kernel_drv, > + "if=%(Interface)s drv=%(Driver_str)s " > + "unused=%(Module_str)s %(Active)s") > + if len(no_drv) != 0: > + display_devices("Other %s devices" % device_name, no_drv, > + "unused=%(Module_str)s") > > def show_status(): > '''Function called when the script is passed the "--status" option. I REALLY like this patch. It makes the dpdk-devbind output MUCH more readable! Reviewed-by: David Hunt