Commit Graph

62 Commits

Author SHA1 Message Date
Peter Lieven
65cd38e8ff PDU further optimize iscsi_add_data()
This patch further improves add data and esepcially preassigns
the right amount of memory where the amount is preknown
2012-11-05 15:13:50 +01:00
Peter Lieven
7f98233169 Merge remote-tracking branch 'upstream/master' 2012-11-03 01:07:40 +01:00
Peter Lieven
d327ab09c6 MEMORY add wrappers around all mallocs and frees and trace them
This patch adds a wrapper around all memory allocations and frees.
The idea is to get warned immediately if the application leaks memory.
Additionally the wrapper functions make it easy to add different
memory allocators or memory pools in the future.
2012-11-03 01:05:57 +01:00
Ronnie Sahlberg
48d5ab9f39 Fix typo
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-30 18:33:58 -07:00
Jon Grimm
b81bdd3932 Merge with upstream 2012-10-25 12:56:26 -05:00
Jon Grimm
1eaca70a52 Add MaintenanceIn: Report Supported Opcodes (all) and testcase. 2012-10-25 12:48:37 -05:00
Peter Lieven
91267f5aaa Limit immediate and unsolicited data to FirstBurstLength
RFC3270 describes in section 12.14 that immediate and unsolicited data
sent from the initiator to the target must not exceed FristBurstLength
bytes in total.
2012-10-18 09:21:54 +02:00
Jon Grimm
c7d8d2593c Add RESERVE6/RELEASE6 Support. 2012-09-27 12:45:06 -05:00
Jon Grimm
e55ec72f36 Add Read TOC (0x43) Command Support (and basic testcase). 2012-09-24 10:15:00 -05:00
Ronnie Sahlberg
71be26ad03 Add tracking of MAXCMDSN 2012-08-02 09:09:22 +10:00
Ronnie Sahlberg
98b0a757b2 R2T: Reset datasn to 0 everytime we start a new sequence from r2t 2012-08-01 13:44:03 +10:00
Ronnie Sahlberg
1f98c40edf DATASN: We have to increment DATASN in each DATA-OUT PDU in a sequence.
For writes that span across multiple DATA-OUT segments we have to
increment the DATASN field for each segment.
We didnt use to, and most targets were perfectly happy, ignoring that the DATASN was constant 0 for every DATAOUT we sent.
LIO however does check this and did cause it to reject the libiscsi test tool.
(This is something we should write a iscsi test for  so we can flag all non-LIO targets as broken and needing to be fixed)

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-08-01 13:30:13 +10:00
Ronnie Sahlberg
16da01ed4e Add PREVENTALLOWMEDIUMREMOVAL support 2012-07-17 18:12:03 +10:00
Ronnie Sahlberg
025136e81c Add support for STARTSTOPUNIT command 2012-07-15 08:10:39 +10:00
Ronnie Sahlberg
1ce5d97e57 TEST: Add test for ORWRITE command 2012-07-14 17:29:58 +10:00
Ronnie Sahlberg
11f7da678b Add support for ORWRITE 2012-07-14 17:01:38 +10:00
Ronnie Sahlberg
bdd6e6bb11 Add support for COMPARE_AND_WRITE command 2012-07-14 11:34:40 +10:00
Ronnie Sahlberg
29f5e9378f Add support for WRITEVERIFY10/12/16 2012-07-14 08:19:43 +10:00
Ronnie Sahlberg
1745f76bef Add SYNCHRONIZECACHE16 support 2012-07-13 10:19:44 +10:00
Ronnie Sahlberg
d5f646099d READ10/WRITE10: Change these functions to sue the same signatures as the other READ/WRITE
Harmonize the signatures for READ10/WRITE10 to match the ones for READ12/16 and WRITE12/16

This breaks the API/ABI so this forces the next version of the library to bump the major version to 2.0

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-05 19:20:02 +10:00
Ronnie Sahlberg
9130d2eb45 Add support for VERIFY12 and tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-04 20:35:15 +10:00
Ronnie Sahlberg
6003000809 Add VERIFY16 support and tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-04 20:16:44 +10:00
Ronnie Sahlberg
812df62bfd SBC: Add GET_LBA_STATUS support and simple test 2012-05-30 18:41:12 +10:00
Ronnie Sahlberg
733b97f4b8 Add PREFETCH10/16 implementations 2012-05-03 06:21:49 +10:00
Ronnie Sahlberg
974738968d Implement READ/WRITE_12/16 and a simple test for read16
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-05-01 21:54:32 +10:00
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