Commit Graph

140 Commits

Author SHA1 Message Date
Ronnie Sahlberg
9e09a46ddd LOGIN: Once the login phase has finished, bump ITT by one
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-02 17:51:10 +10:00
Ronnie Sahlberg
819248a519 LOGIN: Dont increment the ITT if the target wants another round of LOGIN
If the login phase takes multiple login requests we should keep the ITT the same for all login requets and not increment it.
A multi-phase login is only a single task eventhough it may be spread across multiple login requetst.

While most targets are forgiving and still work if we increment the ITT for each login command, some targets such as SOLARIS/COMSTAR is NOT forgiving if we break the protocol in this situation.

Fix the ITT handling so that we dont make SOLARIS/COMSTAR upset.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-02 15:41:38 +10:00
Ronnie Sahlberg
812df62bfd SBC: Add GET_LBA_STATUS support and simple test 2012-05-30 18:41:12 +10:00
Ronnie Sahlberg
6be4a82407 Remove some unused variables 2012-05-30 18:23:15 +10:00
Ronnie Sahlberg
824a33c834 win32 set the socket to nonblocking moe for win32 2012-05-15 22:08:10 +10:00
Ronnie Sahlberg
dafa186868 win32: connect.c needs the compatibility functions 2012-05-15 21:54:10 +10:00
Ronnie Sahlberg
201d6c3b54 win32: sinc.c need the compatibility header so it finds the replacement for poll() 2012-05-15 21:51:53 +10:00
Ronnie Sahlberg
05d2f81a84 win32: unistd.h is not available under win32 2012-05-15 21:45:30 +10:00
Ronnie Sahlberg
ec0d9682a7 Dont use FIONREAD just rely on the fact the socket is nonblocking and look for EAGAIN when we reach the end of available data.
From Paolo Bonzini <pbonzini@redhat.com>
2012-05-15 20:32:37 +10:00
Ronnie Sahlberg
83730f7d4c w32: dont export our version of poll. 2012-05-13 17:21:53 +10:00
Ronnie Sahlberg
1c63b55e20 W32: update libiscsi.def with all new and missing symbols 2012-05-13 17:05:25 +10:00
Ronnie Sahlberg
ed4b8ec72e W32: Remove our poor emulation of poll() from the w32 build. 2012-05-13 16:46:38 +10:00
Michael Tokarev
261924d73a export only required symbols, do not export internal symbols from the library
Hopefully I collected the list of symbols to expot correctly.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-05-12 08:46:06 +10:00
Michael Tokarev
aee0e3bf72 always export iscsi_set_tcp_keepalive()
Set only the (socket) options which are defined on a given platform.
The function becomes a no-op if no option is known at complie time.
Remove autoconf test for HAVE_TCP_KEEPALIVE too.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-05-12 08:41:34 +10:00
Ronnie Sahlberg
c91de1e35a We might be called by some eventsystems with POLLIN eventhough there is
no data to read from the socket and there is no error.
For this case, if FIONREAD tells us that there are 0 bytes to read, check if
there is a socket error and return ok/error based on that.

Some eventsystems may cause this to burn some cpu if the socket is ok
but there are no bytes available to read by invoking POLLIN over and over, but it is better than failing the application.
2012-05-10 20:04:22 +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
9e5535adfd Reconnect: If we are logged in and we experience a session failure, then
try to re-connect and redrive all I/O

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-05-01 18:46:30 +10:00
Ronnie Sahlberg
9c6447b73a SENSE: add a sense key and an ascq 2012-04-28 15:03:43 +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
d71a9d4f95 Add support for BLOCK LIMITS VPD page
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-04-20 17:57:40 +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
422bc32ce8 Add support for INQUIRY LOGICAL_BLOCK_PROVISIONING page
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-04-19 20:09:14 +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
6ecf536e86 Rename a varialbe to get rid of compiler warning 2011-12-31 10:31:23 +11:00
Ronnie Sahlberg
114c81390f Remove unused variable 2011-12-31 10:29:41 +11:00
Ronnie Sahlberg
d486d466c8 Cast an expression to get rid of a compiler warning 2011-12-31 10:28:34 +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
8e7e29a52b Remove an unused variable 2011-12-31 10:24:37 +11:00
Ronnie Sahlberg
7b9bdaafb1 TMGMT: dont hardcode the lun we send to to 2, use the lun that is passed in as argument 2011-12-19 15:43:27 +11:00
Ronnie Sahlberg
9bfc3f095d Logout processing is a bit broken since it does not update the cmdsn properly
Copy the code to initialize the cmdsn and expstatsn from nop.c
2011-10-16 13:58:07 +11:00
Ronnie Sahlberg
2f23773390 add sync write10 2011-09-29 22:01:53 +10:00
Paolo Bonzini
217bf6f53e fix warning from -Wswitch 2011-09-21 12:01:39 +02:00
Paolo Bonzini
a1975e90f6 fix warning from -Wuninitialized 2011-09-21 12:00:20 +02:00
Paolo Bonzini
c940381b59 fix warning from -Wsign-compare 2011-09-21 11:51:36 +02:00
Ronnie Sahlberg
3c11c3598b Add a function to cancel a scsi task from libiscsi. 2011-09-19 21:21:40 +10: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
0a9049ad65 remove debug messages 2011-09-10 14:02:22 +10:00
Ronnie Sahlberg
49017fda58 OpenSolaris: Add support for opensolaris 2011-09-01 18:04:29 +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
0be42c8833 If an application specifies zero-copy read-buffers to read the data into
for a read10 call, the application might have specified too few buffers
for the full I/O.
For example if the application tries to read just 512 bytes off a MMC device.

In this case we wopuld run out of buffers and fail with a SEGV.

Instead of failing like this, return NULL from the function to locate a suitable buffer and read the remaining data from the command into the callback buffer instead, just like when no read-buffer at all has been specified.
2011-06-12 10:44:31 +10:00
Ronnie Sahlberg
de97dbdde8 start implementing mode page unmarshalling 2011-04-23 14:02:59 +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