public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Is scsi_cmnd::underflow still useful?
@ 2004-07-12 19:40 Douglas Gilbert
  2004-07-13  0:55 ` James Bottomley
  0 siblings, 1 reply; 4+ messages in thread
From: Douglas Gilbert @ 2004-07-12 19:40 UTC (permalink / raw)
  To: linux-scsi; +Cc: bunk

Doesn't look like many LLDs act on scsi_cmnd::underflow.
Seems to me that scsi_cmnd::resid is a more general
replacement.

Comments?

Doug Gilbert


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

* Re: Is scsi_cmnd::underflow still useful?
  2004-07-12 19:40 Is scsi_cmnd::underflow still useful? Douglas Gilbert
@ 2004-07-13  0:55 ` James Bottomley
  2004-07-13  5:09   ` Matthew Dharm
  2004-07-13 22:09   ` Douglas Gilbert
  0 siblings, 2 replies; 4+ messages in thread
From: James Bottomley @ 2004-07-13  0:55 UTC (permalink / raw)
  To: Douglas Gilbert; +Cc: SCSI Mailing List, bunk

On Mon, 2004-07-12 at 14:40, Douglas Gilbert wrote:
> Doesn't look like many LLDs act on scsi_cmnd::underflow.
> Seems to me that scsi_cmnd::resid is a more general
> replacement.

well, I know I suggested a recent use of it to the USB people , so I
don't think it's entirely unused.  resid can't be a replacement because
they mean different things:

resid - number of bytes left over after a transaction
underflow - driver must return error if less than this amount
transferred.

James



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

* Re: Is scsi_cmnd::underflow still useful?
  2004-07-13  0:55 ` James Bottomley
@ 2004-07-13  5:09   ` Matthew Dharm
  2004-07-13 22:09   ` Douglas Gilbert
  1 sibling, 0 replies; 4+ messages in thread
From: Matthew Dharm @ 2004-07-13  5:09 UTC (permalink / raw)
  To: James Bottomley; +Cc: Douglas Gilbert, SCSI Mailing List, bunk

[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]

On Mon, Jul 12, 2004 at 07:55:13PM -0500, James Bottomley wrote:
> On Mon, 2004-07-12 at 14:40, Douglas Gilbert wrote:
> > Doesn't look like many LLDs act on scsi_cmnd::underflow.
> > Seems to me that scsi_cmnd::resid is a more general
> > replacement.
> 
> well, I know I suggested a recent use of it to the USB people , so I
> don't think it's entirely unused.  resid can't be a replacement because
> they mean different things:
> 
> resid - number of bytes left over after a transaction
> underflow - driver must return error if less than this amount
> transferred.

I think the recent USB usage of it was because some mid-level drivers look
for the error condition related to the underflow value.

We don't really use it, other than to trigger an error.

Matt

-- 
Matthew Dharm                              Home: mdharm-usb@one-eyed-alien.net 
Maintainer, Linux USB Mass Storage Driver

Stef, you just got beaten by a ball of DIRT.
					-- Greg
User Friendly, 12/7/1997

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Is scsi_cmnd::underflow still useful?
  2004-07-13  0:55 ` James Bottomley
  2004-07-13  5:09   ` Matthew Dharm
@ 2004-07-13 22:09   ` Douglas Gilbert
  1 sibling, 0 replies; 4+ messages in thread
From: Douglas Gilbert @ 2004-07-13 22:09 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI Mailing List, bunk

James Bottomley wrote:
> On Mon, 2004-07-12 at 14:40, Douglas Gilbert wrote:
> 
>>Doesn't look like many LLDs act on scsi_cmnd::underflow.
>>Seems to me that scsi_cmnd::resid is a more general
>>replacement.
> 
> 
> well, I know I suggested a recent use of it to the USB people , so I
> don't think it's entirely unused.  resid can't be a replacement because
> they mean different things:
> 
> resid - number of bytes left over after a transaction
> underflow - driver must return error if less than this amount
> transferred.

James,
Here is a code snippet from one of the few LLDs that acts on
scsi_cmnd::underflow: qla2xxx/qla_isr.c . It shows
the relationship between request_buflen, resid and underflow:

    if ((unsigned)(cp->request_bufflen - resid) <
                   cp->underflow) {
        qla_printk(KERN_INFO, ha,
                   "scsi(%ld:%d:%d:%d): Mid-layer underflow "
                   "detected (%x of %x bytes)...returning "
                   "error status.\n",
                   ha->host_no, b, t, l, resid,
                   cp->request_bufflen);
                   cp->result = DID_ERROR << 16;
                   break;
     }

Rather than ask the LLD report an error (and leave the upper
layers wondering if any data was sent or received) wouldn't
it be better to allow the issuer of the scsi_cmnd object to
decide whether the response was deficient (based on resid)?

I am responsible for resid being added (in the lk 2.3 series)
at the prompting of Joerg Schilling. The scsi_cmnd::underflow
parameter was not of use to him, even if I exposed it to
applications via sg_io_hdr. resid is a "steal" from CAM and
the only complaints I have received about it are concerning
LLDs that do _not_ implement it.

Doug Gilbert

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

end of thread, other threads:[~2004-07-13 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-12 19:40 Is scsi_cmnd::underflow still useful? Douglas Gilbert
2004-07-13  0:55 ` James Bottomley
2004-07-13  5:09   ` Matthew Dharm
2004-07-13 22:09   ` Douglas Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox