linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] scsi: Add scsi_device max_cmd_len (resend)
@ 2006-04-17 22:40 Brian King
  2006-04-17 22:48 ` [PATCH 2/2] libata: Use " Brian King
  2006-04-28 14:28 ` [PATCH 1/2] scsi: Add " Brian King
  0 siblings, 2 replies; 18+ messages in thread
From: Brian King @ 2006-04-17 22:40 UTC (permalink / raw)
  To: James.Bottomley; +Cc: linux-scsi, jgarzik, linux-ide, brking


Add a max_cmd_len field to the scsi_device struct
to allow for per device limits of allowable command
lengths. This patch was submitted earlier and resulted
in a bit of discussion regarding whether or not
CDB length is a limitation of the host or the device.
For ATA, both the host and the device can limit the
CDB length. Currently libata reads the IDENTIFY
PACKET DEVICE data for an ATAPI device and sets
the max_cmd_len in the scsi host for the maximum
supported CDB length of all ATA/ATAPI devices attached
to the same scsi host. This patch allows libata to
set the max CDB length on a per device basis and
allows the SAS/SATA HBA to set its own max command
length in the scsi host template.

Signed-off-by: Brian King <brking@us.ibm.com>
---

 libata-dev-bjking1/drivers/scsi/scsi.c        |    3 ++-
 libata-dev-bjking1/drivers/scsi/scsi_scan.c   |    1 +
 libata-dev-bjking1/include/scsi/scsi_device.h |    1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff -puN include/scsi/scsi_device.h~scsi_device_cdb_len include/scsi/scsi_device.h
--- libata-dev/include/scsi/scsi_device.h~scsi_device_cdb_len	2006-04-17 17:17:50.000000000 -0500
+++ libata-dev-bjking1/include/scsi/scsi_device.h	2006-04-17 17:17:50.000000000 -0500
@@ -72,6 +72,7 @@ struct scsi_device {
 	unsigned int manufacturer;	/* Manufacturer of device, for using 
 					 * vendor-specific cmd's */
 	unsigned sector_size;	/* size in bytes */
+	unsigned char max_cmd_len;
 
 	void *hostdata;		/* available to low-level driver */
 	char type;
diff -puN drivers/scsi/scsi_scan.c~scsi_device_cdb_len drivers/scsi/scsi_scan.c
--- libata-dev/drivers/scsi/scsi_scan.c~scsi_device_cdb_len	2006-04-17 17:17:50.000000000 -0500
+++ libata-dev-bjking1/drivers/scsi/scsi_scan.c	2006-04-17 17:17:50.000000000 -0500
@@ -218,6 +218,7 @@ static struct scsi_device *scsi_alloc_sd
 	sdev->lun = lun;
 	sdev->channel = starget->channel;
 	sdev->sdev_state = SDEV_CREATED;
+	sdev->max_cmd_len = MAX_COMMAND_SIZE;
 	INIT_LIST_HEAD(&sdev->siblings);
 	INIT_LIST_HEAD(&sdev->same_target_siblings);
 	INIT_LIST_HEAD(&sdev->cmd_list);
diff -puN drivers/scsi/scsi.c~scsi_device_cdb_len drivers/scsi/scsi.c
--- libata-dev/drivers/scsi/scsi.c~scsi_device_cdb_len	2006-04-17 17:17:50.000000000 -0500
+++ libata-dev-bjking1/drivers/scsi/scsi.c	2006-04-17 17:17:50.000000000 -0500
@@ -610,7 +610,8 @@ int scsi_dispatch_cmd(struct scsi_cmnd *
 	 * Before we queue this command, check if the command
 	 * length exceeds what the host adapter can handle.
 	 */
-	if (CDB_SIZE(cmd) > cmd->device->host->max_cmd_len) {
+	if (CDB_SIZE(cmd) > cmd->device->host->max_cmd_len ||
+	    CDB_SIZE(cmd) > cmd->device->max_cmd_len) {
 		SCSI_LOG_MLQUEUE(3,
 				printk("queuecommand : command too long.\n"));
 		cmd->result = (DID_ABORT << 16);
_

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2006-04-28 21:54 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-17 22:40 [PATCH 1/2] scsi: Add scsi_device max_cmd_len (resend) Brian King
2006-04-17 22:48 ` [PATCH 2/2] libata: Use " Brian King
2006-04-17 22:52   ` Jeff Garzik
2006-04-18 14:01     ` Brian King
2006-04-28 14:28 ` [PATCH 1/2] scsi: Add " Brian King
2006-04-28 15:17   ` James Bottomley
2006-04-28 17:47     ` Luben Tuikov
2006-04-28 18:19     ` Brian King
2006-04-28 18:30       ` James Bottomley
2006-04-28 19:03         ` Brian King
2006-04-28 20:56           ` James Bottomley
2006-04-28 21:11             ` Brian King
2006-04-28 21:21               ` James Bottomley
2006-04-28 21:32               ` Jeff Garzik
2006-04-28 21:43                 ` Brian King
2006-04-28 21:54                 ` James Bottomley
2006-04-28 17:28   ` Luben Tuikov
2006-04-28 18:16     ` Brian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).