]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agomps: Use 64-bit chain structures
Warner Losh [Wed, 2 Feb 2022 21:36:49 +0000 (14:36 -0700)]
mps: Use 64-bit chain structures

According to Broadcom, mixing 64-bit SGEs with 32-bit chain entries can
lead to IOC Fault code 0x40000d04. This fault code has been observed to
suddenly increase on certain machines when the OCA firmware images are
deployed. The hardware interprets all elements of a 64-bit SGE, even
ones marked as 32-bit. Depending on the other bits, this will just work,
but sometimes generate the above fault. Broadcom recommends this
practice, and the Linux and NetBSD drivers follow it.

Rework the chaining code to use MPI2_SGE_CHAIN64 instead of
MPI2_SGE_CHAIN32. Adjust MPS_SGC_SIZE from 8 to 12 to match the size of
the new structure. Flag the structure as being 64-bits now. Since
MPS_SGE64_SIZE and MPS_SGC_SIZE are the same now, mps_push_sge could be
simplified (after the same fashion of mpr). The different number of
cases collapse to whether or not there's room for the segments and if
not we need a chain, however these changes haven't been made yet as the
current code handles those cases properly with the new defines.

Made chain_busaddr 64-bits, even though we ask for all allocations to be
below 4GB for this tag. Use it to set both parts of the CHAIN64 address
rather than baking the 4GB assumption. Add asserts around the allocation
to detect and BUSDMA bugs in allocation.

Remove asserts and associated comment in mpi_pre_fw_download and
mpi_pre_fw_upload. The code does not, it seems, depend on this
invariant. The mpr driver has similar code, no asserts and also doesn't
depend on this.

Adjust comments to reflect the updated size.

Sponsored by: Netflix
Reviewed by: scottl, mav
Differential Revision: https://reviews.freebsd.org/D34016

2 years agounionfs: do not force LK_NOWAIT if VI_OWEINACT is set
Jason A. Harmening [Sun, 30 Jan 2022 21:03:18 +0000 (15:03 -0600)]
unionfs: do not force LK_NOWAIT if VI_OWEINACT is set

I see no apparent need to avoid waiting on the lock just because
vinactive() may be called on another thread while the thread that
cleared the vnode refcount has the lock dropped.  In fact, this
can at least lead to a panic of the form "vn_lock: error <errno>
incompatible with flags" if LK_RETRY was passed to VOP_LOCK().
In this case LK_NOWAIT may cause the underlying FS to return an
error which is incompatible with LK_RETRY.

Reported by: pho
Reviewed by: kib, markj, pho
Differential Revision: https://reviews.freebsd.org/D34109

2 years agounionfs: allow lock recursion when reclaiming the root vnode
Jason A. Harmening [Sun, 30 Jan 2022 20:52:08 +0000 (14:52 -0600)]
unionfs: allow lock recursion when reclaiming the root vnode

The unionfs root vnode will always share a lock with its lower vnode.
If unionfs was mounted with the 'below' option, this will also be the
vnode covered by the unionfs mount.  During unmount, the covered vnode
will be locked by dounmount() while the unionfs root vnode will be
locked by vgone().  This effectively requires recursion on the same
underlying like, albeit through two different vnodes.

Reported by: pho
Reviewed by: kib, markj, pho
Differential Revision: https://reviews.freebsd.org/D34109

2 years agounionfs: fix assertion order in unionfs_lock()
Jason A. Harmening [Sun, 30 Jan 2022 20:43:19 +0000 (14:43 -0600)]
unionfs: fix assertion order in unionfs_lock()

VOP_LOCK() may be handed a vnode that is concurrently reclaimed.
unionfs_lock() accounts for this by checking for empty vnode private
data under the interlock.  But it incorrectly asserts that the vnode
is using the unionfs dispatch table before making this check.
Reverse the order, and also update KASSERT_UNIONFS_VNODE() to provide
more useful information.

Reported by: pho
Reviewed by: kib, markj, pho
Differential Revision: https://reviews.freebsd.org/D34109

2 years ago__ctype_load(): check for calloc() failure
Konstantin Belousov [Wed, 2 Feb 2022 18:17:58 +0000 (20:17 +0200)]
__ctype_load(): check for calloc() failure

Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34140

2 years ago__numeric_load(): check for calloc() failure
Konstantin Belousov [Wed, 2 Feb 2022 18:16:25 +0000 (20:16 +0200)]
__numeric_load(): check for calloc() failure

Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34140

2 years agolibc/locale/lnumeric.c: minor style
Konstantin Belousov [Wed, 2 Feb 2022 18:15:34 +0000 (20:15 +0200)]
libc/locale/lnumeric.c: minor style

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

