cam_resid calculation

Gerard Roudier groudier at
Sun Jul 4 10:17:22 PDT 1999

* From the T10 Reflector (t10 at, posted by:
* Gerard Roudier <groudier at>

The CAM/CAM3 specifications seem to require SIMs to provide the residual=20
count of an SCSI IO at completion.

In usual situations, the calculation of this residual seems possible
without too much complexity. But, in situations of a device using MODIFY
DATA POINTER messages, such a calculation may get more complex. And if=20
the residual applies to data that are not at the end of the buffer, this =20
information may lose any relevance for the application client.

My understanding of SPI is that the device may save, restore, change (if
enabled for MDP) the data pointer at any time and so we can imagine lots
of weird but compliant device behaviours that may complexify a lot the
calculation of the residual count by the SIM.=20

Looking into specifications that address SCSI devices, it seems that the=20
'residual' is mostly useless. In situation where it could help, as for=20
stream devices when using variable length records, the actual number of=20
bytes transferred can be obtained from the SENSE informations.

As seen from the application client, the 'resid' is an information that=20
addresses the data transferred to the device server that is returned by=20
the transport layer. If we refer to SAM, this may appear as a layering=20
violation, in my opinion.

I apologize in advance for all my misunderstandings of the specs that are
very likely.

My questions are:

- Is the 'cam_resid' information required to be returned by SIM?

- If yes, how the application client must behave when it is not zero?

- What are the relationships between the transfer length, the current data
  pointer and the residual?
  For example, the SCSI specs does not preclude a device from restoring or
  changing the data pointer and then complete the IO. This is unlikely=20
  to happen, obviously, but this must be considered, in my opinion.


        G=E9rard ROUDIER.

* For T10 Reflector information, send a message with
* 'info t10' (no quotes) in the message body to majordomo at

More information about the T10 mailing list