Commit Graph

1767 Commits

Author SHA1 Message Date
Ronnie Sahlberg
cd0dcb5dae Make iscsi-ls default to HeaderDigest=None for its discovery session
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-02-17 18:18:08 -08:00
Ronnie Sahlberg
b1003dc75a Add URL arguments to enable/disable header digest
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-02-17 17:58:19 -08:00
Ronnie Sahlberg
a1cbd8a2ce Merge pull request #237 from bvanassche/master
Three libiscsi fixes
2017-02-05 07:41:12 -08:00
Bart Van Assche
71c797fd1c test-tool: Fix a segmentation fault in test_receive_copy_results_op_params()
Do not access the RECEIVE_COPY_RESULTS() output if this operation
failed.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-01-23 10:55:53 -08:00
Bart Van Assche
9df32565a6 test-tool/test_async_read.c: Allocate large arrays dynamically
This patch avoids that Valgrind complains about the memset() call
that was used to initialize the array that it triggers an invalid
write.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-01-23 10:55:53 -08:00
Bart Van Assche
38e6ab7582 Spelling fix: incase -> in case
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-01-23 10:55:53 -08:00
Ronnie Sahlberg
81f7f60e6c Merge pull request #236 from plieven/fix_sync_ret
sync: fix return value for various sync commands
2017-01-23 07:12:52 -08:00
Peter Lieven
b5210a1e31 sync: fix return value for various sync commands
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>
2017-01-23 15:40:09 +01:00
Ronnie Sahlberg
9f4f6f85d0 Merge pull request #234 from optimistyzy/19_1
iscsi-perf: fix overflow issue in fill_read_queue
2017-01-09 18:07:43 -08:00
optimistyzy
63cfcd3384 iscsi-perf: fix overflow issue in fill_read_queue
If with int defintion, this statement:

num_blocks = client->num_blocks - client->pos;

May not get the exact value we want.

Signed-off-by: optimistyzy <optimistyzy@gmail.com>
2017-01-09 18:38:59 +08:00
Ronnie Sahlberg
20f52ea756 Add test that ipv6 works
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-01-08 13:12:16 -08:00
Ronnie Sahlberg
179f6b33d4 Fix IPV6
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-01-08 12:57:12 -08:00
Ronnie Sahlberg
2eefdbb9e8 Lost patch when resolving conflicts
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-01-07 09:06:59 -08:00
Ronnie Sahlberg
178b3ec5b9 XCOPY: Only set the write flag if we actually have DATA-OUT
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-01-07 08:57:45 -08:00
Ronnie Sahlberg
f915aabf57 Merge pull request #231 from plieven/read_batch_pdu2
Batch pdu read in function iscsi_read_from_socket()
2017-01-07 08:42:32 -08:00
Ronnie Sahlberg
33d0b63717 Merge branch 'master' into read_batch_pdu2 2017-01-07 08:42:12 -08:00
Ronnie Sahlberg
310674224c Merge pull request #233 from plieven/for_upstream
fix crc32c header checksums and some bugs
2017-01-07 08:32:32 -08:00
Peter Lieven
eb7c1d9b0c socket: process PDUs directly after receiving them
this eliminated the need for an inqueue

Signed-off-by: Peter Lieven <pl@kamp.de>
2017-01-06 11:48:17 +01:00
Ronnie Sahlberg
8784a2b65f Bump API version
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-01-05 19:33:40 -08:00
Peter Lieven
0225c662d0 socket: restore connected_portal info
this got lost in commit 0d6362f

Signed-off-by: Peter Lieven <pl@kamp.de>
2017-01-05 14:47:51 +01:00
Peter Lieven
1cbeec6bdc pdu: verify header digest
we never verified the received header digest. do that now.

Signed-off-by: Peter Lieven <pl@kamp.de>
2017-01-05 14:41:21 +01:00
Peter Lieven
443b104833 crc32c: use uint_t types
Signed-off-by: Peter Lieven <pl@kamp.de>
2017-01-05 14:39:15 +01:00
Peter Lieven
55eacac425 login: add logging for the negotiation login parameters
Signed-off-by: Peter Lieven <pl@kamp.de>
2017-01-05 12:33:47 +01:00
Peter Lieven
23738bf1c3 socket: calculate header checksum at the right place
we mangled the PDU header after calculating the checksum which
effectively broke CRC32C header digests completely.

Signed-off-by: Peter Lieven <pl@kamp.de>
2017-01-05 12:28:37 +01:00
Peter Lieven
ed1ed27dde socket: return in->hdr to smalloc pool
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>
2017-01-05 12:19:20 +01:00
Peter Lieven
1a552a8afa socket: do not zero header of incoming PDU
we overwrite it anyway

Signed-off-by: Peter Lieven <pl@kamp.de>
2017-01-05 12:19:07 +01:00
Peter Lieven
c68d2c0ddb init: introduce iscsi_smalloc
Signed-off-by: Peter Lieven <pl@kamp.de>
2017-01-05 12:18:03 +01:00
Ronnie Sahlberg
b7ab5d05f1 TEST: Add a test to verify that HeaderDigest works
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-01-04 18:47:18 -08:00
Ronnie Sahlberg
f97f1fbaab Merge pull request #230 from ddiss/iscsi-dd-xcopy
examples/dd: add XCOPY support
2017-01-04 18:14:14 -08:00
David Disseldorp
30a49f97cb examples/dd: split out duplicate read capacity code
Use a helper function, rather than having duplicate source and
destination READ CAPACITY logic.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2017-01-04 19:33:00 +01:00
David Disseldorp
aaeb2dd5a5 examples/dd: add XCOPY support
EXTENDED COPY can be triggered with the new --xcopy/-x parameter. When
invoked, (--max) EXTENDED COPY requests are dispatched in parallel, with
each request attempting to copy (--blocks) from source to destination.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2017-01-04 19:33:00 +01:00
David Disseldorp
4bc5f962e2 Libiscsi: add support for EXTENDED COPY
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>
2017-01-04 19:33:00 +01:00
David Disseldorp
f475436c5a Libiscsi: add support for RECEIVE COPY RESULTS
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>
2017-01-04 19:33:00 +01:00
David Disseldorp
2b9abd9ac8 examples/dd: validate block count and max in flight params
Signed-off-by: David Disseldorp <ddiss@suse.de>
2017-01-04 19:32:05 +01:00
Peter Lieven
e058e825bf socket: break receive loop if there are no more outstanding PDUs
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>
2017-01-03 11:13:06 +01:00
Peter Lieven
b81e9a28a6 Batch pdu read in function iscsi_read_from_socket()
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>
2017-01-02 15:52:19 +01:00
Ronnie Sahlberg
e8afafb32d Merge pull request #229 from ddiss/xcopy
TESTS: fix ExtendedCopy.ValidTgtDescr for SPC-4
2016-12-29 12:38:53 -08:00
David Disseldorp
14cc8facc1 TESTS: fix ExtendedCopy.ValidTgtDescr for SPC-4
With SPC-4, the 0xE4 descriptor LU ID TYPE field should be ignored, and
the NUL bit is obsolete. Update the ValidTgtDescr accordingly.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-12-29 20:49:12 +01:00
Ronnie Sahlberg
9b585dd558 Merge pull request #227 from ddiss/xcopy_limits_v2
TESTS: exceed Maximum Descriptor List Length
2016-12-26 10:16:35 -08:00
David Disseldorp
e427a813ad TESTS: exceed Maximum Descriptor List Length
ExtendedCopy.DescrLimits currently attempts to test Maximum Descriptor
List Length bounds checking by issuing a request with
(max_target_desc_count + 1 + max_segment_desc_count + 1) descriptors.

Maximum Descriptor List Length is a separately advertised field, that
may not be exceeded with the above logic, e.g. LIO advertises:
- Max Target Desc Count = 2
- Max Segment Desc Count = 1
- Max Desc List Len = 1024

Calculate the number of descriptors using the advertised Maximum
Descriptor List Length value, to explicitly test bounds checking.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-12-23 02:36:43 +01:00
Ronnie Sahlberg
8000a14d55 Add a test that a (future) single call to iscsi_service() will process all queued PDUs
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-12 17:47:17 -08:00
Ronnie Sahlberg
3a598ea846 TESTS: Unmap. Clamp max number of unmap blocks to 256 if the target reports
no limit

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-15 18:37:59 -08:00
Ronnie Sahlberg
04b029dc88 TESTS: Allow iser:// style URLs
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-15 18:21:35 -08:00
Ronnie Sahlberg
727faa6fc4 Merge branch 'master' of github.com:sahlberg/libiscsi 2016-11-15 18:09:13 -08:00
Ronnie Sahlberg
8c9519b145 TESTS: Setup and use iovectors for ALL data transfers in send_scsi_command
We need to use iovectors for iSER to work as it requires that the vectors
are attached to the task before we queue the task.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-11-15 18:07:23 -08:00
Ronnie Sahlberg
d7809374e1 Merge pull request #219 from vriera/master
Do not use -I/usr/include. This is unsafe when cross-compiling.
2016-11-14 17:12:36 -08:00
Ronnie Sahlberg
5228631a60 Merge pull request #220 from mimusato/unmap
adds max block descriptor count control to Unmap; skips Verify on LBA…
2016-11-14 17:11:39 -08:00
Ronnie Sahlberg
b89e1c87a4 Merge pull request #221 from hramrach/master
Fix 32bit build.
2016-11-14 12:40:03 -08:00
Michal Suchanek
a239423a0f Fix 32bit build.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2016-11-14 17:28:31 +01:00
Mihai Musatoiu
1a92fbcc12 adds max block descriptor count control to Unmap; skips Verify on LBA 2^31 if that LBA is valid (not outside the LUN) 2016-10-27 09:42:14 +00:00