[9020] in linux-scsi channel archive
RE: direction table?
daemon@ATHENA.MIT.EDU (Ralston, Steve)
Mon Jun 19 20:02:12 2000
Message-Id: <B2B3C90E45AED111B7B40001FA7E520A03834282@exw-kansas.ks.lsil.com>
From: "Ralston, Steve" <sralston@lsil.com>
To: "'Matthew Dharm'" <mdharm-scsi@one-eyed-alien.net>,
Linux SCSI list <linux-scsi@vger.rutgers.edu>
Date: Mon, 19 Jun 2000 15:32:21 -0500
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----_=_NextPart_000_01BFDA2D.78DA63A8"
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01BFDA2D.78DA63A8
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01BFDA2D.78DA63A8"
------_=_NextPart_001_01BFDA2D.78DA63A8
Content-Type: text/plain
I believe the scsi mid-layer reliably sets the direction in all modern
kernels
(thanks to Alan Cox and others!:-) But just in case;-)
my meager attempt:
{attach: scsi_dir.c: <<scsi_dir.c>> }
Thanks,
-SteveR
> -----Original Message-----
> From: Matthew Dharm [SMTP:mdharm-scsi@one-eyed-alien.net]
> Sent: Monday, June 19, 2000 12:46 PM
> To: Linux SCSI list
> Subject: direction table?
>
> A while back, there seemed to be a general agreement that the mechanism
> for
> determining the setting of the direction flag needed an overhaul. If my
> memory serves, the general consensus seemed to be that either (a) the
> mid-layer should have a direction table for all commands, or (b) there
> were
> some inferrence rules which could be used to derive the information.
>
> This change was only needed for the scsi-generic interface, as userspace
> programs (i.e. cdrecord, cdparanoia, etc) wound up causing Scsi_Cmnd
> structures with a direction of UNKNOWN to be sent to the HBAs -- this
> causes problems with the USB SCSI emulation.
>
> My question is this: Has anyone managed to implement this?
>
> Matt Dharm
>
> --
> Matthew Dharm Home: mdharm@one-eyed-alien.net
>
> Senior Engineer, QCP Inc. Work: mdharm@qcpi.com
>
> What the hell are you?
> -- Pitr to Dust Puppy
> User Friendly, 12/3/1997
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.rutgers.edu
------_=_NextPart_001_01BFDA2D.78DA63A8
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DUS-ASCII">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>RE: direction table?</TITLE>
</HEAD>
<BODY>
<P><FONT COLOR=3D"#800000" SIZE=3D2 FACE=3D"Arial">I believe the scsi =
mid-layer reliably sets the direction in all modern kernels</FONT>
<BR><FONT COLOR=3D"#800000" SIZE=3D2 FACE=3D"Arial">(thanks to Alan Cox =
and others!:-) But just in case;-)</FONT>
<BR><FONT COLOR=3D"#800000" SIZE=3D2 FACE=3D"Arial">my meager =
attempt:</FONT>
<BR><FONT COLOR=3D"#800000" SIZE=3D2 FACE=3D"Arial"> {attach: =
scsi_dir.c:<FONT FACE=3D"Arial" SIZE=3D2 COLOR=3D"#000000"> =
<<scsi_dir.c>> </FONT>}</FONT>
</P>
<P><FONT COLOR=3D"#800000" SIZE=3D2 FACE=3D"Arial">Thanks,</FONT>
<BR><FONT COLOR=3D"#800000" SIZE=3D2 FACE=3D"Arial">-SteveR</FONT>
</P>
<P><FONT SIZE=3D1 FACE=3D"Arial">-----Original Message-----</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"Arial">From: </FONT></B> <FONT =
SIZE=3D1 FACE=3D"Arial">Matthew Dharm =
[SMTP:mdharm-scsi@one-eyed-alien.net]</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"Arial">Sent: </FONT></B> <FONT =
SIZE=3D1 FACE=3D"Arial">Monday, June 19, 2000 12:46 PM</FONT>
<BR><B><FONT SIZE=3D1 =
FACE=3D"Arial">To: </FONT></B> <FONT SIZE=3D1 =
FACE=3D"Arial">Linux SCSI list</FONT>
<BR><B><FONT SIZE=3D1 =
FACE=3D"Arial">Subject: </FONT>=
</B> <FONT SIZE=3D1 FACE=3D"Arial">direction table?</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">A while back, there seemed to be a =
general agreement that the mechanism for</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">determining the setting of the =
direction flag needed an overhaul. If my</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">memory serves, the general consensus =
seemed to be that either (a) the</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">mid-layer should have a direction =
table for all commands, or (b) there were</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">some inferrence rules which could be =
used to derive the information.</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">This change was only needed for the =
scsi-generic interface, as userspace</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">programs (i.e. cdrecord, cdparanoia, =
etc) wound up causing Scsi_Cmnd</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">structures with a direction of =
UNKNOWN to be sent to the HBAs -- this</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">causes problems with the USB SCSI =
emulation.</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">My question is this: Has anyone =
managed to implement this?</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Matt Dharm</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">-- </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Matthew =
Dharm &=
nbsp; &=
nbsp; Home: mdharm@one-eyed-alien.net =
</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Senior Engineer, QCP =
Inc. &n=
bsp; &n=
bsp; Work: mdharm@qcpi.com</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">What the hell are you?</FONT>
<BR> =
=
=
=
<FONT SIZE=3D2 =
FACE=3D"Arial">-- Pitr to Dust Puppy </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">User Friendly, 12/3/1997</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">-</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">To unsubscribe from this list: send =
the line "unsubscribe linux-scsi" in</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">the body of a message to =
majordomo@vger.rutgers.edu</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01BFDA2D.78DA63A8--
------_=_NextPart_000_01BFDA2D.78DA63A8
Content-Type: application/octet-stream;
name="scsi_dir.c"
Content-Disposition: attachment;
filename="scsi_dir.c"
/* 19991030 -sralston
* Return absolute SCSI data direction:
* 1 = _DATA_OUT
* 0 = _DIR_NONE
* -1 = _DATA_IN
*/
int
scsi_dir(Scsi_Cmnd *cmd)
{
switch (cmd->cmnd[0]) {
/* _DATA_OUT commands */
case WRITE_6: case WRITE_10: case WRITE_12:
case WRITE_LONG: case WRITE_SAME: case WRITE_BUFFER:
case WRITE_VERIFY: case WRITE_VERIFY_12:
case COMPARE: case COPY: case COPY_VERIFY:
case SEARCH_EQUAL: case SEARCH_HIGH: case SEARCH_LOW:
case SEARCH_EQUAL_12: case SEARCH_HIGH_12: case SEARCH_LOW_12:
case MODE_SELECT: case MODE_SELECT_10: case LOG_SELECT:
case SEND_DIAGNOSTIC: case CHANGE_DEFINITION: case UPDATE_BLOCK:
case SET_WINDOW: case MEDIUM_SCAN: case SEND_VOLUME_TAG:
case REASSIGN_BLOCKS:
case PERSISTENT_RESERVE_OUT:
case 0xea:
return 1;
/* No data transfer commands */
case SEEK_6: case SEEK_10:
case RESERVE: case RELEASE:
case TEST_UNIT_READY:
case START_STOP:
case ALLOW_MEDIUM_REMOVAL:
return 0;
/* Conditional data transfer commands */
case FORMAT_UNIT:
if (cmd->cmnd[1] & 0x10) // FmtData (data out phase)?
return 1;
else
return 0;
case VERIFY:
if (cmd->cmnd[1] & 0x02) // VERIFY:BYTCHK (data out phase)?
return 1;
else
return 0;
case RESERVE_10:
if (cmd->cmnd[1] & 0x03) // RESERSE:{LongID|Extent} (data out phase)?
return 1;
else
return 0;
/* ??
case REZERO_UNIT: // (or REWIND)
case SPACE:
case ERASE: case ERASE_10:
case SYNCHRONIZE_CACHE:
case LOCK_UNLOCK_CACHE:
*/
/* Must be data _IN! */
default:
return -1;
}
}
------_=_NextPart_000_01BFDA2D.78DA63A8--
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu