Add support for Mode Page Policy (0x87) VPD page.

(cherry picked from commit abf46035ae02b6750dbf028666f3c3711f3bc000)
Oops, missed piece of r271311.

(cherry picked from commit fbe6280d13eacb04a9b0c1ec0f36678b1f56f962)
Report that DPO and FUA bits are supported after r271311.

(cherry picked from commit d6b90c0b3c0363c5f1f3a10a561e13dd71e502c0)
Fix minor buffer overflow reported by Coverity.

CID:		1006781
(cherry picked from commit aa30f2d2de093521ce4245a97a46a41c52ffb3ad)
Fix memory leak on error, reported by Coverity.

CID:		1007773
(cherry picked from commit 8633346319dd121efa70e40e0be37acc9551d378)
Fix couple off-by-one range check errors, reported by Coverity.

CID:		1007837
(cherry picked from commit a209c226c546b8b98b04ded0d3980e500c3a626e)
Fix array overrun, reported by Coverity.

CID:		1229970
(cherry picked from commit 4db7e51eb21db397e3251d89396446e11e97972a)
Remove uninitialized and unused variable, reported by Coverity.

CID:		1230015
(cherry picked from commit 20136fb37c5697db2a887bebc4240379d685aa90)
Make ctl_port_mask an array to support more then 32 ports.

Overflow reported by Coverity.

CID:		1229894
MFC after:	3 days

(cherry picked from commit 645f3f53cf53a90202ed8efe564952087b9447ad)
Make it possible to disable NOP-In PDUs by the iSCSI initiator by setting
kern.cam.ctl.iscsi.ping_timeout to 0.  This fixes interoperability with
some initiators that don't properly support NOP-Ins, namely iPXE/gPXE.

Submitted by:	Chen Wen <pokkys@gmail.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 6cacb7cf778fd2c20de9f18c03dab6cfd10d015a)
Make sure we handle less than zero timeouts in iSCSI initiator and target
in a reasonable way.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d8aaa0480ad6b6338180fa978ed574f0cb35004c)
Add support for Extended INQUIRY Data (0x86) VPD page.

(cherry picked from commit a132abedb0496e25270631e950c8089692b13d8b)
Implement range checks between UNMAP and READ/WRITE commands.

Before this change UNMAP completely blocked other I/Os while running.
Now it blocks only colliding ones, slowing down others only due to ZFS
locks collisions.

Sponsored by:	iXsystems, Inc.

(cherry picked from commit d38ee298689653c70b76d3fe5f498287ca706fa6)
Add "readcache" and "writecache" LUN options to control default behavior.

Default values are "on".  Disabling requires backend to support IO_DIRECT
and IO_SYNC flags respectively, or some alternatives.

(cherry picked from commit 20d551b720cdef4df77f1910630877f3b6a4d7a8)
Implement control over command reordering via options and control mode page.

It allows to bypass range checks between UNMAP and READ/WRITE commands,
which may introduce additional delays while waiting for UNMAP parameters.
READ and WRITE commands are always processed in safe order since their
range checks are almost free.

(cherry picked from commit 01d0aad79892713eb6cabc3287091a9568d492b1)
Remove redundant code.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 517f4fff73c6b7fef6dd61dc9a2c797c2a073f9e)
Remove unused variable.

(cherry picked from commit 0c37f4aebf437b4a5042a339474f87f7283dae81)
Use proper term in debug messages.

MFC after:	1 month
Sponsored by:	FreeBSD Foundation

(cherry picked from commit 42b427986a951350e36787287a22cf9dfc81417d)
Improve code a little; no functional changes.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7e30e0160a5ae7d50e45b1024674298c6ef8c981)
Get rid of unneccessary argument.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9975d0a2a6425a1d7affd9ed8615f3f9d43d1b4f)