Skip to content

Commit fc9af25

Browse files
dtatuleamstsirkin
authored andcommitted
vdpa/mlx5: Accept Init -> Ready VQ transition in resume_vq()
Until now resume_vq() was used only for the suspend/resume scenario. This change also allows calling resume_vq() to bring it from Init to Ready state (VQ initialization). Signed-off-by: Dragos Tatulea <[email protected]> Reviewed-by: Cosmin Ratiu <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Eugenio Pérez <[email protected]> Acked-by: Eugenio Pérez <[email protected]>
1 parent e60e9ee commit fc9af25

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,11 +1557,31 @@ static void suspend_vqs(struct mlx5_vdpa_net *ndev)
15571557

15581558
static void resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq)
15591559
{
1560-
if (!mvq->initialized || !is_resumable(ndev))
1560+
if (!mvq->initialized)
15611561
return;
15621562

1563-
if (mvq->fw_state != MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND)
1563+
switch (mvq->fw_state) {
1564+
case MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT:
1565+
/* Due to a FW quirk we need to modify the VQ fields first then change state.
1566+
* This should be fixed soon. After that, a single command can be used.
1567+
*/
1568+
if (modify_virtqueue(ndev, mvq, 0))
1569+
mlx5_vdpa_warn(&ndev->mvdev,
1570+
"modify vq properties failed for vq %u\n", mvq->index);
1571+
break;
1572+
case MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND:
1573+
if (!is_resumable(ndev)) {
1574+
mlx5_vdpa_warn(&ndev->mvdev, "vq %d is not resumable\n", mvq->index);
1575+
return;
1576+
}
1577+
break;
1578+
case MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY:
15641579
return;
1580+
default:
1581+
mlx5_vdpa_warn(&ndev->mvdev, "resume vq %u called from bad state %d\n",
1582+
mvq->index, mvq->fw_state);
1583+
return;
1584+
}
15651585

15661586
if (modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY))
15671587
mlx5_vdpa_warn(&ndev->mvdev, "modify to resume failed for vq %u\n", mvq->index);

0 commit comments

Comments
 (0)