net/mlx5: Synchronize correct IRQ when destroying CQ
[linux-2.6-microblaze.git] / drivers / vdpa / mlx5 / net / mlx5_vnet.c
index 8e29b57..379a191 100644 (file)
@@ -526,7 +526,6 @@ static int cq_create(struct mlx5_vdpa_net *ndev, u16 idx, u32 num_ent)
        void __iomem *uar_page = ndev->mvdev.res.uar->map;
        u32 out[MLX5_ST_SZ_DW(create_cq_out)];
        struct mlx5_vdpa_cq *vcq = &mvq->cq;
-       unsigned int irqn;
        __be64 *pas;
        int inlen;
        void *cqc;
@@ -566,7 +565,7 @@ static int cq_create(struct mlx5_vdpa_net *ndev, u16 idx, u32 num_ent)
        /* Use vector 0 by default. Consider adding code to choose least used
         * vector.
         */
-       err = mlx5_vector2eqn(mdev, 0, &eqn, &irqn);
+       err = mlx5_vector2eqn(mdev, 0, &eqn);
        if (err)
                goto err_vec;
 
@@ -1423,8 +1422,8 @@ static int mlx5_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx,
                return -EINVAL;
        }
 
-       mvq->used_idx = state->avail_index;
-       mvq->avail_idx = state->avail_index;
+       mvq->used_idx = state->split.avail_index;
+       mvq->avail_idx = state->split.avail_index;
        return 0;
 }
 
@@ -1445,7 +1444,7 @@ static int mlx5_vdpa_get_vq_state(struct vdpa_device *vdev, u16 idx, struct vdpa
                 * Since both values should be identical, we take the value of
                 * used_idx which is reported correctly.
                 */
-               state->avail_index = mvq->used_idx;
+               state->split.avail_index = mvq->used_idx;
                return 0;
        }
 
@@ -1454,7 +1453,7 @@ static int mlx5_vdpa_get_vq_state(struct vdpa_device *vdev, u16 idx, struct vdpa
                mlx5_vdpa_warn(mvdev, "failed to query virtqueue\n");
                return err;
        }
-       state->avail_index = attr.used_index;
+       state->split.avail_index = attr.used_index;
        return 0;
 }
 
@@ -1767,6 +1766,14 @@ out:
        mutex_unlock(&ndev->reslock);
 }
 
+static void clear_vqs_ready(struct mlx5_vdpa_net *ndev)
+{
+       int i;
+
+       for (i = 0; i < ndev->mvdev.max_vqs; i++)
+               ndev->vqs[i].ready = false;
+}
+
 static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status)
 {
        struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev);
@@ -1777,6 +1784,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status)
        if (!status) {
                mlx5_vdpa_info(mvdev, "performing device reset\n");
                teardown_driver(ndev);
+               clear_vqs_ready(ndev);
                mlx5_vdpa_destroy_mr(&ndev->mvdev);
                ndev->mvdev.status = 0;
                ndev->mvdev.mlx_features = 0;