Commit 1021d064 authored by Rongwei Liu's avatar Rongwei Liu Committed by Saeed Mahameed
Browse files

net/mlx5: Use native_port_num as 1st option of device index



Using "native_port_num" can support more NICs.

Fallback to PCIe IDs if "native_port_num" query fails.

Signed-off-by: default avatarRongwei Liu <rongweil@nvidia.com>
Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 2ec16ddd
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1245,6 +1245,11 @@ static inline int mlx5_core_native_port_num(struct mlx5_core_dev *dev)

static inline int mlx5_get_dev_index(struct mlx5_core_dev *dev)
{
	int idx = MLX5_CAP_GEN(dev, native_port_num);

	if (idx >= 1 && idx <= MLX5_MAX_PORTS)
		return idx - 1;
	else
		return PCI_FUNC(dev->pdev->devfn);
}