qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <4ECA5BD7.2070008@redhat.com> (raw)
In-Reply-To: <1321882802-3337-7-git-send-email-kraxel@redhat.com>

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 <pbonzini@redhat.com>

... even without 5/8.

Paolo

  reply	other threads:[~2011-11-21 14:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 13:39 [Qemu-devel] [PULL 1.0] usb patch queue (with scsi bits) Gerd Hoffmann
2011-11-21 13:39 ` [Qemu-devel] [PATCH 1/8] usb-storage: move status debug message to usb_msd_send_status Gerd Hoffmann
2011-11-21 13:39 ` [Qemu-devel] [PATCH 2/8] usb-storage: fill status in complete callback Gerd Hoffmann
2011-11-21 13:39 ` [Qemu-devel] [PATCH 3/8] usb-storage: drop tag from device state Gerd Hoffmann
2011-11-21 13:39 ` [Qemu-devel] [PATCH 4/8] usb-storage: drop result " Gerd Hoffmann
2011-11-21 13:39 ` [Qemu-devel] [PATCH 5/8] scsi-disk: don't call scsi_req_complete twice Gerd Hoffmann
2011-11-21 13:49   ` Paolo Bonzini
2011-11-21 13:40 ` [Qemu-devel] [PATCH 6/8] usb-storage: don't try to send the status early Gerd Hoffmann
2011-11-21 14:10   ` Paolo Bonzini [this message]
2011-11-21 13:40 ` [Qemu-devel] [PATCH 7/8] ehci: add assert Gerd Hoffmann
2011-11-21 13:40 ` [Qemu-devel] [PATCH 8/8] usb-linux: fix /proc/bus/usb/devices scan Gerd Hoffmann
2011-11-21 17:17   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ECA5BD7.2070008@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).