summaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-08-09 16:45:55 +0200
committerStefan Hajnoczi <stefanha@gmail.com>2012-09-14 08:40:31 +0100
commit987a9b4800003567b1a47a379255e886a77d57ea (patch)
tree030780937d777488169946c3d9cb5efdcc63c3fd /net.c
parente0a1e32dbc41e6b2aabb436a9417dfd32177a3dc (diff)
downloadqemu-987a9b4800003567b1a47a379255e886a77d57ea.tar.gz
qemu-987a9b4800003567b1a47a379255e886a77d57ea.tar.bz2
qemu-987a9b4800003567b1a47a379255e886a77d57ea.zip
net: notify iothread after flushing queue
virtio-net has code to flush the queue and notify the iothread whenever new receive buffers are added by the guest. That is fine, and indeed we need to do the same in all other drivers. However, notifying the iothread should be work for the network subsystem. And since we are at it we can add a little smartness: if some of the queued packets already could not be delivered, there is no need to notify the iothread. Reported-by: Luigi Rizzo <rizzo@iet.unipi.it> Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Cc: Jan Kiszka <jan.kiszka@siemens.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'net.c')
-rw-r--r--net.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net.c b/net.c
index e5d25d4b6d..d9ba1e5b74 100644
--- a/net.c
+++ b/net.c
@@ -357,7 +357,12 @@ void qemu_flush_queued_packets(NetClientState *nc)
{
nc->receive_disabled = 0;
- qemu_net_queue_flush(nc->send_queue);
+ if (qemu_net_queue_flush(nc->send_queue)) {
+ /* We emptied the queue successfully, signal to the IO thread to repoll
+ * the file descriptor (for tap, for example).
+ */
+ qemu_notify_event();
+ }
}
static ssize_t qemu_send_packet_async_with_flags(NetClientState *sender,