Commit Graph

131 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
d66a906bc2 Make ICL proxy use kernel code for handling iSCSI sequence numbers
for PDUs to/from iscsid(8).  This fixes StatSN for Logout PDUs sent
by iscsi_session_logout().

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-19 14:57:37 +00:00
Edward Tomasz Napierala
2f0586b2ce Make it possible to interrupt proxy-mode iscsid receive.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-19 14:37:24 +00:00
Edward Tomasz Napierala
257cbe3410 Rename icl_proxy.c to icl_soft_proxy.c, to make it clear it's a part
of software ICL backend.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-17 15:21:17 +00:00
Edward Tomasz Napierala
0fbbc37da3 Make iscsi_ioctl_daemon_send() actually work by adding missing locking.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-17 11:59:38 +00:00
Edward Tomasz Napierala
f41492b00f Add icl_conn_connect() ICL method, required for iSER.
Obtained from:	Mellanox Technologies (earlier version)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-17 11:10:44 +00:00
Edward Tomasz Napierala
604c023f94 Extend the ICL interface to include the PDU pointer in the task_setup
method.  This is required for upcoming iSER support.

Obtained from:	Mellanox Technologies (earlier version)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-17 08:55:21 +00:00
Edward Tomasz Napierala
47d8fd8502 Make ICL_KERNEL_PROXY compilable.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-17 07:56:45 +00:00
Pedro F. Giffuni
266078c6db dev/iscsi: minor spelling fixes.
No functional change.

Reviewed by:	trasz
2016-05-03 14:49:49 +00:00
Edward Tomasz Napierala
938bcb04fc Fix iSCSI initiator crash that could happen with out-of-memory
conditions with in-flight IO and subsequent reconnection.

PR:		199117
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5673
2016-03-25 16:01:40 +00:00
Edward Tomasz Napierala
e204e2cd93 Add lock assertion.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-03-18 13:26:16 +00:00
Edward Tomasz Napierala
099ad7abd0 Add a kern.icl.drivers sysctl, to retrieve the list of registered
ICL drivers.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-02-10 19:01:26 +00:00
Edward Tomasz Napierala
c5805a3deb Remove stray semicolons from the iSCSI code.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-02-10 17:55:39 +00:00
Steven Hartland
481b36c66a Close iSCSI sessions on shutdown
Ensure that all iSCSI sessions are correctly terminated during shutdown.

* Enhances the changes done by r286226 (D3052).
* Add shutdown post sync event to run after filesystem shutdown
  (SHUTDOWN_PRI_FIRST) but before CAM shutdown (SHUTDOWN_PRI_DEFAULT).
* Changes iscsi_maintenance_thread to processes terminate in preference to
  reconnect.

Reviewed by:	trasz
MFC after:	2 weeks
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D4429
2016-01-11 10:24:30 +00:00
Navdeep Parhar
1e86840331 MFP r291227, r291228, and r292618.
r291227:
s/is->is_conn/ic to shorten things a bit.

r291228:
Do not generate PDUs with payload greater than max_data_segment_length.

It is perhaps preferable to have a separate limit for send instead of
reusing the receive limit.  I'll discuss with trasz@ and mav@ before
pulling this into head.

r292618:
Add comment to go with r291228.
2015-12-24 02:35:59 +00:00
Navdeep Parhar
c8b73c2cc7 Add comment to go with r291228.
Submitted by:	trasz@
2015-12-22 20:03:49 +00:00
Steven Hartland
c82d74037f Fix panic on shutdown due to iscsi event priority
iscsi's shutdown_pre_sync prio was SHUTDOWN_PRI_FIRST which caused it to
run before other high priority handlers such as filesystems e.g. ZFS.

This meant the iscsi sessions where removed before the ZFS geom consumer
was closed, resulting in a panic from g_access calls on debug kernels
due to negative acr.

Instead use the same as the old iscsi_initiator SHUTDOWN_PRI_DEFAULT-1
which allows it to run before dashutdown etc but after filesystems.

