From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3SOv-00068Q-4h for qemu-devel@nongnu.org; Fri, 02 Mar 2012 08:20:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S3SOV-0007t5-1k for qemu-devel@nongnu.org; Fri, 02 Mar 2012 08:20:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3SOU-0007sR-Ow for qemu-devel@nongnu.org; Fri, 02 Mar 2012 08:19:34 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q22DJWtA020409 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 2 Mar 2012 08:19:33 -0500 From: Gerd Hoffmann Date: Fri, 2 Mar 2012 14:19:25 +0100 Message-Id: <1330694370-1078-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1330694370-1078-1-git-send-email-kraxel@redhat.com> References: <1330694370-1078-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 2/7] usb: queue can have async packets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann This can happen today in case the ->complete() callback queues up the next packet. Also we'll support pipelining soon, which allows to have multiple packets per queue in flight (aka ASYNC) state. Signed-off-by: Gerd Hoffmann --- hw/usb.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/hw/usb.c b/hw/usb.c index 57fc5e3..fc41d62 100644 --- a/hw/usb.c +++ b/hw/usb.c @@ -356,6 +356,9 @@ void usb_packet_complete(USBDevice *dev, USBPacket *p) while (!QTAILQ_EMPTY(&ep->queue)) { p = QTAILQ_FIRST(&ep->queue); + if (p->state == USB_PACKET_ASYNC) { + break; + } assert(p->state == USB_PACKET_QUEUED); ret = usb_process_one(p); if (ret == USB_RET_ASYNC) { -- 1.7.1