[PATCH 4.4 06/42] IB/mlx4: When no DMFS for IPoIB, dont allow NET_IF QPs

2017-01-23 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Eran Ben Elisha 

commit 1f22e454df2eb99ba6b7ace3f594f6805cdf5cbc upstream.

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 
Signed-off-by: Daniel Jurgens 
Reviewed-by: Mark Bloch 
Signed-off-by: Leon Romanovsky 
Signed-off-by: Doug Ledford 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/infiniband/hw/mlx4/main.c |   21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2403,14 +2403,19 @@ static void *mlx4_ib_add(struct mlx4_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++)




[PATCH 4.4 06/42] IB/mlx4: When no DMFS for IPoIB, dont allow NET_IF QPs

2017-01-23 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Eran Ben Elisha 

commit 1f22e454df2eb99ba6b7ace3f594f6805cdf5cbc upstream.

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 
Signed-off-by: Daniel Jurgens 
Reviewed-by: Mark Bloch 
Signed-off-by: Leon Romanovsky 
Signed-off-by: Doug Ledford 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/infiniband/hw/mlx4/main.c |   21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2403,14 +2403,19 @@ static void *mlx4_ib_add(struct mlx4_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++)