9. Loopback Control
The Host Access Protocol provides a Loopback Request control message which can be used by a WPS or a host to request the remote loopback of its HAP messages. Such requests are usually the result of operator intervention for purposes of system fault diagnosis. For clarity in the following discussion, the unit (WPS or host) requesting the remote loopback is referred to as the "transmitter" and the unit implementing (or rejecting) the loopback is referred to as the "receiver".
When the host access link is remotely looped, all HAP messages will be returned, unmodified, over the access link by the receiver. (Messages that are too long to be valid HAP messages may be discarded instead of being returned.) The receiver will not send any of its own messages to the transmitter while it is implementing the loop. WPS-generated messages are distinguished from host-generated messages by means of the Loopback indicator that is in every HAP message header.
Two types of remote loopback may be requested: loopback at the receiver's interface hardware and loopback at the receiver's I/O driver software. HAP does not specify the manner in which the receiver should implement these loops; additionally, some receivers may use interface hardware which is incapable of looping the transmitter's messages, only allowing the receiver to provide software loops. A receiver may not be able to interpret the transmitter's messages as it is looping them back. If such interpretation is possible, however, the receiver will not act on any of the transmitter's messages other than requests to reinitialize the WPS-host link (Restart Request (RR) control messages; see Section 8.)
When a receiver initiates a loopback condition in response to a loopback request, it makes an implicit promise to maintain the condition for the duration specified in the Loopback Request message. However, if an unanticipated condition such as a system restart occurs in either the transmitter or the receiver, the affected unit will try to reinitialize the WPS-host link by sending an RR message to the other unit. If the RR message is recognized by the other unit, a link initialization sequence can be completed. This will restore the link to an unlooped condition even if the specified loop duration has not yet expired. If a receiver cannot interpret a transmitter's RR messages, and in the absence of operator intervention at the receiver, the loop will remain in place for its duration.
HAP does not specify the characteristics of any loopback conditions that may be locally implemented by a given unit. An example of such a condition is that obtained when a WPS commands its host interface to loop back its own messages. If such local loop conditions also cause the reflection of messages received from the remote unit, the remote unit will detect the condition via the HAP header Loopback indicator.
A specific sequence must be followed for setting up a remote loopback. It begins after the HAP link has been initialized and a decision is made to request a remote loop. The transmitter then sends a Loopback Request message (Figure 39) to the receiver and waits for either (1) a 10-second timer to expire, (2) a "Can't implement loop" Unnumbered Response message from the receiver, or (3) one of its own reflected messages. If event (1) or (2) occurs the request has failed and the transmitter may, at its option, try again with a new Loopback Request message. If event (3) occurs, the remote loopback condition has been established. While waiting for one of these events, messages from the receiver are processed normally. Note that RR messages arriving from the receiver during this time will terminate the loopback request.
When a receiver gets a Loopback Request message, it either implements the requested loop for the specified duration, or returns a "Can't implement loop" response without changing the state of the link. The latter response would be returned, for example, if a receiver is incapable of implementing a requested hardware loop. A receiver should initiate reinitialization of the link with an RR message(s) whenever a loopback condition times out.
There is one asymmetry that is required in the above sequence to resolve the (unlikely) case where both WPS and host request a remote loopback at the same time. If a WPS receives a Loopback Request message from a host while it is itself waiting for an event of type (1)-(3), it will return a "Can't implement loop" response to the host and will continue to wait. A host in the converse situation, however, will abort its loopback request and will instead act on the WPS's loopback request.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
0 | 1|LB|GOPRI| 0 | LOOP TYPE | 8 |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1 | HEADER CHECKSUM |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
2 | LOOP DURATION |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
LOOPBACK REQUEST
Figure 39
0[0] Message Type = 1 (Control Message).
0[1] Loopback indicator.
0[2-3] Go-Priority.
0[4-7] Reserved. Must be zero.
0[8-11] Loop Type. This field indicates the type of loop that is being requested as follows:
0 = Undefined 1 = Loop at interface (hardware loop) 2 = Loop at driver (software loop) 3-15 = Undefined
0[12-15] Control Message Type = 8 (Loopback Request).
1[0-15] Header Checksum. The checksum is the 2's-complement of the 2's-complement sum of words 0-2 (excluding the checksum word itself).
2[0-15] Loop Duration. The transmitter of a Loopback Request message uses this field to specify the number of seconds that the loop is to be maintained by the receiver.