2 years ago__monetary_load(): check for calloc() failure
Konstantin Belousov [Wed, 2 Feb 2022 18:12:43 +0000 (20:12 +0200)]
__monetary_load(): check for calloc() failure

Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34140

2 years agolibc/locale/lmonetary.c: minor style
Konstantin Belousov [Wed, 2 Feb 2022 18:10:43 +0000 (20:10 +0200)]
libc/locale/lmonetary.c: minor style

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

2 years ago__messages_load(): check for calloc() failure
Konstantin Belousov [Wed, 2 Feb 2022 18:07:42 +0000 (20:07 +0200)]
__messages_load(): check for calloc() failure

Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34140

2 years agolibc/locale/lmessages.c: minor style
Konstantin Belousov [Wed, 2 Feb 2022 18:06:39 +0000 (20:06 +0200)]
libc/locale/lmessages.c: minor style

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

2 years ago__collate_load(): check for calloc failure
Konstantin Belousov [Wed, 2 Feb 2022 18:01:56 +0000 (20:01 +0200)]
__collate_load(): check for calloc failure

Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34140

2 years agolibc/locale/collate.c: minor style
Konstantin Belousov [Wed, 2 Feb 2022 18:00:53 +0000 (20:00 +0200)]
libc/locale/collate.c: minor style

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

2 years agoxlocale.c: only call init_key() when locale was successfully allocated
Konstantin Belousov [Wed, 2 Feb 2022 17:25:45 +0000 (19:25 +0200)]
xlocale.c: only call init_key() when locale was successfully allocated

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

2 years agoxlocale.c: check for allocation failure
Konstantin Belousov [Wed, 2 Feb 2022 17:24:42 +0000 (19:24 +0200)]
xlocale.c: check for allocation failure

PR: 261679
Reported by: phil.stone@gmx.com
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34140

2 years agoxlocale.c:init_key(): do not ignore errors from pthread_key_create()
Konstantin Belousov [Wed, 2 Feb 2022 17:23:55 +0000 (19:23 +0200)]
xlocale.c:init_key(): do not ignore errors from pthread_key_create()

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

2 years agolibc/locale/xlocale.c: minor style
Konstantin Belousov [Wed, 2 Feb 2022 17:23:14 +0000 (19:23 +0200)]
libc/locale/xlocale.c: minor style

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

2 years agonfsd: Allow file owners to perform Open(Delegate_cur)
Rick Macklem [Wed, 2 Feb 2022 22:10:16 +0000 (14:10 -0800)]
nfsd: Allow file owners to perform Open(Delegate_cur)

Commit b0b7d978b6a8 changed the NFSv4 server's default
behaviour to check the file's mode or ACL for permission to
open the file, to be Linux and Solaris compatible.
However, it turns out that Linux makes an exception for
the case of Claim_delegate_cur(_fh).

When a NFSv4 client is returning a delegation, it must
acquire Opens against the server to replace the ones
done locally in the client.  The client does this via
an Open operation with Claim_delegate_cur(_fh).  If
this operation fails, due to a change to the file's
mode or ACL after the delegation was issued, the
client does not have any way to retain the open.

As such, the Linux client allows the file's owner
to perform an Open with Claim_delegate_cur(_fh)
no matter what the mode or ACL allows.

This patch makes the FreeBSD server allow this case,
to be Linux compatible.

This patch only affects the case where delegations
are enabled, which is not the default.

MFC after: 2 weeks

2 years agoMakefile.libcompat: Sort
Warner Losh [Wed, 2 Feb 2022 21:34:29 +0000 (14:34 -0700)]
Makefile.libcompat: Sort

Sort MK_BOOT before MK_CTF and remove now-useless NO_LINT while I'm
here.

Suggested by: brooks, emaste
Sponsored by: Netflix

2 years agostand: Fix kboot issue on powerpc64 with MK_LIB32=yes
Warner Losh [Wed, 2 Feb 2022 21:27:56 +0000 (14:27 -0700)]
stand: Fix kboot issue on powerpc64 with MK_LIB32=yes

When MK_LIB32 is true, we descend into stand for make includes, make
clean, etc. We shouldn't do this, so set MK_BOOT=no when we're building
includes.

Fixes: 6497250f6f7f
PR: 261497
Sponsored by: Netflix
Reviewed by: emaste, brooks (he suggested this)
Differential Revision: https://reviews.freebsd.org/D34141

2 years agokyua/qemu: When running in qemu, don't teset sendfile
Warner Losh [Wed, 2 Feb 2022 21:27:51 +0000 (14:27 -0700)]
kyua/qemu: When running in qemu, don't teset sendfile

qemu's bsd-user doesn't implement sendfile, so just skip those tests
that use it.

Sponsored by: Netflix

2 years agoDisable -Wunused-function for {ed,x}25519_ref10.c in libsodium.
John Baldwin [Wed, 2 Feb 2022 20:25:16 +0000 (12:25 -0800)]
Disable -Wunused-function for {ed,x}25519_ref10.c in libsodium.

2 years agostand/efi: Pass --no-dynamic-linker to ld.bfd >= 2.34.
John Baldwin [Wed, 2 Feb 2022 20:18:43 +0000 (12:18 -0800)]
stand/efi: Pass --no-dynamic-linker to ld.bfd >= 2.34.

ld.bfd in binutils 2.34+ now reports an error in more cases for custom
ldscripts that do not place PHDRs in a LOAD segment.  However, EFI
binaries are not dynamic binaries which need PHDRs, so pass
--no-dynamic-linker to disable this check.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D34124

2 years agosockstat: fix usage string
Michael Tuexen [Tue, 1 Feb 2022 14:44:57 +0000 (15:44 +0100)]
sockstat: fix usage string

MFC after: 1 week
Sponsored by: Netflix, Inc.

2 years agosockstat: add -i to display inp_gencnt
Michael Tuexen [Tue, 1 Feb 2022 14:37:03 +0000 (15:37 +0100)]
sockstat: add -i to display inp_gencnt

The inp_gencnt will be used to identify a TCP endpoint by an upcoming
command line tool to set TCP socket options.

Reviewed by: rscheff
MFC after:  1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D34137

2 years agoExclude DEBUG_VFS_LOCKS from non-debug kernel configs
Konstantin Belousov [Wed, 2 Feb 2022 17:22:17 +0000 (19:22 +0200)]
Exclude DEBUG_VFS_LOCKS from non-debug kernel configs

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agocontrib/terminus: update to terminus-font-4.49.1
Toomas Soome [Wed, 2 Feb 2022 13:42:18 +0000 (15:42 +0200)]
contrib/terminus: update to terminus-font-4.49.1

2 years agoimport terminus-font-4.49.1
Toomas Soome [Wed, 2 Feb 2022 12:26:09 +0000 (14:26 +0200)]
import terminus-font-4.49.1

2 years agousb(4): Ignore port resume failures.
Hans Petter Selasky [Wed, 2 Feb 2022 11:59:00 +0000 (12:59 +0100)]
usb(4): Ignore port resume failures.

If port resume fails, likely the USB device is detached. Ignore such errors,
because else the USB stack might try forever trying to resume the device,
before it will proceed detaching it.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoamd64: micro-optimize vptopte()/vtopde() further
Konstantin Belousov [Sat, 8 Jan 2022 05:09:09 +0000 (07:09 +0200)]
amd64: micro-optimize vptopte()/vtopde() further

Eliminate shlq $3,address shift after masking of the va is done, which
is needed to convert pt_entry_t[] array index into byte offset.
Do it by preshifting the mask, and compensating the right shift of va.

Suggested by: alc
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33786

2 years agovmmeter(): Fix detection of the named swap objects
Konstantin Belousov [Tue, 25 Jan 2022 21:03:23 +0000 (23:03 +0200)]
vmmeter(): Fix detection of the named swap objects

Noted and reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33549

2 years agovm_object: restore handling of shadow_count for all type of objects
Konstantin Belousov [Fri, 17 Dec 2021 20:55:45 +0000 (22:55 +0200)]
vm_object: restore handling of shadow_count for all type of objects

instead of only OBJ_ANON objects that are backing, as it is now.
This is required for e.g. vm_meter is_object_active() detection, and
should be useful in some more cases.

Use refcount KPI for all objects, regardless of owning the object lock,
and the fact that currently OBJ_ANON cannot change for the live object.

Noted and reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33549

2 years agoip_mroute: refactor epoch-basd locking
Wojciech Macek [Tue, 25 Jan 2022 09:10:44 +0000 (10:10 +0100)]
ip_mroute: refactor epoch-basd locking

Remove duplicated epoch_enter and epoch_exit in IP inp/outp routines.
Remove unnecessary macros as well.

Obtained from: Semihalf
Spponsored by: Stormshield
Reviewed by: glebius
Differential revision: https://reviews.freebsd.org/D34030

2 years agoipfilter: Correct a typo in a comment
Cy Schubert [Wed, 2 Feb 2022 03:55:56 +0000 (19:55 -0800)]
ipfilter: Correct a typo in a comment

MFC after: 3 days

