Hello Stephen,

The patch fixes `ifname` parameter as a character buffer.

Fixes: 1256805dd54d ("net/mlx5: move Linux-specific functions")

Signed-off-by: Gregory Etelson <getel...@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnow...@nvidia.com>
---

This looks better but did you know that the ifname can never be as big as 
MLX5_NAMESIZE.
Kernel limits to IFNAMSIZ (ie 16). The largest allowable interface name in 
Linux is 15 characters.

Looks like:
       MLX5_NAMESIZE := MXL5_FS_NAME_MAX := IBV_SYSFS_NAME_MAX + 1 = 64 + 1 = 65

Because Linux interface name length is fixed by BSD legacy ABI's it will never 
be longer.


The MLX5 PMD defines MLX5_NAMESIZE macro for Linux and Windows.

The Linux definition is in the drivers/net/mlx5/linux/mlx5_os.h:
#define MLX5_NAMESIZE IF_NAMESIZE

Linux API sets IF_NAMESIZE to 16.

The Windows definition is in the drivers/net/mlx5/windows/mlx5_os.h:
#define MLX5_NAMESIZE MLX5_FS_NAME_MAX.

The MLX5_FS_NAME_MAX macro also has different definitions for Linux and Windows:

drivers/common/mlx5/linux/mlx5_common_os.h
MLX5_FS_NAME_MAX = IBV_SYSFS_NAME_MAX + 1

IB verbs API sets IBV_SYSFS_NAME_MAX to 265.

drivers/common/mlx5/windows/mlx5_common_os.h: MLX5_FS_NAME_MAX = MLX5_DEVX_DEVICE_NAME_SIZE + 1

MLX5_DEVX_DEVICE_NAME_SIZE is defined by NVIDIA/Mellanox’s DevX (WinOF2) user-space headers for Windows and is set to 64.

Regards,
Gregory

Reply via email to