]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoGiven that the idea of D15374 was to "make memmove a first class citizen",
Marius Strobl [Tue, 20 Nov 2018 00:08:33 +0000 (00:08 +0000)]
Given that the idea of D15374 was to "make memmove a first class citizen",
provide a _MEMMOVE extension of _MEMCPY that deals with overlap based on
the previous bcopy(9) implementation and use the former for bcopy(9) and
memmove(9). This addresses my D15374 review comment, avoiding extra MOVs
in case of memmove(9) and trashing the stack pointer.

5 years agopom: Fix fencepost bugs.
Thomas Munro [Tue, 20 Nov 2018 00:06:53 +0000 (00:06 +0000)]
pom: Fix fencepost bugs.

Under some conditions pom would report "waning" and then "full", show
higher percentages than it should, and get confused by DST.  Fix.

Before:

  2018.01.30: The Moon is Waxing Gibbous (97% of Full)
  2018.01.31: The Moon is Waning Gibbous (100% of Full)
  2018.02.01: The Moon is Full
  2018.02.02: The Moon is Waning Gibbous (98% of Full)

After:

  2018.01.30: The Moon is Waxing Gibbous (96% of Full)
  2018.01.31: The Moon is Waxing Gibbous (99% of Full)
  2018.02.01: The Moon is Full
  2018.02.02: The Moon is Waning Gibbous (97% of Full)

PR:                    231705
Submitted by:          Andrew Gierth
Approved by:           allanjude (mentor)
MFC after:             2 weeks
Differential Revision: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231705

5 years agoFor consistency within the front-end, prefer SDHCI_{READ,WRITE}_{2,4}()
Marius Strobl [Mon, 19 Nov 2018 23:56:33 +0000 (23:56 +0000)]
For consistency within the front-end, prefer SDHCI_{READ,WRITE}_{2,4}()
to sdhci_acpi_{read,write}_{2,4}() in the sdhci_acpi_set_uhs_timing()
added in r340543.

5 years agopowerpc: Sync icache on SIGILL, in case of cache issues
Justin Hibbits [Mon, 19 Nov 2018 23:54:49 +0000 (23:54 +0000)]
powerpc: Sync icache on SIGILL, in case of cache issues

The update of jemalloc to 5.1.0 exposed a cache syncing issue on a Freescale
e500 base system.  There was already code in the FPU emulator to address
this, but it was limited to a single static variable, and did not attempt to
sync the cache.  This pulls that out to the higher level program exception
handler, and syncs the cache.

If a SIGILL is hit a second time at the same address, it will be treated as
a real illegal instruction, and handled accordingly.

5 years agorescue: set NO_SHARED in Makefile
Ed Maste [Mon, 19 Nov 2018 22:18:18 +0000 (22:18 +0000)]
rescue: set NO_SHARED in Makefile

The rescue binary is built statically via the Makefile generated by
crunchgen, but that does not trigger other shared/static logic in
bsd.prog.mk - in particular disabling retpolineplt with static linking.

PR: 233336
Reported by: Charlie Li
Sponsored by: The FreeBSD Foundation

5 years agocxgbe(4): Update T4/5/6 firmwares to 1.22.0.3.
Navdeep Parhar [Mon, 19 Nov 2018 21:59:07 +0000 (21:59 +0000)]
cxgbe(4): Update T4/5/6 firmwares to 1.22.0.3.

Obtained from: Chelsio Communications
MFC after: 2 months
Sponsored by: Chelsio Communications

5 years agoAvoid retpolineplt with static linking
Ed Maste [Mon, 19 Nov 2018 20:48:47 +0000 (20:48 +0000)]
Avoid retpolineplt with static linking

Statically linked binaries linked with -zretpolineplt crash at startup
as lld produces a broken PLT.

PR: 233336
Sponsored by: The FreeBSD Foundation

5 years agoAdd a fortune describing how to upload a machine's dmesg information to the
Benedict Reuschling [Mon, 19 Nov 2018 20:45:49 +0000 (20:45 +0000)]
Add a fortune describing how to upload a machine's dmesg information to the
NYCBUG database.

We want to encourage our users to upload their dmesgs so that the project can
get a better insight into what kind of hardware is run on. This helps in making
data-driven decisions about i.e., platform and driver support.

Note that dmesgs may contain sensitive information like hardware serial numbers,
hence uploading them without review is discouraged.

Reviewed by: brooks, imp, allanjude
Approved by: allanjude
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D17705

5 years agoAdd capsicum_helpers.h to -legacy if needed
Alex Richardson [Mon, 19 Nov 2018 18:58:34 +0000 (18:58 +0000)]
Add capsicum_helpers.h to -legacy if needed

This fixes bootstrap of capsicumized strings on FreeBSD 11.

Reviewed By: oshogbo, bdrewery
Differential Revision: https://reviews.freebsd.org/D17971

5 years agoacpi: fix acpi_ec_probe to only check EC devices
Ben Widawsky [Mon, 19 Nov 2018 18:29:03 +0000 (18:29 +0000)]
acpi: fix acpi_ec_probe to only check EC devices

This patch utilizes the fixed_devclass attribute in order to make sure
other acpi devices with params don't get confused for an EC device.

The existing code assumes that acpi_ec_probe is only ever called with a
dereferencable acpi param. Aside from being incorrect because other
devices of ACPI_TYPE_DEVICE may be probed here which aren't ec devices,
(and they may have set acpi private data), it is even more nefarious if
another ACPI driver uses private data which is not dereferancable. This
will result in a pointer deref during boot and therefore boot failure.

On X86, as it stands today, no other devices actually do this (acpi_cpu
checks for PROCESSOR type devices) and so there is no issue. I ran into
this because I am adding such a device which gets probed before
acpi_ec_probe and sets private data. If ARM ever has an EC, I think
they'd run into this issue as well.

There have been several iterations of this patch. Earlier
iterations had ECDT enumerated ECs not call into the probe/attach
functions of this driver. This change was Suggested by: jhb@.

Reviewed by:    jhb
Approved by: emaste (mentor)
Differential Revision:  https://reviews.freebsd.org/D16635

5 years agoMake libthr(3) use sysconf(_SC_NPROCESSORS_CONF); this shaves off
Edward Tomasz Napierala [Mon, 19 Nov 2018 18:24:08 +0000 (18:24 +0000)]
Make libthr(3) use sysconf(_SC_NPROCESSORS_CONF); this shaves off
two calls to sysctl(2) from the binary startup.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18046

