[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/3] virtio-serial-bus: discard data in already popp
From: |
Amit Shah |
Subject: |
[Qemu-devel] [PATCH 2/3] virtio-serial-bus: discard data in already popped-out elem |
Date: |
Wed, 14 Sep 2011 12:59:06 +0530 |
While discarding data previously any popped-out elem in the vq but not
yet pushed into the guest because the backend was throttled wasn't
pushed back into the guest. Fix that by checking if we had any
in-progress elem, and pushing it out to the guest first before emptying
the vq.
Signed-off-by: Amit Shah <address@hidden>
---
hw/virtio-serial-bus.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 6838d73..2c84398 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -122,6 +122,10 @@ static void discard_vq_data(VirtIOSerialPort *port,
VirtQueue *vq,
if (!virtio_queue_ready(vq)) {
return;
}
+ if (port && port->elem.out_num) {
+ virtqueue_push(vq, &port->elem, 0);
+ port->elem.out_num = 0;
+ }
while (virtqueue_pop(vq, &elem)) {
virtqueue_push(vq, &elem, 0);
}
--
1.7.6