]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoUsage cleanup pt 1
imp [Sun, 2 Dec 2018 23:12:58 +0000 (23:12 +0000)]
Usage cleanup pt 1

Provide a usage() function that takes a struct nvme_function pointer
and produces a usage mssage. Eliminate all now-redundant usage
functions. Propigate the new argument through the program as needed.
Use common routine to print usage.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoReturn after we find the dispatched function.
imp [Sun, 2 Dec 2018 23:12:48 +0000 (23:12 +0000)]
Return after we find the dispatched function.

If the dispatched function doesn't exit, then we get can get a
spurious function not found message. They all do exit, but this is a
little cleaner.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove the hgst/wdc log page printing code into wdc.c
imp [Sun, 2 Dec 2018 23:12:37 +0000 (23:12 +0000)]
Move the hgst/wdc log page printing code into wdc.c

These are all hgst/wdc specific, so move them into the wdc.c to live
with the wdc command.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove common logpage routines into nvmecontrol.h
imp [Sun, 2 Dec 2018 23:12:26 +0000 (23:12 +0000)]
Move common logpage routines into nvmecontrol.h

For the upcoming move of vendor specific code into vendor specific
files, make the common logpage routines global and move them to
nvmecontrol.h.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMake logpage functions a linker set.
imp [Sun, 2 Dec 2018 23:12:16 +0000 (23:12 +0000)]
Make logpage functions a linker set.

Move logpage function def to header. Convert all the logpage_function
elements to elements of the linker set. Leave them all in logpage.c
for the moment.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove nvmecontrol to using linker sets for commands
imp [Sun, 2 Dec 2018 23:10:55 +0000 (23:10 +0000)]
Move nvmecontrol to using linker sets for commands

More commands will be added to nvmecontrol. Also, there will be a few
more vendor commands (some of which may need to remain private to
companies writing them). The first step on that journey is to move to
using linker sets to dispatch commands. The next step will be using
dlopen to bring in the .so's that have the command that might need
to remain private for seamless integration.

Similar changes to this will be needed for vendor specific log pages.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoFix PCI driver unload for Marvell PCI controller
gonzo [Sun, 2 Dec 2018 21:58:36 +0000 (21:58 +0000)]
Fix PCI driver unload for Marvell PCI controller

Add generic implementation for bus_deactivate_resource method. Without
it bus_release_resource fails with "Failed to release active resource"
message

MFC after: 1 week

5 years agoBuild the dtb for the rock64 board.
andreast [Sun, 2 Dec 2018 19:36:20 +0000 (19:36 +0000)]
Build the dtb for the rock64 board.

Reviewed by: manu@

5 years agoAdd rule to build the dtb for the rock64 board.
andreast [Sun, 2 Dec 2018 19:35:22 +0000 (19:35 +0000)]
Add rule to build the dtb for the rock64 board.

Reviewed by: manu@

5 years agoFix off-by-one (page) errors in checks in d_mmap methods of several drivers.
kib [Sun, 2 Dec 2018 18:30:58 +0000 (18:30 +0000)]
Fix off-by-one (page) errors in checks in d_mmap methods of several drivers.

Reported by: C Turt <ecturt@gmail.com>
Reviewed by: alc, markj
admbug: 781
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoAdd a comment noting that the additional range checks are not needed.
kib [Sun, 2 Dec 2018 13:29:13 +0000 (13:29 +0000)]
Add a comment noting that the additional range checks are not needed.

The object size is set in the dsp_mmap_single() which provides the
range limit by vm_fault().

Reported by: C Turt <ecturt@gmail.com>
Reviewed by: alc, markj
admbug: 781
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoFix off by one in hpet_mmap() csw method.
kib [Sun, 2 Dec 2018 13:27:36 +0000 (13:27 +0000)]
Fix off by one in hpet_mmap() csw method.

Reported by: C Turt <ecturt@gmail.com>
Reviewed by: alc, markj
Tested by: pho
admbug: 781
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoChange the vm_ooffset_t type to unsigned.
kib [Sun, 2 Dec 2018 13:16:46 +0000 (13:16 +0000)]
Change the vm_ooffset_t type to unsigned.

The type represents byte offset in the vm_object_t data space, which
does not span negative offsets in FreeBSD VM.  The change matches byte
offset signess with the unsignedness of the vm_pindex_t which
represents the type of the page indexes in the objects.

This allows to remove the UOFF_TO_IDX() macro which was used when we
have to forcibly interpret the type as unsigned anyway.  Also it fixes
a lot of implicit bugs in the device drivers d_mmap methods.

Reviewed by: alc, markj (previous version)
Tested by: pho
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoCorrect accuracy of the barrier writes accounting.
kib [Sun, 2 Dec 2018 12:53:39 +0000 (12:53 +0000)]
Correct accuracy of the barrier writes accounting.

Discussed with: mckusick
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoReturn computed real memory size, not a value from similarly named
mmel [Sun, 2 Dec 2018 07:39:16 +0000 (07:39 +0000)]
Return computed real memory size, not a value from similarly named
global variable.

