]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
IB/mlx5: Enable MAD_IFC commands for IB ports only
authorNoa Osherovich <noaos@mellanox.com>
Mon, 12 Sep 2016 16:16:23 +0000 (19:16 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Oct 2016 13:21:27 +0000 (15:21 +0200)
commit 7fae6655a0c897875bd34501ec092232b526d3e4 upstream.

MAD_IFC command is supported only for physical functions (PF)
and when physical port is IB. The proposed fix enforces it.

Fixes: d603c809ef91 ("IB/mlx5: Fix decision on using MAD_IFC")
Reported-by: David Chang <dchang@suse.com>
Signed-off-by: Noa Osherovich <noaos@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/mlx5/main.c

index b48ad85315dc671da59f0453e8d1393a3c3d1a43..b8679e84b14f7689bc3428be4f7c7d85580b872b 100644 (file)
@@ -287,7 +287,9 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
 
 static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev)
 {
-       return !MLX5_CAP_GEN(dev->mdev, ib_virt);
+       if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB)
+               return !MLX5_CAP_GEN(dev->mdev, ib_virt);
+       return 0;
 }
 
 enum {