usertools: decode PCI device name as UTF-8

Message ID 1586789914-10825-1-git-send-email-ricudis@niometrics.com (mailing list archive)
State Superseded, archived
Headers
Series usertools: decode PCI device name as UTF-8 |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/iol-intel-Performance fail Performance Testing issues
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, 2:58 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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Andrew Rybchenko April 13, 2020, 3:14 p.m. UTC | #1
On 4/13/20 5:58 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>
> ---
>  usertools/dpdk-devbind.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
> index b1d1498..8ec1703 100755
> --- a/usertools/dpdk-devbind.py
> +++ b/usertools/dpdk-devbind.py
> @@ -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
> 


Is similar fix required in line 214 as well?

 name, value = line.decode('utf-8').split("\t", 1)
  
Christos Ricudis April 13, 2020, 3:36 p.m. UTC | #2
> On 13 Apr 2020, at 11:14 PM, Andrew Rybchenko <arybchenko@solarflare.com> wrote:
> 
> On 4/13/20 5:58 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>
>> ---
>> usertools/dpdk-devbind.py | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
>> index b1d1498..8ec1703 100755
>> --- a/usertools/dpdk-devbind.py
>> +++ b/usertools/dpdk-devbind.py
>> @@ -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
>> 
> 
> 
> Is similar fix required in line 214 as well?
> 
> name, value = line.decode('utf-8').split("\t", 1)

Apparently yes, though the above patch was enough to fix our usage of dpdk-devbind. 

Same string appears in output of lspci -vmmks. I will update the patch and resubmit. 

Thanks for your help!

$ lspci -vmmks 28:00.0
Slot:   28:00.0
Class:  Ethernet controller
Vendor: Mellanox Technologies
Device: MT27800 Family [ConnectX-5]
SVendor:        Mellanox Technologies
SDevice:        ConnectX®-5 EN network interface card, 100GbE single-port QSFP28, PCIe3.0 x16, tall bracket; MCX515A-CCAT
PhySlot:        2
Driver: mlx5_core
Module: mlx5_core
NUMANode:       0

Christos Rikoudis
Senior Software Engineer
  <https://niometrics.com/>
Mail: ricudis@niometrics.com | Mobile: +65 9893 3659 | Office: +65 6396 9159 | Fax: +65 6396 7908

Niometrics Pte. Ltd. (Reg. No. 200909012M) | 600 North Bridge Road, #12-04, Parkview Square, Singapore 188778

niometrics.com <https://niometrics.com/>
We support email encryption via GPG suite <https://gpgtools.org/>
CONFIDENTIALITY NOTICE: This message (including any attachments) is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error please contact the sender (by return email) immediately and delete this message. Any unauthorised use or dissemination of this message in whole or in parts is strictly prohibited.

DISCLAIMER: The information contained in this email, attachment, document and/or presentation have been researched by us with due care and all and any evaluations or assessments stated herein represent our personal opinions. We advise you that some of the available information may not have been independently verified and may be based on statements by third persons. No representation or warranty, expressed or implied, is made as to, and no reliance should be placed on, the fairness, accuracy, completeness or correctness of this information or opinions contained herein. Certain statements contained herein may be statements of future expectations and other forward-looking statements that are based on our current personal views and assumptions and involve known and unknown risks and uncertainties that cause actual results, performance or events to differ materially from those expressed or implied in such statements. None of our team shall assume any liability whatsoever (in negligence or otherwise) for any loss howsoever arising from any use of this email, attachment and/or presentation or the statements contained herein as to unverified third person statements, any statements of future expectations and other forward-looking statements, or the fairness, accuracy, completeness or correctness of statements contained herein, or otherwise arising in connection with this email, attachment, document and/or presentation.
  

Patch

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index b1d1498..8ec1703 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -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