]> git.droids-corp.org - dpdk.git/commitdiff
vdpa/mlx5: fix steering update in virtq unset
authorMatan Azrad <matan@mellanox.com>
Mon, 27 Jul 2020 08:07:59 +0000 (08:07 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 29 Jul 2020 22:41:23 +0000 (00:41 +0200)
When a virtq is destroyed by the driver, it must be removed from the
steering RQT which holds its reference.

The driver didn't remove the virtq from RQT before destroying it what
caused HW syndrome in virtq unset.

Remove the virtq from RQT before destroying it.

Fixes: 9f09b1ca15c5 ("vdpa/mlx5: recreate a virtq becoming enabled")
Cc: stable@dpdk.org
Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/vdpa/mlx5/mlx5_vdpa_virtq.c

index 3e6126492b38eb109a7135fef3417c94b8811e22..19554f654c2c11f6e5bd2d7bdcd133763891f05a 100644 (file)
@@ -482,6 +482,13 @@ mlx5_vdpa_virtq_enable(struct mlx5_vdpa_priv *priv, int index, int enable)
                DRV_LOG(INFO, "Virtq %d was modified, recreate it.", index);
        }
        if (virtq->virtq) {
+               virtq->enable = 0;
+               if (is_virtq_recvq(virtq->index, priv->nr_virtqs)) {
+                       ret = mlx5_vdpa_steer_update(priv);
+                       if (ret)
+                               DRV_LOG(WARNING, "Failed to disable steering "
+                                       "for virtq %d.", index);
+               }
                ret = mlx5_vdpa_virtq_stop(priv, index);
                if (ret)
                        DRV_LOG(WARNING, "Failed to stop virtq %d.", index);
@@ -493,14 +500,12 @@ mlx5_vdpa_virtq_enable(struct mlx5_vdpa_priv *priv, int index, int enable)
                        DRV_LOG(ERR, "Failed to setup virtq %d.", index);
                        return ret;
                }
-       }
-       virtq->enable = !!enable;
-       if (is_virtq_recvq(virtq->index, priv->nr_virtqs)) {
-               /* Need to add received virtq to the RQT table of the TIRs. */
-               ret = mlx5_vdpa_steer_update(priv);
-               if (ret) {
-                       virtq->enable = !enable;
-                       return ret;
+               virtq->enable = 1;
+               if (is_virtq_recvq(virtq->index, priv->nr_virtqs)) {
+                       ret = mlx5_vdpa_steer_update(priv);
+                       if (ret)
+                               DRV_LOG(WARNING, "Failed to enable steering "
+                                       "for virtq %d.", index);
                }
        }
        return 0;