From patchwork Fri Mar 2 13:19:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 144253 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 197011007D3 for ; Sat, 3 Mar 2012 00:20:43 +1100 (EST) Received: from localhost ([::1]:54696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3SPY-0007My-Tg for incoming@patchwork.ozlabs.org; Fri, 02 Mar 2012 08:20:40 -0500 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 Received: from rincewind.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q22DJWRg007233; Fri, 2 Mar 2012 08:19:32 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 5D1CB42232; Fri, 2 Mar 2012 14:19:31 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 2/7] usb: queue can have async packets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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) {