Blame 0145-usb-redir-Get-rid-of-local-shadow-copy-of-packet-hea.patch

5544c1
From 40d22426e0e12f26c7bfa5848cf0a9857d52dc99 Mon Sep 17 00:00:00 2001
c8dfc6
From: Hans de Goede <hdegoede@redhat.com>
c8dfc6
Date: Tue, 28 Aug 2012 09:05:38 +0200
5544c1
Subject: [PATCH] usb-redir: Get rid of local shadow copy of packet headers
c8dfc6
c8dfc6
The shadow copy only serves as an extra check (besides the packet-id) to
c8dfc6
ensure the packet we get back is a reply to the packet we think it is.
c8dfc6
c8dfc6
This check has never triggered in all the time usb-redir is in use now,
c8dfc6
and since the verified data in the returned packet-header is not used
c8dfc6
otherwise, removing the check does not open any possibilities for the
c8dfc6
usbredirhost to confuse us.
c8dfc6
c8dfc6
This is a preparation patch for completely getting rid of the async-packet
c8dfc6
struct in usb-redir, instead relying on the (new) per ep queues in the
c8dfc6
qemu usb core.
c8dfc6
c8dfc6
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
c8dfc6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5544c1
(cherry picked from commit 104981d52b63dc3d68f39d4442881c667f44bbb9)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
c8dfc6
---
c8dfc6
 hw/usb/redirect.c | 27 ---------------------------
c8dfc6
 1 file changed, 27 deletions(-)
c8dfc6
c8dfc6
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
5544c1
index 2cae8c5..e4ef372 100644
c8dfc6
--- a/hw/usb/redirect.c
c8dfc6
+++ b/hw/usb/redirect.c
c8dfc6
@@ -99,11 +99,6 @@ struct AsyncURB {
c8dfc6
     USBRedirDevice *dev;
c8dfc6
     USBPacket *packet;
c8dfc6
     uint32_t packet_id;
c8dfc6
-    union {
c8dfc6
-        struct usb_redir_control_packet_header control_packet;
c8dfc6
-        struct usb_redir_bulk_packet_header bulk_packet;
c8dfc6
-        struct usb_redir_interrupt_packet_header interrupt_packet;
c8dfc6
-    };
c8dfc6
     QTAILQ_ENTRY(AsyncURB)next;
c8dfc6
 };
c8dfc6
 
5544c1
@@ -500,7 +495,6 @@ static int usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p,
c8dfc6
     bulk_packet.endpoint  = ep;
c8dfc6
     bulk_packet.length    = p->iov.size;
c8dfc6
     bulk_packet.stream_id = 0;
c8dfc6
-    aurb->bulk_packet = bulk_packet;
c8dfc6
 
c8dfc6
     if (ep & USB_DIR_IN) {
c8dfc6
         usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id,
5544c1
@@ -581,7 +575,6 @@ static int usbredir_handle_interrupt_data(USBRedirDevice *dev,
c8dfc6
 
c8dfc6
         interrupt_packet.endpoint  = ep;
c8dfc6
         interrupt_packet.length    = p->iov.size;
c8dfc6
-        aurb->interrupt_packet     = interrupt_packet;
c8dfc6
 
c8dfc6
         usb_packet_copy(p, buf, p->iov.size);
c8dfc6
         usbredir_log_data(dev, "interrupt data out:", buf, p->iov.size);
5544c1
@@ -762,7 +755,6 @@ static int usbredir_handle_control(USBDevice *udev, USBPacket *p,
c8dfc6
     control_packet.value       = value;
c8dfc6
     control_packet.index       = index;
c8dfc6
     control_packet.length      = length;
c8dfc6
-    aurb->control_packet       = control_packet;
c8dfc6
 
c8dfc6
     if (control_packet.requesttype & USB_DIR_IN) {
c8dfc6
         usbredirparser_send_control_packet(dev->parser, aurb->packet_id,
5544c1
@@ -1326,14 +1318,6 @@ static void usbredir_control_packet(void *priv, uint32_t id,
c8dfc6
         return;
c8dfc6
     }
c8dfc6
 
c8dfc6
-    aurb->control_packet.status = control_packet->status;
c8dfc6
-    aurb->control_packet.length = control_packet->length;
c8dfc6
-    if (memcmp(&aurb->control_packet, control_packet,
c8dfc6
-               sizeof(*control_packet))) {
c8dfc6
-        ERROR("return control packet mismatch, please report this!\n");
c8dfc6
-        len = USB_RET_NAK;
c8dfc6
-    }
c8dfc6
-
c8dfc6
     if (aurb->packet) {
c8dfc6
         len = usbredir_handle_status(dev, control_packet->status, len);
c8dfc6
         if (len > 0) {
5544c1
@@ -1371,12 +1355,6 @@ static void usbredir_bulk_packet(void *priv, uint32_t id,
c8dfc6
         return;
c8dfc6
     }
c8dfc6
 
c8dfc6
-    if (aurb->bulk_packet.endpoint != bulk_packet->endpoint ||
c8dfc6
-            aurb->bulk_packet.stream_id != bulk_packet->stream_id) {
c8dfc6
-        ERROR("return bulk packet mismatch, please report this!\n");
c8dfc6
-        len = USB_RET_NAK;
c8dfc6
-    }
c8dfc6
-
c8dfc6
     if (aurb->packet) {
c8dfc6
         len = usbredir_handle_status(dev, bulk_packet->status, len);
c8dfc6
         if (len > 0) {
5544c1
@@ -1455,11 +1433,6 @@ static void usbredir_interrupt_packet(void *priv, uint32_t id,
c8dfc6
             return;
c8dfc6
         }
c8dfc6
 
c8dfc6
-        if (aurb->interrupt_packet.endpoint != interrupt_packet->endpoint) {
c8dfc6
-            ERROR("return int packet mismatch, please report this!\n");
c8dfc6
-            len = USB_RET_NAK;
c8dfc6
-        }
c8dfc6
-
c8dfc6
         if (aurb->packet) {
c8dfc6
             aurb->packet->result = usbredir_handle_status(dev,
c8dfc6
                                                interrupt_packet->status, len);
c8dfc6
-- 
5544c1
1.7.12.1
c8dfc6