qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/3] net: invoke callback when purging queue
@ 2014-09-04  8:39 Michael S. Tsirkin
  2014-09-04  8:39 ` [Qemu-devel] [PATCH 2/3] net: complete all queued packets on VM stop Michael S. Tsirkin
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2014-09-04  8:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jason Wang, Stefan Hajnoczi, qemu-stable, Anthony Liguori

devices rely on packet callbacks eventually running,
but we violate this rule whenever we purge the queue.
To fix, invoke callbacks on all packets on purge.
Set length to 0, this way callers can detect that
this happened and re-queue if necessary.

Cc: qemu-stable@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 net/queue.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/queue.c b/net/queue.c
index 859d02a..f948318 100644
--- a/net/queue.c
+++ b/net/queue.c
@@ -233,6 +233,9 @@ void qemu_net_queue_purge(NetQueue *queue, NetClientState *from)
         if (packet->sender == from) {
             QTAILQ_REMOVE(&queue->packets, packet, entry);
             queue->nq_count--;
+            if (packet->sent_cb) {
+                packet->sent_cb(packet->sender, 0);
+            }
             g_free(packet);
         }
     }
-- 
MST

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-04 13:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-04  8:39 [Qemu-devel] [PATCH 1/3] net: invoke callback when purging queue Michael S. Tsirkin
2014-09-04  8:39 ` [Qemu-devel] [PATCH 2/3] net: complete all queued packets on VM stop Michael S. Tsirkin
2014-09-04 10:15   ` Jason Wang
2014-09-04 10:32     ` Michael S. Tsirkin
2014-09-04  8:39 ` [Qemu-devel] [PATCH 3/3] virtio-net: purge outstanding packets when starting vhost Michael S. Tsirkin
2014-09-04  9:58 ` [Qemu-devel] [PATCH 1/3] net: invoke callback when purging queue Jason Wang
2014-09-04 13:38 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).