5 years agoMake sysconf(_SC_PAGESIZE) return the value from getpagesize(3).
Edward Tomasz Napierala [Mon, 19 Nov 2018 18:23:17 +0000 (18:23 +0000)]
Make sysconf(_SC_PAGESIZE) return the value from getpagesize(3).
That avoids a syscall - getpagesize(3) gets the value from the ELF
aux strings.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17989

5 years agolibc: forcibly disable BIND_NOW
Ed Maste [Mon, 19 Nov 2018 18:12:39 +0000 (18:12 +0000)]
libc: forcibly disable BIND_NOW

Building libc WITH_BIND_NOW results in segfault at process start.  For
now force BIND_NOW off until the root cause can be identified and fixed.

PR: 233333
Sponsored by: The FreeBSD Foundation

5 years agoRemove comments made obsolete by the ino64 work.
Mark Johnston [Mon, 19 Nov 2018 17:33:44 +0000 (17:33 +0000)]
Remove comments made obsolete by the ino64 work.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agolibcasper: provide compatibility with the old version of service
Mariusz Zaborski [Mon, 19 Nov 2018 17:22:52 +0000 (17:22 +0000)]
libcasper: provide compatibility with the old version of service

Some external tools like tcpdump(1) have upstream the changes with old limits
name. Because of that provide compatibility with the old names.

Reported by: emaste

5 years agoUse swp_pager_isondev() throughout. Submitted by: ota@j.email.ne.jp
Alan Cox [Mon, 19 Nov 2018 17:17:23 +0000 (17:17 +0000)]
Use swp_pager_isondev() throughout.  Submitted by: ota@j.email.ne.jp

Change swp_pager_isondev()'s return type to bool.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D16712

5 years agobectl(8) tests: attempt to load the ZFS module
Kyle Evans [Mon, 19 Nov 2018 17:09:57 +0000 (17:09 +0000)]
bectl(8) tests: attempt to load the ZFS module

Observed in a CI test image, bectl_create test will run and be marked as
skipped because the module is not loaded. The first zpool invocation will
automagically load the module, but bectl_create is still skipped. Subsequent
tests all pass as expected because the module is now loaded and everything
is OK.

MFC after: 3 days

5 years agolibbe(3): Handle non-ZFS rootfs better
Kyle Evans [Mon, 19 Nov 2018 16:47:21 +0000 (16:47 +0000)]
libbe(3): Handle non-ZFS rootfs better

If rootfs isn't ZFS, current version will emit an error claiming so and fail
to initialize libbe. As a consumer, bectl -r (undocumented) can be specified
to operate on a BE independently of whether on a UFS or ZFS root.

Unbreak this for the UFS case by only erroring out the init if we can't
determine a ZFS dataset for rootfs and no BE root was specified. Consumers
of libbe should take care to ensure that rootfs is non-empty if they're
trying to use it, because this could certainly be the case.

Some check is needed before zfs_path_to_zhandle because it will
unconditionally emit to stderr if the path isn't a ZFS filesystem, which is
unhelpful for our purposes.

This should also unbreak the bectl(8) tests on a UFS root, as is the case in
Jenkins' -test runs.

MFC after: 3 days

5 years agoEnable evdev on ppc64
Niclas Zeising [Mon, 19 Nov 2018 15:36:58 +0000 (15:36 +0000)]
Enable evdev on ppc64

Enable evdev on ppc64 as well, similar to what was done for amd64 and i386
in r340387.

Evdev can be used by X and is used by wayland to handle input devices.

Approved by: mmacy
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18026

5 years agoDo proper copyin of control message data in the Linux sendmsg syscall.
Tijl Coosemans [Mon, 19 Nov 2018 15:31:54 +0000 (15:31 +0000)]
Do proper copyin of control message data in the Linux sendmsg syscall.

Instead of calling m_append with a user address, allocate an mbuf cluster
and copy data into it using copyin.  For the SCM_CREDS case, instead of
zeroing a stack variable and appending that to the mbuf, zero part of the
mbuf cluster directly.  One mbuf cluster is also the size limit used by
the FreeBSD sendmsg syscall (uipc_syscalls.c:sockargs()).

PR: 217901
Reviewed by: kib
MFC after: 3 days

5 years agoMinor code factoring. No functional change.
Hans Petter Selasky [Mon, 19 Nov 2018 09:36:09 +0000 (09:36 +0000)]
Minor code factoring. No functional change.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoBe more verbose when a sysctl fails to unregister.
Hans Petter Selasky [Mon, 19 Nov 2018 09:35:16 +0000 (09:35 +0000)]
Be more verbose when a sysctl fails to unregister.
Print name of sysctl in question.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoUnbreak ng_source(4) for 64-bit platforms including amd64.
Eugene Grosbein [Mon, 19 Nov 2018 07:27:50 +0000 (07:27 +0000)]
Unbreak ng_source(4) for 64-bit platforms including amd64.

5 years agoFix access to cpu_model[] in mtk_soc_set_cpu_model()
Stanislav Galabov [Mon, 19 Nov 2018 06:48:48 +0000 (06:48 +0000)]
Fix access to cpu_model[] in mtk_soc_set_cpu_model()

There may be cases where cpu_model[] may not be 32bit aligned, so it is
better to not try to access it as such in order to avoid unaligned access.

Sponsored by: Smartcom - Bulgaria AD

5 years agogitv3_its: fixes for multiple GIC ITS blocks
Jayachandran C. [Mon, 19 Nov 2018 03:52:56 +0000 (03:52 +0000)]
gitv3_its: fixes for multiple GIC ITS blocks

First pass of support for multiple GIC ITS blocks with ACPI.
Changes are to:
 * register the correct subset of interrupts with pic_register
   in case of ACPI.
 * initialize just the cpu interface for the first ITS, when
   domain information is not avialable. This has to be done
   until we split the per-CPU init to do LPI setup just once.
 * remove duplicate check for the GIC ITS domain, the sc_cpus
   are setup from domain, so the check again in per-CPU init
   seems unnecessary.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17841

