Subject: Re: a couple of proposed patches fo SCSI midlayer
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Matthew Jacob <mjacob@feral.com>
List: tech-kern
Date: 03/20/2002 13:34:21
On Wed, 20 Mar 2002, Manuel Bouyer wrote:

> On Tue, Mar 19, 2002 at 07:24:27PM -0800, Matthew Jacob wrote:
> > 
> > Problem I'm trying to solve:
> > 
> >   I want to have commands completing XS_SELTIMEMOUT be retried like
> >   XS_TIMEOUT. That is- I want the retry count in the command to be
> >   honoured.
> > 
> > This turned out to be a tad more then just changing scsipi_complete to
> > have XS_SELTIMEOUT have the same case as XS_TIMEOUT.
> > 
> > What you need to do is to make sure that *probing* doesn't take forever.
> > 
> > So- what I did was to make sure that we don't retry the TEST UNIT READY
> > that's done as part of device discovery. Ditto for INQUIRY.
> 
> I don't really like the idea of doing this based on commands.
> I think a better test would be to see whenever the device is already
> attached or not (if it attached it's that it was present at one time).
> scsipi_lookup_periph() be used for this.
> 
> Also I wouldn't do it by setting retries to 0, because xs->xs_retries
> is used for other failure cases than XS_TIMEOUT. I would do this in 
> scsipi_complete() for the XS_SELTIMEOUT/XS_TIMEOUT case:
> 	case XS_SELTIMEOUT
> 	case XS_TIMEOUT
> 		if (scsipi_lookup_periph(chan, periph->periph_target,
> 		    periph->periph_lun) && xs->xs_retries != 0) {
> 			xs->xs_retries--;
> 			error = ERESTART;
> 		} else
> 			error = EIO;
> 

Hmm. I kind of like this, although the periph lookup should probably only
apply to XS_SELTIMEOUT. I'll do some rewhacking this way and send that out in
a bit.

> > 
> > Additionally, and this area still needs some more work particularly as we want
> > to add (soon) things like REPORT LUNS here so we can ask a device how many of
> > a possible 65535 luns it actually supports, the loop where we're evaluating a
> > bus should:
> > 
> > 	+ If we're probing a whole bus, and this is lun 0, and things
> > 	  fail to probe, we shouldn't just continue probing (a working
> > 	  lun 0 is a *requirement*, IIRC, for the SAM-2 specs).
> > 
> > 	+ We should only set xfer mode if we actually ever found anything
> 
> This looks good.
> 
> -- 
> Manuel Bouyer <bouyer@antioche.eu.org>
> --
>