Commit Graph

125099 Commits

Author SHA1 Message Date
Justin Hibbits
bfed756af6 Sprinkle EARLY_DRIVER_MODULE around the tree
Mark some buses as BUS_PASS_BUS, and some resources as BUS_PASS_RESOURCE.
This also decouples some resource attachment orderings from being races by
device tree ordering, instead relying on the bus pass to provide the
ordering.

This was originally intended to support multipass suspend/resume, but it's
also needed on PowerMacs when using fdt, as the device tree seems to get
created in reverse of the OFW tree.
Reviewed by:	nwhitehorn (long ago)
Differential Revision:	https://reviews.freebsd.org/D918
2018-12-04 04:55:49 +00:00
Justin Hibbits
f1e0cb5ef1 powerpc: preload_addr_relocate is no longer necessary for booke
The same behavior was moved to machdep.c, paired with AIM's relocation,
making this redundant.  With this, it's now possible to boot FreeBSD with
ubldr on a uboot Book-E platform, even with a
KERNBASE != VM_MIN_KERNEL_ADDRESS.
2018-12-04 03:51:10 +00:00
Brooks Davis
3a325dec32 Remove a needlessly clever hack to start init with sys_exec().
Construct a struct image_args with the help of new exec_args_*() helper
functions and call kern_execve().

The previous code mapped a page in userspace, copied arguments out
to it one at a time, and then constructed a struct execve_args all so
that sys_execve() can call exec_copyin_args() to copy the data back in
to a struct image_args.

Opencode the part of pre_execve()/post_execve() that releases a
reference to the initial vmspace. We don't need to stop threads like
they do.

Reviewed by:	kib, jhb (prior version)
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D15469
2018-12-04 00:15:47 +00:00
Konstantin Belousov
f186340011 Improve procstat reporting for the linux cdev file descriptors.
If there is a vnode attached to the linux file, use it to fill
kinfo_file.  Otherwise, report a new KF_TYPE_DEV file type, without
supplying any type-specific information.

KF_TYPE_DEV is supposed to be used by most devfs-specific file types.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2018-12-03 23:39:45 +00:00
Mark Johnston
02164d3603 Add a missing definition for the !COMPAT_FREEBSD32 case.
Reported by:	jenkins
MFC with:	r341442
Sponsored by:	The FreeBSD Foundation
2018-12-03 21:07:10 +00:00
Mark Johnston
352aaa5122 Plug memory disclosures via ptrace(2).
On some architectures, the structures returned by PT_GET*REGS were not
fully populated and could contain uninitialized stack memory.  The same
issue existed with the register files in procfs.

Reported by:	Thomas Barabosch, Fraunhofer FKIE
Reviewed by:	kib
MFC after:	3 days
Security:	kernel stack memory disclosure
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18421
2018-12-03 20:54:17 +00:00
Toomas Soome
7aaf685ba7 zfs: we can boot from dataset with large_dnode enabled
loader has been supporting large_dnode for some time, no need to block the
feature for boot dataset.

Reviewed by:	avg
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D18391
2018-12-03 19:35:21 +00:00
Justin Hibbits
f095905ca4 powerpc: Check for a fdt in the metadata if it doesn't already exist
It's possible the fdt pointer was passed in via the metadata, as is done in
ubldr.  Check for the fdt here, instead of working with a NULL fdt, and
panicking.
2018-12-03 04:56:06 +00:00
Justin Hibbits
3c0b081966 powerpc/booke: Check for the metadata address by physical address
The metadata pointer will almost never be at or above 'btext', as btext is a
relocated symbol, so will be based at VM_MIN_KERNEL_ADDRESS, not at
KERNBASE.  Check the address against kernload, where the kernel is
physically loaded.
2018-12-03 04:47:28 +00:00
Oleksandr Tymoshenko
440e13cf1e 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
2018-12-02 21:58:36 +00:00
Andreas Tobler
905bbe376c Build the dtb for the rock64 board.
Reviewed by:	manu@
2018-12-02 19:36:20 +00:00
Andreas Tobler
4df1cc71fd Add rule to build the dtb for the rock64 board.
Reviewed by:	manu@
2018-12-02 19:35:22 +00:00
Konstantin Belousov
b8c20c02cc 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
2018-12-02 18:30:58 +00:00
Konstantin Belousov
d77e8982ab 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
2018-12-02 13:29:13 +00:00
Konstantin Belousov
83fb1d62ca 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
2018-12-02 13:27:36 +00:00
Konstantin Belousov
10d9120c44 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
2018-12-02 13:16:46 +00:00
Konstantin Belousov
200bf72793 Correct accuracy of the barrier writes accounting.
Discussed with:	mckusick
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-12-02 12:53:39 +00:00
Michal Meloun
f788dba5bb Return computed real memory size, not a value from similarly named
global variable.

MFC after:	1 week
2018-12-02 07:39:16 +00:00
Conrad Meyer
d86e0b338f 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
2018-12-01 21:37:47 +00:00
Conrad Meyer
23459e135d Restore build of the kernel, removed through r341377
Turns out we already had a path_mtu_discovery variable.

X-MFC-with:	r341377
2018-12-01 21:28:05 +00:00
Emmanuel Vadot
04f9b8a116 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
2018-12-01 20:31:49 +00:00
Emmanuel Vadot
affb46a826 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
2018-12-01 20:31:05 +00:00
Cy Schubert
a23b6c018b 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
2018-12-01 20:30:18 +00:00
Emmanuel Vadot
1d47648a76 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
2018-12-01 20:29:42 +00:00
Emmanuel Vadot
36ae7efe61 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
2018-12-01 20:28:16 +00:00
Emmanuel Vadot
c3aec23870 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
2018-12-01 20:26:59 +00:00
Cy Schubert
8a50297550 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
2018-12-01 17:59:41 +00:00
Konstantin Belousov
a823302783 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
2018-12-01 16:50:12 +00:00
Konstantin Belousov
36e1b9702e Correct the tunable name in the message.
Submitted by:	 Andre Albsmeier <mail@fbsd.e4m.org>
PR:	231577
MFC after:	1 week
2018-12-01 16:43:18 +00:00
Mateusz Guzik
ddf6571230 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
2018-12-01 14:20:32 +00:00
Kristof Provost
b2e0b24f76 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.
2018-12-01 09:58:21 +00:00
Eric van Gyzen
984969cd96 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
2018-11-30 22:44:33 +00:00
Mateusz Guzik
94243af2da 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
2018-11-30 20:58:08 +00:00
Michael Tuexen
c8b53ced95 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
2018-11-30 10:50:07 +00:00
Andrey V. Elsukov
851073551d 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
2018-11-30 10:36:14 +00:00
Emmanuel Vadot
fc6ebb297b 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
2018-11-30 10:31:30 +00:00
Andrew Rybchenko
ad72d03040 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
2018-11-30 07:11:05 +00:00
Andrew Rybchenko
b162acfe52 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
2018-11-30 07:10:54 +00:00
Andrew Rybchenko
c6831b0bcb sfxge(4): support Medford2
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18286
2018-11-30 07:10:43 +00:00
Andrew Rybchenko
f0a2945d38 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
2018-11-30 07:10:32 +00:00
Andrew Rybchenko
d707fb201e 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
2018-11-30 07:10:20 +00:00
Andrew Rybchenko
405f7a36fe 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
2018-11-30 07:10:09 +00:00
Andrew Rybchenko
f0095e1f86 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
2018-11-30 07:09:58 +00:00
Andrew Rybchenko
cf94ca3704 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
2018-11-30 07:09:46 +00:00
Andrew Rybchenko
5a51b32e4c 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
2018-11-30 07:09:34 +00:00
Andrew Rybchenko
109f5727a0 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
2018-11-30 07:09:23 +00:00
Andrew Rybchenko
c42b6a3560 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
2018-11-30 07:09:11 +00:00
Andrew Rybchenko
7e370b0ea7 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
2018-11-30 07:09:00 +00:00
Andrew Rybchenko
e12a751b0d 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
2018-11-30 07:08:50 +00:00
Andrew Rybchenko
3c3b954225 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
2018-11-30 07:08:38 +00:00
Andrew Rybchenko
0bc522c2d6 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
2018-11-30 07:08:27 +00:00
Andrew Rybchenko
a10539aa18 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
2018-11-30 07:08:16 +00:00
Andrew Rybchenko
1ad53cbf7e 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
2018-11-30 07:08:05 +00:00
Andrew Rybchenko
fe094a7cbc 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
2018-11-30 07:07:54 +00:00
Andrew Rybchenko
3f3f5d85c5 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
2018-11-30 07:07:43 +00:00
Andrew Rybchenko
6ddb48de77 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
2018-11-30 07:07:31 +00:00
Andrew Rybchenko
d085cfff22 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
2018-11-30 07:07:20 +00:00
Andrew Rybchenko
94a7dab5bf 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
2018-11-30 07:07:09 +00:00
Andrew Rybchenko
bd1be89ebe 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
2018-11-30 07:06:58 +00:00
Andrew Rybchenko
a8c1489fbb 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
2018-11-30 07:06:46 +00:00
Andrew Rybchenko
5c6609f6f4 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
2018-11-30 07:06:35 +00:00
Andrew Rybchenko
aea82ebf8a 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
2018-11-30 07:06:24 +00:00
Andrew Rybchenko
39e58a98ba 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
2018-11-30 07:06:13 +00:00
Andrew Rybchenko
b2053d8025 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
2018-11-30 07:06:01 +00:00
Andrew Rybchenko
c6d5e85dbe 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
2018-11-30 07:05:49 +00:00
Andrew Rybchenko
315bbbaa7c 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
2018-11-30 07:05:36 +00:00
Andrew Rybchenko
5037810f7e 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
2018-11-30 07:05:23 +00:00
Andrew Rybchenko
6b231fec92 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
2018-11-30 07:05:12 +00:00
Andrew Rybchenko
e919b7ec20 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
2018-11-30 07:05:00 +00:00
Andrew Rybchenko
cd5e337110 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
2018-11-30 07:04:48 +00:00
Andrew Rybchenko
d86bef48a5 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
2018-11-30 07:04:37 +00:00
Andrew Rybchenko
b4d3f02ea2 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
2018-11-30 07:04:25 +00:00
Andrew Rybchenko
9d3487a623 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
2018-11-30 07:04:13 +00:00
Andrew Rybchenko
d515a203d8 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
2018-11-30 05:54:30 +00:00
Andrew Rybchenko
4c7d5ddbe4 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
2018-11-30 05:54:19 +00:00
Andrew Rybchenko
21b72677d9 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
2018-11-30 05:54:07 +00:00
Andrew Rybchenko
383a1cce7a 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
2018-11-30 05:50:01 +00:00
Eric van Gyzen
5e38e3f5eb 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
2018-11-30 04:59:43 +00:00
Eric van Gyzen
0951bd362c 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
2018-11-30 04:18:31 +00:00
Cy Schubert
a85c2efc11 Clean up a rather useless conditional structure member definition.
MFC after:	1 week
2018-11-30 04:15:56 +00:00
Cy Schubert
a9af9f073c Clean up a redundant non-redefinition of IFNAMSIZ. IFNAMSIZ
is defined in net/if.h, therefore the condition is never met and
confusing to those who follow.

