Re: [RFC 2/9] UAS: Use unique tags on non-streams devices.

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

 



* 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. 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.

Sebastian
--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux