public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: linux-scsi@vger.kernel.org, promise_linux@promise.com, akpm@osdl.org
Subject: Re: [PATCH] Add Promise SuperTrak EX 'stex' driver
Date: Tue, 08 Aug 2006 11:11:19 -0500	[thread overview]
Message-ID: <1155053479.26517.20.camel@mulgrave.il.steeleye.com> (raw)
In-Reply-To: <20060808120507.GA20032@havoc.gtf.org>

On Tue, 2006-08-08 at 08:05 -0400, Jeff Garzik wrote:
> Adds the 'stex' driver for Promise SuperTrak EX storage controllers.
> These controllers present themselves as SCSI, though like 3ware,
> megaraid and others, the underlying storage may or may not be SCSI.
> 
> As discussed, the block tagging stuff is a post-merge todo item.

That's not exactly my recollection of the discussion:  I thought we were
still discussing the chicken and egg issue (which is we have APIs to do
this per host tagging which stex duplicates on the grounds no-one's
using the current APIs).  Jens and I seem to be in agreement that stex
should try the API's and well make any changes that become necessary to
block or SCSI happen.


> +	switch (cmd->cmnd[0]) {
> +	case MODE_SENSE_10:
> +	{
> +		static char mode_sense10[8] = { 0, 6, 0, 0, 0, 0, 0, 0 };
> +
> +		stex_direct_copy(cmd, mode_sense10, sizeof(mode_sense10));
> +		cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
> +		done(cmd);
> +		return 0;
> +	}

This looks like it will trick the sd driver into reading uninitialised
data for the drive caching parameters ... there are obviously faults on
both sides, but I think when you ask for a mode page and you get a
success return, you're entitled to think you got it ...


> +	case INQUIRY:
> +		if (id != ST_MAX_ARRAY_SUPPORTED)
> +			break;
> +		if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) {
> +			stex_direct_copy(cmd, console_inq_page,
> +				sizeof(console_inq_page));
> +			cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
> +		} else
> +			cmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8;
> +		done(cmd);

The error return isn't correct you should never use DID_ERROR for an
uncorrectable error because it will cause a retry (which you'll fail
again).  For an unsupported inquiry the correct return should be Check
Condition/Illegal Request/Invalid Field in CDB

> +	case INQUIRY:
> +		if (id != ST_MAX_ARRAY_SUPPORTED)
> +			break;
> +		if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) {
> +			stex_direct_copy(cmd, console_inq_page,
> +				sizeof(console_inq_page));
> +			cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
> +		} else
> +			cmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8;
> +		done(cmd);

The error return here looks like it shouldn't be DID_ERROR either.  I
assume the error is a format one and uncorrectable by a retry?

> +	}
> +
> +	hba->dma_mem = pci_alloc_consistent(pdev,
> +		STEX_BUFFER_SIZE, &hba->dma_handle);
> +	if (!hba->dma_mem) {
> +		err = -ENOMEM;
> +		printk(KERN_ERR DRV_NAME "(%s): dma mem alloc failed\n",
> +			pci_name(pdev));
> +		goto out_iounmap;
> +	}

This should be dma_alloc_coherent, not pci_alloc_consistent.

James



  reply	other threads:[~2006-08-08 16:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-08 12:05 [PATCH] Add Promise SuperTrak EX 'stex' driver Jeff Garzik
2006-08-08 16:11 ` James Bottomley [this message]
2006-08-08 18:09   ` James Bottomley
2006-08-08 22:55   ` Jeff Garzik
2006-08-08 23:26     ` James Bottomley
2006-08-09  1:37       ` Jeff Garzik
     [not found] <NONAMEBxe2jl8n4bRNe0000069a@nonameb.ptu.promise.com>
2006-08-09 14:18 ` James Bottomley

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=1155053479.26517.20.camel@mulgrave.il.steeleye.com \
    --to=james.bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=jeff@garzik.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=promise_linux@promise.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox