Skip to content

Commit 3b3adb3

Browse files
dtatuleamstsirkin
authored andcommitted
vdpa/mlx5: Use suspend/resume during VQP change
Resume a VQ if it is already created when the number of VQ pairs increases. This is done in preparation for VQ pre-creation which is coming in a later patch. It is necessary because calling setup_vq() on an already created VQ will return early and will not enable the queue. For symmetry, suspend a VQ instead of tearing it down when the number of VQ pairs decreases. But only if the resume operation is supported. Reviewed-by: Cosmin Ratiu <[email protected]> Acked-by: Eugenio Pérez <[email protected]> Signed-off-by: Dragos Tatulea <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent ac85cd9 commit 3b3adb3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,14 +2130,22 @@ static int change_num_qps(struct mlx5_vdpa_dev *mvdev, int newqps)
21302130
if (err)
21312131
return err;
21322132

2133-
for (i = ndev->cur_num_vqs - 1; i >= 2 * newqps; i--)
2134-
teardown_vq(ndev, &ndev->vqs[i]);
2133+
for (i = ndev->cur_num_vqs - 1; i >= 2 * newqps; i--) {
2134+
struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i];
2135+
2136+
if (is_resumable(ndev))
2137+
suspend_vq(ndev, mvq);
2138+
else
2139+
teardown_vq(ndev, mvq);
2140+
}
21352141

21362142
ndev->cur_num_vqs = 2 * newqps;
21372143
} else {
21382144
ndev->cur_num_vqs = 2 * newqps;
21392145
for (i = cur_qps * 2; i < 2 * newqps; i++) {
2140-
err = setup_vq(ndev, &ndev->vqs[i], true);
2146+
struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i];
2147+
2148+
err = mvq->initialized ? resume_vq(ndev, mvq) : setup_vq(ndev, mvq, true);
21412149
if (err)
21422150
goto clean_added;
21432151
}

0 commit comments

Comments
 (0)