Commit Graph

238066 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
7f92f23316 Revert r341337; according to imp@ we still support these.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-11-30 15:52:03 +00:00
Edward Tomasz Napierala
fd2f7a7f90 Use .Va for sysctls, not .Dv.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-11-30 12:17:35 +00:00
Edward Tomasz Napierala
7b8bdbef02 Use .Va for sysctls, not .Dv.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-11-30 11:50:41 +00:00
Edward Tomasz Napierala
6ce4ddc466 Remove duplicated word.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-11-30 11:44:43 +00:00
Edward Tomasz Napierala
9599680a9c Say in plain text what the 'debug' keymap action usually is.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-11-30 11:44:16 +00:00
Edward Tomasz Napierala
b7477b1e5f Remove the hint for ISA buses; we don't support them anymore.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2018-11-30 11:42:19 +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
Toomas Soome
fb0df66629 loader.efi: fix EFI getchar() for multiple consoles
This fix is ported from illumos (issue #9970), the analysis and initial
implementation was done by John Levon.

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

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

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

This patch does implement a bit more generic key buffer to support
translation of input keys, and we use generic efi_readkey() to reduce
duplication from calls from getchar() and poll().
2018-11-30 08:42:14 +00:00
Toomas Soome
cdff10360e loader: create separate lists for fd, cd and hd, merge bioscd with biosdisk
Create unified block IO implementation in BIOS version, like it is done in UEFI
side. Implement fd, disk and cd device lists, this will split floppy devices
from disks and will allow us to have consistent, predictable device naming
(modulo BIOS issues).

Differential Revision:	https://reviews.freebsd.org/D17888
2018-11-30 08:01:11 +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