Commit Graph

31 Commits

Author SHA1 Message Date
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
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
ddc5fd903d Use proper include paths in kernel iSCSI code.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-21 16:08:17 +00:00
Edward Tomasz Napierala
b7a65e3936 Make the iSCSI stack use __FBSDID() properly.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-21 15:32:38 +00:00
Edward Tomasz Napierala
e403cfdc57 Fix potential double free that could happen after connection error.
MFC after:	3 days
2014-07-28 21:14:41 +00:00
Hans Petter Selasky
af3b2549c4 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
Glen Barber
37a107a407 Revert r267961, r267973:
These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory
2014-06-27 22:05:21 +00:00
Hans Petter Selasky
3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
2014-06-27 16:33:43 +00:00
Alexander Motin
7a0397fc3b Close the race in older code, that caused connection stuck after r264348.
Reviewed by:	trasz
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2014-04-16 19:59:06 +00:00
Edward Tomasz Napierala
a67051e9f6 Fix typo.
Sponsored by:	The FreeBSD Foundation
2014-04-16 17:39:59 +00:00
Alexander Motin
1f6b2af297 Remove unused val argument value from SYSCTL_INT() calls. 2014-04-11 20:44:09 +00:00
Alexander Motin
35263d6a48 Improve use of socket buffer upcalls.
Use soreadable()/sowriteable() in socket upcalls to avoid extra wakeups
until we have enough data to read or space to write.

Increase partial receive len from 1K to 128K to not wake up on every
received packet.

This significantly reduces locks congestion and CPU usage and improves
throughput for large I/Os on NICs without TSO and LRO.

Reviewed by:	trasz
Sponsored by:	iXsystems, Inc.
2014-04-11 18:26:08 +00:00
Edward Tomasz Napierala
e40779571e Remove hack to pass STAILQ to a function and do it properly instead.
Sponsored by:	The FreeBSD Foundation
2014-04-05 18:41:08 +00:00
Edward Tomasz Napierala
c485ab142f Rework the iSCSI PDU transmit code to avoid lock contention and coalesce
PDUs before sending.

Sponsored by:	The FreeBSD Foundation
2014-04-04 15:49:37 +00:00
Edward Tomasz Napierala
605a34b065 All the iSCSI sysctls are also tunables; advertise that.
Sponsored by:	The FreeBSD Foundation
2014-04-04 08:48:55 +00:00
Edward Tomasz Napierala
16c158a562 We don't need TAILQ for iSCSI PDUs; STAILQ is enough.
Sponsored by:	The FreeBSD Foundation
2014-04-04 08:43:23 +00:00
Edward Tomasz Napierala
d303275e19 Fix build, broken by r264025.
Sponsored by:	The FreeBSD Foundation
2014-04-02 23:07:15 +00:00
Edward Tomasz Napierala
038fc7c630 Enable a KASSERT.
Sponsored by:	The FreeBSD Foundation
2014-04-01 22:21:56 +00:00
Edward Tomasz Napierala
812961f31a Get rid of the "autoscaling", instead just set socket buffer sizes
in the usual way.  The only thing the old code did was making things
less predictable.

Sponsored by:	The FreeBSD Foundation
2014-04-01 22:03:03 +00:00
Edward Tomasz Napierala
ecba49ddfc Instead of "icltx" and "iclrx", use thread names with prefix from upper
layer, so that one can see which side of the stack the threads are for.

Sponsored by:	The FreeBSD Foundation
2014-04-01 21:47:22 +00:00
Edward Tomasz Napierala
6ed8f5d236 Get rid of ICL lock; use upper-layer (initiator or target) lock instead.
This avoids extra locking in icl_pdu_queue(); the upper layer needs to call
it while holding its own lock anyway, to avoid sending PDUs out of order.

Sponsored by:	The FreeBSD Foundation
2014-04-01 21:40:46 +00:00
Edward Tomasz Napierala
717f4815f3 Move the ic_outstanding_count under #ifdef DIAGNOSTIC.
Sponsored by:	The FreeBSD Foundation
2014-03-25 19:17:22 +00:00
Edward Tomasz Napierala
b1277ad1f7 Use a less unusual syntax in debug printfs.
Sponsored by:	The FreeBSD Foundation
2014-03-25 18:30:57 +00:00
Robert Watson
4a14441044 Update kernel inclusions of capability.h to use capsicum.h instead; some
further refinement is required as some device drivers intended to be
portable over FreeBSD versions rely on __FreeBSD_version to decide whether
to include capability.h.

MFC after:	3 weeks
2014-03-16 10:55:57 +00:00
Edward Tomasz Napierala
2901576a0d Fix a rare "truncated checksums" problem, which manifested like this:
WARNING: icl_pdu_check_data_digest: data digest check failed; got 0xf23b,
    should be 0xdb7f23b

Tested by:	Darcy Birkbeck
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-01-07 11:03:57 +00:00
Edward Tomasz Napierala
68ca2e2ebb Fix extremely slow operation with data digests enabled. This was caused
by receive code waiting for data digest even when the data segment was
empty.  It didn't actually read it, but it waited until those four bytes
become available in the socket buffer, i.e. until any other PDU (such as NOP)
came in.

PR:		kern/185240
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2013-12-30 12:18:06 +00:00
Edward Tomasz Napierala
84fb32a371 Don't spin with mutex hold when there is not enough room in the send socket
buffer.  While here, make the code flow somewhat nicer.

Thanks to mav@ for tracking it down.

Tested by:	mav
MFC after:	3 days
Sponsored by:	FreeBSD Foundation
2013-10-24 15:54:06 +00:00
Edward Tomasz Napierala
e49b31f292 Fail connection upon receiving too large data segment.
Approved by:	re (glebius)
Sponsored by:	FreeBSD Foundation
2013-10-09 19:28:56 +00:00
Edward Tomasz Napierala
c28c09c1f0 Don't leak memory when removing an unconnected session, and remove useless
UMA_ZONE_NOFREE that caused another leak when unloading the module.

Approved by:	re (glebius)
Sponsored by:	FreeBSD Foundation
2013-10-04 19:31:41 +00:00
Edward Tomasz Napierala
009ea47eb2 Bring in the new iSCSI target and initiator.
Reviewed by:	ken (parts)
Approved by:	re (delphij)
Sponsored by:	FreeBSD Foundation
2013-09-14 15:29:06 +00:00