From 490a01053a31306cced03a23cb2f6d2497ddbc7b Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 2 Jan 2011 17:34:36 +1100 Subject: [PATCH] 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. --- include/iscsi-private.h | 4 ++++ lib/socket.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/iscsi-private.h b/include/iscsi-private.h index 85fbc5d..a1a33b9 100644 --- a/include/iscsi-private.h +++ b/include/iscsi-private.h @@ -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; diff --git a/lib/socket.c b/lib/socket.c index c5a2d19..31bf755 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -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;