aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2014-07-17 20:02:45 +0530
committerAmit Shah <amit.shah@redhat.com>2015-03-19 17:35:40 +0530
commit4add73aa601ab42b7a9863d483fa313b06105b34 (patch)
tree9d181e5e777b8bea757911f2b31d70fe2192a1a9 /include
parent17b11a1406fdc43b5022f32a6fbfcb005a353b38 (diff)
virtio: serial: expose a 'guest_writable' callback for users
Users of virtio-serial may want to know when a port becomes writable. A port can stop accepting writes if the guest port is open but not being read from. In this case, data gets queued up in the virtqueue, and after the vq is full, writes to the port do not succeed. When the guest reads off a vq element, and adds a new one for the host to put data in, we can tell users the port is available for more writes, via the new ->guest_writable() callback. Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/virtio/virtio-serial.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/hw/virtio/virtio-serial.h b/include/hw/virtio/virtio-serial.h
index ccf8459829..18d1bccd0b 100644
--- a/include/hw/virtio/virtio-serial.h
+++ b/include/hw/virtio/virtio-serial.h
@@ -60,6 +60,17 @@ typedef struct VirtIOSerialPortClass {
/* Guest is now ready to accept data (virtqueues set up). */
void (*guest_ready)(VirtIOSerialPort *port);
+ /*
+ * Guest has enqueued a buffer for the host to write into.
+ * Called each time a buffer is enqueued by the guest;
+ * irrespective of whether there already were free buffers the
+ * host could have consumed.
+ *
+ * This is dependent on both the guest and host end being
+ * connected.
+ */
+ void (*guest_writable)(VirtIOSerialPort *port);
+
/*
* Guest wrote some data to the port. This data is handed over to
* the app via this callback. The app can return a size less than