From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPToI-0006KU-7S for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:58:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPToD-0005E3-6E for qemu-devel@nongnu.org; Thu, 04 Sep 2014 05:58:34 -0400 Message-ID: <540837B2.1050209@redhat.com> Date: Thu, 04 Sep 2014 17:58:10 +0800 From: Jason Wang MIME-Version: 1.0 References: <1409816839-12309-1-git-send-email-mst@redhat.com> In-Reply-To: <1409816839-12309-1-git-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] net: invoke callback when purging queue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , qemu-devel@nongnu.org Cc: Stefan Hajnoczi , qemu-stable@nongnu.org, Anthony Liguori 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-stable@nongnu.org > Cc: Jason Wang > Signed-off-by: Michael S. Tsirkin > --- > 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