From 64bdcbc449105377dd60c8da97cfc1663b39562c Mon Sep 17 00:00:00 2001 From: "Kashyap.Desai@avagotech.com" Date: Wed, 20 Aug 2014 19:24:33 +0530 Subject: scsi: add use_cmd_list flag Add a use_cmd_list flag in struct Scsi_Host to request keeping track of all outstanding commands per device. Default behaviour is not to keep track of cmd_list per sdev, as this may introduce lock contention. (overhead is more on multi-node NUMA.), and only enable it on the two drivers that need it. Signed-off-by: Kashyap Desai Reviewed-by: Martin K. Petersen Reviewed-by: Bart Van Assche Signed-off-by: Christoph Hellwig --- include/scsi/scsi_host.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/scsi/scsi_host.h') diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index ba2034779961..cafb260ef2d3 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -680,6 +680,7 @@ struct Scsi_Host { unsigned no_write_same:1; unsigned use_blk_mq:1; + unsigned use_cmd_list:1; /* * Optional work queue to be utilized by the transport -- cgit v1.2.3 From 50c4e96411a6cd728f04cf70d8d6def57828b320 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Tue, 2 Sep 2014 11:35:50 -0400 Subject: scsi: don't store LUN bits in CDB[1] for USB mass-storage devices The SCSI specification requires that the second Command Data Byte should contain the LUN value in its high-order bits if the recipient device reports SCSI level 2 or below. Nevertheless, some USB mass-storage devices use those bits for other purposes in vendor-specific commands. Currently Linux has no way to send such commands, because the SCSI stack always overwrites the LUN bits. Testing shows that Windows 7 and XP do not store the LUN bits in the CDB when sending commands to a USB device. This doesn't matter if the device uses the Bulk-Only or UAS transports (which virtually all modern USB mass-storage devices do), as these have a separate mechanism for sending the LUN value. Therefore this patch introduces a flag in the Scsi_Host structure to inform the SCSI midlayer that a transport does not require the LUN bits to be stored in the CDB, and it makes usb-storage set this flag for all devices using the Bulk-Only transport. (UAS is handled by a separate driver, but it doesn't really matter because no SCSI-2 or lower device is at all likely to use UAS.) The patch also cleans up the code responsible for storing the LUN value by adding a bitflag to the scsi_device structure. The test for whether to stick the LUN value in the CDB can be made when the device is probed, and stored for future use rather than being made over and over in the fast path. Signed-off-by: Alan Stern Reported-by: Tiziano Bacocco Acked-by: Martin K. Petersen Acked-by: James Bottomley Signed-off-by: Christoph Hellwig --- include/scsi/scsi_host.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/scsi/scsi_host.h') diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index cafb260ef2d3..d0f69a3210df 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -693,6 +693,9 @@ struct Scsi_Host { */ struct workqueue_struct *tmf_work_q; + /* The transport requires the LUN bits NOT to be stored in CDB[1] */ + unsigned no_scsi2_lun_in_cdb:1; + /* * Value host_blocked counts down from */ -- cgit v1.2.3 From 8e4a5da69c39788fabc9e7cf178eb62b6077c96b Mon Sep 17 00:00:00 2001 From: Sebastian Herbszt Date: Sat, 20 Sep 2014 13:37:55 +0200 Subject: scsi: fix comment in struct Scsi_Host definition Commit 1abf635 (scsi: use 64-bit value for 'max_luns') changed the order of Scsi_Host members. Update the comment to reflect this. Signed-off-by: Sebastian Herbszt Reviewed-by: Bart Van Assche Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig --- include/scsi/scsi_host.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/scsi/scsi_host.h') diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index d0f69a3210df..5e362489ee88 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -606,7 +606,7 @@ struct Scsi_Host { /* * These three parameters can be used to allow for wide scsi, * and for host adapters that support multiple busses - * The first two should be set to 1 more than the actual max id + * The last two should be set to 1 more than the actual max id * or lun (e.g. 8 for SCSI parallel systems). */ unsigned int max_channel; -- cgit v1.2.3