On 09/04/2014 04:39 PM, Michael S. Tsirkin wrote: > 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-sta...@nongnu.org > Cc: Jason Wang <jasow...@redhat.com> > Signed-off-by: Michael S. Tsirkin <m...@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); > } > }
Acked-by: Jason Wang <jasow...@redhat.com>