Commit Graph

286 Commits

Author SHA1 Message Date
Ronnie Sahlberg
3edd40953e TESTS: SANITIZE, Add tests for WABEREQ/WACEREQ 2013-07-05 14:25:43 -07:00
Ronnie Sahlberg
9f88ea2e9a Change a u_int32_t to uint32_t
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2013-06-25 20:23:21 -07:00
Ronnie Sahlberg
e061cba1b9 URL encoded Targetnames
Assume target names are URL encoded with '%' as the special character.

Any sequence of '%' followed by two bytes in the target name will be replaced
with the byte that the second two bytes represent in hexadecimal.

Example
iqn.ronnie.test%3A1234
will be translated to iqn.ronnie.test:1234
2013-06-16 11:35:14 -07:00
Bart Van Assche
49d1145a10 Next to BUS RESET, also accept NEXUS LOSS unit attention after login
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-06-08 07:44:43 -07:00
Bart Van Assche
9dce01bbea Fix PERSISTENT RESERVE IN / READ RESERVATION response unmarshalling
The code that verifies the pr_type response must compare only the
lower four bits of byte 21 of the response ("TYPE") and must ignore
the upper four bits ("SCOPE").

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-05-29 18:56:00 -07:00
Ronnie Sahlberg
99a74310a2 Block Device Characteristics: Add decode of the rest of this page that was missing 2013-05-27 08:28:26 -07:00
Ronnie Sahlberg
92b987de52 Add helpers for the SANITIZE service actions 2013-05-26 10:51:19 -07:00
Ronnie Sahlberg
eebd04e613 Add initial support for SANITIZE and a simple test to generate this opcode. 2013-05-25 16:02:02 -07:00
Ronnie Sahlberg
4df179bfd4 TESTS: Add checks for CDB sanity to REPORT SUPPORTED OPCODES
Read all individual opcodes and check that CDB length > 0  and that
CDB[0] Usage Data is 0xFF
2013-05-19 08:18:09 -07:00
Ronnie Sahlberg
709410b1d7 TESTS: Add some REPORT SUPPORTED OPCODES tests
Add a simple test that it works or is not implemented.

Add a RCTD test to verify that with this flag clear we get command descriptors without CTDP set  and with it set we get command descriptors with CTDP set and a timeout descriptor
2013-05-18 13:56:02 -07:00
Ronnie Sahlberg
ce4623b2fb READ SUPPORTED OPCODES. Update the signature to allow setting all of the
parameters to this command.
2013-05-18 12:34:03 -07:00
Ronnie Sahlberg
772d220217 Add a version descriptor 2013-05-11 16:03:23 -07:00
Ronnie Sahlberg
b7dd6b533b TEST: Add a test that is cmdsn is too low the target just ignores the pdu 2013-04-30 19:05:23 -07:00
Ronnie Sahlberg
4a8d967541 Add support for synchronous command timeout.
Default to 0 meaning no timeout.

Implement a test for iSCS to test what happens if we send a command
with CMDSN being higher than the target allows.
In this case we dont strictly know what will happen, just that what should
NOT happen is the target responding with success.
But we have to be prepared for any kind of failure, including a timeout,
scsi sense, or even iscsi reject or session failure.
2013-04-29 20:42:33 -07:00
Ronnie Sahlberg
555906e76e Revert "Add SSC to the version descriptors."
This reverts commit 45f5fc2105.

Conflicts:

	include/scsi-lowlevel.h
2013-04-22 18:32:09 -07:00
Ronnie Sahlberg
e640fa3cde missing , broke compile 2013-04-22 18:28:20 -07:00
Ronnie Sahlberg
45f5fc2105 Add SSC to the version descriptors.
I actually have a usb-stick that claims it supports SSC. I stongly doubt it.
2013-04-22 17:44:13 -07:00
Ronnie Sahlberg
91a98d6b92 Add handling of inquiry version descriptors 2013-04-21 14:04:30 -07:00
Ronnie Sahlberg
808eed9680 Make task->residual a size_t instead of an int
Update and improve the log messages for failures for the read10 invalid test
2013-03-23 11:23:02 -07:00
Peter Lieven
80ef1807ef Add ASCQ codes related to thin-provisioning
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-03-11 12:13:42 +01:00
Ronnie Sahlberg
3e28133a9a Add unmarshallers for READ*/VERIFY*/WRITE* cdb 2013-03-10 09:19:23 -07:00
Ronnie Sahlberg
0d5c8a4f11 TESTS: Add test for PREVENTALLOWMEDIUMREMOVAL are cleared on lun/target reset 2013-03-03 13:37:52 -08:00
Ronnie Sahlberg
100fcd796d Add ASCQ code for CAPACITY_DATA_HAS_CHANGED 2013-02-19 17:59:45 -08:00
Peter Lieven
8bc0046f51 changed iscsi_data.size from int to size_t
iscsi_data.size is used as parameter to memory
operation functions (such as malloc) which except
size_t rather than int.

