Update comments explaining how we send unsolicited data.

Add comments to explain how/why we send unsolicited data.
This is a somewhat hairy area and it is easy to make mistakes here, so
extra comments on the how/why is useful.
This commit is contained in:
Ronnie Sahlberg
2012-12-02 13:09:12 -08:00
parent 023c7f855a
commit 39f42dbd2f

View File

@@ -222,9 +222,10 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun,
/* update data segment length */ /* update data segment length */
scsi_set_uint32(&pdu->outdata.data[4], pdu->out_len); scsi_set_uint32(&pdu->outdata.data[4], pdu->out_len);
} }
/* We are allowed to send unsolicited data-out. And /* We have (more) data to send and we are allowed to send
* we couldnt send all data yet as immediate data * it as unsolicited data-out segments.
* so drop the F-flag, and generate a DATA-OUT train below. * Drop the F-flag from the pdu and start sending a train
* of data-out further below.
*/ */
if (iscsi->use_initial_r2t == ISCSI_INITIAL_R2T_NO if (iscsi->use_initial_r2t == ISCSI_INITIAL_R2T_NO
&& pdu->out_len < (uint32_t)task->expxferlen && pdu->out_len < (uint32_t)task->expxferlen
@@ -266,8 +267,10 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun,
return -1; return -1;
} }
/* If this is not the final pdu, then we must send some DATA-OUT PDUs /* The F flag is not set. This means we haven't sent all the unsolicited
* as unsolicited data. * data yet. Sent as much as we are allowed as a train of DATA-OUT PDUs.
* We might already have sent some data as immediate data, which we must
* subtract from first_burst_length.
*/ */
if (!(flags & ISCSI_PDU_SCSI_FINAL)) { if (!(flags & ISCSI_PDU_SCSI_FINAL)) {
uint32_t len = task->expxferlen; uint32_t len = task->expxferlen;