]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC: r348340
Jung-uk Kim [Tue, 28 May 2019 21:57:01 +0000 (21:57 +0000)]
MFC: r348340

Merge OpenSSL 1.1.1c.

5 years agoMFC r348066, r348090:
Mark Johnston [Tue, 28 May 2019 14:17:03 +0000 (14:17 +0000)]
MFC r348066, r348090:
bootpd: Add an option to skip modifications to the ARP table.

PR: 30854

5 years agoMFC r348069: bootpd: avoid the same error indication for different issues
Ed Maste [Tue, 28 May 2019 13:14:53 +0000 (13:14 +0000)]
MFC r348069: bootpd: avoid the same error indication for different issues

There were several (apparently) copy-pasted NEED validation macros,
leading to the same error string for different issues.  Change the
YP and NTP tags so they are distinct.

PR: 30863
Submitted by: Dan Lukes <dan@obluda.cz>
Reviewed by: markj

5 years agoMFC r347642:
Cy Schubert [Tue, 28 May 2019 02:00:09 +0000 (02:00 +0000)]
MFC r347642:

The driver list prints "(null)" for the NDIS driver when -h (help) or
an unknown switch is passed outputting the command usage. This is
because the NDIS driver is uninitialized when usage help is printed.
To resolve this we initialize the driver prior to the possibility of
printing the usage help message.

Obtained from: The wpa_supplicant port

5 years agoMFC r348215, r348219: fix bectl(8) jail w/ numeric BE names
Kyle Evans [Mon, 27 May 2019 02:18:33 +0000 (02:18 +0000)]
MFC r348215, r348219: fix bectl(8) jail w/ numeric BE names

r348215:
jail_getid(3): validate jid string input

Currently, if jail_getid(3) is passed in a numeric string, it assumes that
this is a jid string and passes it back converted to an int without checking
that it's a valid/existing jid. This breaks consumers that might use
jail_getid(3) to see if it can trivially grab a jid from a name if that name
happens to be numeric but not actually the name/jid of the jail. Instead of
returning -1 for the jail not existing, it'll return the int version of the
input and the consumer will not fallback to trying other methods.

Pass the numeric input to jail_get(2) as the jid for validation, rather than
the name. This works well- the kernel enforces that jid=name if name is
numeric, so doing the safe thing and checking numeric input as a jid will
still DTRT based on the description of jail_getid.

r348219:
bectl(8): Add a test for jail/unjail of numeric BE names

Fixed by r348215, bectl ujail first attempts the trivial fetch of a jid by
passing the first argument to 'ujail' to jail_getid(3) in case a jid/name
have been passed in instead of a BE name. For numerically named BEs, this
was doing the wrong thing: instead of failing to locate the jid specified
and falling back to mountpath search, jail_getid(3) would return the input
as-is.

While here, I've fixed bectl_jail_cleanup which still used a hard-coded pool
name that was overlooked w.r.t. other work that was in-flight around the
same time.

5 years agoMFC r348127: bectl(8): add description for create subcommand
Kyle Evans [Mon, 27 May 2019 02:17:41 +0000 (02:17 +0000)]
MFC r348127: bectl(8): add description for create subcommand

In commit r345845, a portion of documentation for the create subcommand was
removed. Specifically, for creating a snapshot of an existing boot
environment. bectl even has a test-case for this functionality.

Removing the sub-command description was discussed in PR 235850.

This patch brings back the second "create" description that was originally
in place. Albeit, with a few wording/clarifying changes.

5 years agoMFC r347975:
Michael Tuexen [Sun, 26 May 2019 16:43:06 +0000 (16:43 +0000)]
MFC r347975:
Improve input validation for the IPPROTO_SCTP level socket options
SCTP_CONNECT_X and SCTP_CONNECT_X_DELAYED.

MFC r347976:
Allow sending on demand SCTP HEARTBEATS only in the ESTABLISHED state.
This issue was found by running syzkaller.

5 years agoLinuxKPI: Revert MFC of r347892
Johannes Lundberg [Sat, 25 May 2019 20:53:23 +0000 (20:53 +0000)]
LinuxKPI: Revert MFC of r347892

Revert until we can figure out how to keep compatibility with drm-kmod
ports between 12.0 and 12-STABLE/12.1.

5 years agoMFC r344385:
Johannes Lundberg [Sat, 25 May 2019 20:24:51 +0000 (20:24 +0000)]
MFC r344385:
PFS: Bump NAMELEN and don't require clients to be sleepable

- debugfs consumers expect to be able to export names more than 48 characters

- debugfs consumers expect to be able to hold locks across calls and are able
  to handle allocation failures

Reviewed by: hps@
Sponsored by: iX Systems
Differential Revision: https://reviews.freebsd.org/D19256

5 years agoMFC r344384:
Johannes Lundberg [Sat, 25 May 2019 19:59:59 +0000 (19:59 +0000)]
MFC r344384:
Add non-sleepable strdup variant strdup_flags

debugfs expects to do non-sleepable allocations

Reviewed by: hps@
Sponsored by: iX Systems
Differential Revision: https://reviews.freebsd.org/D19259

5 years agoMFC r347892:
Johannes Lundberg [Sat, 25 May 2019 18:36:38 +0000 (18:36 +0000)]
MFC r347892:
LinuxKPI: Finalize import of seq_file.

seq_file.h and linux_seq_file.c was imported form ports earlier but
linux_seq_file.c was never compiled in with the module. With this
commit base seq_file will replace ports seq_file and it required a
few modifications to not break functionality and build.

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r344486:
Johannes Lundberg [Sat, 25 May 2019 18:23:32 +0000 (18:23 +0000)]
MFC r344486:
Change seq_read to seq_load to avoid namespace conflicts with lkpi

Sponsored by: iX Systems

5 years agoLinuxKPI: Register new linuxkpi and lindebugfs source files.
Johannes Lundberg [Sat, 25 May 2019 18:03:17 +0000 (18:03 +0000)]
LinuxKPI: Register new linuxkpi and lindebugfs source files.

This change is a partial MFC of r344487.

Reviewed by: hps
Approved by: imp (mentor), hps
Obtained from: mmacy

5 years agoMFC r344485:
Johannes Lundberg [Sat, 25 May 2019 17:17:08 +0000 (17:17 +0000)]
MFC r344485:
import linux debugfs support

Reviewed by: hps@
Sponsored by: iX Systems
Differential Revision: https://reviews.freebsd.org/D19258

5 years agoMFC of 348074
Kirk McKusick [Fri, 24 May 2019 23:07:32 +0000 (23:07 +0000)]
MFC of 348074

Rewrite fsck_readdir() and dircheck() for clarity and correctness.

5 years agoMFC r347596:
Johannes Lundberg [Fri, 24 May 2019 17:14:07 +0000 (17:14 +0000)]
MFC r347596:
LinuxKPI: Add context member to ww_mutex and bump FreeBSD version.

This patch is part of https://reviews.freebsd.org/D19565.

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347891:
Johannes Lundberg [Fri, 24 May 2019 17:06:10 +0000 (17:06 +0000)]
MFC r347891:
LinuxKPI: Add in_task macro.

This patch is part of D19565

Reviewed by: hps, bwidawsk
Approved by: imp (mentor), hps
Obtained from: bwidawsk

5 years agoMFC r347843:
Johannes Lundberg [Fri, 24 May 2019 17:04:27 +0000 (17:04 +0000)]
MFC r347843:
LinuxKPI: Add group_leader member to struct task_struct.

Assign self as group leader at creation to act as the only member of a
new process group.
Bump FreeBSD version.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347852:
Johannes Lundberg [Fri, 24 May 2019 17:01:05 +0000 (17:01 +0000)]
MFC r347852:
LinuxKPI: Updates to tasklets for Linux 5.0.

DRM drivers expect tasklets to have a counter for enable/disable calls.
Also, add a few more tasklet locking functions.
MFC also includes powerpc build fix from r347889.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347837:
Johannes Lundberg [Fri, 24 May 2019 15:37:54 +0000 (15:37 +0000)]
MFC r347837:
LinuxKPI: Update access_ok macro for v5.0.

Check LINUXKPI_VERSION macro for backwards compatibility.
It's recommended to update any drivers that depend on the older KPI
so we can deprecate < 5.0 code as we update to newer Linux version.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r348002:
Mark Johnston [Fri, 24 May 2019 14:38:31 +0000 (14:38 +0000)]
MFC r348002:
Typo.

5 years agoMFC r346598: Enable Mellanox drivers (modules) on AArch64
Ed Maste [Fri, 24 May 2019 13:39:56 +0000 (13:39 +0000)]
MFC r346598: Enable Mellanox drivers (modules) on AArch64

PR: 237055
Submitted by: Greg V <greg@unrelenting.technology>

5 years agoFix the build. Use NET_EPOCH_ENTER_ET() and NET_EPOCH_EXIT_ET().
Andrey V. Elsukov [Fri, 24 May 2019 09:01:54 +0000 (09:01 +0000)]
Fix the build. Use NET_EPOCH_ENTER_ET() and NET_EPOCH_EXIT_ET().

This is direct commit to stable/12, since macros are different in stable/12
and head/ branches.

5 years agoMFC r346630:
Andrey V. Elsukov [Fri, 24 May 2019 08:42:34 +0000 (08:42 +0000)]
MFC r346630:
  Add GRE-in-UDP encapsulation support as defined in RFC8086.

  This GRE-in-UDP encapsulation allows the UDP source port field to be
  used as an entropy field for load-balancing of GRE traffic in transit
  networks. Also most of multiqueue network cards are able distribute
  incoming UDP datagrams to different NIC queues, while very little are
  able do this for GRE packets.

  When an administrator enables UDP encapsulation with command
  `ifconfig gre0 udpencap`, the driver creates kernel socket, that binds
  to tunnel source address and after udp_set_kernel_tunneling() starts
  receiving of all UDP packets destined to 4754 port. Each kernel socket
  maintains list of tunnels with different destination addresses. Thus
  when several tunnels use the same source address, they all handled by
  single socket.  The IP[V6]_BINDANY socket option is used to be able bind
  socket to source address even if it is not yet available in the system.
  This may happen on system boot, when gre(4) interface is created before
  source address become available. The encapsulation and sending of packets
  is done directly from gre(4) into ip[6]_output() without using sockets.

  Reviewed by: eugen
  Relnotes: yes
  Differential Revision: https://reviews.freebsd.org/D19921

5 years agoMFC r347383:
Andrey V. Elsukov [Fri, 24 May 2019 08:40:37 +0000 (08:40 +0000)]
MFC r347383:
  In mld_v2_cancel_link_timers() check number of references and disconnect
  inm before releasing the last reference. This fixes possible panics and
  assertion.

  PR: 237329
  Reviewed by: mmacy

5 years agoMerge r344481:
Gleb Smirnoff [Fri, 24 May 2019 06:27:11 +0000 (06:27 +0000)]
Merge r344481:
  Support struct ip_mreqn as argument for IP_ADD_MEMBERSHIP. Legacy support
  for struct ip_mreq remains in place.

  The struct ip_mreqn is Linux extension to classic BSD multicast API. It
  has extra field allowing to specify the interface index explicitly. In
  Linux it used as argument for IP_MULTICAST_IF and IP_ADD_MEMBERSHIP.
  FreeBSD kernel also declares this structure and supports it as argument
  to IP_MULTICAST_IF since r170613. So, we have structure declared but
  not fully supported, this confused third party application configure
  scripts.

  Code handling IP_ADD_MEMBERSHIP was mixed together with code for
  IP_ADD_SOURCE_MEMBERSHIP.  Bringing legacy and new structure support
  into the mess would made the "argument switcharoo" intolerable, so
  code was separated into its own switch case clause.

5 years agoMFC: r346717: Make bhyve SMBIOS table topology aware
Rodney W. Grimes [Fri, 24 May 2019 05:47:16 +0000 (05:47 +0000)]
MFC: r346717: Make bhyve SMBIOS table topology aware

When the CPU Topology was added to bhyve in r332298 the SMBIOS table was
missed, this table passes topology information to the system and was still
using the old concept of each vCPU is a socket with 1 core and 1 thread.
This code did not even try to use the old sysctl information to adjust
this data.

Correct that by building a proper SMBios table, mapping the > 254 cases to
0 per the SMBios 2.6 specification that is claimed by the structure.

Approved by: bde (implicit/mentor)

5 years agoMFC: r346714: Add accessor function for vm->maxcpus
Rodney W. Grimes [Fri, 24 May 2019 04:15:38 +0000 (04:15 +0000)]
MFC: r346714: Add accessor function for vm->maxcpus

Replace most VM_MAXCPU constant useses with an accessor function to
vm->maxcpus which for now is initialized and kept at the value of
VM_MAXCPUS.

This is a rework of Fabian Freyer (fabian.freyer_physik.tu-berlin.de)
work from D10070 to adjust it for the cpu topology changes that
occured in r332298

Approved by: bde (implicit)

5 years agoMFC r347463:
Justin Hibbits [Fri, 24 May 2019 01:51:58 +0000 (01:51 +0000)]
MFC r347463:

powerpc: Initialize the Hardware Interrupt Offset Register (HIOR) earlier for
ppc970

Since we now have a much larger KVA on powerpc64, it's possible to get SLB
traps earlier in boot, possibly even before the HIOR is properly configured
for us.  Move the HIOR setup to immediately after reset, so that we use our
exception handlers instead of Open Firmware's.

PR: 233863

5 years agoMFC 340486: Consolidate on a single set of constants for SCMD fields.
John Baldwin [Fri, 24 May 2019 00:44:31 +0000 (00:44 +0000)]
MFC 340486: Consolidate on a single set of constants for SCMD fields.

Both ccr(4) and the TOE TLS code had separate sets of constants for
fields in SCMD messages.

5 years agoMFC 346617: Test the AES-CCM test vectors from the NIST Known Answer Tests.
John Baldwin [Thu, 23 May 2019 21:57:58 +0000 (21:57 +0000)]
MFC 346617: Test the AES-CCM test vectors from the NIST Known Answer Tests.

The CCM test vectors use a slightly different file format in that
there are global key-value pairs as well as section key-value pairs
that need to be used in each test.  In addition, the sections can set
multiple key-value pairs in the section name.  The CCM KAT parser
class is an iterator that returns a dictionary once per test where the
dictionary contains all of the relevant key-value pairs for a given
test (global, section name, section, test-specific).

Note that all of the CCM decrypt tests use nonce and tag lengths that
are not supported by OCF (OCF only supports a 12 byte nonce and 16
byte tag), so none of the decryption vectors are actually tested.

5 years agoMFC 346649: Don't panic for empty CCM requests.
John Baldwin [Thu, 23 May 2019 21:52:24 +0000 (21:52 +0000)]
MFC 346649: Don't panic for empty CCM requests.

A request to encrypt an empty payload without any AAD is unusual, but
it is defined behavior.  Removing this assertion removes a panic and
instead returns the correct tag for an empty buffer.

5 years agoMFC 346648: Fix requests for "plain" SHA digests of an empty buffer.
John Baldwin [Thu, 23 May 2019 21:05:05 +0000 (21:05 +0000)]
MFC 346648: Fix requests for "plain" SHA digests of an empty buffer.

To workaround limitations in the crypto engine, empty buffers are
handled by manually constructing the final length block as the payload
passed to the crypto engine and disabling the normal "final" handling.
For HMAC this length block should hold the length of a single block
since the hash is actually the hash of the IPAD digest, but for
"plain" SHA the length should be zero instead.

5 years agoMFC 346616: Run the plain SHA digest tests from NIST.
John Baldwin [Thu, 23 May 2019 19:20:37 +0000 (19:20 +0000)]
MFC 346616: Run the plain SHA digest tests from NIST.

Pass in an explicit digest length to the Crypto constructor since it
was assuming only sessions with a MAC key would have a MAC.  Passing
an explicit size allows us to test the full digest in HMAC tests as
well.

5 years agoMFC 346615: Use more descriptive algorithm names in skip messages.
John Baldwin [Thu, 23 May 2019 19:19:09 +0000 (19:19 +0000)]
MFC 346615: Use more descriptive algorithm names in skip messages.

5 years agoMFC 346614: Skip tests with missing test vectors instead of failing.
John Baldwin [Thu, 23 May 2019 19:18:21 +0000 (19:18 +0000)]
MFC 346614: Skip tests with missing test vectors instead of failing.

This copes more gracefully when older version of the nist-kat package
are intalled that don't have newer test vectors such as CCM or plain
SHA.

If the nist-kat package is not installed at all, this still fails with
an error.

5 years agoMFC 346421: Test SHA2-224-HMAC now that OCF supports it.
John Baldwin [Thu, 23 May 2019 19:13:38 +0000 (19:13 +0000)]
MFC 346421: Test SHA2-224-HMAC now that OCF supports it.

5 years agoMFC 346419: Sync cryptographic algorithm constants with current cryptodev.h.
John Baldwin [Thu, 23 May 2019 19:12:47 +0000 (19:12 +0000)]
MFC 346419: Sync cryptographic algorithm constants with current cryptodev.h.

5 years agoMFC: r347960: bhyve virtio needs barriers
Rodney W. Grimes [Thu, 23 May 2019 18:48:46 +0000 (18:48 +0000)]
MFC: r347960: bhyve virtio needs barriers

Under certain tight race conditions, we found that the lack of a memory
barrier in bhyve's virtio handling causes it to miss a NO_NOTIFY state
transition on block devices, resulting in guest stall. The investigation
is recorded in OS-7613. As part of the examination into bhyve's use of
barriers, one other section was found to be problematic, but only on
non-x86 ISAs with less strict memory ordering. That was addressed in
this patch as well, although it was not at all a problem on x86.

PR: 231117
Submitted by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: jhb, kib, rgrimes
Approved by: jhb
Differential Revision: https://reviews.freebsd.org/D19501

5 years agoMFC r347698:
Konstantin Belousov [Thu, 23 May 2019 13:05:47 +0000 (13:05 +0000)]
MFC r347698:
amd64 pmap: sysctl vm.pmap.pcid_save_cnt should be read-only.

5 years agoMFC r347694:
Konstantin Belousov [Thu, 23 May 2019 13:03:10 +0000 (13:03 +0000)]
MFC r347694:
subr_turnstile: Extract some common  code to a helper.

5 years agoMFC r347693:
Konstantin Belousov [Thu, 23 May 2019 12:52:19 +0000 (12:52 +0000)]
MFC r347693:
rtld_malloc.c: cleanup morepages().

5 years agoMFC r347692:
Konstantin Belousov [Thu, 23 May 2019 12:51:29 +0000 (12:51 +0000)]
MFC r347692:
Remove more dead definitions from rtld_malloc.c after r347019.

5 years agoMFC r347244:
Xin LI [Thu, 23 May 2019 05:49:43 +0000 (05:49 +0000)]
MFC r347244:

Move contrib/zlib to sys/contrib/zlib so that we can use it in kernel.
This is a prerequisite of unifying kernel zlib instances.

Submitted by: Yoshihiro Ota <ota at j.email.ne.jp>

5 years agoMFC r346652-r346654
Ian Lepore [Thu, 23 May 2019 02:12:00 +0000 (02:12 +0000)]
MFC r346652-r346654

r346652:
Complain and exit the script if the 'make install' phase fails.  Also,
there is no need to install any debug files.

r346653:
The zfs module has grown a dependency on zcl_nfs4.ko, so copy it into all
the test images.

r346654:
For the geli-gpt-zfs test images, both bios and uefi flavors, add a dummy
ufs partition as p2, and put the zfs partition at p3, to test the ability
of the zfs probe code to find a zfs pool on something other than the first
partition.

5 years agoMFC r346431,r347417,r348019:
Enji Cooper [Thu, 23 May 2019 01:25:34 +0000 (01:25 +0000)]
MFC r346431,r347417,r348019:

r346431 (by lwhsu):

Specify using Python2, these .py files have not been converted to use Python3
yet, but the default Python version in ports has been switched to 3.

r347417:

Refactor tests/sys/opencrypto/runtests

* Convert from plain to TAP for slightly improved introspection when skipping
  the tests due to requirements not being met.
* Test for the net/py-dpkt (origin) package being required when running the
  tests, instead of relying on a copy of the dpkt.py module from 2014. This
  enables the tests to work with py3. Subsequently, remove
  `tests/sys/opencrypto/dpkt.py(c)?` via `make delete-old`.
* Parameterize out `python2` as `$PYTHON`.

PR: 237403

r348019:

Allow the end-user to pass along arguments to cryptotest.py via `$CRYPTOTEST_ARGS`

This allows someone to use `-v` to dump out standard output.

5 years agoRegenerate src.conf(5) after r348138
Enji Cooper [Thu, 23 May 2019 01:13:12 +0000 (01:13 +0000)]
Regenerate src.conf(5) after r348138

5 years agoMFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346081,r346270...
Enji Cooper [Thu, 23 May 2019 01:09:10 +0000 (01:09 +0000)]
MFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346081,r346270,r346574,r346576:

