Commit Graph

30 Commits

Author SHA1 Message Date
Tim Crawford
9347cfebf2 Replace file variables with .dir-locals.el
Signed-off-by: Tim Crawford <tcrawford@datto.com>
2019-02-21 11:54:02 -05:00
Peter Lieven
fa123fc397 abstract transport to static driver functions and opaque driver specific information.
This splits a transport into static driver specific functions for the common
iscsi commands. Optionally, a driver specific opaque memory is introduced
which is currently only used by iSER transport.
Last a lot of functions changed to static.

Signed-off-by: Peter Lieven <pl@kamp.de>
2016-08-05 11:28:43 +02:00
Ronnie Sahlberg
37507c994a Add back iscsi_queue_pdu
We need a public symbol for iscsi_queue_pdu. This is now just a
simple wrapper around iscsi->t->queue_pdu

https://github.com/sahlberg/libiscsi/issues/212

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-07-11 18:37:25 -07:00
Roy Shterman
6c1bdb4808 Libiscsi: Adding free_pdu function to transport abstraction
Signed-off-by: Roy Shterman <roysh@mellanox.com>
2016-06-03 18:47:23 -07:00
Roy Shterman
e3df0bbf96 Libiscsi: Adding queue pdu function to transport abstraction
include/iscsi-private: adding queue_pdu in transport function pointers
                       struct
include/iscsi: declaration of tcp_queue_pdu function

socket: adding queue_pdu function to transport initialization

all_library: changing iscsi_queue_pdu into iscsi->t->queue_pdu

Signed-off-by: Roy Shterman <roysh@mellanox.com>
2016-06-03 18:44:51 -07:00
Peter Lieven
423b82efa4 pdu: check callback for NULL everywhere
Signed-off-by: Peter Lieven <pl@kamp.de>
2016-05-02 13:55:13 +02:00
David Disseldorp
c38a8c1d9a task_mgmt: don't cancel local PDUs on ABORT TASK
Currently the iscsi_task_mgmt_abort_task_[a]sync() functions cancel any
queued or dispatched (awaiting response) PDUs prior to transmitting the
ABORT TASK TMF request, which means that a TMF request may be sent which
references a PDU that the target never received.

Bug: https://github.com/sahlberg/libiscsi/issues/192

Signed-off-by: David Disseldorp <ddiss@suse.de>
2016-03-22 21:12:09 +01:00
Ronnie Sahlberg
99a5f99527 Add some emacs defaults. Tabs are 8 spaces.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-18 21:34:43 -08:00
Peter Lieven
b3ad565783 pdu: move update of maxcmdsn, expcmdsn & statsn to iscsi_process_pdu
Signed-off-by: Peter Lieven <pl@kamp.de>
2015-04-20 14:46:44 +02:00
Peter Lieven
153e6ba07c pdu: set pdu->cmdsn when the pdu structure is updated
Signed-off-by: Peter Lieven <pl@kamp.de>
2015-03-30 12:32:03 +02:00
Ronnie Sahlberg
63c2e7583d task_mgmt.c: drop tmgmt pdus on reconnect
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-23 20:31:25 -08:00
Ronnie Sahlberg
511c2fdbd1 pdu.c: remove iscsi_allocate_pdu_with_itt_flags()
Remove iscsi_allocate_pdu() which is just a wrapper.
Rename iscsi_allocate_pdu_with_itt_flags() to iscsi_allocate_pdu()
and update all callers.

This only removes a wrapper function and contains no logic changes.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-23 20:26:22 -08:00
Peter Lieven
4e129d385c pdu: fix statsn and factor out sn comparision
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-06-17 14:58:38 +02: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
402653b9f3 portability updates
add check if ipv6/sockaddr_in6 is availavble or not
add check for poll.h and only include when available
add includes for AROS
2013-04-18 19:43:36 -07:00
Peter Lieven
cd09c0f17d PDU use serial32 arithmetic for cmdsn, maxcmdsn and expcmdsn.
RFC3720 says that cmdsn comparison must be done using
serial32 arithmetic. This will definetly avoid a deadlock
if cmdsn wraps from 2^32-1 to 0.

Signed-off-by: Peter Lieven <pl@kamp.de>
2012-11-28 10:37:28 +01:00
Bernhard Kohl
6644389907 Use the (un)marshalling functions scsi_get/set_uint16/32() anywhere in the code
This has the nice side effect to remove the compiler warning
"dereferencing type-punned pointer will break strict-aliasing rules"
which occur since gcc-4.7.

There are 79 locations where the warning occurs. All of them are in
statements where the htonl/htons/ntohl/ntohs functions are used, e.g.:

in lib/pdu.c                itt = ntohl(*(uint32_t *)&in->hdr[16]);
in lib/scsi-lowlevel.c      *(uint32_t *)&task->cdb[2] = htonl(lba);

The warning is not related to the htonl/htons/ntohl/ntohs functions but
to the casting/dereferencing operation. If the dereferenced variable is
already a pointer, the warning does not not occur, e.g. this one:

in lib/pdu.c                itt = ntohl(*(uint32_t *)&in->data[16]);

The warning is caused by the -fstrict-aliasing option. The
-fstrict-aliasing option is enabled at optimization levels -O2, -O3, -Os.

Signed-off-by: Bernhard Kohl <bernhard.kohl@gmx.net>
2012-11-23 16:47:32 -08:00
Ronnie Sahlberg
3b05e9996f Move cancel_task and cancel_all_tasks from scsi-lowlevel.c to scsi-command.c
These two functions belong in the iscsi layer, not the scsi layer so move them
out from scsi-lowlevel.c so that we can start turning scsi-lowlevel.c to a pure
scsi layer and remove all dependencies to iscsi from it.
2012-11-11 09:44:11 -08:00
Ronnie Sahlberg
71be26ad03 Add tracking of MAXCMDSN 2012-08-02 09:09:22 +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
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
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
bceb3d058d TYPO: fix error strings to "trying TO send ..." 2011-04-06 17:47:55 +10:00
Ronnie Sahlberg
e93ad2f039 Fix a cut-n-paste typo in an error message 2011-04-05 12:24:59 +10:00
Ronnie Sahlberg
c07dee474c TaskManagement: Add LunReset, TargetWarmReset, TargetColdReset 2011-02-19 18:23:03 +11:00
Ronnie Sahlberg
6a2a8b5187 TaskManagement: Add a function for abort task set 2011-02-19 18:18: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
09446737aa TaskMgmt: add a enum for the task management functions 2011-02-15 22:03:41 +11:00
Ronnie Sahlberg
3dfdebcba7 TaskMgmt : Add an initial function to create a iscsi tm PDU 2011-02-15 21:53:47 +11:00