aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/virtio/virtio_vdpa.c
diff options
context:
space:
mode:
authorZhu Lingshan <lingshan.zhu@intel.com>2024-02-03 00:39:03 +0800
committerMichael S. Tsirkin <mst@redhat.com>2024-03-19 02:45:50 -0400
commit273ae08fa03f907d09d6fe815a3982a7298ba804 (patch)
tree0030615da5b8518769facd3cc9ef160027f2ce3b /drivers/virtio/virtio_vdpa.c
parentvduse: implement vdpa_config_ops.get_vq_size for vduse (diff)
downloadwireguard-linux-273ae08fa03f907d09d6fe815a3982a7298ba804.tar.xz
wireguard-linux-273ae08fa03f907d09d6fe815a3982a7298ba804.zip
virtio_vdpa: create vqs with the actual size
The size of a virtqueue is a per vq configuration, this commit allows virtio_vdpa to create virtqueues with the actual size of a specific vq size that supported by the backend device. Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com> Message-Id: <20240202163905.8834-9-lingshan.zhu@intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to '')
-rw-r--r--drivers/virtio/virtio_vdpa.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
index 8d63e5923d24..e803db0da307 100644
--- a/drivers/virtio/virtio_vdpa.c
+++ b/drivers/virtio/virtio_vdpa.c
@@ -183,8 +183,11 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return ERR_PTR(-ENOMEM);
+ if (ops->get_vq_size)
+ max_num = ops->get_vq_size(vdpa, index);
+ else
+ max_num = ops->get_vq_num_max(vdpa);
- max_num = ops->get_vq_num_max(vdpa);
if (max_num == 0) {
err = -ENOENT;
goto error_new_virtqueue;