aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-serial.h
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-04-27 18:04:11 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2010-04-28 08:58:22 -0500
commit9ed7b059ef776a3921cfd085e891f45076922542 (patch)
tree422546b0e15528f3ee5f937c73c3b1818611c9d9 /hw/virtio-serial.h
parenta69c76008597ccdffae7a933686ab856ca85e87c (diff)
virtio-serial: Implement flow control for individual ports
Individual ports can now signal to the virtio-serial core to stop sending data if the ports cannot immediately handle new data. When a port later unthrottles, any data queued up in the virtqueue are sent to the port. Disable throttling once a port is closed (and we discard all the unconsumed buffers in the vq). The guest kernel can reclaim the buffers when it receives the port close event or when a port is being removed. Ensure we free up the buffers before we send out any events to the guest. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-serial.h')
-rw-r--r--hw/virtio-serial.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h
index 62d76a25fe..a93b5458b2 100644
--- a/hw/virtio-serial.h
+++ b/hw/virtio-serial.h
@@ -110,6 +110,8 @@ struct VirtIOSerialPort {
bool guest_connected;
/* Is this device open for IO on the host? */
bool host_connected;
+ /* Do apps not want to receive data? */
+ bool throttled;
};
struct VirtIOSerialPortInfo {
@@ -173,4 +175,11 @@ ssize_t virtio_serial_write(VirtIOSerialPort *port, const uint8_t *buf,
*/
size_t virtio_serial_guest_ready(VirtIOSerialPort *port);
+/*
+ * Flow control: Ports can signal to the virtio-serial core to stop
+ * sending data or re-start sending data, depending on the 'throttle'
+ * value here.
+ */
+void virtio_serial_throttle_port(VirtIOSerialPort *port, bool throttle);
+
#endif