Patchwork [1/8] virtio-serial: throttling: check for throttled status before sending any data

login
register
mail settings
Submitter Amit Shah
Date April 7, 2010, 9:02 p.m.
Message ID <1270674156-9345-2-git-send-email-amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/49643/
State New
Headers show

Comments

Amit Shah - April 7, 2010, 9:02 p.m.
We were assuming that once unthrottled, ports could accept any amount of
data without getting throttled again.

Fix this assumption.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/virtio-serial-bus.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 65ab253..5df9b6b 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -118,7 +118,7 @@  static void flush_queued_data(VirtIOSerialPort *port, bool discard)
     VirtQueueElement elem;
 
     vq = port->ovq;
-    while (virtqueue_pop(vq, &elem)) {
+    while ((discard || !port->throttled) && virtqueue_pop(vq, &elem)) {
         uint8_t *buf;
         size_t ret, buf_size;