]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
7 years agoMFH (r308297): use what(1) instead of strings(1).
des [Sat, 10 Dec 2016 20:24:22 +0000 (20:24 +0000)]
MFH (r308297): use what(1) instead of strings(1).

PR: 213665
Submitted by: Pawel Worach <pawel.worach@gmail.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@309830 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH (r296659): the IPv6 address of the L root changed earlier this year
des [Sat, 10 Dec 2016 20:23:16 +0000 (20:23 +0000)]
MFH (r296659): the IPv6 address of the L root changed earlier this year

git-svn-id: svn://svn.freebsd.org/base/stable/10@309829 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r309544:
bapt [Sat, 10 Dec 2016 11:37:05 +0000 (11:37 +0000)]
MFC r309544:

Import tzdata 2016j

git-svn-id: svn://svn.freebsd.org/base/stable/10@309793 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r309184:
delphij [Sat, 10 Dec 2016 06:27:45 +0000 (06:27 +0000)]
MFC r309184:

style(9) indent changes, no actual code change.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309789 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r309298: libm: remove duplicate version script entries
emaste [Fri, 9 Dec 2016 17:17:37 +0000 (17:17 +0000)]
MFC r309298: libm: remove duplicate version script entries

These symbols already appear in the common lib/msun/Symbol.map.
Duplicate entries produce an error with LLVM's LLD linker.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@309740 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 309613: cxgbe(4): Update firmwares from version 1.16.12.0 to 1.16.22.0.
jhb [Fri, 9 Dec 2016 01:44:26 +0000 (01:44 +0000)]
MFC 309613: cxgbe(4): Update firmwares from version 1.16.12.0 to 1.16.22.0.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@309724 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoPartial MFC r309300:
mm [Thu, 8 Dec 2016 01:07:00 +0000 (01:07 +0000)]
Partial MFC r309300:

Apply fix for libarchive issue #821:
  "tar -P" cannot extract hardlinks through symlinks

PR: 213255
Reported by: Tijl Coosemans <tilj@FreeBSD.org>

git-svn-id: svn://svn.freebsd.org/base/stable/10@309702 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMerge rr309688: address regressions in SA-16:37.libc.
glebius [Wed, 7 Dec 2016 23:20:26 +0000 (23:20 +0000)]
Merge rr309688: address regressions in SA-16:37.libc.

PR: 215105
Submitted by: <jtd2004a sbcglobal.net>

git-svn-id: svn://svn.freebsd.org/base/stable/10@309690 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoDocument EN-16:19, EN-16:20, EN-16:21, SA-16:36, SA-16:37, SA-16:38.
gjb [Wed, 7 Dec 2016 18:55:55 +0000 (18:55 +0000)]
Document EN-16:19, EN-16:20, EN-16:21, SA-16:36, SA-16:37, SA-16:38.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@309680 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/11 r309661:
ngie [Wed, 7 Dec 2016 00:57:15 +0000 (00:57 +0000)]
MFstable/11 r309661:

MFC r306962:
r306962 (by br):

Ensure data in pipe is available to read.
Useful for latest (5th, direct mode) test only.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309662 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMerge r309640 from head:
glebius [Tue, 6 Dec 2016 18:55:01 +0000 (18:55 +0000)]
Merge r309640 from head:

  Fix possible integer overflow in guest memory bounds checking, which could
  lead to access from the virtual machine to the heap of the bhyve(8) process.

Submitted by: Felix Wilhelm <fwilhelm ernw.de>
Patch by: grehan
Security: FreeBSD-SA-16:38.bhyve

git-svn-id: svn://svn.freebsd.org/base/stable/10@309648 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMerge r309639 from head:
glebius [Tue, 6 Dec 2016 18:53:46 +0000 (18:53 +0000)]
Merge r309639 from head:

  Fix possible buffer overflow(s) in link_ntoa(3).

  A specially crafted sockaddr_dl argument can trigger a static buffer overflow
  in the libc library, with possibility to rewrite with arbitrary data following
  static buffers that belong to other library functions.

Reviewed by: kib
Security: FreeBSD-SA-16:37.libc

git-svn-id: svn://svn.freebsd.org/base/stable/10@309645 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMerge r309638 from head:
glebius [Tue, 6 Dec 2016 18:52:18 +0000 (18:52 +0000)]
Merge r309638 from head:

  When telnetd(8) composes argument list for login(1), an unexpected sequence
  of memory allocation failures combined with insufficient error checking
  could result in the construction and execution of an argument sequence that
  was not intended.

  Fix that treating malloc(3) failures as fatal condition.

Submitted by: brooks
Security: FreeBSD-SA-16:36.telnetd

git-svn-id: svn://svn.freebsd.org/base/stable/10@309642 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r309282: Explicitly initialize cdai.flags.
mav [Tue, 6 Dec 2016 17:10:17 +0000 (17:10 +0000)]
MFC r309282: Explicitly initialize cdai.flags.

In SES driver uninitialized value caused unreliable physpath reporting.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309629 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r309332:
dim [Tue, 6 Dec 2016 07:33:49 +0000 (07:33 +0000)]
MFC r309332:

Cleanup old debug dirs in delete-old-dirs target

Any .debug or .symbols files under /usr/lib/debug which correspond to
OLD_FILES entries in ObsoleteFiles.inc are also automatically cleaned up
by the delete-old target.  Make this also apply to any OLD_DIRS entries.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D8683

git-svn-id: svn://svn.freebsd.org/base/stable/10@309605 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/11 r309600:
ngie [Tue, 6 Dec 2016 04:38:08 +0000 (04:38 +0000)]
MFstable/11 r309600:

MFC r307220:
r307220 (by br):

Fix typos: use correct string format and value to compare.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309601 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 308066: cxgbe(4): Accurate statistics for all chip settings.
jhb [Mon, 5 Dec 2016 23:55:53 +0000 (23:55 +0000)]
MFC 308066: cxgbe(4): Accurate statistics for all chip settings.

There are 4 independent knobs in T5+ chips to include or exclude PAUSE
frames from the "total frames" and "multicast frames" counters in either
direction.  This change lets the driver deal with any combination of
these settings.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309580 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 307876:
jhb [Mon, 5 Dec 2016 23:46:21 +0000 (23:46 +0000)]
MFC 307876:
cxgbe(4): Fix bug in the calculation of the number of physically
contiguous regions in an mbuf chain.

If the payload of an mbuf ends at a page boundary count_mbuf_nsegs would
incorrectly consider the next mbuf's payload physically contiguous based
solely on a KVA comparison.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309579 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 307759: cxgbe(4): Dump any mailbox command that times out.
jhb [Mon, 5 Dec 2016 23:35:37 +0000 (23:35 +0000)]
MFC 307759: cxgbe(4): Dump any mailbox command that times out.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309578 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 307233:
jhb [Mon, 5 Dec 2016 23:25:49 +0000 (23:25 +0000)]
MFC 307233:
cxgbe(4): Allow the interface MTU to be set as high as the actual
hardware limit.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309575 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 306821,306823: Permit updating firmware config file in flash.
jhb [Mon, 5 Dec 2016 23:02:26 +0000 (23:02 +0000)]
MFC 306821,306823: Permit updating firmware config file in flash.

306821:
cxgbe(4): Add an ioctl to copy a firmware config file to the card's flash.

306823:
cxgbetool: Add a loadcfg subcommand to allow a user to upload a firmware
configuration file to the card.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309569 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 306277:
jhb [Mon, 5 Dec 2016 22:13:09 +0000 (22:13 +0000)]
MFC 306277:
cxgbe(4): Make the location/length of all descriptor rings available in
the sysctl MIB.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309564 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 305695,305696,305699,305702,305703,305713,305715,305827,305852,305906,
jhb [Mon, 5 Dec 2016 20:43:25 +0000 (20:43 +0000)]
MFC 305695,305696,305699,305702,305703,305713,305715,305827,305852,305906,
305908,306062,306063,306137,306138,306206,306216,306273,306295,306301,
306465,309302:
Add support for adapters using the Terminator T6 ASIC.

305695:
cxgbe(4): Set up fl_starve_threshold2 accurately for T6.

305696:
cxgbe(4): Use correct macro for header length with T6 ASICs.  This
affects the transmit of the VF driver only.

305699:
cxgbe(4): Update the pad_boundary calculation for T6, which has a
different range of boundaries.

305702:
cxgbe(4): Use smaller min/max bursts for fl descriptors with a T6.

305703:
cxgbe(4): Deal with the slightly different SGE_STAT_CFG in T6.

305713:
cxgbe(4): Add support for additional port types and link speeds.

305715:
cxgbe(4): Catch up with the rename of tlscaps -> cryptocaps.  TLS is one
of the capabilities of the crypto engine in T6.

305827:
cxgbe(4): Use the interface's viid to calculate the PF/VF/VFValid fields
to use in tx work requests.

305852:
cxgbe(4): Attach to cards with the Terminator 6 ASIC.  T6 cards will
come up as 't6nex' nexus devices with 'cc' ports hanging off them.

The T6 firmware and configuration files will be added as soon as they
are released.  For now the driver will try to work with whatever
firmware and configuration is on the card's flash.

305906:
cxgbe/t4_tom: The SMAC entry for a VI is at a different location in the T6.

305908:
cxgbe/t4_tom: Update the active/passive open code to support T6.  Data
path works as-is.

306062:
cxgbe(4): Show wcwr_stats for T6 cards.

306063:
cxgbe(4): Setup congestion response for T6 rx queues.

306137:
cxgbetool: Add T6 support to the SGE context decoder.

306138:
Fix typo.

306206:
cxgbe(4): Catch up with the different layout of WHOAMI in T6.

Note that the code moved below t4_prep_adapter() as part of this change
because now it needs a working chip_id().

306216:
cxgbe(4): Fix the output of the "tids" sysctl on T6.

306273:
cxgbe(4): Fix netmap with T6, which doesn't encapsulate SGE_EGR_UPDATE
message inside a FW_MSG.  The base NIC already deals with updates in
either form.

306295:
cxgbe(4): Support SIOGIFXMEDIA so that ifconfig displays correct media
for 25Gbps and 100Gbps ports.   This should have been part of r305713,
which is when the driver first started reporting extended media types.

306301:
cxgbe(4): Use the port's top speed to figure out whether it is "high
speed" or not (for the purpose of calculating the number of queues etc.)
This does the right thing for 25Gbps and 100Gbps ports.

306465:
cxgbe(4): Claim the T6 -DBG card.

309302:
cxgbe(4): Include firmware for T6 cards in the driver.  Update all
firmwares to 1.16.12.0.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@309560 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 305667:
jhb [Mon, 5 Dec 2016 19:37:15 +0000 (19:37 +0000)]
MFC 305667:
cxgbe(4): Avoid a NULL dereference in the clearstats ioctl handler.
Port softc's are not initialized when the adapter is in recovery mode.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309559 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 305652: cxgbe(4): Do not prescreen frames before attempting LRO.
jhb [Mon, 5 Dec 2016 19:34:52 +0000 (19:34 +0000)]
MFC 305652: cxgbe(4): Do not prescreen frames before attempting LRO.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309558 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 305433:
jhb [Mon, 5 Dec 2016 19:32:06 +0000 (19:32 +0000)]
MFC 305433:
cxgbe/t4_tom: toepcb should be all-zero on allocation because the code
that cleans up on failure assumes that non-NULL values indicate
initialized items.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309557 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303688,303750,305166,305167: Centralize and rework page pod handling.
jhb [Mon, 5 Dec 2016 19:16:46 +0000 (19:16 +0000)]
MFC 303688,303750,305166,305167: Centralize and rework page pod handling.

Note that the TOE DDP code in 10 is different from 11 and later and
had to be updated directly.

303688:
cxgbe/t4_tom: Read the chip's DDP page sizes and save them in a
per-adapter data structure.  This replaces a global array with hardcoded
page sizes.

303750:
cxgbe/t4_tom: The page pod arena allocates from pod address space and
not index space.  The minimum valid allocation out of this arena is the
size of a single page pod.

305166:
cxgbe/t4_tom: Add general purpose routines to deal with page pod regions
and allocations within them.  Switch to these routines to manage the TOE
DDP region.

305167:
cxgbe/t4_tom: Two new routines to allocate and write page pods for a
buffer in the kernel's address space.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@309556 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r309026: open(2): Clarify non-POSIX error when opening a symlink with
jilles [Sun, 4 Dec 2016 16:00:25 +0000 (16:00 +0000)]
MFC r309026: open(2): Clarify non-POSIX error when opening a symlink with
O_NOFOLLOW.

We return [EMLINK] instead of [ELOOP] when trying to open a symlink with
O_NOFOLLOW, so that the original case of [ELOOP] can be distinguished. Code
like cmp -h and xz takes advantage of this.

PR: 214633

git-svn-id: svn://svn.freebsd.org/base/stable/10@309536 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r309209:
kib [Sun, 4 Dec 2016 13:56:15 +0000 (13:56 +0000)]
MFC r309209:
Do not enable nullfs vnode caching over nfs v4 mounts.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309530 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoAdd sys/systm.h to have critical_enter() defined, required by
kib [Sun, 4 Dec 2016 13:53:06 +0000 (13:53 +0000)]
Add sys/systm.h to have critical_enter() defined, required by
machine/counter.h on i386.

This is a direct commit to stable/10.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@309529 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC: r308871
rmacklem [Sat, 3 Dec 2016 21:56:46 +0000 (21:56 +0000)]
MFC: r308871
Modify umount so that it does not do an Unmount RPC for NFSv4 mounts
and uses TCP for the Unmount RPC if the mount is over TCP.
Without this patch, umount does an Unmount RPC over UDP for all NFS mounts.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309518 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r309356: svn 1.9.4 -> 1.9.5
peter [Sat, 3 Dec 2016 20:30:25 +0000 (20:30 +0000)]
MFC r309356: svn 1.9.4 -> 1.9.5

git-svn-id: svn://svn.freebsd.org/base/stable/10@309512 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301761:
trasz [Sat, 3 Dec 2016 20:01:12 +0000 (20:01 +0000)]
MFC r301761:

Fix frexpl() declaration to not include the field name.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309510 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308206:
trasz [Sat, 3 Dec 2016 19:55:55 +0000 (19:55 +0000)]
MFC r308206:

Make autounmountd(8) not die when traced with "truss -p".

git-svn-id: svn://svn.freebsd.org/base/stable/10@309509 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r264196:
ngie [Sat, 3 Dec 2016 19:52:33 +0000 (19:52 +0000)]
MFC r264196:
r264196 (by theraven):

Move definitions out of rpc_com so that the linker doesn't complain about
multiple definitions.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309507 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301770:
ngie [Sat, 3 Dec 2016 19:21:35 +0000 (19:21 +0000)]
MFC r301770:
r301770 (by pfg):

rpcbind(8): Make use of some xdr_* macros.

xdr_rpcproc, xdr_rpcprog and xdr_rpcvers were broken in older
versions of FreeBSD but fixed in r296394.  Give them some use
hoping they help make the code somewhat more readable.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309506 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r298183,r304226:
ngie [Sat, 3 Dec 2016 19:15:26 +0000 (19:15 +0000)]
MFC r298183,r304226:

r298183 (by araujo):

Use NULL for pointers.

strrchr(3) will return NULL if the character does not appears in
the string.

r304226 (by araujo):

Use nitems() from sys/param.h.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309505 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r297975:
ngie [Sat, 3 Dec 2016 19:03:25 +0000 (19:03 +0000)]
MFC r297975:
r297975 (by pfg):

RPC: for pointers replace 0 with NULL.

These are mostly cosmetical, no functional change.

Found with devel/coccinelle.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309503 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r296133:
ngie [Sat, 3 Dec 2016 18:56:28 +0000 (18:56 +0000)]
MFC r296133:
r296133 (by pfg):

RPC: update the getrpcbyname() definition to include a const qualifier.

Add const qualifier making getrpcbyname() and getrpcbyname_r()
prototypes match those used in latest Sun RPC code (TI-RPC 2.3).

Obtained from: NetBSD

git-svn-id: svn://svn.freebsd.org/base/stable/10@309502 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301734:
ngie [Sat, 3 Dec 2016 18:53:03 +0000 (18:53 +0000)]
MFC r301734:
r301734 (by kevlo):

Fix the rpcb_getaddr() definition to match its declaration.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309501 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r296404:
ngie [Sat, 3 Dec 2016 18:48:39 +0000 (18:48 +0000)]
MFC r296404:
r296404 (by pfg):

Stray tabs and spaces.

No functional change.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309500 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r287353:
ngie [Sat, 3 Dec 2016 18:45:12 +0000 (18:45 +0000)]
MFC r287353:
r287353 (by rodrigc):

Use unsigned variable.

Eliminates gcc 4.9 compiler warning.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309499 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r296386:
ngie [Sat, 3 Dec 2016 18:40:39 +0000 (18:40 +0000)]
MFC r296386:
r296386 (by pfg):

Work around aliasing issues detected in modern GCC.

Avoid casting gymnastics that lead to pointer aliasing by introducing an
inline function as done in NetBSD (but without #if0'd WIP code).

Obtained from: NetBSD (CVS Rev. 1.24, 1.25)

git-svn-id: svn://svn.freebsd.org/base/stable/10@309498 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r278039:
ngie [Sat, 3 Dec 2016 18:26:41 +0000 (18:26 +0000)]
MFC r278039:
r278039 (by pfg):

Resource leak

CID: 1016703

git-svn-id: svn://svn.freebsd.org/base/stable/10@309497 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r288017:
ngie [Sat, 3 Dec 2016 18:25:23 +0000 (18:25 +0000)]
MFC r288017:
r288017 (by rodrigc):

Use ANSI C prototypes.

Eliminates gcc 4.9 warnings.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309496 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r288995:
ngie [Sat, 3 Dec 2016 18:21:28 +0000 (18:21 +0000)]
MFC r288995:
r288995 (by rodrigc):

Use proper function prototypes.
Eliminates -Wstrict-prototypes warning

git-svn-id: svn://svn.freebsd.org/base/stable/10@309495 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r287347:
ngie [Sat, 3 Dec 2016 18:17:06 +0000 (18:17 +0000)]
MFC r287347:
r287347 (by rodrigc):

Use ANSI C prototypes.

Eliminates gcc 4.9 warnings.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309494 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301754,r301769:
ngie [Sat, 3 Dec 2016 18:14:29 +0000 (18:14 +0000)]
MFC r301754,r301769:

r301754 (by pfg):

libc/rpc: Make use of some xdr_* macros.

xdr_rpcprog and xdr_rpcvers were broken in older versions of FreeBSD
but were fixed in r296394. Give them some use hoping they help make
the code somewhat more readable.

r301769 (by pfg):

libc/rpc: Make use of some xdr_* macros. (part 2)

xdr_rpcproc, xdr_rpcprog and xdr_rpcvers were broken in older
versions of FreeBSD but fixed in r296394.  Give them some use
hoping they help make the code somewhat more readable.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309493 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r278041:
ngie [Sat, 3 Dec 2016 18:08:49 +0000 (18:08 +0000)]
MFC r278041:
r278041 (by pfg):

rpc: Uninitialized pointer read

Initialize *xprt to avoid exposing a random value
in cleanup_svc_vc_create.

CID: 1018723
Phabric: D1749

git-svn-id: svn://svn.freebsd.org/base/stable/10@309492 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r287341,r287342,r287348:
ngie [Sat, 3 Dec 2016 17:40:58 +0000 (17:40 +0000)]
MFC r287341,r287342,r287348:

r287341 (by rodrigc):

Use ANSI C prototypes.

Eliminates gcc 4.9 warnings.

r287342 (by rodrigc):

Mark unused parameters to reduce gcc 4.9 warnings.

r287348 (by rodrigc):

Use correct function prototype for signal handler.

Eliminates gcc 4.9 warning.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309489 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r288113:
ngie [Sat, 3 Dec 2016 17:27:28 +0000 (17:27 +0000)]
MFC r288113:
r288113 (by rodrigc):

Use ANSI C prototypes.  Eliminates -Wold-style-definition warnings.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309487 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r297790:
ngie [Sat, 3 Dec 2016 17:17:42 +0000 (17:17 +0000)]
MFC r297790:
r297790 (by pfg):

libc: replace 0 with NULL for pointers.

While here also cleanup some surrounding code; particularly
drop some malloc() casts.

Found with devel/coccinelle.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309485 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r287350:
ngie [Sat, 3 Dec 2016 17:10:37 +0000 (17:10 +0000)]
MFC r287350:
r287350 (by rodrigc):

Use ANSI C prototypes.

Eliminates gcc 4.9 warnings.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309484 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r299704:
ngie [Sat, 3 Dec 2016 16:52:40 +0000 (16:52 +0000)]
MFC r299704:
r299704 (by vangyzen):

iconvctl(3): remove superfluous NULL pointer tests

convname and dst are guaranteed to be non-NULL by iconv_open(3).
src is an array. Remove these tests for NULL pointers.
While I'm here, eliminate a strlcpy with a correct but suspicious-looking
calculation for the third parameter (i.e. not a simple sizeof).
Compare the strings in-place instead of copying.

Found by: bdrewery
Found by: Coverity
CID: 11300501130056

git-svn-id: svn://svn.freebsd.org/base/stable/10@309482 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303348:
jhb [Sat, 3 Dec 2016 01:10:45 +0000 (01:10 +0000)]
MFC 303348:
cxgbe(4): Initialize the adapter queues (fwq and mgmtq) instead of
returning EAGAIN if they aren't available when the user tries to program
a filter.  Do this after validating the filter so that the driver
doesn't bring up the queues if it doesn't have to.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309459 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302440,304873,305704,305985,306787,307531: Fixes for sysctls.
jhb [Sat, 3 Dec 2016 01:04:59 +0000 (01:04 +0000)]
MFC 302440,304873,305704,305985,306787,307531: Fixes for sysctls.

302440:
cxgbe(4): Add sysctl to display the RSS indirection table size for an
interface.

dev.cxl.<n>.rss_size
dev.vcxl.<n>.rss_size

304873:
cxgbe(4): Provide more details about the card in the sysctl MIB.

dev.t5nex.0.%desc: Chelsio T580-CR
dev.t5nex.0.hw_revision: 1
dev.t5nex.0.sn: PT13140042
dev.t5nex.0.pn: 110117150A0
dev.t5nex.0.ec: 0000000000000000
dev.t5nex.0.na: 0007432AF490
dev.t5nex.0.vpd_version: 3
dev.t5nex.0.scfg_version: 53255
dev.t5nex.0.bs_version: 1.1.0.0
dev.t5nex.0.er_version: 1.0.0.68
dev.t5nex.0.tp_version: 0.1.4.9
dev.t5nex.0.firmware_version: 1.16.2.0

305704:
cxgbe(4): Rename the debug_flags driver tunable/sysctl to dflags.
Tunables that end with _flags are special.

305985:
cxgbe(4): Fixes to wrq stats.

- Increment tx_wrs_copied in the correct place.
- Add tx_wrs_sspace to the sysctl MIB.

306787:
cxgbe(4): Fix whitespace in the pm_stats display.

307531:
cxgbe(4): Adjust whitespace to line up the column titles in cim_qcfg
with the values displayed.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@309458 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r309179:
pfg [Sat, 3 Dec 2016 00:45:13 +0000 (00:45 +0000)]
MFC r309179:
ext2fs: avoid possible overflow when calculating malloc size.

This is inspired on r308064 for the case of mounting UFS.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309456 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/11 r309453:
ngie [Sat, 3 Dec 2016 00:40:08 +0000 (00:40 +0000)]
MFstable/11 r309453:

MFC r307700:

Only build lib/libc/tests/iconv if MK_ICONV != no

git-svn-id: svn://svn.freebsd.org/base/stable/10@309454 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 304854: cxgbe/iw_cxgbe: Various fixes to the iWARP driver.
jhb [Sat, 3 Dec 2016 00:18:38 +0000 (00:18 +0000)]
MFC 304854: cxgbe/iw_cxgbe: Various fixes to the iWARP driver.

- Return appropriate error code instead of ENOMEM when sosend() fails in
  send_mpa_req.
- Fix for problematic race during destroy_qp.
- Abortive close in the failure of send_mpa_reject() instead of normal close.
- Remove the unnecessary doorbell flowcontrol logic.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@309450 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303859,305851: Fix a typo and some whitespace nits.
jhb [Fri, 2 Dec 2016 23:05:14 +0000 (23:05 +0000)]
MFC 303859,305851: Fix a typo and some whitespace nits.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309449 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303454: Mark spg_len and fl_pktshift static.
jhb [Fri, 2 Dec 2016 23:01:19 +0000 (23:01 +0000)]
MFC 303454: Mark spg_len and fl_pktshift static.

These variables are no longer exported to t4_netmap.c after r296478.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309448 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303522,303647,303860,303880,304168-304170,304479,304482,304485,305548,
jhb [Fri, 2 Dec 2016 22:53:33 +0000 (22:53 +0000)]
MFC 303522,303647,303860,303880,304168-304170,304479,304482,304485,305548,
305549:
Chelsio T4/T5 VF driver.

303522:
Various fixes to the t4/5nex character device.

- Remove null open/close methods.
- Don't set d_flags to 0 explicitly.
- Remove t5_cdevsw as the .d_name member isn't really used and doesn't
  warrant a separate cdevsw just for the name.
- Use ENOTTY as the error value for an unknown ioctl request.
- Use make_dev_s() to close race with setting si_drv1.

303647:
Store the offset of the KDOORBELL and GTS registers in the softc.

VF devices use a different register layout than PF devices.  Storing
the offset in a value in the softc allows code to be shared between the
PF and VF drivers.

303860:
Reserve an adapter flag IS_VF to mark VF devices vs PF devices.

303880:
Track the base absolute ID of ingress and egress queues.

Use this to map an absolute queue ID to a logical queue ID in interrupt
handlers.  For the regular cxgbe/cxl drivers this should be a no-op as
the base absolute ID should be zero.  VF devices have a non-zero base
absolute ID and require this change.  While here, export the absolute ID
of egress queues via a sysctl.

304168:
Make SGE parameter handling more VF-friendly.

Add fields to hold the SGE control register and free list buffer sizes to
the sge_params structure.  Populate these new fields in
t4_init_sge_params() for PF devices and change t4_read_chip_settings() to
pull these values out of the params structure instead of reading
registers directly.  This will permit t4_read_chip_settings() to be reused
for VF devices which cannot read SGE registers directly.

While here, move the call to t4_init_sge_params() to
get_params__post_init().  The VF driver will populate the SGE parameters
structure via a different method before calling t4_read_chip_settings().

304169:
Update mailbox writes to work with VF devices.

- Use alternate register locations for the data and control registers for
  VFs.
- Do a dummy read to force the writes to the  mailbox data registers to
  post before the write to the control register on VFs.
- Do not check the PCI-e firmware register for errors on VFs.

304170:
Add support for register dumps on VF devices.

- Add handling of VF register sets to t4_get_regs_len() and t4_get_regs().
- While here, use t4_get_regs_len() in the ioctl handler for regdump
  instead of inlining it.

304479:
Add structures for VF-specific adapter parameters.

While here, mark which parameters are PF-specific and which are
VF-specific.

304482:
Adjust t4_port_init() to work with VF devices.

Specifically, the FW_PORT_CMD may or may not work for a VF (the PF
driver can choose whether or not to permit access to this command),
so don't attempt to fetch port information on a VF if permission is
denied by the PF.

304485:
Reorder sysctls so that nodes shared with the VF driver are added first.

This permits a single early return for VF devices in the routines that
add sysctl nodes.

305548:
Don't break out of the m_advance() loop if len drops to zero.

If a packet contains the Ethernet header (14 bytes) in the first mbuf
and the payload (IP + UDP + data) in the second mbuf, then the attempt
to fetch the l3hdr will return a NULL pointer.  The first loop iteration
will drop len to zero and exit the loop without setting 'p'.  However,
the desired data is at the start of the second mbuf, so the correct
behavior is to loop around and let the conditional set 'p' to m_data of
the next mbuf (and leave offset as 0).

305549:
Chelsio T4/T5 VF driver.

The cxgbev/cxlv driver supports Virtual Function devices for Chelsio
T4 and T4 adapters.  The VF devices share most of their code with the
existing PF4 driver (cxgbe/cxl) and as such the VF device driver
currently depends on the PF4 driver.

Similar to the cxgbe/cxl drivers, the VF driver includes a t4vf/t5vf
PCI device driver that attaches to the VF device.  It then creates
child cxgbev/cxlv devices representing ports assigned to the VF.
By default, the PF driver assigns a single port to each VF.

t4vf_hw.c contains VF-specific routines from the shared code used to
fetch VF-specific parameters from the firmware.

t4_vf.c contains the VF-specific PCI device driver and includes its
own attach routine.

VF devices are required to use a different firmware request when
transmitting packets (which in turn requires a different CPL message
to encapsulate messages).  This alternate firmware request does not
permit chaining multiple packets in a single message, so each packet
results in a firmware request.  In addition, the different CPL message
requires more detailed information when enabling hardware checksums,
so parse_pkt() on VF devices must examine L2 and L3 headers for all
packets (not just TSO packets) for VF devices.  Finally, L2 checksums
on non-UDP/non-TCP packets do not work reliably (the firmware trashes
the IPv4 fragment field), so IPv4 checksums for such packets are
calculated in software.

Most of the other changes in the non-VF-specific code are to expose
various variables and functions private to the PF driver so that they
can be used by the VF driver.

Note that a limited subset of cxgbetool functions are supported on VF
devices including register dumps, scheduler classes, and clearing of
statistics.  In addition, TOE is not supported on VF devices, only for
the PF interfaces.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@309447 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 308564: Don't place threads on the run queue after waking up other CPUs.
jhb [Fri, 2 Dec 2016 22:27:54 +0000 (22:27 +0000)]
MFC 308564: Don't place threads on the run queue after waking up other CPUs.

The other CPU might resume and see a still-empty runq and go back to
sleep before sched_add() adds the thread to the runq.  This results
in a lost wakeup and a potential hang if the system is otherwise
completely idle.

The race originated due to a micro-optimization (my fault) in 4BSD in
that it avoided putting a thread on the run queue if the scheduler was
going to preempt to the new thread.  To avoid complexity while fixing
this race, just drop this optimization.  4BSD now always sets the
"owepreempt" flag when a preemption is warranted and defers the actual
preemption to the thread_unlock of the caller the same as ULE.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309446 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoFix build without INVARIANTS.
jhb [Fri, 2 Dec 2016 22:25:11 +0000 (22:25 +0000)]
Fix build without INVARIANTS.

This is a direct commit to stable/10.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309445 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303204: Install a handler for firmware work request error messages.
jhb [Fri, 2 Dec 2016 21:36:21 +0000 (21:36 +0000)]
MFC 303204: Install a handler for firmware work request error messages.

If a driver sends an malformed or disallowed work request, the firmware
responds with a work request error.  Previously the driver treated this is
as an unexpected message and panicked.  Now it decodes the error message
to aid in debugging.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309444 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 308005: Add powerd(8) support for several families of AMD CPUs.
jhb [Fri, 2 Dec 2016 21:35:14 +0000 (21:35 +0000)]
MFC 308005: Add powerd(8) support for several families of AMD CPUs.

Use the same logic to calculate the nominal CPU frequency from the P-state
MSRs on family 0x12, 0x15, and 0x16 CPUs as is used for family 0x10.
Family 0x14 was included in the original patch in the PR but I left that
out as the BIOS writer's guide for family 0x14 CPUs show a different layout
for the relevant MSR and include a different formulate for calculating the
frequency.

While here, simplify a few expressions and print out the family of
unsupported CPUs in hex rather than decimal.

PR: 212020

git-svn-id: svn://svn.freebsd.org/base/stable/10@309443 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 302339:
jhb [Fri, 2 Dec 2016 21:29:52 +0000 (21:29 +0000)]
MFC 302339:
cxgbe(4): Changes to the CPL-handler registration mechanism and code
related to "shared" CPLs.

a) Combine t4_set_tcb_field and t4_set_tcb_field_rpl into a single
function.  Allow callers to direct the response to any iq.  Tidy up
set_ulp_mode_iscsi while there to use names from t4_tcb.h instead of
magic constants.

b) Remove all CPL handler tables from struct adapter.  This reduces its
size by around 2KB.  All handlers are now registered at MOD_LOAD instead
of attach or some kind of initialization/activation.  The registration
functions do not need an adapter parameter any more.

c) Add per-iq handlers to deal with CPLs whose destination cannot be
determined solely from the opcode.  There are 2 such CPLs in use right
now: SET_TCB_RPL and L2T_WRITE_RPL.  The base driver continues to send
filter and L2T_WRITEs over the mgmtq and solicits the reply on fwq.
t4_tom (including the DDP code) now uses the port's ctrlq to send
L2T_WRITEs and SET_TCB_FIELDs and solicits the reply on an ofld_rxq.
fwq and ofld_rxq have different handlers that know what kind of tid to
expect in the reply.  Update t4_write_l2e and callers to to support any
wrq/iq combination.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@309442 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 292736:
jhb [Fri, 2 Dec 2016 20:16:52 +0000 (20:16 +0000)]
MFC 292736:
cxgbe(4): Updates to the base NIC driver and t4_tom to support the iSCSI
offload driver.  These changes come from projects/cxl_iscsi.

Note that these changes make use of the mbufq API from 11.0, but that
API is not present in 10.x in the same form.  Borrow an implementation
from the CAM CTL ha code that uses m_nextpkt to implement mbufq for use
in 10.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309440 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 303753,308004: Add bounds checking on addresses used with /dev/mem.
jhb [Fri, 2 Dec 2016 19:02:12 +0000 (19:02 +0000)]
MFC 303753,308004: Add bounds checking on addresses used with /dev/mem.

303753:
Don't permit mappings of invalid physical addresses on amd64 via /dev/mem.

308004:
MFamd64: Add bounds checks on addresses used with /dev/mem.

Reject attempts to read from or memory map offsets in /dev/mem that are
beyond the maximum-supported physical address of the current CPU.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309426 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH: r309295
julian [Fri, 2 Dec 2016 08:21:25 +0000 (08:21 +0000)]
MFH: r309295

bhyve: stability and performance improvement for dbgport

The TCP server implementation in dbgport does not track clients, so it
may try to write to a disconected socket resulting in SIGPIPE.
Avoid that by setting SO_NOSIGPIPE socket option.

Because dbgport emulates an I/O port to guest, the communication is done
byte by byte.  Reduce latency of the TCP/IP transfers by using
TCP_NODELAY option.  In my tests that change improves performance of
kgdb commands with lots of output (e.g. info threads) by two orders of
magnitude.

A general note.  Since we have a uart emulation in bhyve, that can be
used for the console and gdb access to guests.  So, bvmconsole and bvmdebug
could be de-orbited now.  But there are many existing deployments that
still dependend on those.

Discussed with: julian, jhb
Sponsored by: Panzura

git-svn-id: svn://svn.freebsd.org/base/stable/10@309401 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH: r307917
julian [Fri, 2 Dec 2016 08:15:52 +0000 (08:15 +0000)]
MFH: r307917

accept4 actually expect SOCK_NONBLOCK and not O_NONBLOCK

Reported by: jhb
Pointyhat to: bapt

git-svn-id: svn://svn.freebsd.org/base/stable/10@309399 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH: r306554
julian [Fri, 2 Dec 2016 08:12:51 +0000 (08:12 +0000)]
MFH: r306554

Use accept4 with O_NONBLOCK rather than accept + fcntl

git-svn-id: svn://svn.freebsd.org/base/stable/10@309398 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH: r297015
julian [Fri, 2 Dec 2016 06:27:54 +0000 (06:27 +0000)]
MFH: r297015

Change a little to match what appears to be the right way of specifying an argument
(from looking at other man pages)

Sponsored by:  Panzura inc

git-svn-id: svn://svn.freebsd.org/base/stable/10@309396 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH: r297012
julian [Fri, 2 Dec 2016 06:27:14 +0000 (06:27 +0000)]
MFH: r297012

Add a few details that make it easier to use this macro.

Sponsored by: Panzura inc

git-svn-id: svn://svn.freebsd.org/base/stable/10@309395 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH: r303611
julian [Fri, 2 Dec 2016 05:42:04 +0000 (05:42 +0000)]
MFH: r303611

