Use a thread for the processing of virtio tx descriptors rather
than blocking the vCPU thread. This improves bulk data performance
by ~30-40% and doesn't harm req/resp time for stock netperf runs.

Future work will use a thread pool rather than a thread per tx queue.

Submitted by:	Dinakar Medavaram
Reviewed by:	neel, grehan
Obtained from:	NetApp


git-svn-id: svn://svn.freebsd.org/base/head@249917 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove a comment that shouldn't have gone in.

X-MFC-with:	r249864


git-svn-id: svn://svn.freebsd.org/base/head@249918 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Octeon 2 (6xxx) and newer CPUs don't use the clock CPU speed for its
I/O clock. Thankfully, the simple executive provies a way to querry
the proper clock that works on all models. Move to asking for the SCLK
via this interface.

This gets the serial console working after we start init and open the
console and set the divisor (which turned the output from good to
bad). I can login on the console now.


git-svn-id: svn://svn.freebsd.org/base/head@249919 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Changed ZFS TRIM sysctl from vfs.zfs.trim_disable -> vfs.zfs.trim.enabled
Enabled ZFS TRIM by default

Reviewed by:	pjd (mentor)
Approved by:	pjd (mentor)
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249921 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Don't appease clang static analyzer after all and roll back
the free(3) of mntbuf ... again. There's no point in doing
useless extra work when we're about to exit.

See also r240565.

Not reading file history:	uqs


git-svn-id: svn://svn.freebsd.org/base/head@249924 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add const qualifier to the dst parameter of the ifnet if_output method.


git-svn-id: svn://svn.freebsd.org/base/head@249925 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
On those machines that use critical(9) for counter(9) we need to
include systm.h.


git-svn-id: svn://svn.freebsd.org/base/head@249926 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add usie to LINT.


git-svn-id: svn://svn.freebsd.org/base/head@249927 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Document constantness of dst argument to if_output.

Submitted by:	pluknet


git-svn-id: svn://svn.freebsd.org/base/head@249928 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Removed unneeded tests in dadeletemethodset changing it to return void

Reviewed by:	mav
Approved by:	pjd (mentor)
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249929 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Added a sysctl (kern.geom.dev.delete_max_sectors) to control the maximum
size of a delete request sent to the providing device performed by g_dev_ioctl.

This allows the kernel and apps via ioctl e.g. newfs -E to request large LBA
deletes which siginificantly improves performance.

Previously this was hard coded to 65536 sectors, the new default is 262144
which doubles the throughput of deletes on commonly available SSD's.

In tests on a Intel 520 120GB FW: 400i disk it improved the delete throughput
from 1.6GB/s to over 2.6GB/s on a full disk delete such as that done via
newfs -E

For some SSD's where delete time is pretty much constant, no matter what
the request, setting this to 0 will provide significantly better throughput
e.g. Samsung 840 240GB FW DXT07B0Q @ 262144 = 79G/s, @ 0 = 2259G/s

Reviewed by:	mav
Approved by:	pjd (mentor)
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249930 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Added Dataset Management defines to be used by TRIM in cam ata and scsi to
calculate the size of blocks.

Reviewed by:	mav
Approved by:	pjd (mentor)
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249931 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Added the ability to send ATA identify and Data Set Management (DSM) TRIM
commands to an ATA device attached via a SCSI control.

sys/cam/scsi/scsi_all.c:
        - Added scsi_ata_identify, scsi_ata_trim
          Which use ATA Pass-Through to send commands to the attached disk.

sys/cam/scsi/scsi_all.h:
        - Added defines for all missing ATA Pass-Through commands values.

        - Added scsi_ata_identify, scsi_ata_trim methods used in ATA TRIM
          support.

        - Added scsi_vpd_logical_block_prov structure used when querying for
          the supported sizes UNMAP commands.

        - Added scsi_vpd_block_limits structure used when querying for the
          supported sizes of the UNMAP command.

Reviewed by:	mav
Approved by:	pjd (mentor)
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249933 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Updated TRIM calculations in cam/ata to be based off ATA_DSM_* defines

Reviewed by:	mav
Approved by:	pjd (mentor)
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249934 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Refactored scsi_xpt use of device_has_vpd to generic scsi_vpd_supported_page
so its available for use in generic scsi code.

This is a pre-requirement for using VPD queries to determine available SCSI
delete methods within scsi_da.

Reviewed by:	mav
Approved by:	pjd (mentor)
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249937 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Added available delete methods discovery during device probe, including the
maximum sizes for said methods, which are used when processing BIO_DELETE
requests. This includes updating UNMAP support discovery to be based on
SBC-3 T10/1799-D Revision 31 specification.

Added ATA TRIM support to cam scsi devices via ATA Pass-Through(16)

sys/cam/scsi/scsi_da.c:
        - Added ATA Data Set Management TRIM support via ATA Pass-Through(16)
          as a delete_method

        - Added four new probe states used to identity available methods and their
          limits for the processing of BIO_DELETE commands via both UNMAP and the
          new ATA TRIM commands.

        - Renamed Probe states to better indicate their use

        - Added delete method descriptions used when informing user of issues.

        - Added automatic calculation of the optimum delete mode based on which
          method presents the largest maximum request size as this is most likely
          to result in the best performance.

        - Added WRITE SAME max block limits

        - Updated UNMAP range generation to mirror that used by ATA TRIM, this
          optimises the generation of ranges and fixes a potential overflow
          issue in the count when combining multiple BIO_DELETE requests

        - Added output of warnings about short deletes. This should only ever
          be triggered on devices that fail to correctly advertise their supported
          delete modes / max sizes.

        - Fixed WS16 requests being incorrectly limited to 65535 in length.

Reviewed by:	mav
Approved by:	pjd (mentor)
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249939 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Teach GEOM and CAM about the difference between the max "size" of r/w and delete
requests.

sys/geom/geom_disk.h:
        - Added d_delmaxsize which represents the maximum size of individual
          device delete requests in bytes. This can be used by devices to
          inform geom of their size limitations regarding delete operations
          which are generally different from the read / write limits as data
          is not usually transferred from the host to physical device.

sys/geom/geom_disk.c:
        - Use new d_delmaxsize to calculate the size of chunks passed through to
          the underlying strategy during deletes instead of using read / write
          optimised values. This defaults to d_maxsize if unset (0).

        - Moved d_maxsize default up so it can be used to default d_delmaxsize

sys/cam/ata/ata_da.c:
        - Added d_delmaxsize calculations for TRIM and CFA

sys/cam/scsi/scsi_da.c:
        - Added re-calculation of d_delmaxsize whenever delete_method is set.

        - Added kern.cam.da.X.delete_max sysctl which allows the max size for
          delete requests to be limited. This is useful in preventing timeouts
          on devices who's delete methods are slow. It should be noted that
          this limit is reset then the device delete method is changed and
          that it can only be lowered not increased from the device max.

Reviewed by:	mav
Approved by:	pjd (mentor)


git-svn-id: svn://svn.freebsd.org/base/head@249940 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Added automatic detection of non-rotating media which disables the
use of BIO queue sorting, hence optimising performance for devices
such as SSD's

Reviewed by:	scottl
Approved by:	pjd (mentor)
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@249941 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Bump FreeBSD_version after glebius' changes.


git-svn-id: svn://svn.freebsd.org/base/head@249943 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Move pinmux configuration to board-specific config. It will vary
    from board to board.


git-svn-id: svn://svn.freebsd.org/base/head@249946 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f