RE: [PATCH v2] common/mlx5: fix the sysfs port name translation

2023-03-23 Thread Bing Zhao
Hi Stephen, > -Original Message- > From: Stephen Hemminger > Sent: Wednesday, March 22, 2023 11:00 PM > To: Bing Zhao > Cc: Slava Ovsiienko ; Matan Azrad > ; dev@dpdk.org; Raslan Darawsheh > ; sta...@dpdk.org > Subject: Re: [PATCH v2] common/mlx5: fix the sys

RE: [PATCH v2] common/mlx5: fix the sysfs port name translation

2023-03-23 Thread Bing Zhao
Hi Stephen, > -Original Message- > From: Stephen Hemminger > Sent: Wednesday, March 22, 2023 10:59 PM > To: Bing Zhao > Cc: Slava Ovsiienko ; Matan Azrad > ; dev@dpdk.org; Raslan Darawsheh > ; sta...@dpdk.org > Subject: Re: [PATCH v2] common/mlx5: fix the sys

Re: [PATCH v2] common/mlx5: fix the sysfs port name translation

2023-03-22 Thread Stephen Hemminger
On Wed, 22 Mar 2023 13:34:12 +0200 Bing Zhao wrote: > + tail_nl = strchr(port_name, '\r'); > + if (tail_nl) > + *tail_nl = '\0'; This is a file provided by Linux kernel, there is no way it could have a CR character.

Re: [PATCH v2] common/mlx5: fix the sysfs port name translation

2023-03-22 Thread Stephen Hemminger
On Wed, 22 Mar 2023 13:34:12 +0200 Bing Zhao wrote: > + > + port_name = (char *)malloc(IF_NAMESIZE); > + if (port_name == NULL) { > + fclose(file); > + rte_errno = ENOMEM; > + return -rte_errno; > + }

[PATCH v2] common/mlx5: fix the sysfs port name translation

2023-03-22 Thread Bing Zhao
With some OFED or upstream kernel of mlx5, the port name fetched from "/sys/class/net/[DEV]/phys_port_name" may have a tailing "\n" as the EOL. The sscanf() will return the scanned items number with this EOL. In such case, the "equal to" condition is considered as false and the function mlx5_trans