Commit Graph

37 Commits

Author SHA1 Message Date
Ronnie Sahlberg
568e4ddfcc SBC: Add support for WRITESAME16 and add simple tests using it to unmap blocks from a thin provisioned lun 2012-04-28 14:34:47 +10:00
Ronnie Sahlberg
cc0fa15e14 SBC: Add support for WRITESAME10 and a simple test for using writesame10 to unmap blocks from thin provisioned luns 2012-04-28 13:55:37 +10:00
Ronnie Sahlberg
dd5f94b2ca Add support for UNMAP command and add a simple test for this opcode 2012-04-22 08:09:15 +10:00
Ronnie Sahlberg
86bf89aabf Add support for READCAPACITY16
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-04-20 17:56:39 +10:00
Ronnie Sahlberg
50594830bd Task Management. When we abort a task or a task set, or reset the lun or target
we must also cancel all active tasks.
This will trigger all affected tasks to have their callback invoked with
SCSI_STATUS_CANCELLED
2012-03-10 12:12:47 +11:00
Ronnie Sahlberg
cff996a96d VERIFY10: Add support for VERIFY10. Also add a simple test for verify10 2012-01-26 15:47:14 +11:00
Ronnie Sahlberg
f4223d96c7 Remove unused variable 2011-12-31 10:26:43 +11:00
Ronnie Sahlberg
626734e52f Remove an unused variable 2011-12-31 10:25:52 +11:00
Ronnie Sahlberg
a974e8efe1 When a scsi task / pdu has been cancelled, pass back SCSI_STATUS_CANCELLED to the task callback and not default to SCSI_STATUS_ERROR 2011-09-19 21:12:32 +10:00
Ronnie Sahlberg
c3d3123981 Windows: Add support to build as a DLL under windows 2011-08-31 13:12:30 +10:00
Ronnie Sahlberg
3a39201543 Add 'zero-copy' in libiscsi for reads.
It is not real zero-copy since the data is still copied in the kernel,
but it avoids copying the data inside libiscsi as well as in the callback.

For SCSI tasks that will return data from the target, the application can now
specify application buffers for libiscsi to read the data directly into.
This is done by calling scsi_task_add_data_in_buffer(task, ...

These buffers need not be linear, you can specify different areas to read into
by calling this function several times.

See examples/iscsiclient.c for an example.
2011-04-20 05:46:17 +10:00
Ronnie Sahlberg
7fe457cea8 We can get over/underflow residuals in a DATA-IN segment if/when the S bit is set too. 2011-04-18 17:31:47 +10:00
Ronnie Sahlberg
3a29351dac Read out the residual count correctly from the scsi reply 2011-04-16 16:28:40 +10:00
Ronnie Sahlberg
4551b01104 compiler warning about unusued variable 2011-04-16 16:28:30 +10:00
Ronnie Sahlberg
024f7dc94e In iscsi_scsi_response_cb()
dont pick task up from the argument, since this callback can be invoked
from places where we dont have/know the task strucutre and it is thus NULL.

Instead pick it up from scsi_cbstruct.

This prevents a SEGV when processing REJECT to SCSI commands.
(the scsi command callback dereferences the task pointer)
2011-04-16 13:51:32 +10:00
Ronnie Sahlberg
07ad0572f2 Add support for READ6 2011-04-16 08:06:16 +10:00
Ronnie Sahlberg
cfe19486ee Add RESERVATION CONFLICT
From Richard Sharpe,  add support to handle when a target responds with
RESERVATION CONFLICT to a scsi i/o
2011-04-09 12:00:10 +10:00
Ronnie Sahlberg
4979b7346f From Richard Sharpe
Add a mechanism where residual overflow/underflow can be reportad back to
the application

We probably need somethinf for bidir residuals at some stage too
2011-03-27 19:27:10 +11:00
Ronnie Sahlberg
343d86dca7 get rid of the _async() scsi functions.
We dotn need two interfaces that only diuffer in whether they return a pointer or NULL vs an semiidentical interface that returns 0 or <0

All uses of _async() for scsi tasks should be replaced with the equivalent _task() function instead
2011-03-27 18:17:12 +11:00
Ronnie Sahlberg
f4f6ef5033 change dont automatically free the scsi_task once the callback completes.
Freeing the scsi_task structure is the responsibility of the application
to either do so during the callback, or later.
2011-03-27 17:53:05 +11:00
Ronnie Sahlberg
76208e1eff Rename the _send() functions to _task()
These functions are also async functions for SCSI commands but they return
a task structure or NULL.

This task structure can be used in task management functions to abort the task or a whole task set.
2011-02-27 10:29:51 +11:00
Ronnie Sahlberg
bdbf6b5d00 Dont free the scsi task from iscsi_scsi_command_async(), leave that for the caller to do if required. 2011-02-25 15:53:56 +11:00
Ronnie Sahlberg
b81d21ce8c TaskManagement: Add a function to abort a scsi_task 2011-02-19 18:04:55 +11:00
Ronnie Sahlberg
4315ee9225 Create _send() functions for all scsi commands that return a 'handle'
we can use to abort the task later.
2011-02-19 17:30:03 +11:00
Ronnie Sahlberg
f73e42ec26 TaskManagement: Store the ITT and CMDSN in the scsi_task structure
These are required for some of the task management functions
2011-02-15 20:57:03 +11:00
Ronnie Sahlberg
ec08fe7a45 Read10/Write10 parameters
LBA is uint32_t for read/write10

Also store the lba/numblocks arguments in the task structure for read10/write10
This makes it much easier to implement a fully async "read lots/write lots"
applications.
2011-01-23 18:34:16 +11:00
Ronnie Sahlberg
f3f2031a8c Fix a compiler warning 2011-01-09 09:48:59 +11:00
Ronnie Sahlberg
9ddce8dc24 Replace bzero() with memset() 2011-01-03 15:35:36 +11:00
Ronnie Sahlberg
e7c24af75e Handle ImmediateData=Yes correctly when sending data to the target.
We should not handle any combination of
ImmediateData=Yes/No
InitialR2T=Yes/No
correctly
2011-01-02 19:51:08 +11:00
Ronnie Sahlberg
20eaf85dd4 Handle InitialR2T=Yes correctly when sendign data to a target and wait for a R2T before sending the first block of data.
We should now honour, and handle the case of
ImmediateData=No
InitialR2T=Yes
correctly for targets that are limited on receiveing data too fast.
2011-01-02 19:33:43 +11:00
Ronnie Sahlberg
74fadc9337 Add support for R2T PDUs.
Update the "send scsi command" fucntion to honour
"FirstBurstLength" so that we only send this many bytes as unsolicited data.

The wait for a train of R2T from the target to clock out additional
busrts of data until the full task data has been sent to the Target.

We should now honour, and handle the case of
ImmediateData=No
InitialR2T=No
correctly for targets that are limited on receiveing data too fast.
2011-01-02 19:27:32 +11:00
Ronnie Sahlberg
502843d64a Honour MaxRecvDataSegmentLength from the target and split DATAOUT into
chunks of this size.
2011-01-02 19:27:23 +11:00
Ronnie Sahlberg
5e5d6c05c0 Add a function to send DATAOUT PDUs.
Update the send pdu command to trap when we need to send data to the target
but we are not allowed to send using immediate data.
For this case, send the data as a separate DATAOUT pdu instead.

Twiddle the flags and other fields to now manage that we send the data
as two separate PDUs.
2011-01-02 18:01:21 +11:00
Ronnie Sahlberg
1c024d6bc4 Input processing:
Input processing used to keep all data in one single input buffer, which
makes it hard to handle nested events as well as reading directly from the
socket into the application buffer without an extra copy.

Create a new iscsi_in_pdu structure where we store the header, and any data
for the recevied pdu and store them in a proper input queue.

Change the signature for all processing functions to tahe a iscsi_in_pdu
structure for the received pdu instead of just a pointer to a buffer.
2010-12-11 15:15:51 +11:00
Ronnie Sahlberg
8a6665a092 Licence
Change to LGPL 2.1+ to be compatible with kvm/qemu
2010-12-11 11:47:28 +11:00
Ronnie Sahlberg
709d85c4da Add a COPYING file and updat ehte LGPL boilerplate 2010-12-05 11:11:37 +11:00
Ronnie Sahlberg
098bc5a9a7 Initial import of libiscsi 2010-12-05 08:24:57 +11:00