Commit Graph

105 Commits

Author SHA1 Message Date
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
100fcd796d Add ASCQ code for CAPACITY_DATA_HAS_CHANGED 2013-02-19 17:59:45 -08: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
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
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
Ronnie Sahlberg
3ac9fdcbff Change iscsi_scsi_command_async() to use iovectors for writes.
Change iscsi_scsi_command_async() to write data-out using iovectors
attached to the scsi task structure instead of copying the data into
the buffer holding the header.
Still allow passing the data via an argument to the funtcion so that the
ABI does not change but then just conver the data to an iovector.

Update the write_to_socket functions to know about the iovectors and write them
as part of the pdu.

Convert write10_task to use iovectors.

This will allow 'zero-copy' writes through libiscsi.
However, as 'zero-copy writes does mean that we do more send() calls into
the kernel this may degrade performance for very small i/o.

A scsi write will not take at least 2 send() calls.
One send call for the iscsi header structure and a second send call for the
payload data.
This will be more expensive than the old memcpy() of payload data plus one send() call since the send() will be a lot more expensive than memcpy() of a small amount of data.
2012-11-25 18:17:51 -08:00
Ronnie Sahlberg
beed0809a5 Fix indentation 2012-11-25 14:12:33 -08:00
Bernhard Kohl
7e4b33dd31 scsi-lowlevel: make scsi_get_uint16/32() global and add scsi_set_uint16/32()
This is a preparation to use the (un)marshalling functions anywhere
in the library.

Signed-off-by: Bernhard Kohl <bernhard.kohl@gmx.net>
2012-11-23 16:46:03 -08:00
Peter Lieven
e7cc6dc1ca SCSI add support for POSIX compatible iovectos
This patch defines an scsi_iovec struct which is guaranteed
to be POSIX compatible. It furthermore adds support for
in+out iovectors for bi-directional operations
Signed-off-by: Peter Lieven <pl@kamp.de>
2012-11-23 15:43:00 +01:00
Peter Lieven
55f76cfb0c SCSI add support for iovectors
If an application passes buffers to libiscsi for reading they are
currently added to a linked list one by one. This leads to a malloc
for each buffer object plus O(n) walks trough the list to add
the buffer to then end of the list. Additionally the buffer read
routine takes up to O(n) iterations to find the right buffer
for a request.

This patch introduces an scsi_iovector struct to pass buffers to
an scsi task. Adding a new buffer is in O(1) and finding the
right buffer to also. Malloc requirements are in O(log(n)).

Additionally the scsi_iovector struct is itended to be binary
compatible to an QEMUIOVector allowing to pass this structure
directly to the library.

Initial tests have been made booting an Ubuntu LTS 12.04.1
Desktop server up to the login prompt. The following observations
have been made with regards to scsi_malloc calls:

original implementation:	~11.500 mallocs
using iovector instead of list:	~ 7.500 mallocs
passing the iovector directly:        0 mallocs

To enable this feature in qemu for testing the following patch might
be used:

diff --git a/block/iscsi.c b/block/iscsi.c
index a6a819d..2809c15 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -390,11 +390,16 @@ iscsi_aio_readv(BlockDriverState *bs, int64_t sector_num,
         return NULL;
     }

+#if defined(LIBISCSI_FEATURE_IOVECTOR)
+    assert(sizeof(struct QEMUIOVector) == sizeof(struct scsi_iovector));
+    scsi_iovector_assign(acb->task, (struct scsi_iovector*) acb->qiov);
+#else
     for (i = 0; i < acb->qiov->niov; i++) {
         scsi_task_add_data_in_buffer(acb->task,
                 acb->qiov->iov[i].iov_len,
                 acb->qiov->iov[i].iov_base);
     }
+#endif

     iscsi_set_events(iscsilun);

