RDMA/mlx4: Catch FW<->SW misalignment without machine crash
authorLeon Romanovsky <leonro@mellanox.com>
Tue, 29 May 2018 11:56:13 +0000 (14:56 +0300)
committerDoug Ledford <dledford@redhat.com>
Fri, 1 Jun 2018 15:16:23 +0000 (11:16 -0400)
Any steering QP is supposed be above steering_qp_base,
see function mlx4_ib_steer_qp_alloc() for it, however in case
of misalignment between SW and FW, this qp_base can be wrong.

Use WARN() to catch such situation without killing the machine.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx4/main.c

index 59aed458d3beb6587d666abbff00542fc5a3e749..1fea1497263bacedc54be3d7975ece13a265ef50 100644 (file)
@@ -3017,7 +3017,10 @@ void mlx4_ib_steer_qp_free(struct mlx4_ib_dev *dev, u32 qpn, int count)
            dev->steering_support != MLX4_STEERING_MODE_DEVICE_MANAGED)
                return;
 
-       BUG_ON(qpn < dev->steer_qpn_base);
+       if (WARN(qpn < dev->steer_qpn_base, "qpn = %u, steer_qpn_base = %u\n",
+                qpn, dev->steer_qpn_base))
+               /* not supposed to be here */
+               return;
 
        bitmap_release_region(dev->ib_uc_qpns_bitmap,
                              qpn - dev->steer_qpn_base,