MFC after:	1 month
2018-11-30 04:15:42 +00:00
Mateusz Guzik
2847cfce54 amd64: remove stale attribution for memmove work
While the routine started as expanded bcopy, it is now entirely rewritten.

Sponsored by:	The FreeBSD Foundation
2018-11-30 00:47:36 +00:00
Mateusz Guzik
dd219e5ea5 amd64: tidy up copying backwards in memmove
For non-ERMS case the code used handle possible trailing bytes with
movsb first and then followed it up with movsq. This also happened
to alter how calculations were done for other cases.

Handle the tail with regular movs, just like when copying forward.
Use leaq to calculate the right offset from the get go, instead of
doing separate add and sub.

This adjusts the offset for non-rep cases so that they can be used
to handle the tail.

The routine is still a work in progress.

Sponsored by:	The FreeBSD Foundation
2018-11-30 00:45:10 +00:00
John Baldwin
31562c4440 Make most of the CLIP code conditional on #ifdef INET6.
This fixes builds of kernels without INET6 such as LINT-NOINET6.

Reported by:	arybchik
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D18384
2018-11-29 23:14:54 +00:00
Emmanuel Vadot
a69c1d42cc arm64: allwinner: Add a dtbo to have cpu operating points
This enables cpufreq on A64 boards.

