]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoAdd new USB host controller PCI ID's.
Hans Petter Selasky [Sun, 6 Feb 2022 12:14:27 +0000 (13:14 +0100)]
Add new USB host controller PCI ID's.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agodma: use canonical getline() loop
Ed Maste [Thu, 3 Feb 2022 18:51:06 +0000 (13:51 -0500)]
dma: use canonical getline() loop

getline() returns -1 on erorr or EOF, so use that condition instead of
feof() and check that there was no error after the loop exits.

Reviewed by: bapt, kevans (both earlier)
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34159

2 years agoffs_read(): lock buffers after snaplk with LK_NOWITNESS
Konstantin Belousov [Sat, 5 Feb 2022 02:03:47 +0000 (04:03 +0200)]
ffs_read(): lock buffers after snaplk with LK_NOWITNESS

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

2 years agovendor/bc: import release 5.2.2
Stefan Eßer [Sat, 5 Feb 2022 21:26:36 +0000 (22:26 +0100)]
vendor/bc: import release 5.2.2

This release assigns a default value to the internal program name
variable in case the program is invoked with argv[0] == NULL.

There was no security issue: the prevuous program version would have
been immediately terminated due to a NULL dereference.

2 years agodmesg: detect wrapped msgbuf on the kernel side and if so, skip first line
Gleb Smirnoff [Sat, 5 Feb 2022 21:25:38 +0000 (13:25 -0800)]
dmesg: detect wrapped msgbuf on the kernel side and if so, skip first line

Since 59f256ec35d3 dmesg(8) will always skip first line of the message
buffer, cause it might be incomplete.  The problem is that in most cases
it is complete, valid and contains the "---<<BOOT>>---" marker.  This
skip can be disabled with '-a', but that would also unhide all non-kernel
messages.  Move this functionality from dmesg(8) to kernel, since kernel
actually knows if wrap has happened or not.

The main motivation for the change is not actually the value of the
"---<<BOOT>>---" marker.  The problem breaks unit tests, that clear
message buffer, perform a test and then check the message buffer for
a result.  Example of such test is sys/kern/sonewconn_overflow.

2 years agoUpdate to bmake-20220204
Simon J. Gerraty [Sat, 5 Feb 2022 20:29:10 +0000 (12:29 -0800)]
Update to bmake-20220204

2 years agoMerge bmake-20220204
Simon J. Gerraty [Sat, 5 Feb 2022 20:26:16 +0000 (12:26 -0800)]
Merge bmake-20220204

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 20:04:00 +0000 (20:04 +0000)]
update external URL

2 years agoImport bmake-20220204
Simon J. Gerraty [Sat, 5 Feb 2022 20:03:50 +0000 (12:03 -0800)]
Import bmake-20220204

Features of interest:

Allow setting target local variables (similar to gmake)

In META_MODE .MAKE.META.CMP_FILTER can be used for filtering commands
before comparion.

contrib/bmake/mk/cc-wrap.mk is an example of using these

