From: Alexandr Moshkov <[email protected]> Wire up the skip_drain parameter introduced in the previous commit to the new GET_VRING_BASE_SKIP_DRAIN message. When skip_drain is set, send GET_VRING_BASE_SKIP_DRAIN instead of GET_VRING_BASE, instructing the back-end to suspend in-flight I/O immediately.
Signed-off-by: Alexandr Moshkov <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Message-ID: <[email protected]> --- hw/virtio/vhost.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 7294d3c42a..68a8e40481 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1521,7 +1521,11 @@ static int do_vhost_virtqueue_stop(struct vhost_dev *dev, } if (!force) { - r = dev->vhost_ops->vhost_get_vring_base(dev, &state); + if (!skip_drain) { + r = dev->vhost_ops->vhost_get_vring_base(dev, &state); + } else { + r = dev->vhost_ops->vhost_get_vring_base_skip_drain(dev, &state); + } if (r < 0) { VHOST_OPS_DEBUG(r, "vhost VQ %u ring restore failed: %d", idx, r); } -- MST