MFC after:	1 month
2018-11-29 22:35:23 +00:00
Cy Schubert
f0fea829d0 Remove an old comment/code and replace with a comment that
directly references a NetBSD commit.

MFC after:	1 week
2018-11-29 21:20:53 +00:00
Brooks Davis
f373437a01 Add helper functions to copy strings into struct image_args.
Given a zeroed struct image_args with an allocated buf member,
exec_args_add_fname() must be called to install a file name (or NULL).
Then zero or more calls to exec_args_add_env() followed by zero or
more calls to exec_args_add_env(). exec_args_adjust_args() may be
called after args and/or env to allow an interpreter to be prepended to
the argument list.

To allow code reuse when adding arg and env variables, begin_envv
should be accessed with the accessor exec_args_get_begin_envv()
which handles the case when no environment entries have been added.

Use these functions to simplify exec_copyin_args() and
freebsd32_exec_copyin_args().

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D15468
2018-11-29 21:00:56 +00:00
Konstantin Belousov
7d2b0bd7d7 If BENEATH is specified, always latch the topping directory vnode.
It is possible that we started with a relative path but during the
lookup, found an absolute symlink.  In this case, BENEATH handling
code needs the latch, but it is too late to calculate it.

While there, somewhat improve the assertions.  Clear the NI_LCF_LATCH
flag when the latch vnode is released, so that asserts know the state.
Assert that there is a latch if we entered beneath+abs path mode,
after the starting point is processed.

Reported by:	wulf
With more input from:	pho
Sponsored by:	The FreeBSD Foundation
2018-11-29 19:13:10 +00:00
Emmanuel Vadot
fc06a872ec arm64: rockchip: armclk: Do not change parent freq if CLK_SET_DRYRUN is set
MFC after:	3 days
2018-11-29 19:11:35 +00:00
Emmanuel Vadot
baec4d5985 extres: clk: Fix clk_set_assigned
ofw_bus_parse_xref_list_get_length doesn't returns the number of elements, fix this.
While here when setting the clock to the assigned freqeuncy, allow the clock
driver to round down or up the frequency as sometimes the exact frequency cannot
be obtain.
2018-11-29 19:06:05 +00:00
Mark Johnston
e31fc3ab13 Update the free page count when blacklisting pages.
Otherwise the free page count will not accurately reflect the physical
page allocator's state.  On 11 this can trigger panics in
vm_page_alloc() since the allocator state and free page count are
updated atomically and we expect them to stay in sync.  On 12 the
bug would manifest as threads looping in vm_page_alloc().

PR:		231296
Reported by:	mav, wollman, Rainer Duffner, Josh Gitlin
Reviewed by:	alc, kib, mav
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18374
2018-11-29 16:31:01 +00:00
Mateusz Guzik
1f6ad48c76 vfs: fix i386 build after r341220 2018-11-29 09:54:27 +00:00
Mateusz Guzik
22443809ff cache: retire cache_enter compat schim
It was added over 6 years ago for binary compat. cache_enter macro remains
as it expands to cache_enter_time.

Sponsored by:	The FreeBSD Foundation
2018-11-29 09:32:59 +00:00
Mateusz Guzik
c0282e1e07 audit: predict AUDITING_TD as false
By default it is compiled in and disabled.

Sponsored by:	The FreeBSD Foundation
2018-11-29 09:19:48 +00:00
Mateusz Guzik
712775843f vfs: drop spurious memcpy in stat
Sponsored by:	The FreeBSD Foundation
2018-11-29 09:04:10 +00:00
Mateusz Guzik
d47f3fdb0a fd: unify fd range check across the routines
While here annotate out of range as unlikely.

Sponsored by:	The FreeBSD Foundation
2018-11-29 08:53:39 +00:00
Mateusz Guzik
159dcc30a5 audit: change audit_syscalls_enabled type to bool
So that it fits better in __read_frequently.

Sponsored by:	The FreeBSD Foundation
2018-11-29 08:37:33 +00:00
Andrew Rybchenko
e9bc5a34f4 sfxge(4): add more definitions of partitions
Add definitions of dynamic config and expansion ROM backup
partitions.

