diff --git a/doc/iscsi-test-cu.1 b/doc/iscsi-test-cu.1 index 815b30d..3260ff8 100644 --- a/doc/iscsi-test-cu.1 +++ b/doc/iscsi-test-cu.1 @@ -2,12 +2,12 @@ .\" Title: iscsi-test-cu .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 03/26/2014 +.\" Date: 02/16/2015 .\" Manual: iscsi-test-cu: iSCSI/SCSI protocol test suite .\" Source: iscsi-test-cu .\" Language: English .\" -.TH "ISCSI\-TEST\-CU" "1" "03/26/2014" "iscsi\-test\-cu" "iscsi\-test\-cu: iSCSI/SCSI pr" +.TH "ISCSI\-TEST\-CU" "1" "02/16/2015" "iscsi\-test\-cu" "iscsi\-test\-cu: iSCSI/SCSI pr" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ iscsi-test-cu \- iSCSI/SCSI test suite .HP \w'\fBiscsi\-test\-cu\ [\ OPTIONS\ ]\ \fR\ 'u \fBiscsi\-test\-cu [ OPTIONS ] \fR .HP \w'\fBiscsi\-test\-cu\fR\ 'u -\fBiscsi\-test\-cu\fR [\-i\ \-\-initiator\-name=] [\-I\ \-\-initiator\-name\-2=] [\-l\ \-\-list] [\-t\ \-\-test=|*[\&.|*[\&.|*]]] [\-d\ \-\-dataloss] [\-s\ \-\-allow\-sanitize] [\-u\ \-\-usb] [\-V\ \-\-Verbose\-scsi] [\-x\ \-\-xml] [\-?\ \-\-help] +\fBiscsi\-test\-cu\fR [\-i\ \-\-initiator\-name=] [\-I\ \-\-initiator\-name\-2=] [\-l\ \-\-list] [\-t\ \-\-test=|*[\&.|*[\&.|*]]] [\-d\ \-\-dataloss] [\-s\ \-\-allow\-sanitize] [\-V\ \-\-Verbose\-scsi] [\-x\ \-\-xml] [\-?\ \-\-help] .SH "DESCRIPTION" .PP iscsi\-test\-cu is a test suite for iSCSI/SCSI\&. @@ -151,13 +151,6 @@ The SBC SANITIZE opcode is expected to take significant time before it completes By default any SBC SANITIZE tests will be skipped\&. Use these arguments if you really want to perform SANITIZE tests\&. .RE .PP -\-u \-\-usb -.RS 4 -SCSI devices that sit behind a USB bus are on linux limited to maximum 120k for any single SCSI Read*/Write*\&. -.sp -When testing against a USB SCSI device you need to specify these arguments so that the tests will clamp the read/write size to a maximum of 120k\&. -.RE -.PP \-V \-\-Verbose\-scsi .RS 4 The tests aims to be self\-documenting\&. By specifying the \-V flag the test tool will print all SCSI commands that are sent to the device, the arguments and the expected result\&. diff --git a/doc/iscsi-test-cu.xml b/doc/iscsi-test-cu.xml index d2c5bd9..9f8a583 100644 --- a/doc/iscsi-test-cu.xml +++ b/doc/iscsi-test-cu.xml @@ -27,7 +27,6 @@ -t --test=<family>|*[.<suite>|*[.<test>|*]] -d --dataloss -s --allow-sanitize - -u --usb -V --Verbose-scsi -x --xml -? --help @@ -186,20 +185,6 @@ iscsi-test-cu --test=~/tests-to-run - -u --usb - - - SCSI devices that sit behind a USB bus are on linux limited - to maximum 120k for any single SCSI Read*/Write*. - - - When testing against a USB SCSI device you need to specify these - arguments so that the tests will clamp the read/write size to - a maximum of 120k. - - - - -V --Verbose-scsi diff --git a/test-tool/iscsi-test-cu.c b/test-tool/iscsi-test-cu.c index b2add52..b6a8ce4 100644 --- a/test-tool/iscsi-test-cu.c +++ b/test-tool/iscsi-test-cu.c @@ -36,6 +36,7 @@ #include #include #include +#include #endif #include @@ -54,6 +55,7 @@ int loglevel = LOG_NORMAL; struct scsi_device *sd; +static unsigned int maxsectbytes; /* * this allows us to redefine how PDU are queued, at times, for @@ -630,9 +632,6 @@ print_usage(void) " -f|--fail Error Action: FAIL if any tests fail\n"); fprintf(stderr, " -A|--abort Error Action: ABORT if any tests fail\n"); - fprintf(stderr, - " -u|--usb The device is attached to a USB bus.\n" - " Additional restrictions apply, such as maximum transfer length 120kb.\n"); fprintf(stderr, " -s|--silent Test Mode: Silent\n"); fprintf(stderr, @@ -885,7 +884,7 @@ static int connect_scsi_device(struct scsi_device *sdev, const char *initiatorna if (sdev->sgio_dev) { int version; - if ((sdev->sgio_fd = open(sdev->sgio_dev, O_RDWR)) == -1) { + if ((sdev->sgio_fd = open(sdev->sgio_dev, O_RDWR|O_NONBLOCK)) == -1) { fprintf(stderr, "Failed to open SG_IO device %s. Error:%s\n", sdev->sgio_dev, strerror(errno)); return -1; @@ -895,6 +894,11 @@ static int connect_scsi_device(struct scsi_device *sdev, const char *initiatorna close(sdev->sgio_fd); return -1; } + if (ioctl(sdev->sgio_fd, BLKSECTGET, &maxsectbytes) < 0) { + fprintf(stderr, "%s failed to read BLKMAXSECT\n", sdev->sgio_dev); + close(sdev->sgio_fd); + return -1; + } return 0; } #endif @@ -943,7 +947,6 @@ main(int argc, char *argv[]) struct scsi_task *rc16_task = NULL; struct scsi_task *rsop_task = NULL; int full_size; - int is_usb = 0; int xml_mode = 0; static struct option long_opts[] = { { "help", no_argument, 0, '?' }, @@ -958,7 +961,6 @@ main(int argc, char *argv[]) { "abort", no_argument, 0, 'A' }, { "silent", no_argument, 0, 's' }, { "normal", no_argument, 0, 'n' }, - { "usb", no_argument, 0, 'u' }, { "verbose", no_argument, 0, 'v' }, { "xml", no_argument, 0, 'x' }, { "Verbose-scsi", no_argument, 0, 'V' }, @@ -971,7 +973,7 @@ main(int argc, char *argv[]) memset(sd, '\0', sizeof(struct scsi_device)); sd->sgio_fd = -1; - while ((c = getopt_long(argc, argv, "?hli:I:t:sdgfAsSnuvxV", long_opts, + while ((c = getopt_long(argc, argv, "?hli:I:t:sdgfAsSnvxV", long_opts, &opt_idx)) > 0) { switch (c) { case 'h': @@ -1011,9 +1013,6 @@ main(int argc, char *argv[]) case 'n': mode = CU_BRM_NORMAL; break; - case 'u': - is_usb = 1; - break; case 'v': mode = CU_BRM_VERBOSE; /* default */ break; @@ -1259,9 +1258,10 @@ main(int argc, char *argv[]) } scsi_free_scsi_task(task); - if (is_usb) { - printf("USB device. Clamping maximum transfer length to 120k\n"); - maximum_transfer_length = 120 *1024 / block_size; + if (maxsectbytes) { + maximum_transfer_length = maxsectbytes / block_size; + printf("Bus transfer size is limited to %d bytes. Clamping " + "max transfers accordingly.\n", maxsectbytes); } if (CU_initialize_registry() != 0) {