MFC after: 1 week

5 years agoUnbreak geli/gmirror testcases if their geom classes cannot be loaded
asomers [Sun, 2 Dec 2018 05:06:37 +0000 (05:06 +0000)]
Unbreak geli/gmirror testcases if their geom classes cannot be loaded

The problem with the logic prior to this commit was twofold:

1. The wrong set of idioms (TAP-compatible) were being applied to the ATF
   testcases when run, resulting in confusing ATF failure results on setup.
2. The cleanup subroutines were broken when the geom classes could not be
   loaded as they exited with 0 unexpectedly.

This commit changes the test code to source the class-specific configuration
(conf.sh) once globally, instead of sourcing it per testcase and per cleanup
subroutine, and to call the ATF-specific setup subroutine(s) inline in
the testcases.

The refactoring done is effectively a no-op for the TAP testcases, modulo
any refactoring done to create common code between the ATF and TAP
testcases.

This unbreaks the geli testcases converted to ATF in r327662 and r327683,
and the gmirror testcases added in r327780, respectively, when the geom
class could not be loaded.

tests/sys/geom/class/mirror/...
    While here, ignore errors when turning debug failpoint sysctl off, which
    could occur if the gmirror class was not loaded.

Submitted by: ngie
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd/pull/241

5 years agoubldr: Force 'usefdt' variable to 1 for powerpc
jhibbits [Sun, 2 Dec 2018 02:20:35 +0000 (02:20 +0000)]
ubldr: Force 'usefdt' variable to 1 for powerpc

The fdt is gated, on powerpc, with a 'usefdt' environment variable.  Force
enable it in ubldr, so that the fdt is passed through the metadata.

5 years agoRemove some dead code from the geli tests
asomers [Sun, 2 Dec 2018 00:41:43 +0000 (00:41 +0000)]
Remove some dead code from the geli tests

This is detritus in the Makefile, leftover from 327662.

MFC after: 2 weeks

5 years agopmcr: Fix pstate setting on Power8
cem [Sat, 1 Dec 2018 21:37:47 +0000 (21:37 +0000)]
pmcr: Fix pstate setting on Power8

Fix p-state setting on Power8 by removing the accidental double-indirection of
the pstate_ids table.

The pstate_ids table comes from the OF property "ibm,pstate-ids."  On Power9,
the values happen to be identical to the indices, so the extra indirection was
harmless.  On Power8, the values were out of the range [0, npstates], so
pmcr_set() would fail the spec[0] range check with EINVAL.

While here, include both the value and index in the driver-specific register
array as spec[0] and spec[1] respectively.  They're redundant, but relatively
harmless, and it may aid debugging.

While here, fix the range check to exclude the index npstates, which is one
past the last valid index.

PR: 233693
Reported and tested by: sbruno
Reviewed by: jhibbits

5 years agoRestore build of the kernel, removed through r341377
cem [Sat, 1 Dec 2018 21:28:05 +0000 (21:28 +0000)]
Restore build of the kernel, removed through r341377

Turns out we already had a path_mtu_discovery variable.

X-MFC-with: r341377

5 years agoFix PowerPC64 ELFv1-specific problem in __elf_phdr_match_addr() leading to crash
jhibbits [Sat, 1 Dec 2018 20:39:20 +0000 (20:39 +0000)]
Fix PowerPC64 ELFv1-specific problem in __elf_phdr_match_addr() leading to crash
in threaded programs that unload libraries.

Summary:
The GNOME update to 3.28 exposed a bug in __elf_phdr_match_addr(), which leads
to a crash when building devel/libsoup on powerpc64.

Due to __elf_phdr_match_addr() limiting its search to PF_X sections, on the
PPC64 ELFv1 ABI, it was never matching function pointers properly.

This meant that libthr was never cleaning up its atfork list in
__pthread_cxa_finalize(), so if a library with an atfork handler was unloaded,
libthr would crash on the next fork.

Normally, the null pointer check it does before calling the handler would avoid
this crash, but, due to PPC64 ELFv1 using function descriptors instead of raw
function pointers, a null check against the pointer itself is insufficient, as
the pointer itself was not null, it was just pointing at a function descriptor
that had been zeroed. (Which is an ABI violation.)

Calling a zeroed function descriptor on PPC64 ELFv1 causes a jump to address 0
with a zeroed r2 and r11.

Submitted by: git_bdragon.rtk0.net
Reviewed By: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18364

5 years agoAdd Silergy SYR827 PMIC driver
manu [Sat, 1 Dec 2018 20:31:49 +0000 (20:31 +0000)]
Add Silergy SYR827 PMIC driver

SYR827 is a PMIC that can output a voltage from 0.7125V to 1.5V in 12.5mV steps
It's controlled via I2C.

MFC after: 1 month

5 years agoarm64: rockchip: rk805: Add basic support for RK808 PMIC
manu [Sat, 1 Dec 2018 20:31:05 +0000 (20:31 +0000)]
arm64: rockchip: rk805: Add basic support for RK808 PMIC

RK808 PMIC is the companion chip for RK3399 SoC.
Add basic regulator support in RK805 since they are similar.

