[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240708-stage-vdpa-vq-precreate-v3-20-afe3c766e393@nvidia.com>
Date: Mon, 8 Jul 2024 15:00:44 +0300
From: Dragos Tatulea <dtatulea@...dia.com>
To: "Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio Pérez
<eperezma@...hat.com>, Saeed Mahameed <saeedm@...dia.com>, Leon Romanovsky
<leon@...nel.org>, Tariq Toukan <tariqt@...dia.com>, Si-Wei Liu
<si-wei.liu@...cle.com>
CC: <virtualization@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<linux-rdma@...r.kernel.org>, <netdev@...r.kernel.org>, Cosmin Ratiu
<cratiu@...dia.com>, Dragos Tatulea <dtatulea@...dia.com>
Subject: [PATCH vhost v3 20/24] 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 <cratiu@...dia.com>
Acked-by: Eugenio Pérez <eperezma@...hat.com>
Signed-off-by: Dragos Tatulea <dtatulea@...dia.com>
---
drivers/vdpa/mlx5/net/mlx5_vnet.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index ce1f6a1f36cd..324604b16b91 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -2130,14 +2130,22 @@ static int change_num_qps(struct mlx5_vdpa_dev *mvdev, int newqps)
if (err)
return err;
- for (i = ndev->cur_num_vqs - 1; i >= 2 * newqps; i--)
- teardown_vq(ndev, &ndev->vqs[i]);
+ for (i = ndev->cur_num_vqs - 1; i >= 2 * newqps; i--) {
+ struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i];
+
+ if (is_resumable(ndev))
+ suspend_vq(ndev, mvq);
+ else
+ teardown_vq(ndev, mvq);
+ }
ndev->cur_num_vqs = 2 * newqps;
} else {
ndev->cur_num_vqs = 2 * newqps;
for (i = cur_qps * 2; i < 2 * newqps; i++) {
- err = setup_vq(ndev, &ndev->vqs[i], true);
+ struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i];
+
+ err = mvq->initialized ? resume_vq(ndev, mvq) : setup_vq(ndev, mvq, true);
if (err)
goto clean_added;
}
--
2.45.2
Powered by blists - more mailing lists