r345203:

Initial googlemock/googletest integration into the build/FreeBSD test suite

This initial integration takes googlemock/googletest release 1.8.1, integrates
the library, tests, and sample unit tests into the build.

googlemock/googletest's inclusion is optionally available via `MK_GOOGLETEST`.
`MK_GOOGLETEST` is dependent on `MK_TESTS` and is enabled by default when
built with a C++11 capable toolchain.

Google tests can be specified via the `GTESTS` variable, which, in comparison
with the other test drivers, is more simplified/streamlined, as Googletest only
supports C++ tests; not raw C or shell tests (C tests can be written in C++
using the standard embedding methods).

No dependent libraries are assumed for the tests. One must specify `gmock`,
`gmock_main`, `gtest`, or `gtest_main`, via `LIBADD` for the program.

More information about googlemock and googletest can be found on the
Googletest [project page](https://github.com/google/googletest), and the
[GoogleMock](https://github.com/google/googletest/blob/v1.8.x/googlemock/docs/Documentation.md)
and
[GoogleTest](https://github.com/google/googletest/tree/v1.8.x/googletest/docs)
docs.

These tests are originally integrated into the build as plain driver tests, but
will be natively integrated into Kyua in a later version.

Known issues/Errata:
* [WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD](https://github.com/google/googletest/issues/2172)

r345205:

Integrate cddl/usr.sbin/zfds/tests into the FreeBSD test suite

This change integrates the unit tests for zfsd into the test suite using the
integration method described in r345203.

This change removes the `LOCALBASE` includes added for the port version of
googlemock/googletest, as well as unnecessary `LIBADD`/`DPADD` and `CXXFLAGS`
defines, which are included in the `GTEST_CXXFLAGS` variable, as part of
r345203.

r345353 (by asomers):

googletest: backport GTEST_SKIP to googletest 1.8.1

This commit backports revisions 00938b2b228f3b70d3d9e51f29a1505bdad43f1e and
59f90a338bce2376b540ee239cf4e269bf6d68ad from googletest's master branch to
our included version of googletest, which is based on 1.8.1. It adds the
GTEST_SKIP feature, which is very useful for a project like FreeBSD where
some tests depend on particular system configurations.

Obtained from: github.com/google/googletest

r345645:

Spam CXXFLAGS with `-I${DESTDIR}/usr/include/private`, instead of GTEST_CXXFLAGS

This makes it easier for googletest users to leverage googletest, instead of
forcing them to plug GTEST_CXXFLAGS into CXXFLAGS manually (resulting in
unnecessary duplication).

I will be following this up with a more proper fix in src.libnames.mk, as
src.libnames.mk should be automatically adding this directory to
CFLAGS/CXXFLAGS when private libraries are referenced. Not doing so can result
in mismatches between base-provided private library's and ports-provided
library's headers.

While here, tweak the comment to clarify what the intent is behind spamming
CXXFLAGS.

r345708:

Standardize `-std=c++* as `CXXSTD`

CXXSTD was added as the C++ analogue to CSTD.

CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`,
otherwise for older versions of g++.

This change standardizes the CXXSTD variable, originally added to
googletest.test.inc.mk as part of r345203.

As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.

Notes:

This value is not sanity checked in bsd.sys.mk, however, given the two
most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is
likely to work with both toolchains. This method will be refined in the future
to support more variants of C++, as not all versions of clang++ and g++ (for
instance) support C++14, C++17, etc.

Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD.
Example:

Before this commit:
```
CXXFLAGS+= -std=c++14
```

After this commit:
```
CXXSTD= c++14
```

Relnotes: yes
Tested with: make tinderbox

r345709:

Allow users to override CSTD/CXXSTD on a per-prog basis

The current logic for CSTD/CXXSTD requires homogenity as far as the
supported C/C++ standards, which is a sensible default. However, when
dealing with differing versions of C++, some code may compile with C++11, but
not C++17 (for instance). So in order to avoid having people convert over their
code to the new standard, give the users the ability to specify the standard on
a per-program basis.

This will allow a user to override the supporting standard for a set of
programs, mixing C++11 with C++14 (for instance).

Apprved by: emaste (mentor)

r345735:

Allow programs to set `NO_SHARED` on a per-PROG basis

This is particularly useful when installing programs for tests that need to be
linked statically, e.g., mini-me from capsicum-test, which is linked statically
to avoid the dynamic library lookup in the upstream project.

r345770:

Import proof-of-concept for handling `GTEST_SKIP()` in `Environment::SetUp`

Per the upstream pull-request [1]:

```
  gtest prior to this change would completely ignore `GTEST_SKIP()` if
  called in `Environment::SetUp()`, instead of bailing out early, unlike
  `Test::SetUp()`, which would cause the tests themselves to be skipped.
  The only way (prior to this change) to skip the tests would be to
  trigger a fatal error via `GTEST_FAIL()`.

  Desirable behavior, in this case, when dealing with
  `Environment::SetUp()` is to check for prerequisites on a system
  (example, kernel supports a particular featureset, e.g., capsicum), and
  skip the tests. The alternatives prior to this change would be
  undesirable:

  - Failing sends the wrong message to the test user, as the result of the
    tests is indeterminate, not failed.
  - Having to add per-test class abstractions that override `SetUp()` to
    test for the capsicum feature set, then skip all of the tests in their
    respective SetUp fixtures, would be a lot of human and computational
    work; checking for the feature would need to be done for all of the
    tests, instead of once for all of the tests.

  For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`,
  by not executing the testcases, is the most desirable solution.

  In order to properly diagnose what happened when running the tests if
  they are skipped, print out the diagnostics in an ad hoc manner.

  Update the documentation to note this change and integrate a new test,
  gtest_skip_in_environment_setup_test, into the test suite.

  This change addresses #2189.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
```

The goal with my merging in this change is to avoid requiring extensive
refactoring/retesting of test suites when ensuring prerequisites are met,
e.g., checking for a CAPABILITIES-enabled kernel before running capsicum-test
(see D19758 for more details).

The proof-of-concept is being imported before accepted by the upstream
project due to the fact that the upstream project is undergoing a potential
development freeze and the maintainers aren't responding to my PR.

1. https://github.com/google/googletest/pull/2203

r346081 (by trasz):

Make zfsd(8) build obey CFLAGS.

Obtained from: CheriBSD

r346270 (by trasz):

Drop -g from CFLAGS for zfsd(8).  No idea why it was ever there.

r346574:

Rework CXXSTD setting via r345708

This change allows the user to once again override the C++ standard, restoring
high-level pre-r345708 behavior.

This also unbreaks building lib/ofed/libibnetdisc/Makefile with a non-C++11
capable compiler, e.g., g++ 4.2.1, as the library supported being built with
older C++ standards.

r346576:

Fix up CXXSTD support originally added in r345708

r345708 worked for the base system, but unfortunately, caused a lot of
disruption for third-party packages that relied on C++, since bsd.sys.mk is
used by applications outside the base system. The defaults picked didn't match
the compiler's defaults and broke some builds that didn't specify a standard,
as well as some that overrode the value by setting `-std=gnu++14` (for
example) manually.

This change takes a more relaxed approach to appending `-std=${CXXSTD}` to
CXXFLAGS, by only doing so when the value is specified, as opposed to
overriding the standard set by an end-user. This avoids the need for having
to bake NOP default into bsd.sys.mk for supported compiler-toolchain
versions.

In order to make this change possible, add CXXSTD to Makefile snippets which
relied on the default value (c++11) added in r345708.

5 years agoRevert r348136
Enji Cooper [Thu, 23 May 2019 00:59:05 +0000 (00:59 +0000)]
Revert r348136

I accidentally committed some unrelated local changes to
`.../tests/sys/opencrypto` along with this MFC set.

5 years agoMFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346574,r346576:
Enji Cooper [Thu, 23 May 2019 00:55:28 +0000 (00:55 +0000)]
MFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346574,r346576:

r345203:

Initial googlemock/googletest integration into the build/FreeBSD test suite

This initial integration takes googlemock/googletest release 1.8.1, integrates
the library, tests, and sample unit tests into the build.

googlemock/googletest's inclusion is optionally available via `MK_GOOGLETEST`.
`MK_GOOGLETEST` is dependent on `MK_TESTS` and is enabled by default when
built with a C++11 capable toolchain.

Google tests can be specified via the `GTESTS` variable, which, in comparison
with the other test drivers, is more simplified/streamlined, as Googletest only
supports C++ tests; not raw C or shell tests (C tests can be written in C++
using the standard embedding methods).

No dependent libraries are assumed for the tests. One must specify `gmock`,
`gmock_main`, `gtest`, or `gtest_main`, via `LIBADD` for the program.

More information about googlemock and googletest can be found on the
Googletest [project page](https://github.com/google/googletest), and the
[GoogleMock](https://github.com/google/googletest/blob/v1.8.x/googlemock/docs/Documentation.md)
and
[GoogleTest](https://github.com/google/googletest/tree/v1.8.x/googletest/docs)
docs.

These tests are originally integrated into the build as plain driver tests, but
will be natively integrated into Kyua in a later version.

Known issues/Errata:
* [WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD](https://github.com/google/googletest/issues/2172)

r345205:

Integrate cddl/usr.sbin/zfds/tests into the FreeBSD test suite

This change integrates the unit tests for zfsd into the test suite using the
integration method described in r345203.

This change removes the `LOCALBASE` includes added for the port version of
googlemock/googletest, as well as unnecessary `LIBADD`/`DPADD` and `CXXFLAGS`
defines, which are included in the `GTEST_CXXFLAGS` variable, as part of
r345203.

r345353 (by asomers):

googletest: backport GTEST_SKIP to googletest 1.8.1

This commit backports revisions 00938b2b228f3b70d3d9e51f29a1505bdad43f1e and
59f90a338bce2376b540ee239cf4e269bf6d68ad from googletest's master branch to
our included version of googletest, which is based on 1.8.1. It adds the
GTEST_SKIP feature, which is very useful for a project like FreeBSD where
some tests depend on particular system configurations.

Obtained from: github.com/google/googletest

r345645:

Spam CXXFLAGS with `-I${DESTDIR}/usr/include/private`, instead of GTEST_CXXFLAGS

This makes it easier for googletest users to leverage googletest, instead of
forcing them to plug GTEST_CXXFLAGS into CXXFLAGS manually (resulting in
unnecessary duplication).

I will be following this up with a more proper fix in src.libnames.mk, as
src.libnames.mk should be automatically adding this directory to
CFLAGS/CXXFLAGS when private libraries are referenced. Not doing so can result
in mismatches between base-provided private library's and ports-provided
library's headers.

While here, tweak the comment to clarify what the intent is behind spamming
CXXFLAGS.

r345708:

Standardize `-std=c++* as `CXXSTD`

CXXSTD was added as the C++ analogue to CSTD.

CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`,
otherwise for older versions of g++.

This change standardizes the CXXSTD variable, originally added to
googletest.test.inc.mk as part of r345203.

As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.

Notes:

This value is not sanity checked in bsd.sys.mk, however, given the two
most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is
likely to work with both toolchains. This method will be refined in the future
to support more variants of C++, as not all versions of clang++ and g++ (for
instance) support C++14, C++17, etc.

Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD.
Example:

Before this commit:
```
CXXFLAGS+= -std=c++14
```

After this commit:
```
CXXSTD= c++14
```

Relnotes: yes
Tested with: make tinderbox

r345709:

Allow users to override CSTD/CXXSTD on a per-prog basis

The current logic for CSTD/CXXSTD requires homogenity as far as the
supported C/C++ standards, which is a sensible default. However, when
dealing with differing versions of C++, some code may compile with C++11, but
not C++17 (for instance). So in order to avoid having people convert over their
code to the new standard, give the users the ability to specify the standard on
a per-program basis.

This will allow a user to override the supporting standard for a set of
programs, mixing C++11 with C++14 (for instance).

Approved by: emaste (mentor)

r345735:

Allow programs to set `NO_SHARED` on a per-PROG basis

This is particularly useful when installing programs for tests that need to be
linked statically, e.g., mini-me from capsicum-test, which is linked statically
to avoid the dynamic library lookup in the upstream project.

r345770:

Import proof-of-concept for handling `GTEST_SKIP()` in `Environment::SetUp`

Per the upstream pull-request [1]:

```
  gtest prior to this change would completely ignore `GTEST_SKIP()` if
  called in `Environment::SetUp()`, instead of bailing out early, unlike
  `Test::SetUp()`, which would cause the tests themselves to be skipped.
  The only way (prior to this change) to skip the tests would be to
  trigger a fatal error via `GTEST_FAIL()`.

  Desirable behavior, in this case, when dealing with
  `Environment::SetUp()` is to check for prerequisites on a system
  (example, kernel supports a particular featureset, e.g., capsicum), and
  skip the tests. The alternatives prior to this change would be
  undesirable:

  - Failing sends the wrong message to the test user, as the result of the
    tests is indeterminate, not failed.
  - Having to add per-test class abstractions that override `SetUp()` to
    test for the capsicum feature set, then skip all of the tests in their
    respective SetUp fixtures, would be a lot of human and computational
    work; checking for the feature would need to be done for all of the
    tests, instead of once for all of the tests.

  For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`,
  by not executing the testcases, is the most desirable solution.

  In order to properly diagnose what happened when running the tests if
  they are skipped, print out the diagnostics in an ad hoc manner.

  Update the documentation to note this change and integrate a new test,
  gtest_skip_in_environment_setup_test, into the test suite.

  This change addresses #2189.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
```

The goal with my merging in this change is to avoid requiring extensive
refactoring/retesting of test suites when ensuring prerequisites are met,
e.g., checking for a CAPABILITIES-enabled kernel before running capsicum-test
(see D19758 for more details).

The proof-of-concept is being imported before accepted by the upstream
project due to the fact that the upstream project is undergoing a potential
development freeze and the maintainers aren't responding to my PR.

1. https://github.com/google/googletest/pull/2203

r346574:

Rework CXXSTD setting via r345708

This change allows the user to once again override the C++ standard, restoring
high-level pre-r345708 behavior.

This also unbreaks building lib/ofed/libibnetdisc/Makefile with a non-C++11
capable compiler, e.g., g++ 4.2.1, as the library supported being built with
older C++ standards.

r346576:

Fix up CXXSTD support originally added in r345708

r345708 worked for the base system, but unfortunately, caused a lot of
disruption for third-party packages that relied on C++, since bsd.sys.mk is
used by applications outside the base system. The defaults picked didn't match
the compiler's defaults and broke some builds that didn't specify a standard,
as well as some that overrode the value by setting `-std=gnu++14` (for
example) manually.

This change takes a more relaxed approach to appending `-std=${CXXSTD}` to
CXXFLAGS, by only doing so when the value is specified, as opposed to
overriding the standard set by an end-user. This avoids the need for having
to bake NOP default into bsd.sys.mk for supported compiler-toolchain
versions.

In order to make this change possible, add CXXSTD to Makefile snippets which
relied on the default value (c++11) added in r345708.

5 years agoload_key_buf do not free data from dearmor
Simon J. Gerraty [Wed, 22 May 2019 23:23:16 +0000 (23:23 +0000)]
load_key_buf do not free data from dearmor

The data returned by dearmor is referenced by the key
leave it alone!

MFC r347980

Reviewed by: stevek

5 years agolibsecureboot: allow control of when pseudo pcr is updated
Simon J. Gerraty [Wed, 22 May 2019 23:19:20 +0000 (23:19 +0000)]
libsecureboot: allow control of when pseudo pcr is updated

During boot we only want to measure things which *must*
be verified - this should provide more deterministic ordering.

MFC r347981

Reviewed by: stevek
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D20297

5 years agoMFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none
Kyle Evans [Wed, 22 May 2019 22:55:27 +0000 (22:55 +0000)]
MFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none

These datasets will generally be canmount=noauto,mountpoint=none (e.g.
zroot/var) but have children that may need to be mounted. Instead of
skipping that segment for no good reason, descend.

5 years agoMFC r347578: tun/tap: Defer clearing if_softc until after if_detach
Kyle Evans [Wed, 22 May 2019 22:34:35 +0000 (22:34 +0000)]
MFC r347578: tun/tap: Defer clearing if_softc until after if_detach

(Commit massaged to match stable structure; tun and tap have been merged in
head)

r346670 added an sx to close a race between the ifioctl handler and
interface destruction. Unfortunately, it clears if_softc immediately after
the interface is closed, but before if_detach has been invoked.

Any time before detachment, an interface that's part of a bridge may still
receive traffic that's pushed through tunstart/tunstart_l2 and promptly
lead to a panic because if_softc is now NULL.

Fix it by deferring the clearing of if_softc until after the interface has
detached and thus been removed from the bridge. if_softc still gets cleared
in case another thread has already entered the ioctl handler before it's
replaced with ifdead_ioctl.

5 years agoMFC r347978:
Dimitry Andric [Wed, 22 May 2019 17:42:22 +0000 (17:42 +0000)]
MFC r347978:

Fix OptionalObsoleteFiles copy/paste mistake from r345236, which
connected libomp to the build.  The comparison should not have been
against ${MK_OPENSSH}, but against ${MK_OPENMP}, obviously.

MFC r347979:

To avoid unnecessarily modifying ports, add a -lgomp symlink, since GCC
does not ship a -lomp symlink.  Also update OptionalObsoleteFiles for
this, and add 32-bit variants while here.

Submitted by: jbeich
PR: 237975

5 years agoMFC r347204:
Dmitry Chagin [Wed, 22 May 2019 05:37:29 +0000 (05:37 +0000)]
MFC r347204:

Adds sys/class/net devices to linsysfs.

Only two interfaces are created eth0 and lo and they expose
the following properties:
address, addr_len, flags, ifindex, mty, tx_queue_len and type.

Initial patch developed by Carlos Neira in 2017 and finished by me.

MFC r347218:

Remove wrong copyright line. Discussed with Carlos Neira.

5 years agoMFC r347203:
Dmitry Chagin [Wed, 22 May 2019 05:35:35 +0000 (05:35 +0000)]
MFC r347203:

Rewrite linux_ifflags() in more readable Linuxulator style.

5 years agoMFC r347202:
Dmitry Chagin [Wed, 22 May 2019 05:34:44 +0000 (05:34 +0000)]
MFC r347202:

Complete r347052 (https://reviews.freebsd.org/D20137) as it it was not
a final revision.

Fix style issues and change bool-like variables from int to bool.

5 years agoMFC r347196:
Dmitry Chagin [Wed, 22 May 2019 05:33:47 +0000 (05:33 +0000)]
MFC r347196:

The build process generates assym.inc from genassym.o, so don't forget
to clean genassym.o

5 years agoMFC r347052:
Dmitry Chagin [Wed, 22 May 2019 05:32:39 +0000 (05:32 +0000)]
MFC r347052:

In order to reduce duplication between MD parts of the Linuxulator
move bits that are MI out into the headers in compat/linux.
For that remove bogus _packed attribute from struct l_sockaddr
and use MI types for struct members.

And continue to move into the linux_common module a code that is
intended for both Linuxulator modules (both instruction set - 32 & 64 bit)
or for external modules like linsysfs or linprocfs.

To avoid header pollution introduce new sys/compat/linux_common.h header.

5 years agoMFC r347621:
Johannes Lundberg [Wed, 22 May 2019 04:10:24 +0000 (04:10 +0000)]
MFC r347621:
LinuxKPI: Add get_random_u32 function.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347619:
Johannes Lundberg [Wed, 22 May 2019 04:08:45 +0000 (04:08 +0000)]
MFC r347619:
LinuxKPI: Expand ktime functionality.

Also, make ktime_get_raw call getnanouptime instead of getnanotime
to match (the correct) ktime_get_raw_ns.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347623:
Johannes Lundberg [Wed, 22 May 2019 04:02:10 +0000 (04:02 +0000)]
MFC r347623:
LinuxKPI: Move {lower|upper}_32_bits macros from port to base.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347626:
Johannes Lundberg [Wed, 22 May 2019 04:00:13 +0000 (04:00 +0000)]
MFC r347626:
LinuxKPI: Add helper macros IS_ALIGNED and DIV_ROUND_DOWN_ULL.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347620:
Johannes Lundberg [Wed, 22 May 2019 03:58:41 +0000 (03:58 +0000)]
MFC r347620:
LinuxKPI: Update user_access_begin for Linux v5.0.

Check the new LINUXKPI_VERSION macro for backwards compatibility.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347622:
Johannes Lundberg [Wed, 22 May 2019 03:54:25 +0000 (03:54 +0000)]
MFC r347622:
LinuxKPI: Include asm/atomic-long.h from atomic.h.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoRevert r348012, MFC r347963.
Brooks Davis [Tue, 21 May 2019 16:36:28 +0000 (16:36 +0000)]
Revert r348012, MFC r347963.

Several of the changes touch actual defaults. These defaults are all
mistakes and no one should rely on them, but changing them in a stable
branch is clearly inappropriate.

Reported by: rgrimes

5 years agoMFC r347216:
Konstantin Belousov [Tue, 21 May 2019 15:19:49 +0000 (15:19 +0000)]
MFC r347216:
amd64: fix BUS_SPACE_MAXSIZE to 64bit max value.

5 years agoBump FreeBSD version after change to struct in linuxkpi from r348035.
Johannes Lundberg [Tue, 21 May 2019 02:42:42 +0000 (02:42 +0000)]
Bump FreeBSD version after change to struct in linuxkpi from r348035.

5 years agoMFC r347601:
Johannes Lundberg [Tue, 21 May 2019 02:38:21 +0000 (02:38 +0000)]
MFC r347601:
LinuxKPI: Add prepare to pm_ops and bump FreeBSD version.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347600:
Johannes Lundberg [Tue, 21 May 2019 02:36:12 +0000 (02:36 +0000)]
MFC r347600:
LinuxKPI: Add vm_fault_t type.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347592:
Johannes Lundberg [Tue, 21 May 2019 02:31:34 +0000 (02:31 +0000)]
MFC r347592:
LinuxKPI: Let del_timer return a value to match Linux.

This patch is part of https://reviews.freebsd.org/D19565.

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347570:
Mark Johnston [Tue, 21 May 2019 01:27:08 +0000 (01:27 +0000)]
MFC r347570:
Specify -z notext when building with -z ifunc-noplt.

5 years agoMFC r347963:
Brooks Davis [Mon, 20 May 2019 21:33:22 +0000 (21:33 +0000)]
MFC r347963:

Change ed(4), ep(4), and fxp(4) examples to em(4).

ed(4) and ep(4) will be removed in FreeBSD 13. fxp(4) remains
popular in older systems, but isn't as future proof as em(4).

Reviewed by: bz, jhb
Differential Revision: https://reviews.freebsd.org/D20311

5 years agoMFC r347565:
Guangyuan Yang [Sun, 19 May 2019 23:56:04 +0000 (23:56 +0000)]
MFC r347565:

Fix some spelling errors in ng_eiface(4).

PR: 237764
Submitted by: Tom Marcoen <tom.marcoen@gmail.com>

5 years agoMFC r347690, r347946:
Konstantin Belousov [Sun, 19 May 2019 09:24:51 +0000 (09:24 +0000)]
MFC r347690, r347946:
imgact_elf.c: Add comment explaining the malloc/VOP_UNLOCK() dance
from r347148.

5 years agoMFC r347488,347606: Update leap-seconds to leap-seconds.3676924800.
Xin LI [Sun, 19 May 2019 04:56:02 +0000 (04:56 +0000)]
MFC r347488,347606: Update leap-seconds to leap-seconds.3676924800.

5 years agoMFC r347940
Brooks Davis [Sat, 18 May 2019 17:30:03 +0000 (17:30 +0000)]
MFC r347940

Remove the notice that ae(4) will be removed in FreeBSD 13.

5 years agoMFC
Johannes Lundberg [Sat, 18 May 2019 13:27:09 +0000 (13:27 +0000)]
MFC
------------------------------------------------------------------------
r347470 | johalun | 2019-05-10 16:10:22 -0700 (Fri, 10 May 2019) | 9 lines

Implement linux_pci_unregister_drm_driver in linuxkpi so that drm drivers
can be unloaded.

This patch is a part of D19565.

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week

------------------------------------------------------------------------

5 years agoMFC r347617:
Benedict Reuschling [Sat, 18 May 2019 03:15:07 +0000 (03:15 +0000)]
MFC r347617:
Add small EXAMPLE section to bsearch.3.

Submitted by:     fernape (via Phabricator)
Reviewed by:     bcr, jilles, dab
Approved by:     bcr (man pages), jilles (src)
Differential Revision:     https://reviews.freebsd.org/D19902

5 years agoMFC r347625:
Konstantin Belousov [Fri, 17 May 2019 20:59:59 +0000 (20:59 +0000)]
MFC r347625:
Properly announce MD_CLEAR.

5 years agoMFC r346390: Change the way FreeBSD GID inheritance is hacked.
Alexander Motin [Fri, 17 May 2019 16:41:18 +0000 (16:41 +0000)]
MFC r346390: Change the way FreeBSD GID inheritance is hacked.

I believe previous ifdef caused NULL dereference in later zfs_log_create()
on attempt to create file inside directory belonging to ephemeral group
created on illumos, trying to write to log information about GID domain
of the newly created file, inheriting the ephemeral GID.

This patch reuses original illumos SGID code with exception that due to
lack of ID mapping code on FreeBSD ephemeral GID will turn into GID_NOBODY
by another ifdef inside zfs_fuid_map_id().

Sponsored by: iXsystems, Inc.

5 years agoMFC r345008:
Kenneth D. Merry [Fri, 17 May 2019 14:29:56 +0000 (14:29 +0000)]
MFC r345008:
  ------------------------------------------------------------------------
  r345008 | ken | 2019-03-11 10:21:14 -0400 (Mon, 11 Mar 2019) | 59 lines

  Fix CRN resets in the isp(4) driver in certain situations.

  The Command Reference Number (CRN) is part of the FC-Tape features
  that we enable when talking to tape drives.  It starts at 1, and
  goes to 255 and wraps around to 1.  There are a number of reset
  type conditions that result in the CRN getting reset to 1.  These
  are detailed in section 4.10 (table 8) of the FCP-4r02b specification.

  One of the conditions is when a PRLI (Process Login) is sent by
  the initiator, and the Establish Image Pair bit is set in Word 0
  of the PRLI.

  Previously, the isp(4) driver core sent a notification via
  isp_async() that the target had changed or stayed in place, but
  there was no indication of whether a PRLI was sent and whether the
  Establish Image Pair bit was set.

  The result of this was that in some situations, notably
  switching back and forth between a direct connection and a switch
  connection to a tape drive, the isp(4) driver would fail to reset
  the CRN in situations that require it according to the spec.  When
  the CRN isn't reset in a situation that requires it, the tape drive
  then rejects every subsequent command that is sent to the drive.
  It is assuming that the commands are being sent out of order.

  So, modify the isp(4) driver to include Word 0 of the PRLI command
  when it sends isp_async() notifications of target changes.  Look at
  the Establish Image Pair bit, and reset the CRN if that bit is set.

  With this change, I am able to switch a tape drive back and forth
  between a direct connection and a switch connection, and the isp(4)
  driver resets the CRN when it should.

  sys/dev/isp_stds.h:
   Add bit definitions for PRLI Word 0.

  sys/dev/ispmbox.h:
   Add PRLI Word 0 to the port database type, isp_pdb_t.

  sys/dev/ispvar.h
   Add PRLI Word 0 to fcportdb_t.

  sys/dev/isp.c:
   Populate the new prli_word0 parameter in the port database.

   In isp_pdb_add_update(), add a check to see if the
   Establish Image Pair bit is set in PRLI Word 0.  If it is,
   then that is an additional reason to create a change
   notification.

  sys/dev/isp_freebsd.c:
   In isp_async(), if the device changed or stayed, look at
   PRLI Word 0 to see if the Establish Image Pair bit is set.
   If it is, reset the CRN if we haven't already.

  Sponsored by: Spectra Logic

  ------------------------------------------------------------------------
Differential Revision: https://reviews.freebsd.org/D19472

5 years agoMFC r347569:
Mark Johnston [Fri, 17 May 2019 14:09:33 +0000 (14:09 +0000)]
MFC r347569:
Remove redundant -Wl uses from the kernel's LDFLAGS.

5 years agoMFC r347564:
Mark Johnston [Fri, 17 May 2019 14:08:58 +0000 (14:08 +0000)]
MFC r347564:
Fix formatting.

5 years agoMFC r347382:
Michael Tuexen [Fri, 17 May 2019 08:25:31 +0000 (08:25 +0000)]
MFC r347382:

Receiver side DSACK implemenation.
This adds initial support for RFC 2883.
This was submitted by Richard Scheffeneffer.

MFC r347407:

Don't use C++ style comments.
Thanks to ngie@ for reporting the issue.

5 years agoMFC r347381:
Michael Tuexen [Fri, 17 May 2019 08:21:27 +0000 (08:21 +0000)]
MFC r347381:

Prevent cwnd to collapse down to 1 MSS after exiting recovery.

This is descrined in RFC 6582, which updates RFC 3782.

5 years agoMFC r347233:
Michael Tuexen [Fri, 17 May 2019 08:19:43 +0000 (08:19 +0000)]
MFC r347233:

Remove non-functional SCTP checksum offload support for virtio.

Checksum offloading for SCTP is not currently specified for virtio.
If the hypervisor announces checksum offloading support, it means TCP
and UDP checksum offload. If an SCTP packet is sent and the host announced
checksum offload support, the hypervisor inserts the IP checksum (16-bit)
at the correct offset, but this is not the right checksum, which is a CRC32c.
This results in all outgoing packets having the wrong checksum and therefore
breaking SCTP based communications.

This patch removes SCTP checksum offloading support from the virtio
network interface.

Thanks to Felix Weinrank for making me aware of the issue.

5 years agoMFC 344761:
Kenneth D. Merry [Thu, 16 May 2019 18:50:18 +0000 (18:50 +0000)]
MFC 344761:
  ------------------------------------------------------------------------
  r344761 | ken | 2019-03-04 09:30:37 -0500 (Mon, 04 Mar 2019) | 18 lines

  Add IBM TS1160 density codes to libmt and the mt(1) man page.

  These are taken directly from the density report from a TS1160
  tape drive.  (Using mt getdensity)

  A TS1160 drive stores 20TB raw (60TB with compression) on a JE tape.

  lib/libmt/mtlib.c:
   Add 3592A6 encrypted/unencrypted density codes, and bpmm/bpi
   values.

  usr.bin/mt/mt.1:
   Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi
   values and number of tracks.  Bump the man page date.

  Sponsored by: Spectra Logic

  ------------------------------------------------------------------------

5 years agoMFC r347365, r347703
Brooks Davis [Thu, 16 May 2019 18:00:17 +0000 (18:00 +0000)]
MFC r347365, r347703

r347365:
Update dme(4) to reflect that it will not be removed due to FCP-101.

dme(4) is the built-in NIC on a couple non-expandable mips platforms and
thus should remain.  The FCP has been updated to reflect this fact.

Discussed with: imp

r347703:
FCP-101: ae(4) is sufficently popular to be moved to the keep list.

5 years agoMFC r347325:
Hans Petter Selasky [Thu, 16 May 2019 16:44:40 +0000 (16:44 +0000)]
MFC r347325:
Bump the Mellanox driver version numbers and the FreeBSD version number.

Sponsored by: Mellanox Technologies

5 years agoMFC r347324:
Hans Petter Selasky [Thu, 16 May 2019 16:43:16 +0000 (16:43 +0000)]
MFC r347324:
Make command workqueue persistant in mlx5core.

There is no reason to re-create the command workqueue during healthcare.
This also fixes an issue where a previous work struct may refer to a
destroyed workqueue.

Sponsored by: Mellanox Technologies

5 years agoMFC r347323:
Hans Petter Selasky [Thu, 16 May 2019 16:42:40 +0000 (16:42 +0000)]
MFC r347323:
Fix race between driver unload and dumping firmware in mlx5core.

Present code uses lock-less accesses to the dump data to prevent top
level ioctls from blocking bottom-level call to dump.  Unfortunately, this
depends on the type stability of the dump data structure, which makes it
non-functional during driver teardown.

Switch to the mutex locking scheme where top levels use the mutex in the
bound regions, while copyouts and drain for completion utilize condvars.
The mutex lifetime is guaranteed to be strictly larger than the time
interval where driver can initiate dump, and most of the control fields
of the old struct mlx5_dump_data are directly embedded into struct
mlx5_core_dev.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347322:
Hans Petter Selasky [Thu, 16 May 2019 16:41:54 +0000 (16:41 +0000)]
MFC r347322:
Ensure the flowtable rules are not freed twice in mlx5en(4).
This can happen when re-loading the driver.

Sponsored by: Mellanox Technologies

5 years agoMFC r347321:
Hans Petter Selasky [Thu, 16 May 2019 16:41:21 +0000 (16:41 +0000)]
MFC r347321:
Undo previous steps upon returning failure in mlx5en(4).

Else flowtable resources may not be properly freed.

Sponsored by: Mellanox Technologies

5 years agoMFC r347320:
Hans Petter Selasky [Thu, 16 May 2019 16:40:47 +0000 (16:40 +0000)]
MFC r347320:
Make sure the flow destination structure does not use values off the stack
in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r347319:
Hans Petter Selasky [Thu, 16 May 2019 16:40:12 +0000 (16:40 +0000)]
MFC r347319:
Flush command workqueue when command completion is triggered in mlx5core.

Avoid race for command completion when triggering a command completions event.
Serialize operation by queueing all commands on the same work queue.
This can happen when healthcare triggers.

Sponsored by: Mellanox Technologies

5 years agoMFC r347318:
Hans Petter Selasky [Thu, 16 May 2019 16:39:37 +0000 (16:39 +0000)]
MFC r347318:
Make command timeout way shorter in mlx5core.

The command timeout is terribly long, whole two hours. Make it 60s so if
things do go wrong, the user gets feedback in relatively short time, so
they can take corrective actions and/or investigate using tools and such.

Linux commit:
6b6c07bdcdc97ccac2596063bfc32a5faddfe884

Sponsored by: Mellanox Technologies

5 years agoMFC r347317:
Hans Petter Selasky [Thu, 16 May 2019 16:39:02 +0000 (16:39 +0000)]
MFC r347317:
Remove non-functional MLX5E_MAX_RX_SEGS macro in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r347316:
Hans Petter Selasky [Thu, 16 May 2019 16:38:19 +0000 (16:38 +0000)]
MFC r347316:
Fix for compilation warning in mlx5en(4).

Function 'mlx5e_alloc_rx_wqe' can never be inlined because it uses alloca
(override using the always_inline attribute)

Sponsored by: Mellanox Technologies