]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
6 years agoMFC r314341:
asomers [Tue, 30 May 2017 16:17:00 +0000 (16:17 +0000)]
MFC r314341:

Update devd.conf for ports change 421360

Ports change 421360 changed the name and UID of the postgres user

Reviewed by: trasz, imp, girgen
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9746

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

6 years agoMFC r314148, r314150
asomers [Tue, 30 May 2017 16:15:52 +0000 (16:15 +0000)]
MFC r314148, r314150

r314148:
Misc Coverity fixes in xnb(4)

Most of these are null pointer dereferences or missing error checks in the
unit tests. One is a missing error check in xnb_attach_failed. None can
cause real problems in running systems.

Reported by: Coverity
CIDs: 1092469 1092468 1092467 2092466 1092465 1092512 1092511 1092510
CIDs: 1092510 1092509 1092508 1092507
Reviewed by: royger
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9234

r314150:
Fix the xnb(4) unit tests

One test was inadvertently expecting a bug in the kernel's sscanf
implementation circa 2012. I don't know when that bug got fixed.

Reported by: royger
Reviewed by: royger
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9766

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

6 years agoMFC r313069:
asomers [Tue, 30 May 2017 16:09:54 +0000 (16:09 +0000)]
MFC r313069:

Allow 999.local to run scripts in any language

If one of the scripts listed in (daily|weekly|monthly)_local is executable,
999.local should simply execute it. Only if the script isn't executable
should 999.local assume it needs /bin/sh.

Reviewed by: brian
Sponsored by: Spectra Logic Corp

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

6 years agoMFC r301207:
asomers [Tue, 30 May 2017 16:05:11 +0000 (16:05 +0000)]
MFC r301207:

Fix exit status of "service routing start <af> <iface>"

etc/rc.d/routing
Ignore the exit status of options_{inet,inet6,atm}. It's
meaningless.

Reviewed by: hrs
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6687

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

6 years agoMFC r318606:
cy [Tue, 30 May 2017 03:33:48 +0000 (03:33 +0000)]
MFC r318606:

Refactor & compact struct i6addr_t #ifdef: remove redundant structure
definintion when USE_INET6 is false.

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

6 years agoMFC r318588:
cy [Tue, 30 May 2017 03:30:53 +0000 (03:30 +0000)]
MFC r318588:

Fix up two assertions following malloc(). vangyzen@ notified me of
the second one. The first one is fixed as well.

Reported by: vangyzen@

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

6 years agoMFC r318578:
cy [Tue, 30 May 2017 03:27:59 +0000 (03:27 +0000)]
MFC r318578:

Fix non-recoverable name resolution failures due to negative cache
entries never expiring. This patch honours the negative cache timeout.

To test/experience the failure do the following:

1. Edit /etc/ncd.conf to adjust the cache timeouts as follows:

positive-time-to-live hosts 30
negative-time-to-live hosts 1

2. Ensure that nsswitch.conf hosts line contains something like:

hosts: files cache dns

Note that cache must be specified before dns.

3. Start nscd.

4. Run the following command:

while true; do nc -z -w 3 www.google.com 80; sleep 5; done

5. While running the command, remove or comment out all nameserver
   statements in /etc/resolv.conf. After a short while you will notice
   non-recoverable name rsolution failures.

6. Uncomment or replace all nameserver statements back into
   /etc/resolv.conf. Take note that name resolution never recovers.
   To recover nscd must be restarted. This patch fixes this.

PR: 207804
Submitted by: Jov <amutu@amutu.com>

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

6 years agoMFC r318745:
cy [Tue, 30 May 2017 03:25:05 +0000 (03:25 +0000)]
MFC r318745:

Remove redundant variable declaration.

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

6 years agoMFC r319015:
ngie [Tue, 30 May 2017 02:56:37 +0000 (02:56 +0000)]
MFC r319015:

Use calloc instead of malloc + memset

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

6 years agoMFC r317313:
ngie [Mon, 29 May 2017 18:20:29 +0000 (18:20 +0000)]
MFC r317313:

gctl_test.t: catch errors with the mdcfg directive

While here, add a note about certain testcases relying on `count=1024` in
the "create" portion.

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

6 years agoMFC r318303:
kib [Mon, 29 May 2017 13:00:39 +0000 (13:00 +0000)]
MFC r318303:
Style.

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

6 years agoMFC r318299:
kib [Mon, 29 May 2017 12:59:24 +0000 (12:59 +0000)]
MFC r318299:
Simplify cleanup on failure in realpath(3).

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

6 years agoMFC r318298:
kib [Mon, 29 May 2017 12:58:30 +0000 (12:58 +0000)]
MFC r318298:
Fix several buffer overflows in realpath(3), and other minor issues.

PR: 219154

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

6 years agoMFC r315561:
ngie [Mon, 29 May 2017 06:31:04 +0000 (06:31 +0000)]
MFC r315561:
r315561 (by trasz):

Bring back the "i".  The point is to make it easy to find via "apropos
iscsi", along with all the other relevant components.

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

6 years agoMFC r316179,r316180,r316181,r316260:
ngie [Mon, 29 May 2017 06:25:59 +0000 (06:25 +0000)]
MFC r316179,r316180,r316181,r316260:

r316179 (by cem):

t_msgsnd: Use msgsnd()'s msgsz argument correctly to avoid overflow

msgsnd's msgsz argument is the size of the message following the 'long'
message type.  Don't include the message type in the size of the message
when invoking msgsnd(2).

CID: 1368712

r316180 (by cem):

Follow-up to r316179: More of the same

CIDs: 1368705136870613687071368710

r316181 (by cem):

t_msgctl: Fix the same msgsnd() misuse as t_msgsnd

msgsnd(2)'s msgsz argument does not describe the full structure, only the
message component.

CIDs: 13687031368711

r316260:

Annotate all changes made in r316178-r316180 with __FreeBSD__

Restore the stock (upstream) code under an #else block, so it's easier
for me to visualize and understand the code that needs to be upstreamed.

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

6 years agoMFC r318315:
ngie [Mon, 29 May 2017 06:22:12 +0000 (06:22 +0000)]
MFC r318315:

lib/libc/gen/realpath_test: make check result from getcwd(3)

This is being done to avoid dereferencing a NULL pointer via strlcat,
obscuring the underlying issue with the getcwd(3) call.

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

6 years agoMFC r318688: "struct ata_params" field "reserved206[2]" actually starts at
rpokala [Mon, 29 May 2017 05:23:09 +0000 (05:23 +0000)]
MFC r318688: "struct ata_params" field "reserved206[2]" actually starts at
offset 20*7*.

Sponsored by: Panasas

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

6 years agoMFC r318860:
hselasky [Sun, 28 May 2017 10:44:43 +0000 (10:44 +0000)]
MFC r318860:
Declare the "snd_fxdiv_table" once. This shaves around 24Kbytes of
binary data from sound.ko and the kernel.

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

6 years agoMFC r318872:
gjb [Sun, 28 May 2017 03:59:33 +0000 (03:59 +0000)]
MFC r318872:
 Enable DHCP and IPv6 autoconfig on non-cloud VM images.

PR: 203653
Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r309412,r316109,r316132:
ngie [Sun, 28 May 2017 01:14:59 +0000 (01:14 +0000)]
MFC r309412,r316109,r316132:

r309412 (by imp):

dd is currently a bootstrap tool. It really doesn't have any business
being a bootstrap tool. However, for reproducible build output,
FreeBSD added dd status=none because it was otherwise difficult to
suppress the status information, but retain any errors that might
happen. There's no real reason that dd has to be a build tool, other
than we use status=none unconditional. Remove dd from a bootstrap tool
entirely by only using status=none when available. This may also help
efforts to build the system on non-FreeBSD hosts as well.

r316109:

Don't hardcode input files for stage 1/2 bootloaders; use .ALLSRC instead

This is a better pattern to follow when creating the bootloaders and doing
the relevant space checks to make sure that the sizes aren't exceeded (and
thus, copy-pasting is a bit less error prone).

r316132:

Parameterize out 7680 (15 * 512) as BOOT2SIZE, similar to sys/boot/i386/zfsboot/...

This is being done to make it easier to change in the future--this action might be
needed sooner rather than later because of gcc 6.3.0 bailing, stating that there
is negative free space left (deficit) in the boot2 bootloader.

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

6 years agoMFC r316131:
ngie [Sun, 28 May 2017 00:47:02 +0000 (00:47 +0000)]
MFC r316131:

Fix up r316081 by using nitems(cam_errbuf) instead of sizeof(cam_errbuf)

Part of my original reasoning as far as converting the snprintf
calls was to permit switching over from char[] to wchar_t[] in the
future, as well as futureproof in case cam_errbuf's size was ever
changed.

Unfortunately, my approach was bugged because it conflated the
number of items with the size of the buffer, instead of the number of
elements being a fixed size != 1 byte.

Use nitems(..) instead which counts the quantity of items of a specific
type, as opposed to an unqualified sizeof(..) (which assumes that the
number of characters is equal to the buffer size).

Noted by: cem

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

6 years agoMFC r317310,r317316:
ngie [Sun, 28 May 2017 00:25:44 +0000 (00:25 +0000)]
MFC r317310,r317316:

r317310:

Minor style(9) fixups

Delete trailing whitespace and sort headers.

Leave libgeom.h's placement alone, per reasoning in r317289.

r317316:

Minor style(9) fixups

Delete trailing whitespace and sort headers.

Leave libgeom.h's placement alone, per reasoning in r317289.

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

6 years agoMFC r317290,r317291,r317292,r317293,r317294,r317295,r317304,r317306,r317307,r317308...
ngie [Sat, 27 May 2017 23:31:59 +0000 (23:31 +0000)]
MFC r317290,r317291,r317292,r317293,r317294,r317295,r317304,r317306,r317307,r317308,r317309:

r317290:

Fix -Wimplicit-function-declaration compilation warning by moving libgeom.h
#include below the stdio.h #include.

gctl_dump(3) needs stdio.h, per reasoning noted in r317289.

PR: 218809

r317291:

Rename gctl.t to gctl_test.t and test.c to gctl_test_helper.c

This is being done to reduce ambiguity and to make the tests more portable
in the future to other locations in the source tree.

r317292:

gctl_test.t: use make to compile gctl_test_helper instead of calling cc directly

r317293:

gctl_test_helper: apply polish

- Staticize variables to fix warnings.
- Sprinkle asserts around for calls that can fail
- Apply style(9) for main(..) definition.
- ANSIify usage(..) definition.

r317294:

Bump WARNS to 6 per previous commits which fixed warnings

Tested with: clang (4.0), gcc (4.2.1, 6.3.0)

r317295:

The GPT class no longer exists; use the PART class instead

r317304:

gctl_test_helper: add diagnostic output for parse_retval(..)

This will help end-users better diagnose issues with the function.

r317306:

gctl_test.t: minor tweaks

- Declare $count with the `my` scope operator to permit `use strict`.
- Add `use strict`.
- Use `use warnings` instead of using `-w` in the shebang.
- Don't unlink $cmd when done (prevents unnecessary rebuilding).
- Improve the error message when running with insufficient permissions, e.g.,
  non-root.

r317307:

Use verb=delete not verb=remove

The `remove` verb hasn't been present in geom_part*(4) for well
over a decade, if ever. I couldn't find any references to it in
^/stable/5 at least, which is around the timeframe that this test
was written.

r317308:

gctl_test.t: more tweaks to try and update the code and get it functional (again?)

- Make the logfile for $out be built off the basename for $cmd, instead of $cmd.
  (r317292 broke this assumption).
- Rename $mntpt to $mntpt_prefix for clarity, as this variable is a prefix for
  mountpoints.
- Reindent the umount directive block while here to match the rest of the code.

r317309:

gctl_test.t: improve error reporting with mdcfg and mount directives

If the commands had failed previously, it would press on and result in a
series of cascading failures. Fail early and continue on to the next case
instead of executing additional commands after a previously failed series
of steps.

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

6 years agoMFC r316099:
ngie [Sat, 27 May 2017 23:26:10 +0000 (23:26 +0000)]
MFC r316099:

lib/libkvm: start adding basic tests for kvm(3)

- kvm_close: add a testcase to verify support for errno = EINVAL / -1
  (see D10065) when kd == NULL is provided to the libcall.
- kvm_geterr:
-- Add a negative testcase for kd == NULL returning "" (see D10022).
-- Add two positive testcases:
--- test the error case using kvm_write on a O_RDONLY descriptor.
--- test the "no error" case using kvm_read(3) and kvm_nlist(3) as
    helper routines and by injecting a bogus error message via
    _kvm_err (an internal API) _kvm_err was used as there isn't a
    formalized way to clear the error output, and because
    kvm_nlist always returns ENOENT with the NULL terminator today.
- kvm_open, kvm_open2:
-- Add some basic negative tests for kvm_open(3) and kvm_open2(3).
   Testing positive cases with a specific
   `corefile`/`execfile`/`resolver` requires more work and would require
   user intervention today in order to reliably test this out.

MFC note:
  lib/libkvm/kvm_open2_test is not compiled/tested because ^/stable/10
  lacks the kvm_open2(3) libcall.

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

6 years agoMFC r318546:
ngie [Sat, 27 May 2017 23:04:48 +0000 (23:04 +0000)]
MFC r318546:

sys/fs/tmpfs/vnd_test: make md(4) allocation dynamic

The previous logic was flawed in the sense that it assumed that /dev/md3
was always available. This was a caveat I noted in r306038, that I hadn't
gotten around to solving before now.

Cache the device for the mountpoint after executing mdmfs, then use the
cached value in basic_cleanup(..) when unmounting/disconnecting the md(4)
device.

Apply sed expressions to use reuse logic in the NetBSD code that could
also be applied to FreeBSD, just with different tools.

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

6 years agoMFC r317288,r317289:
ngie [Sat, 27 May 2017 22:57:07 +0000 (22:57 +0000)]
MFC r317288,r317289:

r317288:

libgeom(3): apply minor polish

- Use .Dv when mentioning NULL per mdoc(7).
- Reword `g_device_path`, `g_open_by_ident`, and `g_providername`'s descriptions
  so they're less wordy.
- Fix a typo in `g_device_path` (can not -> cannot).

Tested with: igor, make manlint

r317289:

libgeom(3): note that stdio.h is required when referencing gctl_dump(3)

gctl_dump(3) is only exposed when stdio.h is #include'd first, per its
addition in r112510. The reasoning noted for the conditional "exposure"
of the function was to "limit #include pollution".

This addresses an issue I found with the documentation when looking at
bug 218809, which in turn addresses a -Wimplicit-function-declaration
compiler warning in `tools/regression/geom_gpt/test.c` (it uses
gctl_dump(3)).

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

6 years agoMFC r318900:
bapt [Sat, 27 May 2017 11:21:20 +0000 (11:21 +0000)]
MFC r318900:

update pci_vendors to 2017.05.25

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

6 years agoMFC r318820:
hselasky [Sat, 27 May 2017 08:27:11 +0000 (08:27 +0000)]
MFC r318820:
Increase the allowed maximum number of audio channels from 31 to 127
in the PCM feeder mixer. Without this change a value of 32 channels is
treated like zero, due to using a mask of 0x1f, causing a kernel
assert when trying to playback bitperfect 32-channel audio. Also
update the AWK script which is generating the division tables to
handle more than 18 channels. This commit complements r282650.

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

6 years agoMFC r318353:
hselasky [Sat, 27 May 2017 08:17:59 +0000 (08:17 +0000)]
MFC r318353:
Avoid use of contiguous memory allocations in busdma when possible.

This patch improves the boundary checks in busdma to allow more cases
using the regular page based kernel memory allocator. Especially in
the case of having a non-zero boundary in the parent DMA tag. For
example AMD64 based platforms set the PCI DMA tag boundary to
PCI_DMA_BOUNDARY, 4GB, which before this patch caused contiguous
memory allocations to be preferred when allocating more than PAGE_SIZE
bytes. Even if the required alignment was less than PAGE_SIZE bytes.

This patch also fixes the nsegments check for using kmem_alloc_attr()
when the maximum segment size is less than PAGE_SIZE bytes.

Updated some comments describing the code in question.

Differential Revision: https://reviews.freebsd.org/D10645
Reviewed by: kib, jhb, gallatin, scottl
Sponsored by: Mellanox Technologies

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

6 years agoMFC r314935 (thompsa):
gjb [Fri, 26 May 2017 19:02:46 +0000 (19:02 +0000)]
MFC r314935 (thompsa):
 Change ec2.conf to use the pkg tool from a chroot rather than trying
 to bootstrap it and fail from the livecd readonly filesystem.

Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r318748:
gjb [Fri, 26 May 2017 13:09:16 +0000 (13:09 +0000)]
MFC r318748:
 Honor WITHOUT_TFTP for check-old* and delete-old* targets.

PR: 217949
Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r318516: Fix time handling in cv_timedwait_hires().
mav [Fri, 26 May 2017 00:26:08 +0000 (00:26 +0000)]
MFC r318516: Fix time handling in cv_timedwait_hires().

pthread_cond_timedwait() receives absolute time, not relative.  Passing
wrong time there caused two threads of zdb to spin in a tight loop.

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

6 years agoMFC r318527
truckman [Thu, 25 May 2017 22:41:34 +0000 (22:41 +0000)]
MFC r318527

Fix the queue delay estimation in PIE/FQ-PIE when the timestamp
(TS) method is used.  When packet timestamp is used, the "current_qdelay"
keeps storing the last queue delay value calculated in the dequeue
function.  Therefore, when a burst of packets arrives followed by
a pause, the "current_qdelay" will store a high value caused by the
burst and stick to that value during the pause because the queue
delay measurement is done inside the dequeue function.  This causes
the drop probability calculation function to calculate high drop
probability value instead of zero and prevents the burst allowance
mechanism from working properly.  Fix this problem by resetting
"current_qdelay" inside the drop probability calculation function
when the queue length is zero and TS option is used.

Submitted by: Rasool Al-Saadi <ralsaadi@swin.edu.au>

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

6 years agoMFC r318511
truckman [Thu, 25 May 2017 17:23:26 +0000 (17:23 +0000)]
MFC r318511

The result of right shifting a negative signed value is implementation
defined.  On machines without arithmetic shift instructions, zero bits
may be shifted in from the left, giving a large positive result instead
of the desired divide-by power-of-2.  Fix this by operating on the
absolute value and compensating for the possible negation later.

Reverse the order of the underflow/overflow tests and the exponential
decay calculation to avoid the possibility of an erroneous overflow
detection if p is a sufficiently small non-negative value.  Also
check for negative values of prob before doing the exponential decay
to avoid another instance of of right shifting a negative value.

Tested by: Rasool Al-Saadi <ralsaadi@swin.edu.au>

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

6 years agoMFC r318863:
jlh [Thu, 25 May 2017 09:34:29 +0000 (09:34 +0000)]
MFC r318863:
  Replace stale handbook URL with the proper oneb.

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

6 years agoMFC r318014, r318091, r318125, and r318263.
np [Thu, 25 May 2017 02:00:37 +0000 (02:00 +0000)]
MFC r318014, r318091, r318125, and r318263.

r318014:
cxgbe(4): Fixes related to the knob that controls link autonegotiation.

- Do not leak the adapter lock in sysctl_autoneg.
- Accept only 0 or 1 as valid settings for autonegotiation.
- A fixed speed must be requested by the driver when autonegotiation is
  disabled otherwise the firmware will reject the l1cfg command.  Use
  the top speed supported by the port for now.

r318091:
cxgbe(4): Do not assume that if_qflush is always followed by inteface-down.

r318125:
Adjust whitespace and fix a comment.  No functional change.

r318263:
cxgbe(4): netmap-only interrupts for a VI do not have an associated rxq
or ofld_rxq and should be ignored by vi_intr_iq.

Sponsored by: Chelsio Communications

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

6 years agoMFC r318646:
gjb [Thu, 25 May 2017 01:45:43 +0000 (01:45 +0000)]
MFC r318646:
 Allow PORTSDIR to be overridden in the pkg-stage target.

PR: 218393
Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r317702, r317847, r318307
np [Thu, 25 May 2017 01:43:28 +0000 (01:43 +0000)]
MFC r317702, r317847, r318307

r317702:
cxgbe(4): Support routines for Tx traffic scheduling.

- Create a new file, t4_sched.c, and move all of the code related to
  traffic management from t4_main.c and t4_sge.c to this file.
- Track both Channel Rate Limiter (ch_rl) and Class Rate Limiter (cl_rl)
  parameters in the PF driver.
- Initialize all the cl_rl limiters with somewhat arbitrary default
  rates and provide routines to update them on the fly.
- Provide routines to reserve and release traffic classes.

r317847:
cxgbe(4): The Tx scheduler initialization either works or doesn't.  It
doesn't need a refresh in either case.

r318307:
cxgbe(4): Avoid an out of bounds access when an attempt to unbind a tx
queue from a traffic class fails.

Sponsored by: Chelsio Communications

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

6 years agoMFC r308737, r308779:
gjb [Thu, 25 May 2017 01:31:12 +0000 (01:31 +0000)]
MFC r308737, r308779:
 r308737:
  Pass SWAPSIZE in env(1) when invoking mk-vmimage.sh, otherwise
  mkimg(1) does not create the second partition after r307008.

 r308779:
  Pass SWAPSIZE in env(1) when invoking mk-vmimage.sh for the
  vm-image target, missed in r308737.

Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r317820 and r317837.
np [Thu, 25 May 2017 01:01:35 +0000 (01:01 +0000)]
MFC r317820 and r317837.

r317820:
cxgbe(4): Update the list of PCIe devices claimed by the driver.  At
this point any board with a T6 should just work.

r317837:
cxgbe(4):  Update the VF device ids too.  This should have been part
of r317820.

Sponsored by: Chelsio Communications

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

6 years agoMFC r316971:
np [Thu, 25 May 2017 00:16:41 +0000 (00:16 +0000)]
MFC r316971:

cxgbe: Add a tunable to configure the SGE time scaler, which is
available starting with T6.  The values in the timer holdoff registers
are multiplied by the scaling factor before use.

dev.<nexus>.<n>.holdoff_timers shows the final values of the
timers in microseconds.

Sponsored by: Chelsio Communications

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

6 years agoMFC r316506:
np [Wed, 24 May 2017 23:08:45 +0000 (23:08 +0000)]
MFC r316506:

cxgbe(4): Program the global RSS key once instead of once per ifnet.

Sponsored by: Chelsio Communications

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

6 years agoMFC r316172:
np [Wed, 24 May 2017 22:48:17 +0000 (22:48 +0000)]
MFC r316172:

cxgbe: Don't call t4_edc_err_read for errors not related to the EDCs.

Sponsored by: Chelsio Communications

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

6 years agoMFC r309725:
np [Wed, 24 May 2017 21:54:04 +0000 (21:54 +0000)]
MFC r309725:

cxgbe(4): netmap does not set IFCAP_NETMAP in an ifnet's if_capabilities
any more (since r307394).  Do it in the driver instead.

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

6 years agoMFC r307008:
np [Wed, 24 May 2017 20:34:19 +0000 (20:34 +0000)]
MFC r307008:

Add the ability to override the size of the swap partition when building
VM images.  The default continues to be 1G.

Sponsored by: Chelsio Communications

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

6 years agoMFC r313318:
np [Wed, 24 May 2017 20:29:20 +0000 (20:29 +0000)]
MFC r313318:

cxgbe(4):  Allow tunables that control the number of queues to be set to
'-n' to tell the driver to create _up to_ 'n' queues if enough cores are
available.  For example, setting hw.cxgbe.nrxq10g="-32" will result in
16 queues if the system has 16 cores, 32 if it has 32.

There is no change in the default number of queues of any type.

Sponsored by: Chelsio Communications

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

6 years agoMFC 318401
jpaetzel [Wed, 24 May 2017 20:13:49 +0000 (20:13 +0000)]
MFC 318401

Increase the number of LUNs this hardware can support.

Experimentally we know this value works, but the hardware
may support an even higher value.

PR: 213876
Reported by: J.Catrysse@proximedia.be

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

6 years agoMFC r313346:
np [Wed, 24 May 2017 20:01:12 +0000 (20:01 +0000)]
MFC r313346:

cxgbe/t4_tom: Fix CLIP entry refcounting on the passive side.  Every
IPv6 connection being handled by the TOE should have a reference on its
CLIP entry.

Sponsored by: Chelsio Communications

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

6 years agoMFC r314131:
np [Wed, 24 May 2017 19:19:02 +0000 (19:19 +0000)]
MFC r314131:

Avoid NULL dereference in a couple of sysctl handlers in ibcore.
iw_cxgbe sets ib_device->dma_device to NULL (since r311880).

Sponsored by: Chelsio Communications

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

6 years agoMFC r311880, r314167, r316118, r316571, r316573, r316580, r316936-r316937,
np [Wed, 24 May 2017 18:16:20 +0000 (18:16 +0000)]
MFC r311880, r314167, r316118, r316571, r316573, r316580, r316936-r316937,
r316940, and r317410.

r311880:
The iw_cxgb and iw_cxgbe drivers should not use a FreeBSD device_t where
a linuxkpi style device is expected.  If OFED/linuxkpi actually starts
using this field then we'll have to figure out whether to create fake
devices for these drivers or have linuxkpi deal with NULL device.

This mismatch was first reported as part of D6585.

r314167:
cxgbe/iw_cxgbe: Minor changes for T6.

r316118:
cxgbe/iw_cxgbe: T6 has no limit on the amount of memory that can be
registered in one ib_reg_phys_mr.

r316571:
cxgbe/iw_cxgbe: Remove bad cast that resulted in incorrect length for
memory regions larger than 4GB.

r316573:
cxgbe/iw_cxgbe: Replace a magic constant with something more readable
(and accurate).

T4 and later have an extra bit for page shift so the maximum page size
is 8TB (shift of 12 + 31) instead of 128MB (12 + 15).  This saves space
in the chip's PBL (physical buffer list) when registering very large
memory regions.

r316580:
cxgbe/iw_cxgbe: Remove another bad cast.  This should have been
included in r316571.

r316936:
cxgbe/iw_cxgbe: hw supports 64K (not 32K) Protection Domains.

r316937:
cxgbe/iw_cxgbe: Report accurate page_size_cap in ib_query_device.

r316940:
cxgbe/iw_cxgbe: Report the actual values of various parameters as
configured by the firmware.

r317410:
cxgbe/iw_cxgbe: Pull in some updates to c4iw_wait_for_reply from the
iw_cxgb4 Linux driver.

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

6 years agoMFC r316774:
np [Wed, 24 May 2017 17:52:56 +0000 (17:52 +0000)]
MFC r316774:

cxgbe: Query some more RDMA related parameters from the firmware.

Sponsored by: Chelsio Communications

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

6 years agoMFC r316854: rename vfs.zfs.debug_flags to vfs.zfs.debugflags
avg [Wed, 24 May 2017 11:38:43 +0000 (11:38 +0000)]
MFC r316854: rename vfs.zfs.debug_flags to vfs.zfs.debugflags

Since this is a stable branch vfs.zfs.debug_flags sysctl is also kept.
The corresponing tunable could never work.

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

6 years agoMFC r316853: dtrace: fix normalization of stddev aggregation
avg [Wed, 24 May 2017 11:11:13 +0000 (11:11 +0000)]
MFC r316853: dtrace: fix normalization of stddev aggregation

Sponsored by: Panzura

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

6 years agoMFC r311846:
np [Wed, 24 May 2017 05:30:36 +0000 (05:30 +0000)]
MFC r311846:
cxgbe(4): Refresh t4_msg.h, mainly for definitions related to the crypto
engine.

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

6 years ago:raw no longer SIGSEGVs on FreeBSD; revert the signal expectation
ngie [Tue, 23 May 2017 19:45:31 +0000 (19:45 +0000)]
:raw no longer SIGSEGVs on FreeBSD; revert the signal expectation

This is a direct commit to ^/stable/10, since this expectation was only
added to ^/stable/10's copy of t_raw.c.

PR: 216954
Sponsored by: Dell EMC Isilon

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

6 years agomove p_sigqueue to the end of struct proc
badger [Tue, 23 May 2017 12:40:50 +0000 (12:40 +0000)]
move p_sigqueue to the end of struct proc

In order to preserve KBI in stable branches, replace the existing
p_sigqueue slot with padding and move the expanded (as of r315949)
p_sigqueue to the end of the struct.

This is a repeat of r317529 (which concerned td_sigqueue in struct
thread) for p_sigqueue in struct proc.

Virtualbox modules (and possibly others) are affected without this fix.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D10843

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

6 years agoMFC: r318287
rmacklem [Mon, 22 May 2017 22:10:02 +0000 (22:10 +0000)]
MFC: r318287
Make nfscl_mtofh() return ENXIO when *nfhpp == NULL.

r317272 introduced a case where nfscl_mtofh() could return 0 when
*nfhpp is NULL. This patch makes it return ENXIO for this case.

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

6 years agoMFC: r317931
rmacklem [Mon, 22 May 2017 21:52:06 +0000 (21:52 +0000)]
MFC: r317931
Fix mount_nfs so that it doesn't create mounttab entries for NFSv4 mounts.

The NFSv4 protocol doesn't use the Mount protocol, so it doesn't make sense
to add an entry for an NFSv4 mount to /var/db/mounttab. Also, r308871
modified umount so that it doesn't remove any entry created by mount_nfs.

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

6 years agoMFC: r317906
rmacklem [Mon, 22 May 2017 19:57:20 +0000 (19:57 +0000)]
MFC: r317906
Fix the client side krpc from doing TCP reconnects for ERESTART from sosend().

When sosend() replies ERESTART in the client side krpc, it indicates that
the RPC message hasn't yet been sent and that the send queue is full or
locked while a signal is posted for the process.
Without this patch, this would result in a RPC_CANTSEND reply from
clnt_vc_call(), which would cause clnt_reconnect_call() to create a new
TCP transport connection. For most NFS servers, this wasn't a serious problem,
although it did imply retries of outstanding RPCs, which could possibly
have missed the DRC.
For an NFSv4.1 mount to AmazonEFS, this caused a serious problem, since
AmazonEFS often didn't retain the NFSv4.1 session and would reply with
NFS4ERR_BAD_SESSION. This implies to the client a crash/reboot which
requires open/lock state recovery.

Three options were considered to fix this:
- Return the ERESTART all the way up to the system call boundary and then
  have the system call redone. This is fraught with risk, due to convoluted
  code paths, asynchronous I/O RPCs etc. cperciva@ worked on this, but it
  is still a work in prgress and may not be feasible.
- Set SB_NOINTR for the socket buffer. This fixes the problem, but makes
  the sosend() completely non interruptible, which kib@ considered
  inappropriate. It also would break forced dismount when a thread
  was blocked in sosend().
- Modify the retry loop in clnt_vc_call(), so that it loops for this case
  for up to 15sec. Testing showed that the sosend() usually succeeded by
  the 2nd retry. The extreme case observed was 111 loop iterations, or
  about 100msec of delay.
This third alternative is what is implemented in this patch, since the
change is:
- localized
- straightforward
- forced dismount is not broken by it.

This patch has been tested by cperciva@ extensively against AmazonEFS.

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

6 years agoMFC r318383
davidcs [Mon, 22 May 2017 19:40:56 +0000 (19:40 +0000)]
MFC r318383
 QL_DPRINT macro modfied to handle multiple args; print line#.

Submitted by:Shminderjit.Singh@cavium.com

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

6 years agoMFC r318382
davidcs [Mon, 22 May 2017 19:36:26 +0000 (19:36 +0000)]
MFC r318382
 1. Move Rx Processing to fp_taskqueue(). With this CPU utilization for
    processing interrupts drops to around 1% for 100G and under 1% for
    other speeds.
 2. Use sysctls for TRACE_LRO_CNT and TRACE_TSO_PKT_LEN
 3. remove unused mtx tx_lock
 4. bind taskqueue kernel thread to the appropriate cpu core
 5. when tx_ring is full, stop further transmits till at least 1/16th of
    the Tx Ring is empty. In our case 1K entries. Also if there are
    rx_pkts to process, put the taskqueue thread to sleep for 100ms,
    before enabling interrupts.
 6. Use rx_pkt_threshold of 128.

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

6 years agoMFC r305613 (gabor):
gjb [Mon, 22 May 2017 16:11:46 +0000 (16:11 +0000)]
MFC r305613 (gabor):
 Fix typo.

PR: 211245
Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r313955 (emaste):
gjb [Mon, 22 May 2017 15:51:17 +0000 (15:51 +0000)]
MFC r313955 (emaste):
 bsdgrep: document ignored option -u

 MSDOS and Windows GNU grep uses -u to mean "print byte offsets as if
 running on an UNIX system." The option has no effect on systems that
 do not use CRLF line endings.

PR: 171200
Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r318531:
hselasky [Mon, 22 May 2017 08:19:08 +0000 (08:19 +0000)]
MFC r318531:

mlx4: Use the CQ quota for SRIOV when creating completion EQs

When creating EQs to handle CQ completion events for the PF or for
VFs, we create enough EQE entries to handle completions for the max
number of CQs that can use that EQ.

When SRIOV is activated, the max number of CQs a VF (or the PF) can
obtain is its CQ quota (determined by the Hypervisor resource
tracker).  Therefore, when creating an EQ, the number of EQE entries
that the VF should request for that EQ is the CQ quota value (and not
the total number of CQs available in the firmware).

Under SRIOV, the PF, also must use its CQ quota, because the resource
tracker also controls how many CQs the PF can obtain.

Using the firmware total CQs instead of the CQ quota when creating EQs
resulted wasting MTT entries, due to allocating more EQEs than were
needed.

Sponsored by: Mellanox Technologies

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

6 years agoMFC r316103:
ngie [Mon, 22 May 2017 06:29:20 +0000 (06:29 +0000)]
MFC r316103:

Remove redundant declarations

They're already defined in libstand.h

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

6 years agoMFC r315775:
ngie [Mon, 22 May 2017 06:20:58 +0000 (06:20 +0000)]
MFC r315775:

Add a post-humous manpage for cd9660(5), the ISO-9660 file system

Describe (briefly) how to compile the filesystem into the kernel and
load as a module.

Reference cd9660(5) in mount(8) and mount_cd9660(8).

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

6 years agoRegenerate src.conf(5) per r318614
ngie [Mon, 22 May 2017 06:12:30 +0000 (06:12 +0000)]
Regenerate src.conf(5) per r318614

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

6 years agoRevert r318615 to correct commit message
ngie [Mon, 22 May 2017 06:10:46 +0000 (06:10 +0000)]
Revert r318615 to correct commit message

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

6 years agoMFC r315766,r315768:
ngie [Mon, 22 May 2017 06:09:47 +0000 (06:09 +0000)]
MFC r315766,r315768:

r315766:

Note that tools/build/options/makeman automatically generated src.conf(5)

This (as a bonus) fixes mdoc warnings with src.conf(5) :)..

r315768:

Remove the .Pa portion I added to the .An macro in AUTHORS section

That doesn't work (mandoc complains about the macro being empty).

That's what I get for being clever and not verifying before committing
things again *sigh*.

Partyhat to: ngie

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

6 years agoMFC r315766,r315768:
ngie [Mon, 22 May 2017 06:08:20 +0000 (06:08 +0000)]
MFC r315766,r315768:

r315766:

Note that tools/build/options/makeman automatically generated src.conf(5)

This (as a bonus) fixes mdoc warnings with src.conf(5) :)..

r315768:

Remove the .Pa portion I added to the .An macro in AUTHORS section

That doesn't work (mandoc complains about the macro being empty).

That's what I get for being clever and not verifying before committing
things again *sigh*.

Partyhat to: ngie

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

6 years agoMFC r315793:
ngie [Mon, 22 May 2017 06:06:48 +0000 (06:06 +0000)]
MFC r315793:

intro(3): fix markup

- Use `Em` with `.It` macro when referring to other libraries, instead of
  `Xr`.
- Use `.Em` instead of `.Xr` when referring to libraries.
- Remove commented out lines.

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

6 years agoMFC r317160:
ngie [Mon, 22 May 2017 06:05:14 +0000 (06:05 +0000)]
MFC r317160:

Clean up trailing whitespace

No functional changes

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

6 years agoMFC r317154:
ngie [Mon, 22 May 2017 06:04:20 +0000 (06:04 +0000)]
MFC r317154:

Print out the signal number on exit in terminate(..) if WARMSTART is compiled
into rpcbind.

The signal number can provide helpful diagnostic info.

Obtained from: Isilon OneFS

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

6 years agoMFC 318512
sephe [Mon, 22 May 2017 02:30:15 +0000 (02:30 +0000)]
MFC 318512

    net/vlan: Revert 305177

    Miss read the parentheses.

    Reported by:    oleg@
    Reviewed by:    hps@
    Sponsored by:   Microsoft

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

6 years agoMFC r317505:
hselasky [Fri, 19 May 2017 13:04:09 +0000 (13:04 +0000)]
MFC r317505:
Don't free uninitialized sysctl contexts in the mlx4en driver. This
can cause NULL pointer panics during failed device attach.

Differential Revision: https://reviews.freebsd.org/D8876
Sponsored by: Mellanox Technologies

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

6 years agoMFC r313555:
hselasky [Fri, 19 May 2017 12:53:50 +0000 (12:53 +0000)]
MFC r313555:
Flexible and asymmetric allocation of EQs and MSI-X vectors for PF/VFs.

Previously, the mlx4 driver queried the firmware in order to get the
number of supported EQs. Under SRIOV, since this was done before the
driver notified the firmware how many VFs it actually needs, the
firmware had to take into account a worst case scenario and always
allocated four EQs per VF, where one was used for events while the
others were used for completions. Now, when the firmware supports the
asymmetric allocation scheme, denoted by exposing num_sys_eqs > 0 (-->
MLX4_DEV_CAP_FLAG2_SYS_EQS), we use the QUERY_FUNC command to query
the firmware before enabling SRIOV. Thus we can get more EQs and MSI-X
vectors per function. Moreover, when running in the new
firmware/driver mode, the limitation that the number of EQs should be
a power of two is lifted.

Obtained from: Linux (dual BSD/GPLv2 licensed)
Submitted by: Dexuan Cui @ microsoft . com
Differential Revision: https://reviews.freebsd.org/D8867
Sponsored by: Mellanox Technologies

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

6 years agoMFC r313556:
hselasky [Fri, 19 May 2017 12:39:35 +0000 (12:39 +0000)]
MFC r313556:
Change mlx4 QP allocation scheme.

When using Blue-Flame, BF, the QPN overrides the VLAN, CV, and SV
fields in the WQE. Thus, BF may only be used for QPNs with bits 6,7
unset.

The current ethernet driver code reserves a TX QP range with 256b
alignment.

This is wrong because if there are more than 64 TX QPs in use, QPNs >=
base + 65 will have bits 6/7 set.

This problem is not specific for the Ethernet driver, any entity that
tries to reserve more than 64 BF-enabled QPs should fail. Also, using
ranges is not necessary here and is wasteful.

The new mechanism introduced here will support reservation for "Eth
QPs eligible for BF" for all drivers: bare-metal, multi-PF, and VFs
(when hypervisors support WC in VMs). The flow we use is:

1. In mlx4_en, allocate Tx QPs one by one instead of a range allocation,
   and request "BF enabled QPs" if BF is supported for the function

2. In the ALLOC_RES FW command, change param1 to:
a. param1[23:0]  - number of QPs
b. param1[31-24] - flags controlling QPs reservation

Bit 31 refers to Eth blueflame supported QPs. Those QPs must have bits
6 and 7 unset in order to be used in Ethernet.

Bits 24-30 of the flags are currently reserved.

When a function tries to allocate a QP, it states the required
attributes for this QP. Those attributes are considered "best-effort".
If an attribute, such as Ethernet BF enabled QP, is a must-have
attribute, the function has to check that attribute is supported
before trying to do the allocation.

