SSA Target Mode

The SSA Target-Mode interface (TMSSA) provides node-to-node communication through the SSA interface. The interface uses two special files that provide a logical connection to another node. One of the special files (the initiator-mode device) is used for write operations; the other (the target-mode device) is used for read operations. Data that is sent to a node is written to the initiator. Data that is read from a node is read from the target. The special files are:

/dev/tmssaXX.im
The initiator-mode device, which has an even, minor device number, and is write only.
/dev/tmssaXX.tm
The target-mode device, which has an odd, minor device number, and is read only.

The device is tmssaXX, where XX is the node number of the using system with which these files communicate. You are not aware of which path connects the two nodes. The path can change if, for example, SSA loops are changed, nodes are switched off, or any other physical changes is made to the connected SSA loops. The TMSSA device driver can use any available path to the other node, but does not tell you which path is being used. Each node must have in its device configuration database a unique node number that is defined by the node_number attribute of the ssar device.

For example, in Node-to-Node Communication configuration, tmssa is, at first, using adapter ssa0 on node 1 and adapter ssa5 on node 2. Suddenly, the link between the adapters fails. The tmssa device driver automatically switches to using adapters ssa1 and ssa3 or adapters ssa1 and ssa4. The connections between nodes can be modified while they are in use, and the target-mode interface tries to recover.

The TMSSA uses either of two methods to read and write data:

The TMSSA device driver provides support for multiple concurrent read and write operations for different devices. It does not provide support for multiple read or write operations on the same device. The device driver blocks the operation until the device is free. Read and write operations can run concurrently on a particular device.

If a working path exists between two nodes, communication works. The path must be stable long enough for the driver to transmit the data. The maximum time taken to fail a write operation is (A * R * T), where A is the number of adapters in the host, R is the number of retries as defined by TM_MAXRETRY in the /usr/include/sys/tmscsi.h file, and T is the time-out before each retry. The minimum time taken to fail a write operation is the write time-out period. You can adjust the write time-out period and the retry-time out period; see "TMCHGIMPARM (Change Parameters) tmssa Device Driver ioctl Operation".

You can use the select and poll routines to check for read and write capability and can also be notified of a read or write being possible.

The amount of data that can be sent by one write operation in blocking mode has no limit, but the driver and adapter interface has been optimized for transfers of 512 bytes or less. In nonblocking mode, enough buffer space must be available for the write operation.

Each separate write is treated separately by the target, so, when reading, each separate write requires a separate read.

Configuring the SSA Target Mode

Each using system requires its own unique node number. The SSA adapter software specifies this node number, which is used by Target Mode SSA. The configuration database contains the ssar device. The node_number attribute sets the number for the node. Failure to have unique node numbers in the SSA loops causes unpredictable results with the target-mode interface. Node numbers that are not unique cause error logs. You can use the ssavfynn command to check for duplicate node numbers.

When the node is configured, it automatically inspects the existing SSA loops. It detects all nodes that are using the target mode SSA interface now. Each detected node is then added to the configuration database, if it is not already part of it. For each node that is added, tmssaXX is created, where XX is the node number of the detected node.

When configuration is complete, special files exist in the /dev directory. These files allow you to use the target mode interface with each node that is defined in the configuration database. Configuration does not need communication to be actually possible between the relevant using systems. Communication is needed only for the write operation.

Buffer Management

You can set the buffer sizes that are used by each device:

The buffer sizes must be multiples of 128 bytes. The maximum buffer size is 512 bytes. A device can have as many buffers as it needs.

Data can be written into the buffers for the initiator-mode device at any time, even if nonblocked write operations are also transferring data from these buffers. The buffers for the target-mode device can be read at any time, even if a write operation to those buffers is occurring at the same time. It is not important if the sizes of the initiator-mode device buffers are different from the sizes of the target-mode device buffers to which the data is being sent. The total buffer space for the target-mode device, however, must be equal to, or greater than, the size of the initiator-mode device buffer size.

The SSA interface for target-mode transfers has been tuned for 512-byte transfers. Each write operation can send as much data as is required, unless that write operation is nonblocking. In a nonblocking write operation, the data being that is being written must be completely transferred to the device buffers. Therefore, the maximum amount of data that can be written during a nonblocked write operation is determined by the size of the device buffers.

Understanding Target-Mode Data Pacing

An initiator-mode device can send data faster than the associated target-mode device application can read it. This condition occurs when:

In both these instances, the target-mode device driver stops the write operation temporarily, and uses the retry mechanism to try again later. These actions can cause the write operation to fail. As a result, the initiator-mode device is unable to send any data to the target-mode device for the whole of the retry period. Alternatively, the write operation might time out.

Think about these possibilities when you set the buffer sizes and the number of buffers for the devices. Determine carefully the retry period, total write time-out period, and the amount of data that is being sent. For example, to write 64 KB of data with no retry operations, you need 64 KB read and write buffers. If you allow one retry operation, you need only 32 KB buffers.

Using SSA Target Mode

SSA Target Mode does not attempt to manage the data transfer between devices. It does, however,take action if buffers become full, and it ensures that read operations can read data from one write operation only. Any protocol that is needed to manage the communication of data must be implemented in user-supplied programs. The only delays that can occur when data is being received are delays that are characteristics of the SSA system and of the environment in which it operates, and delays that are caused by full buffers.

SSA Target Mode can concurrently send data to, and receive data from, all attached nodes. Blocking read and write operations do nothing until data is available to be read, or until the write operation is complete.

Execution of Target Mode Requests

The write operation transfers the data into the device buffers. When a buffer is full, the SSA adapter starts to transfer the data to the remote using system. At the same time, the user's application program continues to fill the device buffer with the remaining data that is being transferred. If the amount of data that is being written is larger than the available buffer space, the application program waits until more space becomes available in the device buffers. As each buffer is sent, the TMSSA device driver checks whether any more data is to be sent. If more data is to be sent, the device driver continues to send that data. If no more data is to be sent, and the write operation is in blocking mode, the device driver starts the waiting application program. If the write operation is in nonblocking mode, the write status is updated. If an unrecoverable error occurs, the write operation is ended, and the remaining buffers are discarded.

The read operation transfers received data from the device buffers to your application program. When the read operation ends, or the write operation stops sending data, the read operation returns the number of bytes read.