Commit Graph

1901 Commits

Author SHA1 Message Date
Bart Van Assche
2bbf7b5017 test-tool: If SG_IO fails, report why it failed
See also https://github.com/sahlberg/libiscsi/issues/302.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-10-31 14:16:56 -07:00
Bart Van Assche
a55f11ee68 Improve iser_rx_desc alignment
Align iscsi_header[] and data[] on an 8-byte boundary instead of on a 4-byte
boundary. With this patch applied pahole produces the following output:

struct iser_rx_desc {
        struct iser_hdr    iser_header;                  /*     0    28 */
        char                       pad1[4];              /*    28     4 */
        char                       iscsi_header[48];     /*    32    48 */
        /* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
        char                       data[128];            /*    80   128 */
        /* --- cacheline 3 boundary (192 bytes) was 16 bytes ago --- */
        struct ibv_sge     rx_sg;                        /*   208    16 */
        struct ibv_mr *            hdr_mr;               /*   224     8 */
        char                       pad2[24];             /*   232    24 */

        /* size: 256, cachelines: 4, members: 7 */
};

Additionally, this patch fixes the following build errors:

iser.c: In function 'iser_alloc_rx_descriptors':
iser.c:916:11: error: taking address of packed member of 'struct iser_rx_desc' may result in an unaligned pointer value [-Werror=address-of-packed-member]
  916 |   rx_sg = &rx_desc->rx_sg;
      |           ^~~~~~~~~~~~~~~
iser.c: In function 'iser_post_recvm':
iser.c:955:20: error: taking address of packed member of 'struct iser_rx_desc' may result in an unaligned pointer value [-Werror=address-of-packed-member]
  955 |   rx_wr->sg_list = &rx_desc->rx_sg;
      |                    ^~~~~~~~~~~~~~~

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-10-31 14:16:56 -07:00
Bart Van Assche
30fc526c6e Link with -lpthread if iSER is enabled
This patch fixes the following linker error:

/usr/bin/ld: ../lib/.libs/libiscsipriv.a(libiscsipriv_la-iser.o): undefined reference to symbol 'sem_post@@GLIBC_2.2.5'
/usr/bin/ld: //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-10-31 14:16:38 -07:00
Ronnie Sahlberg
1ab84e2175 fix LGTM.com warning
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-09-28 17:32:29 -07:00
Ronnie Sahlberg
65c425ef82 It is a TODO not a FIXME
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-09-27 21:04:56 -07:00
Ronnie Sahlberg
101c1a5835 Merge pull request #301 from ddiss/iscsi_sendtargets_nop
test-tool: add iSCSI SendTargets, Nop-Out and CHAP auth tests
2019-09-27 13:32:15 -07:00
David Disseldorp
84d80878a6 test-tool: add iSCSI CHAP_A negotiation tests
The iSCSICHAP.Simple test ensures that CHAP_A comma separated lists
are correctly handled. iSCSICHAP.Invalid tests a range of invalid
CHAP_A parameters.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-23 16:46:26 +02:00
David Disseldorp
e716691a45 test-tool: use CHECK_FOR_ISCSI() helper macro
This removes a large amount of boilerplate code.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-22 16:40:13 +02:00
David Disseldorp
2600e538d8 test-tool: add CHECK_FOR_ISCSI() test filter macro
Skip the test if the provided iscsi_ctx is null.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-22 16:40:13 +02:00
David Disseldorp
1511ddcbe4 test-tool: add simple iSCSI NOP-Out test
Send a ping with/without data and expect a valid response.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-22 16:40:13 +02:00
David Disseldorp
98d383d159 test-tool: add iSCSI SendTargets.Invalid test case
This test sends a series of Text request PDUs with key-value data that
doesn't match SendTargets=All.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-22 16:40:13 +02:00
David Disseldorp
955b16b3e3 test-tool: add iSCSI SendTargets.Simple test
This test currently only sends a SendTargets request via existing normal
iSCSI sessions.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-22 16:07:52 +02:00
David Disseldorp
d42fcd89ce lib: use const for add_data buffers
The buffer is memcopied into the PDU. const makes it a little clearer
that the caller isn't handing over ownership.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-18 13:30:04 +02:00
Ronnie Sahlberg
f36b936db1 Merge pull request #300 from ddiss/libiscsipriv
test-tool: add and link against libiscsipriv convenience library
2019-09-18 10:07:02 +10:00
David Disseldorp
d8946c4548 test-tool: replace some manual PDU tweaks with helper calls
For now this only changes iSCSIDataSnInvalid to use
iscsi_pdu_set_datasn() instead of scsi_set_uint32().
iSCSICmdSnTooHigh/Low changes should also be possible, as noted, but
haven't been converted yet.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-18 01:25:39 +02:00
David Disseldorp
2714f7705a test-tool/build: link against libiscsipriv.la
libiscsipriv.la exposes all symbols, so allows tests to perform low
level PDU manipulation, etc. without duplicating code.
As a trade-off, this results in a larger iscsi-test-cu, with libiscsi.so
linking removed.

Link: https://github.com/sahlberg/libiscsi/issues/297
Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-18 01:25:34 +02:00
David Disseldorp
9c78c6d2af build: add convenience library which exports all symbols
Add a new libiscsipriv.la noinst convenience library, which can then be
used by test-tool for low-level PDU manipulation.

Link: https://github.com/sahlberg/libiscsi/issues/297
Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-18 01:25:15 +02:00
Ronnie Sahlberg
6dee6eefbf Merge pull request #299 from ddiss/iscsi_queue_pdu_overload
test-tool: rework iscsi_queue_pdu() overloading
2019-09-18 07:11:58 +10:00
David Disseldorp
dd17293bcc test-tool: remove unused iscsi_queue_pdu() symbol overload
All users have now been changed to overload via the iscsi_ctx transport
callback, so the dlsym based overloading can now be dropped.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
2ae45ac15d test-tool/OverwriteReserved: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
e5cc079e7c test-tool/OverwriteReserved: skip unless iSCSI
This test performs PDU manipulation so should only be run against iSCSI
devices.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
77279dd44f test-tool/CryptoEraseReserved: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
c830a3b55e test-tool/CryptoEraseReserved: skip unless iSCSI
This test performs PDU manipulation so should only be run against iSCSI
devices.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
b705f9e524 test-tool/BlockEraseReserved: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
fdc45fadfa test-tool/BlockEraseReserved: skip unless iSCSI
This test performs PDU manipulation so should only be run against iSCSI
devices.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
153ca193fa test-tool/iSCSIDataSnInvalid: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.
This commit also removes a number of unnecessary "WRITE10 is not
implemented" checks, which should all be caught by the first check.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:29:52 +02:00
David Disseldorp
575ba2244c test-tool/iSCSICmdSnTooHigh: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
David Disseldorp
c067eef9c1 test-tool/iSCSICmdSnTooLow: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
David Disseldorp
310e9ace02 test-tool/Compare&Write: override driver queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert the Compare&Write InvalidDataOutSize test to use
the regular transport driver callback for this purpose.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
David Disseldorp
60a5856f00 test-tool/Compare&Write: skip InvalidDataOutSize unless iSCSI
This test performs PDU manipulation so should only be run against iSCSI
devices.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-16 19:16:30 +02:00
Ronnie Sahlberg
e7fb116f7c Merge pull request #298 from ddiss/sendtargets
discovery: permit SendTargets on normal sessions
2019-09-12 07:27:51 +10:00
David Disseldorp
4ecc34706b discovery: permit SendTargets on normal sessions
rfc3720 indicates that SendTargets on discovery *and* normal operational
sessions must be supported by targets:
   A system that contains targets MUST support discovery sessions on
   each of its iSCSI IP address-port pairs, and MUST support the
   SendTargets command on the discovery session.
   ...
   A target MUST support the SendTargets command on operational
   sessions...

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-09-11 16:17:22 +02:00
Ronnie Sahlberg
54078c6ba9 Merge pull request #296 from smartxworks/dev
update tests/.gitignore
2019-07-19 13:46:19 +10:00
Kyle Zhang
93c7b7a7e3 update tests/.gitignore
Signed-off-by: Kyle Zhang <kyle@smartx.com>
2019-07-19 10:10:23 +08:00
Khazhismel Kumykov
22648d9dbf add some missing includes
avoids forward referenced enums, and includes standard type defns

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
2019-07-14 12:49:05 +10:00
Khazhismel Kumykov
08cd206c4a test-tool: fix async read/write test for bs != 512
Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
2019-07-14 12:47:47 +10:00
Ronnie Sahlberg
eea5d3ba8e new version 1.19.0
Minor updates to the library

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-07-14 08:04:44 +10:00
Ronnie Sahlberg
d1e589655b win32: we don't have a vsbuild.bat file any more
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-07-14 07:53:18 +10:00
Khazhismel Kumykov
4409521cb6 test-tool: fix mpio_async_caw for bs != 512
wr_buf was hardcoded with blocksize 512, resulting in incorrect behavior
for larger block sizes, and buffer overflow. Use the block_size global.

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
2019-07-14 07:46:08 +10:00
Ronnie Sahlberg
676dfc213e Merge pull request #295 from ddiss/mpio_misc
test_multipathio_simple: change data with path
2019-07-09 19:45:31 +10:00
David Disseldorp
cdf32e64d7 test_multipathio_simple: change data with path
This makes the data consistency check slightly more useful.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-07-09 11:24:33 +02:00
Ronnie Sahlberg
29df7d8171 Merge pull request #291 from sumitrai/RDMAExtensions_Support
Added support for iSER related iSCSI keys
2019-06-12 18:53:35 +10:00
Sumit Rai
b3a1d99e27 Added support for iSER related iSCSI keys
Added support for negotiating below keys:
RDMAExtensions, TargetRecvDataSegmentLength, and
InitiatorRecvDataSegmentLength.

These are required to support iSER. See RFC5046 Section 6.
2019-06-12 14:10:31 +05:30
Ronnie Sahlberg
b26e15932a Merge pull request #290 from ddiss/fix_mpio_clear_pr
test-tool: fix MPIO clear_pr() behaviour
2019-05-09 07:37:22 +10:00
David Disseldorp
1af3314e2b test-tool: fix MPIO clear_pr() behaviour
clear_pr() can be called before connect_scsi_device() has been invoked
on each MPIO sdev. This results in a NULL pointer dereference in the
send_scsi_command() MPIO NOP-responder code-path.

Fix this by invoking clear_pr() after the MPIO connect_scsi_device()
loop has run. clear_pr() also only needs to be invoked via a single
path, so do so via the first path only.

Link: https://github.com/sahlberg/libiscsi/issues/289
Fixes: 16435a9 ("iscsi-test-cu: Improve persistent reservation clearing")
Signed-off-by: David Disseldorp <ddiss@suse.de>
2019-04-15 14:32:54 +02:00
Ronnie Sahlberg
cdd0448052 Merge pull request #286 from crawfxrd/dir-locals
Replace file variables with .dir-locals.el
2019-02-22 08:46:23 +10:00
Tim Crawford
9347cfebf2 Replace file variables with .dir-locals.el
Signed-off-by: Tim Crawford <tcrawford@datto.com>
2019-02-21 11:54:02 -05:00
Ronnie Sahlberg
6da503eba5 Merge pull request #283 from yann-morin-1998/yem/no-test
buildsys: add options to disable part of the build, fix cunit detection
2019-02-05 13:10:11 +10:00
Ronnie Sahlberg
d397e7d369 Merge pull request #284 from bvanassche/master
Three bug fixes for the libiscsi test tool
2019-02-05 13:08:58 +10:00
Bart Van Assche
16435a917d iscsi-test-cu: Improve persistent reservation clearing
Clear persistent reservations before sending the first SCSI command to the
target to avoid that that command fails due to persistent reservations left
behind by a previous run of the test tool.

Avoid that a subsequent test fails if a test did not remove the persistent
reservations it obtained.

Make sure that clear_pr() returns -1 if clearing persistent reservations
fails.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-01-13 11:53:09 -08:00