From Richard Sharpe

Add a mechanism where residual overflow/underflow can be reportad back to
the application

We probably need somethinf for bidir residuals at some stage too
This commit is contained in:
Ronnie Sahlberg
2011-03-27 19:27:10 +11:00
parent 2c932a1869
commit 4979b7346f
2 changed files with 23 additions and 0 deletions

View File

@@ -354,6 +354,21 @@ iscsi_process_scsi_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu,
task->datain.data = pdu->indata.data;
task->datain.size = pdu->indata.size;
task->residual_status = SCSI_RESIDUAL_NO_RESIDUAL;
task->residual = 0;
/*
* These flags should only be set if the S flag is also set
*/
if (flags & (ISCSI_PDU_DATA_RESIDUAL_OVERFLOW|ISCSI_PDU_DATA_RESIDUAL_UNDERFLOW)) {
task->residual = ntohl(&in->hdr[44]);
if (flags & ISCSI_PDU_DATA_RESIDUAL_UNDERFLOW) {
task->residual_status = SCSI_RESIDUAL_UNDERFLOW;
} else {
task->residual_status = SCSI_RESIDUAL_OVERFLOW;
}
}
pdu->indata.data = NULL;
pdu->indata.size = 0;