IB/mlx4: When no DMFS for IPoIB, don't allow NET_IF QPs
authorEran Ben Elisha <eranbe@mellanox.com>
Thu, 10 Nov 2016 09:31:00 +0000 (11:31 +0200)
committerDoug Ledford <dledford@redhat.com>
Tue, 13 Dec 2016 18:29:46 +0000 (13:29 -0500)
According to the firmware spec, FLOW_STEERING_IB_UC_QP_RANGE command is
supported only if dmfs_ipoib bit is set.

If it isn't set we want to ensure allocating NET_IF QPs fail. We do so
by filling out the allocation bitmap. By thus, the NET_IF QPs allocating
function won't find any free QP and will fail.

Fixes: c1c98501121e ('IB/mlx4: Add support for steerable IB UD QPs')
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx4/main.c

index 4054a1bfabb5f333faffc1914a5ebc8c2d8d2472..4a67ffc1ddfbd4bb5610a82dc9037b16efbe7365 100644 (file)
@@ -2823,14 +2823,19 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
                        goto err_steer_qp_release;
                }
 
-               bitmap_zero(ibdev->ib_uc_qpns_bitmap, ibdev->steer_qpn_count);
-
-               err = mlx4_FLOW_STEERING_IB_UC_QP_RANGE(
-                               dev, ibdev->steer_qpn_base,
-                               ibdev->steer_qpn_base +
-                               ibdev->steer_qpn_count - 1);
-               if (err)
-                       goto err_steer_free_bitmap;
+               if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_DMFS_IPOIB) {
+                       bitmap_zero(ibdev->ib_uc_qpns_bitmap,
+                                   ibdev->steer_qpn_count);
+                       err = mlx4_FLOW_STEERING_IB_UC_QP_RANGE(
+                                       dev, ibdev->steer_qpn_base,
+                                       ibdev->steer_qpn_base +
+                                       ibdev->steer_qpn_count - 1);
+                       if (err)
+                               goto err_steer_free_bitmap;
+               } else {
+                       bitmap_fill(ibdev->ib_uc_qpns_bitmap,
+                                   ibdev->steer_qpn_count);
+               }
        }
 
        for (j = 1; j <= ibdev->dev->caps.num_ports; j++)