In a lower layer of the code, mlx4_qp_reserve_range masks out the bits
which are unsupported. If SRIOV is used, the PF validates those
attributes and masks out unsupported attributes as well. In order to
notify VFs which attributes are supported, the VF uses QUERY_FUNC_CAP
command. This command's mailbox is filled by the PF, which notifies
which QP allocation attributes it supports.

Obtained from: Linux (dual BSD/GPLv2 licensed)
Submitted by: Dexuan Cui @ microsoft . com
Differential Revision: https://reviews.freebsd.org/D8868
Sponsored by: Mellanox Technologies

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

6 years agoMFC r318243:
kib [Fri, 19 May 2017 10:16:51 +0000 (10:16 +0000)]
MFC r318243:
Do not wake up sleeping thread in reschedule_signals() if the signal
is blocked.  The spurious wakeup might result in spurious EINTR.

PR: 219228

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

6 years agoMFC r318150:
eugen [Fri, 19 May 2017 07:31:48 +0000 (07:31 +0000)]
MFC r318150:

Fix translation of transit PPtP/GRE connections for ipfw nat/natd "global" case.

PR:             218968
Approved by:    ae, vsevolod (mentor)

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

6 years agoMFC r314693
rgrimes [Fri, 19 May 2017 02:12:10 +0000 (02:12 +0000)]
MFC r314693
  Change /etc/rmt symlink from absolute to relative path,
  correcting the mistake made in r6499

Approved by: grehan (mentor)

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

6 years agoPersistently store NIC's hardware MAC address, and add a way to retrive it
rpokala [Thu, 18 May 2017 23:41:34 +0000 (23:41 +0000)]
Persistently store NIC's hardware MAC address, and add a way to retrive it

jhb pointed out that (struct ifnet) is part of the network driver KBI, and
thus the offsets of internal fields must not change. Therefore, move the new
"if_hw_addr" field to the end, and consume one of the "if_pspare"s; that's
what they're there for. Because netmap on stable/10 uses "if_pspare[0]", the
new field replaces the *last* element of that array; that way,
offsetof(if_pspare) is unchanged compared to before r318430.

PR: 194386
Reviewed by: jhb
Pointyhat to: rpokala
Sponsored by: Panasas

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

6 years agoMFC: r314345, r318276
marius [Thu, 18 May 2017 21:09:31 +0000 (21:09 +0000)]
MFC: r314345, r318276

- Add ID for NEC uPD720202 xHCI controller.
- Describe Intel Apollo Lake and Braswell USB 3.0 controllers.

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

6 years agoMFC: r318282
marius [Thu, 18 May 2017 21:00:53 +0000 (21:00 +0000)]
MFC: r318282

- Unlike as in the PCI case, when attached to ACPI, Intel Bay Trail
  and Braswell eMMC and SDXC controllers share the same IDs. Like in
  the PCI case, Braswell eMMC needs the SDHCI_QUIRK_DATA_TIMEOUT_1MHZ
  quirk (see r311794 for the corresponding change to the sdhci(4) PCI
  PCI front-end), though. However, due to the shared ACPI IDs, this
  is trickier to do.
