qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 6/8] usb-storage: don't try to send the status e


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 6/8] usb-storage: don't try to send the status early.
Date: Mon, 21 Nov 2011 15:10:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1

On 11/21/2011 02:40 PM, Gerd Hoffmann wrote:
Until recently all scsi commands sent to scsi-disk did either transfer
data or finished instantly.  The correct implementation of
SYNCRONIZE_CACHE changed the picture though, and usb-storage needs
a fix to handle that case correctly.
---
  hw/usb-msd.c |   16 ++++++++++------
  1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 6f32a0e..68e3756 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -378,9 +378,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
              s->scsi_len = 0;
              s->req = scsi_req_new(s->scsi_dev, tag, 0, cbw.cmd, NULL);
              scsi_req_enqueue(s->req);
-            /* ??? Should check that USB and SCSI data transfer
-               directions match.  */
-            if (s->mode != USB_MSDM_CSW&&  s->residue == 0) {
+            if (s->req&&  s->req->cmd.xfer != SCSI_XFER_NONE) {
                  scsi_req_continue(s->req);
              }
              ret = p->result;
@@ -439,9 +437,15 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket 
*p)
                  goto fail;
              }

-            usb_msd_send_status(s, p);
-            s->mode = USB_MSDM_CBW;
-            ret = 13;
+            if (s->req) {
+                /* still in flight */
+                s->packet = p;
+                ret = USB_RET_ASYNC;
+            } else {
+                usb_msd_send_status(s, p);
+                s->mode = USB_MSDM_CBW;
+                ret = 13;
+            }
              break;

          case USB_MSDM_DATAIN:

Acked-by: Paolo Bonzini <address@hidden>

... even without 5/8.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]