[v2] usertools: decode PCI device name as UTF-8

Message ID 1586794684-19027-1-git-send-email-ricudis@niometrics.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] usertools: decode PCI device name as UTF-8 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Christos Ricudis April 13, 2020, 4:18 p.m. UTC
  Fixes the case where a PCI device string identifier
contains non-ASCII UTF-8

A particular example is Mellanox Connext-X 5 EN MT27800:

28:00.0 Ethernet controller: Mellanox Technologies
MT27800 Family [ConnectX-5]

Subsystem: Mellanox Technologies ConnectX®-5 EN network
interface card, 100GbE single-port QSFP28, PCIe3.0 x16,
tall bracket; MCX515A-CCAT

Signed-off-by: Christos Ricudis <ricudis@niometrics.com>
---
 usertools/dpdk-devbind.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Andrew Rybchenko April 13, 2020, 4:19 p.m. UTC | #1
On 4/13/20 7:18 PM, Christos Ricudis wrote:
> Fixes the case where a PCI device string identifier
> contains non-ASCII UTF-8
> 
> A particular example is Mellanox Connext-X 5 EN MT27800:
> 
> 28:00.0 Ethernet controller: Mellanox Technologies
> MT27800 Family [ConnectX-5]
> 
> Subsystem: Mellanox Technologies ConnectX®-5 EN network
> interface card, 100GbE single-port QSFP28, PCIe3.0 x16,
> tall bracket; MCX515A-CCAT
> 
> Signed-off-by: Christos Ricudis <ricudis@niometrics.com>

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

Thanks
  
Thomas Monjalon May 24, 2020, 5:10 p.m. UTC | #2
13/04/2020 18:19, Andrew Rybchenko:
> On 4/13/20 7:18 PM, Christos Ricudis wrote:
> > Fixes the case where a PCI device string identifier
> > contains non-ASCII UTF-8
> > 
> > A particular example is Mellanox Connext-X 5 EN MT27800:
> > 
> > 28:00.0 Ethernet controller: Mellanox Technologies
> > MT27800 Family [ConnectX-5]
> > 
> > Subsystem: Mellanox Technologies ConnectX®-5 EN network
> > interface card, 100GbE single-port QSFP28, PCIe3.0 x16,
> > tall bracket; MCX515A-CCAT
> > 
> > Signed-off-by: Christos Ricudis <ricudis@niometrics.com>
> 
> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

Applied, thanks
  

Patch

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index b1d1498..fad0eaa 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -211,7 +211,7 @@  def get_pci_device_details(dev_id, probe_lspci):
         for line in extra_info:
             if len(line) == 0:
                 continue
-            name, value = line.decode().split("\t", 1)
+            name, value = line.decode("utf8").split("\t", 1)
             name = name.strip(":") + "_str"
             device[name] = value
     # check for a unix interface name
@@ -257,7 +257,7 @@  def get_device_details(devices_type):
             # Clear previous device's data
             dev = {}
         else:
-            name, value = dev_line.decode().split("\t", 1)
+            name, value = dev_line.decode("utf8").split("\t", 1)
             value_list = value.rsplit(' ', 1)
             if len(value_list) > 1:
                 # String stored in <name>_str