Signed-off-by: Peter Lieven <pl@kamp.de>
2013-01-28 09:36:00 +01:00
Ronnie Sahlberg
0f73f062d2 SCSI: remove LBDATA/PBDATA from the WriteSame10/16 signatures
Make LBA the third argument to the iscsi writesame functions
2013-01-21 21:15:37 -08:00
Ronnie Sahlberg
065319f996 SCSI Add support for STATUS_BUSY
Add support for BUSY status coide from the target and just pass this
back to the application as is (instead of converting it to _ERROR).

This allows the application to trap task->status==SCSI_STATUS_BUSY and
decide what/how to proceed.
2013-01-01 10:15:56 -08:00
Lee Duncan
d72e6b3717 Removed custom struct for tracking Persistent Resvn type. 2012-12-23 21:36:46 -08:00
Lee Duncan
474cec5556 Added new 1130* test file for PGR simple reserve testing.
Added infrastructure to support reading, setting, and
clearing reservations.
2012-12-22 13:50:55 -08:00
Ronnie Sahlberg
09df905d30 Add unmarshalling ot REPORT_CAPABILITIES 2012-12-18 21:19:25 -08:00
Ronnie Sahlberg
4522658254 Add unmarshalling og READ_RESERVATION data 2012-12-18 21:10:26 -08:00
Ronnie Sahlberg
0338e4edd0 TEST: Change the last test to be a more simple REGISTER/UNREGISTER test for persisntet registrations. 2012-12-18 20:30:03 -08:00
Ronnie Sahlberg
2a74fc00bc Initial support for PERSISTENT_RESERVER_OUT and add a simple test to show the api 2012-12-17 21:25:46 -08:00
Ronnie Sahlberg
2b46e4adfa Add unmarshalling of PERSISTENT_RESERVE_IN/READ_KEYS DATA-IN blob 2012-12-17 19:26:43 -08:00
Ronnie Sahlberg
c60093eafe Add support for PERSISTENT_RESERVE_IN and add a simple test for READ_KEYS 2012-12-17 19:01:50 -08:00
Peter Lieven
446b1829c8 SOCKET use readv/writev to write directly into iovectors
This patch adds support for read/writev to directly read and write
from/to iovectors. Before this patch on read and write from/to socket
the operation was limited by the iovec boundaries. If there is enough
data in the buffer or enough buffer space available its now possible
to transfer the whole data in one atomic operaion.

Signed-off-by: Peter Lieven <pl@kamp.de>
2012-12-10 19:24:28 +01:00
Peter Lieven
5f18c72706 RECONNCT fix broken reconnect for iov out vectors
We where modifying out_offset and out_len in iscsi_write_to_socket().
If the packet that was being sent before reconnect was a write command
the was a significant change that out_offset and out_len where already
touched. When requeing the packet after reconnect we where
sending garbage!

Signed-off-by: Peter Lieven <pl@kamp.de>
2012-12-06 10:42:16 +01:00
Peter Lieven
237729545a NOP count in flight of client generated NOP-Outs
This patch adds the abilitiy to libiscsi to count the number
of consecutive outstanding NOPs.

With this ability its fairly easy to implement a keepalive
check with NOPs in your application.

Periodically (e.g. every 5 secs) create a NOP-Out with:

iscsi_nop_out_async(iscsi, NULL, NULL, 0, NULL);

At that time check the number of consecutive missing NOP-Ins
with

iscsi_get_nops_in_flight(iscsi) > N.

Where N is the number of missing NOP-Ins you will allow.
Please note that it is legitime for the Target to ignore
a NOP if the load is very high as those packet are mark
as IMMEDIATE.

