qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/3] virtio-serial-bus: add port arg to discard_vq_d


From: Amit Shah
Subject: [Qemu-devel] [PATCH 1/3] virtio-serial-bus: add port arg to discard_vq_data()
Date: Wed, 14 Sep 2011 12:59:05 +0530

To discard throttled data as well as maintain statistics of bytes
received and discarded, discard_vq_data() will need the port associated
with the vq.

Signed-off-by: Amit Shah <address@hidden>
---
 hw/virtio-serial-bus.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index a4825b9..6838d73 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -114,7 +114,8 @@ static size_t write_to_port(VirtIOSerialPort *port,
     return offset;
 }
 
-static void discard_vq_data(VirtQueue *vq, VirtIODevice *vdev)
+static void discard_vq_data(VirtIOSerialPort *port, VirtQueue *vq,
+                            VirtIODevice *vdev)
 {
     VirtQueueElement elem;
 
@@ -248,7 +249,7 @@ int virtio_serial_close(VirtIOSerialPort *port)
      * consume, reset the throttling flag and discard the data.
      */
     port->throttled = false;
-    discard_vq_data(port->ovq, &port->vser->vdev);
+    discard_vq_data(port, port->ovq, &port->vser->vdev);
 
     send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN, 0);
 
@@ -473,7 +474,7 @@ static void handle_output(VirtIODevice *vdev, VirtQueue *vq)
     info = port ? DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info) : NULL;
 
     if (!port || !port->host_connected || !info->have_data) {
-        discard_vq_data(vq, vdev);
+        discard_vq_data(port, vq, vdev);
         return;
     }
 
@@ -730,7 +731,7 @@ static void remove_port(VirtIOSerial *vser, uint32_t 
port_id)
 
     port = find_port_by_id(vser, port_id);
     /* Flush out any unconsumed buffers first */
-    discard_vq_data(port->ovq, &port->vser->vdev);
+    discard_vq_data(port, port->ovq, &port->vser->vdev);
 
     send_control_event(port, VIRTIO_CONSOLE_PORT_REMOVE, 1);
 }
-- 
1.7.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]