UAS: Use unique tags on non-streams devices.
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Fri, 2 Dec 2011 19:55:46 +0000 (11:55 -0800)
committerSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 22 Dec 2011 09:14:48 +0000 (10:14 +0100)
UAS can work with either USB 3.0 devices that support bulk streams, or
USB 2.0 devices that do not support bulk streams.  When we're working
with a non-streams device, we need to be able to uniquely identify a
SCSI command with a tag in the IU.  Devices will barf and abort all
queued commands if they find a duplicate tag.

uas_queuecommand_lck() sets cmdinfo->stream to zero if the device
doesn't support streams, which is later passed into uas_alloc_cmd_urb()
as the variable stream.  This means the UAS driver was setting the tag
in all commands to zero for non-stream devices.  So the UAS driver won't
currently work with USB 2.0 devices.

Use the SCSI command tag instead of the stream ID for the command IU
tag.  We have to add one to the SCSI command tag because SCSI tags are
zero-based, but stream IDs are one-based, and the command tag must match
the stream ID that we're queueing the data IUs for.  Untagged SCSI
commands use stream ID 1.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
drivers/usb/storage/uas.c

index 4bbaf6e150e41fa94f93a03d8f18fedfc28bb388..28d9b1909389d4197c6e26712cf113359b21ea1b 100644 (file)
@@ -343,7 +343,10 @@ static struct urb *uas_alloc_cmd_urb(struct uas_dev_info *devinfo, gfp_t gfp,
                goto free;
 
        iu->iu_id = IU_ID_COMMAND;
-       iu->tag = cpu_to_be16(stream_id);
+       if (blk_rq_tagged(cmnd->request))
+               iu->tag = cpu_to_be16(cmnd->request->tag + 1);
+       else
+               iu->tag = cpu_to_be16(1);
        iu->prio_attr = UAS_SIMPLE_TAG;
        iu->len = len;
        int_to_scsilun(sdev->lun, &iu->lun);
This page took 0.029327 seconds and 5 git commands to generate.