---
Signed-off-by: Peter Lieven <pl@kamp.de>
2012-11-21 17:02:59 +01:00
Ronnie Sahlberg
4a973e9a4e SCSI: Pass the expected opcode to scsi_cdb_unmarshall()
Pass the opcode we expect to the unmarshalling function so it can do a basic
check that we are trying to unmarshalling the right kind of cdb.
2012-11-20 19:16:42 -08:00
Ronnie Sahlberg
890471c8cc Add support to unmarshall a CDB into a structure and update iscsi-dd
Add two new helper functions scsi_get_uint32() and scsi_get_uint16()
2012-11-20 19:00:55 -08:00
Arne Redlich
5194d13e73 scsi-lowlevel: remove scsi_maintenancein_params and finally scsi_task->params too
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 23:28:32 +01:00
Arne Redlich
8baa843d73 scsi-lowlevel: remove scsi_readtoc_params and fix READ TOC format field
Set the format field in the READ TOC CDB (lower nibble of byte 2).

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 23:16:45 +01:00
Arne Redlich
551298adfb scsi-lowlevel: remove scsi_serviceactionin_params and plug potential memleaks
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 22:57:59 +01:00
Arne Redlich
fa158865d2 scsi-lowlevel: remove scsi_modesense6_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 22:47:14 +01:00
Arne Redlich
5f414317dc scsi-lowlevel: remove scsi_inquiry_params and refactor INQUIRY data-in unmarshalling
Split the INQUIRY data-in unmarshalling into smaller chunks, fixing some
potential memory leaks along the way.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 22:46:04 +01:00
Arne Redlich
b5a9ba6159 scsi-lowlevel: remove scsi_readcapacity10_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 22:04:57 +01:00
Arne Redlich
188505a72d scsi-lowlevel: remove scsi_verify16_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:59:42 +01:00
Arne Redlich
de67d86e64 scsi-lowlevel: remove scsi_verify12_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:58:30 +01:00
Arne Redlich
10fd2f560b scsi-lowlevel: remove scsi_verify10_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:57:00 +01:00
Arne Redlich
1dbdd04795 scsi-lowlevel: remove scsi_writeverify16_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:55:01 +01:00
Arne Redlich
a262d07c4b scsi-lowlevel: remove scsi_writeverify12_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:53:44 +01:00
Arne Redlich
fff2527cda scsi-lowlevel: remove scsi_writeverify10_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:52:34 +01:00
Arne Redlich
8169c3e280 scsi-lowlevel: remove scsi_compareandwrite_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:51:10 +01:00
Arne Redlich
9f7f7f1e0d scsi-lowlevel: remove scsi_orwrite_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:48:17 +01:00
Arne Redlich
8f513c23f5 scsi-lowlevel: remove scsi_preventallow_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:46:52 +01:00
Arne Redlich
a02cd53cfc scsi-lowlevel: remove scsi_startstopunit_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:45:02 +01:00
Arne Redlich
3ec1a2147f scsi-lowlevel: remove scsi_write16_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:43:15 +01:00
Arne Redlich
f95d86f762 scsi-lowlevel: remove scsi_write12_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:41:53 +01:00
Arne Redlich
1ca5f447fc scsi-lowlevel: remove scsi_write10_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:40:27 +01:00
Arne Redlich
daed6117c8 scsi-lowlevel: remove scsi_read16_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:38:35 +01:00
Arne Redlich
17eff2d8d9 scsi-lowlevel: remove scsi_read12_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:37:05 +01:00
Arne Redlich
f955449ecc scsi-lowlevel: remove scsi_read10_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:35:37 +01:00
Arne Redlich
d95e811ccf scsi-lowlevel: remove scsi_read6_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:34:08 +01:00
Arne Redlich
76aa2693c4 scsi-lowlevel: remove scsi_reportluns_params
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-18 21:31:11 +01:00
Peter Lieven
5e1d011270 SCSI-LOWLEVEL revert changes to scsi-lowlevel
The memory tracking code reports memory allocated by iscsi_allocate_pdu_with_itt_flags_size() as lost.
This memory is allocated by the iscsi part of libiscsi, but later freed by the lowlevel scsi part. We
will fix this later by introducing an iscsi_task object.
2012-11-12 15:43:29 +01:00