Simplify the logic for when we need to send unsolicited DATA-OUT

This commit is contained in:
Ronnie Sahlberg
2012-12-02 12:58:52 -08:00
parent 338a8e26f5
commit 023c7f855a
+6 -6
View File
@@ -227,7 +227,8 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun,
* so drop the F-flag, and generate a DATA-OUT train below. * so drop the F-flag, and generate a DATA-OUT train below.
*/ */
if (iscsi->use_initial_r2t == ISCSI_INITIAL_R2T_NO if (iscsi->use_initial_r2t == ISCSI_INITIAL_R2T_NO
&& pdu->out_len < iscsi->first_burst_length) { && pdu->out_len < (uint32_t)task->expxferlen
&& pdu->out_len < iscsi->first_burst_length) {
/* We have more data to send, and we are allowed to send /* We have more data to send, and we are allowed to send
* unsolicited data, so dont flag this PDU as final. * unsolicited data, so dont flag this PDU as final.
*/ */
@@ -265,11 +266,10 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun,
return -1; return -1;
} }
/* Can we send more data that did not fit as immediate data ? */ /* If this is not the final pdu, then we must send some DATA-OUT PDUs
if (task->xfer_dir == SCSI_XFER_WRITE * as unsolicited data.
&& iscsi->use_initial_r2t == ISCSI_INITIAL_R2T_NO */
&& pdu->out_len < (uint32_t)task->expxferlen if (!(flags & ISCSI_PDU_SCSI_FINAL)) {
&& pdu->out_len < iscsi->first_burst_length) {
uint32_t len = task->expxferlen; uint32_t len = task->expxferlen;
if (len + pdu->out_len > iscsi->first_burst_length) { if (len + pdu->out_len > iscsi->first_burst_length) {