Submitted by:   Paul Fox <pfox at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18247
2018-11-29 06:47:41 +00:00
Andrew Rybchenko
b288270efc sfxge(4): fix build because of no declaration
Functions declared in mcdi_mon.h are implemented in mcdi_mon.c.
The build fails if compiler options require declaration before definition.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18246
2018-11-29 06:47:30 +00:00
Andrew Rybchenko
dbcc3c8f70 sfxge(4): fix SAL annotation for input buffers
Submitted by:   Martin Harvey <mharvey at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18245
2018-11-29 06:47:19 +00:00
Andrew Rybchenko
e4ddd4ccb3 sfxge(4): fix PreFAST warnings because of unused return
Submitted by:   Martin Harvey <mharvey at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18244
2018-11-29 06:47:06 +00:00
Andrew Rybchenko
aea9d093f2 sfxge(4): add Medford2 head-of-line blocking stats
These stats are availble on Medford2 DPDK firmware variant
which support equal stride super-buffer Rx mode. RXDP_HLB_IDLE
capability bit is set when the stats are available.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18243
2018-11-29 06:46:55 +00:00
Andrew Rybchenko
ef8967c7d2 sfxge(4): support RxDP scatter disabled truncate counter
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18242
2018-11-29 06:46:44 +00:00
Andrew Rybchenko
c27e7228d5 sfxge(4): generate Medford2 RxDP stats
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18241
2018-11-29 06:46:33 +00:00
Andrew Rybchenko
5c2f9d6a49 sfxge(4): get max supported value for action MARK
The mark value for MATCH_ACTION_MARK has a maximum value.
Requesting a value larger than the maximum will cause the
filter insertion to fail with EINVAL. This patch allows the
driver to check the value at the filter validation.

Submitted by:   Roman Zhukov <roman.zhukov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18240
2018-11-29 06:46:21 +00:00
Andrew Rybchenko
fc9798c79a sfxge(4): support MARK and FLAG actions in filters
This patch adds support for DPDK rte_flow "MARK" and "FLAG" filter
actions to filters on EF10 family NICs.

Submitted by:   Roman Zhukov <roman.zhukov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18239
2018-11-29 06:46:10 +00:00
Andrew Rybchenko
6e1ebbe9e2 sfxge(4): get actions MARK and FLAG support
Filter actions MARK and FLAG are supported on Medford2 by DPDK
firmware variant.

Submitted by:   Roman Zhukov <roman.zhukov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18238
2018-11-29 06:46:01 +00:00
Andrew Rybchenko
d222b61743 sfxge(4): add equal stride super-buffer prefix layout
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18237
2018-11-29 06:45:50 +00:00
Andrew Rybchenko
04381b5e29 sfxge(4): support equal stride super-buffer Rx mode
Equal stride super-buffer Rx mode is supported by DPDK firmware
variant. One Rx descriptor provides many Rx buffers to firmware.
Rx buffers follow each other with specified stride.
Also it supports head of line blocking with timeout to address
drops when no Rx descriptors are available. So it gives extra time
to the driver to provide Rx descriptors before drop.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18236
2018-11-29 06:45:38 +00:00
Andrew Rybchenko
ceeff9b1a1 sfxge(4): detect equal stride super-buffer support
Equal stride super-buffer Rx mode is supported on Medford2 by
DPDK firmware variant.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18235
2018-11-29 06:45:26 +00:00
Andrew Rybchenko
2a726a7f94 sfxge(4): make RxQ type data an union
The type is an internal interface. Single integer is insufficient
to carry RxQ type-specific information in the case of equal stride
super-buffer Rx mode (packet buffers per bucket, maximum DMA length,
packet stride, head of line block timeout).

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18234
2018-11-29 06:45:15 +00:00
Andrew Rybchenko
aed78107bb sfxge(4): update autogenerated MCDI and TLV headers
Equal stride super-buffer is a new name instead of deprecated equal
stride packed stream to avoid confusion with previous packed stream.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18233
2018-11-29 06:45:04 +00:00
Andrew Rybchenko
fcfb73b86d sfxge(4): honour packed stream RSS restriction
Packed stream firmware variant on EF10 adapters has a
number of properties which must be taken into account:

 - Only one exclusive RSS context is available per port.
 - Only IP addresses can contribute to the hash value.

