All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian King <brking@us.ibm.com>
To: Brian King <brking@us.ibm.com>
Cc: James.Bottomley@steeleye.com, linux-scsi@vger.kernel.org,
	jgarzik@pobox.com, linux-ide@vger.kernel.org
Subject: Re: [PATCH 1/2] scsi: Add scsi_device max_cmd_len (resend)
Date: Fri, 28 Apr 2006 09:28:02 -0500	[thread overview]
Message-ID: <44522672.5010607@us.ibm.com> (raw)
In-Reply-To: <200604172240.k3HMes2V010154@d01av01.pok.ibm.com>

James,

Any comments on the patch below?

Thanks

Brian

Brian King wrote:
> 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);
> _


-- 
Brian King
eServer Storage I/O
IBM Linux Technology Center

  parent reply	other threads:[~2006-04-28 14:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Brian King [this message]
2006-04-28 15:17   ` [PATCH 1/2] scsi: Add " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44522672.5010607@us.ibm.com \
    --to=brking@us.ibm.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.