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

2 years agothrow an error if reading from stdin failed
Wolfram Schneider [Mon, 31 Jan 2022 18:04:45 +0000 (18:04 +0000)]
throw an error if reading from stdin failed

2 years agoenable to configure the locate path length at compile time
Wolfram Schneider [Mon, 31 Jan 2022 17:32:46 +0000 (17:32 +0000)]
enable to configure the locate path length at compile time

The length has not changed and is 1024 chars (equals PATH_MAX).

PR: 201243
Submitted by: Willem Jan Withagen <wjw@digiware.nl>

2 years agoFix statistics for empty databases
Wolfram Schneider [Mon, 31 Jan 2022 17:03:08 +0000 (17:03 +0000)]
Fix statistics for empty databases

An empty database is a database which does not contain any filenames.
It should not occur in practice but maybe in the case of an error.

echo | /usr/libexec/locate.mklocatedb > empty.db; locate -d empty.db -S

2 years agoinsmntque(9): update and correct man page
Konstantin Belousov [Sat, 29 Jan 2022 00:55:28 +0000 (02:55 +0200)]
insmntque(9): update and correct man page

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D34071

2 years agoinsmntque1(): remove useless arguments
Konstantin Belousov [Fri, 28 Jan 2022 00:57:09 +0000 (02:57 +0200)]
insmntque1(): remove useless arguments

Also remove once-used functions to clean up after failed insmntque1(),
which were destructor callbacks in previous life.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D34071

2 years agoremove register
Wolfram Schneider [Mon, 31 Jan 2022 10:59:07 +0000 (10:59 +0000)]
remove register

There are no measurable performance differences if registers are used or not.

2 years agoenetc: Wait for pending transmissions before disabling TX queues
Kornel Duleba [Thu, 27 Jan 2022 10:25:25 +0000 (11:25 +0100)]
enetc: Wait for pending transmissions before disabling TX queues

According to the RM it's not safe to disable a TX ring while it is busy
transmitting frames.
In order to be safe wait until the ring is empty. (cidx==pidx)
Use this opportunity to remove a set-but-unused variable.

Obtained from: Semihalf
Sponsored by: Alstom Group

2 years agoenetc: Simply TX ring credits counting logic
Kornel Duleba [Thu, 27 Jan 2022 09:24:26 +0000 (10:24 +0100)]
enetc: Simply TX ring credits counting logic

According to the RM rings can hold at most ring_size - 1 descriptors at any time.
No additional logic is needed since iflib already respects this constrain.
Thanks to that the pidx == cidx situation is not ambiguous and indicates an
empty ring.
Use that to simplify the logic that calculates the amount of processed frames.

Obtained from: Semihalf
Sponsored by: Alstom Group

2 years agoenetc: Disable HW IP packet alignment
Kornel Duleba [Thu, 27 Jan 2022 08:26:07 +0000 (09:26 +0100)]
enetc: Disable HW IP packet alignment

The NIC can IP align received packets.
It was observed that it caused some rare stalls, that required full board reset.
Disable this feature for now. It doesn't provide any significant performance
improvement anyway.

Obtained from: Semihalf
Sponsored by: Alstom Group

2 years agoufs: be more persistent with finishing some operations
Konstantin Belousov [Tue, 18 Jan 2022 01:49:36 +0000 (03:49 +0200)]
ufs: be more persistent with finishing some operations

when the vnode is doomed after relock.  The mere fact that the vnode is
doomed does not prevent us from doing UFS operations on it while it is
still belongs to UFS, which is determined by non-NULL v_data.  Not
finishing some operations, e.g. not syncing the inode block only because
the vnode started reclamation, is not correct.

Add macro IS_UFS() which incapsulates the v_data != NULL, and use it
instead of VN_IS_DOOMED() for places where the operation completion is
important.

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

2 years agoffs_snapblkfree(): add a comment explaining lockmgr invocation
Konstantin Belousov [Sun, 23 Jan 2022 00:33:18 +0000 (02:33 +0200)]
ffs_snapblkfree(): add a comment explaining lockmgr invocation

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

2 years agoufs: Use IS_SNAPSHOT()
Konstantin Belousov [Thu, 20 Jan 2022 13:17:59 +0000 (15:17 +0200)]
ufs: Use IS_SNAPSHOT()

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

2 years agosyncer VOP_FSYNC(): unlock syncer vnode around call to VFS_SYNC()
Konstantin Belousov [Fri, 21 Jan 2022 15:42:28 +0000 (17:42 +0200)]
syncer VOP_FSYNC(): unlock syncer vnode around call to VFS_SYNC()

The lock is unneccessary since the mount point is busied, which prevents
unmount and syncer vnode deallocation.  Having the vnode locked causes
innocent LoRs and complicates debugging.

Also stop starting write accounting around it.  Any caller of
VOP_FSYNC() must do it already, and sync_vnode() does.

Reported and tested by: pho
Reviewed by: markj, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34072

