All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Brian King <brking@us.ibm.com>
Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 5/6] libata: Per device max command length checking
Date: Sun, 11 Jun 2006 23:29:03 -0400	[thread overview]
Message-ID: <448CDF7F.2090609@pobox.com> (raw)
In-Reply-To: <200606071625.k57GPxAB009587@d01av03.pok.ibm.com>

Brian King wrote:
> Currently, libata sets the scsi_host's max_cmd_len to
> be the minimum of the max command lengths of all devices
> attached to the same ATA port. This patch moves this checking
> into libata so libata can check this on a per device
> basis and still allows an ATA host to implement its
> own host limit.
> 
> Signed-off-by: Brian King <brking@us.ibm.com>
> ---
> 
>  libata-dev-bjking1/drivers/scsi/libata-core.c |    8 +-------
>  libata-dev-bjking1/drivers/scsi/libata-scsi.c |    6 ++++++
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff -puN drivers/scsi/libata-core.c~libata_max_cmd_len drivers/scsi/libata-core.c
> --- libata-dev/drivers/scsi/libata-core.c~libata_max_cmd_len	2006-06-07 10:54:09.000000000 -0500
> +++ libata-dev-bjking1/drivers/scsi/libata-core.c	2006-06-07 10:54:09.000000000 -0500
> @@ -1415,12 +1415,6 @@ static int ata_dev_configure(struct ata_
>  				       cdb_intr_string);
>  	}
>  
> -	ap->host->max_cmd_len = 0;
> -	for (i = 0; i < ATA_MAX_DEVICES; i++)
> -		ap->host->max_cmd_len = max_t(unsigned int,
> -					      ap->host->max_cmd_len,
> -					      ap->device[i].cdb_len);
> -
>  	/* limit bridge transfers to udma5, 200 sectors */
>  	if (ata_dev_knobble(dev)) {
>  		if (print_info)
> @@ -5166,7 +5160,7 @@ static void ata_host_init(struct ata_por
>  	host->max_lun = 1;
>  	host->max_channel = 1;
>  	host->unique_id = ata_unique_id++;
> -	host->max_cmd_len = 12;
> +	host->max_cmd_len = ATAPI_CDB_LEN;
>  
>  	ap->lock = &host_set->lock;
>  	ap->flags = ATA_FLAG_DISABLED;
> diff -puN drivers/scsi/libata-scsi.c~libata_max_cmd_len drivers/scsi/libata-scsi.c
> --- libata-dev/drivers/scsi/libata-scsi.c~libata_max_cmd_len	2006-06-07 10:54:09.000000000 -0500
> +++ libata-dev-bjking1/drivers/scsi/libata-scsi.c	2006-06-07 10:54:09.000000000 -0500
> @@ -2607,6 +2607,12 @@ static inline int __ata_scsi_queuecmd(st
>  {
>  	int rc = 0;
>  
> +	if (unlikely(cmd->cmd_len > dev->cdb_len)) {
> +		cmd->result = (DID_ABORT << 16);
> +		done(cmd);
> +		return 0;
> +	}

:(  do we really need to be adding this to the hot path, for such an 
unlikely case?

Further, I wonder why this matters?  Doesn't ipr present devices as one 
per port?

	Jeff




  reply	other threads:[~2006-06-12  3:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-07 16:25 [PATCH 5/6] libata: Per device max command length checking Brian King
2006-06-12  3:29 ` Jeff Garzik [this message]
2006-06-12 18:22   ` 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=448CDF7F.2090609@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=brking@us.ibm.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.