]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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

5 years agoClean up a rather useless conditional structure member definition.
cy [Fri, 30 Nov 2018 04:15:56 +0000 (04:15 +0000)]
Clean up a rather useless conditional structure member definition.

MFC after: 1 week

5 years agoClean up a redundant non-redefinition of IFNAMSIZ. IFNAMSIZ
cy [Fri, 30 Nov 2018 04:15:42 +0000 (04:15 +0000)]
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

5 years agoUse _thr_isthreaded() and _thr_setthreaded() wrappers
vangyzen [Fri, 30 Nov 2018 03:02:49 +0000 (03:02 +0000)]
Use _thr_isthreaded() and _thr_setthreaded() wrappers

...instead of directly using the global variable.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

5 years ago_thr_setthreaded() cannot fail; change return type to void
vangyzen [Fri, 30 Nov 2018 03:01:32 +0000 (03:01 +0000)]
_thr_setthreaded() cannot fail; change return type to void

Also remove logic to avoid unnecessary stores to the global variable.
Thread creation and destruction are heavy enough that any supposed savings
is in the noise.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

5 years agoWhen handling CMD_CRIT error set command_errmsg to NULL after we dump it out,
sobomax [Fri, 30 Nov 2018 02:14:41 +0000 (02:14 +0000)]
When handling CMD_CRIT error set command_errmsg to NULL after we dump it out,
so that it does not result in error message printed twice.

OK load doodoo
can't find 'doodoo'
can't find 'doodoo'
OK

MFC after: 2 weeks

5 years agoamd64: remove stale attribution for memmove work
mjg [Fri, 30 Nov 2018 00:47:36 +0000 (00:47 +0000)]
amd64: remove stale attribution for memmove work

While the routine started as expanded bcopy, it is now entirely rewritten.

Sponsored by: The FreeBSD Foundation

5 years agoamd64: tidy up copying backwards in memmove
mjg [Fri, 30 Nov 2018 00:45:10 +0000 (00:45 +0000)]
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

5 years agoMake most of the CLIP code conditional on #ifdef INET6.
jhb [Thu, 29 Nov 2018 23:14:54 +0000 (23:14 +0000)]
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

5 years agorelease: arm64: Add opp dtbo to PINE* boards
manu [Thu, 29 Nov 2018 22:36:36 +0000 (22:36 +0000)]
release: arm64: Add opp dtbo to PINE* boards

MFC after: 1 month

5 years agoarm64: allwinner: Add a dtbo to have cpu operating points
manu [Thu, 29 Nov 2018 22:35:23 +0000 (22:35 +0000)]
arm64: allwinner: Add a dtbo to have cpu operating points

This enables cpufreq on A64 boards.

MFC after: 1 month

5 years agoRemove an old comment/code and replace with a comment that
cy [Thu, 29 Nov 2018 21:20:53 +0000 (21:20 +0000)]
Remove an old comment/code and replace with a comment that
directly references a NetBSD commit.

MFC after: 1 week

5 years agoAdd helper functions to copy strings into struct image_args.
brooks [Thu, 29 Nov 2018 21:00:56 +0000 (21:00 +0000)]
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

5 years agoReplace hand-crafted naive byte-by-byte zero block detection routine
sobomax [Thu, 29 Nov 2018 19:28:01 +0000 (19:28 +0000)]
Replace hand-crafted naive byte-by-byte zero block detection routine
with macro based around memcmp(). The latter is expected to be some
8 times faster on a modern 64-bit architectures.

In practice, throughput of doing conv=sparse from /dev/zero to /dev/null
went up some 5-fold here from 1.9GB/sec to 9.7GB/sec with this change
(bs=128k).

MFC after: 2 weeks

5 years agoIf BENEATH is specified, always latch the topping directory vnode.
kib [Thu, 29 Nov 2018 19:13:10 +0000 (19:13 +0000)]
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

5 years agoarm64: rockchip: armclk: Do not change parent freq if CLK_SET_DRYRUN is set
manu [Thu, 29 Nov 2018 19:11:35 +0000 (19:11 +0000)]
arm64: rockchip: armclk: Do not change parent freq if CLK_SET_DRYRUN is set

MFC after: 3 days

5 years agoextres: clk: Fix clk_set_assigned
manu [Thu, 29 Nov 2018 19:06:05 +0000 (19:06 +0000)]
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.

5 years agoThe libstand's panic() appends its own '\n' to the message, so that users of the API
sobomax [Thu, 29 Nov 2018 18:37:48 +0000 (18:37 +0000)]
The libstand's panic() appends its own '\n' to the message, so that users of the API
don't need to supply one.

MFC after: 2 weeks

5 years agoFix age_old_log() after r337468.
markj [Thu, 29 Nov 2018 16:49:56 +0000 (16:49 +0000)]
Fix age_old_log() after r337468.

We can no longer use sizeof() to get the path buffer's size.  Apply
a straightforward fix for now with the aim of MFCing soon.

PR: 233633
Submitted by: Katsuyuki Miyoshi <katsu@miyoshi.matsuyama.ehime.jp>
MFC after: 3 days

5 years agoUpdate the free page count when blacklisting pages.
markj [Thu, 29 Nov 2018 16:31:01 +0000 (16:31 +0000)]
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

5 years agotrim.8: fix contents after rename from trim.1
eugen [Thu, 29 Nov 2018 16:13:46 +0000 (16:13 +0000)]
trim.8: fix contents after rename from trim.1

MFC after: 1 month

5 years agotrim(8): fix Makefile after rename from trim(1).
eugen [Thu, 29 Nov 2018 16:10:54 +0000 (16:10 +0000)]
trim(8): fix Makefile after rename from trim(1).

MFC after: 1 month

5 years agoRename trim.1 to trim.8 too.
eugen [Thu, 29 Nov 2018 16:09:24 +0000 (16:09 +0000)]
Rename trim.1 to trim.8 too.

MFC after: 1 month

5 years agoMove trim(1) from usr.bin to usr.sbin to become trim(8).
eugen [Thu, 29 Nov 2018 16:08:16 +0000 (16:08 +0000)]
Move trim(1) from usr.bin to usr.sbin to become trim(8).

Requested by: se
MFC after: 1 month

5 years agotrim(1): unbreak build after r341232 for platforms using gcc and not clang
eugen [Thu, 29 Nov 2018 14:49:33 +0000 (14:49 +0000)]
trim(1): unbreak build after r341232 for platforms using gcc and not clang

MFC after: 1 month

5 years agoAdd new small tool trim(1) to delete contents for blocks on flash
eugen [Thu, 29 Nov 2018 14:21:26 +0000 (14:21 +0000)]
Add new small tool trim(1) to delete contents for blocks on flash
based storage devices that use wear-leveling algorithms.

Reviewed by: hackers@
MFC after: 1 month

5 years agoloader: command_bcache() should print unsigned values
tsoome [Thu, 29 Nov 2018 14:21:01 +0000 (14:21 +0000)]
loader: command_bcache() should print unsigned values

All bcache counters are unsigned.

5 years agovfs: fix i386 build after r341220
mjg [Thu, 29 Nov 2018 09:54:27 +0000 (09:54 +0000)]
vfs: fix i386 build after r341220

5 years agocache: retire cache_enter compat schim
mjg [Thu, 29 Nov 2018 09:32:59 +0000 (09:32 +0000)]
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

5 years agoaudit: predict AUDITING_TD as false
mjg [Thu, 29 Nov 2018 09:19:48 +0000 (09:19 +0000)]
audit: predict AUDITING_TD as false

By default it is compiled in and disabled.

Sponsored by: The FreeBSD Foundation

5 years agovfs: drop spurious memcpy in stat
mjg [Thu, 29 Nov 2018 09:04:10 +0000 (09:04 +0000)]
vfs: drop spurious memcpy in stat

Sponsored by: The FreeBSD Foundation

5 years agofd: unify fd range check across the routines
mjg [Thu, 29 Nov 2018 08:53:39 +0000 (08:53 +0000)]
fd: unify fd range check across the routines

While here annotate out of range as unlikely.

Sponsored by: The FreeBSD Foundation

5 years agoaudit: change audit_syscalls_enabled type to bool
mjg [Thu, 29 Nov 2018 08:37:33 +0000 (08:37 +0000)]
audit: change audit_syscalls_enabled type to bool

So that it fits better in __read_frequently.

Sponsored by: The FreeBSD Foundation

5 years agosfxge(4): add more definitions of partitions
arybchik [Thu, 29 Nov 2018 06:47:41 +0000 (06:47 +0000)]
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

5 years agosfxge(4): fix build because of no declaration
arybchik [Thu, 29 Nov 2018 06:47:30 +0000 (06:47 +0000)]
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

5 years agosfxge(4): fix SAL annotation for input buffers
arybchik [Thu, 29 Nov 2018 06:47:19 +0000 (06:47 +0000)]
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

5 years agosfxge(4): fix PreFAST warnings because of unused return
arybchik [Thu, 29 Nov 2018 06:47:06 +0000 (06:47 +0000)]
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

5 years agosfxge(4): add Medford2 head-of-line blocking stats
arybchik [Thu, 29 Nov 2018 06:46:55 +0000 (06:46 +0000)]
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

5 years agosfxge(4): support RxDP scatter disabled truncate counter
arybchik [Thu, 29 Nov 2018 06:46:44 +0000 (06:46 +0000)]
sfxge(4): support RxDP scatter disabled truncate counter

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

5 years agosfxge(4): generate Medford2 RxDP stats
arybchik [Thu, 29 Nov 2018 06:46:33 +0000 (06:46 +0000)]
sfxge(4): generate Medford2 RxDP stats

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

5 years agosfxge(4): get max supported value for action MARK
arybchik [Thu, 29 Nov 2018 06:46:21 +0000 (06:46 +0000)]
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

5 years agosfxge(4): support MARK and FLAG actions in filters
arybchik [Thu, 29 Nov 2018 06:46:10 +0000 (06:46 +0000)]
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

5 years agosfxge(4): get actions MARK and FLAG support
arybchik [Thu, 29 Nov 2018 06:46:01 +0000 (06:46 +0000)]
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

5 years agosfxge(4): add equal stride super-buffer prefix layout
arybchik [Thu, 29 Nov 2018 06:45:50 +0000 (06:45 +0000)]
sfxge(4): add equal stride super-buffer prefix layout

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

5 years agosfxge(4): support equal stride super-buffer Rx mode
arybchik [Thu, 29 Nov 2018 06:45:38 +0000 (06:45 +0000)]
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

5 years agosfxge(4): detect equal stride super-buffer support
arybchik [Thu, 29 Nov 2018 06:45:26 +0000 (06:45 +0000)]
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

5 years agosfxge(4): make RxQ type data an union
arybchik [Thu, 29 Nov 2018 06:45:15 +0000 (06:45 +0000)]
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

5 years agosfxge(4): update autogenerated MCDI and TLV headers
arybchik [Thu, 29 Nov 2018 06:45:04 +0000 (06:45 +0000)]
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

5 years agosfxge(4): honour packed stream RSS restriction
arybchik [Thu, 29 Nov 2018 06:44:51 +0000 (06:44 +0000)]
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

5 years agosfxge(4): support more RSS hash configurations
arybchik [Thu, 29 Nov 2018 06:44:39 +0000 (06:44 +0000)]
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

5 years agosfxge(4): add a new means to control RSS hash
arybchik [Thu, 29 Nov 2018 06:44:28 +0000 (06:44 +0000)]
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

