~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to Documentation/scsi/scsi_mid_low_api.txt

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1343
1343
                   underruns (overruns should be rare). If possible an LLD
1344
1344
                   should set 'resid' prior to invoking 'done'. The most
1345
1345
                   interesting case is data transfers from a SCSI target
1346
 
                   device device (i.e. READs) that underrun. 
 
1346
                   device (e.g. READs) that underrun.
1347
1347
    underflow    - LLD should place (DID_ERROR << 16) in 'result' if
1348
1348
                   actual number of bytes transferred is less than this
1349
1349
                   figure. Not many LLDs implement this check and some that
1351
1351
                   report a DID_ERROR. Better for an LLD to implement
1352
1352
                   'resid'.
1353
1353
 
 
1354
It is recommended that a LLD set 'resid' on data transfers from a SCSI
 
1355
target device (e.g. READs). It is especially important that 'resid' is set
 
1356
when such data transfers have sense keys of MEDIUM ERROR and HARDWARE ERROR
 
1357
(and possibly RECOVERED ERROR). In these cases if a LLD is in doubt how much
 
1358
data has been received then the safest approach is to indicate no bytes have
 
1359
been received. For example: to indicate that no valid data has been received
 
1360
a LLD might use these helpers:
 
1361
    scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
 
1362
where 'SCpnt' is a pointer to a scsi_cmnd object. To indicate only three 512
 
1363
bytes blocks has been received 'resid' could be set like this:
 
1364
    scsi_set_resid(SCpnt, scsi_bufflen(SCpnt) - (3 * 512));
 
1365
 
1354
1366
The scsi_cmnd structure is defined in include/scsi/scsi_cmnd.h
1355
1367
 
1356
1368