DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] devbind: don't display non-existent device categories
@ 2018-11-13 16:42 Anatoly Burakov
  2018-11-15 13:27 ` Hunt, David
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Anatoly Burakov @ 2018-11-13 16:42 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, john.mcnamara, thomas, ferruh.yigit

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 <anatoly.burakov@intel.com>
---
 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.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] devbind: don't display non-existent device categories
  2018-11-13 16:42 [dpdk-dev] [PATCH] devbind: don't display non-existent device categories Anatoly Burakov
@ 2018-11-15 13:27 ` Hunt, David
  2018-11-15 14:06   ` Wiles, Keith
  2018-11-18 23:13 ` Thomas Monjalon
  2018-11-19 10:33 ` [dpdk-dev] [PATCH v2] " Anatoly Burakov
  2 siblings, 1 reply; 8+ messages in thread
From: Hunt, David @ 2018-11-15 13:27 UTC (permalink / raw)
  To: Anatoly Burakov, dev; +Cc: john.mcnamara, thomas, ferruh.yigit

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 <anatoly.burakov@intel.com>
> ---
>   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 <david.hunt@intel.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] devbind: don't display non-existent device categories
  2018-11-15 13:27 ` Hunt, David
@ 2018-11-15 14:06   ` Wiles, Keith
  0 siblings, 0 replies; 8+ messages in thread
From: Wiles, Keith @ 2018-11-15 14:06 UTC (permalink / raw)
  To: Hunt, David
  Cc: Burakov, Anatoly, dev, Mcnamara, John, Thomas Monjalon, Yigit, Ferruh



> On Nov 15, 2018, at 7:27 AM, Hunt, David <david.hunt@intel.com> wrote:
> 
> 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 <anatoly.burakov@intel.com>
>> ---
>>  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!
> 

I even modified my version of dpdk-devbind to do just that as it keep scrolling off the screen. I was going to get around to sending a patch. :-)

The output should be a compressed as possible, to me even the ‘=======‘ lines are not required if you indented the information lines by a couple spaces. But that does not need to be done in this patch.

> Reviewed-by: David Hunt <david.hunt@intel.com>

Regards,
Keith


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] devbind: don't display non-existent device categories
  2018-11-13 16:42 [dpdk-dev] [PATCH] devbind: don't display non-existent device categories Anatoly Burakov
  2018-11-15 13:27 ` Hunt, David
@ 2018-11-18 23:13 ` Thomas Monjalon
  2018-11-19 10:03   ` Burakov, Anatoly
  2018-11-19 10:33 ` [dpdk-dev] [PATCH v2] " Anatoly Burakov
  2 siblings, 1 reply; 8+ messages in thread
From: Thomas Monjalon @ 2018-11-18 23:13 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, david.hunt, john.mcnamara, ferruh.yigit

13/11/2018 17:42, Anatoly Burakov:
> --- a/usertools/dpdk-devbind.py
> +++ b/usertools/dpdk-devbind.py
> +    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
> +

Indentation is wrong here:
	TabError: inconsistent use of tabs and spaces in indentation

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] devbind: don't display non-existent device categories
  2018-11-18 23:13 ` Thomas Monjalon
@ 2018-11-19 10:03   ` Burakov, Anatoly
  0 siblings, 0 replies; 8+ messages in thread
From: Burakov, Anatoly @ 2018-11-19 10:03 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, david.hunt, john.mcnamara, ferruh.yigit

On 18-Nov-18 11:13 PM, Thomas Monjalon wrote:
> 13/11/2018 17:42, Anatoly Burakov:
>> --- a/usertools/dpdk-devbind.py
>> +++ b/usertools/dpdk-devbind.py
>> +    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
>> +
> 
> Indentation is wrong here:
> 	TabError: inconsistent use of tabs and spaces in indentation
> 

Oops, auto indentation in my editor strikes again... i'll submit a v2.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v2] devbind: don't display non-existent device categories
  2018-11-13 16:42 [dpdk-dev] [PATCH] devbind: don't display non-existent device categories Anatoly Burakov
  2018-11-15 13:27 ` Hunt, David
  2018-11-18 23:13 ` Thomas Monjalon
@ 2018-11-19 10:33 ` Anatoly Burakov
  2018-11-22 17:12   ` Thomas Monjalon
  2 siblings, 1 reply; 8+ messages in thread
From: Anatoly Burakov @ 2018-11-19 10:33 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, john.mcnamara, thomas, ferruh.yigit, keith.wiles

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 <anatoly.burakov@intel.com>
Reviewed-by: David Hunt <david.hunt@intel.com>
---

Notes:
    v2: fix indentation

 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..6051f6f9e 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.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] devbind: don't display non-existent device categories
  2018-11-19 10:33 ` [dpdk-dev] [PATCH v2] " Anatoly Burakov
@ 2018-11-22 17:12   ` Thomas Monjalon
  2018-11-23  9:23     ` Burakov, Anatoly
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Monjalon @ 2018-11-22 17:12 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, david.hunt, john.mcnamara, ferruh.yigit, keith.wiles

19/11/2018 11:33, Anatoly Burakov:
> 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 <anatoly.burakov@intel.com>
> Reviewed-by: David Hunt <david.hunt@intel.com>

Applied, thanks

I think we can strip output more and remove "no detected" messages.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] devbind: don't display non-existent device categories
  2018-11-22 17:12   ` Thomas Monjalon
@ 2018-11-23  9:23     ` Burakov, Anatoly
  0 siblings, 0 replies; 8+ messages in thread
From: Burakov, Anatoly @ 2018-11-23  9:23 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, david.hunt, john.mcnamara, ferruh.yigit, keith.wiles

On 22-Nov-18 5:12 PM, Thomas Monjalon wrote:
> 19/11/2018 11:33, Anatoly Burakov:
>> 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 <anatoly.burakov@intel.com>
>> Reviewed-by: David Hunt <david.hunt@intel.com>
> 
> Applied, thanks
> 
> I think we can strip output more and remove "no detected" messages.
> 

I had an idea to do that, but for now i decided to keep it for the 
purposes of providing just enough useful information to the user with 
little expense.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-11-23  9:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-13 16:42 [dpdk-dev] [PATCH] devbind: don't display non-existent device categories Anatoly Burakov
2018-11-15 13:27 ` Hunt, David
2018-11-15 14:06   ` Wiles, Keith
2018-11-18 23:13 ` Thomas Monjalon
2018-11-19 10:03   ` Burakov, Anatoly
2018-11-19 10:33 ` [dpdk-dev] [PATCH v2] " Anatoly Burakov
2018-11-22 17:12   ` Thomas Monjalon
2018-11-23  9:23     ` Burakov, Anatoly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).