]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
22 months agoAdd getsock
Mateusz Guzik [Wed, 7 Sep 2022 15:41:55 +0000 (15:41 +0000)]
Add getsock

All but one consumers of getsock_cap only pass 4 arguments.
Take advantage of it.

22 months agoAdd branch prediction hints to getsock_cap
Mateusz Guzik [Sat, 10 Sep 2022 19:41:34 +0000 (19:41 +0000)]
Add branch prediction hints to getsock_cap

22 months agoiscsi(4): Remove a double word in a source code comment
Gordon Bergling [Sat, 10 Sep 2022 11:04:42 +0000 (13:04 +0200)]
iscsi(4): Remove a double word in a source code comment

 - s/to to/to/

MFC after: 3 days

22 months agoisp: Remove a double word in the driver manual
Gordon Bergling [Sat, 10 Sep 2022 11:03:38 +0000 (13:03 +0200)]
isp: Remove a double word in the driver manual

 - s/to to/to/

MFC after: 3 days

22 months agonetinet6: Remove a double word in a source code comment
Gordon Bergling [Sat, 10 Sep 2022 11:01:44 +0000 (13:01 +0200)]
netinet6: Remove a double word in a source code comment

 - s/to to/to/

MFC after: 3 days

22 months agoocs_fc(4): Remove double words in source code comments
Gordon Bergling [Sat, 10 Sep 2022 11:00:23 +0000 (13:00 +0200)]
ocs_fc(4): Remove double words in source code comments

 - s/to to/to/

MFC after: 3 days

22 months agomsun: Remove a double word in a source code comment
Gordon Bergling [Sat, 10 Sep 2022 10:59:10 +0000 (12:59 +0200)]
msun: Remove a double word in a source code comment

 - s/to to/to/

MFC after: 3 days

22 months agomk: Remove a double word in a comment
Gordon Bergling [Sat, 10 Sep 2022 10:57:55 +0000 (12:57 +0200)]
mk: Remove a double word in a comment

 - s/to to/to/

MFC after: 3 days

22 months agoipf-howto: Remove a double word
Gordon Bergling [Sat, 10 Sep 2022 10:56:48 +0000 (12:56 +0200)]
ipf-howto: Remove a double word

 - s/to to/to/

MFC after: 3 days

22 months agotools: Remove a double words
Gordon Bergling [Sat, 10 Sep 2022 10:54:33 +0000 (12:54 +0200)]
tools: Remove a double words

 - s/to to/to/
 - s/to to/to do/ in an error message

MFC after: 3 days

22 months agostress2: Remove double words in comments
Gordon Bergling [Sat, 10 Sep 2022 10:52:50 +0000 (12:52 +0200)]
stress2: Remove double words in comments

 - s/to to/to/

 MFC after:3 days

22 months agoregression-netinet: Remove a double word in a source code comment
Gordon Bergling [Sat, 10 Sep 2022 10:52:01 +0000 (12:52 +0200)]
regression-netinet: Remove a double word in a source code comment

 - s/to to/to/

 MFC after: 3 days

22 months agoarm64: allwinner: aw_r_intc: Add A64 and H6 compatible.
Peter Jeremy [Sat, 10 Sep 2022 10:36:22 +0000 (20:36 +1000)]
arm64: allwinner: aw_r_intc: Add A64 and H6 compatible.

This fixes booting the Pine H64 with a 5.13 DTS.

Suggested by: manu@

22 months agoip_reass: optimize ipreass_drain_vnet()
Gleb Smirnoff [Sat, 10 Sep 2022 09:11:39 +0000 (02:11 -0700)]
ip_reass: optimize ipreass_drain_vnet()

- Call ipreass_reschedule() only once per slot [1]
- Aggregate stats and update them once

Suggested by: jtl [1]

22 months agoip_reass: make stray callout assertion more verbose
Gleb Smirnoff [Sat, 10 Sep 2022 09:11:39 +0000 (02:11 -0700)]
ip_reass: make stray callout assertion more verbose

Syzcaller hits this assertion, but can't find reproducer.  I also never
seen it hit in my testing.  Try to get more information via syzcaller.

22 months agoda.4: Add some sysctl descriptions
Felix Johnson [Sat, 10 Sep 2022 07:44:08 +0000 (09:44 +0200)]
da.4: Add some sysctl descriptions

Add descriptions for the following sysctl's:

- kern.cam.da.default_softtimeout
- kern.cam.da.disable_wp_protection
- kern.cam.da.enable_biospeedup
- kern.cam.da.enable_uma_ccbs
- kern.cam.da.poll_period
- kern.cam.da.send_ordered

While here, fix some mandocs warnings.

PR: 258727
Reported by: Felix Johnson <felix dot the dot red at gmail dot com>
Reviewed by: debdrup, pauamma, gbe
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32278

22 months agoifnet(9): Duplicates for IFCAP_TOE flags removed.
Maxim Konovalov [Sat, 10 Sep 2022 01:35:34 +0000 (01:35 +0000)]
ifnet(9): Duplicates for IFCAP_TOE flags removed.

PR: 266330

22 months agostand: Add driver interface docs
Warner Losh [Fri, 9 Sep 2022 23:22:09 +0000 (17:22 -0600)]
stand: Add driver interface docs

Add some rather bare-bones driver interface docs.

Sponsored by: Netflix
Suggestions by: rpokala
Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D35912