2 years agobuf_alloc(): lock the buffer with LK_NOWAIT
Konstantin Belousov [Tue, 18 Jan 2022 01:39:05 +0000 (03:39 +0200)]
buf_alloc(): lock the buffer with LK_NOWAIT

The buffer must not be accessed by any other thread, it is freshly
allocated.  As such, LK_NOWAIT should be nop but also it prevents
recording the order between the buffer lock and any other locks we might
own in the call to getnewbuf().  In particular, if we own FFS snap lock,
it should avoid triggering false positive warning.

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

2 years agoUse dedicated lock name for pbufs
Konstantin Belousov [Sun, 23 Jan 2022 00:24:12 +0000 (02:24 +0200)]
Use dedicated lock name for pbufs

Also remove a pointer to array variable, use array address directly.

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

2 years agoext2fs: remove remnants of the UFS snapshot code
Konstantin Belousov [Sun, 30 Jan 2022 01:52:27 +0000 (03:52 +0200)]
ext2fs: remove remnants of the UFS snapshot code

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

2 years agoIn GEOM debugging output, show consumer for cloned and duplicated bio's.
Kirk McKusick [Mon, 31 Jan 2022 01:20:10 +0000 (17:20 -0800)]
In GEOM debugging output, show consumer for cloned and duplicated bio's.

When using bio's created by g_clone_bio() or g_duplicate_bio()
their consumer device (the device to which their I/O requests
are sent) is listed by the geom debugging facility as [unknown].
If available, this update lists the consumer associated with
the bio's parent.

MFC after:    2 weeks
Sponsored by: Netflix

2 years agoUpdate commit instructions. Still more TBD as I plan out the first
Gregory Neil Shapiro [Sun, 30 Jan 2022 22:20:12 +0000 (22:20 +0000)]
Update commit instructions.  Still more TBD as I plan out the first
git-based vendor import.

2 years agoObsoleteFiles: move libelf.so.2 to MOVED_LIBS
Ed Maste [Sun, 30 Jan 2022 21:34:07 +0000 (16:34 -0500)]
ObsoleteFiles: move libelf.so.2 to MOVED_LIBS

5a536241ea2b moved it from /usr/lib to /lib.  This case is now handled
using MOVED_LIBS.

Reported by: dim
Sponsored by: The FreeBSD Foundation

2 years agoApply clang fix for assertion failure compiling science/chrono
Dimitry Andric [Sun, 30 Jan 2022 20:41:24 +0000 (21:41 +0100)]
Apply clang fix for assertion failure compiling science/chrono

Merge commit 6b0f35931a44 from llvm git (by Jennifer Yu):

  Fix signal during the call to checkOpenMPLoop.

  The root problem is a null pointer is accessed during the call to
  checkOpenMPLoop, because loop up bound expr is an error expression
  due to error diagnostic was emit early.

  To fix this, in setLCDeclAndLB, setUB and setStep instead return false,
  return true when LB, UB or Step contains Error, so that the checking is
  stopped in checkOpenMPLoop.

  Differential Revision: https://reviews.llvm.org/D107385

Note this only fixes the assertion reported in bug 261567; some other
tweaks for port dependencies are probably still required to make it
build to completion.

PR: 261567
MFC after: 3 days

2 years agoimprove error handling for corrupt database
Wolfram Schneider [Sun, 30 Jan 2022 18:04:52 +0000 (18:04 +0000)]
improve error handling for corrupt database

2 years agofix check for integer
Wolfram Schneider [Sun, 30 Jan 2022 16:27:27 +0000 (16:27 +0000)]
fix check for integer

For historical reasons, the integer is stored with an offset of plus 14.
That means, for a given max path length of 1024 the valid values
are -1009 .. 1037 and not -1023 .. 1023

PR: 201243

2 years agoenable to set locate command
Wolfram Schneider [Sun, 30 Jan 2022 16:24:49 +0000 (16:24 +0000)]
enable to set locate command

2 years agofix fgets error handling (from last commit)
Wolfram Schneider [Sun, 30 Jan 2022 13:08:42 +0000 (13:08 +0000)]
fix fgets error handling (from last commit)

2 years agoimprove error handling
Wolfram Schneider [Sun, 30 Jan 2022 09:27:21 +0000 (09:27 +0000)]
improve error handling

2 years agounionfs: use VV_ROOT to check for root vnode in unionfs_lock()
Jason A. Harmening [Mon, 17 Jan 2022 01:03:54 +0000 (17:03 -0800)]
unionfs: use VV_ROOT to check for root vnode in unionfs_lock()

This avoids a potentially wild reference to the mount object.
Additionally, simplify some of the checks around VV_ROOT in
unionfs_nodeget().

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D33914

2 years agoGEOM: Remove g_wait_sim.
Alexander Motin [Sun, 30 Jan 2022 03:12:43 +0000 (22:12 -0500)]
GEOM: Remove g_wait_sim.

It seems never been used since addition.

2 years agoGEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers.
Alexander Motin [Sun, 30 Jan 2022 02:59:03 +0000 (21:59 -0500)]
GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers.