MFC after:	2 weeks
Sponsored by:	Multiplay
2015-12-07 02:56:08 +00:00
Navdeep Parhar
7ceec7e48d Do not generate PDUs with payload greater than max_data_segment_length.
It is perhaps preferable to have a separate limit for send instead of
reusing the receive limit.  I'll discuss with trasz@ and mav@ before
pulling this into head.
2015-11-24 01:12:17 +00:00
Navdeep Parhar
f5cadbc463 s/is->is_conn/ic to shorten things a bit. 2015-11-24 01:07:57 +00:00
Navdeep Parhar
ab875b713d Catch up with head, primarily for the 1.14.4.0 firmware. 2015-08-13 22:01:13 +00:00
Edward Tomasz Napierala
e553ca4994 Rework the way iSCSI initiator handles system shutdown. This fixes
hangs on shutdown with LUNs with mounted filesystems over a disconnected
iSCSI session.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3052
2015-08-03 11:57:11 +00:00
Navdeep Parhar
416ba5c745 Catch up with HEAD (r280229-r284686). 2015-06-22 00:05:22 +00:00
Alexander Motin
5b157f2144 Close some potential races around socket start/close.
There are some reports about panics on ic->ic_socket NULL derefence.
This kind of races is the only way I can imagine it to happen.

MFC after:	2 weeks
2015-05-15 13:36:50 +00:00
Edward Tomasz Napierala
aca050aaaa Remove icl_conn_connected(); was unused.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-04-04 22:11:38 +00:00
Navdeep Parhar
584e633137 Add a field to struct icl_conn for per-connection offload driver state. 2015-03-11 05:54:14 +00:00
Navdeep Parhar
b4943e97bb Initial drop of the hardare accelerated iSCSI driver.
Submitted by:	Sreenivasa Honnur <shonnur at chelsio dot com>
Sponsored by:	Chelsio Communications
2015-02-10 23:48:06 +00:00
Edward Tomasz Napierala
7a03d007cf Extend ICL to add receive offload methods. For software ICL backend
they are no-ops.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-08 19:15:14 +00:00
Edward Tomasz Napierala
d4b195d315 Make output of "iscsictl -v" and "ctladm islist -v" a little prettier
by capitalizing "None".

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-08 10:58:25 +00:00
Edward Tomasz Napierala
5aabcd7c4e Tidy up; no functional changes.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-07 14:15:17 +00:00
Edward Tomasz Napierala
674074da06 Don't call callout_drain() with iscsi mutex held; this fixes a warning
that was introduced recently.  While here, don't try to access is_terminating
without lock.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-05 07:46:34 +00:00
Edward Tomasz Napierala
09f2b94bf4 Fix error handling.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-05 07:16:45 +00:00
Edward Tomasz Napierala
82babffba9 Make it possible to set (via iscsi.conf(5)) and query (via iscsictl -v)
initiator iSCSI offload.  Pass maximum data segment size supported by
chosen offload module to iscsid(8), and make iscsid(8) not try to negotiate
anything larger than that.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-05 06:37:59 +00:00
Alexander Motin
4b0e5c9ef4 Missed addition to r278098.
MFC after:	1 week
2015-02-02 16:06:23 +00:00
Alexander Motin
bebf6a8572 Add some fields and constants from RFC7144.
MFC after:	1 week
2015-02-02 15:59:17 +00:00
Edward Tomasz Napierala
872d2d9276 Use proper module name in MODULE_VERSION().
Sponsored by:	The FreeBSD Foundation
2015-01-31 15:22:45 +00:00
Edward Tomasz Napierala
a6ad7194e0 Drop unneeded include.
Sponsored by:	The FreeBSD Foundation
2015-01-31 15:21:54 +00:00
Edward Tomasz Napierala
9e46a88722 Add two files missed in r277963.
Sponsored by:	The FreeBSD Foundation
2015-01-31 08:03:56 +00:00
Edward Tomasz Napierala
321b17ec15 Add kobj interface between ICL and the rest of the iSCSI stack.
Review note - icl.c was moved to icl_soft.c.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-01-31 07:49:50 +00:00
Alexander Motin
3f9e1172b7 Slightly polish iSCSI parameters negotiation.
MFC after:	1 week
2014-12-19 01:12:22 +00:00
Alexander Motin
2124e3b07f Make sequence numbers checks more strict.
While we don't support MCS, hole in received sequence numbers may mean
only PDU loss.  While we don't support lost PDU recovery, terminate the
connection to avoid stuck commands.