2 years agotests/sys/ses: Use ANSI C definition for has_ses.
John Baldwin [Tue, 1 Feb 2022 20:35:21 +0000 (12:35 -0800)]
tests/sys/ses: Use ANSI C definition for has_ses.

This fixes -Wstrict-prototypes and -Wold-style-definition warnings
from GCC 9.

2 years agoOpenSSL: Fix the same BIO_FLAGS macro definition
John Baldwin [Tue, 1 Feb 2022 18:38:49 +0000 (10:38 -0800)]
OpenSSL: Fix the same BIO_FLAGS macro definition

Also add comment to the public header to avoid
making another conflict in future.

Reviewed by: jkim
Obtained from: OpenSSL commit 5d4975ecd88ac17d0749513a8fac9a7c7befd900
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34135

2 years agoarm64, riscv: handle RB_KDB
Mitchell Horne [Tue, 1 Feb 2022 17:58:07 +0000 (13:58 -0400)]
arm64, riscv: handle RB_KDB

This allows entering the debugger at the earliest possible time, if
the '-d' argument is passed to the kernel.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34120

2 years agoriscv: add ALT_BREAK_TO_DEBUGGER to GENERIC
Mitchell Horne [Tue, 1 Feb 2022 17:57:35 +0000 (13:57 -0400)]
riscv: add ALT_BREAK_TO_DEBUGGER to GENERIC

It allows quickly entering ddb(4) over a serial line.

Reviewed by: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34119

2 years agotcp: LRO code to deal with all 12 TCP header flags
Richard Scheffenegger [Tue, 1 Feb 2022 16:25:49 +0000 (17:25 +0100)]
tcp: LRO code to deal with all 12 TCP header flags

TCP per RFC793 has 4 reserved flag bits for future use. One
of those bits may be used for Accurate ECN.
This patch is to include these bits in the LRO code to ease
the extensibility if/when these bits are used.

Reviewed By: hselasky, rrs, #transport
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34127

2 years ago<sys/bitstring.h>: Cast _BITSTR_BITS to int in a ternary operator.
John Baldwin [Tue, 1 Feb 2022 17:45:11 +0000 (09:45 -0800)]
<sys/bitstring.h>: Cast _BITSTR_BITS to int in a ternary operator.

This fixes a -Wsign-compare error reported by GCC due to the two
results of the ternary operator having differing signedness.

Reviewed by: dougm, rlibby
Differential Revision: https://reviews.freebsd.org/D34122

2 years agoimprove casting for pointer diffs
Wolfram Schneider [Tue, 1 Feb 2022 17:26:20 +0000 (17:26 +0000)]
improve casting for pointer diffs

2 years agopflog: align header to 4 bytes, not 8
Kristof Provost [Tue, 1 Feb 2022 07:56:49 +0000 (08:56 +0100)]
pflog: align header to 4 bytes, not 8

6d4baa0d01 incorrectly rounded the lenght of the pflog header up to 8
bytes, rather than 4.

PR: 261566
Reported by: Guy Harris <gharris@sonic.net>
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agomlx5en: Implement TLS RX support.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:16 +0000 (16:20 +0100)]
mlx5en: Implement TLS RX support.

TLS RX support is modeled after TLS TX support. The basic structures and layouts
are almost identical, except that the send tag created filters RX traffic and
not TX traffic.

The TLS RX tag keeps track of past TLS records up to a certain limit,
approximately 1 Gbyte of TCP data. TLS records of same length are joined
into a single database record.

Regularly the HW is queried for TLS RX progress information. The TCP sequence
number gotten from the HW is then matches against the database of TLS TCP
sequence number records and lengths. If a match is found a static params WQE
is queued on the IQ and the hardware should immediately resume decrypting TLS
data until the next non-sequential TCP packet arrives.

Offloading TLS RX data is supported for untagged, prio-tagged, and
regular VLAN traffic.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5core: Set driver version into firmware.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:16 +0000 (16:20 +0100)]
mlx5core: Set driver version into firmware.

If the driver_version capability bit is enabled, send the driver
version to firmware after the init HCA command, for display purposes.

Example of driver version: "FreeBSD,mlx5_core,14.0.0,3.x-xxx"

Linux commits:
012e50e109fd27ff989492ad74c50ca7ab21e6a1

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Implement one RQT object per channel.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:15 +0000 (16:20 +0100)]
mlx5en: Implement one RQT object per channel.

These objects will eventually be used to switch TLS RX traffic.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5: Add raw ethernet local loopback support.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:15 +0000 (16:20 +0100)]
mlx5: Add raw ethernet local loopback support.