5 years agosfxge(4): cope with clang warning on negative shift
arybchik [Thu, 29 Nov 2018 06:44:20 +0000 (06:44 +0000)]
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

5 years agosfxge(4): fix comparison always true warning
arybchik [Thu, 29 Nov 2018 06:44:09 +0000 (06:44 +0000)]
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

5 years agosfxge(4): support FW subvariant choice
arybchik [Thu, 29 Nov 2018 06:43:57 +0000 (06:43 +0000)]
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

5 years agosfxge(4): report no Tx checksum FW subvariant support
arybchik [Thu, 29 Nov 2018 06:43:46 +0000 (06:43 +0000)]
sfxge(4): report no Tx checksum FW subvariant support

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

5 years agosfxge(4): add firmware subvariant aware driver option
arybchik [Thu, 29 Nov 2018 06:43:34 +0000 (06:43 +0000)]
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

5 years agosfxge(4): update MCDI headers
arybchik [Thu, 29 Nov 2018 06:43:23 +0000 (06:43 +0000)]
sfxge(4): update MCDI headers

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

5 years agosfxge(4): add values for RxDPCPU firmware id recognition
arybchik [Thu, 29 Nov 2018 06:43:12 +0000 (06:43 +0000)]
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

5 years agosfxge(4): support choosing firmware variant
arybchik [Thu, 29 Nov 2018 06:43:00 +0000 (06:43 +0000)]
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

5 years agosfxge(4): support drop filters on EF10 family NICs
arybchik [Thu, 29 Nov 2018 06:42:49 +0000 (06:42 +0000)]
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

5 years agosfxge(4): distinguish filters for encapsulated packets
arybchik [Thu, 29 Nov 2018 06:42:38 +0000 (06:42 +0000)]
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

5 years agosfxge(4): support VXLAN filter creation
arybchik [Thu, 29 Nov 2018 06:42:26 +0000 (06:42 +0000)]
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

5 years agosfxge(4): support VNI/VSID and inner frame local MAC
arybchik [Thu, 29 Nov 2018 06:42:15 +0000 (06:42 +0000)]
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

5 years agosfxge(4): support filters for encapsulated packets
arybchik [Thu, 29 Nov 2018 06:42:04 +0000 (06:42 +0000)]
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

5 years agosfxge(4): sync MCDI headers and TLV layout
arybchik [Thu, 29 Nov 2018 06:41:53 +0000 (06:41 +0000)]
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

5 years agosfxge(4): add signed image layout support
arybchik [Thu, 29 Nov 2018 06:41:41 +0000 (06:41 +0000)]
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

5 years agosfxge(4): add firmware image layout option
arybchik [Thu, 29 Nov 2018 06:29:24 +0000 (06:29 +0000)]
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

5 years agoConvert racct_enable to bool and annotate as __read_frequently
mjg [Thu, 29 Nov 2018 05:17:16 +0000 (05:17 +0000)]
Convert racct_enable to bool and annotate as __read_frequently

Sponsored by: The FreeBSD Foundation

5 years agoDeinline racct throttling out of syscall exit path.
mjg [Thu, 29 Nov 2018 05:08:46 +0000 (05:08 +0000)]
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

5 years agoAnnotate td_cowgen check as unlikely.
mjg [Thu, 29 Nov 2018 04:48:22 +0000 (04:48 +0000)]
Annotate td_cowgen check as unlikely.

Sponsored by: The FreeBSD Foundation

5 years agoAllow truss to operate on ELFv2 processes.
jhibbits [Thu, 29 Nov 2018 03:57:06 +0000 (03:57 +0000)]
Allow truss to operate on ELFv2 processes.

Summary:
Currently, truss doesn't work on ELFv2 processes due to not recognizing the ABI.

Since there's no special handling needed here, just adding a PROCABI struct for
it is sufficient to get it working.

Submitted by: git_bdragon.rtk0.net
Differential Revision: https://reviews.freebsd.org/D18352