5 years agopci_host_generic : move activate/release to generic code
Jayachandran C. [Mon, 19 Nov 2018 03:43:10 +0000 (03:43 +0000)]
pci_host_generic : move activate/release to generic code

Now that the ACPI and FDT implementations for activating and
deactivating resources are the same, we can move it to
pci_host_generic.c.  No functional changes.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17793

5 years agopci_host_generic, acpi_resource: drop unneeded code
Jayachandran C. [Mon, 19 Nov 2018 03:34:15 +0000 (03:34 +0000)]
pci_host_generic, acpi_resource: drop unneeded code

Now that we are handling PCI resources in pci_host_generic_acpi.c, we
don't need these change (made by r336129)

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17792

5 years agoacpica, pci_host_generic_acpi: redo pci_host_generic_acpi.c
Jayachandran C. [Mon, 19 Nov 2018 03:16:16 +0000 (03:16 +0000)]
acpica, pci_host_generic_acpi: redo pci_host_generic_acpi.c

This is a major update for pci_host_generic_acpi.c, the current
implementation has some gaps that are better fixed up in one go.
The changes are to:
 * Follow x86 method of not adding PCI resources to PCI host bridge in
   ACPI code. This has been moved to pci_host_generic_acpi.c, where we
   walk thru its resources of the host bridge and add them.
 * Fixup code in pci_host_generic_acpi.c to read all decoded ranges
   and update the 'ranges' property. This allows us to share most of
   the code with generic implementation (and the FDT one).
 * Parse and setup IO ranges and bus ranges when walking the resources
   above. Drop most of the changes related to this from acpica code.
 * Add the ECAM memory area as mem resource 0. Implement the logic to
   get the ECAM area from MCFG (using bus range which we now decode),
   or from _CBA (using _BBN/bus range). Drop aarch64 ifdefs from acpica
   code which did part of this.
 * Switch resource activation to similar code as FDT implementation,
   this can be moved into generic implementation in a later pass.
 * Drop the mechanism of using the 7th bit of bus number as the domain,
   this is not correct and will work only in very specific cases. Use
   _SEG as PCI domain and use the bus ranges of the host bridge to
   provide start bus number.

This commit should not make any functional change to dev/acpica/acpi.c
for other architectures, almost all the changes there are to revert
earlier additions in this file done for aarch64.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17791

5 years agoacpica: rework INTRNG interrupts
Jayachandran C. [Mon, 19 Nov 2018 03:02:47 +0000 (03:02 +0000)]
acpica: rework INTRNG interrupts

On arm64 (where INTRNG is enabled), the interrupts have to be mapped
with ACPI_BUS_MAP_INTR() before adding them as resources to devices.

The earlier code did the mapping before calling acpi_set_resource(),
which bypassed code that checked for PCI link interrupts.

To fix this, move the call to map interrupts into acpi_set_resource()
and that requires additional work to lookup interrupt properties.
The changes here are to:
 * extend acpi_lookup_irq_handler() to lookup an irq in the ACPI
   resources
 * create a helper function acpi_map_intr() which uses the updated
   acpi_lookup_irq_handler() to look up an irq, and then map it
   with ACPI_BUS_MAP_INTR()
 * use acpi_map_intr() in acpi_pcib_route_interrupt() to map
   pci link interrupts.

With these changes, we can drop the ifdefs in acpi_resource.c, and
we can also drop the call for mapping interrupts in generic_timer.c

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17790

5 years agopci_host_generic*: basic implementation of bus range
Jayachandran C. [Mon, 19 Nov 2018 02:55:18 +0000 (02:55 +0000)]
pci_host_generic*: basic implementation of bus range

Both ACPI and FDT support bus ranges for pci host bridges. Update
pci_host_generic*.[ch] with a default implementation to support this.
This will be used in the next set of changes for ACPI based host
bridge. No functional changes in this commit.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17657

5 years agopci_host_generic: allocate resources against devices
Jayachandran C. [Mon, 19 Nov 2018 02:43:34 +0000 (02:43 +0000)]
pci_host_generic: allocate resources against devices

Fix up pci_host_generic.c and pci_host_generic_fdt.c to allocate
resources against devices that requested them. Currently the
allocation happens against the pcib, which is incorrect.

This is needed for the upcoming changes for fixing up
pci_host_generic_acpi.c

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17656

5 years agopci_host_generic: remove unneeded ThunderX2 quirk
Jayachandran C. [Mon, 19 Nov 2018 02:38:02 +0000 (02:38 +0000)]
pci_host_generic: remove unneeded ThunderX2 quirk

The current quirk implementation writes a fixed address to the PCI BAR
to fix a firmware bug. The PCI BARs are allocated by firmware and will
change depending on PCI devices present. So using a fixed address here
is not correct.

This quirk worked around a firmware bug that programmed the MSI-X bar
of the SATA controller incorrectly. The newer firmware does not have
this issue, so it is better to drop this quirk altogether.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17655

5 years agobectl(8): Add some regression tests
Kyle Evans [Mon, 19 Nov 2018 02:30:12 +0000 (02:30 +0000)]
bectl(8): Add some regression tests

These tests operate on a file-backed zpool that gets created in the kyua
temp dir. root and ZFS support are both required for these tests. Current
tests cover create, destroy, export/import, jail, list (kind of), mount,
rename, and jail.

List tests should later be extended to cover formatting and the different
list flags, but for now only covers basic "are create/destroy actually
reflected properly"

MFC after: 3 days

5 years agolibbe(3): Properly account for altroot when creating new BEs
Kyle Evans [Mon, 19 Nov 2018 02:16:20 +0000 (02:16 +0000)]
libbe(3): Properly account for altroot when creating new BEs

Previously we would blindly copy the 'mountpoint' property, which includes
the altroot. The altroot needs to be snipped off prior to setting it on the
new BE, though, or you'll end up with a new BE and a mountpoint of /mnt with
altroot=/mnt

MFC after: 3 days

5 years agobectl(3)/libbe(3): Allow BE root to be specified
Kyle Evans [Mon, 19 Nov 2018 02:12:08 +0000 (02:12 +0000)]
bectl(3)/libbe(3): Allow BE root to be specified

Add an undocumented -r option preceding the bectl subcommand to specify a BE
root to operate out of. This will remain undocumented for now, as some
caveats apply:

- BEs cannot be activated in the pool that doesn't contain the rootfs
- bectl create cannot work out of the box without the -e option right now,
  since it defaults to the rootfs and cross-pool cloning doesn't work like
  that (IIRC)

Plumb the BE root through to libbe(3) so that some things -can- be done to
it, e.g.

bectl -r tank/ROOT create -e default upgrade
bectl -r tank/ROOT mount upgrade /mnt

this aides in some upgrade setups where rootfs is not necessarily ZFS, and
also makes it easier/possible to regression-test bectl when combined with a
file-backed zpool.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18029

5 years agoRetire sbsndptr() KPI
Kevin Bowling [Mon, 19 Nov 2018 00:54:31 +0000 (00:54 +0000)]
Retire sbsndptr() KPI

As of r340465 all consumers use sbsndptr_adv and sbsndptr_noadv

Reviewed by: gallatin
Approved by: krion (mentor)
Differential Revision: https://reviews.freebsd.org/D17998

5 years agoFix -DNO_CLEAN amd64 build after r340463
Alex Richardson [Sun, 18 Nov 2018 19:55:03 +0000 (19:55 +0000)]
Fix -DNO_CLEAN amd64 build after r340463

Without this change I got the following error:
clang-7: error: no such file or directory: '..../lib/libc/amd64/string/bzero.S'

Reviewed By: mjg
Differential Revision: https://reviews.freebsd.org/D18031

5 years agobrandelf: capsicumize it
Mariusz Zaborski [Sun, 18 Nov 2018 12:23:03 +0000 (12:23 +0000)]
brandelf: capsicumize it

5 years agobrandelf: fix style nits
Mariusz Zaborski [Sun, 18 Nov 2018 12:03:12 +0000 (12:03 +0000)]
brandelf: fix style nits

No functional change intended.

Reviewed by: emaste, markj
Differential Revision: https://reviews.freebsd.org/D17966

5 years agoUpdate the names in the LIMITS and EXAMPLES sections after r340363.
Mariusz Zaborski [Sun, 18 Nov 2018 11:11:27 +0000 (11:11 +0000)]
Update the names in the LIMITS and EXAMPLES sections after r340363.

Reported by: markj

5 years agoChange dumpon(8)'s handling of -g.
Mark Johnston [Sun, 18 Nov 2018 01:58:48 +0000 (01:58 +0000)]
Change dumpon(8)'s handling of -g.

Rather than using a special value to denote "use the default router",
treat the absence of the -g option to mean the same thing.  The
in-kernel netdump client will always attempt to reach the server
directly before falling back to the configured gateway anyway.  This
change makes it cleaner to support a hostname value for -g.

Reviewed by: cem
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18025

5 years agoTidy up vm_map_simplify_entry() and its recently introduced helper
Alan Cox [Sun, 18 Nov 2018 01:27:17 +0000 (01:27 +0000)]
Tidy up vm_map_simplify_entry() and its recently introduced helper
functions.  Notably, reflow the text of some comments so that they
occupy fewer lines, and introduce an assertion in one of the new
helper functions so that it is not misused by a future caller.

In collaboration with: Doug Moore <dougm@rice.edu>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D17635

5 years agoAdd a quirk handling for AMDI0040 controllers allowing them to do HS400.
Marius Strobl [Sun, 18 Nov 2018 00:52:27 +0000 (00:52 +0000)]
Add a quirk handling for AMDI0040 controllers allowing them to do HS400.

Submitted by: Shreyank Amartya (original version)

5 years agomount_fusefs.8: expand HISTORY section
Alan Somers [Sat, 17 Nov 2018 21:35:01 +0000 (21:35 +0000)]
mount_fusefs.8: expand HISTORY section

Note that fuse was available from ports long before joining the base system.
Also, update the upstream URL.

MFC after: 2 weeks

5 years agolibbe(3): Rewrite be_unmount to stop mucking with getmntinfo(2)
Kyle Evans [Sat, 17 Nov 2018 19:19:37 +0000 (19:19 +0000)]
libbe(3): Rewrite be_unmount to stop mucking with getmntinfo(2)

Go through the ZFS layer instead; given a BE, we can derive the dataset,
zfs_open it, then zfs_unmount. ZFS takes care of the dirty details and
likely gets it more correct than we did for more interesting setups.

MFC after: 3 days

5 years agolibbe(3): rewrite init to support chroot usage
Kyle Evans [Sat, 17 Nov 2018 19:15:29 +0000 (19:15 +0000)]
libbe(3): rewrite init to support chroot usage

libbe(3) currently uses zfs_be_root and locates which of its children is
currently mounted at "/". This is reasonable, but not correct in the case of
a chroot, for two reasons:

- chroot root may be of a different zpool than zfs_be_root
- chroot root will not show up as mounted at "/"

Fix both of these by rewriting libbe_init to work from the rootfs down.
zfs_path_to_zhandle on / will resolve to the dataset mounted at the new
root, rather than the real root. From there, we can derive the BE root/pool
and grab the bootfs off of the new pool. This does no harm in the average
case, and opens up bectl to operating on different pools for scenarios where
one may be, for instance, updating a pool that generally gets re-rooted into
from a separate UFS root or zfs bootpool.

While here, I've also:
- Eliminated the check for /boot and / to be on the same partition. This
  leaves one open to a setup where /boot (and consequently, kernel/modules)
  are not included in the boot environment. This may very well be an
  intentional setup done by someone that knows what they're doing, we should
  not kill BE usage because of it.

- Eliminated the validation bits of BEs and snapshots that enforced
  'mountpoint' to be "/" -- this broke when trying to operate on an imported
  pool with an altroot, but we need not be this picky.

Reported by: philip
Reviewed by: philip, allanjude (previous version)
Tested by: philip
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18012

5 years ago- Restore setting the clock for devices which support the default/legacy
Marius Strobl [Sat, 17 Nov 2018 17:21:36 +0000 (17:21 +0000)]
- Restore setting the clock for devices which support the default/legacy
  transfer mode only (lost with r321385). [1]
- Similarly, don't try to set the power class on MMC devices that comply
  to version 4.0 of the system specification but are operated in default/
  legacy transfer or 1-bit bus mode as no power class is specified for
  these cases. Trying to set a power class nevertheless resulted in an -
  albeit harmless - error message.

PR: 231713 [1]

5 years agoImprove the comment for arpresolve_full() in if_ether.c.
Bjoern A. Zeeb [Sat, 17 Nov 2018 16:13:09 +0000 (16:13 +0000)]
Improve the comment for arpresolve_full() in if_ether.c.
No functional changes.

MFC after: 6 weeks

5 years agoRetire arpresolve_addr(), which is not used anywhere, from if_ether.c.
Bjoern A. Zeeb [Sat, 17 Nov 2018 16:08:36 +0000 (16:08 +0000)]
Retire arpresolve_addr(), which is not used anywhere, from if_ether.c.

5 years agoMake mbstowcs_basic test pass, now that we have more ctype definitions.
Yuri Pankov [Sat, 17 Nov 2018 12:59:59 +0000 (12:59 +0000)]
Make mbstowcs_basic test pass, now that we have more ctype definitions.

Reported by: jenkins
Approved by: kib (mentor, implicit)

5 years agoUse UnicodeData.txt to create UTF-8 ctype map.
Yuri Pankov [Sat, 17 Nov 2018 10:36:00 +0000 (10:36 +0000)]
Use UnicodeData.txt to create UTF-8 ctype map.

This should provide more complete coverage of currently defined Unicode
characters as compared to manually assembled one we use currently.

Comparison of original and new UTF-8 ctype maps by character class:

TYPE    ORIG    NEW
alnum   94229   126029
alpha   93557   125419
blank   4       2
cntrl   73      137685
digit   469     622
graph   109615  137203
lower   1478    2145
print   109641  137222
punct   3428    797
rune    110481  274907
space   33      24
upper   983     1781
xdigit  469     622

Large number of added cntrl definitions is due to the fact that private-use
planes are currently defined as such, this can change in the future.

Discussed with: bapt
Approved by: kib (mentor, implicit)
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D17842

5 years agoFix stray tab.
Brooks Davis [Sat, 17 Nov 2018 00:03:04 +0000 (00:03 +0000)]
Fix stray tab.

Reported by: jbeich
MFC after: 3 days
MFC with: r340489
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18011

5 years agoFix freebsd32 support for PCIOCGETCONF.
Brooks Davis [Fri, 16 Nov 2018 23:58:51 +0000 (23:58 +0000)]
Fix freebsd32 support for PCIOCGETCONF.

This fixes regresssions in pciconf -l and some ports as reported on
freebsd-current:

https://lists.freebsd.org/pipermail/freebsd-current/2018-November/072144.html

Reported by: jbeich
Reviewed by: kib (also proposed an idential patch)
Tested by: jbeich
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18011

5 years agoAxe MINIMUM_MSI_INT.
John Baldwin [Fri, 16 Nov 2018 23:39:39 +0000 (23:39 +0000)]
Axe MINIMUM_MSI_INT.

Just allow MSI interrupts to always start at the end of the I/O APIC
pins.  Since existing machines already have more than 255 I/O APIC
pins, IRQ 255 is no longer reliably invalid, so just remove the
minimum starting value for MSI.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D17991

5 years agoAlign IA32_ARCH_CAP MSR definitions and use with SDM rev. 068.
Konstantin Belousov [Fri, 16 Nov 2018 21:27:11 +0000 (21:27 +0000)]
Align IA32_ARCH_CAP MSR definitions and use with SDM rev. 068.

SDM rev. 068 was released yesterday and it contains the description of
the MSR 0x10a IA32_ARCH_CAP. This change adds symbolic definitions for
all bits present in the document, and decode them in the CPU
identification lines printed on boot.

But also, the document defines SSB_NO as bit 4, while FreeBSD used but
2 to detect the need to work-around Speculative Store Bypass
issue.  Change code to use the bit from SDM.

Similarly, the document describes bit 3 as an indicator that L1TF
issue is not present, in particular, no L1D flush is needed on
VMENTRY.  We used RDCL_NO to avoid flushing, and again I changed the
code to follow new spec from SDM.

In fact my Apollo Lake machine with latest ucode shows this:
    IA32_ARCH_CAPS=0x19<RDCL_NO,SKIP_L1DFL_VME,SSB_NO>

Reviewed by: bwidawsk
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D18006

5 years agoConsolidate on a single set of constants for SCMD fields.
John Baldwin [Fri, 16 Nov 2018 19:08:52 +0000 (19:08 +0000)]
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.

Sponsored by: Chelsio Communications

5 years agoAdd regression tests for r340313 and r340483.
Mark Johnston [Fri, 16 Nov 2018 19:04:12 +0000 (19:04 +0000)]
Add regression tests for r340313 and r340483.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17926

5 years agoRename the SO_REUSEPORT_LB test file to be consistent with other tests.
Mark Johnston [Fri, 16 Nov 2018 18:59:58 +0000 (18:59 +0000)]
Rename the SO_REUSEPORT_LB test file to be consistent with other tests.

MFC after: 1 week

5 years agoAdd some additional length checks to the IPv4 fragmentation code.
Jonathan T. Looney [Fri, 16 Nov 2018 18:32:48 +0000 (18:32 +0000)]
Add some additional length checks to the IPv4 fragmentation code.

Specifically, block 0-length fragments, even when the MF bit is clear.
Also, ensure that every fragment with the MF bit clear ends at the same
offset and that no subsequently-received fragments exceed that offset.

Reviewed by: glebius, markj
MFC after: 3 days
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D17922

5 years agoproc: always store parent pid in p_oppid
Mateusz Guzik [Fri, 16 Nov 2018 17:07:54 +0000 (17:07 +0000)]
proc: always store parent pid in p_oppid

Doing so removes the dependency on proctree lock from sysctl process list
export which further reduces contention during poudriere -j 128 runs.

Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17825

5 years agoRemove do-nothing nvme_modevent.
Warner Losh [Fri, 16 Nov 2018 16:51:44 +0000 (16:51 +0000)]
Remove do-nothing nvme_modevent.

nvme_modevent no longer does anything interesting, remove it.

Sponsored by: Netflix

5 years agoDefine asm macro in the LinuxKPI.
Hans Petter Selasky [Fri, 16 Nov 2018 16:23:45 +0000 (16:23 +0000)]
Define asm macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoImplement ktime_get_ts64() function macro in the LinuxKPI.
Hans Petter Selasky [Fri, 16 Nov 2018 16:19:16 +0000 (16:19 +0000)]
Implement ktime_get_ts64() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agodevelopment(7): Replace "reboot" with "shutdown -r now"
Mateusz Piotrowski [Fri, 16 Nov 2018 14:29:28 +0000 (14:29 +0000)]
development(7): Replace "reboot" with "shutdown -r now"

We generally document shutdown(8) instead of reboot(8) as it's better for
interactive use.

In modern FreeBSD is matters a lot less, it's mostly just convention. One
minor thing is that shutdown(8) produces a global message, while reboot(8)
does not. It is believed that historically, some versions of reboot did not
do appropriate safe shutdown checks and just rebooted.

It's also just consistency: for example the handbook[1] documents shutdown.

There is actually another important difference between reboot and shutdown
-r now: reboot does not run /etc/rc.shutdown. This is because reboot has
its own shutdown procedure and does not signal init like init 6 and
shutdown -r now do (except in the case of rerooting via reboot -r).

A few years ago jilles@ proposed changing reboot's default to signalling
init (preserving reboot -q which just invokes the reboot system call), but
this was not accepted. Perhaps this can be tried again for 13.0.

[1]: https://www.freebsd.org/doc/handbook/boot-shutdown.html

Reported by: eadler
Reviewed by: eadler, jilles
Approved by: krion (mentor)
Differential Revision: https://reviews.freebsd.org/D16843

5 years agoAllow configuration of several ipsec interfaces with the same tunnel
Andrey V. Elsukov [Fri, 16 Nov 2018 14:21:57 +0000 (14:21 +0000)]
Allow configuration of several ipsec interfaces with the same tunnel
endpoints.

This can be used to configure several IPsec tunnels between two hosts
with different security associations.

Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC

5 years agoImplement support for sysctl hw.model for Mediatek/Ralink SoCs
Stanislav Galabov [Fri, 16 Nov 2018 11:17:18 +0000 (11:17 +0000)]
Implement support for sysctl hw.model for Mediatek/Ralink SoCs

These SoCs have CHIPID registers, which store the Chip model, according
to the manufacturer; make use of those in order to better identify
the chip we're actually running on.

If we're unable to read the CHIPID registers for some reason we will
use the string "unknown " as a value for hw.model.

Reported by: yamori813@yahoo.co.jp
Sponsored by: Smartcom - Bulgaria AD

5 years agoifnet(9): Add description of IFCAP_NETMAP
Vincenzo Maffione [Fri, 16 Nov 2018 10:20:35 +0000 (10:20 +0000)]
ifnet(9): Add description of IFCAP_NETMAP

Describe IFCAP_NETMAP adding a cross reference to netmap(4).