All I/O requests through the taste consumers are synchronous, done
with g_read_data() and without any locks held.  It makes no sense
to delegate the I/O to g_down/g_up threads.

This removes many of context switches during disk retaste.

MFC after: 2 weeks

2 years agobhyve nvme: Fix Identify Namespace, NSID=ffffffff
Chuck Tuffli [Sun, 30 Jan 2022 07:11:14 +0000 (23:11 -0800)]
bhyve nvme: Fix Identify Namespace, NSID=ffffffff

If the NVMe Controller doesn't support Namespace Management, it should
return "Invalid Namespace or Format" when the Host request Identify
Namespace with the global NSID value.

Fixes UNH IOL 16.0 Test 9.1, Case 6

Reviewed by: imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33578

2 years agobhyve nvme: Fix Set Features, AEN
Chuck Tuffli [Sun, 30 Jan 2022 07:10:59 +0000 (23:10 -0800)]
bhyve nvme: Fix Set Features, AEN

NVMe Controllers which do not support Endurance Groups must return an
error when the Endurance Group Event Aggregate Log Change Notices bit is
set in Set Features, Asynchronous Event Configuration.

Fixes UNH IOL Test 3.12, Case 8

Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33577

2 years agobhyve nvme: Fix reported VWC value
Chuck Tuffli [Sun, 30 Jan 2022 07:10:42 +0000 (23:10 -0800)]
bhyve nvme: Fix reported VWC value

v1.4 and later NVMe Controllers report "Flush all Namespaces" support
differently.

Fixes UNH IOL 16.0 Test 2.6, Case 3

Reviewed by: imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33576

2 years agobhyve nvme: Fix LBA out-of-range calculation
Chuck Tuffli [Sun, 30 Jan 2022 07:09:57 +0000 (23:09 -0800)]
bhyve nvme: Fix LBA out-of-range calculation

The function which checks for a valid LBA range mistakenly named an
input value as NLB ("Number of Logical Blocks") instead of "number of
blocks". The NVMe specification defines NLB as a zero-based value (i.e.
NLB=0x0 represents 1 block, 0x1 is 2 blocks, etc.), but the passed
parameter is a 1's-based value.

Fix is to rename the variable to avoid future confusion.

While in the neighborhood, also check that the starting LBA is less than
the size of the backing storage to avoid an integer overflow.

Reviewed by: imp, allanjude, jhb
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33575

2 years agobhyve nvme: Add Select support to Get Features
Chuck Tuffli [Sun, 30 Jan 2022 07:09:35 +0000 (23:09 -0800)]
bhyve nvme: Add Select support to Get Features

Implement basic support for the SEL field of Get Features. This returns
information about Namespace Specific features.

Fixes UNH ILO 16.0 Test 1.2, Case 13

Reviewed by: imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33574

2 years agobhyve nvme: Update v1.4 Identify Controller data
Chuck Tuffli [Sun, 30 Jan 2022 07:09:10 +0000 (23:09 -0800)]
bhyve nvme: Update v1.4 Identify Controller data

Compliant v1.4 Controllers must report a Controller Type (CNTRLTYPE).
Also, do not advertise secure erase functionality in the Format NVM
Attributes field of the Identify Controller data structure as the
Controller does not implement secure erase.

Fixes UNH ILO Test 1.1, Case 2

Reviewed by: imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33573

2 years agobhyve nvme: Add Temperature Threshold support
Chuck Tuffli [Sun, 30 Jan 2022 07:08:47 +0000 (23:08 -0800)]
bhyve nvme: Add Temperature Threshold support

This adds the ability for a guest OS to send Set / Get Feature,
Temperature Threshold commands. The implementation assumes a constant
temperature and will generate an Asynchronous Event Notification if the
specified threshold is above/below this value. Although the
specification allows 9 temperature values, this implementation only
implements the Composite Temperature.

While in the neighborhood, move the clear of the CSTS register in the
reset function after all other cleanup. This avoids a race with the
guest thinking the reset is complete (i.e. CSTS.RDY = 0) before the NVMe
emulation is actually complete with the reset.

Fixes UNH IOL 16.0 Test 1.7, cases 1, 2, and 4.

Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33572

2 years agobhyve nvme: Fix Set Features
Chuck Tuffli [Sun, 30 Jan 2022 07:07:44 +0000 (23:07 -0800)]
bhyve nvme: Fix Set Features

Be more conservative and only support the Features mandatory for an I/O
Controller.

Avoids a "hang" in UNH test 1.2.10 associated with Predictable Latency
Mode Configuration and Host Behavior Support features.

Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33571

2 years agobhyve nvme: Remove redundant AER Limit checks
Chuck Tuffli [Sun, 30 Jan 2022 07:07:29 +0000 (23:07 -0800)]
bhyve nvme: Remove redundant AER Limit checks

The NVMe emulation checked if the Asynchronous Event Request Limit
(a.k.a AERL) would be exceeded in pci_nvme_aer_add(), but this function
is only called from nvme_opc_async_event_req() which also checks for
exceeding the AERL.

Reviewed by: imp, allanjude
Tested by:      jason@tubnor.net
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33570