Make reset handling in iSCSI target RFC-compliant.  This fixes some rare
hangs with Open-iSCSI (Linux).

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8ed0a5d71d40e495bfbc50eccc010915b97100aa)
Make the error message more clear.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f1f4cd9f224f22e9c224f7a9fc8a026d854eb863)
Use a less unusual syntax in debug printfs.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ea00acab004517278f2d7d63a4f20df5d34a73dd)
Fix harmless warning after reconnecting a session and not doing anything
with it.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 522b872251537f2fa2e10f3c7f58fed4b17df55e)
Move the ic_outstanding_count under #ifdef DIAGNOSTIC.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 49eacc91a5f5843b878a707d57fb588c3f3713bb)
Target Transfer Tag is opaque; no need to htonl(3) it.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit cf6f64db9cda7c574b61877807417af3248e73bb)
Rework cfiscsi_datamove_in() to obey expected data transfer length
received from the initiator.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit b46b2184f035b7399cc4585988f4d1d73a7d91b6)
Remove ctl_mem_pool.{c,h}.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 427a2d21c4d21db6b006e9bb60f5259c47517553)
Remove ctl(4) from GENERIC.  Also remove 'options CTL_DISABLE'
and kern.cam.ctl.disable tunable; those were introduced as a workaround
to make it possible to boot GENERIC on low memory machines.

With ctl(4) being built as a module and automatically loaded by ctladm(8),
this makes CTL work out of the box.

Reviewed by:	ken
Sponsored by:	FreeBSD Foundation

(cherry picked from commit 80b8b2f7791585982400714f802d5617862e9c68)

Conflicts:
	sys/arm/conf/ATMEL
	sys/cam/ctl/ctl.c
	sys/sparc64/conf/GENERIC
Make it possible to have multiple CTL worker threads.  Leave the default
of 1 for now.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 02f16a2065d25e53407b1c52f896a60351bba9a4)
Hide CTL messages about SCSI error responses.  Too many users take
them for actual target errors.  They can be enabled back by setting
kern.cam.ctl.verbose=1, or booting with bootverbose.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ce1467af53e91b14b00aa31254188830cd2585fa)
Remove the homegrown ctl_be_block_io allocator, replacing it with UMA.
There is no performance difference.

Reviewed by:	mav@
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 99e9c66846b2e9db802523c030537cd646ad0446)
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

(cherry picked from commit 6bb1f3c7fe2aa95c8f204120e91fafd5526c7432)
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

(cherry picked from commit 9161dabe243a4a11092c20302198ed20482e615f)
Use atomic ops instead of mutexes where appropriate.

Submitted by:	mav@
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit db317ef12f32d61d02a1b78b248a64272e7e1f28)
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

(cherry picked from commit a13245996769b8693e3c5a1adc4d195003e7fd71)
Enable a KASSERT.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7e4afd5dca9c0bf59aea4307406badff8781b109)
Fix build, broken by r264025.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ef9da5b7f97e0241e152076b0861edcc7fadb4e3)
We don't need TAILQ for iSCSI PDUs; STAILQ is enough.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 56ca79568d3301f19ad863974183eb4d206db209)
All the iSCSI sysctls are also tunables; advertise that.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 642cc48cbc384e9dcb70f224116f6f37e62a5467)