Signed-off-by: Peter Lieven <pl@kamp.de>
2012-12-06 10:42:09 +01:00
Ronnie Sahlberg
d1344a666b Merge pull request #53 from plieven/reconnect_on_login_error
RECONNECT add option to limit the number of reconnect retries
2012-12-04 19:16:44 -08:00
Ronnie Sahlberg
22797e0f67 NOPs should not be requeued when reconnecting a session.
Just like DATA_OUT we should just discard NOPs instead of requeueing them
on session reconnect.
Add new flag that to indicate this behaviour on reconnect and set it for
both data out and nops
2012-12-04 19:07:49 -08:00
Peter Lieven
ee83c7ce75 RECONNECT add option to limit the number of reconnect retries
In specific situation it might be useful to give up if a reconnect
is not successful or after a given number reconnect retries.
This patch adds the ability to change that. The default remains
the same: retry forever.

Signed-off-by: Peter Lieven <pl@kamp.de>
2012-12-04 13:38:50 +01:00
Peter Lieven
dbe9a1e73a SOCKET queue cmd PDUs directly in waitpdu queue
A storage might sent an R2T response for a WRITE command while
we still sending out the WRITE command PDU. This is especially
the case when the command PDU carries immediata data.

Without this patch the R2T response will get lost as
the cmdpdu for the R2T cannot be found in iscsi_process_pdu()
leading to a deadlock.

Signed-off-by: Peter Lieven <pl@kamp.de>
2012-12-03 11:05:21 +01:00
Ronnie Sahlberg
04970ef95e TESTS: Add a new test that does a one block write using unsilicited immediate data
As part of the test also validate the PDU that libiscsi generates and verify that
1, the PDU we send has the F flag set
2, that datasegmentlength for the PDU is one block
2012-12-01 10:45:42 -08:00
Ronnie Sahlberg
276f600181 Add functions to control how IMMEDIATE_DATA and INITIAL_R2T is negotiated 2012-12-01 09:19:50 -08:00
Ronnie Sahlberg
6661f290a0 Remove next/prev pointers from the scsi_cbdata structure 2012-12-01 08:14:49 -08:00
Ronnie Sahlberg
3ae7cec51d Revert "ISCSI fix broken send logic in iscsi_scsi_async_command"
This reverts commit 548bd22f51.

Revert for now. Will check it later today.
Causes 0130 and other tests to fail/hang when sending a solicited data-out
2012-11-30 06:49:53 -08:00
Peter Lieven
58e5ef5cbc SCSI_IOVECTOR remove size field
Remove the size field as it is not used. If we would keep it
we would have to calculate it in scsi_task_set_iov_in/out which
would add unneccassry wals to the iovec array.

Signed-off-by: Peter Lieven <pl@kamp.de>
2012-11-30 08:44:33 +01:00
Peter Lieven
548bd22f51 ISCSI fix broken send logic in iscsi_scsi_async_command
The send logic was completely broken for any cases except
ISCSI_INITIAL_R2T_NO and ISCSI_IMMEDIATE_DATA_YES.
The final flag was set wrong or no data was sent.

It was also broken if the data did not fit into the cmd_pdu as
the consecutive pdus did not have the scsi_cbdata set which
lead to a segfault in iscsi_get_user_out_buffer().

Unfortunately we need to include scsi-lowlevel.h again in iscsi-private.h.
This should be fixed asap by introduction of an iscsi_task struct
to avoid to store iscsi relevant data in the scsi_task.

Signed-off-by: Peter Lieven <pl@kamp.de>

Conflicts:

	lib/iscsi-command.c

Signed-off-by: Peter Lieven <pl@kamp.de>
2012-11-30 08:43:34 +01:00
Ronnie Sahlberg
b1da7311c4 change u_int to uint 2012-11-29 19:14:26 -08:00
Ronnie Sahlberg
9449753a5d Remove iscsi_scsi_free_cbdata from the headers 2012-11-29 18:49:06 -08:00
Ronnie Sahlberg
5ffb58c55f Merge branch 'zero_copy_write-3' into resolve-conflicts
Conflicts:
	lib/iscsi-command.c
	lib/pdu.c
	lib/socket.c
2012-11-29 18:46:51 -08:00