slite style changes. There is an incoming patch that rewrites a
lot of this module and I want to get the style and whitespace changes in
a separate commit (or maybe more).

PR: 206185
Submitted by: Dmitry Vagin

git-svn-id: svn://svn.freebsd.org/base/stable/10@309389 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH: r303613
julian [Fri, 2 Dec 2016 05:39:10 +0000 (05:39 +0000)]
MFH: r303613

Man page for the new checksum netgraph module.

PR: 206186
Submitted by: Dmitry Vagin <daemon.hammer@ya.ru>

git-svn-id: svn://svn.freebsd.org/base/stable/10@309388 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH: r303612
julian [Fri, 2 Dec 2016 05:38:25 +0000 (05:38 +0000)]
MFH: r303612

netgraph module for reconstructing checksums

PR: 206108
Submitted by: Dmitry Vagin  daemon.hammer@ya.ru

git-svn-id: svn://svn.freebsd.org/base/stable/10@309387 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFH: r306306
julian [Fri, 2 Dec 2016 05:24:51 +0000 (05:24 +0000)]
MFH: r306306

Give the user a clue as to which process hit maxfiles.

Sponsored by: Panzura

git-svn-id: svn://svn.freebsd.org/base/stable/10@309383 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 297797:
jhb [Fri, 2 Dec 2016 00:23:10 +0000 (00:23 +0000)]
MFC 297797:
cxgbe(4): Provide an explicit value for nqpcq in the firmware
configuration file.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@309379 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 273806,289103,289201,289338,289578,293185,294474,294610,297124,297368,
jhb [Thu, 1 Dec 2016 23:38:52 +0000 (23:38 +0000)]
MFC 273806,289103,289201,289338,289578,293185,294474,294610,297124,297368,
297406,300875,300888,301158,301896,301897,304838:

Pull in most of the Chelsio and iWARP related changes from stable/11 into
stable/10.  A few changes from 278886 (OFED 1.2) were also included though
the full merge is not:
- The find_gid_port() function in infiband/core/cma.c.
- Addition of the 'ord' and 'ird' fields to 'struct iw_cm_event'.

273806:
Userspace library for Chelsio's Terminator 5 based iWARP RNICs (pretty
much every T5 card that does _not_ have "-SO" in its name is RDMA
capable).

This plugs into the OFED verbs framework and allows userspace RDMA
applications to work over T5 RNICs.  Tested with rping.

289103:
iw_cxgbe: fix for page fault in cm_close_handler().

This is roughly the iw_cxgbe equivalent of
https://github.com/torvalds/linux/commit/be13b2dff8c4e41846477b22cc5c164ea5a6ac2e
-----------------
RDMA/cxgb4: Connect_request_upcall fixes

When processing an MPA Start Request, if the listening endpoint is
DEAD, then abort the connection.

If the IWCM returns an error, then we must abort the connection and
release resources.  Also abort_connection() should not post a CLOSE
event, so clean that up too.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-----------------

289201:
iw_cxgbe: MPA v2 is always available.

289338:
iw_cxgbe: use correct RFC number.

289578:
Merge LinuxKPI changes from DragonflyBSD:
- Define the kref structure identical to the one found in Linux.
- Update clients referring inside the kref structure.
- Implement kref_sub() for FreeBSD.

293185:
iw_cxgbe: Shut down the socket but do not close the fd in case of error.
The fd is closed later in this case.  This fixes a "SS_NOFDREF on enter"
panic.

294474:
iw_cxgbe: fix a couple of problems int the RDMA_TERMINATE handler.

a) Look for the CPL in the payload buffer instead of the descriptor.
b) Retrieve the socket associated with the tid with the inpcb lock held.

294610:
Fix for iWARP servers that listen on INADDR_ANY.

The iWARP Connection Manager (CM) on FreeBSD creates a TCP socket to
represent an iWARP endpoint when the connection is over TCP. For
servers the current approach is to invoke create_listen callback for
each iWARP RNIC registered with the CM. This doesn't work too well for
INADDR_ANY because a listen on any TCP socket already notifies all
hardware TOEs/RNICs of the new listener. This patch fixes the server
side of things for FreeBSD. We've tried to keep all these modifications
in the iWARP/TCP specific parts of the OFED infrastructure as much as
possible.

297124:
iw_cxgbe/libcxgb4: Pull in many applicable fixes from the upstream Linux
iWARP driver and userspace library to the FreeBSD iw_cxgbe and libcxgb4.

This commit includes internal changesets 6785 8111 8149 8478 8617 8648
8650 9110 9143 9440 9511 9894 10164 10261 10450 10980 10981 10982 11730
11792 12218 12220 12222 12223 12225 12226 12227 12228 12229 12654.

297368:
cxgbe/iw_cxgbe: Fix for stray "start_ep_timer timer already started!"
messages.

297406:
Remove unnecessary dequeue_mutex (added in r294610) from the iWARP
connection manager.  Examining so_comp without synchronization with
iw_so_event_handler is a harmless race.

300875:
iw_cxgbe: Use vmem(9) to manage PBL and RQT allocations.

300888:
iw_cxgbe: Plug a lock leak in process_mpa_request().

If the parent is DEAD or connect_request_upcall() fails, the parent
mutex is left locked.  This leads to a hang when process_mpa_request()
is called again for another child of the listening endpoint.

301158:
iw_cxgbe: Fix panic that occurs when c4iw_ev_handler tries to acquire
comp_handler_lock but c4iw_destroy_cq has already freed the CQ memory
(which is where the lock resides).

301896:
Fix bug in iwcm that caused a panic in iw_cm_wq when krping is run
repeatedly in a tight loop.

301897:
iw_cxgbe: Make sure that send_abort results in a TCP RST and not a FIN.
Release the hold on ep->com immediately after sending the RST.  This
fixes a bug that sometimes leaves userspace iWARP tools hung when the
user presses ^C.

304838:
Do not free an uninitialized pointer on soaccept failure in the iWARP
connection manager.

Submitted by: Krishnamraju Eraparaju @ Chelsio (original patch)
Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@309378 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 308456: Pass the correct flag to find_symdef() from _rtld_bind().
jhb [Thu, 1 Dec 2016 20:36:48 +0000 (20:36 +0000)]
MFC 308456: Pass the correct flag to find_symdef() from _rtld_bind().

When symbol versioning was added to rtld, the boolean 'in_plt' argument
to find_symdef() was converted to a bitmask of flags.  The first flag
added was 'SYMLOOK_IN_PLT' which replaced the 'in_plt' bool.  This
happened to still work by accident as SYMLOOK_IN_PLT had the value of 1
which is the same as 'true', so there should be no functional change.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309371 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r306577 r306652 306830
vangyzen [Wed, 30 Nov 2016 22:20:23 +0000 (22:20 +0000)]
MFC r306577 r306652 306830

Add GARP retransmit capability

A single gratuitous ARP (GARP) is always transmitted when an IPv4
address is added to an interface, and that is usually sufficient.
However, in some circumstances, such as when a shared address is
passed between cluster nodes, this single GARP may occasionally be
dropped or lost.  This can lead to neighbors on the network link
working with a stale ARP cache and sending packets destined for
that address to the node that previously owned the address, which
may not respond.

To avoid this situation, GARP retransmissions can be enabled by setting
the net.link.ether.inet.garp_rexmit_count sysctl to a value greater
than zero.  The setting represents the maximum number of retransmissions.
The interval between retransmissions is calculated using an exponential
backoff algorithm, doubling each time, so the retransmission intervals
are: {1, 2, 4, 8, 16, ...} (seconds).

