Introduce a helper exported from lib/pdu.c which cancels all pdus for a
given context. This patch eliminates repeated code from various other
files which have the same purpose. The only functional difference is
that the cancellation done from iscsi-command.c was (incorrectly) not
checking for iscsi->is_loggedin before issuing callbacks.
Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
Using WIN32 depends on the build environment defining the variable.
_WIN32 is a predefined MSVC macro and is always available.
Signed-off-by: Tim Crawford <crawfxrd@gmail.com>
Build on existing scsi_cdb_extended_copy() functionality. This operation
can be used to offload inter and intra LU copies to the target.
The API is rather primitive, in that the caller needs to construct the
parameter buffer, including CSCD and segment descriptor lists, etc.
Signed-off-by: David Disseldorp <ddiss@suse.de>
Build on existing scsi_cdb_receive_copy_results() functionality. This
request is most commonly used to determine target-side EXTENDED COPY
operational parameters.
Signed-off-by: David Disseldorp <ddiss@suse.de>
This splits a transport into static driver specific functions for the common
iscsi commands. Optionally, a driver specific opaque memory is introduced
which is currently only used by iSER transport.
Last a lot of functions changed to static.
Signed-off-by: Peter Lieven <pl@kamp.de>
iscsi-command: Adding new functions for all write operations (WRITE10,
WRITE12, WRITE16, WRITEOR, etc') for cases where the user wants
to pass his own io vectors (prevent memcpy).
new functions are called iscsi_write*_iov_task and looks
very similar to the iscsi_write*_task, only they get
scsi_iovec pointer and number of scsi_iovec as
parameters.
Change-Id: I719552b4cbda4f937975b5df7e77b4844e48cd16
Signed-off-by: Roy Shterman <roysh@mellanox.com>
iscsi-command: Adding new functions for all write operations (READ6,
READ10, READ12, READ16, etc') for cases where the
user wants to pass his own io vectors (prevent memcpy).
new functions are called iscsi_read*_iov_task and looks
very similar to the iscsi_read*_task, only they get
scsi_iovec pointer and number of scsi_iovec as
parameters.
Change-Id: Ice6bdb9227d72b20f495927f17d6757c124e4c84
Signed-off-by: Roy Shterman <roysh@mellanox.com>
include/iscsi-private: adding queue_pdu in transport function pointers
struct
include/iscsi: declaration of tcp_queue_pdu function
socket: adding queue_pdu function to transport initialization
all_library: changing iscsi_queue_pdu into iscsi->t->queue_pdu
Signed-off-by: Roy Shterman <roysh@mellanox.com>
we use the flag ISCSI_PDU_NO_CALLBACK and pdu->callback simultaneously, but
check only for one of them in various places. So drop ISCSI_PDU_NO_CALLBACK
and check for pdu->callback != NULL instead.
All PDUs that carried this flag have pdu->callback set to NULL.
Signed-off-by: Peter Lieven <pl@kamp.de>
Add a test to verify the pdu timeout handling.
Fix numerous bugs in the timeout handling. It was really broken.
Add test for non-SCSI task PDUs too and verify they works.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Only use TUR to eat any pending unit attentions on the initial connect
but not during reconnect.
From Peter Lieven <pl@kamp.de>
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Extend struct scsi_sense with sense specific descriptor information,
introduce the function scsi_parse_sense_data() and let that function
parse the sense specific descriptor.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
those are part of the login process to consume UNIT_ATTENTIONS.
Its questionable if we should consume them at all, but iff we change
that behaviour we should do it for the initial login as well as
for a reconnect.
Signed-off-by: Peter Lieven <pl@kamp.de>
Rework the reconnect logic so we just call iscsi_scsi_command_async()
for the scsi commands we are re-quining instead of poking into the
private fields of the structures themself.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Remove iscsi_allocate_pdu() which is just a wrapper.
Rename iscsi_allocate_pdu_with_itt_flags() to iscsi_allocate_pdu()
and update all callers.
This only removes a wrapper function and contains no logic changes.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
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>
We write unsolicited data-out PDUs from two places;
when we originally write the command in iscsi_scsi_command_async()
but also when we re-queue the PDUs during a session reconnect.
The re-queuing during the session re-connect was recently (almost) fixed
but was still buggy in that it did not correctly clamp the amount of written
data as per first burst length restriction.
This attempts to fix that.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Both are the same value at this point but it is better to
do the computation only based on pdy-> fields.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
If we have writes that do not have the Final bit set during reconnect
we must send out any missing data-out PDU.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
If we have send unsolicited immediate data and are ALSO sending
unsilocoted data-out, then we have to exclude the length of data we have already sent.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
From the SPC-4 paragraph about WRITE SAME(10): "The WRITE SAME (10)
command requests that the device server transfer a single logical
block from the Data-Out Buffer [ ... ]". Hence always pass a data
buffer when sending a WRITE SAME(10) command.
Set the NDOB bit in the WRITE SAME(16) command if no data out buffer
is present.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Rename the macros for managing the linked lists from SLIST_* to ISCSI_LIST_*
to avoid a clash on *BSD which already have other macros SLIST_*
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Previously COMPAREANDWRITE was only sending verify instance data which
can cause targets to generate COMMAND ABORTED/NOT ENOUGH UNSOLICITED
DATA errors due to the buffer being obviously too small to contain
verify AND write instance data.
The buffer size check has been modified and compareandwrite tests
updated to pass a larger buffer with interesting write instance data.