MFC 270830:
When anouncing link state changes on an 802.11 interface with a vap,
announce the change on the vap's ifnet instead of the main ifnet.  This
matches the behavior of other wireless drivers in the tree and allows the
default devd configuration to correctly start dhclient automatically after
an ndis wireless device associates.

Approved by:	re (marius for 10)
MFC r268854
Initiate error recovery stats fail to update after 3 retries.
Change bxe_panic() ECORE_DBG_BREAK_IF() ECORE_BUG() ECORE_BUG_ON() to
panic only if ECORE_STOP_ON_ERROR is defined.

Approved by: re(gjb)
MFC Clang debuginfo crash fix

r271432: Merge upstream Clang rev 205331 debuginfo crash fix:

      Debug info: fix a crash when emitting IndirectFieldDecls, which were
      previously not handled at all.
      rdar://problem/16348575

r271433: Add clang patch corresponding to r271432

Approved by:	re
Sponsored by:	DARPA, AFRL
MFC r271445,r271446,r271560:
Improve markup and language throughout the ctl.conf man page

MFC r271543:
Add the new iscsi(4) man page
Cross reference it from iscsid(8) and iscsictl(8)

Approved by:	re (gjb), bcr (mentor)
MFC r271597:

Pull in r217410 from upstream llvm trunk (by Bob Wilson):

  Set trunc store action to Expand for all X86 targets.

  When compiling without SSE2, isTruncStoreLegal(F64, F32) would return
  Legal, whereas with SSE2 it would return Expand. And since the Target
  doesn't seem to actually handle a truncstore for double -> float, it
  would just output a store of a full double in the space for a float
  hence overwriting other bits on the stack.

  Patch by Luqman Aden!

This should fix clang -O0 on i386 assigning garbage to floats, in
certain scenarios.

PR:		187437
Submitted by:	cebd@gmail.com
Approved by:	re (marius)
Obtained from:	http://llvm.org/viewvc/llvm-project?rev=217410&view=rev
MFC r270673:
Announce SCTP support in the kern.features sysctl variables.

MFC r270859:
Enable SCTP support. It runs perfectly fine on a Wandboard quad.

MFC r271204 with manual intervention:
Fix the handling of sysctl variables when used with VIMAGE.
While there do some cleanup of the code.

MFC r271209:
Fix a leak of an address, if the address is scheduled for removal
and the stack is torn down.
Thanks to Peter Bostroem and Jiayang Liu from Google for reporting the
issue.

MFC r271219:
Use SYSCTL_PROC instead of SYSCTL_VNET_PROC.
Suggested by: glebius@

MFC r271221:
Use union sctp_sockstore instead of struct sockaddr_storage. This
eliminates some warnings when building in userland.
Thanks to Patrick Laimbock for reporting this issue.
Remove also some unnecessary casts.
There should be no functional change.

MFC r271228:
Address another warnings reported by Patrick Laimbock when compiling
in userspace. While there, improve consistency.

MFC r271230:
Address warnings generated by the clang analyzer.

Approved by: re (kib)
MFC r271644:
Add quirks to disable READ CAPACITY (16) for PNY USB 3.0 Flash Drives.

Submitted by:	Sean Fagan <sef@ixsystems.com>
Approved by:	re (kib)
MFC r271643:
Chunk IDs are 8 bit entities, not 16 bit.
Thanks to Peter Kasting from Google for drawing
my attention to it.

MFC r271665:
The MTU is handled as a 32-bit entity within the SCTP stack.
This was reported by Peter Kasting from Google.

MFC r271670:
Make a type conversion explicit. When compiling this code on
Windows as part of the SCTP userland stack, this fixes a
warning reported by Peter Kasting from Google.

MFC r271672:
Small cleanup which addresses a warning regaring the truncation
of a 64-bit entity to a 32-bit entity. This issue was reported by
Peter Kasting from Google.

MFC r271673:
Use a consistent type for the number of HMAC algorithms.
This fixes a bug which resulted in a warning on the userland
stack, when compiled on Windows.
Thanks to Peter Kasting from Google for reporting the issue and
provinding a potential fix.