Huntington and Medford have one more limitation which
is important for the drivers capable of packed stream:

 - Hash algorithm is non-standard (i.e. non-Toeplitz).
   This implies XORing together source + destination
   IP addresses (or last four bytes in the case of IPv6)
   and using the result as the input to a Toeplitz hash.

This patch provides a number of improvements in order
to treat the mentioned limitations in the common code.

If the firmware variant is packed stream, the list of
supported hash tuples will include less variants, and
the maximum number of RSS contexts will be set to one.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18232
2018-11-29 06:44:51 +00:00
Andrew Rybchenko
fd962dff89 sfxge(4): support more RSS hash configurations
Modern firmwares on EF10 adapters have support for
more traffic classes eligible for hash computation.
Also, it has become possible to adjust hashing per
individual class and select distinct packet fields
which will be able to contribute to the hash value.

This patch adds support for the mentioned features.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18231
2018-11-29 06:44:39 +00:00
Andrew Rybchenko
35ebf2a9f2 sfxge(4): add a new means to control RSS hash
Currently, libefx has no support for additional RSS modes
available with later controllers. In order to support this,
libefx should be able to list available hash configurations.

This patch provides basic infrastructure for the new interface.
The client drivers will be able to query the list of supported
hash configurations for a particular hash algorithm. Also, it
will be possible to configure hashing by means of new definitions.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18230
2018-11-29 06:44:28 +00:00
Andrew Rybchenko
ce6c2c8ffb sfxge(4): cope with clang warning on negative shift
clang 4.0.1-6 on Ubuntu generates false positive warning that shift
is negative.  It is done regardless of the fact that the branch is
not taken because of previous check.

The warning is generate in EFX_INSERT_NATIVE32 used by
EFX_INSERT_FIELD_NATIVE32. All similar cases are fixed as well.

It is undesirable to suppress the warning completely.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18229
2018-11-29 06:44:20 +00:00
Andrew Rybchenko
2a67ba3018 sfxge(4): fix comparison always true warning
Loopback type used as bit index has efx_loopback_type_t type
which is enum. clang complains that it is always true when it
is compared with qword (64 bit) bits number boundary.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18228
2018-11-29 06:44:09 +00:00
Andrew Rybchenko
17bcc05631 sfxge(4): support FW subvariant choice
If DPDK application or OS does not need checksumming on transmit,
it may be disabled in firmware to achieve higher packet rates.
Choice must be done before VIS allocation and is allowed if
no other non-preboot and firmware subvariant-unaware drivers are
attached.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18227
2018-11-29 06:43:57 +00:00
Andrew Rybchenko
3f8f54956a sfxge(4): report no Tx checksum FW subvariant support
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18226
2018-11-29 06:43:46 +00:00
Andrew Rybchenko
e0b3c2cc1a sfxge(4): add firmware subvariant aware driver option
FW subvariants allow to tweak NIC global features. For example,
if no drivers require checksumming on transmit, it may be disabled
in FW to increase packet rate.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18225
2018-11-29 06:43:34 +00:00
Andrew Rybchenko
6da6b6c758 sfxge(4): update MCDI headers
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18224
2018-11-29 06:43:23 +00:00
Andrew Rybchenko
d5dbb451b6 sfxge(4): add values for RxDPCPU firmware id recognition
Submitted by:   Roman Zhukov <roman.zhukov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18223
2018-11-29 06:43:12 +00:00
Andrew Rybchenko
87a67e180f sfxge(4): support choosing firmware variant
Submitted by:   Gautam Dawar <gdawar at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18222
2018-11-29 06:43:00 +00:00
Andrew Rybchenko
2d2d812352 sfxge(4): support drop filters on EF10 family NICs
Add support for filters which drop packets when forming MCDI request
for a filter.

Submitted by:   Roman Zhukov <roman.zhukov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18221
2018-11-29 06:42:49 +00:00
Andrew Rybchenko
9d5aae2705 sfxge(4): distinguish filters for encapsulated packets
Add filter match flag to distinguish filters applied only to
encapsulated packets.

