The set of sync connect calls use a stack variable to track the
connection status. This is ok because such calls block on event_poll()
until the connection is established. However, event_poll may return
early in case of errors (or timeout) while PDUs are still queued on the
context (and pointing to a local stack).
This cancels any pending PDUs before returning from sync connect calls.
Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
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>
The primary issue is that in MSVC 14.00 (VS2015) Microsoft added
snprintf as a function to the standard library and prevents users from
defining it to something else (typically, this was _snprintf). So, only
define it when using _MSC_VER < 1900.
Other changes are:
- Fix macro definition of dup2
- Add macro for getpid
- Add function definition for win32_dup
- Add missing EXTERNs
Signed-off-by: Tim Crawford <crawfxrd@gmail.com>
Win32 has been rotting for a while. This patch adds vs17 build files
as well as fixing up all build errors that have accumulated.
There are still build warnings but those can be addressed in a followup
patch.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
all sync commands that return an integer value are
supposed to return a negative value on error.
However, state.status is positive non-zero on error.
Fix this by returning -1 if the state.status is
not SCSI_STATUS_GOOD.
Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
we mangled the PDU header after calculating the checksum which
effectively broke CRC32C header digests completely.
Signed-off-by: Peter Lieven <pl@kamp.de>
commit bc64420 introduced an extra smalloc for the in->hdr,
however it did use iscsi_free instead of iscsi_sfree to free it.
Signed-off-by: Peter Lieven <pl@kamp.de>
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>
If the length of iscsi->waitpdu and iscsi->inqueue are the same
then except for any target initiated NOPs or async messages
we should have received any and all possible pdus from this
socket and can abort early.
This avoids running the loop one more time just to fail with EAGAIN
at the recs/readv. Just avoiding that recv/readv syscall will shave
at least 10us off this function and thus the latency.
Suggested-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
iscsi_read_from_socket can currently only read one PDU in each iscsi_service invocation even
if there is more data available on the socket. This patch reads all PDUs until the socket
would block. It enqueues all complete read PDUs and then processes them in order of arrival.
Signed-off-by: Peter Lieven <pl@kamp.de>
- Various updates to the test utility
- Add transport abstraction
- Add support for iSER
- Add iscsi_discovery_sync()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Let user specify iSER support by the protocol part of the URL.
I.e. support both
iser://127.0.0.1/iqn.ronnie.test/1
iscsi://127.0.0.1/iqn.ronnie.test/1?iser
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
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>
Remove iscsi_queue_pdu from the list of symbols otherwise clang on OSX
fails to compile with the following error:
Undefined symbols for architecture x86_64:
"_iscsi_queue_pdu", referenced from:
-exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This commit includes all iSER implementation in libscsi
library and utilities.
Also, adding iser option in url.
Change-Id: I55ca8a9d4db802e72eb991061260dbb0bd0ef9ba
Signed-off-by: Roy Shterman <roysh@mellanox.com>
future iSER implementation will include different implementations
for all socket relative function. in iSER we get event only when
there is new entry in completion queue opposed to TCP that we get event
when we can write to the socket.
1. iscsi_get_fd -
TCP - returns socket fd.
ISER - returns completion queue channel fd.
2. iscsi_service -
TCP - processing the event type got from the socket
and handles it.
ISER - rearming the event mechanism in the completion queue
and polling all available completion queue entries for
process.
3. iscsi_which_events -
TCP - returns which type of event the library is waiting for
(Read, Write or both).
ISER - in iSER we are waiting only for POLLIN event, hence this
function always returns POLLIN.
Signed-off-by: Roy Shterman <roysh@mellanox.com>
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>
all library: change disconnect to iscsi->t->disconnect
1. In TCP we need only to put -1 in fd and we don't
have more transport resources. In future iSER we will need to
clean resources and destroy the rdma connection.
Signed-off-by: Roy Shterman <roysh@mellanox.com>