On Fri, Dec 09, 2011 at 10:08:15AM +0100, Sebastian Andrzej Siewior wrote: > * Sarah Sharp | 2011-12-02 11:55:46 [-0800]: > > >index 4bbaf6e..28d9b19 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, > > 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); > > For that 0 you make no difference between the untagged command the > tagged command with tag 0. The host seems to send the first two commands > untagged and then use tagging so it should make no difference. Yeah, I noticed that too. As you said, it's probably harmless, although it wouldn't be too hard to fix. The UAS driver does at least stop multiple untagged commands from being in flight at once. > However, > what about: > > diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c > index 680bea9..9310640 100644 > --- a/drivers/usb/storage/uas.c > +++ b/drivers/usb/storage/uas.c > @@ -232,11 +232,8 @@ static void uas_stat_cmplt(struct urb *urb) > return; > } > > - tag = be16_to_cpup(&iu->tag) - 1; > - if (sdev->current_cmnd) > - cmnd = sdev->current_cmnd; > - else > - cmnd = scsi_find_tag(sdev, tag); > + tag = be16_to_cpup(&iu->tag); > + cmnd = scsi_find_tag(sdev, tag == 0 ? SCSI_NO_TAG : tag - 1); > if (!cmnd) > return; > > @@ -334,7 +331,11 @@ 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(0); > + > iu->prio_attr = UAS_SIMPLE_TAG; > iu->len = len; > > So you reserve tag 0 for the untagged commands and have the remaining > numbers are available. I don't think we can use tag 0 in the SCSI commands. That will cause USB 3.0 devices that have been set up for streams to attempt to request the data and status phases on stream ID 0 when they get an untagged command, right? Stream ID 0 is a reserved stream ID, and the xHCI driver doesn't allow any URBs to be queued to it. We could certainly reserve tag 1 for untagged SCSI commands though. That would mean we'd have to set the stream ID to tag + 2, and set the qdepth down one more place. Sarah Sharp -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html