[7188] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: Fixing SCSI Layer

daemon@ATHENA.MIT.EDU (Gerard Roudier)
Wed Sep 8 15:18:15 1999

Date:   Wed, 8 Sep 1999 21:35:25 +0200 (MET DST)
From:   Gerard Roudier <groudier@club-internet.fr>
To:     Mark Veteikis <mark@iphase.com>
cc:     linux-scsi@vger.rutgers.edu
In-Reply-To: <199909081532.KAA11178@sw10.iphase.com>



On Wed, 8 Sep 1999, Mark Veteikis wrote:

> Small suggestion on cleanup:
> 
> I noticed that most busmastering drivers duplicate the logic which determines 
> the direction of the data phase. (data out or in).
> 
> Each lowlevel driver parses the command descriptor block in their own unique 
> way to gain this information. It would be helpful if it was passed in the 
> Scsi_Cmnd structure by the mid-layer code. Quite a bit of duplicate code in the 
> lowlevel drivers could be removed by adding this. I also noticed that lots of
> the low-level drivers don't fully decode all the possible SCSI opcodes
> properly to determine the direction, potential future bugs can be avoided
> by doing this correctly.

The actual data direction cannot be guessed from the opcode. It depends
also on the device type and some commands may just be vendor-specific.
The transfer direction must be supplied by the part that supplies the 
IO request.

This flaw in Linux-SCSI requires driver to be able to handle any transfer
direction required by a device for a command. Usually, the direction is 
enforced only for common opcodes as READ*/WRITE* and friends. For non
usual commands the driver/controller pair must wait the first data phase 
asked by the device to know about the transfer direction.

Gérard.


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post