Merge branches 'cxgb3', 'ehca', 'ipath', 'ipoib', 'misc', 'mlx4', 'mthca' and 'nes...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / infiniband / hw / mlx4 / main.c
index 0b2f77a98e2c1b63627bfb8293cc3c0aa322fc96..3cb3f47a10b85753cded5f80f019517bf81e3635 100644 (file)
@@ -342,6 +342,9 @@ static struct ib_ucontext *mlx4_ib_alloc_ucontext(struct ib_device *ibdev,
        struct mlx4_ib_alloc_ucontext_resp resp;
        int err;
 
+       if (!dev->ib_active)
+               return ERR_PTR(-EAGAIN);
+
        resp.qp_tab_size      = dev->dev->caps.num_qps;
        resp.bf_reg_size      = dev->dev->caps.bf_reg_size;
        resp.bf_regs_per_page = dev->dev->caps.bf_regs_per_page;
@@ -669,6 +672,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
                        goto err_reg;
        }
 
+       ibdev->ib_active = true;
+
        return ibdev;
 
 err_reg:
@@ -725,6 +730,7 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr,
                break;
 
        case MLX4_DEV_EVENT_CATASTROPHIC_ERROR:
+               ibdev->ib_active = false;
                ibev.event = IB_EVENT_DEVICE_FATAL;
                break;