- Intel Apollo Lake eMMC and SDXC controllers are affected by the
  APL18 ("Using 32-bit Addressing Mode With SD/eMMC Controller May
  Lead to Unpredictable System Behavior") silicon bug. When this
  erratum hits, typically both SDHCI and XHCI controllers wedge.
  According to Intel, using ADMA2 with 64-bit addressing and 96-bit
  descriptors serves as a workaround. Until such times when sdhci(4)
  has ADMA2 support, flag DMA as broken for affected interfaces.
  This turns out to work around the problem, too, at the cost of
  performance.
- In the sdhci(4) ACPI front-end, probe the Intel Apollo Lake eMMC
  and SDXC controllers, too.

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

6 years agoMFC: r315598
marius [Thu, 18 May 2017 20:46:27 +0000 (20:46 +0000)]
MFC: r315598

o Add support for eMMC DDR bus speed mode up to 52 MHz to sdhci(4)
  and mmc(4). Given that support for DDR52 is not denoted by SDHCI
  capability registers, availability of that timing is indicated by
  a new quirk SDHCI_QUIRK_MMC_DDR52 and only enabled for Intel SDHCI
  controllers so far.

  Compared to 50 MHz at SDR high speed typically yielding ~45 MB/s
  read throughput with the eMMC chips tested, read performance goes
  up to ~80 MB/s at DDR52.

  As a side-effect, this change also fixes communication with some
  eMMC devices at SDR high speed mode due to the signaling voltage
  and UHS bits in the SDHCI controller no longer being left in an
  inappropriate state.

o In sdhci(4), add two tunables hw.sdhci.quirk_clear as well as
  hw.sdhci.quirk_set, which (when hooked up in the front-end)
  allow to set/clear sdhci(4) quirks for debugging and testing
  purposes. However, especially for SDHCI controllers on the
  PCI bus which have no specific support code so far and, thus,
  are picked up as generic SDHCI controllers, hw.sdhci.quirk_set
  allows for setting the necessary quirks (if required).

o In mmc(4), check and handle the return values of some more
  function calls instead of assuming that everything went right.
  In case failures actually are not problematic, indicate that
  by casting the return value to void.

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

6 years agoMFC r317782,318181:
mm [Thu, 18 May 2017 19:50:15 +0000 (19:50 +0000)]
MFC r317782,318181:

MFC r317782 (mm):
  Sync libarchive with vendor

  Vendor changes (FreeBSD-related):
    PR 897: add test for ZIP archives with invalid EOCD headers
    PR 901: fix invalid renaming of sparse files
    OSS-Fuzz issue 497: remove fallback tree in LZX decoder
    OSS-Fuzz issue 527: rewrite expressions in lz4 filter
    OSS-Fuzz issue 577: fix integer overflow in cpio reader
    OSS-Fuzz issue 862: fix numerc parsing in mtree reader
    OSS-Fuzz issue 1097: fix undefined shift in rar reader
    cpio: various optimizations and memory leak fixes

MFC r318181 (ngie) (2):
  cpio/tests/test_option_lz4: fix a use after free in the failure case

Reported by: Coverity (2)
Sponsored by: Dell EMC Isilon (2)

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

6 years agoMFC r318294:
gjb [Thu, 18 May 2017 12:27:41 +0000 (12:27 +0000)]
MFC r318294:
 Correct the URL to instructions for updating system sources.

PR: 219303
Sponsored by: The FreeBSD Foundation

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

6 years agoRevert the partial MFC of r313045 which broke dtrace
smh [Thu, 18 May 2017 03:32:01 +0000 (03:32 +0000)]
Revert the partial MFC of r313045 which broke dtrace

This removes the mbuf to ipinfo_t translator and switches tcp_autorcvbuf to
use the older mtod macro.

This was originally merged to stable/10 as part of r317375.

Reported by: markj
Reviewed by: markj, hiren
Sponsored by: Multiplay
Differential Revision:  https://reviews.freebsd.org/D10769

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

6 years agoMFC 317783
sephe [Thu, 18 May 2017 01:42:55 +0000 (01:42 +0000)]
MFC 317783
    hyperv/kvp: Fix pool direcrory and file permission

    PR: 209385
    Sponsored by: Microsoft

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

6 years agoMFC r318160, 318176: Persistently store NIC's hardware MAC address, and add
rpokala [Wed, 17 May 2017 22:29:25 +0000 (22:29 +0000)]
MFC r318160, 318176: Persistently store NIC's hardware MAC address, and add
a way to retrive it

NOTE: Due to restructuring, the merges didn't apply cleanly; the resulting
change is almost identical to what went into stable/11, but in some cases in
different locations.

The MAC address reported by `ifconfig ${nic} ether' does not always match
the address in the hardware, as reported by the driver during attach. In
particular, NICs which are components of a lagg(4) interface all report the
same MAC.

When attaching, the NIC driver passes the MAC address it read from the
hardware as an argument to ether_ifattach(). Keep a second copy of it, and
create ioctl(SIOCGHWADDR) to return it. Teach `ifconfig' to report it along
with the active MAC address.

PR: 194386

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

6 years agoMFC 318136
sephe [Wed, 17 May 2017 02:40:06 +0000 (02:40 +0000)]
MFC 318136

    hyperv/vmbus: Reorganize vmbus device tree

    For GEN1 Hyper-V, vmbus is attached to pcib0, which contains the
    resources for PCI passthrough and SR-IOV.  There is no
    acpi_syscontainer0 on GEN1 Hyper-V.

    For GEN2 Hyper-V, vmbus is attached to acpi_syscontainer0, which
    contains the resources for PCI passthrough and SR-IOV.  There is
    no pcib0 on GEN2 Hyper-V.

    The ACPI VMBUS device now only holds its _CRS, which is empty as
    of this commit; its existence is mainly for upward compatibility.

    Device tree structure is suggested by jhb@.

    Tested-by: dexuan@
    Collabrated-wth: dexuan@
    Sponsored by: Microsoft
    Differential Revision: https://reviews.freebsd.org/D10565

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

6 years agoMFC r318283:
cy [Wed, 17 May 2017 01:45:26 +0000 (01:45 +0000)]
MFC r318283:

As of r318281 in HEAD (r318390 [in stable/10 & stable/11]), there is no
need to put a colon (:) in the message string.

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

6 years agoMFC r318281:
cy [Wed, 17 May 2017 01:38:32 +0000 (01:38 +0000)]
MFC r318281:

Separate the ipfilter function/static string from the error with a
colon (:) in error messages to assist the user in parsing out the error
from where or which object the error message refers to.

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

6 years agoMFC r318259:
dim [Tue, 16 May 2017 18:54:25 +0000 (18:54 +0000)]
MFC r318259:

Silence a -Wunused warning about the junk variable being used to raise
an inexact floating point exception.  The variable cannot be eliminated,
unfortunately, otherwise the desired addition triggering the exception
will be emitted neither by clang, nor by gcc.

Reviewed by: Steve Kargl, bde

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

6 years agoMFC r317660, r317710
brooks [Mon, 15 May 2017 23:13:49 +0000 (23:13 +0000)]
MFC r317660, r317710

r317660:
Support clnt_raw's use of FD_SETSIZE as a fake file descriptor.

Accomplish this by allocating space for it in __svc_xports and allowing
it to be registered.  The failure to allocate space was causing an
out-of-bounds read in svc_getreq_common().  The failure to register
caused PR 211804.

The bug was found with CHERI bounds checking.

PR: 211804
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D10528

r317710:
Remove expected failure now that it was fixed in r317660.

PR: 211804
Reviewed by: ngie
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10576

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

6 years agoMFC r317845-r317846
brooks [Mon, 15 May 2017 22:50:54 +0000 (22:50 +0000)]
MFC r317845-r317846

r317845:
Provide a freebsd32 implementation of sigqueue()

The previous misuse of sys_sigqueue() was sending random register or
stack garbage to 64-bit targets.  The freebsd32 implementation preserves
the sival_int member of value when signaling a 64-bit process.

Document the mixed ABI implementation of union sigval and the
incompability of sival_ptr with pointer integrity schemes.

Reviewed by: kib, wblock
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10605

r317846:
Regen post r317845.

MFC with: r317845
Sponsored by: DARPA, AFRL

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

6 years agoMFC r317658:
bdrewery [Mon, 15 May 2017 18:41:12 +0000 (18:41 +0000)]
MFC r317658:

  Redo r288270: Hookup mkcsmapper_static and mkesdb_static for 'make clean'

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

6 years agoMFC r317996
davidcs [Mon, 15 May 2017 18:21:36 +0000 (18:21 +0000)]
MFC r317996
    Fix bug where MTX_DEF lock was held while taskqueue_drain() was invoked.
    Check IFF_DRV_RUNNING flag is set prior to calling ql_hw_set_multi()

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

6 years agoMFC r318126
davidcs [Mon, 15 May 2017 17:48:58 +0000 (17:48 +0000)]
MFC r318126
    llh_func_filter needs to be configured for 100G

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

6 years agoMFC r318185:
ken [Mon, 15 May 2017 15:27:59 +0000 (15:27 +0000)]
MFC r318185:

  Add LTO-8 density codes.

  lib/libmt/mtlib.c:
   Add the LTO-8 density code to the density table in libmt.

  usr.bin/mt/mt.1:
   Add the LTO-8 density code, tracks, bpmm, and bpi to the density
   table in the mt(1) man page.

Sponsored by: Spectra Logic

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

6 years agoMFC: r317982
marius [Sun, 14 May 2017 14:21:11 +0000 (14:21 +0000)]
MFC: r317982

- Also outside of the KOBJOPLOOKUP macro - which in turn is used by
  the code auto-generated for *.m - kobj_lookup_method(9) is useful;
  for example in back-ends or base class device drivers in order to
  determine whether a default method has been overridden. Thus, allow
  for the kobj_method_t pointer argument - used by KOBJOPLOOKUP in
  order to update the cache entry - of kobj_lookup_method(9), to be
  NULL. Actually, that pointer is redundant as it's just set to the
  same kobj_method_t that the kobj_lookup_method(9) function returns
  in the first place, but probably it serves to reduce the number of
  instructions generated for KOBJOPLOOKUP.
- For the same reason, move updating kobj_lookup_{hits,misses} (if
  KOBJ_STATS is defined) from kobj_lookup_method(9) to KOBJOPLOOKUP.
  As a side-effect, this gets rid of the convoluted approach of always
  incrementing kobj_lookup_hits in KOBJOPLOOKUP and then in case of
  a cache miss, decrementing it in kobj_lookup_method(9) again.

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