22 months agoHandle NULL return from localtime(3) in ls(1) and find(1)
Kirk McKusick [Fri, 9 Sep 2022 21:29:53 +0000 (14:29 -0700)]
Handle NULL return from localtime(3) in ls(1) and find(1)

The ls(1) (with -l option) and find(1) (with -ls option) utilties
segment fault when operating on files with very large modification
times. A recent disk corruption set a spurious bit in the mtime
field of one of my files to 0x8000000630b0167 (576460753965089127)
which is in year 18,266,940,962. I discovered the problem when
running fsck_ffs(8) which uses ctime(3) to convert it to a readable
format. Ctime cannot fit the year into its four character field, so
returns ??? ??? ?? ??:??:?? ???? (typically Thu Nov 24 18:22:48 2021).

With the filesystem mounted, I used `ls -l' to see how it would
report the modification time and it segment faulted. The find(1)
program also segment faulted (see script below). Both these utilities
call the localtime(3) function to decode the modification time.
Localtime(3) returns a pointer to a struct tm (which breaks things
out into its component pieces: year, month, day, hour, minute,
second). The ls(1) and find(1) utilities then print out the date
based on the appropriate fields in the returned tm structure.

Although not documented in the localtime(3) manual page, localtime(3)
returns a NULL pointer if the passed in time translates to a year
that will not fit in an "int" (which if "int" is 32-bits cannot
hold the year 18,266,940,962). Since ls(1) and find(1) do not check
for a NULL struct tm * return from localtime(3), they segment fault
when they try to dereference it.

When localtime(3) returns NULL, the attached patches produce a date
string of "bad date val". This string is chosen because it has the
same number of characters (12) and white spaces (2) as the usual
date string, for example "Sep 3 22:06" or "May 15 2017".

The most recent ANSI standard for localtime(3) does say that localtime(3)
can return NULL (see https://pubs.opengroup.org/onlinepubs/9699919799/
and enter localtime in the search box). Our localtime(3) man page should
be updated to indicate that NULL is a possible return. More importantly,
there are over 100 uses of localtime(3) in the FreeBSD source tree (see
Differential Revision D36474 for the list). Most do not check for a NULL
return from localtime(3).

Reported by:  Peter Holm
Reviewed by:  kib, Chuck Silvers, Warner Losh
MFC after:    2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36474

22 months agoLinuxKPI: 80211 (+net80211): update and cleanup headers
Bjoern A. Zeeb [Fri, 9 Sep 2022 18:40:23 +0000 (18:40 +0000)]
LinuxKPI: 80211 (+net80211): update and cleanup headers

Fix types for various struct fields (initially added as int).

Move structs and inline functions logically together, e.g., for wowlan.
Add more skeleton functions and #defines needed for iwlwifi d3.c
in the future.

Add struct ieee80211_vht_cap (without "_ie") to net80211 and remove
duplicate definitions in LinuxKPI headers now using net80211 structs.
For now leave ieee80211_ie_vhtcap in net80211.  I am not sure yet if we
actually need it as such.  That'll be cleaned up with more VHT updates
in net80211 in the future.

No functional changes in currently compiled code intended.

Try to implement ieee80211_action_contains_tpc() as I ran into it with
an older iwlwifi chipset.  This depends on c994352a8841eb453.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

22 months agopf: remove pf_bcmp_state_key
Mateusz Guzik [Fri, 9 Sep 2022 17:16:58 +0000 (17:16 +0000)]
pf: remove pf_bcmp_state_key

Clang 14 performs the optimisation on its own, thus the custom code is
no longer needed.

Sponsored by: Rubicon Communications, LLC ("Netgate")

22 months agopf: partially depessimize pf_match_translation
Mateusz Guzik [Fri, 9 Sep 2022 16:37:00 +0000 (18:37 +0200)]
pf: partially depessimize pf_match_translation

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

22 months agortw89: import firmware for Realtek's rtw89 supported chipsets.
Bjoern A. Zeeb [Fri, 9 Sep 2022 12:52:54 +0000 (12:52 +0000)]
rtw89: import firmware for Realtek's rtw89 supported chipsets.

Import the most recent versions of the firmware images for the
rtw89 driver.

This is based on linux-firmware at 2f2f0181581d3e35bfdb9fc65f609ee9d3fbaeb7.

The license of the firmware matches the previously added rtw88(4) firmware
and you can find a copy in sys/contrib/dev/rtw89fw/LICENCE.rtlwifi_firmware.txt.

Add build infrastructure to create the .ko files but do not yet hook
it up to the build until all parts are in the tree.

Approved by: core.11 (imp) [2022-03-27]
MFC after: 6 weeks

22 months agortw89: import Realtek's rtw89 driver
Bjoern A. Zeeb [Fri, 9 Sep 2022 12:41:07 +0000 (12:41 +0000)]
rtw89: import Realtek's rtw89 driver

Import rtw89 based on wireless-testing at (tag: wt-2022-09-02)
78667a29c116c6b186a37e28cd8dd7fa9923aee8 with adjustments for FreeBSD.

For the moment this will stay disconnected from the build until the
last bits are flushed out, but this will help people with a card to
do testing and possibly help improving.

Given the lack of full license texts on non-local files this is
imported under the draft policy for handling SPDX files (D29226). [1]

Approved by: core.11 (imp) [1] [2022-03-27]
MFC after: 6 weeks

22 months agoLinuxKPI: 80211: add ieee80211_stop_tx_ba_session()
Bjoern A. Zeeb [Fri, 9 Sep 2022 16:30:00 +0000 (16:30 +0000)]
LinuxKPI: 80211: add ieee80211_stop_tx_ba_session()

rtw89 needs ieee80211_stop_tx_ba_session().
Add the skeleton function for now so we can implement BA functions all
together.

MFC after: 3 days

22 months agoip_reass: fixup the just added tunable
Gleb Smirnoff [Fri, 9 Sep 2022 16:18:04 +0000 (09:18 -0700)]
ip_reass: fixup the just added tunable

- Don't use hardcoded hash mask
- free the memory on VNET destroy

Fixes: 1494f4776af32b49e3c5bbdf09d6b2995b374614

22 months agoif_dwc: fix reinitialization with changed MAC
Jiahao LI [Thu, 8 Sep 2022 15:50:37 +0000 (12:50 -0300)]
if_dwc: fix reinitialization with changed MAC

It was observed that on RockPro64 hardware, the dwc interface is unable
to receive packets after being assigned a new MAC address. The fix is
simply to call mii_mediachg() before touching any device registers in
dwc_init_locked(). This is consistent with what the OpenBSD driver does.

PR: 263820
MFC after: 1 week

22 months agobcm2835_clkman: add RPI4 compat string
Matthew Grooms [Thu, 8 Sep 2022 15:34:15 +0000 (12:34 -0300)]
bcm2835_clkman: add RPI4 compat string

This enables attachment on the RPI4, thus enabling the bcm2835_pwm
driver too. Per the device tree documentation, these compat strings are
equivalent, and no further changes to the driver are required.

https://lists.freebsd.org/archives/freebsd-arm/2021-June/000143.html

MFC after: 3 days

22 months agogicv3_its: Fix typo
Warner Losh [Fri, 9 Sep 2022 15:22:41 +0000 (09:22 -0600)]
gicv3_its: Fix typo

Sponsored by: Netflix

22 months agoBump __FreeBSD_version after linuxkpi changes.
Felix Palmen [Fri, 9 Sep 2022 15:07:40 +0000 (17:07 +0200)]
Bump __FreeBSD_version after linuxkpi changes.

Approved by: tcberner (mentor)

22 months agolinuxkpi: Add non-atomic readq()/writeq()
Felix Palmen [Fri, 9 Sep 2022 14:01:22 +0000 (16:01 +0200)]
linuxkpi: Add non-atomic readq()/writeq()

The non-atomic versions are required by drm-510-kmod to build on 32-bit
architectures.

Approved by: hselasky, manu, tcberner (mentor)
Differential Revision: https://reviews.freebsd.org/D36507

22 months agoRevert "vmm: permit some IPIs to be handled by userspace"
Emmanuel Vadot [Fri, 9 Sep 2022 13:55:01 +0000 (15:55 +0200)]
Revert "vmm: permit some IPIs to be handled by userspace"

This reverts commit a5a918b7a906eaa88e0833eac70a15989d535b02.

This cause some problem with vm using bhyveload.

Reported by: pho, kp

22 months agoRevert "vmm: Remove unneeded variable maxcpus"
Emmanuel Vadot [Fri, 9 Sep 2022 13:54:56 +0000 (15:54 +0200)]
Revert "vmm: Remove unneeded variable maxcpus"

This reverts commit 653c36179d9ee587e4d5e4668fd73d6c3d318ef8.

22 months agoTCP: Rack ends up sending all that is outstanding every timeout.
Randall Stewart [Fri, 9 Sep 2022 12:59:21 +0000 (08:59 -0400)]
TCP: Rack ends up sending all that is outstanding every timeout.

In doing some testing for a different problem, I have found rack retransmitting
all outstanding data every time a timeout occurs. The outstanding is sent 1ms
apart between each packet, and then the timeout runs off again. This causes
extra retransmissions when we should be waiting for an ack after sending the
very first segment.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D36494

22 months agoNOTES: add Veriexec options and modules.
Dag-Erling Smørgrav [Fri, 9 Sep 2022 12:11:19 +0000 (14:11 +0200)]
NOTES: add Veriexec options and modules.

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

22 months agomac_veriexec_parser: fix build after 7e1d3eefd410.
Dag-Erling Smørgrav [Fri, 9 Sep 2022 12:09:08 +0000 (14:09 +0200)]
mac_veriexec_parser: fix build after 7e1d3eefd410.

Sponsored by: Klara, Inc.

22 months agoOptionalObsoleteFiles.inc: add bearssl, secureboot, veriexec.
Dag-Erling Smørgrav [Fri, 9 Sep 2022 12:06:11 +0000 (14:06 +0200)]
OptionalObsoleteFiles.inc: add bearssl, secureboot, veriexec.

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

22 months agosystm.h: change pause from #define to inline function
Bjoern A. Zeeb [Thu, 8 Sep 2022 00:04:42 +0000 (00:04 +0000)]
systm.h: change pause from #define to inline function

There are drivers are using (*pause)(x, y) function pointers and depending
on how "pause" is used it gets replaced by pause_sbt causing compile time
failures.
Given "pause" is a generic enough name change it from a #define to an
inline function to avoid replacements where it should not.

MFC after: 2 weeks
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D36489

22 months agoTMP461: Add support for ADT7461 sensor
Mateusz Kozyra [Fri, 9 Sep 2022 08:36:22 +0000 (10:36 +0200)]
TMP461: Add support for ADT7461 sensor

The register map is fairly similar, with one difference in the local
sensor temperature register width.
Both devices support reading two sensors - "local" and "remote".
While here add support for the latter one.
The ADT7461 doesn't update the temperature correctly, unless a write
transaction is done before every read.
Do just that as a workaround for this issue.

Tested on LS1046ARDB.

Reviewed by: manu
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36464

22 months agomsun/Makefile: Fix conditional and unbreak the build.
Gleb Popov [Fri, 9 Sep 2022 07:48:48 +0000 (10:48 +0300)]
msun/Makefile: Fix conditional and unbreak the build.
Approved by: imp
Fixes: 20adba8bc1beb125d5e5ed8f12e747ae79ca6a10

22 months agosrc.conf.5: Regenerate.
Gleb Popov [Fri, 9 Sep 2022 07:42:21 +0000 (10:42 +0300)]
src.conf.5: Regenerate.
Approved by: imp
Fixes: 20adba8bc1beb125d5e5ed8f12e747ae79ca6a10

22 months agoUse the correct size when checking an EFI address
Andrew Turner [Fri, 9 Sep 2022 07:42:49 +0000 (08:42 +0100)]
Use the correct size when checking an EFI address

Use the correct page size macro when checking if an address is with
the EFI runtime map. This would previously work correctly when the
page size is 4k. With a larger page size it may incorrectly detect
memory as within the map when it's not.

Reported by: imp
Sponsored by: Innovate UK

22 months agosrc.conf: Introduce WITHOUT_MACHDEP knob.
Gleb Popov [Mon, 8 Aug 2022 15:16:00 +0000 (18:16 +0300)]
src.conf: Introduce WITHOUT_MACHDEP knob.

Summary:
This knob can be used to make buildsystem prefer generic C implentations of
various functions, instead of machine-specific assembler ones.

Test Plan: `make buildworld` on amd64

Reviewed by: imp, emaste

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

MFC after: 3 days

22 months agoip_reass: add loader tunable to tune the reassembly hash size
Gleb Smirnoff [Thu, 8 Sep 2022 20:49:58 +0000 (13:49 -0700)]
ip_reass: add loader tunable to tune the reassembly hash size

22 months agoip_reass: retire ipreass_slowtimo() in favor of per-slot callout
Gleb Smirnoff [Thu, 8 Sep 2022 20:49:58 +0000 (13:49 -0700)]
ip_reass: retire ipreass_slowtimo() in favor of per-slot callout

o Retire global always running ipreass_slowtimo().
o Instead use one callout entry per hash slot.  The per-slot callout
  would be scheduled only if a slot has entries, and would be driven
  by TTL of the very last entry.
o Make net.inet.ip.fragttl read/write and document it.
o Retire IPFRAGTTL, which used to be meaningful only with PR_SLOWTIMO.

Differential revision: https://reviews.freebsd.org/D36275

22 months agotail: Initialize the stat buffer used when input is stdin
Mark Johnston [Thu, 8 Sep 2022 20:21:39 +0000 (16:21 -0400)]
tail: Initialize the stat buffer used when input is stdin

PR: 266284
Reported by: Jenkins via delphij
Fixes: 7e11889959a6 ("tail: Fix -f with stdin")
MFC after: 3 days

22 months agonet: employ newly added pfil_mbuf_{in,out} where approriate
Mateusz Guzik [Thu, 8 Sep 2022 16:01:00 +0000 (16:01 +0000)]
net: employ newly added pfil_mbuf_{in,out} where approriate

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

22 months agonet: add pfil_mbuf_{in,out}
Mateusz Guzik [Fri, 2 Sep 2022 16:23:54 +0000 (18:23 +0200)]
net: add pfil_mbuf_{in,out}

This shaves a lot of branching due to MEMPTR flag.

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

22 months agohwpmc: purge EOL release compatibility
Elliott Mitchell [Thu, 8 Sep 2022 16:16:03 +0000 (16:16 +0000)]
hwpmc: purge EOL release compatibility

22 months agotcp: avoid call to soisconnected() on transition to ESTABLISHED
Gleb Smirnoff [Thu, 8 Sep 2022 16:16:04 +0000 (09:16 -0700)]
tcp: avoid call to soisconnected() on transition to ESTABLISHED

This call existed since pre-FreeBSD times, and it is hard to understand
why it was there in the first place.  After 6f3caa6d815 it definitely
became necessary always and commit message from f1ee30ccd60 confirms that.
Now that 6f3caa6d815 is effectively backed out by 07285bb4c22, the call
appears to be useful only for sockets that landed on the incomplete queue,
e.g. sockets that have accept_filter(9) enabled on them.

Provide a new TCP flag to mark connections that are known to be on the
incomplete queue, and call soisconnected() only for those connections.

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D36488

22 months agostand: i386: take into account disk sector size for blk calculation
Kyle Evans [Thu, 8 Sep 2022 00:35:06 +0000 (19:35 -0500)]
stand: i386: take into account disk sector size for blk calculation

disk_blocks assumes BIOSDISK_SECSIZE, but the media may not be using
it.  In particular, bioscd on Parallels presents a 2K sector size, so
we end up with a short disk_blocks and subsequent validation fails when
trying to read /boot/lua.

PR: 233098
Reviewed by: imp, tsoome
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36490

22 months agoUse the cached dc zva length in arm64 memset
Andrew Turner [Wed, 7 Sep 2022 11:43:16 +0000 (12:43 +0100)]
Use the cached dc zva length in arm64 memset

On boot we cache the length the 'dc zva' instruction will zero. Use
this in the memset function to decide when to use it. As the cached
value is in .bss it will be zero on boot so memset is safe to use
before the value has been read.

Sponsored by: The FreeBSD Foundation

22 months agoImport the arm64 Cortex Strings memset into the kernel
Andrew Turner [Wed, 7 Sep 2022 11:41:13 +0000 (12:41 +0100)]
Import the arm64 Cortex Strings memset into the kernel

Bring in the last version of the optimized memset from the Cortex
Strings library that didn't use the VFP registers. While here clean up
to use the ENTRY/EDIT macros.

This is imported from:
https://git.linaro.org/toolchain/cortex-strings.git/tree/src/aarch64/memset.S?id=bc654e7a594385071b42db3c9c94bd0fd5fe0da5

Sponsored by: The FreeBSD Foundation

22 months agoImport an optimized arm64 memcmp into the kernel
Andrew Turner [Wed, 7 Sep 2022 11:12:30 +0000 (12:12 +0100)]
Import an optimized arm64 memcmp into the kernel

Bring in a version of the Arm Optimized Routines memcpy from before
the VFP registers were used.

Imported with modification from:
https://github.com/ARM-software/optimized-routines/blob/e823e3abf5f89ecb/string/aarch64/memcmp.S

Sponsored by: The FreeBSD Foundation

22 months agoImport an optimized str{n}cmp on arm64
Andrew Turner [Wed, 7 Sep 2022 10:40:26 +0000 (11:40 +0100)]
Import an optimized str{n}cmp on arm64

These are from the Arm Optimized Routines and don't use the VFP so are
safe to use in the kernel.

Sponsored by: The FreeBSD Foundation

22 months agoUpdate the arm64 kernel memcpy/memmove
Andrew Turner [Wed, 7 Sep 2022 09:51:21 +0000 (10:51 +0100)]
Update the arm64 kernel memcpy/memmove

Bring in the latest Arm Optimized Routines memcpy/memmove into the
arm64 kernel. As these functions have been merged in the current
version remove the now unneeded memmove.S.

Sponsored by: The FreeBSD Foundation

22 months agoMove the non-exported PCB_FP_* flags to the upper bits
Andrew Turner [Tue, 6 Sep 2022 16:49:00 +0000 (17:49 +0100)]
Move the non-exported PCB_FP_* flags to the upper bits

To make way for a flag for SVE move the PCB_FP_* flags we don't export
to userspace to the upper bits.

Sponsored by: The FreeBSD Foundation

22 months agoGenerate termcap.small automatically. This eliminates the
Maxim Sobolev [Fri, 19 Aug 2022 07:00:27 +0000 (22:00 -0900)]
Generate termcap.small automatically. This eliminates the
need to do synchronization by hand when termcap is updated.

Reviewed by: uqs, bapt, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36333

22 months agorouting: constantify nh/nhg argument in <nhop|nhgrp>_get_origin().
Alexander V. Chernikov [Thu, 8 Sep 2022 10:21:25 +0000 (10:21 +0000)]
routing: constantify nh/nhg argument in <nhop|nhgrp>_get_origin().

MFC after: 1 month

22 months agorouting: add abitity to set the protocol that installed route/nexthop.
Alexander V. Chernikov [Thu, 8 Sep 2022 09:05:53 +0000 (09:05 +0000)]
routing: add abitity to set the protocol that installed route/nexthop.

Routing daemons such as bird need to know if they install certain route
 so they can clean it up on startup, as a form of achieving consistent
 state during the crash recovery.
Currently they use combination of routing flags (RTF_PROTO1) to detect
 these routes when interacting via route(4) rtsock protocol.
Netlink protocol has a special "rtm_protocol" field that is filled and
 checked by the route originator. To prepare for the upcoming netlink
 introduction, add ability to record origing to both nexthops and
 nexthop groups via <nhop|nhgrp>_<get|set>_origin() KPI. The actual
 calls will be used in the followup commits.

MFC after: 1 month

22 months agoarm64, riscv: size boot stacks appropriately
Kyle Evans [Wed, 7 Sep 2022 02:11:30 +0000 (21:11 -0500)]
arm64, riscv: size boot stacks appropriately

In 8db2e8fd16c4 ("Remove the secondary_stacks array in arm64 [...]"),
bootstacks was setup to be allocated dynamically.  While this is
generally how x86 does it, it inadvertently shrunk each boot stack from
KSTACK_PAGES pages to a single page.

Resize these back up to the expected size using the kstack_pages
tunable, as we'll need larger stacks with upcoming sanitizer work.

Reviewed by: andrew, imp, markj
Fixes: 8db2e8fd16c4 ("Remove the secondary_stacks array [...]")
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D36475

22 months agorb_tree: reduce duplication in balancing code
Doug Moore [Thu, 8 Sep 2022 04:46:19 +0000 (23:46 -0500)]
rb_tree: reduce duplication in balancing code

Change RB_INSERT_COLOR and RB_REMOVE_COLOR so that the blocks of code
that are identical except for left and right being exchanged are made
only one block with a variable to indicate left- or right-handedness.

Rename RB macros so that those not intended for external use begin
with an underscore.

Add comments to the balancing code so that another might understand it.

Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D36393

22 months agoHyper-V: storvsc: relax a couple more kasserts
Wei Hu [Thu, 8 Sep 2022 04:19:55 +0000 (04:19 +0000)]
Hyper-V: storvsc: relax a couple more kasserts

Seems these kasserts don't work well on ARM64

Fixes: 0af5a0cd2788e
Sponsored by: Microsoft

22 months agorb_tree: test rank balance
Doug Moore [Thu, 8 Sep 2022 02:40:05 +0000 (21:40 -0500)]
rb_tree: test rank balance

With _RB_DIAGNOSTIC defined, provide an RB_RANK method to compute the
rank of a node in an rb-tree, if the subtree rooted at that node is
rank-balanced, and -1 otherwise.

In rb_test, rewrite a bit to avoid malloc/free and nondeterministic
running times because of randomness. Allocate all the nodes on the
stack, and shuffle a set of keys to get randomness for the testing.

Add a rank-balance check for the completed tree.

Reviewed by: markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D36484

22 months agostand: Unbreak FAT32 in loader
Michael Gmelin [Wed, 7 Sep 2022 16:56:49 +0000 (18:56 +0200)]
stand: Unbreak FAT32 in loader

This corrects an issue introduced in b4cb3fe0e39a3, where a freshly
allocated `DOS_FS` structure would not be initialized properly before
use in `dos_open`.

In case of FAT32 file systems, this would leave `fs->dirents`
uninitialized and - depending on its content and due to checks in
`parsebs` - prevent mounting the file system successfully.

This particularily impacted the EFI loader, as it was sometimes not
able to read files from a FAT32-formatted EFI partition, including
LoaderEnv (`/efi/freebsd/loader.env`).

Accepted by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36482

22 months agoUSB: add 2 (3) more device IDs for rtw88-usb devices and a quirk
Bjoern A. Zeeb [Wed, 7 Sep 2022 23:48:59 +0000 (23:48 +0000)]
USB: add 2 (3) more device IDs for rtw88-usb devices and a quirk

Add DLink DWA-182 rev D1 and generic Realtek RTW8821CU entry found on
a Tenda U10 USB WLAN Stick, AC 650 Mbps (and possibly more devices).
The latter first presents itself as a CD device with Windows drivers
(useless on FreeBSD) first so add a quirk for that we get the wireless
device right away.

MFC after: 2 weeks
While here sort some other Realtek entries by DeviceID.

22 months agoLinuxKPI, dev: 80211 update mac80211 KPI
Bjoern A. Zeeb [Wed, 7 Sep 2022 23:38:54 +0000 (23:38 +0000)]
LinuxKPI, dev: 80211 update mac80211 KPI

Update the mac80211 ops KPI for (*conf_tx), (*assign_vif_chanctx),
(*unassign_vif_chanctx), (*start_ap), and (*stop_ap), as well as
ieee80211_beacon_get_tim() and ieee80211_beacon_get_template().

Update in-tree drivers iwlwifi and rtw88 accordingly based on upstream
changes (as well as out-of-tree ones).  This was triggered by trying to
synchronize more drivers to a common state.

MFC after: 1 week

22 months agoLinuxKPI: netdev: expose napi state
Bjoern A. Zeeb [Wed, 7 Sep 2022 23:35:41 +0000 (23:35 +0000)]
LinuxKPI: netdev: expose napi state

There are drivers directly accessing napi->state testing for bits
(NAPI_STATE_SCHED encountered so far).  Rename the internal _flags
struct field to state and expose our internal state flag bits along
with the one official aliased.

As I left in a comment, I wished Linux would hide these accesses
behind inline functions or by other means and not public expose
the implementation details.

MFC after: 1 week

22 months agoLinuxKPI: firmware: add request_partial_firmware_into_buf()
Bjoern A. Zeeb [Wed, 7 Sep 2022 23:33:45 +0000 (23:33 +0000)]
LinuxKPI: firmware: add request_partial_firmware_into_buf()

A (so far out-of-tree) driver update needs
request_partial_firmware_into_buf().  Given we load the full .ko file
using firmware(9) just do that and copy the requeste data into the
buffer (rather than poissibly only reading portions of the firmware
file).

MFC after: 1 week

22 months agonet80211: update (parts of) Action field categories
Bjoern A. Zeeb [Wed, 7 Sep 2022 23:28:13 +0000 (23:28 +0000)]
net80211: update (parts of) Action field categories

Update to the full list of action field category values based on
802.11-2020 with 11ax extensions and remove one value Reserved nowadays.
While here annotate them with descriptions.

Also add Spectrum Management and Radio Measurement action field values
needed in LinuxKPI.

No functional changes.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

22 months agoRELNOTES: Add an entry for use of "intr,nolockd" NFSv4.1/4.2 mounts
Rick Macklem [Wed, 7 Sep 2022 22:55:15 +0000 (15:55 -0700)]
RELNOTES: Add an entry for use of "intr,nolockd" NFSv4.1/4.2 mounts

Add an entry for the commits that make the mount options "intr" and
"nolockd" usable for NFSv4.1/4.2 mounts.

22 months agoRELNOTES: Add an entry for new NFSv4.1/4.2 console messages
Rick Macklem [Wed, 7 Sep 2022 22:35:55 +0000 (15:35 -0700)]
RELNOTES: Add an entry for new NFSv4.1/4.2 console messages

Add and entry for the commits that generate new console messages
indicating that all clients need to have unique /etc/hostid strings.

22 months agomount_nfs.8: Update for NFSv4 use of "nolockd"
Rick Macklem [Wed, 7 Sep 2022 21:07:20 +0000 (14:07 -0700)]
mount_nfs.8: Update for NFSv4 use of "nolockd"

Commit 33721eb991d8 enabled use of "nolockd" for
NFSv4 mounts.  This was done primarily to allow its
use with the "intr" mount option.

This patch updates the man page for this.

This is a content change.

Reviewed by: gbe (manpages), karels
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36462

22 months agovfs: flip a condition around in kern_statat
Mateusz Guzik [Wed, 7 Sep 2022 20:05:32 +0000 (22:05 +0200)]
vfs: flip a condition around in kern_statat

error tends to be 0.

22 months agosnd_hda: Remove duplicate erroneous HDA_INTEL_ALLKPS line
Neel Chauhan [Wed, 7 Sep 2022 18:05:01 +0000 (11:05 -0700)]
snd_hda: Remove duplicate erroneous HDA_INTEL_ALLKPS line

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D36483

22 months agoCirrus-CI: move QEMU pkg installation to test script
Ed Maste [Wed, 7 Sep 2022 14:12:37 +0000 (10:12 -0400)]
Cirrus-CI: move QEMU pkg installation to test script

Occasionally the QEMU package fails to build and isn't available on
-CURRENT using the Latest package set.  Move the package installation
to the test script, so that if the package isn't available we at least
still perform a build test.

Sponsored by: The FreeBSD Foundation

22 months agosnd_hda: Add the full Intel AlderLake HD Audio PCI IDs
Neel Chauhan [Wed, 7 Sep 2022 02:35:02 +0000 (19:35 -0700)]
snd_hda: Add the full Intel AlderLake HD Audio PCI IDs

This is based off the Linux file sound/hda/intel-dsp-config.c.

Reviewed by: imp (src)
Tested on: HP Spectre x360 16-f0023dx
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D36476

22 months agoHyper-V: storvsc: relax a kassert check
Wei Hu [Wed, 7 Sep 2022 15:06:54 +0000 (15:06 +0000)]
Hyper-V: storvsc: relax a kassert check

On ARM64 this kassert check could cause unnecessary panic.

Sponsored by: Microsoft

22 months agonet80211(4): Bring back an accidently reverted grammar correction
Gordon Bergling [Wed, 7 Sep 2022 11:35:45 +0000 (13:35 +0200)]
net80211(4): Bring back an accidently reverted grammar correction

- s/that that/that/

Reported by: se, danfe
MFC after: 3 days

22 months agonet80211(4): Correct a grammar mistake in a source code comment
Gordon Bergling [Wed, 7 Sep 2022 11:13:54 +0000 (13:13 +0200)]
net80211(4): Correct a grammar mistake in a source code comment

- s/the/be the/
- s/Mhz/MHz/
- s/it'll/it will/

Reported by: bz, danfe
MFC after: 3 days

22 months agonet: retire PFIL_FWD
Mateusz Guzik [Fri, 2 Sep 2022 16:37:55 +0000 (18:37 +0200)]
net: retire PFIL_FWD

It is now unused and not having it allows further clean ups.

Reviewed by: cy, glebius, kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D36452

22 months agonet: remove stale altq_input reference
Mateusz Guzik [Tue, 6 Sep 2022 18:12:54 +0000 (18:12 +0000)]
net: remove stale altq_input reference

Code setting it was removed in:
commit 325fab802e1f40c992141f945d0788c0edfdb1a4
Author: Eric van Gyzen <vangyzen@FreeBSD.org>
Date:   Tue Dec 4 23:46:43 2018 +0000

    altq: remove ALTQ3_COMPAT code

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

22 months agovmm: Remove unneeded variable maxcpus
Emmanuel Vadot [Wed, 7 Sep 2022 09:40:03 +0000 (11:40 +0200)]
vmm: Remove unneeded variable maxcpus

Reported by: FreeBSD User <freebsd@walstatt-de.de>
Fixes: a5a918b7a906 ("vmm: permit some IPIs to be handled by userspace")

22 months agomvneta: Use clkgen API on armv7
Albert Jakieła [Tue, 6 Sep 2022 08:33:34 +0000 (10:33 +0200)]
mvneta: Use clkgen API on armv7

With addition of clkgen devices to the Armada38x we no longer
need to rely on get_tclk() to get the device frequency.
Leave it as a fallback, just in case.

Reviewed by: manu
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36465

22 months agomv_twsi: Use the clock API on armv7
Albert Jakieła [Mon, 11 Jul 2022 13:45:28 +0000 (15:45 +0200)]
mv_twsi: Use the clock API on armv7

With the addition of clkgen devices to the Armada38x, there is
no longer any need to use the get_tclk() hack.

Reviewed by: manu
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36456

22 months agoAdd ARMADA38X gateclk control
Albert Jakieła [Tue, 12 Jul 2022 09:16:21 +0000 (11:16 +0200)]
Add ARMADA38X gateclk control

This patch introduces basic gate control driver for Armada38x SoC.
Each gate controls coreclk output to a given peripheral.

Reviewed by: manu
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36455

22 months agoAdd ARMADA38X clkgen driver
Albert Jakieła [Tue, 5 Jul 2022 15:01:02 +0000 (17:01 +0200)]
Add ARMADA38X clkgen driver

This patch introduces clkgen driver for Armada38x SoCs.
Clock topology consists of single coreclk which supplies
clock signal to CPU cores and peripherials.

Reviewed by: manu
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36453

22 months agouart_bus_acpi: Read clock frequency from bus
Mateusz Kozyra [Tue, 6 Sep 2022 14:54:00 +0000 (16:54 +0200)]
uart_bus_acpi: Read clock frequency from bus

It is stored in the clock-frequency property.
In case of failure, fallback to the harcoded value stored in the
compat data.
Also, while here improve style.
Tested on LS1046ARDB and x86 PC.

Reviewed by: mw
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36326

22 months agovmm: permit some IPIs to be handled by userspace
Corvin Köhne [Wed, 7 Sep 2022 07:07:03 +0000 (09:07 +0200)]
vmm: permit some IPIs to be handled by userspace

Add VM_EXITCODE_IPI to permit returning unhandled IPIs to userland.
INIT and Startup IPIs are now returned to userland. Due to backward
compatibility reasons, a new capability is added for enabling
VM_EXITCODE_IPI.

MFC after:              2 weeks
Differential Revision:  https://reviews.freebsd.org/D35623
Sponsored by:           Beckhoff Automation GmbH & Co. KG

22 months agobhyve: create all vcpus on startup
Corvin Köhne [Wed, 7 Sep 2022 07:05:36 +0000 (09:05 +0200)]
bhyve: create all vcpus on startup

vcpus could be restarted by the guest by sending an INIT SIPI SIPI
sequence to a vcpu. That's not supported by bhyve yet but it will be
supported in a future commit. So, create the vcpu threads only once on
startup to make restarting a vcpu easier.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35621
Sponsored by: Beckhoff Automation GmbH & Co. KG

22 months agoFix build.
Xin LI [Wed, 7 Sep 2022 06:41:10 +0000 (23:41 -0700)]
Fix build.

Pointy hat to: delphij
MFC after: 2 weeks
X-MFC-with: c65e42dbde41

22 months agoMFV: cherry-pick "PR/358: Fix width for -f - (jpalus)"
Xin LI [Wed, 7 Sep 2022 06:31:20 +0000 (23:31 -0700)]
MFV: cherry-pick "PR/358: Fix width for -f - (jpalus)"

MFC after: 1 week
PR: bin/266264

22 months agoPR/358: Fix width for -f - (jpalus)
Christos Zoulas [Mon, 4 Jul 2022 17:00:51 +0000 (17:00 +0000)]
PR/358: Fix width for -f - (jpalus)

(cherry picked from commit 19bf47777d0002ee884467e45e6ace702e40a4c1)

22 months agolibc: add test case for qsort_b(3)
Xin LI [Wed, 7 Sep 2022 06:11:46 +0000 (23:11 -0700)]
libc: add test case for qsort_b(3)

Reviewed by:  markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36463

22 months agodivert(4): do not depend on ipfw(4)
Gleb Smirnoff [Wed, 7 Sep 2022 03:54:57 +0000 (20:54 -0700)]
divert(4): do not depend on ipfw(4)

Although originally socket was intended to use with ipfw(4) only, now
it also can be used with pf(4).  On a kernel without packet filters,
it still can be used to inject traffic.

22 months agodivert(4): don't check for CSUM_SCTP without INET
Gleb Smirnoff [Wed, 7 Sep 2022 03:54:57 +0000 (20:54 -0700)]
divert(4): don't check for CSUM_SCTP without INET

This compiles, but actually is a dead code.

Noticed by: bz
Fixes: e72c522858cb

22 months agotests: partial revert of 4627bc1e90fd17c8d4f44de6b932d456b67661fc
Gleb Smirnoff [Wed, 7 Sep 2022 03:54:49 +0000 (20:54 -0700)]
tests: partial revert of 4627bc1e90fd17c8d4f44de6b932d456b67661fc

Python's socketmodule isn't able to construct sockaddr when it doesn't
recognize the address family.  Until this is solved in python let the
tests use the compatibility way to create divert(4) socket.

22 months agoipfilter: Remove unused ioctl
Cy Schubert [Tue, 6 Sep 2022 20:58:35 +0000 (13:58 -0700)]
ipfilter: Remove unused ioctl

The SIOCSTAT1 ioctl is only used in ip_auth and is unused in ip_state.
The ip_state version was likely added to support a new statistic yet
to be developed in ipfstat(8) or for some sample userspace application
(similar in fashion to the sample provided for authentication rules).
There is no need to report individual state hash table bucket lengths
to any future userspace application.

If needed for any future debugging purposes a DTrace probe would be a
better vehicle.

This unused ioctl in ip_stat results in a panic.

PR: 266124
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days

22 months agoipfilter: Remove IPL_SELECT
Cy Schubert [Fri, 25 Mar 2022 03:15:49 +0000 (20:15 -0700)]
ipfilter: Remove IPL_SELECT

IPL_SELECT was used for HP-UX >= 11.11 only. Remove this de trop code.

MFC after: 3 days

22 months agoCTL: Validate IOCTL parameters.
Alexander Motin [Wed, 7 Sep 2022 01:58:27 +0000 (21:58 -0400)]
CTL: Validate IOCTL parameters.

It was possible to cause kernel panic by passing too large args_len
or non-NULL result_nvl.

Though since the /dev/cam/ctl device is accessible only by root and
used only by limited number of tools it was not a big problem.

PR: 266115
PR: 266136
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 1 week