dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0020-usb-parallelize-usb3-streams.patch

298366
From 96b14d0db19b2b80ab3dc35d522671da82101e72 Mon Sep 17 00:00:00 2001
298366
From: Gerd Hoffmann <kraxel@redhat.com>
298366
Date: Tue, 27 Aug 2013 15:25:24 +0200
298366
Subject: [PATCH] usb: parallelize usb3 streams
298366
298366
usb3 bulk endpoints with streams are implicitly pipelined now,
298366
so the requests will actually be processed in parallel.  Also
298366
allow them to complete out-of-order.
298366
298366
Fixes stalls in the uas driver.
298366
298366
Cc: qemu-stable@nongnu.org
298366
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
298366
(cherry picked from commit c96c41ed0d38d68a6c8b6f84751afebafeae31be)
298366
298366
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
298366
---
298366
 hw/usb/core.c | 7 ++++---
298366
 1 file changed, 4 insertions(+), 3 deletions(-)
298366
298366
diff --git a/hw/usb/core.c b/hw/usb/core.c
298366
index 05948ca..31960c2 100644
298366
--- a/hw/usb/core.c
298366
+++ b/hw/usb/core.c
298366
@@ -403,7 +403,7 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p)
298366
         p->ep->halted = false;
298366
     }
298366
 
298366
-    if (QTAILQ_EMPTY(&p->ep->queue) || p->ep->pipeline) {
298366
+    if (QTAILQ_EMPTY(&p->ep->queue) || p->ep->pipeline || p->stream) {
298366
         usb_process_one(p);
298366
         if (p->status == USB_RET_ASYNC) {
298366
             /* hcd drivers cannot handle async for isoc */
298366
@@ -420,7 +420,8 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p)
298366
              * When pipelining is enabled usb-devices must always return async,
298366
              * otherwise packets can complete out of order!
298366
              */
298366
-            assert(!p->ep->pipeline || QTAILQ_EMPTY(&p->ep->queue));
298366
+            assert(p->stream || !p->ep->pipeline ||
298366
+                   QTAILQ_EMPTY(&p->ep->queue));
298366
             if (p->status != USB_RET_NAK) {
298366
                 usb_packet_set_state(p, USB_PACKET_COMPLETE);
298366
             }
298366
@@ -434,7 +435,7 @@ void usb_packet_complete_one(USBDevice *dev, USBPacket *p)
298366
 {
298366
     USBEndpoint *ep = p->ep;
298366
 
298366
-    assert(QTAILQ_FIRST(&ep->queue) == p);
298366
+    assert(p->stream || QTAILQ_FIRST(&ep->queue) == p);
298366
     assert(p->status != USB_RET_ASYNC && p->status != USB_RET_NAK);
298366
 
298366
     if (p->status != USB_RET_SUCCESS ||