What does it mean that a SCSI target that has been granted the "disconnect privilege" or been placed into "buffered mode of operation?" When are these useful and how are they invoked?
To disconnect means that the initiator and target agree to put the current "SCSI bus conversation" on hold to free up the SCSI bus for other activity, and to resume the "conversation" later when the target is ready to continue.
SCSI buffered mode of operation means that the target may report GOOD status on commands as soon as the data has been transferred to the target. It is not required that the data actually be processed at the time GOOD status is reported. This allows the initiator to begin preparing the next command in parallel with the target processing the buffered data.
The disconnect privilege granted by the initiator allows the target to disconnect from the SCSI bus before or during the processing of a command. The target gets to decide when to disconnect, and typically disconnects when it may take a while to process the command, or when it may be a while until the target is able to begin processing the command.
The initiator grants or revokes Disconnect Privilege with each command it issues on the SCSI-2 bus. Before the initiator sends the command, it sends an IDENTIFY message. The IDENTIFY message byte always has the high order bit set. The next highest bit is the "DiscPriv" bit. When this bit is set, it specifies that the initiator has granted the target the privilege of disconnecting. When this DiscPriv bit is not set, the Gypsy will not disconnect.
There are three common times at which a target may request disconnection:
The Gypsy does not implement any commands that naturally fall into the first category. The only commands without any associated data are Test Unit Ready, Reserve Unit, Release Unit, and Stop Print. The Gypsy will not disconnect for any of these commands.
Commands which normally have a Data Out phase (candidates for the second and third categories) are Print, Format, Mode Select, and Send Diagnostic. Because the Gypsy does not currently require any data for the Send Diagnostic command, the Gypsy proceeds from the Command phase directly to the Status In phase, skipping the Data Out phase, and does not disconnect.
For the second category, the initiator must have granted the disconnect privilege and enabled buffered mode of operation, and all Gypsy internal buffers must be in use prior to receiving a Print, Format, or Mode Select command. Only when these conditions are met will the Gypsy disconnect between the Command and Data Out phases. When a buffer is available to receive the data, the Gypsy will reselect the initiator and proceed to the Data Out phase.
For the third category, the Print and Format commands will try to disconnect after taking the data, unless the initiator has requested buffered mode of operation. The Gypsy disconnects because it does not know in advance how much time will be required to transfer the data or remote command to the printer. When buffered mode of operation has been enabled, there is no point in disconnecting at this time as the Gypsy needs only to report GOOD status before going bus free.
As a general rule, the initiator grants the disconnect privilege on all commands.
For the Gypsy, buffered mode of operation means that when the initiator sends Print or Format commands, the Gypsy will take the data and immediately respond with GOOD status. Later, when the Gypsy detects the plotter is ready for more data, the Gypsy begins sending the buffered data to the plotter.
By placing the Gypsy into buffered mode of operation, the overall plotting system may achieve higher performance (data throughput). The host should not be tied up waiting for each Print command to complete before beginning its processing to generate the next Print command data buffer. Meanwhile, the Gypsy may already have its next buffer full of data ready for transmission to the plotter as soon as the current buffer is fully sent. Typically, a large gain may be seen when the number of buffers goes from one to two. When adding a third buffer, the gain realized is not as great. Additional gain may be realized by "double-buffering" within the host, depending upon the application.
Buffered mode of operation does not require multiple data blocks be buffered. The host may sporadically issue single Print commands. In this case too, the host's process is not I/O blocked waiting for the data to reach the plotter.
An application might not want to allow buffered mode of operation on the final FORMAT command sending a Remote Form FEeD (RFFED). By not being in buffered mode, the host is assured that when the FORMAT command completes, the Gypsy has passed all data to the plotter, and that the plotter has received and executed the RFFED.
To determine the current mode of operation, perform a Mode Sense command. Only the mode parameter header (first 4 bytes) are needed. The third byte contains the "buffered mode" field, and will always returns the current value, independent of the Page Control (PC) field. A value of 0 indicates buffered mode is not enabled. The Gypsy will not issue ending status until all data has been sent to the plotter, or an error has occurred. A value of 1 indicates buffered mode of operation is enabled for this initiator, and the Gypsy will report GOOD status as soon as it has received the data for Print and Format commands.
To control this mode, issue a Mode Select command. Only the mode parameter header (4 bytes) need to be sent to the Gypsy. The "buffered mode" field in the third byte may be set to either 0 or 1. Values 2 through 7 are reserved. Setting a value of 0 disables buffered mode of operation for this initiator. Setting a value of 1 enables buffered mode of operation for this initiator. Each initiator is in control of when the Gypsy uses buffered mode for the initiator's commands. One initiator may not control buffered mode for another initiator.