Currently, unicast/multicast loopback raw ethernet (non-RDMA) packets
are sent back to the vport.  A unicast loopback packet is the packet
with destination MAC address the same as the source MAC address.  For
multicast, the destination MAC address is in the vport's multicast
filter list.

Moreover, the local loopback is not needed if there is one or none
user space context.

After this patch, the raw ethernet unicast and multicast local
loopback are disabled by default. When there is more than one user
space context, the local loopback is enabled.

Note that when local loopback is disabled, raw ethernet packets are
not looped back to the vport and are forwarded to the next routing
level (eswitch, or multihost switch, or out to the wire depending on
the configuration).

Linux commits:
c85023e153e3824661d07307138fdeff41f6d86a
8978cc921fc7fad3f4d6f91f1da01352aeeeff25

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5: Implement mlx5_nic_vport_update_local_lb()
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:15 +0000 (16:20 +0100)]
mlx5: Implement mlx5_nic_vport_update_local_lb()

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Create TIRs before flowtables.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:14 +0000 (16:20 +0100)]
mlx5en: Create TIRs before flowtables.

Because flowtables may redirect traffic to TIRs.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Create flowtables in correct order.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:14 +0000 (16:20 +0100)]
mlx5en: Create flowtables in correct order.

Because it affects how the flow tables may re-direct traffic.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5: Implement flow steering helper functions for TCP sockets.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:13 +0000 (16:20 +0100)]
mlx5: Implement flow steering helper functions for TCP sockets.

This change adds convenience functions to setup a flow steering rule based on
a TCP socket. The helper function gets all the address information from the
socket and returns a steering rule, to be used with HW TLS RX offload.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5: Implement offloads flowtable namespace.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:13 +0000 (16:20 +0100)]
mlx5: Implement offloads flowtable namespace.

This namespace will be used for TCP offloads, like hardware decryption
of TLS TCP data.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Create and destroy all flow tables and rules when the network interface attac...
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:12 +0000 (16:20 +0100)]
mlx5en: Create and destroy all flow tables and rules when the network interface attaches and detaches.

Previously flow steering tables and rules were only created and destroyed
at link up and down events, respectivly. Due to new requirements for adding
TLS RX flow tables and rules, the main flow steering table must always be
available as there are permanent redirections from the TLS RX flow table
to the vlan flow table.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Add race protection for SQ remap
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:12 +0000 (16:20 +0100)]
mlx5en: Add race protection for SQ remap

Add a refcount for posted WQEs to avoid a race between
post WQE and FW command flows.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Properly account for no-checksum on tunneled packets.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:12 +0000 (16:20 +0100)]
mlx5en: Properly account for no-checksum on tunneled packets.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Force all packets through the indirection table.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:11 +0000 (16:20 +0100)]
mlx5en: Force all packets through the indirection table.

All packets must go through the indirection table, RQT,
because it is not possible to modify the RQN of the TIR
for direct dispatchment after it is created, typically
when the link goes up and down.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5/mlx5en: Add SQ remap support
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:11 +0000 (16:20 +0100)]
mlx5/mlx5en: Add SQ remap support

Add support to map an SQ to a specific schedule queue using a
special WQE as performance enhancement.

SQ remap operation is handled by a privileged internal queue, IQ,
and the mapping is enabled from one rate to another.

The transition from paced to non-paced should however always go
through FW.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5: Properly define the reg_umr_sq networking offload capability bit.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:10 +0000 (16:20 +0100)]
mlx5: Properly define the reg_umr_sq networking offload capability bit.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Only delete installed VxLAN rules.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:10 +0000 (16:20 +0100)]
mlx5en: Only delete installed VxLAN rules.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Fix inverted logical assignment.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:10 +0000 (16:20 +0100)]
mlx5en: Fix inverted logical assignment.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Implement support for internal queues, IQ.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:09 +0000 (16:20 +0100)]
mlx5en: Implement support for internal queues, IQ.

Internal send queues are regular sendqueues which are reserved for WQE commands
towards the hardware and firmware. These queues typically carry resync
information for ongoing TLS RX connections and when changing schedule queues
for rate limited connections.

The internal queue, IQ, code is more or less a stripped down copy
of the existing SQ managing code with exception of:

1) An optional single segment memory buffer which can be read or
   written as a whole by the hardware, may be provided.
2) An optional completion callback for all transmit operations, may
   be provided.
3) Does not support mbufs.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Implement helper functions to open and close TLS TIR context.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:09 +0000 (16:20 +0100)]
mlx5en: Implement helper functions to open and close TLS TIR context.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Share DEK objects with TLS RX.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:08 +0000 (16:20 +0100)]
mlx5en: Share DEK objects with TLS RX.

