The scsi_buf structure is used for communication between the FCP device driver and the FCP adapter device driver during an initiator I/O request. This structure is passed to and from the strategy routine in the same way a standard driver uses a struct buf structure.
The scsi_buf structure contains certain fields used to pass a FCP command and associated parameters to the FCP adapter device driver. Other fields within this structure are used to pass returned status back to the FCP device driver. The scsi_buf structure is defined in the /usr/include/sys/scsi_buf.h file.
Fields in the scsi_buf structure are used as follows:
During normal use, the SC_NODISC bit should not be set. Setting this bit allows a device executing commands to monopolize the FCP transport layer. Sometimes it is desirable for a particular device to maintain control of the transport layer once it has successfully arbitrated for it; for instance, when this is the only device on the FCP transport layer or the only device that will be in use. For performance reasons, it may not be desirable to go through FCP selections again to save FCP transport layer overhead on each command.
Also during normal use, the SC_ASYNC bit must not be set. It should be set only in cases where a previous command to the device ended in an unexpected FCP transport free condition. This condition is noted as SCSI_TRANSPORT_FAULT in the adapter_status field of the scsi_cmd structure. Since other errors may also result in the SCSI_TRANSPORT_FAULT flag being set, the SC_ASYNC bit should only be set on the last retry of the failed command.
If an error is detected during execution of a FCP command, and the error prevented the FCP command from actually being sent to the FCP transport layer by the adapter, then the error should be processed or recovered, or both, by the FCP adapter device driver.
If it is recovered successfully by the FCP adapter device driver, the error is logged, as appropriate, but is not reflected in the adapter_status byte. If the error cannot be recovered by the FCP adapter device driver, the appropriate adapter_status bit is set and the scsi_buf structure is returned to the FCP device driver for further processing.
If an error is detected after the command was actually sent to the FCP device, then it should be processed or recovered, or both, by the FCP device driver.
For error logging, the FCP adapter device driver logs FCP transport layer and adapter-related conditions, while the FCP device driver logs FCP device-related errors. In the following description, a capital letter (A) after the error name indicates that the FCP adapter device driver handles error logging. A capital letter (H) indicates that the FCP device driver handles error logging.
Some of the following error conditions indicate a FCP device failure. Others are FCP transport layer or adapter-related.
Note: Commands with the value of SC_NO_Q for the q_tag_msg field (except for request sense commands) should not be queued to a device whose queue contains a command with another value for q_tag_msg. If commands with the SC_NO_Q value (except for request sense) are sent to the device, then the FCP device driver must make sure that no active commands are using different values for q_tag_msg. Similarly, the FCP device driver must also make sure that a command with a q_tag_msg value of SC_ORDERED_Q, SC_HEAD_Q, or SC_SIMPLE_Q is not sent to a device that has a command with the q_tag_msg field of SC_NO_Q.
This transaction must have the SCSI ID field (scsi_buf.scsi_id) and the LUN field (scsi_buf.lun_id) filled in with the device's SCSI ID and logical unit number (LUN). This flag is valid only during error recovery of a check condition or command terminated at a command tag queuing.
Understanding the Execution of Initiator I/O Requests