MFC r271674:
Add a explict cast to silence a warning when building
the userland stack on Windows.
This issue was reported by Peter Kasting from Google.

Approved by: re (kib)
MFC r271571:

Fix two small nits in ctl.conf(5).

Approved by:	re (glebius)
Sponsored by:	The FreeBSD Foundation
MFH (r271255): fix parsing of ipv6 nameserver lines

Approved by:	re (kib)
MFH (r271256, r271617): avoid segfault if PAM_RHOST nor PAM_TTY are unset.

Approved by:	re (gjb)
PR:		83099
vt(4): Merge several bug fixes and improvements

SVN revisions in this MFC:
  269779 270705 270706 271180 271250 271253 271682 271684

Detailed commit list:

r269779:
  fbd: Fix a bug where vt_fb_attach() success would be considered a failure

  vt_fb_attach() currently always returns 0, but it could return a code
  defined in errno.h. However, it doesn't return a CN_* code. So checking
  its return value against CN_DEAD (which is 0) is incorrect, and in this
  case, a success becomes a failure.

  The consequence was unimportant, because the caller (drm_fb_helper.c)
  would only log an error message in this case. The console would still
  work.

  Approved by:	nwhitehorn

r270705:
  vt(4): Add cngrab() and cnungrab() callbacks

  They are used when a panic occurs or when entering a DDB session for
  instance.

  cngrab() forces a vt-switch to the console window, no matter if the
  original window is another terminal or an X session. However, cnungrab()
  doesn't vt-switch back to the original window currently.

r270706:
  drm: Don't "taskqueue" vt-switch if under DDB/panic situation

  If DDB is active, we can't use a taskqueue thread to switch away from
  the X window, because this thread can't run.

  Reviewed by:	ray@
  Approved by:	ray@

r271180:
  vt_vga: vd_setpixel_t and vd_drawrect_t are noop in text mode

r271250:
  vt(4): Change the terminal and buffer sizes, even without a font

  This fixes a bug where scroll lock would not work for tty #0 when using
  vt_vga's textmode. The reason was that this window is created with a
  static 256x100 buffer, larger than the real size of 80x25.

  Now, in vt_change_font() and vt_compute_drawable_area(), we still
  perform operations even of the window has no font loaded (this is the
  case in textmode here vw->vw_font == NULL). One of these operation
  resizes the buffer accordingly.

  In vt_compute_drawable_area(), we take the terminal size as is (ie.
  80x25) for the drawable area.

  The font argument to vt_set_border() is removed (it was never used) and
  the code now uses the computed drawable area instead of re-doing its own
  calculation.

  Reported by:	Harald Schmalzbauer <h.schmalzbauer_omnilan.de>
  Tested by:	Harald Schmalzbauer <h.schmalzbauer_omnilan.de>

r271253:
  pause_sbt(): Take the cold path (ie. use DELAY()) if KDB is active

  This fixes a panic in the i915 driver when one uses debug.kdb.enter=1
  under vt(4).

  PR:		193269
  Reported by:	emaste@
  Submitted by:	avg@

r271682:
  vt(4): Fix a LOR which occurs during a call to vt_upgrade()

  Reported by:	kib@
  Review:		https://reviews.freebsd.org/D785
  Reviewed by:	ray@
  Approved by:	ray@

r271684:
  vt(4): Use vt_fb_drawrect() and vt_fb_setpixel() in all vt_fb-derivative

  Review:		https://reviews.freebsd.org/D789
  Reviewed by:	nwhitehorn
  Approved by:	nwhitehorn

Approved by:	re (gjb)
MFC tty fixes, r259549 and r259663

Keep tty_makedev as a function to preserve the KBI on 10-stable
(it is a macro in CURRENT). The changes for this are direct
commits to 10-stable.

r259549 (glebius):
  - Rename tty_makedev() into tty_makedevf() and make it capable
    to fail and return error.
  - Use make_dev_p() in tty_makedevf() instead of make_dev_cred().
  - Always pass MAKEDEV_CHECKNAME flag.
  - Optionally pass MAKEDEV_REF flag.
  - Provide macro for compatibility with old API.

  This fixes races with simultaneous creation and desctruction of
  ttys, and makes it possible to call tty_makedevf() from device
  cloners.

  A race in tty_watermarks() still exist, since the latter drops
  lock for M_WAITOK allocation. This will be addressed in separate
  commit.

