iscsi-command: fix unsolicited data-out length

the recent implementation allows to send
iscsi->first_burst_length + iscsi->target_max_recv_data_segment_length
bytes if immediate and unsolicited data-out is send and
iscsi->target_max_recv_data_segment_length < iscsi->first_burst_length.

RFC3720 defines the length as:

Length=(min(FirstBurstLength, Expected Data
   Transfer Length) - Received Immediate Data Length).

so that immediate data and unsolicited data-out are together
FirstBurstLength at maximum.

Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
Peter Lieven
2015-02-23 07:53:41 +01:00
parent c94fb840bc
commit dd6831a50f

View File

@@ -193,11 +193,8 @@ iscsi_timeout_scan(struct iscsi_context *iscsi)
int
iscsi_send_unsolicited_data_out(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
{
uint32_t len = pdu->expxferlen - pdu->payload_len;
uint32_t len = MIN(pdu->expxferlen, iscsi->first_burst_length) - pdu->payload_len;
if (len > iscsi->first_burst_length) {
len = iscsi->first_burst_length;
}
return iscsi_send_data_out(iscsi, pdu, 0xffffffff,
pdu->payload_len, len);
}