Hi Stephen,

> -----Original Message-----
> From: Stephen Hemminger <step...@networkplumber.org>
> Sent: Friday, November 11, 2022 12:22 AM
> To: Bing Zhao <bi...@nvidia.com>
> Cc: Slava Ovsiienko <viachesl...@nvidia.com>; Matan Azrad
> <ma...@nvidia.com>; dev@dpdk.org; Raslan Darawsheh
> <rasl...@nvidia.com>; sta...@dpdk.org
> Subject: Re: [PATCH] common/mlx5: fix the sysfs port name
> translation
> 
> External email: Use caution opening links or attachments
> 
> 
> On Thu, 10 Nov 2022 17:57:26 +0200
> Bing Zhao <bi...@nvidia.com> wrote:
> 
> > 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.
> 
> Why not fix the DPDK driver to strip off the new line when the port
> name is read? The code in mlx5_os.c should do it there.

Thanks for your comments. Yes, IF_NAMESIZE is large enough to read all the 
characters including the newline into the buffer.
After fgets(), the strlen() or strchr() can be used to remove the tailing 
newline character.


BR. Bing

Reply via email to