diff options
author | Zhu Lingshan <lingshan.zhu@intel.com> | 2024-02-02 17:39:02 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2024-03-19 07:45:50 +0100 |
commit | 47e62e6d62fcae0a00b9f00228c458661595b380 (patch) | |
tree | a85abfa3346c383aefdd142c9effd95431e51954 /drivers/vdpa | |
parent | vdpa_sim: implement vdpa_config_ops.get_vq_size for vDPA simulator (diff) | |
download | linux-47e62e6d62fcae0a00b9f00228c458661595b380.tar.xz linux-47e62e6d62fcae0a00b9f00228c458661595b380.zip |
vduse: implement vdpa_config_ops.get_vq_size for vduse
This commit implements get_vq_size for vdpa_config_ops. This
new interface is used to report per vq size.
Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
Message-Id: <20240202163905.8834-8-lingshan.zhu@intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vdpa')
-rw-r--r-- | drivers/vdpa/vdpa_user/vduse_dev.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c index 75354ce186a1..73c89701fc9d 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -541,6 +541,17 @@ static void vduse_vdpa_set_vq_num(struct vdpa_device *vdpa, u16 idx, u32 num) vq->num = num; } +static u16 vduse_vdpa_get_vq_size(struct vdpa_device *vdpa, u16 idx) +{ + struct vduse_dev *dev = vdpa_to_vduse(vdpa); + struct vduse_virtqueue *vq = dev->vqs[idx]; + + if (vq->num) + return vq->num; + else + return vq->num_max; +} + static void vduse_vdpa_set_vq_ready(struct vdpa_device *vdpa, u16 idx, bool ready) { @@ -773,6 +784,7 @@ static const struct vdpa_config_ops vduse_vdpa_config_ops = { .kick_vq = vduse_vdpa_kick_vq, .set_vq_cb = vduse_vdpa_set_vq_cb, .set_vq_num = vduse_vdpa_set_vq_num, + .get_vq_size = vduse_vdpa_get_vq_size, .set_vq_ready = vduse_vdpa_set_vq_ready, .get_vq_ready = vduse_vdpa_get_vq_ready, .set_vq_state = vduse_vdpa_set_vq_state, |