diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-03-08 15:04:52 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2019-03-12 22:31:21 -0400 |
commit | b13919ab64e712158a031bf4ea48e92b20ed8ef5 (patch) | |
tree | 81b2892f8acabd4aee6cf981ebc74c26bcad4b2e /contrib/libvhost-user/libvhost-user.c | |
parent | 922ef483ec812730f87102b372691c510313fcea (diff) |
libvhost-user: add vu_queue_unpop()
vhost-user-input will make use of this function to undo some queue pop
in case the virtio queue does not have enough room.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190308140454.32437-11-marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'contrib/libvhost-user/libvhost-user.c')
-rw-r--r-- | contrib/libvhost-user/libvhost-user.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c index fcf5014240..df72d3e440 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -1966,6 +1966,22 @@ vu_queue_pop(VuDev *dev, VuVirtq *vq, size_t sz) return elem; } +static void +vu_queue_detach_element(VuDev *dev, VuVirtq *vq, VuVirtqElement *elem, + size_t len) +{ + vq->inuse--; + /* unmap, when DMA support is added */ +} + +void +vu_queue_unpop(VuDev *dev, VuVirtq *vq, VuVirtqElement *elem, + size_t len) +{ + vq->last_avail_idx--; + vu_queue_detach_element(dev, vq, elem, len); +} + bool vu_queue_rewind(VuDev *dev, VuVirtq *vq, unsigned int num) { |