Due to the exponential backoff algorithm used for the interval
between GARP retransmissions, the maximum number of retransmissions
is limited to 16 for sanity.  This limit corresponds to a maximum
interval between retransmissions of 2^16 seconds ~= 18 hours.
Increasing this limit is possible, but sending out GARPs spaced
days apart would be of little use.

Update arp(4) to document the net.link.ether.inet.garp_rexmit_count sysctl.

Submitted by: dab
Relnotes: yes
Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@309340 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308340
vangyzen [Wed, 30 Nov 2016 20:51:51 +0000 (20:51 +0000)]
MFC r308340

ncal: fix a reference to an out-of-scope stack buffer

PR: 214237
Submitted by: Jonathan de Boyne Pollard
Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@309336 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308904
vangyzen [Wed, 30 Nov 2016 20:48:44 +0000 (20:48 +0000)]
MFC r308904

Fix error reporting from wcstof()

When wcstof() skipped initial space and then parsing failed, it set
endptr to the first non-space character.  Fix it to correctly report
failure by setting endptr to the beginning of the input string.
The fix is from theraven@, who fixed this bug in wcstod() and
wcstold() in r227753.

While I'm here:

Move assignments out of declarations in wcstod() and wcstold().
This is against my personal preference, but it is our agreed style(9).

Set endptr correctly on malloc() failure in all three functions.

Remove an incorrect comment:  This is pointer arithmetic,
so the code was not actually making that assumption.

wcstold() advanced the wcp pointer beyond leading whitespace
and then reset it back to the beginning of the string.
Do not reset it.  This seems to have no functional effect,
since strtold_l() also skips leading whitespace.  I'm making
the change to keep this function consistent with wcstof() and
wcstod(), and because the C11 spec prescribes the use of iswspace()
to skip leading space.

Reported by: libc++ unit test for std::stof(std::wstring)
Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@309334 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308824
vangyzen [Wed, 30 Nov 2016 18:11:35 +0000 (18:11 +0000)]
MFC r308824

locale: fix display of "grouping" and "mon_grouping" values

The "grouping" and "mon_grouping" values are arrays of one-byte
integers, not arrays of ASCII characters.  Display them in a format
similar to GNU and MacOS.

Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@309329 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308797-308799,309082
dexuan [Wed, 30 Nov 2016 07:51:46 +0000 (07:51 +0000)]
MFC r308797-308799,309082

Approved by: sephe (mentor)

    r308797
    update the hv_vmbus(4) manual by adding a dependency on pci

    We enhanced the vmbus driver to support PCIe pass-through recently.

    Reviewed by:        sephe
    Approved by:        sephe (mentor)
    Sponsored by:       Microsoft

    r308798
    remove the hv_ata_pci_disengage(4) manual

    A few months ago, we removed the driver, which was not necessary any longer.

    Reviewed by:        sephe
    Approved by:        sephe (mentor)
    Sponsored by:       Microsoft

    r308799
    fix share/man/man4/Makefile for hv_ata_pci_disengage.4

    We need to remove the line since we removed the related manual just now.

    Reviewed by:        sephe
    Approved by:        sephe (mentor)
    Sponsored by:       Microsoft

    r309082
    share/man/man4/Makefile: Only install Hyper-V man pages on amd64 and i386

    We shouldn't install them on the architectures not supported by Hyper-V.

    And, hv_ata_pci_disengage.4.gz should be removed from all architectures:
    1) It should have only applied to Hyper-V;
    2) For Hyper-V platforms (amd64 and i386), the related driver was removed by
    r306426 | sephe | 2016-09-29 09:41:52 +0800 (Thu, 29 Sep 2016),
    because now we have a better mechanism to disble the ata driver for hard
    disks when the VM runs on Hyper-V.

    Reviewed by:        sephe, andrew, jhb
    Approved by:        sephe (mentor)
    Sponsored by:       Microsoft
    Differential Revision:      https://reviews.freebsd.org/D8572

git-svn-id: svn://svn.freebsd.org/base/stable/10@309317 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC: 308723-308725,308793-308795,309127
dexuan [Wed, 30 Nov 2016 06:26:37 +0000 (06:26 +0000)]
MFC: 308723-308725,308793-308795,309127

Approved by: sephe (mentor)

r308723
    hyperv/vmbus: add a new method to get vcpu_id

    vcpu_id is host's representation of guest CPU.
    We get the mapping between vcpu_id and FreeBSD kernel's cpu id when VMBus
    driver is loaded. Later, when a driver, like the coming pcib driver, talks
    to the host and needs to refer to a guest CPU, the driver must use the
    vcpu_id.

    Reviewed by:    jhb, sephe
    Approved by:    sephe (mentor)
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8410

r308724
    hyperv/vmbus: add new vmbus methods to support PCIe pass-through

    The new methods will be used by the coming pcib driver.

    Reviewed by:    sephe
    Approved by:    sephe (mentor)
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8409

r308725
    hyperv/pcib: enable PCIe pass-through (a.k.a. Discrete Device Assignment)

    The feature enables us to pass through physical PCIe devices to FreeBSD VM
    running on Hyper-V (Windows Server 2016) to get near-native performance with
    low CPU utilization.

    The patch implements a PCI bridge driver to support the feature:

    1) The pcib driver talks to the host to discover device(s) and presents
    the device(s) to FreeBSD's pci driver via PCI configuration space (note:
    to access the configuration space, we don't use the standard I/O port
    0xCF8/CFC method; instead, we use an MMIO-based method supplied by Hyper-V,
    which is very similar to the 0xCF8/CFC method).

    2) The pcib driver allocates resources for the device(s) and initialize
    the related BARs, when the device driver's attach method is invoked;

    3) The pcib driver talks to the host to create MSI/MSI-X interrupt
    remapping between the guest and the host;

    4) The pcib driver supports device hot add/remove.

    Reviewed by:    sephe
    Approved by:    sephe (mentor)
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D8332

r308793
    hyperv/pcib: Fix the build for some kernel configs

    Add the dependency on pci explicitly for the pcib and vmbus drivers.
    The related Makefiles are updated accordingly too.

    Reviewed by:    sephe
    Approved by:    sephe (mentor)
    Sponsored by:   Microsoft

r308794
    hyperv/vmbus,pcib: Add MODULE_DEPEND on pci

    We'd better add this dependency explicitly, though usually the pci
    driver is built into the kernel by default.

    Reviewed by:    sephe
    Approved by:    sephe (mentor)
    Sponsored by:   Microsoft

r308795
    hyperv/pcib: change the file name: pcib.c -> vmbus_pcib.c

    This makes the file name and the variable naming in the file consistent.

    Reviewed by:    sephe
    Approved by:    sephe (mentor)
    Sponsored by:   Microsoft

r309127
    hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined

    vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at
    least shouldn't break build.

    Reviewed by:    sephe
    Approved by:    sephe (mentor)
    Sponsored by:   Microsoft

git-svn-id: svn://svn.freebsd.org/base/stable/10@309313 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r309027:
brooks [Wed, 30 Nov 2016 01:22:12 +0000 (01:22 +0000)]
MFC r309027:

Allocate a struct ifreq rather than using a (wrong) computed size for
the BIOCSETIF ioctl.

The kernel always copies an entire struct ifreq and IPv4 addresses will
always fit in an ifreq.