r259663 (glebius):
  Move list of ttys handling from the allocating procedures, to the
  device creation stage. A device creation can fail, and in that case
  an entry already on the list will be freed.

KBI issue pointed out by:       kib
Reviewed by:    kib (KBI addition)
Approved by:    re (kib)
MFC r271429:
Persist vdev_resilver_txg changes to avoid panic caused by validation
vs a vdev_resilver_txg value from a previous resilver.

Approved by:	re (glebius)
Sponsored by:	Multiplay
MFC r271552:

Make the default choice for the chroot shell at the end be "No". This allows
just pressing enter repeatedly to successfully install a reasonable system.

Approved by:	re (gjb)
MFC r257770 r257818 r257823 r260066 r260067 r260089 r260145 r268587 r268588
    r268589 r268590 r268593 r268597 r269758 r270845 r270847 r270893 r270932
    r270947 r271147

Merge libm work by kargl, bde and das from the past few months.
Besides optimisations and small bug fixes this includes new implementations
for C99 functions expl, coshl, sinhl, tanhl, erfl and erfcl.

Approved by:	re (kib)
MFC r271563:
Make the root-on-zfs part of the installer warn a user who booted the
installer via UEFI that we do not support booting ZFS via UEFI yet

PR:		193595
Approved by:	re (gjb), nwhitehorn
Sponsored by:	ScaleEngine Inc.
MFC r271676, r271677, r271678:

r271676:
  Catch up with Crochet changes to fix the BEAGLEBONE
  build.

r271677:
  Catch up with Crochet changes to fix the WANDBOARD-QUAD
  build.

r271678:
  Set a static revision of the Crochet checkout to avoid
  surprise build failures.

Approved by:	re (marius)
Sponsored by:	The FreeBSD Foundation
MFC nmdm driver changes, r259550 and r271350

r259550 (glebius):
 Make nmdm(4) destroy devices when both sides of a pair are disconnected.
 This makes it possible to kldunload nmdm.ko when there are no users of it.

r271350:
 Fix issue with nmdm and leading zeros in device name.

 The nmdm code enforces a number between the 'nmdm' and 'A|B' portions
 of the device name. This is then used as a unit number, and sprintf'd
 back into the tty name. If leading zeros were used in the name,
 the created device name is different than the string used for the
 clone-open (e.g. /dev/nmdm0001A will result in /dev/nmdm1A).

 Since unit numbers are no longer required with the updated tty
 code, there seems to be no reason to force the string to be a
 number. The fix is to allow an arbitrary string between
 'nmdm' and 'A|B', within the constraints of devfs names. This allows
 all existing user of numeric strings to continue to work, and also
 allows more meaningful names to be used, such as bhyve VM names.

PR:	192281
Approved by:	re (glebius)
drm/i915: Add HW context support

This feature is required by Mesa 9.2+. Without this, a GL application
crashes with the following message:
    # glxinfo
    name of display: :0.0
    Gen6+ requires Kernel 3.6 or later.
    Assertion failed: (ctx->Version > 0), function handle_first_current,
      file ../../src/mesa/main/context.c, line 1498.
    Abort (core dumped)

Now, Mesa 10.2.4 and 10.3-rc3 works fine:
    # glxinfo
    name of display: :0
    display: :0  screen: 0
    direct rendering: Yes
    ...
    OpenGL renderer string: Mesa DRI Intel(R) 965GM
    OpenGL version string: 2.1 Mesa 10.2.4
    ...

The code was imported from Linux 3.8.13.

This an MFC of r271705.

Approved by:	re (glebius)
Reviewed by:	kib@
Tested by:	kwm@, danfe@, Henry Hu,
		Lundberg, Johannes <johannes@brilliantservice.co.jp>,
		Johannes Dieterich <dieterich.joh@gmail.com>,
		Lutz Bichler <lutz.bichler@gmail.com>,
Relnotes:	yes