Add more formal and strict command parsing and validation.

For every supported command define CDB length and mask of bits that are
allowed to be set.  This allows to remove bunch of checks through the code
and still make the validation more strict.  To properly do it for commands
supporting multiple service actions, formalize their parsing by adding
subtables for each of such commands.

As visible effect, this change allows to add support for REPORT SUPPORTED
OPERATION CODES command, reporting to client all the data about supported
SCSI commands, except timeouts.

MFC after:	2 weeks

(cherry picked from commit 68790c55907cfefd2306c307bf84d7dc526ad163)
Add support for REPORT TIMESTAMP command.

MFC after:	2 weeks

(cherry picked from commit 7eb84da710650ecb94d95025618eff013d32a6f3)
Remove targ_enable()/targ_disable() frontend methods.

Those methods were never implemented, and I believe that their concept is
wrong, since single frontend (SCSI port) can not handle several targets.

(cherry picked from commit c9aabd0ff96f0a2797a5bf64144a2ad160e620c6)
Separate concepts of frontend and port.

Before iSCSI implementation CTL had no knowledge about frontend drivers,
it had only frontends, which really were ports (alike to LUNs, if comparing
to backends).  But iSCSI added there ioctl() method, which does not belong
to frontend as a port, but belongs to a frontend driver.

(cherry picked from commit 43424a09728bc2c362d6899b02a1a0587326ef29)

Conflicts:
	sys/cam/ctl/scsi_ctl.c
Use proper links field for ports linking.

(cherry picked from commit c3a321909bfde2143544687ef657505df2073dbc)
Make options KPI more generic to allow it to be used for ports too,
not only for LUNs.

(cherry picked from commit 5ec7bb54efdc7d09277b000aa7862840b99d24ff)

Conflicts:
	sys/cam/ctl/ctl_frontend_iscsi.c
Introduce new IOCTL CTL_PORT_LIST reporting in more flexible XML format.

Leave old CTL_GET_PORT_LIST in place so far.  Garbage-collect it later.

(cherry picked from commit 28432b0ce5a74d0cf2e0dad9d0e76c3be10d5dc3)
Implement and use ctl_frontend_find().

(cherry picked from commit cd2bf77221bc5ca0b3bc700494ceb7267a9c276c)
Improve CTL_BEARG_* flags support, including optional values copyout.

(cherry picked from commit 6a3d6f39825c967975be57c4826c2a2c91803940)
Create separate CTL port for every iSCSI target (and maybe portal group).

Having single port for all iSCSI connections makes problematic implementing
some more advanced SCSI functionality in CTL, that require proper ports
enumeration and identification.

This change extends CTL iSCSI API, making ctld daemon to control list of
iSCSI ports in CTL.  When new target is defined in config fine, ctld will
create respective port in CTL.  When target is removed -- port will be
also removed after all active commands through that port properly aborted.
This change require ctld to be rebuilt to match the kernel.

As a minor side effect, this allows to have iSCSI targets without LUNs.
While that may look odd and not very useful, that is not incorrect.

(cherry picked from commit 4e932574fbef709769d2454c9f2aa543e4371d1b)

Conflicts:
	usr.sbin/ctld/ctld.h
Burry devid port method, which was a gross hack.

Instead make ports provide wanted port and target IDs, and LUNs provide
wanted LUN IDs.  After that core Device ID VPD code only had to link all
of them together and add relative port and port group numbers.

LUN ID for iSCSI LUNs no longer created by CTL, but by ctld, and passed
to CTL as "scsiname" LUN option.  This makes LUNs to report the same set
of IDs, independently from the port through which it is accessed, as
required by SCSI specifications.

(cherry picked from commit dd9568e89220188d1c2f0861713f1ec90ccaae02)

Conflicts:
	sys/cam/ctl/ctl_frontend_iscsi.c
Pass through iSCSI session ISID from LOGIN request to the CTL frontend.

ISID is an important part of initiator transport ID for iSCSI.  It is not
used now, but should be to properly implement persistent reservation.

(cherry picked from commit e3cec6db55cb1225d5dd300275ea0821b98e400e)
Relax some bit checks for INQUIRY command.

FreeBSD still tries to put LUN number in second byte until it get device
protocol version, even that it was obsoleted about 20 years ago.

(cherry picked from commit 1bf007c8086750123e3746021e59b6022ec7ae97)
Move lun_map() method from command nexus to port.

Previous implementation made impossible to do some things, such as calling
it for ports other then one through which command arrived.

(cherry picked from commit a50500ead5f0e5703333d6f631e2ba9508b56f5b)
Make REPORT TARGET PORT GROUPS command report realistic data instead of
hardcoded garbage.

(cherry picked from commit 30f8b78b35bffda7e4d698be06dee0c25c62a300)
Add support for SCSI Ports (88h) VPD page.

(cherry picked from commit 832ad256f9e19e41d418f827617f264f67899855)
Close race in r268291 between port destruction, delayed by sessions
teardown, and new port creation during `service ctld restart`.

Close it by returning iSCSI port internal state, that allows to identify
dying ports, which should not be counted as existing, from really alive.

(cherry picked from commit ac68a20a27159e0ed74698fc31e53c56228aa396)
Make gcc happy, init idlen2.

(cherry picked from commit 67a3cc14e4271143b6cfac66524950035bc00f57)
Implement ABORT TASK SET and I_T NEXUS RESET task management functions.

Use the last one to terminate active commands on iSCSI session termination.
Previous code was aborting only commands doing some data moves.

(cherry picked from commit c28c880da743bc507647c5fdbfd2fe3c5a8d1aa6)
When new connection comes in, check whether we already have session from
the same intiator (Name+ISID).  If so -- terminate the old session and let
the new one take its place, as required by iSCSI RFC.

(cherry picked from commit 17f8e3065c7be0c80b168ee0ce8399837fa18115)

Conflicts:
	sys/cam/ctl/ctl_frontend_iscsi.h