Skip to content

Commit d102c6d

Browse files
rddunlapmartinkpetersen
authored andcommitted
scsi: documentation: Corrections for struct updates
Update scsi_mid_low_api.rst for changes to struct scsi_host and struct scsi_cmnd. struct scsi_host: - no_async_abort is gone - drop sh_list w/ no replacement - change my_devices to __devices struct scsi_cmnd: - removed 'done' (now in struct scsi_driver); use scsi_done() or scsi_done_direct() callbacks - change previous request_bufflen to scsi_bufflen() - change previous use_sg field to scsi_dma_map() or scsi_sg_count() - change previous request_buffer field to reference to 'usg_sg' text [mkp: removed more obsolete stuff] Signed-off-by: Randy Dunlap <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: James E.J. Bottomley <[email protected]> Cc: Martin K. Petersen <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: [email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent defb754 commit d102c6d

File tree

1 file changed

+18
-49
lines changed

1 file changed

+18
-49
lines changed

Documentation/scsi/scsi_mid_low_api.rst

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -683,11 +683,7 @@ Details::
683683
*
684684
* Calling context: kernel thread
685685
*
686-
* Notes: If 'no_async_abort' is defined this callback
687-
* will be invoked from scsi_eh thread. No other commands
688-
* will then be queued on current host during eh.
689-
* Otherwise it will be called whenever scsi_timeout()
690-
* is called due to a command timeout.
686+
* Notes: This is called only for a command that has timed out.
691687
*
692688
* Optionally defined in: LLD
693689
**/
@@ -990,7 +986,7 @@ struct scsi_host_template
990986
There is one "struct scsi_host_template" instance per LLD [#]_. It is
991987
typically initialized as a file scope static in a driver's header file. That
992988
way members that are not explicitly initialized will be set to 0 or NULL.
993-
Member of interest:
989+
Members of interest:
994990

995991
name
996992
- name of driver (may contain spaces, please limit to
@@ -1006,6 +1002,13 @@ Member of interest:
10061002
- primary callback that the mid level uses to inject
10071003
SCSI commands into an LLD.
10081004

1005+
vendor_id
1006+
- a unique value that identifies the vendor supplying
1007+
the LLD for the Scsi_Host. Used most often in validating
1008+
vendor-specific message requests. Value consists of an
1009+
identifier type and a vendor-specific value.
1010+
See scsi_netlink.h for a description of valid formats.
1011+
10091012
The structure is defined and commented in include/scsi/scsi_host.h
10101013

10111014
.. [#] In extreme situations a single driver may have several instances
@@ -1046,9 +1049,6 @@ of interest:
10461049
- maximum number of commands that can be queued on devices
10471050
controlled by the host. Overridden by LLD calls to
10481051
scsi_change_queue_depth().
1049-
no_async_abort
1050-
- 1=>Asynchronous aborts are not supported
1051-
- 0=>Timed-out commands will be aborted asynchronously
10521052
hostt
10531053
- pointer to driver's struct scsi_host_template from which
10541054
this struct Scsi_Host instance was spawned
@@ -1057,22 +1057,10 @@ of interest:
10571057
transportt
10581058
- pointer to driver's struct scsi_transport_template instance
10591059
(if any). FC and SPI transports currently supported.
1060-
sh_list
1061-
- a double linked list of pointers to all struct Scsi_Host
1062-
instances (currently ordered by ascending host_no)
1063-
my_devices
1064-
- a double linked list of pointers to struct scsi_device
1065-
instances that belong to this host.
10661060
hostdata[0]
10671061
- area reserved for LLD at end of struct Scsi_Host. Size
1068-
is set by the second argument (named 'xtr_bytes') to
1062+
is set by the second argument (named 'privsize') to
10691063
scsi_host_alloc().
1070-
vendor_id
1071-
- a unique value that identifies the vendor supplying
1072-
the LLD for the Scsi_Host. Used most often in validating
1073-
vendor-specific message requests. Value consists of an
1074-
identifier type and a vendor-specific value.
1075-
See scsi_netlink.h for a description of valid formats.
10761064

10771065
The scsi_host structure is defined in include/scsi/scsi_host.h
10781066

@@ -1094,30 +1082,11 @@ Members of interest:
10941082

10951083
cmnd
10961084
- array containing SCSI command
1097-
cmnd_len
1085+
cmd_len
10981086
- length (in bytes) of SCSI command
10991087
sc_data_direction
11001088
- direction of data transfer in data phase. See
11011089
"enum dma_data_direction" in include/linux/dma-mapping.h
1102-
request_bufflen
1103-
- number of data bytes to transfer (0 if no data phase)
1104-
use_sg
1105-
- ==0 -> no scatter gather list, hence transfer data
1106-
to/from request_buffer
1107-
- >0 -> scatter gather list (actually an array) in
1108-
request_buffer with use_sg elements
1109-
request_buffer
1110-
- either contains data buffer or scatter gather list
1111-
depending on the setting of use_sg. Scatter gather
1112-
elements are defined by 'struct scatterlist' found
1113-
in include/linux/scatterlist.h .
1114-
done
1115-
- function pointer that should be invoked by LLD when the
1116-
SCSI command is completed (successfully or otherwise).
1117-
Should only be called by an LLD if the LLD has accepted
1118-
the command (i.e. queuecommand() returned or will return
1119-
0). The LLD may invoke 'done' prior to queuecommand()
1120-
finishing.
11211090
result
11221091
- should be set by LLD prior to calling 'done'. A value
11231092
of 0 implies a successfully completed command (and all
@@ -1140,13 +1109,13 @@ Members of interest:
11401109
device
11411110
- pointer to scsi_device object that this command is
11421111
associated with.
1143-
resid
1112+
resid_len (access by calling scsi_set_resid() / scsi_get_resid())
11441113
- an LLD should set this unsigned integer to the requested
11451114
transfer length (i.e. 'request_bufflen') less the number
1146-
of bytes that are actually transferred. 'resid' is
1115+
of bytes that are actually transferred. 'resid_len' is
11471116
preset to 0 so an LLD can ignore it if it cannot detect
11481117
underruns (overruns should not be reported). An LLD
1149-
should set 'resid' prior to invoking 'done'. The most
1118+
should set 'resid_len' prior to invoking 'done'. The most
11501119
interesting case is data transfers from a SCSI target
11511120
device (e.g. READs) that underrun.
11521121
underflow
@@ -1155,10 +1124,10 @@ Members of interest:
11551124
figure. Not many LLDs implement this check and some that
11561125
do just output an error message to the log rather than
11571126
report a DID_ERROR. Better for an LLD to implement
1158-
'resid'.
1127+
'resid_len'.
11591128

1160-
It is recommended that a LLD set 'resid' on data transfers from a SCSI
1161-
target device (e.g. READs). It is especially important that 'resid' is set
1129+
It is recommended that a LLD set 'resid_len' on data transfers from a SCSI
1130+
target device (e.g. READs). It is especially important that 'resid_len' is set
11621131
when such data transfers have sense keys of MEDIUM ERROR and HARDWARE ERROR
11631132
(and possibly RECOVERED ERROR). In these cases if a LLD is in doubt how much
11641133
data has been received then the safest approach is to indicate no bytes have
@@ -1168,7 +1137,7 @@ a LLD might use these helpers::
11681137
scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
11691138

11701139
where 'SCpnt' is a pointer to a scsi_cmnd object. To indicate only three 512
1171-
bytes blocks has been received 'resid' could be set like this::
1140+
bytes blocks have been received 'resid_len' could be set like this::
11721141

11731142
scsi_set_resid(SCpnt, scsi_bufflen(SCpnt) - (3 * 512));
11741143

0 commit comments

Comments
 (0)