[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 19/19] virtio: console: add flow control
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 19/19] virtio: console: add flow control |
Date: |
Mon, 18 Feb 2013 15:48:16 -0600 |
From: Amit Shah <address@hidden>
The virtio-serial-bus already has the logic to make flow control work
properly. Hook into the char layer's new ability to signal a backend is
writable again.
Signed-off-by: Amit Shah <address@hidden>
---
hw/virtio-console.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 46072a0..b3ee074 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -20,6 +20,18 @@ typedef struct VirtConsole {
CharDriverState *chr;
} VirtConsole;
+/*
+ * Callback function that's called from chardevs when backend becomes
+ * writable.
+ */
+static gboolean chr_write_unblocked(GIOChannel *chan, GIOCondition cond,
+ void *opaque)
+{
+ VirtConsole *vcon = opaque;
+
+ virtio_serial_throttle_port(&vcon->port, false);
+ return FALSE;
+}
/* Callback function that's called when the guest sends us data */
static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t
len)
@@ -48,6 +60,7 @@ static ssize_t flush_buf(VirtIOSerialPort *port, const
uint8_t *buf, size_t len)
* do_flush_queued_data().
*/
ret = 0;
+ qemu_chr_fe_add_watch(vcon->chr, G_IO_OUT, chr_write_unblocked, vcon);
}
return ret;
}
--
1.8.0
- [Qemu-devel] [PATCH 06/19] qemu-char: convert UDP to GIOChannel, (continued)
- [Qemu-devel] [PATCH 11/19] qemu-char: use a glib timeout instead of qemu-timer, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 12/19] qemu-char: remove use of QEMUTimer in favor of glib idle function, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 13/19] qemu-char: make char drivers dynamically registerable, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 14/19] qemu-char: move spice registration to spice-qemu-char.c, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 19/19] virtio: console: add flow control,
Anthony Liguori <=
- [Qemu-devel] [PATCH 18/19] serial: add flow control to transmit, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 15/19] qemu-char: move baum registration to baum.c, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 16/19] qemu-char: move msmouse registeration to msmouse.c, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 17/19] qemu-char: move text console init to console.c, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 02/19] qemu-char: remove dead/confusing logic with nb_stdio_clients, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 04/19] qemu-char: convert fd_chr to use a GIOChannel, Anthony Liguori, 2013/02/18
- [Qemu-devel] [PATCH 05/19] qemu-char: convert pty to GIOChannel, Anthony Liguori, 2013/02/19
- Re: [Qemu-devel] [PATCH 00/19] chardev flow control, Amit Shah, 2013/02/19
- Re: [Qemu-devel] [PATCH 00/19] chardev flow control, Hans de Goede, 2013/02/19