While there, improve handling of sequence numbers wrap after 2^32 PDUs.

MFC after:	2 weeks
2014-12-17 15:13:21 +00:00
Alexander Motin
8b94b5836c For both iSCSI initiator and target increase socket buffer sizes before
establishing connection.

This is a workaround for Chelsio TOE driver, that does not update socket
buffer size in hardware after connection established, and unless that is
done beforehand, kernel code will stuck, attempting to send/receive full
PDU at once.

MFC after:	1 week
2014-11-22 15:09:18 +00:00
Alexander Motin
73e2e95d94 Fix use-after-free introduced in r274843.
I've missed that iscsi_outstanding_remove() frees the second pointer,
so it should no longer be used.  And in fact we don't really need to.

MFC after:	2 weeks
2014-11-22 09:45:32 +00:00
Alexander Motin
c215ad3aa8 Move icl_pdu_get_data() and xpt_done() out of initiator's session lock.
During heavy reads data copying in icl_pdu_get_data() may consume large
percent of CPU time.  Moving it out of the lock significantly reduces
lock hold time and respectively lock congestion on read operations.

MFC after:	2 weeks
2014-11-22 09:05:54 +00:00
Gleb Smirnoff
cfa6009e36 In preparation of merging projects/sendfile, transform bare access to
sb_cc member of struct sockbuf to a couple of inline functions:

sbavail() and sbused()

Right now they are equal, but once notion of "not ready socket buffer data",
will be checked in, they are going to be different.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-11-12 09:57:15 +00:00
Edward Tomasz Napierala
d2d52b0013 s/icl_pdu_new_bhs/icl_pdu_new/; no functional changes, just a little
nicer code.

Sponsored by:	The FreeBSD Foundation
2014-11-03 11:15:51 +00:00
Edward Tomasz Napierala
08c5dbaeb0 s/icl_pdu_new/icl_pdu_new_empty/g; no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-11-03 11:05:23 +00:00
Edward Tomasz Napierala
6cc1e267f3 When removing an iSCSI session, check whether all conditions match,
not if any of them matches.  This fixes "iscsictl -Rn" removing
unrelated sessions.

PR:		194034
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-16 09:09:43 +00:00
Alexander Motin
259f12da87 Make iSCSI connection close somewhat less aggressive.
It allows to push out some final data from the send queue to the socket
before its close.  In particular, it increases chances for logout response
to be delivered to the initiator.
2014-10-09 09:12:08 +00:00
Alexander Motin
3b4ae4621f Remove one second wait for threads exit from icl_conn_close().
Switch it from polling with pause() to using cv_wait()/cv_signal().
2014-10-08 19:54:42 +00:00
Edward Tomasz Napierala
17cf3eb152 Fix LUN discovery for targets that don't support REPORT_LUNS, broken
in r263741.  At least with CTL (slightly modified to report SPC2) there
is still some problem: it doesn't seem to find LUNs higher than 7.

Sponsored by:	The FreeBSD Foundation
2014-09-17 07:55:23 +00:00
Edward Tomasz Napierala
2c5b89e54b Make sure we handle less than zero timeouts in iSCSI initiator and target
in a reasonable way.

Sponsored by:	The FreeBSD Foundation
2014-09-10 14:04:10 +00:00