aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2011-12-02 14:55:46 -0500
committerSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-12-22 04:14:48 -0500
commit9eb445410db99e5f5f660e97a2165a0567bd909e (patch)
tree1e3d6f9bd9262babbef7bde1f83dcaf13d85872f
parentea9da1c79eb9a28176550d0b8ba9166e6e5f42b8 (diff)
UAS: Use unique tags on non-streams devices.
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>
-rw-r--r--drivers/usb/storage/uas.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 4bbaf6e150e4..28d9b1909389 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -343,7 +343,10 @@ static struct urb *uas_alloc_cmd_urb(struct uas_dev_info *devinfo, gfp_t gfp,
343 goto free; 343 goto free;
344 344
345 iu->iu_id = IU_ID_COMMAND; 345 iu->iu_id = IU_ID_COMMAND;
346 iu->tag = cpu_to_be16(stream_id); 346 if (blk_rq_tagged(cmnd->request))
347 iu->tag = cpu_to_be16(cmnd->request->tag + 1);
348 else
349 iu->tag = cpu_to_be16(1);
347 iu->prio_attr = UAS_SIMPLE_TAG; 350 iu->prio_attr = UAS_SIMPLE_TAG;
348 iu->len = len; 351 iu->len = len;
349 int_to_scsilun(sdev->lun, &iu->lun); 352 int_to_scsilun(sdev->lun, &iu->lun);