Match flags set should allow to determine whether a filter
is supported or not. The problem is that if specification
has supported set outer match flags and specified
encapsulation without any inner flags, check says that it
is supported, and filter insertion is performed. However,
there is no filtering of the encapsulated traffic. A new
flag is added to solve this problem and separate the
filters for the encapsulated packets.

Submitted by:   Roman Zhukov <roman.zhukov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18220
2018-11-29 06:42:38 +00:00
Andrew Rybchenko
aab1bcb438 sfxge(4): support VXLAN filter creation
Submitted by:   Vijay Srivastava <vijays at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18219
2018-11-29 06:42:26 +00:00
Andrew Rybchenko
de7acb0847 sfxge(4): support VNI/VSID and inner frame local MAC
This supports VNI/VSID and inner frame local MAC fields to
match in VXLAN, GENEVE, or NVGRE packets.

Submitted by:   Roman Zhukov <roman.zhukov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18218
2018-11-29 06:42:15 +00:00
Andrew Rybchenko
13c11cb7aa sfxge(4): support filters for encapsulated packets
This adds filters for encapsulated packets to the list
returned by ef10_filter_supported_filters().

Submitted by:   Roman Zhukov <roman.zhukov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18217
2018-11-29 06:42:04 +00:00
Andrew Rybchenko
80c4ed9696 sfxge(4): sync MCDI headers and TLV layout
Regenerate MCDI and TLV layout headers from firmwaresrc to
pick up DPDK firmware variant and related Rx queue and filtering
extensions.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18216
2018-11-29 06:41:53 +00:00
Andrew Rybchenko
02d7c0c395 sfxge(4): add signed image layout support
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18215
2018-11-29 06:41:41 +00:00
Andrew Rybchenko
391763d7b4 sfxge(4): add firmware image layout option
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18214
2018-11-29 06:29:24 +00:00
Mateusz Guzik
eec8d0a378 Convert racct_enable to bool and annotate as __read_frequently
Sponsored by:	The FreeBSD Foundation
2018-11-29 05:17:16 +00:00
Mateusz Guzik
64cf6a62d4 Deinline racct throttling out of syscall exit path.
racct is not enabled by default and even when it is enabled processes are
typically not throttled. The order of checks is left unchanged since
racct_enable will be annotated as __read_frequently, while checking for the
flag in the processes would probably require an extra fetch.

Sponsored by:	The FreeBSD Foundation
2018-11-29 05:08:46 +00:00
Mateusz Guzik
e272bf479b Annotate td_cowgen check as unlikely.
Sponsored by:	The FreeBSD Foundation
2018-11-29 04:48:22 +00:00
Mateusz Guzik
3277792bde Tidy up hardclock.
- use fcmpset for updating ticks
- move (rarely used) itimer handling to a dedicated function

Sponsored by:	The FreeBSD Foundation
2018-11-29 03:44:02 +00:00
Justin Hibbits
f4a80449ce Fix thread creation in PowerPC64 ELFv2 processes.
Summary:
Currently, the upcall used to create threads assumes ELFv1.

Instead, we should check which sysentvec is in use on the process and act
accordingly.

This makes ELFv2 threaded processes work.

Submitted by:	git_bdragon.rtk0.net
Differential Revision: https://reviews.freebsd.org/D18330
2018-11-29 03:39:11 +00:00
Mateusz Guzik
1e9a1bf589 proc: create a dedicated lock for zombproc to ligthen the load on allproc_lock
waitpid always takes proctree to evaluate the list, but only takes allproc
if it can reap. With this patch allproc is no longer taken, which helps during
poudriere -j 128.

Discussed with: kib
Sponsored by:	The FreeBSD Foundation
2018-11-29 02:52:08 +00:00
John Baldwin
78afed1396 Move CLIP table handling out of TOM and into the base driver.
- Store the clip table in 'struct adapter' instead of in the TOM softc.
- Init the clip table during attach and teardown during detach.
- While here, add a dev.<nexus>.<unit>.misc.clip sysctl to dump the
  CLIP table.

This does mean that we update the clip table even if TOE is not enabled,
but non-TOE things need the CLIP table anyway.