MFC after: 1 month

5 years agoRemove IFF_DRVRLOCK as it is used in IRIX only (and we all know IRIX
cy [Sat, 1 Dec 2018 20:30:18 +0000 (20:30 +0000)]
Remove IFF_DRVRLOCK as it is used in IRIX only (and we all know IRIX
is dead). This includes collaterally removing code shared by HP/UX,
SGI, and Linux, where IP Filter will in all likelihood for various
reasons never run again.

MFC after: 1 week

5 years agoarm64: rockchip: rk_i2c: Use correct clock
manu [Sat, 1 Dec 2018 20:29:42 +0000 (20:29 +0000)]
arm64: rockchip: rk_i2c: Use correct clock

While here add RK3399 support and call clk_set_assigned to set the correct
clock set in the DTS.

MFC after: 1 month

5 years agoarm64/rockchip: add RK3399 support
manu [Sat, 1 Dec 2018 20:28:16 +0000 (20:28 +0000)]
arm64/rockchip: add RK3399 support

Add CRU (Clock and Reset Unit) driver for RK3399.
Add support in rk_pinctrl driver.

Submitted by:  Greg V <greg@unrelenting.technology> (Original version)
Differential Revision: https://reviews.freebsd.org/D16732

MFC after: 1 month

5 years agoarm64: rockchip: Add RK3399_CLK_PLL
manu [Sat, 1 Dec 2018 20:26:59 +0000 (20:26 +0000)]
arm64: rockchip: Add RK3399_CLK_PLL

PLLs on the RK3399 are different than the ones on the RK3328.
Add a new type and some dedicated recalc and set_freq functions.
Rename the RK3328 dedicated rk_clk_pll function with rk3328_ prefix.

MFC after: 1 month

5 years agoRestore handling of PMTU discovery, removed through an unifdef(1)
cy [Sat, 1 Dec 2018 17:59:41 +0000 (17:59 +0000)]
Restore handling of PMTU discovery, removed through an unifdef(1)
following the MFV of r254219 into r255332. In addition the 'FreeBSD'
macro was never defined in ipfilter 5.1.2 thus it never would have
been enabled in the first place.

This work is prompted by a general cleanup of the IP Filter code
prompted by working to resolve a PR. More to follow.

MFC after: 1 week

5 years agoAllow to create swap zone larger than v_page_count / 2.
kib [Sat, 1 Dec 2018 16:50:12 +0000 (16:50 +0000)]
Allow to create swap zone larger than v_page_count / 2.

If user configured the maxswapzone tunable, just take the literal
value for the initial zone sizing attempt.  Before, it was only
possible to reduce the zone by the tunable.

While there, correct the message which was not correct when zone
creation rounded the size up.

Reported by: jmg
Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18381

5 years agoCorrect the tunable name in the message.
kib [Sat, 1 Dec 2018 16:43:18 +0000 (16:43 +0000)]
Correct the tunable name in the message.

Submitted by:  Andre Albsmeier <mail@fbsd.e4m.org>
PR: 231577
MFC after: 1 week

5 years agoamd64: align target memmove buffer to 16 bytes before using rep movs
mjg [Sat, 1 Dec 2018 14:20:32 +0000 (14:20 +0000)]
amd64: align target memmove buffer to 16 bytes before using rep movs

See the review for sample test results.

Reviewed by: kib (kernel part)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18401

5 years agopf tests: Test name handling
kp [Sat, 1 Dec 2018 09:59:32 +0000 (09:59 +0000)]
pf tests: Test name handling

Provoke a situation where two interfaces have the same name, and verify
pf's reaction to this.

5 years agopf: Fix panic on overlapping interface names
kp [Sat, 1 Dec 2018 09:58:21 +0000 (09:58 +0000)]
pf: Fix panic on overlapping interface names

In rare situations[*] it's possible for two different interfaces to have
the same name. This confuses pf, because kifs are indexed by name (which
is assumed to be unique). As a result we can end up trying to
if_rele(NULL), which panics.

Explicitly checking the ifp pointer before if_rele() prevents the panic.
Note pf will likely behave in unexpected ways on the the overlapping
interfaces.

[*] Insert an interface in a vnet jail. Rename it to an interface which
exists on the host. Remove the jail. There are now two interfaces with
the same name in the host.

5 years agopf tests: Make pass_block:noalias more robust
kp [Sat, 1 Dec 2018 09:57:29 +0000 (09:57 +0000)]
pf tests: Make pass_block:noalias more robust

Send several ICMPv6 echo requests. We've seen occasional failures with a
single request.

5 years agoClarify that patterns are extended regular expressions in pkill(1) manual page.
ygy [Sat, 1 Dec 2018 05:58:33 +0000 (05:58 +0000)]
Clarify that patterns are extended regular expressions in pkill(1) manual page.

PR: 231060
Submitted by: naddy
MFC after: 3 days

5 years agoRemove trim(8) by multiple demands.
eugen [Sat, 1 Dec 2018 03:20:10 +0000 (03:20 +0000)]
Remove trim(8) by multiple demands.

5 years agoMaybe make gcc happy
vangyzen [Fri, 30 Nov 2018 23:47:57 +0000 (23:47 +0000)]
Maybe make gcc happy

According to Jenkins, the GCC architectures were unhappy because:

    sigaltstack.c:82: warning: missing initializer
    sigaltstack.c:82: warning: (near initialization for 'oss.ss_size')

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

5 years agoFix reporting of SS_ONSTACK
vangyzen [Fri, 30 Nov 2018 22:44:33 +0000 (22:44 +0000)]
Fix reporting of SS_ONSTACK

Fix reporting of SS_ONSTACK in nested signal delivery when sigaltstack()
is used on some architectures.

Add a unit test for this.  I tested the test by introducing the bug
on amd64.  I did not test it on other architectures.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D18347

5 years agotrim(8): serveral style fixes
eugen [Fri, 30 Nov 2018 21:57:02 +0000 (21:57 +0000)]
trim(8): serveral style fixes

Submitted by: imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18380

5 years agoamd64: handle small memmove buffers with overlapping stores
mjg [Fri, 30 Nov 2018 20:58:08 +0000 (20:58 +0000)]
amd64: handle small memmove buffers with overlapping stores

Handling sizes of > 32 backwards will be updated later.

Reviewed by: kib (kernel part)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18387

5 years agoiscsi: simplify the capsicumization
oshogbo [Fri, 30 Nov 2018 19:40:16 +0000 (19:40 +0000)]
iscsi: simplify the capsicumization

Approved by: trasz
Differential Revision: https://reviews.freebsd.org/D17962

5 years agolibcasper: do not fail if Capsicum is not avilable
oshogbo [Fri, 30 Nov 2018 19:27:14 +0000 (19:27 +0000)]
libcasper: do not fail if Capsicum is not avilable

Casper service can be also used on the kernels without Capsicum support.

Reported by: sbruno
Tested by: sbruno

5 years agoAdd missing display messages when toggling modes.
markj [Fri, 30 Nov 2018 18:02:59 +0000 (18:02 +0000)]
Add missing display messages when toggling modes.

PR: 233667
Submitted by: James Wright <james.wright@jigsawdesign.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18331

5 years agoSilence down the example builds a bit.
trasz [Fri, 30 Nov 2018 16:02:27 +0000 (16:02 +0000)]
Silence down the example builds a bit.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd an example of quick kernel rebuild.
trasz [Fri, 30 Nov 2018 16:01:43 +0000 (16:01 +0000)]
Add an example of quick kernel rebuild.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd an example of rebuilding a single piece of userspace.
trasz [Fri, 30 Nov 2018 15:56:14 +0000 (15:56 +0000)]
Add an example of rebuilding a single piece of userspace.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRevert r341337; according to imp@ we still support these.
trasz [Fri, 30 Nov 2018 15:52:03 +0000 (15:52 +0000)]
Revert r341337; according to imp@ we still support these.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoUse .Va for sysctls, not .Dv.
trasz [Fri, 30 Nov 2018 12:17:35 +0000 (12:17 +0000)]
Use .Va for sysctls, not .Dv.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoUse .Va for sysctls, not .Dv.
trasz [Fri, 30 Nov 2018 11:50:41 +0000 (11:50 +0000)]
Use .Va for sysctls, not .Dv.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRemove duplicated word.
trasz [Fri, 30 Nov 2018 11:44:43 +0000 (11:44 +0000)]
Remove duplicated word.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoSay in plain text what the 'debug' keymap action usually is.
trasz [Fri, 30 Nov 2018 11:44:16 +0000 (11:44 +0000)]
Say in plain text what the 'debug' keymap action usually is.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRemove the hint for ISA buses; we don't support them anymore.
trasz [Fri, 30 Nov 2018 11:42:19 +0000 (11:42 +0000)]
Remove the hint for ISA buses; we don't support them anymore.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoLimit option_len for the TCP_CCALGOOPT.
tuexen [Fri, 30 Nov 2018 10:50:07 +0000 (10:50 +0000)]
Limit option_len for the TCP_CCALGOOPT.

Limiting the length to 2048 bytes seems to be acceptable, since
the values used right now are using 8 bytes.

Reviewed by: glebius, bz, rrs
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D18366

5 years agoAdapt the fix in r341008 to correctly work with EBR.
ae [Fri, 30 Nov 2018 10:36:14 +0000 (10:36 +0000)]
Adapt the fix in r341008 to correctly work with EBR.

IFNET_RLOCK_NOSLEEP() is epoch_enter_preempt() in FreeBSD 12+. Holding
it in sysctl_rtsock() doesn't protect us from ifnet unlinking, because
unlinking occurs with IFNET_WLOCK(), that is rw_wlock+sx_xlock, and it
doesn check that concurrent code is running in epoch section. But while
we are in epoch section, we should be able to do access to ifnet's
fields, even it was unlinked. Thus do not change if_addr and if_hw_addr
fields in ifnet_detach_internal() to NULL, since rtsock code can do
access to these fields and this is allowed while it is running in epoch
section.

This should fix the race, when ifnet_detach_internal() unlinks ifnet
after we checked it for IFF_DYING in sysctl_dumpentry.

Move free(ifp->if_hw_addr) into ifnet_free_internal(). Also remove the
NULL check for ifp->if_description, since free(9) can correctly handle
NULL pointer.

MFC after: 1 week

5 years agoarm64: allwinner: Add 792Mhz frequency to sun50i-a64-opp
manu [Fri, 30 Nov 2018 10:31:30 +0000 (10:31 +0000)]
arm64: allwinner: Add 792Mhz frequency to sun50i-a64-opp

This is the frequency of the cpu on the Pinebook so add it to make
cpufreq find the current setting.
Note that this dtbo on the Pinebook doesn't work right now as u-boot
dtb doesn't have symbols and so it fails to apply. Linux 4.20 have
the dts and will be imported once taggued.

MFC after: 1 month
X-MFC with: r341268

5 years agoloader.efi: fix EFI getchar() for multiple consoles
tsoome [Fri, 30 Nov 2018 08:42:14 +0000 (08:42 +0000)]
loader.efi: fix EFI getchar() for multiple consoles

This fix is ported from illumos (issue #9970), the analysis and initial
implementation was done by John Levon.

See also: https://www.illumos.org/issues/9970

Currently, efi_cons_getchar() will wait for a key. While this seems to make
sense, the implementation of getchar() in common/console.c will loop across
getchar() for all consoles without doing ischar() first.

This means that if we've configured multiple consoles, we can't input into
the serial, as getchar() will be sat waiting for input only from efi_console.c

This patch does implement a bit more generic key buffer to support
translation of input keys, and we use generic efi_readkey() to reduce
duplication from calls from getchar() and poll().

5 years agoloader: create separate lists for fd, cd and hd, merge bioscd with biosdisk
tsoome [Fri, 30 Nov 2018 08:01:11 +0000 (08:01 +0000)]
loader: create separate lists for fd, cd and hd, merge bioscd with biosdisk

Create unified block IO implementation in BIOS version, like it is done in UEFI
side. Implement fd, disk and cd device lists, this will split floppy devices
from disks and will allow us to have consistent, predictable device naming
(modulo BIOS issues).

Differential Revision: https://reviews.freebsd.org/D17888

5 years agosfxge(4): rollback last seen VLAN TCI if Tx packet is dropped
arybchik [Fri, 30 Nov 2018 07:11:05 +0000 (07:11 +0000)]
sfxge(4): rollback last seen VLAN TCI if Tx packet is dropped

Early processing of a packet on transmit may change last seen
VLAN TCI in the queue context. If such a packet is eventually
dropped, last seen VLAN TCI must be set to its previous value.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18288

5 years agosfxge(4): ensure EvQ poll stops when abort is requested
arybchik [Fri, 30 Nov 2018 07:10:54 +0000 (07:10 +0000)]
sfxge(4): ensure EvQ poll stops when abort is requested

If an event handler requested an abort, only the inner loop was
guarenteed to be broken out of - the outer loop could continue
if total == batch.

Fix this by poisoning batch to ensure it is different to total.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18287

5 years agosfxge(4): support Medford2
arybchik [Fri, 30 Nov 2018 07:10:43 +0000 (07:10 +0000)]
sfxge(4): support Medford2

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18286

5 years agosfxge(4): update external port number calculation
arybchik [Fri, 30 Nov 2018 07:10:32 +0000 (07:10 +0000)]
sfxge(4): update external port number calculation

Revise the external port calculation to support all
X2 port modes. The previous algorithm could not
handle different port numbering schemes on each cage.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18285

5 years agosfxge(4): correct annotations where NULL input is OK
arybchik [Fri, 30 Nov 2018 07:10:20 +0000 (07:10 +0000)]
sfxge(4): correct annotations where NULL input is OK

Correct annotations where NULL input can be permitted

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18284

5 years agosfxge(4): support new link modes in the driver
arybchik [Fri, 30 Nov 2018 07:10:09 +0000 (07:10 +0000)]
sfxge(4): support new link modes in the driver

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18283

5 years agosfxge(4): use transceiver ID when reading info
arybchik [Fri, 30 Nov 2018 07:09:58 +0000 (07:09 +0000)]
sfxge(4): use transceiver ID when reading info

In efx_mcdi_phy_module_get_info() probe the
transceiver identification byte rather than assume
the module matches the fixed port type.  This
supports scenarios such as a SFP mounted in a QSFP
port via a QSA module.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18282

5 years agosfxge(4): add accessor to whole link status
arybchik [Fri, 30 Nov 2018 07:09:46 +0000 (07:09 +0000)]
sfxge(4): add accessor to whole link status

Add a function which makes an MCDI GET_LINK request and
packages up the results. Currently, the get-link function
is triggered from several entry points which then pass
on or store selected parts of the data. When the driver
needs to obtain the current link state, it is more
efficient to do this in a single call.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18281

5 years agosfxge(4): guard Rx scale code with corresponding option
arybchik [Fri, 30 Nov 2018 07:09:34 +0000 (07:09 +0000)]
sfxge(4): guard Rx scale code with corresponding option

Previously only some of the code was guarded by this which caused
a build error when EFSYS_OPT_RX_SCALE is 0 (e.g. in manftest).

Submitted by:   Tom Millington <tmillington at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18280

5 years agosfxge(4): infer port mode bandwidth from max link speed
arybchik [Fri, 30 Nov 2018 07:09:23 +0000 (07:09 +0000)]
sfxge(4): infer port mode bandwidth from max link speed

Limit the port mode bandwidth calculations by the maximum
reported link speed. This system detects 25G vs 10G cards,
and 100G port modes vs 40G.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18279

5 years agosfxge(4): support improvements to bandwidth calculations
arybchik [Fri, 30 Nov 2018 07:09:11 +0000 (07:09 +0000)]
sfxge(4): support improvements to bandwidth calculations

Change the interface to ef10_nic_get_port_mode_bandwidth()
so more NIC information can be used to infer bandwidth
requirements. Huntington calculations separated out
completely.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18278

5 years agosfxge(4): add X2 port modes to bandwidth calculator
arybchik [Fri, 30 Nov 2018 07:09:00 +0000 (07:09 +0000)]
sfxge(4): add X2 port modes to bandwidth calculator

Add cases for the new port modes supported by X2 NICs.
Lane bandwidth is calculated for pre-X2 cards so is an
underestimate for X2 in 25G/100G modes.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18277

5 years agosfxge(4): update to current port mode terminology
arybchik [Fri, 30 Nov 2018 07:08:50 +0000 (07:08 +0000)]
sfxge(4): update to current port mode terminology

>From Medford onwards, the newer constants enumerating
port modes should be used.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18276

5 years agosfxge(4): adjust PHY module info interface
arybchik [Fri, 30 Nov 2018 07:08:38 +0000 (07:08 +0000)]
sfxge(4): adjust PHY module info interface

Adjust data types in interface to permit the complete
module information buffer to be obtained in a single
call.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18275

5 years agosfxge(4): expose PHY module device address constants
arybchik [Fri, 30 Nov 2018 07:08:27 +0000 (07:08 +0000)]
sfxge(4): expose PHY module device address constants

Rearrange so the valid addresses are visible to the caller.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18274

5 years agosfxge(4): make last byte of module information available
arybchik [Fri, 30 Nov 2018 07:08:16 +0000 (07:08 +0000)]
sfxge(4): make last byte of module information available

Adjust bounds so the interface supports reading
the last available byte of data.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18273

5 years agosfxge(4): add helper API to make Geneve filter spec
arybchik [Fri, 30 Nov 2018 07:08:05 +0000 (07:08 +0000)]
sfxge(4): add helper API to make Geneve filter spec

Submitted by:   Vijay Srivastava <vijays at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18272

5 years agosfxge(4): fix MAC Tx stats for less or equal to 64 bytes
arybchik [Fri, 30 Nov 2018 07:07:54 +0000 (07:07 +0000)]
sfxge(4): fix MAC Tx stats for less or equal to 64 bytes

This statistic should include 64byte and smaller frames.
Fix EF10 calculation to match Siena code.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18271

5 years agosfxge(4): modify phy caps to indicate FEC request
arybchik [Fri, 30 Nov 2018 07:07:43 +0000 (07:07 +0000)]
sfxge(4): modify phy caps to indicate FEC request

The capability bits to request FEC modes are implicitly valid
when the corresponding FEC mode is a supported capability.
Drivers expect that it is only valid to advertise those
capabilities explicitly marked as supported. The capabilities
reported by firmware is modified with the implicit capabilities
to present the explicit model to drivers.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18270

5 years agosfxge(4): improve handling of legacy RSS hash flags
arybchik [Fri, 30 Nov 2018 07:07:31 +0000 (07:07 +0000)]
sfxge(4): improve handling of legacy RSS hash flags

Client drivers may use either legacy flags, for example,
EFX_RX_HASH_TCPIPV4, or generalised flags, for example,
EFX_RX_HASH(IPV4_TCP, 4TUPLE), to configure RSS hash.
The libefx is able to recognise what scheme is used.

Legacy flags may be consumed directly by a chip-specific handler to
configure the NIC, that is, on EF10, these flags can be used to fill
in legacy RSS mode field in MCDI request. Generalised flags can also
be directly used in EF10-specific handler as they are fully compatible
with additional fields of the same MCDI request.

Legacy flags undergo conversion to generalised flags before they
are consumed by a chip-specific handler. This conversion is used to
make sure that chip-specific handlers expect only generalised flags
in the input for the sake of clarity of the code.

Depending on firmware capabilities, a chip-specififc handler either
supplies the input to the NIC directly, for example,
EFX_RX_HASH(IPV4_TCP, 4TUPLE) flag will enable 4 bits in
RSS_CONTEXT_SET_FLAGS_IN_TCP_IPV4_RSS_MODE field on EF10, or takes
the opportunity to translate the input to enable bits which don't map
to the generic flag, like setting
RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_TCPV4_EN on EF10 when the firmware
claims no support for additional modes.

However, this approach has introduced a severe problem which can be
reproduced with ultra-low-latency firmware variant. In order to enable
IP hash, EF10-specific handler requires the user to request 2-tuple
hash for IP-other, TCP and UDP traffic classes, unconditionally.
In example, IPv4 hash can be enabled using the following input:
EFX_RX_HASH(IPV4_TCP, 2TUPLE) | EFX_RX_HASH(IPV4_UDP, 2TUPLE) |
EFX_RX_HASH(IPV4, 2TUPLE).
At the same time, on ultra-low-latency firmware, the common code will
never report support for any UDP tuple to the client driver. That is,
in the same example, the driver will use EFX_RX_HASH(IPV4_TCP, 2TUPLE) |
EFX_RX_HASH(IPV4, 2TUPLE). This input will not be recognised by
EF10-specific handler, and RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_IPV4_EN
bit will not be set in the MCDI request.

In order to solve the problem, the patch removes conversion code
from chip-specific handlers and adds appropriate code to convert
EFX_RX_HASH() flags to their legacy counterparts to the common scale
mode set function. If the firmware does not support additional modes,
the function will convert generalised flags to legacy flags correctly
without any demand for UDP flags and pass the result to a chip-specific
handler.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18269

5 years agosfxge(4): simplify the code to parse RSS hash type
arybchik [Fri, 30 Nov 2018 07:07:20 +0000 (07:07 +0000)]
sfxge(4): simplify the code to parse RSS hash type

RSS mode bits can be accessed a lot easier in the hash
type value provided that the variable type is uint32_t.
The macro helper can be removed to enhance readability.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18268

5 years agosfxge(4): check buffer size for hash flags
arybchik [Fri, 30 Nov 2018 07:07:09 +0000 (07:07 +0000)]
sfxge(4): check buffer size for hash flags

The efx_rx_scale_hash_flags_get interface is unsafe, as it does not
have an argument for the size of the output buffer used to return
the flags. While the only caller currently supplies a sufficiently
large buffer, this should be checked at runtime to avoid writing
past the end of the buffer.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18267

5 years agosfxge(4): use simpler code to check hash algorithm type
arybchik [Fri, 30 Nov 2018 07:06:58 +0000 (07:06 +0000)]
sfxge(4): use simpler code to check hash algorithm type

The API which is used to list supported hash flags verifies
hash algorithm choice before writing the output. This check
is based on a switch() statement which has only two options
and no distinctive actions to be conducted for each of them.
Use simpler code instead of switch() to improve readability.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18266

5 years agosfxge(4): add support to get active FEC type
arybchik [Fri, 30 Nov 2018 07:06:46 +0000 (07:06 +0000)]
sfxge(4): add support to get active FEC type

Submitted by:   Vijay Srivastava <vijays at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18265

5 years agosfxge(4): fix a typo in unicast filter insertion comment
arybchik [Fri, 30 Nov 2018 07:06:35 +0000 (07:06 +0000)]
sfxge(4): fix a typo in unicast filter insertion comment

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18264

5 years agosfxge(4): prevent access to the NIC config before probe
arybchik [Fri, 30 Nov 2018 07:06:24 +0000 (07:06 +0000)]
sfxge(4): prevent access to the NIC config before probe

NIC config is initialized during NIC probe.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18263

5 years agosfxge(4): fix ID retrieval in v3 licensing
arybchik [Fri, 30 Nov 2018 07:06:13 +0000 (07:06 +0000)]
sfxge(4): fix ID retrieval in v3 licensing

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18262

5 years agosfxge(4): add API to inform libefx of hardware removal
arybchik [Fri, 30 Nov 2018 07:06:01 +0000 (07:06 +0000)]
sfxge(4): add API to inform libefx of hardware removal

The efx_nic_hw_unavailable() checks ensure that if the NIC hardware
has failed or has been physically removed then libefx will stop
further attempts to access the hardware.

Add an interface for libefx clients to force unavailability, so the
hardware is treated as dead or removed even if still physically present.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18261

5 years agosfxge(4): add routine to check for hardware presence
arybchik [Fri, 30 Nov 2018 07:05:49 +0000 (07:05 +0000)]
sfxge(4): add routine to check for hardware presence

Add efx_nic_hw_unavailable() routine to check for hardware presence
before continuing with NIC operations.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18260

5 years agosfxge(4): fix out of bounds read when dereferencing sdup
arybchik [Fri, 30 Nov 2018 07:05:36 +0000 (07:05 +0000)]
sfxge(4): fix out of bounds read when dereferencing sdup

Introduce and use macro to make sure that MCDI buffers allocated
on stack are rounded up properly.

Submitted by:   Gautam Dawar <gdawar at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18259

5 years agosfxge(4): add information if TSO workaround is required
arybchik [Fri, 30 Nov 2018 07:05:23 +0000 (07:05 +0000)]
sfxge(4): add information if TSO workaround is required

In SF bug 61297 it's been confirmed that the hardware does not always
calculate the TCP checksum correctly with TSO sends.

The value of the Total Length field (IPv4) or Payload Length field
(IPv6) is the critical factor. We're sufficiently confident that if
these fields are zero then the checksum will be calculated correctly.

The information may be used by the drivers to check if the workaround is
required when FATSOv2 is implemented.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18258

5 years agosfxge(4): avoid usage of too big arrays on stack
arybchik [Fri, 30 Nov 2018 07:05:12 +0000 (07:05 +0000)]
sfxge(4): avoid usage of too big arrays on stack

Found by PreFAST static analysis.

Submitted by:   Martin Harvey <mharvey at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18257

5 years agosfxge(4): generalise EF10 NVRAM buffer interface
arybchik [Fri, 30 Nov 2018 07:05:00 +0000 (07:05 +0000)]
sfxge(4): generalise EF10 NVRAM buffer interface

The SFN driver's PartitionControl WMI object requires an API to parse
and filter partition data in TLV format, particularly for the Dynamic
Config partition. The ef10_nvram_buffer functions provide this
functionality but are tied to use with license partition only.
Modify functions so they are applicable to all TLV partitions and add
functions to support in-place tag modification.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18256

5 years agosfxge(4): add accessor for default port mode
arybchik [Fri, 30 Nov 2018 07:04:48 +0000 (07:04 +0000)]
sfxge(4): add accessor for default port mode

Extend efx_mcdi_get_port_modes() to optionally pass on the default
port mode field. This provides a more direct way of handling the case
where the dynamic config does not specify the port mode than the
alternative of a lookup table indexed by MCFW subtype.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18255

5 years agosfxge(4): add buffer editing functions to boot config
arybchik [Fri, 30 Nov 2018 07:04:37 +0000 (07:04 +0000)]
sfxge(4): add buffer editing functions to boot config

Functions to process the DHCP option list format used by the expansion
ROM config buffers, to support extracting and updating of individual
options.
The initial use case is the driver presenting the global and per-PF
options as separate items, with the driver implementing the
synchronization of global options across the configuration buffers
for all PFs.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18254

5 years agosfxge(4): add API to retrieve sensor limits
arybchik [Fri, 30 Nov 2018 07:04:25 +0000 (07:04 +0000)]
sfxge(4): add API to retrieve sensor limits

Submitted by:   Martin Harvey <mharvey at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18253

5 years agosfxge(4): check size of memory to read sensors data to
arybchik [Fri, 30 Nov 2018 07:04:13 +0000 (07:04 +0000)]
sfxge(4): check size of memory to read sensors data to

Size of provided memory should be consistent with specified size.

Submitted by:   Martin Harvey <mharvey at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18252

5 years agosfxge(4): add generated description of sensors
arybchik [Fri, 30 Nov 2018 05:54:30 +0000 (05:54 +0000)]
sfxge(4): add generated description of sensors

Description of sensors is generated from firmware sources.

Submitted by:   Martin Harvey <mharvey at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18251

5 years agosfxge(4): remove probes when a Tx queue is too full
arybchik [Fri, 30 Nov 2018 05:54:19 +0000 (05:54 +0000)]
sfxge(4): remove probes when a Tx queue is too full

No need for probe messages when a TxQ is too full for a post to be done.

Existing drivers check if there is room in the queue before posting
descriptors, even though efx_tx_qdesc_post() does the check itself.

The new SFN Windows driver doesn't perform the check before calling
efx_tx_qdesc_post(), but that means these probes can get frequently
printed out. It's normal driver behaviour so there's no need to print
an error.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18250

5 years agosfxge(4): refactor monitors support
arybchik [Fri, 30 Nov 2018 05:54:07 +0000 (05:54 +0000)]
sfxge(4): refactor monitors support

Remove obsolete monitor types since Falcon SFN4000 series adapters
no longer supported by libefx.
Rename MCDI monitors to be consistent with YML.
The code may be simplified and generalized since only MCDI monitors
remain.

Submitted by:   Martin Harvey <mharvey at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18249

5 years agosfxge(4): move empty efsys definitions to EFX headers
arybchik [Fri, 30 Nov 2018 05:50:01 +0000 (05:50 +0000)]
sfxge(4): move empty efsys definitions to EFX headers

Move empty definitions for platform-specific annotations from efsys.h
to EFX headers.

Submitted by:   Martin Harvey <mharvey at solarflare.com>
Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18248

5 years agoInclude path for tmpfs objects in vm.objects sysctl
vangyzen [Fri, 30 Nov 2018 04:59:43 +0000 (04:59 +0000)]
Include path for tmpfs objects in vm.objects sysctl

This applies the fix in r283924 to the vm.objects sysctl
added by r283624 so the output will include the vnode
information (i.e. path) for tmpfs objects.

Reviewed by: kib, dab
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D2724

5 years agoAdd assertions and comment to vm_object_vnode()
vangyzen [Fri, 30 Nov 2018 04:18:31 +0000 (04:18 +0000)]
Add assertions and comment to vm_object_vnode()

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D2724