See ChangeLog for the gory details.

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:54:59 +0000 (19:54 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:49:46 +0000 (19:49 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:43:03 +0000 (19:43 +0000)]
update external URL

2 years agoremove defunct Sundance URL
Wolfram Schneider [Sat, 5 Feb 2022 19:41:28 +0000 (19:41 +0000)]
remove defunct Sundance URL

2 years agoremove defunct Ralink Technology URL
Wolfram Schneider [Sat, 5 Feb 2022 19:39:18 +0000 (19:39 +0000)]
remove defunct Ralink Technology URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:23:51 +0000 (19:23 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:19:43 +0000 (19:19 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:17:33 +0000 (19:17 +0000)]
update external URL

2 years agoremove defunct National Semiconductor URL
Wolfram Schneider [Sat, 5 Feb 2022 18:44:52 +0000 (18:44 +0000)]
remove defunct National Semiconductor URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 18:32:38 +0000 (18:32 +0000)]
update external URL

2 years agoupdate URL
Wolfram Schneider [Sat, 5 Feb 2022 18:30:06 +0000 (18:30 +0000)]
update URL

2 years agoupdate URL
Wolfram Schneider [Sat, 5 Feb 2022 17:35:24 +0000 (17:35 +0000)]
update URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 17:14:27 +0000 (17:14 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 17:11:18 +0000 (17:11 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 17:09:48 +0000 (17:09 +0000)]
update external URL

2 years agotcp: use TCPSTAT_INC in kernel ecn functions
Richard Scheffenegger [Sat, 5 Feb 2022 15:50:21 +0000 (16:50 +0100)]
tcp: use TCPSTAT_INC in kernel ecn functions

Incorrectly used KMOD_ marco in static kernel ECN functions.

Both eventually resolve to counter_s64_add(), but better
use the correct macros.

Reviewed By: tuexen, #transport
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34181

2 years agoif_vtnet(4): Restore the ability to set promisc mode.
Aleksandr Fedorov [Sat, 5 Feb 2022 15:47:46 +0000 (18:47 +0300)]
if_vtnet(4): Restore the ability to set promisc mode.

PR: 254343, 255054
Reviewed by: vmaffione (mentor), donner
Approved by: vmaffione (mentor), donner
MFC after: 2 weeks
Sponsored by: vstack.com
Differential Revision: https://reviews.freebsd.org/D30639

2 years agotcp: move ECN handling code to a common file
Richard Scheffenegger [Sat, 5 Feb 2022 13:59:00 +0000 (14:59 +0100)]
tcp: move ECN handling code to a common file

Reduce the burden to maintain correct and
extensible ECN related code across multiple
stacks and codepaths.

Formally no functional change.

Incidentially this establishes correct
ECN operation in one instance.

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

2 years agolibc: add helper furnction to set sysctl() user.* variables
Stefan Eßer [Sat, 5 Feb 2022 12:33:53 +0000 (13:33 +0100)]
libc: add helper furnction to set sysctl() user.* variables

Testing had revealed that trying to retrieve the user.localbase
variable into to small a buffer would return the correct error code,
but would not fill the available buffer space with a partial result.

A partial result is of no use, but this is still a violation of the
documented behavior, which has been fixed in the previous commit to
this function.

I just checked the code for "user.cs_path" and found that it had the
same issue.

Instead of fixing the logic for each user.* sysctl string variable
individually, this commit adds a helper function set_user_str() that
implements the semantics specified in the sysctl() man page.

It is currently only used for "user.cs_path" and "user.localbase",
but it will offer a significant simplification when further such
variables will be added (as I intend to do).

MFC after: 3 days

2 years agopf tests: Only do post-test logging when specifically enabled
Kristof Provost [Tue, 1 Feb 2022 17:33:42 +0000 (18:33 +0100)]
pf tests: Only do post-test logging when specifically enabled

The pf tests have the ability to log state information (pf rules, pf
states, interfaces, ...) on exit (i.e. on success or on error).
This is useful, but only in specific cases. When it's not needed it may
get in the way of clear output.

Test scripts can add 'debug' to the pft_init call to enable this for the
specified test.

Reviewed by: brd
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34133

2 years agopf tests: Test adding counters to an existing table
Kristof Provost [Tue, 1 Feb 2022 17:27:40 +0000 (18:27 +0100)]
pf tests: Test adding counters to an existing table

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34132

2 years agopf: deal with tables gaining or losing counters
Kristof Provost [Tue, 1 Feb 2022 17:25:57 +0000 (18:25 +0100)]
pf: deal with tables gaining or losing counters

When we create a table without counters, add an entry  and later
re-define the table to have counters we wound up trying to read
non-existent counters.

We now cope with this by attempting to add them if needed, removing them
when they're no longer needed and not trying to read from counters that
are not present.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34131

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 09:13:07 +0000 (09:13 +0000)]
update external URL

2 years agofix URL typo
Wolfram Schneider [Sat, 5 Feb 2022 09:08:45 +0000 (09:08 +0000)]
fix URL typo

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 09:00:35 +0000 (09:00 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 08:58:30 +0000 (08:58 +0000)]
update external URL

2 years agostress2: Fix compiler warnings
Peter Holm [Sat, 5 Feb 2022 08:51:11 +0000 (09:51 +0100)]
stress2: Fix compiler warnings

2 years agoswitch from short to int for lookup table
Wolfram Schneider [Sat, 5 Feb 2022 08:44:35 +0000 (08:44 +0000)]
switch from short to int for lookup table

This simplifies the code, less casting is needed.

2 years agoupdate external URLs
Wolfram Schneider [Sat, 5 Feb 2022 08:19:56 +0000 (08:19 +0000)]
update external URLs

2 years agoRevert "tcp: move ECN handling code to a common file"
Richard Scheffenegger [Sat, 5 Feb 2022 00:07:51 +0000 (01:07 +0100)]
Revert "tcp: move ECN handling code to a common file"

This reverts commit 0c424c90eaa6602e07bca7836b1d178b91f2a88a.

2 years agoelfctl: update man page example for 'no' prefix
Ed Maste [Sat, 5 Feb 2022 02:02:44 +0000 (21:02 -0500)]
elfctl: update man page example for 'no' prefix

Reported by: Mark Millard on freebsd-current@
Fixes: c763f99d11fd ("elfctl: prefix disable flags with "no"")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agofusefs: fix the build without INVARIANTS after 00134a07898
Alan Somers [Sat, 5 Feb 2022 01:43:23 +0000 (18:43 -0700)]
fusefs: fix the build without INVARIANTS after 00134a07898

MFC after: 2 weeks
MFC with: 00134a07898fa807b8a1fcb2596f0e3644143f69
Reported by: se

2 years agotcp: move ECN handling code to a common file
Richard Scheffenegger [Fri, 4 Feb 2022 21:25:03 +0000 (22:25 +0100)]
tcp: move ECN handling code to a common file

Reduce the burden to maintain correct and
extensible ECN related code across multiple
stacks and codepaths.

Formally no functional change.

Incidentially this establishes correct
ECN operation in one instance.

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

2 years agoRemove more quotes around Makefile .error/.warn/.info strings.
John Baldwin [Fri, 4 Feb 2022 23:59:00 +0000 (15:59 -0800)]
Remove more quotes around Makefile .error/.warn/.info strings.

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

2 years agolinux_copyout_strings: Use PROC_PS_STRINGS().
John Baldwin [Fri, 4 Feb 2022 23:57:57 +0000 (15:57 -0800)]
linux_copyout_strings: Use PROC_PS_STRINGS().

Reviewed by: markj
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D34173

2 years agobsd.compat.mk: A few cosmetic fixes.
John Baldwin [Fri, 4 Feb 2022 23:57:28 +0000 (15:57 -0800)]
bsd.compat.mk: A few cosmetic fixes.

- Add a missing ')' to a warning.

- Consistently use {} when expanding variables.

- Remove a spurious blank line.

Reviewed by: imp, emaste
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D34172

2 years agocxgbei: Rework parsing of pre-offload PDUs.
John Baldwin [Fri, 4 Feb 2022 23:38:49 +0000 (15:38 -0800)]
cxgbei: Rework parsing of pre-offload PDUs.

sbcut() returns mbufs in reverse order so is not suitable for reading
data from the socket buffer.  Instead, check for already-received data
in the receive worker thread before passing offload PDUs up to the
iSCSI layer.  This uses soreceive() to read data from the socket and
is also to use M_WAITOK since it now runs from a worker thread instead
of an interrupt thread.

Also, fix decoding of the data segment length for pre-offload PDUs.

Reported by: Jithesh Arakkan @ Chelsio
Fixes: a8c4147edcdc cxgbei: Parse all PDUs received prior to enabling offload mode.
Sponsored by: Chelsio Communications

2 years agofusefs: require FUSE_NO_OPENDIR_SUPPORT for NFS exporting
Alan Somers [Mon, 3 Jan 2022 00:16:09 +0000 (17:16 -0700)]
fusefs: require FUSE_NO_OPENDIR_SUPPORT for NFS exporting

FUSE file systems that do not set FUSE_NO_OPENDIR_SUPPORT do not
guarantee that d_off will be valid after closing and reopening a
directory.  That conflicts with NFS's statelessness, that results in
unresolvable bugs when NFS reads large directories, if:

* The file system _does_ change the d_off field for the last directory
  entry previously returned by VOP_READDIR, or
* The file system deletes the last directory entry previously seen by
  NFS.

Rather than doing a poor job of exporting such file systems, it's better
just to refuse.

Even though this is technically a breaking change, 13.0-RELEASE's
NFS-FUSE support was bad enough that an MFC should be allowed.

MFC after: 3 weeks.
Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D33726

2 years agofusefs: optimize NFS readdir for FUSE_NO_OPENDIR_SUPPORT
Alan Somers [Sun, 2 Jan 2022 22:29:50 +0000 (15:29 -0700)]
fusefs: optimize NFS readdir for FUSE_NO_OPENDIR_SUPPORT

In its lowest common denominator, FUSE does not require that a directory
entry's d_off field is valid outside of the lifetime of the directory's
FUSE file handle.  But since NFS is stateless, it must reopen the
directory on every call to VOP_READDIR.  That means reading the
directory all the way from the first entry.  Not only does this create
an O(n^2) condition for large directories, but it can also result in
incorrect behavior if either:

* The file system _does_ change the d_off field for the last directory
  entry previously seen by NFS, or
* The file system deletes the last directory entry previously seen by
  NFS.

Handily, for file systems that set FUSE_NO_OPENDIR_SUPPORT d_off is
guaranteed to be valid for the lifetime of the directory entry, there is
no need to read the directory from the start.

MFC after: 3 weeks
Reviewed by: rmacklem

2 years agoFix NFS exports of FUSE file systems for big directories
Alan Somers [Sun, 2 Jan 2022 17:18:47 +0000 (10:18 -0700)]
Fix NFS exports of FUSE file systems for big directories

The FUSE protocol does not require that a directory entry's d_off field
outlive the lifetime of its directory's file handle.  Since the NFS
server must reopen the directory on every VOP_READDIR call, that means
it can't pass uio->uio_offset down to the FUSE server.  Instead, it must
read the directory from 0 each time.  It may need to issue multiple
FUSE_READDIR operations until it finds the d_off field that it's looking
for.  That was the intention behind SVN r348209 and r297887, but a logic
bug prevented subsequent FUSE_READDIR operations from ever being issued,
rendering large directories incompletely browseable.

MFC after: 3 weeks
Reviewed by: rmacklem

2 years agowhereis: fix fetching of user.cs_path sysctl variable
Stefan Eßer [Fri, 4 Feb 2022 22:37:12 +0000 (23:37 +0100)]
whereis: fix fetching of user.cs_path sysctl variable

The current implementation of sysctlbyname() does not support the user
sub-tree. This function exits with a return value of 0, but sets the
passed string buffer to an empty string.

As a result, the whereis program did not use the value of the sysctl
variable "user.cs_path", but only the value of the environment
variable "PATH".

This update makes whereis use the sysctl function with a fixed OID,
which already supports the user sub-tree.

MFC after: 3 days

2 years agostyle(9): Default to omitting $FreeBSD$
Warner Losh [Fri, 4 Feb 2022 22:38:15 +0000 (15:38 -0700)]
style(9): Default to omitting $FreeBSD$

Advise people to omit $FreeBSD$ (in both comments and macros) unless the
code is definitely going to be merged to stable/12. This strengthens
previous statements and is appropriate now that stable/11 is no longer
supported. If people are wrong and things are unexpected merged to 12,
tags can be added before that merge. No sense adding a tag that will
never be expanded and removed later on the off chance it might wind up
in stable/12.

The next step is likely to weaken this to apply just to mergemaster
managed files, but not today.

Reviewed by: rpokala, cem, erj, hselasky, brooks, kib
Differential Revision: https://reviews.freebsd.org/D34152

2 years agoProperly fix parameter to sysctlnametomib().
Kirk McKusick [Fri, 4 Feb 2022 22:04:12 +0000 (14:04 -0800)]
Properly fix parameter to sysctlnametomib().

2 years agoFix parameter to sysctlnametomib();
Kirk McKusick [Fri, 4 Feb 2022 22:00:38 +0000 (14:00 -0800)]
Fix parameter to sysctlnametomib();

2 years agoHave fsck_ffs(8) properly correct superblock check-hash failures.
Kirk McKusick [Fri, 4 Feb 2022 19:46:36 +0000 (11:46 -0800)]
Have fsck_ffs(8) properly correct superblock check-hash failures.

Part of the problem was that fsck_ffs would read the superblock
multiple times complaining and repairing the superblock check hash
each time and then at the end failing to write out the superblock
with the corrected check hash. This fix reads the superblock just
once and if the check hash is corrected ensures that the fixed
superblock gets written.

Tested by:    Peter Holm
PR:           245916
MFC after:    1 week
Sponsored by: Netflix

2 years agocompiler-rt: re-exec with ASLR disabled when necessary
Ed Maste [Sun, 16 Jan 2022 19:22:05 +0000 (14:22 -0500)]
compiler-rt: re-exec with ASLR disabled when necessary

Some sanitizers (at least msan) currently require ASLR to be disabled.
When we detect that ASLR is enabled, re-exec with it disabled rather
than exiting with an error.  See LLVM GitHub issue 53256 for more
detail: https://github.com/llvm/llvm-project/issues/53256

No objection: dim
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33934

2 years agocompiler-rt: support ReExec() on FreeBSD
Ed Maste [Wed, 19 Jan 2022 18:08:18 +0000 (13:08 -0500)]
compiler-rt: support ReExec() on FreeBSD

Based on getMainExecutable() in llvm/lib/Support/Unix/Path.inc.
This will need a little more work for an upstream change as it must
support older FreeBSD releases that lack elf_aux_info() / AT_EXEC_PATH.

No objection: dim
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33934

2 years agolindebugfs: Fix write
Emmanuel Vadot [Mon, 31 Jan 2022 13:46:16 +0000 (14:46 +0100)]
lindebugfs: Fix write

For write operation pseudofs creates an sbuf with the data.
Use this data instead of the uio as it's not usable anymore after
uiomove.

Reviewed by: hselasky
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34114

2 years agolibc: return partial sysctl() result if buffer is too small
Stefan Eßer [Fri, 4 Feb 2022 12:44:20 +0000 (13:44 +0100)]
libc: return partial sysctl() result if buffer is too small

Testing of a new feature revealed that calling sysctl() to retrieve
the value of the user.localbase variable passing too low a buffer size
could leave the result buffer unchanged.

The behavior in the normal case of a sufficiently large buffer was
correct.

All known callers pass a sufficiently large buffer and have thus not
been affected by this issue. If a non-default value had been assigned
to this variable, the result was as documented, too.

Fix the function to fill the buffer with a partial result, if the
passed in buffer size is too low to hold the full result.

MFC after: 3 days

2 years agox86 atomic.h: remove obsoleted comment
Konstantin Belousov [Thu, 3 Feb 2022 17:46:22 +0000 (19:46 +0200)]
x86 atomic.h: remove obsoleted comment

Modules no longer call kernel functions for atomic ops, and since the
previous commit, we always use lock prefix.

Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by: jhb, markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34153

2 years agox86 atomics: use lock prefix unconditionally
Konstantin Belousov [Thu, 3 Feb 2022 09:51:36 +0000 (11:51 +0200)]
x86 atomics: use lock prefix unconditionally

Atomics have significant other use besides providing in-system
primitives for safe memory updates.  They are used for implementing
communication with out of system software or hardware following some
protocols.

For instance, even UP kernel might require a protocol using atomics to
communicate with the software-emulated device on SMP hypervisor.  Or
real hardware might need atomic accesses as part of the proper
management protocol.

Another point is that UP configurations on x86 are extinct, so slight
performance hit by unconditionally use proper atomics is not important.
It is compensated by less code clutter, which in fact improves the
UP/i386 lifetime expectations.

Requested by: Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by: Elliott Mitchell, imp, jhb, markj, royger
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34153

2 years agox86 atomic.h: cleanup comments for preprocessor directives
Konstantin Belousov [Thu, 3 Feb 2022 09:25:03 +0000 (11:25 +0200)]
x86 atomic.h: cleanup comments for preprocessor directives

Reviewed by: Elliott Mitchell, imp, jhb, markj, royger
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34153

2 years agoSort the names of the arm64 debug registers
Andrew Turner [Wed, 26 Jan 2022 15:43:14 +0000 (15:43 +0000)]
Sort the names of the arm64 debug registers

While here clean up the names for the naming convention of the other
registers in this file.

Reviewed by: kib, mhorne (earlier version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34060

2 years agoip_mroute: split mrouter interface deactivation and if_free
Sylvian Meygret [Fri, 4 Feb 2022 09:19:55 +0000 (10:19 +0100)]
ip_mroute: split mrouter interface deactivation and if_free

Move if_free outside MRW_LOCK. This will silence LOR message
which might appere during deinitialization.

2 years agoar40xx_switch: add initial switch for the IPQ4018/IPQ4019.
Adrian Chadd [Sun, 30 Jan 2022 03:04:19 +0000 (19:04 -0800)]
ar40xx_switch: add initial switch for the IPQ4018/IPQ4019.

Summary:

This switch is based off of the AR8327/AR8337 external switch/PHY.
However unlike the AR8327/AR8337 it itself doesn't have any PHYs;
instead an external PHY connects to it using the PSGMII port.

Differential Revision: https://reviews.freebsd.org/D34112
Reviewed by: manu

This code is inspired by the ar40xx code in openwrt, which itself
is based on the Qualcomm QCA-SSDK.  Both of these sources are, amusingly,
BSD licenced - and thus I have included some of the comments in the
hardware workaround paths to document some of the magic numbers.

2 years agodts: add IPQ4018/IPQ4019 ethernet MAC and ethernet switch definitions
Adrian Chadd [Sun, 30 Jan 2022 19:15:42 +0000 (11:15 -0800)]
dts: add IPQ4018/IPQ4019 ethernet MAC and ethernet switch definitions

This adds the ethernet MAC and ethernet switch definitions.

I've rewritten the header file and the DTS based on documentation
and the required driver fields rather than the GPL'ed
ones from openwrt.

Differential Revision: https://reviews.freebsd.org/D34111
Reviewed by: manu

2 years agoqcom_mdio: add initial IPQ4018 MDIO support
Adrian Chadd [Sun, 30 Jan 2022 02:27:58 +0000 (18:27 -0800)]
qcom_mdio: add initial IPQ4018 MDIO support

This adds support for the IPQ4018/IPQ4019 MDIO bus.  This is used to
talk to external PHYs and switches.  (There's an internal switch
in the IPQ4018/IPQ4019 as well, but it's accessible via MMIO/AXI.)

Differential Revision: https://reviews.freebsd.org/D34110
Reviewed by: manu

2 years agortsx: Update driver version number to 2.1c
Henri Hennebert [Thu, 3 Feb 2022 23:24:27 +0000 (18:24 -0500)]
rtsx: Update driver version number to 2.1c

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

2 years agortsx: Do not display pci_read_config() errors during rtsx_init()
Henri Hennebert [Thu, 3 Feb 2022 23:22:24 +0000 (18:22 -0500)]
rtsx: Do not display pci_read_config() errors during rtsx_init()

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

2 years agortsx: Add CTLFLAG_STATS flag for read and write counters
Henri Hennebert [Thu, 3 Feb 2022 23:18:08 +0000 (18:18 -0500)]
rtsx: Add CTLFLAG_STATS flag for read and write counters

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

2 years agortsx: Prefer __FreeBSD_version over __FreeBSD__
Henri Hennebert [Thu, 3 Feb 2022 23:10:02 +0000 (18:10 -0500)]
rtsx: Prefer __FreeBSD_version over __FreeBSD__

No functional change.

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

2 years agortsx: Convert driver to use the mmc_sim interface
Henri Hennebert [Thu, 3 Feb 2022 22:58:57 +0000 (17:58 -0500)]
rtsx: Convert driver to use the mmc_sim interface

A lot more generic cam related things were done in mmc_sim so this
simplifies the driver a lot.

Differential Revision: https://reviews.freebsd.org/D32154
Reviewed by: imp

2 years agopowerpc/atomic: Fix atomic_testand_*_long on powerpc64
Justin Hibbits [Thu, 3 Feb 2022 23:20:36 +0000 (17:20 -0600)]
powerpc/atomic: Fix atomic_testand_*_long on powerpc64

After b5d227b0 FreeBSD was panicking on boot with "Duplicate free" in
UMA.  Analyzing the asm, the '1' mask was treated as an integer, rather
than a long, causing 'slw' (shift left word) to be used for the shifting
instruction, not 'sld' (shift left double).  This means the upper bits
of the bitfield were not getting used, resulting in corruption of the
bitfield.

While fixing this, the 'and' check of the mask does not need to be
recorded, so don't record (drop the '.').

2 years agoAPEI: Make sure event data fit into the buffer.
Alexander Motin [Thu, 3 Feb 2022 20:18:31 +0000 (15:18 -0500)]
APEI: Make sure event data fit into the buffer.

There seem to be systems returning some garbage here.  I still don't
know why, but at least I hope this check fix indefinite printf loop.

MFC after: 2 weeks

2 years agotcp: fix typo in commit f026275e26d0071ac3dee98526e8b9bcad58f0fa
Richard Scheffenegger [Thu, 3 Feb 2022 19:53:50 +0000 (20:53 +0100)]
tcp: fix typo in commit f026275e26d0071ac3dee98526e8b9bcad58f0fa

missed one bitmask inversion while committing D34148

Differential Revision: https://reviews.freebsd.org/D34148
Differential Revision: https://reviews.freebsd.org/D34160

2 years agotcp: Prevent setting of ECN bits with setsockopt()
Richard Scheffenegger [Thu, 3 Feb 2022 18:50:56 +0000 (19:50 +0100)]
tcp: Prevent setting of ECN bits with setsockopt()

setsockopt() grants full access to the deprecated
TOS byte. For TCP, mask out the ECN codepoint, so that
only the DSCP portion can be adjusted.

Reviewed By: tuexen, hselasky, #manpages, #transport, debdrup
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34154

2 years agosys/arm64/iommu/iommu_pmap.c readd sys/systm.h
Jesper Schmitz Mouridsen [Thu, 3 Feb 2022 18:53:28 +0000 (19:53 +0100)]
sys/arm64/iommu/iommu_pmap.c readd sys/systm.h

after d950c5898a2d UINT64_C and bzero were no longer defined

Approved by: kib
Differential Revision: https://reviews.freebsd.org/D34155

2 years agolnumeric.c: replace some space*8 by tabs
Konstantin Belousov [Thu, 3 Feb 2022 18:53:31 +0000 (20:53 +0200)]
lnumeric.c: replace some space*8 by tabs

Reported by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoiwlwifi: Disable -Wformat when building with GCC.
John Baldwin [Thu, 3 Feb 2022 18:48:18 +0000 (10:48 -0800)]
iwlwifi: Disable -Wformat when building with GCC.

GCC's -Wformat complains about NULL format strings passed to
iwl_fw_dbg_collect_trig (though the function handles NULL format
strings).  Curious that upstream iwlwifi in Linux is built with GCC
and explicitly opts into this warning via the __printf() attribute.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D34146

2 years agoremove dead code
Wolfram Schneider [Thu, 3 Feb 2022 17:02:37 +0000 (17:02 +0000)]
remove dead code

A lookup array is faster than a function with linear search.
The old function was not used for years - spring cleaning.

2 years agobetter printf(3) format usage
Wolfram Schneider [Thu, 3 Feb 2022 16:56:32 +0000 (16:56 +0000)]
better printf(3) format usage

Reported by: jhb

2 years agomlx5ib: Fix whitespace.
Hans Petter Selasky [Thu, 3 Feb 2022 16:44:11 +0000 (17:44 +0100)]
mlx5ib: Fix whitespace.

Found by: kib@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoipfilter: Fix indentation error
Cy Schubert [Thu, 3 Feb 2022 16:03:24 +0000 (08:03 -0800)]
ipfilter: Fix indentation error

Fixes: 064a5a95649d05ac084bcf2612cbac5575d76358
MFC after: 3 days

2 years agomlx5ib: Add missing auto generated header file to Makefile.
Hans Petter Selasky [Thu, 3 Feb 2022 16:11:39 +0000 (17:11 +0100)]
mlx5ib: Add missing auto generated header file to Makefile.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoCTL: Fix mode page trucation on HA synchronization.
Alexander Motin [Thu, 3 Feb 2022 15:48:19 +0000 (10:48 -0500)]
CTL: Fix mode page trucation on HA synchronization.

Due to variable size of struct ctl_ha_msg_mode ctl_isc_announce_mode()
sent only first 4 bytes of modified mode page to the other HA side,
that caused its corruption there, noticeable only after failover.

I've found alike bug also in ctl_isc_announce_lun(), but there it was
sending slightly more than needed, that is a smaller problem.

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

2 years agokern: harvest entropy from callouts
Kyle Evans [Thu, 3 Feb 2022 16:05:06 +0000 (10:05 -0600)]
kern: harvest entropy from callouts

74cf7cae4d22 ("softclock: Use dedicated ithreads for running callouts.")
switched callouts away from the swi infrastructure.  It turns out that
this was a major source of entropy in early boot, which we've now lost.

As a result, first boot on hardware without a 'fast' entropy source
would block waiting for fortuna to be seeded with little hope of
progressing without manual intervention.

Let's resolve it by explicitly harvesting entropy in callout_process()
if we've handled any callouts.  cc/curthread/now seem to be reasonable
sources of entropy, so use those.

Discussed with: jhb (also proposed initial patch)
Reported by: many
Reviewed by: cem, markm (both csprng)
Differential Revision: https://reviews.freebsd.org/D34150

2 years agotcp: set IP ECN header codepoint properly
Richard Scheffenegger [Thu, 3 Feb 2022 15:47:50 +0000 (16:47 +0100)]
tcp: set IP ECN header codepoint properly

TCP RACK can cache the IP header while preparing
a new TCP packet for transmission. Thus all the
IP ECN codepoint bits need to be assigned, without
assuming a clear field beforehand.

Reviewed By: tuexen, kbowling, #transport
MFC after:   3 days
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34148

2 years agotcp: Access all 12 TCP header flags via inline function
Richard Scheffenegger [Thu, 3 Feb 2022 15:21:25 +0000 (16:21 +0100)]
tcp: Access all 12 TCP header flags via inline function

In order to consistently provide access to all
(including reserved) TCP header flag bits,
use an accessor function tcp_get_flags and
tcp_set_flags. Also expand any flag variable from
uint8_t / char to uint16_t.

Reviewed By: hselasky, tuexen, glebius, #transport
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34130

2 years agofilemon.4: Document FILEMON_SET_FD errors and refine wording a bit
Mark Johnston [Thu, 3 Feb 2022 14:42:14 +0000 (09:42 -0500)]
filemon.4: Document FILEMON_SET_FD errors and refine wording a bit

Reviewed by: emaste, debdrup, Pau Amma
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34128

2 years agofilemon: Reject FILEMON_SET_FD commands when the fd is a kqueue
Mark Johnston [Thu, 3 Feb 2022 14:41:17 +0000 (09:41 -0500)]
filemon: Reject FILEMON_SET_FD commands when the fd is a kqueue

When FILEMON_SET_FD is used, the filemon handle effectively wraps the
passed file.  In particular, the handle may be inherited by a child
process, or transferred over a unix domain socket, so we must verify
that the backing file permits this.

Reported by: syzbot+36e6be9e02735fe66ca8@syzkaller.appspotmail.com
Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34128

2 years agorack: fix compilation and small cleanup
Michael Tuexen [Wed, 2 Feb 2022 08:41:40 +0000 (09:41 +0100)]
rack: fix compilation and small cleanup

Fix a function prototype missed in the last commit and whitespace
change.
Sponsored by: Netflix, Inc.

2 years agotcp: cleanup functions related to socket option handling
Michael Tuexen [Wed, 2 Feb 2022 08:20:43 +0000 (09:20 +0100)]
tcp: cleanup functions related to socket option handling

Consistently only pass the inp and the sopt around. Don't pass the
so around, since in a upcoming commit tcp_ctloutput_set() will be
called from a context different from setsockopt(). Also expect
the inp to be locked when calling tcp_ctloutput_[gs]et(), this is
also required for the upcoming use by tcpsso, a command line tool
to set socket options.
Reviewed by: glebius, rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D34151

2 years agostress2: Fix "set but not used [-Wunused-but-set-variable]" warnings
Peter Holm [Thu, 3 Feb 2022 10:52:38 +0000 (11:52 +0100)]
stress2: Fix "set but not used [-Wunused-but-set-variable]" warnings

2 years agostress2: Finish work on a unionfs test scenario. Enable three unionfs tests
Peter Holm [Thu, 3 Feb 2022 07:04:56 +0000 (08:04 +0100)]
stress2: Finish work on a unionfs test scenario.  Enable three unionfs tests

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