As foreshadowed in a previous posting to this group, some
changes have been made to the SCSI mid level command structure
[struct scsi_cmnd] in 2.3.19
  - the sense_buffer array has been increased from 16 to 64 bytes
  - a new int member called "resid" has been added.

The "resid" member is for the residual DMA count from data 
transfers. It is initialized to 0 and is set currently by no
adapter drivers [hint]. It is defined (as per CAM) as the
requested data transfer length less the number of bytes
actually transferred. In practice, it should be used to indicate
underrun (which will yield a positive number). [Hopefully
overrun never occurs.]

Since the days of SCSI 2, the sense buffer of 16 bytes has
been too short (SCSI 2 requires 18 bytes). To cope with
SCSI 3 statuses it has been increased to 64 bytes. Surprisingly
this seems to cause little pain, but here are some known
problems:
  - the sg driver in 2.3.19 (sg version # 2.1.34) is broken
    due to this change. I got a fixed version into the
    2.3.18ac series but for some reason it didn't make it
    into 2.3.19 . This can be fixed by getting a driver from
    the sg website (see below)
  - the SCSI_IOCTL_SEND_COMMAND now will write back a 64
    sense buffer when a SCSI error occurs, potentially
    upsetting apps that allocated space for 16 bytes. I will
    submit a patch to truncate that.

The rationale for the above changes is to provide more
information to applications based on sg. As an additional
benefit, the other high level SCSI drivers may be able to
use the information as well. 

Sg's much maligned interface based on the sg_header structure
is not capable of holding the extra information provided by 
these changes. So to cope with this and direct IO, a new 
interface has been added. It is discussed at:
http://www.torque.net/sg  [follow interface link]
An alpha version, test code and some documentation are
currently available. That alpha version will work on
2.3.19 (and the 2.2 series). There is also a less radical
sg driver to fix the problem in 2.3.19 .

Doug Gilbert

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]

Reply via email to