The TLS RX support also needs to be able to allocate DEK objects.
Share the available objects 1:1.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Add missing TLS structure prototype.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:08 +0000 (16:20 +0100)]
mlx5en: Add missing TLS structure prototype.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Remove unused hardware TLS field.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:08 +0000 (16:20 +0100)]
mlx5en: Remove unused hardware TLS field.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Make the receive packet indirection table, RQT, static instead of dynamic.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:07 +0000 (16:20 +0100)]
mlx5en: Make the receive packet indirection table, RQT, static instead of dynamic.

Allocate the RQT once, pointing all initial entries to the drop RQN.
When opening the channels simplify modify the RQT, directing all traffic
to the new RQNs. Similarly when closing the channels point all RQT entries
back to the so-called drop RQN.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Set CQN in RQ parameters for drop RQ.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:07 +0000 (16:20 +0100)]
mlx5en: Set CQN in RQ parameters for drop RQ.

Else creating the drop RQ fails.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Set channel pointer for drop receive queue.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:06 +0000 (16:20 +0100)]
mlx5en: Set channel pointer for drop receive queue.

A valid channel pointer is needed to get the priv pointer during init.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Print error code when opening drop RQ fails.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:06 +0000 (16:20 +0100)]
mlx5en: Print error code when opening drop RQ fails.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Implement dummy receive queue, RQ, for dropping packets.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:06 +0000 (16:20 +0100)]
mlx5en: Implement dummy receive queue, RQ, for dropping packets.

What is a drop RQ and why is it needed?

The RSS indirection table, also called the RQT, selects the
destination RQ based on the receive queue number, RQN. The RQT is
frequently referred to by flow steering rules to distribute traffic
among multiple RQs. The problem is that the RQs cannot be destroyed
before the RQT referring them is destroyed too. Further, TLS RX
rules may still be referring to the RQT even if the link went
down. Because there is no magic RQN for dropping packets, we create
a dummy RQ, also called drop RQ, which sole purpose is to drop all
received packets. When the link goes down this RQN is filled in all
RQT entries, of the main RQT, so the real RQs which are about to be
destroyed can be released and the TLS RX rules can be sustained.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Make the hw_lro parameter read only tunable.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:05 +0000 (16:20 +0100)]
mlx5en: Make the hw_lro parameter read only tunable.

This prevents the so-called TIR context from changing during runtime.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5: Remove support for FreeBSD 10 and older.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:05 +0000 (16:20 +0100)]
mlx5: Remove support for FreeBSD 10 and older.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Patch to inhibit transmit doorbell writes during packet reception.
Hans Petter Selasky [Tue, 1 Feb 2022 15:20:04 +0000 (16:20 +0100)]
mlx5en: Patch to inhibit transmit doorbell writes during packet reception.

During packet reception the network stack frequently transmit data in
response to TCP window updates. To reduce the number of transmit doorbells
needed, inhibit all transmit doorbells designated for the same channel until
after the reception of packets for the given channel is completed.

While at it slightly refactor the mlx5e_tx_notify_hw() function:

1) The doorbell information is always stored into sq->doorbell.d64 .
No need to pass a separate pointer to this variable.

2) Move checks for skipping doorbell writes inside this function.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: Use a UMA cache zone for managing TLS send tags
Konstantin Belousov [Mon, 15 Nov 2021 17:37:08 +0000 (19:37 +0200)]
mlx5en: Use a UMA cache zone for managing TLS send tags

Instead of allocating directly from a normal zone. This way
import and release are guaranteed to process all allocated and then
deallocated items. Also, the release occurs in a sleepable context when
caller of uma_zfree() or uma_zdestroy() can sleep itself.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5ib: idiomatic use of preprocessor, in particular paths
Konstantin Belousov [Mon, 14 Jun 2021 11:10:30 +0000 (14:10 +0300)]
mlx5ib: idiomatic use of preprocessor, in particular paths

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5ib: normalize use of the opt_*.h files
Konstantin Belousov [Mon, 14 Jun 2021 10:29:39 +0000 (13:29 +0300)]
mlx5ib: normalize use of the opt_*.h files

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: idiomatic use of preprocessor, in particular paths
Konstantin Belousov [Mon, 14 Jun 2021 10:43:44 +0000 (13:43 +0300)]
mlx5en: idiomatic use of preprocessor, in particular paths

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5en: normalize use of the opt_*.h files
Konstantin Belousov [Mon, 14 Jun 2021 08:05:13 +0000 (11:05 +0300)]
mlx5en: normalize use of the opt_*.h files

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5: idiomatic use of preprocessor, in particular paths
Hans Petter Selasky [Tue, 1 Feb 2022 10:49:42 +0000 (11:49 +0100)]
mlx5: idiomatic use of preprocessor, in particular paths

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomlx5: normalize use of the opt_*.h files
Konstantin Belousov [Mon, 14 Jun 2021 10:26:03 +0000 (13:26 +0300)]
mlx5: normalize use of the opt_*.h files

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoAdd the Arm SPE interrupt to acpidump
Andrew Turner [Tue, 1 Feb 2022 11:43:13 +0000 (11:43 +0000)]
Add the Arm SPE interrupt to acpidump

To support the Arm Statistical Profiling Extension (SPE) ACPI 6.3 added
a place to hold the SPE interrupt. Add to acpidump to show when printing
the Arm Generic Interrupt data.

Sponsored by: The FreeBSD Foundation

2 years agoufs, msdosfs: do not record witness order when creating vnode
Konstantin Belousov [Tue, 1 Feb 2022 05:16:30 +0000 (07:16 +0200)]
ufs, msdosfs: do not record witness order when creating vnode

When allocating new vnode, we need to lock it exclusively before
making it externally visible.  Since other threads cannot observe the
vnode yet, current lock order cannot create LoR conditions.

Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34126

2 years agomsdosfs_denode.c: some style
Konstantin Belousov [Tue, 1 Feb 2022 05:15:56 +0000 (07:15 +0200)]
msdosfs_denode.c: some style

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

2 years agoffs: lock buffers after snaplk with LK_NOWITNESS
Konstantin Belousov [Fri, 28 Jan 2022 04:42:33 +0000 (06:42 +0200)]
ffs: lock buffers after snaplk with LK_NOWITNESS

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34073

2 years agoAdd GB_NOWITNESS flag
Konstantin Belousov [Fri, 28 Jan 2022 04:37:23 +0000 (06:37 +0200)]
Add GB_NOWITNESS flag

It prevents WITNESS from recording the lock order for the buffer lock
acquired by getblkx().

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34073

2 years agoffs_alloc.c: order includes alphabetically
Konstantin Belousov [Fri, 28 Jan 2022 04:36:50 +0000 (06:36 +0200)]
ffs_alloc.c: order includes alphabetically

Reviewed by: mckusick
Discussed with: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34073

2 years agovm/vm_extern.h, vm/vm_page.h: use sys/kassert.h
Konstantin Belousov [Sat, 29 Jan 2022 03:39:30 +0000 (05:39 +0200)]
vm/vm_extern.h, vm/vm_page.h: use sys/kassert.h

instead of fatty sys/systm.h.

Suggested by: jhb
Reviewed by: alc, imp, jhb (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34089

2 years agovm/vm_pager.h: use sys/systm.h header
Konstantin Belousov [Tue, 1 Feb 2022 03:54:26 +0000 (05:54 +0200)]
vm/vm_pager.h: use sys/systm.h header

it is needed for __read_mostly attribute definition, which right now
comes from vm/vm_page.h including sys/systm.h

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34089

2 years agoIntroduce sys/kassert.h
Konstantin Belousov [Sat, 29 Jan 2022 03:37:15 +0000 (05:37 +0200)]
Introduce sys/kassert.h

It contains assert-related definitions previously provided by
sys/systm.h.  The new header is leaner than whole systm.h.
Include kassert.h from systm.h for compatibility.

The copyright assignment to Eivind Eklund was suggested by Kirk McKusick
and is based in the commit 5526d2d920eb17b1507499f35b275b486f7fe8d0.

Suggested by: jhb
Reviewed by: alc, imp, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34089

2 years agofstyp: Remove __packed from struct exfat_de_label.
John Baldwin [Tue, 1 Feb 2022 01:33:31 +0000 (17:33 -0800)]
fstyp: Remove __packed from struct exfat_de_label.

This fixes a -Waddress-of-packed-member warning about a possibly
unaligned pointer from GCC 9 when calling convert_label().

__packed has to be removed from struct exfat_dirent as well to fix an
alignment warning when casting from a struct exfat_dirent pointer to a
struct exfat_de_label pointer.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D32144

2 years agoggatec: Use ANSI C definition for init_initial_buffer_size.
John Baldwin [Tue, 1 Feb 2022 01:12:04 +0000 (17:12 -0800)]
ggatec: Use ANSI C definition for init_initial_buffer_size.

This fixes -Wstrict-prototypes and -Wold-style-definition warnings
from GCC 9.

2 years agohyperv storvsc: Don't abuse struct sglist to hold virtual addresses.
John Baldwin [Tue, 1 Feb 2022 01:11:27 +0000 (17:11 -0800)]
hyperv storvsc: Don't abuse struct sglist to hold virtual addresses.

struct sglist is intended for holding S/G lists of physical address
ranges, not virtual address ranges.  GCC 9.x issues several warnings
due to casts between pointers and integers of different sizes as a
result (vm_paddr_t is 64-bits on i386).  Instead, add a local 'struct
hv_sglist' which uses an array of 'struct iovec' to hold the S/G list
of virtual address ranges.

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

2 years agotcp_ratelimit: Handle some edge cases with TLS + RL send tags.
John Baldwin [Tue, 1 Feb 2022 00:40:04 +0000 (16:40 -0800)]
tcp_ratelimit: Handle some edge cases with TLS + RL send tags.

- After a connection has fallen back from NIC TLS to SW TLS, any
  pacing rate changes should modify the inpcb send tag even though
  SB_TLS_IFNET is set.

- If a connection tries to modify the pacing rate before the send
  tag has been converted from plain TLS to TLS + RL, don't fail
  the rate request set but let it fall through to setting the rate
  on the non-TLS inpcb RL tag.

Reviewed by: gallatin, rrs, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34085

2 years agoktls: Try to enable TOE TLS after marking existing data not ready.
John Baldwin [Tue, 1 Feb 2022 00:39:21 +0000 (16:39 -0800)]
ktls: Try to enable TOE TLS after marking existing data not ready.

At the moment this is mostly a no-op but in the future there will be
in-flight encrypted data which requires software decryption.  This
same setup is also needed for NIC TLS RX.

Note that this does break TOE TLS RX for AES-CBC ciphers since there
is no software fallback for AES-CBC receive.  This will be resolved
one way or another before 14.0 is released.

Reviewed by: hselasky
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34082

2 years agoFix minor grammar nit.
Gordon Tetlow [Mon, 31 Jan 2022 23:35:23 +0000 (15:35 -0800)]
Fix minor grammar nit.

2 years agossh: remove unused header
Ed Maste [Mon, 31 Jan 2022 22:14:12 +0000 (17:14 -0500)]
ssh: remove unused header

Fixes: 0746301c4995 ("ssh: pass 0 to procctl(2) to operate...")
Sponsored by: The FreeBSD Foundation

2 years agopf: Initialize pf_kpool mutexes earlier
Mark Johnston [Mon, 31 Jan 2022 21:14:00 +0000 (16:14 -0500)]
pf: Initialize pf_kpool mutexes earlier

There are some error paths in ioctl handlers that will call
pf_krule_free() before the rule's rpool.mtx field is initialized,
causing a panic with INVARIANTS enabled.

Fix the problem by introducing pf_krule_alloc() and initializing the
mutex there.  This does mean that the rule->krule and pool->kpool
conversion functions need to stop zeroing the input structure, but I
don't see a nicer way to handle this except perhaps by guarding the
mtx_destroy() with a mtx_initialized() check.

Constify some related functions while here and add a regression test
based on a syzkaller reproducer.

Reported by: syzbot+77cd12872691d219c158@syzkaller.appspotmail.com
Reviewed by: kp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34115

2 years agobhyve/virtio: use correct device id for virtio-scsi
Robert Wing [Mon, 31 Jan 2022 18:44:47 +0000 (09:44 -0900)]
bhyve/virtio: use correct device id for virtio-scsi

Section 4.1.2.1 of the virtio spec states that the transitional PCI
device id for a scsi device is 0x1004.

Fix suggested by reporter.

PR:             259961
Reported by:    me@nanaya.pro
Reviewed by: imp, jhb
Fixes: f9c005a17f4e ("Add bhyve virtio-scsi storage backend support.")
Differential Revision: https://reviews.freebsd.org/D34103

2 years agofix casting issue in error message for 32bit CPUs (e.g. armv7)
Wolfram Schneider [Mon, 31 Jan 2022 18:30:07 +0000 (18:30 +0000)]
fix casting issue in error message for 32bit CPUs (e.g. armv7)

2 years agolibpfctl: fix pfctl_kill_states()
Kristof Provost [Mon, 31 Jan 2022 17:31:53 +0000 (18:31 +0100)]
libpfctl: fix pfctl_kill_states()

735748f30a changed the output of the states so that the creator id
endianness would be consistent. This means that we need to convert the
host endianness creatorid back to big-endian before we give it to the
kernel.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agocleanup documentation
Wolfram Schneider [Mon, 31 Jan 2022 18:11:14 +0000 (18:11 +0000)]
cleanup documentation