Add a flags field to the pdu structure

Add a new pdu flag : DELETE_WHEN_SENT. When this pdu has been
sent to the wire, the pdu will be deleted and not put on the waitpdu list.

This will be useful for sequences such as
    -> WRITE10 cdb
    -> DATAOUT the data to write
    -< RESPONSE

Where we want to match WRITE10 and RESPONSE but where the plain DATAOUT pdu
will not be soliciting its own response.
We dont need to wait for the response to DATAOUT pdus, we are already waitin
for the response form the initial PDU in the sequence.
This commit is contained in:
Ronnie Sahlberg
2011-01-02 17:34:36 +11:00
parent 1f1e5111d4
commit 490a01053a
2 changed files with 9 additions and 1 deletions

View File

@@ -150,6 +150,10 @@ enum iscsi_opcode {
struct iscsi_pdu {
struct iscsi_pdu *next;
/* There will not be a response to this pdu, so delete it once it is sent on the wire. Dont put it on the wait-queue */
#define ISCSI_PDU_DELETE_WHEN_SENT 0x00000001
uint32_t flags;
uint32_t itt;
uint32_t cmdsn;
enum iscsi_opcode response_opcode;

View File

@@ -292,7 +292,11 @@ iscsi_write_to_socket(struct iscsi_context *iscsi)
struct iscsi_pdu *pdu = iscsi->outqueue;
SLIST_REMOVE(&iscsi->outqueue, pdu);
SLIST_ADD_END(&iscsi->waitpdu, pdu);
if (pdu->flags & ISCSI_PDU_DELETE_WHEN_SENT) {
iscsi_free_pdu(iscsi, pdu);
} else {
SLIST_ADD_END(&iscsi->waitpdu, pdu);
}
}
}
return 0;