Reviewed by:	np, Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D18010
2018-11-29 01:15:53 +00:00
Gleb Smirnoff
0b2e3aead3 Fix yet another edge case in uma_startup_count(). If zone size fits into
several pages, but leaves no space for struct uma_slab at the end we
miscalculate number of pages by one. Totally mimic keg_large_init() math
here to cover that problem.

Reported by:	gallatin
2018-11-28 19:54:02 +00:00
Gleb Smirnoff
3d5e3df73f For not offpage zones the slab is placed at the end of page. Keg's uk_pgoff
is calculated to guarantee that struct uma_slab is placed at pointer size
alignment. Calculation of real struct uma_slab size is done in keg_ctor()
and yet again in keg_large_init(), to check if we need an extra page. This
calculation can actually be performed at compile time.

- Add SIZEOF_UMA_SLAB macro to calculate size of struct uma_slab placed at
  an end of a page with alignment requirement.
- Use SIZEOF_UMA_SLAB in keg_ctor() and in keg_large_init(). This is a not
  a functional change.
- Use SIZEOF_UMA_SLAB in UMA_SLAB_SPACE definition and in keg_small_init().
  This is a potential bugfix, but in reality I don't think there are any
  systems affected, since compiler aligns struct uma_slab anyway.
2018-11-28 19:17:27 +00:00
Stephen Hurd
e8e0ecb969 Fix first-packet completion
The first packet after the ring is initialized was never
completed as isc_txd_credits_update() would not include it in the
count of completed packets. This caused netmap to never complete
a batch. See PR 233022 for more details.

This is the same fix as the r340310 for e1000

PR:		233607
Reported by:	lev
Reviewed by:	lev
MFC after:	3 days
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D18368
2018-11-28 17:37:17 +00:00
Justin Hibbits
8f69e36d87 powerpc: Don't include KERNBASE in genassym, it's unnecessary
A related future change, which changes KERNBASE for Book-E for some reason
causes a "KERNBASE redefined" error with assym.inc, even though it only changed
the value of KERNBASE and nothing else.  Since machine/vmparam.h is already
included in booke/locore.S, and the requisite guards are already in place for
properly handling KERNBASE in vmparam.h, just remove it from genassym, and
include vmparam.h in the AIM locore files.
2018-11-28 16:00:52 +00:00
Vincenzo Maffione
43cf589ced cxgbe: revert r309725
After the fix contained in r341144, cxgbe does not need anymore
to set the IFCAP_NETMAP flag manually.

Reviewed by:	np
Approved by:	gnn (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D17987
2018-11-28 15:29:58 +00:00
Vincenzo Maffione
d55913f555 netmap: set IFCAP_NETMAP in if_capabilities
Revision r307394 removed (by mistake) the code that sets IFCAP_NETMAP
in if_capabilities on netmap_attach. This patch reverts this change.

Reviewed by:	np
Approved by:	gnn (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D17987
2018-11-28 14:07:34 +00:00
Emmanuel Vadot
006f540e44 arm64: Add rk_i2c and rk805 to GENERIC
MFC after:	1 month
2018-11-28 13:54:39 +00:00
Emmanuel Vadot
cee1927ea2 Add RK805 PMIC Support
RK805 is the companion PMIC for RK3328 SoC.
Add a driver for it with most of it's regulators supported.

MFC after:	1 month
2018-11-28 13:53:43 +00:00
Emmanuel Vadot
da3d2dce91 rk_clk_composite: Fix set_mux
Pointy Hat:	  manu
2018-11-28 13:25:22 +00:00
Sean Bruno
1a8177b128 Add CAPABILITIES to the ERL kernel config so that tools that have been
modified with Capsicum work on this target platform.

This came up after the conversion of wc(8).
2018-11-28 13:25:10 +00:00
Andrew Rybchenko
4142e8cfbb sfxge(4): add outer IP ID parameter to TSOv2 descriptor
Set outer_ip_id in the TX option descriptor for encapsulated packets.

Submitted by:   Vijay Srivastava <vijays at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18213
2018-11-28 09:25:43 +00:00
Andrew Rybchenko
357c2ebbb4 sfxge(4): add encapsulated TSOv2 capability
Submitted by:   Vijay Srivastava <vijays at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18212
2018-11-28 09:25:31 +00:00