DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] usertools: add device index for dpdk-devbind script
@ 2019-06-03 12:57 Loc Nguyen
  2019-06-04 10:01 ` Bruce Richardson
  2019-06-04 15:50 ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: Loc Nguyen @ 2019-06-03 12:57 UTC (permalink / raw)
  To: thomas; +Cc: dev, Loc Nguyen

Add a device index in front of the PCI ID for easy counting

Network devices using DPDK-compatible driver
============================================
 0: 0000:07:00.0 ...
 1: 0000:07:00.1 ...

Signed-off-by: Loc Nguyen <locnguyen@niometrics.com>
---
 usertools/dpdk-devbind.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 9e79f0d28..21da3deca 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -534,7 +534,9 @@ def display_devices(title, dev_list, extra_params=None):
                 strings.append("%s '%s'" % (dev["Slot"], dev["Device_str"]))
     # sort before printing, so that the entries appear in PCI order
     strings.sort()
-    print("\n".join(strings))  # print one per line
+    # add device index in front of each device
+    enum_dev_list = ['%2d' % index + ": " + device for index, device in enumerate(strings)]
+    print("\n".join(enum_dev_list))  # print one per line
 
 def show_device_status(devices_type, device_name):
     global dpdk_drivers
-- 
2.18.0


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

* Re: [dpdk-dev] [PATCH] usertools: add device index for dpdk-devbind script
  2019-06-03 12:57 [dpdk-dev] [PATCH] usertools: add device index for dpdk-devbind script Loc Nguyen
@ 2019-06-04 10:01 ` Bruce Richardson
  2019-06-04 13:35   ` Loc Nguyen
  2019-06-04 15:50 ` Stephen Hemminger
  1 sibling, 1 reply; 4+ messages in thread
From: Bruce Richardson @ 2019-06-04 10:01 UTC (permalink / raw)
  To: Loc Nguyen; +Cc: thomas, dev

On Mon, Jun 03, 2019 at 08:57:36PM +0800, Loc Nguyen wrote:
> Add a device index in front of the PCI ID for easy counting
> 
> Network devices using DPDK-compatible driver
> ============================================
>  0: 0000:07:00.0 ...
>  1: 0000:07:00.1 ...
> 
> Signed-off-by: Loc Nguyen <locnguyen@niometrics.com>
> ---
>  usertools/dpdk-devbind.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
While I don't see anything wrong with this change, can you elaborate on why
you think this is of use? The rest of the script doesn't do anything with
these indexes so why is it worth using columns of screen space to display
them?

Thanks,
/Bruce

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

* Re: [dpdk-dev] [PATCH] usertools: add device index for dpdk-devbind script
  2019-06-04 10:01 ` Bruce Richardson
@ 2019-06-04 13:35   ` Loc Nguyen
  0 siblings, 0 replies; 4+ messages in thread
From: Loc Nguyen @ 2019-06-04 13:35 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Thomas Monjalon, dev

Hi Bruce,

Thanks for the feedback. In my application, we map the NIC interfaces into port numbers,
which are these indexes. For example, we have an config file saying we would like to use
port 2, 3 and 5 for RX. Having the indexes printed together with the NIC interfaces via this
script helps us to easily select the correct interfaces to use. Especially when we usually
bind or unbind the interfaces to kernel driver or DPDK driver depending on the situation,
which will cause a shift in the interface to port number mapping. On machines with more
than 10 interfaces, it’s much slower if we need to count the indexes manually.

Thanks,
Loc

> On 4 Jun 2019, at 6:01 PM, Bruce Richardson <bruce.richardson@intel.com> wrote:
> 
> On Mon, Jun 03, 2019 at 08:57:36PM +0800, Loc Nguyen wrote:
>> Add a device index in front of the PCI ID for easy counting
>> 
>> Network devices using DPDK-compatible driver
>> ============================================
>> 0: 0000:07:00.0 ...
>> 1: 0000:07:00.1 ...
>> 
>> Signed-off-by: Loc Nguyen <locnguyen@niometrics.com>
>> ---
>> usertools/dpdk-devbind.py | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>> 
> While I don't see anything wrong with this change, can you elaborate on why
> you think this is of use? The rest of the script doesn't do anything with
> these indexes so why is it worth using columns of screen space to display
> them?
> 
> Thanks,
> /Bruce


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

* Re: [dpdk-dev] [PATCH] usertools: add device index for dpdk-devbind script
  2019-06-03 12:57 [dpdk-dev] [PATCH] usertools: add device index for dpdk-devbind script Loc Nguyen
  2019-06-04 10:01 ` Bruce Richardson
@ 2019-06-04 15:50 ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2019-06-04 15:50 UTC (permalink / raw)
  To: Loc Nguyen; +Cc: thomas, dev

On Mon,  3 Jun 2019 20:57:36 +0800
Loc Nguyen <locnguyen@niometrics.com> wrote:

> Add a device index in front of the PCI ID for easy counting
> 
> Network devices using DPDK-compatible driver
> ============================================
>  0: 0000:07:00.0 ...
>  1: 0000:07:00.1 ...
> 
> Signed-off-by: Loc Nguyen <locnguyen@niometrics.com>
> ---
>  usertools/dpdk-devbind.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
> index 9e79f0d28..21da3deca 100755
> --- a/usertools/dpdk-devbind.py
> +++ b/usertools/dpdk-devbind.py
> @@ -534,7 +534,9 @@ def display_devices(title, dev_list, extra_params=None):
>                  strings.append("%s '%s'" % (dev["Slot"], dev["Device_str"]))
>      # sort before printing, so that the entries appear in PCI order
>      strings.sort()
> -    print("\n".join(strings))  # print one per line
> +    # add device index in front of each device
> +    enum_dev_list = ['%2d' % index + ": " + device for index, device in enumerate(strings)]
> +    print("\n".join(enum_dev_list))  # print one per line
>  
>  def show_device_status(devices_type, device_name):
>      global dpdk_drivers

This is a bad idea. it is making assumption about how ports are ordered which
can change if their are other busses, whitelist/blackst or the device may be owned.

Longer term, I want DPDK to get away from using and exposing portid's as the
preferred API to applications.

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

end of thread, other threads:[~2019-06-04 15:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-03 12:57 [dpdk-dev] [PATCH] usertools: add device index for dpdk-devbind script Loc Nguyen
2019-06-04 10:01 ` Bruce Richardson
2019-06-04 13:35   ` Loc Nguyen
2019-06-04 15:50 ` Stephen Hemminger

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).