On systems with pointers larger than 64-bits, the computed size will be
less than the size of struct ifreq, potentially resulting in the kernel
attempting to copyin memory from outside the allocation.

Reviewed by: jhb
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8445

git-svn-id: svn://svn.freebsd.org/base/stable/10@309304 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 307756: Define max_align_t for C11.
jhb [Mon, 28 Nov 2016 18:36:37 +0000 (18:36 +0000)]
MFC 307756: Define max_align_t for C11.

libc++'s stddef.h includes an existing definition of max_align_t for
C++11, but it is only defined for C++, not for C.  In addition, GCC and
clang both define an alternate version of max_align_t that uses a
union of multiple types rather than a plain long double as in libc++.
This adds a __max_align_t to <sys/_types.h> that matches the GCC and
clang definition that is mapped to max_align_t in <stddef.h>.

PR: 210890

git-svn-id: svn://svn.freebsd.org/base/stable/10@309258 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308730:
hselasky [Mon, 28 Nov 2016 17:24:24 +0000 (17:24 +0000)]
MFC r308730:
Make sure MAC address is reprogrammed when if_init() callback is
invoked. Else promiscious mode must be used to pass traffic. While at
it fix a debug print macro.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309255 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308618:
kib [Sun, 27 Nov 2016 09:14:52 +0000 (09:14 +0000)]
MFC r308618:
Provide simple mutual exclusion between mount point update and unmount.
In the update path in ffs_mount(), drop vfs_busy() reference around namei().

git-svn-id: svn://svn.freebsd.org/base/stable/10@309208 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308608:
mav [Sun, 27 Nov 2016 05:59:17 +0000 (05:59 +0000)]
MFC r308608:
Use providergone method to cover race between destroy and g_access().

git-svn-id: svn://svn.freebsd.org/base/stable/10@309206 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308579: Do not report error on close even if we have no paths left.
mav [Sat, 26 Nov 2016 07:59:57 +0000 (07:59 +0000)]
MFC r308579: Do not report error on close even if we have no paths left.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309186 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308808, r308809: Lookup locale when print all keywords as well.
ume [Sat, 26 Nov 2016 02:48:59 +0000 (02:48 +0000)]
MFC r308808, r308809: Lookup locale when print all keywords as well.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309181 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308064:
mckusick [Sat, 26 Nov 2016 00:56:03 +0000 (00:56 +0000)]
MFC r308064:
Avoid possible overflow when calclating malloc size for auxillary
data structure sizes when mounting and reloading UFS/FFS filesystems.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309173 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 307333: Reprogram I/O APIC interrupt pins when registering an I/O APIC.
jhb [Fri, 25 Nov 2016 22:12:03 +0000 (22:12 +0000)]
MFC 307333: Reprogram I/O APIC interrupt pins when registering an I/O APIC.

All I/O APIC pins are masked when an I/O APIC is first probed.  The
APIC enumerator (MP Table or MADT) then parses its associated tables to
configure individual pins to set custom delivery modes or alternate
routing (e.g. routing IRQ 0 to intpin 2).  Pins for regular interrupt
pins are left masked until the first interrupt is assigned.  However,
pins with unusual settings (e.g. NMI or SMI) are never assigned an
interrupt and thus never re-programmed.  The I/O APIC code used to
reprogram all interrupt pins during registration but this was lost in
r151979.

In theory, this is mostly a no-op as the ACPI APIC table does not
include a way to enumerate NMI or SMI pins for the I/O APIC, so only
systems using an MP Table would be affected.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309168 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r286227, r286443:
jch [Thu, 24 Nov 2016 14:48:46 +0000 (14:48 +0000)]
MFC r286227, r286443:

r286227:

Decompose TCP INP_INFO lock to increase short-lived TCP connections scalability:

- The existing TCP INP_INFO lock continues to protect the global inpcb list
  stability during full list traversal (e.g. tcp_pcblist()).

- A new INP_LIST lock protects inpcb list actual modifications (inp allocation
  and free) and inpcb global counters.

It allows to use TCP INP_INFO_RLOCK lock in critical paths (e.g. tcp_input())
and INP_INFO_WLOCK only in occasional operations that walk all connections.

PR: 183659
Differential Revision: https://reviews.freebsd.org/D2599
Reviewed by: jhb, adrian
Tested by: adrian, nitroboost-gmail.com
Sponsored by: Verisign, Inc.

r286443:

Fix a kernel assertion issue introduced with r286227:
Avoid too strict INP_INFO_RLOCK_ASSERT checks due to
tcp_notify() being called from in6_pcbnotify().

Reported by: Larry Rosenman <ler@lerctr.org>
Submitted by: markj, jch

git-svn-id: svn://svn.freebsd.org/base/stable/10@309108 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r308772: crunchide: report explicit error for combined string table
emaste [Thu, 24 Nov 2016 00:46:34 +0000 (00:46 +0000)]
MFC r308772: crunchide: report explicit error for combined string table

Some tools produce objects with a combined strtab and shstrtab.
These objects are not supported by crunchide since it rewrites the
symtab and strtab to "hide" symbols. This invalidates section header
offsets into a combined strtab/shstrtab.

In the future we could support these objects (by ensuring that we retain
unmodified section name strings in the output .strtab, and then rewriting
each section header's sh_name).

git-svn-id: svn://svn.freebsd.org/base/stable/10@309077 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 308056: Fix formatting of tables.
jhb [Wed, 23 Nov 2016 23:53:52 +0000 (23:53 +0000)]
MFC 308056: Fix formatting of tables.

Specifically, use .Ta instead of tabs to separate column entries.  While
here fix a few other things:
- Use .Sy for all column headers (previously only the first column header
  was bold)
- Use .Dv to markup constants used for MIB names.
- Use "1234" and "4321" for the byte order descriptions without
  thousands separators.
- Mark up header files in the first table with .In.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309072 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 307975: Enable EFER_NXE properly on APs.
jhb [Wed, 23 Nov 2016 23:45:42 +0000 (23:45 +0000)]
MFC 307975: Enable EFER_NXE properly on APs.

EFER_NXE is set in the EFER MSR by initializecpu() and must be set on all
CPUs in the system.  When PG_NX support was added to PAE on i386, the
block to enable EFER_NXE was placed in a section of initializecpu() that
only runs if 'cpu == CPU_686'.  During early boot, locore does an
initial pass to set cpu that sets it to CPU_686 on all CPUs later than
a Pentium.  Later, printcpuinfo() adjusts the 'cpu' variable on
PII and later CPUs to one of CPU_PII, CPU_PIII, or CPU_P4.  However,
printcpuinfo() is called after initializecpu() on the BSP, so the BSP
would enable EFER_NXE and pg_nx.  The APs execute initializecpu() much
later after printcpuinfo() has run.  The end result on a modern CPU was
that cpu was set to CPU_PIII when the APs invoked initializecpu(), so
they did not enable EFER_NXE.  As a result, the APs would fault when
trying to access any pages marked with PG_NX set.

When booting a 2 CPU PAE kernel in bhyve this manifested as a hang before
single user mode.  The attempt to execute /bin/init tried to copy out
the exec strings (argv, etc.) to a non-executable mapping while running
on the AP.  The instruction kept faulting due to invalid bits in the PTE
in an infinite loop.

Fix this by moving the code to enable EFER_NXE out of the switch statement
on 'cpu' and always doing it if 'amd_feature' supports AMDID_NX.

git-svn-id: svn://svn.freebsd.org/base/stable/10@309071 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f