Reviewed by: bcr, 0mp
Approved by: gnn (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17988

5 years agoFix flags collision causing inability to enable CBQ in ALTQ
Mike Karels [Fri, 16 Nov 2018 03:42:29 +0000 (03:42 +0000)]
Fix flags collision causing inability to enable CBQ in ALTQ

The CBQ BORROW flag conflicts with the RMCF_CODEL flag; the
two sets of definitions actually define the same things. The symptom
is that a kernel with CBQ support and not CODEL fails to load a QoS
policy with the obscure error "pfctl: DIOCADDALTQ: Cannot allocate memory."
If ALTQ_DEBUG is enabled, the error becomes a little clearer:
"rmc_newclass: CODEL not configured for CBQ!" is printed by the kernel.
There really shouldn't be two sets of macros that have to be defined
consistently, but the include structure isn't right for exporting
CBQ flags to altq_rmclass.h. Re-align the definitions, and add
CTASSERTs in the kernel to ensure that the definitions are consistent.

PR: 215716
Reviewed by: pkelsey
MFC after: 2 weeks
Sponsored by: Forcepoint LLC
Differential Revision: https://reviews.freebsd.org/D17758

5 years agoRestore the <sys/vmem.h> header to fix build of cxgbe(4) TOM.
John Baldwin [Fri, 16 Nov 2018 01:27:24 +0000 (01:27 +0000)]
Restore the <sys/vmem.h> header to fix build of cxgbe(4) TOM.

vmem's are not just used for TLS memory in TOM and the #include actually
predates the TLS code so should not have been removed when the TLS vmem
moved in r340466.

Pointy hat to: jhb
Sponsored by: Chelsio Communications

5 years agoamd64: handle small memset buffers with overlapping stores
Mateusz Guzik [Fri, 16 Nov 2018 00:44:22 +0000 (00:44 +0000)]
amd64: handle small memset buffers with overlapping stores

Instead of jumping to locations which store the exact number of bytes,
use displacement to move the destination.

In particular the following clears an area between 8-16 (inclusive)
branch-free:

movq    %r10,(%rdi)
movq    %r10,-8(%rdi,%rcx)

For instance for rcx of 10 the second line is rdi + 10 - 8 = rdi + 2.
Writing 8 bytes starting at that offset overlaps with 6 bytes written
previously and writes 2 new, giving 10 in total.

Provides a nice win for smaller stores. Other ones are erratic depending
on the microarchitecture.

General idea taken from NetBSD (restricted use of the trick) and bionic
string functions (use for various ranges like in this patch).

Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17660

5 years agoRemove bogus roundup2() of the key programming work request header.
John Baldwin [Thu, 15 Nov 2018 23:31:04 +0000 (23:31 +0000)]
Remove bogus roundup2() of the key programming work request header.

The key context is always placed immediately after the work request
header.  The total work request length has to be rounded up by 16
however.

MFC after: 1 month
Sponsored by: Chelsio Communications

5 years agoChange the quantum for TLS key addresses to 32 bytes.
John Baldwin [Thu, 15 Nov 2018 23:10:46 +0000 (23:10 +0000)]
Change the quantum for TLS key addresses to 32 bytes.

The addresses passed when reading and writing keys are always shifted
right by 5 as the memory locations are addressed in 32-byte chunks, so
the quantum needs to be 32, not 8.

MFC after: 1 month
Sponsored by: Chelsio Communications

5 years agoRemove mostly-useless proc provider probes.
Mark Johnston [Thu, 15 Nov 2018 23:02:59 +0000 (23:02 +0000)]
Remove mostly-useless proc provider probes.

For some reason the proc UMA zone's ctor, dtor and init functions are
instrumented, but these functions are always available through FBT.
Moreover, the probes are not part of the original Solaris proc
provider, aren't documented, have no uses (e.g., in dwatch(8)) and
have no clear use to begin with.  Therefore, remove them.

Reviewed by: rpaulo
Differential Revision: https://reviews.freebsd.org/D2169

5 years agoMove the TLS key map into the adapter softc so non-TOE code can use it.
John Baldwin [Thu, 15 Nov 2018 23:00:30 +0000 (23:00 +0000)]
Move the TLS key map into the adapter softc so non-TOE code can use it.

Sponsored by: Chelsio Communications

5 years agoUse sbsndptr_adv() instead of sbsndptr() for TOE TLS.
John Baldwin [Thu, 15 Nov 2018 22:47:47 +0000 (22:47 +0000)]
Use sbsndptr_adv() instead of sbsndptr() for TOE TLS.

For TOE TLS, we just want to advance the send pointer to skip over the
record just sent to the TOE.  The recently added sbsndptr_adv() is
sufficient for that and is cheaper.

MFC after: 1 month
Sponsored by: Chelsio Communications

5 years agoamd64: sync up libc memset with the kernel version
Mateusz Guzik [Thu, 15 Nov 2018 20:28:35 +0000 (20:28 +0000)]
amd64: sync up libc memset with the kernel version

- tidy up memset to have rax set earlier for small sizes
- finish the tail in memset with an overlapping store
- align memset buffers to 16 bytes before using rep stos

Sponsored by: The FreeBSD Foundation

5 years agoamd64: convert libc bzero to a C func to avoid future bloat
Mateusz Guzik [Thu, 15 Nov 2018 20:20:39 +0000 (20:20 +0000)]
amd64: convert libc bzero to a C func to avoid future bloat

Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17549

5 years agoConvert the number of MSI IRQs on x86 from a constant to a tunable.
John Baldwin [Thu, 15 Nov 2018 18:37:41 +0000 (18:37 +0000)]
Convert the number of MSI IRQs on x86 from a constant to a tunable.

The number of MSI IRQs still defaults to 512, but it can now be
changed at boot time via the machdep.num_msi_irqs tunable.

Reviewed by: kib, royger (older version)
Reviewed by: markj
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D17977

5 years agoSet the SPI clock speed and polarity on each transfer to catch up with
Luiz Otavio O Souza [Thu, 15 Nov 2018 17:05:02 +0000 (17:05 +0000)]
Set the SPI clock speed and polarity on each transfer to catch up with
recent changes in spibus and allow the use of different SPI modes on
the same bus.

Reported by: ian
Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoComment MD_ROOT and remove 'device re' which is not part of the system and
Luiz Otavio O Souza [Thu, 15 Nov 2018 16:29:27 +0000 (16:29 +0000)]
Comment MD_ROOT and remove 'device re' which is not part of the system and
can be loaded as module.

5 years agofcntl.2: document an additional error condition
Alan Somers [Thu, 15 Nov 2018 16:13:25 +0000 (16:13 +0000)]
fcntl.2: document an additional error condition

MFC after: 2 weeks

5 years agoAdd cam_iosched_set_latfcn to set a latency callback for high latency.
Warner Losh [Thu, 15 Nov 2018 16:02:45 +0000 (16:02 +0000)]
Add cam_iosched_set_latfcn to set a latency callback for high latency.

It's often useful to have a callback when an I/O takes more than a
threshold amount of time. This adds the infrastructure for periph
devices to register one.

One use-case is as a debugging aide when you need a semi-realtime
indication of an I/O outlier so you can trigger bus capture gear for
vendor analysis.

Sponsored by: Netflix, Inc

5 years agoIntroduce scsi_ata_setfeatures() as a convenient way to make
Warner Losh [Thu, 15 Nov 2018 16:02:34 +0000 (16:02 +0000)]
Introduce scsi_ata_setfeatures() as a convenient way to make
a passthru ATA SETFEATURES command.

Sponsored by: Netflix, Inc

5 years agoDo proper conversion to/from sbt.
Warner Losh [Thu, 15 Nov 2018 16:02:24 +0000 (16:02 +0000)]
Do proper conversion to/from sbt.

Doh! sbttoX and Xtosbt were backwards. While they ran, they produced
bogus results.

Pointy hat to: imp@

5 years agoWhen converting ns,us,ms to sbt, return the ceil() of the result
Warner Losh [Thu, 15 Nov 2018 16:02:13 +0000 (16:02 +0000)]
When converting ns,us,ms to sbt, return the ceil() of the result
rather than the floor(). Returning the floor means that
sbttoX(Xtosbt(y)) != y for almost all values of y.  In practice, this
results in a difference of at most 1 in the lsb of the sbintime_t.
This difference is meaningless for all current users of these
functions, but is important for the newly introduced sysctl conversion
routines which implicitly rely on the transformation being idempotent.

Sponsored by: Netflix, Inc

5 years agoRemove trailing white space in advance of other changes.
Warner Losh [Wed, 14 Nov 2018 23:15:50 +0000 (23:15 +0000)]
Remove trailing white space in advance of other changes.

5 years agoClear RX completion queue state veriables in iflib_stop()
Stephen Hurd [Wed, 14 Nov 2018 20:36:18 +0000 (20:36 +0000)]
Clear RX completion queue state veriables in iflib_stop()

iflib_stop() was not resetting the rxq completion queue state variables.
This meant that for any driver that has receive completion queues, after a
reinit, iflib would start asking what's available on the rx side starting at
whatever the completion queue index was prior to the stop, instead of at 0.

Submitted by: pkelsey
Reported by: pkelsey
MFC after: 3 days
Sponsored by: Limelight Networks

5 years agoInitialize compatibility epoch tracker for thread0. Fixes
Gleb Smirnoff [Wed, 14 Nov 2018 19:10:35 +0000 (19:10 +0000)]
Initialize compatibility epoch tracker for thread0. Fixes
panics for drivers that call if_maddr_lock() during startup.

Reported by: cy

5 years agomountd has no way to configure the listen queue depth; rather than add a new
Sean Eric Fagan [Wed, 14 Nov 2018 19:06:43 +0000 (19:06 +0000)]
mountd has no way to configure the listen queue depth; rather than add a new
option, we pass -1 down to listen, which causes it to use the
kern.ipc.soacceptqueue sysctl.

Approved by: mav
MFC after: 2 weeks
Sponsored by: iXsystems Inc

5 years agoRevert r332735 and fix MSI-X to properly fail allocations when full.
John Baldwin [Wed, 14 Nov 2018 18:45:33 +0000 (18:45 +0000)]
Revert r332735 and fix MSI-X to properly fail allocations when full.

The off-by-one errors in 332735 weren't actual errors and were
preventing the last MSI interrupt source from being used.  Instead,
the issue is that when all MSI interrupt sources were allocated, the
loop in msix_alloc() would terminate with 'msi' still set to non-null.
The only check for 'i' overflowing was in the 'msi' == NULL case, so
msix_alloc() would try to reuse the last MSI interrupt source instead
of failing.

Fix by moving the check for all sources being in use to just after the
loop.

Reviewed by: kib, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D17976

5 years agoFix typo introduced in r340439 - s/ETN/ETC/
Renato Botelho [Wed, 14 Nov 2018 18:38:27 +0000 (18:38 +0000)]
Fix typo introduced in r340439 - s/ETN/ETC/

Reported by: jhb, yuripv
Approved by: eugen
MFC after: 3 days
X-MFC-With: 340439
Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoFix /etc/ntp permissions. According to mtree it must be 0700
Renato Botelho [Wed, 14 Nov 2018 16:19:15 +0000 (16:19 +0000)]
Fix /etc/ntp permissions. According to mtree it must be 0700

Reviewed by: imp
Approved by: imp
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D17973

5 years agoHook mac_ntpd.4 up to the build.
Mark Johnston [Wed, 14 Nov 2018 16:18:13 +0000 (16:18 +0000)]
Hook mac_ntpd.4 up to the build.

PR: 232757
Submitted by: Yasuhiro KIMURA <yasu@utahime.org>
MFC after: 3 days

5 years agoFix the path to malloc_domain.9.
Mark Johnston [Wed, 14 Nov 2018 16:15:36 +0000 (16:15 +0000)]
Fix the path to malloc_domain.9.

Reported by: yuripv
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agovtnet: fix netmap support
Vincenzo Maffione [Wed, 14 Nov 2018 15:39:48 +0000 (15:39 +0000)]
vtnet: fix netmap support

netmap(4) support for vtnet(4) was incomplete and had multiple bugs.
This commit fixes those bugs to bring netmap on vtnet in a functional state.

Changelist:
  - handle errors returned by virtqueue_enqueue() properly (they were
    previously ignored)
  - make sure netmap XOR rest of the kernel access each virtqueue.
  - compute the number of netmap slots for TX and RX separately, according to
    whether indirect descriptors are used or not for a given virtqueue.
  - make sure sglist are freed according to their type (mbufs or netmap
    buffers)
  - add support for mulitiqueue and netmap host (aka sw) rings.
  - intercept VQ interrupts directly instead of intercepting them in txq_eof
    and rxq_eof. This simplifies the code and makes it easier to make sure
    taskqueues are not running for a VQ while it is in netmap mode.
  - implement vntet_netmap_config() to cope with changes in the number of queues.

Reviewed by: bryanv
Approved by: gnn (mentor)
MFC after: 3 days
Sponsored by: Sunny Valley Networks
Differential Revision: https://reviews.freebsd.org/D17916

5 years agoPrevent POLA violation with TSO/CSUM offload
Stephen Hurd [Wed, 14 Nov 2018 15:23:39 +0000 (15:23 +0000)]
Prevent POLA violation with TSO/CSUM offload

Ensure that any time CSUM_IP_TSO or CSUM_IP6_TSO is set that the corresponding
CSUM_IP6?_TCP / CSUM_IP flags are also set.

Rather than requireing drivers to bake-in an understanding that TSO implies
checksum offloads, make it explicit.

This change requires us to move the IFLIB_NEED_ZERO_CSUM implementation to
ensure it's zeroed for TSO.

Reported by: Jacob Keller <jacob.e.keller@intel.com>
MFC after: 1 week
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D17801

5 years agoFix leaks caused by ifc_nhwtxqs never being initialized
Stephen Hurd [Wed, 14 Nov 2018 15:16:45 +0000 (15:16 +0000)]
Fix leaks caused by ifc_nhwtxqs never being initialized

r333502 removed initialization of ifc_nhwtxqs, and it's not clear
there's a need to copy it into the struct iflib_ctx at all. Use
ctx->ifc_sctx->isc_ntxqs instead.

Further, iflib_stop() did not clear the last ring in the case where
isc_nfl != isc_nrxqs (such as when IFLIB_HAS_RXCQ is set). Use
ctx->ifc_sctx->isc_nrxqs here instead of isc_nfl.

Reported by: pkelsey
Reviewed by: pkelsey
MFC after: 3 days
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D17979

5 years agosmbutil(1): Improve mdoc formatting.
Mateusz Piotrowski [Wed, 14 Nov 2018 15:15:07 +0000 (15:15 +0000)]
smbutil(1): Improve mdoc formatting.

Also, make the path to the example configuration file absolute.

Reviewed by: bcr
Approved by: krion (mentor, implicit), mat (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17985

5 years agoAdd the driver for the SPI controller on ARMADA38X.
Luiz Otavio O Souza [Wed, 14 Nov 2018 14:26:32 +0000 (14:26 +0000)]
Add the driver for the SPI controller on ARMADA38X.

Tested on Clearfog (Pro) and SG-3100.

Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoAdd d_off support for multiple filesystems.
Konstantin Belousov [Wed, 14 Nov 2018 14:18:35 +0000 (14:18 +0000)]
Add d_off support for multiple filesystems.

The d_off field has been added to the dirent structure recently.
Currently filesystems don't support this feature.  Support has been
added and tested for zfs, ufs, ext2fs, fdescfs, msdosfs and unionfs.
A stub implementation is available for cd9660, nandfs, udf and
pseudofs but hasn't been tested.

Motivation for this feature: our usecase is for a userspace nfs server
(nfs-ganesha) with zfs.  At the moment we cache direntry offsets by
calling lseek once per entry, with this patch we can get the offset
directly from getdirentries(2) calls which provides a significant
speedup.

Submitted by: Jack Halford <jack@gandi.net>
Reviewed by: mckusick, pfg, rmacklem (previous versions)
Sponsored by: Gandi.net
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D17917