IBM Advanced SerialRAID Adapters SA33-3285-02 User Manual page 319

Advanced serialraid adapters
Table of Contents

Advertisement

write subroutine
Support for the write entry point is provided only for the initiator-mode device driver. The
write entry point generates one write operation in response to a calling program write
request. If the device is opened with the O_NDELAY flag set, and the write request is
for a length that is greater than the total buffer size of the device, the write request fails.
The errno global variable is set to EINVAL. The total buffer size for the device is
determined by multiplying the value of the XmitBufferSize attribute by the value of the
XmitBuffers attribute. These values are in the configuration database.
Support for data gathering is through the user-mode writev or writevx subroutine, or
through the kernel-mode fp_rwuio service call. The write buffers are gathered so that
they are transferred, in sequence, as one write operation. The returned errno global
variable is set to EFAULT if an error occurs while the caller data is being copied to the
device buffers.
If the write operation is unsuccessful, the return value is set to -1 and the errno global
variable is set to the value of the return value from the device driver. If the return value
is other than -1, the write operation was successful and the return value indicates the
number of bytes that were written. The caller should validate the number of bytes that
are sent to check for any errors. Because the whole data transfer length is sent in a
single write operation, you should suspect that a return code that is not equal to the
expected total length is an error. File offsets are not applicable, and are ignored for
target-mode write operations.
If the calling program needs to break a blocked write operation, a signal is generated.
The target-mode device driver receives that signal, and ends the current write
operation. The write operation that is in progress fails, and the errno global variable is
set to EINTR. The write operation returns the number of bytes that were already sent,
before the signal was generated. The calling program can then continue by issuing
another write operation or an ioctl operation, or it can close the device. If the write
operation that the caller attempts to break completes before the signal is generated, the
write operation ends normally, and the signal is ignored.
If the buffers of remote using systems are full, or no device response status is received
for the write operation, the target-mode device driver automatically retries the write
operation. It retries the operation up to the number of times that is specified by the
value TM_MAXRETRY. This value is defined in the /usr/include/sys/tmscsi.h file. By
default, the target mode device driver delays each retry attempt by approximately two
seconds to allow the target device to respond successfully. The caller can change the
time delayed through the TMCHGIMPARM operation. If the write operation is still
unsuccessful after the specified number of retries, it tries another SSA adapter. If this
write operation has already tried all the SSA adapters, it fails. The calling program can
retry the write operation, or perform other appropriate error recovery. No other error
conditions are retried, but are returned with the appropriate errno global variable.
The target-mode device driver, by default, generates a time-out value, which is the
amount of time allowed for the write operation to end. If the write operation does not
end before the time-out value expires, the write operation fails. The time-out value is
related to the length of the requested transfer, in bytes, and is calculated as follows:
299
Chapter 13. Using the Programming Interface

Advertisement

Table of Contents
loading

Table of Contents