summaryrefslogtreecommitdiff
path: root/hw/virtio-serial.h
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-12-10 16:51:14 +0530
committerAmit Shah <amit.shah@redhat.com>2011-01-20 14:38:22 +0530
commitf1925dff7e6c4799f5951cf167a437c0737a266c (patch)
tree25cbad7d9dfb64ec7f7ae4a4ef932e6ad0cb35bb /hw/virtio-serial.h
parente300ac275bbf19b31cf5968b8de8abe52c26e163 (diff)
downloadqemu-f1925dff7e6c4799f5951cf167a437c0737a266c.tar.gz
qemu-f1925dff7e6c4799f5951cf167a437c0737a266c.tar.bz2
qemu-f1925dff7e6c4799f5951cf167a437c0737a266c.zip
virtio-serial: Add support for flow control
This commit lets apps signal an incomplete write. When that happens, stop sending out any more data to the app and wait for it to unthrottle the port. Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'hw/virtio-serial.h')
-rw-r--r--hw/virtio-serial.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h
index 9cc0fb3543..a308196786 100644
--- a/hw/virtio-serial.h
+++ b/hw/virtio-serial.h
@@ -102,6 +102,23 @@ struct VirtIOSerialPort {
*/
uint32_t id;
+ /*
+ * This is the elem that we pop from the virtqueue. A slow
+ * backend that consumes guest data (e.g. the file backend for
+ * qemu chardevs) can cause the guest to block till all the output
+ * is flushed. This isn't desired, so we keep a note of the last
+ * element popped and continue consuming it once the backend
+ * becomes writable again.
+ */
+ VirtQueueElement elem;
+
+ /*
+ * The index and the offset into the iov buffer that was popped in
+ * elem above.
+ */
+ uint32_t iov_idx;
+ uint64_t iov_offset;
+
/* Identify if this is a port that binds with hvc in the guest */
uint8_t is_console;