Commit Graph

308415 Commits

Author SHA1 Message Date
Lexi Winter aa0bc7cca1 boot1.chrp: Specify --image-base
This is required for LLVM 22's ld.lld to avoid a build error:

ld.lld: error: section '.text' address (0x38000) is smaller than image base (0x10000000); specify --image-base
ld.lld: error: section '.rodata' address (0x3b308) is smaller than image base (0x10000000); specify --image-base
ld.lld: error: section '.data' address (0x3b610) is smaller than image base (0x10000000); specify --image-base
ld.lld: error: section '.bss' address (0x3f618) is smaller than image base (0x10000000); specify --image-base

Use 0x38000 for the image base, which is the address of the lowest
(and only) LOAD segment in the file.

Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D56459
2026-04-18 21:15:26 +01:00
Michael Tuexen cca22c36c3 iflib: fix book keeping
iflib_txq_drain() returns the number of consumed entries. In the case
of TSO, a single entry can contain multiple TCP packets.

Reported by:		Ricardo Branco, David Wolfskill
Reviewed by:		gallatin
Fixes:			3fade68cfd ("iflib: accurately count bytes/segments for TSO")
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D56509
2026-04-18 21:57:40 +02:00
Andrew Gallatin 29336f1c9d tcp: Allocate t_tcpreq_info on demand
When TCP_REQUEST_TRK is enabled, the tcb grows by 600 bytes
to accommodate the t_tcpreq_info[MAX_TCP_TRK_REQ] array.
Even when the option is enabled, not every connection is using
this feature.  So let's allocate it on-demand, and save 600
bytes in the common case.

Sponsored by: Netflix
Reviewed by: rrs, tuexen
Differential Revision: https://reviews.freebsd.org/D56484
2026-04-18 15:04:05 -04:00
Bjoern A. Zeeb 90383181aa rtw88: update module Makefile for v7.0 driver version
Update LINUXKPI_VERSION to reflect that the driver is based on
Linux v7.0.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 14:21:36 +00:00
Bjoern A. Zeeb 41b641cc05 rtw88: update Realtek's rtw88 driver
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
028ef9c96e96197026887c0f092424679298aae8 ( tag: v7.0 ).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 14:21:04 +00:00
Dag-Erling Smørgrav 480ba21efd README: Update and harmonize
MFC after:	1 week
Reviewed by:	imp, markj, jhb
Differential Revision:	https://reviews.freebsd.org/D56499
2026-04-18 16:12:32 +02:00
Dag-Erling Smørgrav d618ba314d du: Set BLOCKSIZE before running tests
Several testcases assume BLOCKSIZE=K, so set it at the top of the
script.  This fixes an issue where the tests would sometimes fail
when run under sudo.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D56476
2026-04-18 14:48:04 +02:00
Mark Johnston 9899c8da0c gdb: Print a stack trace if a python command raises an error
MFC after:	1 week
2026-04-18 12:26:29 +00:00
Mark Johnston 8de0fc10a1 routing: Use a better error number in sysctl_fibs()
ENOTCAPABLE is for capsicum and its use here is inappropriate.  In
particular, note that syscallret() treats this value specially.

Reviewed by:	glebius, pouria, zlei
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56481
2026-04-18 12:26:29 +00:00
Mark Johnston 2b264cb802 routing: Initialize V_rt_numfibs earlier during boot
V_rt_numfibs can be set at compile time (with the ROUTETABLES kernel
config option) or boot time (with the net.fibs tunable).
vnet_rtables_init(), running during SI_PROTO_DOMAIN, was checking the
tunable and updating V_rt_numfibs accordingly, but that means that
earlier SYSINITs, such as vnet_mroute_init(), see the compile-time value
for V_rt_numfibs before it gets corrected in vnet_rtables_init().

Fix this by initializing V_rt_numfibs earlier, so that SYSINITs are less
likely to use the wrong value.

Add a comment describing the weird, preexisting semantic of resetting
rt_numfibs to 1 in VNET jails.

PR:		294510
Reviewed by:	glebius, zlei, pouria
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56473
2026-04-18 12:26:16 +00:00
Lexi Winter ba94d75749 stand/common/load_elf: Do kernel module relocations for PPC
reloc_ptr() skips relocations for the kernel module, because on most
platforms the kernel is ET_EXEC and this is not required.  On PPC,
the kernel is ET_DYN and we need to relocate here, otherwise the
module metadata will not be loaded properly and the kernel module
will have an incorrect version, preventing module dependencies from
resolving.

This fixes loading kernel modules from loader.conf on powerpc.

Diagnosed by:	jrtc27
Reviewed by:	jrtc27, adrian
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D56457
2026-04-18 13:07:10 +01:00
Bjoern A. Zeeb 25e776a543 LinuxKPI: 802.11: add struct/fields and functions for v7.0
Add 802.11 struct fields and functions support for Linux v7.0 based
wireless drivers (at least iwlwifi, rtw88, rtw89).

While here cleanup some other bits.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 12:00:00 +00:00
Bjoern A. Zeeb a0112b013f LinuxKPI: 802.11: Add structures and functions for NAN support
In Linux v7.0 iwlwifi(4) started to add support for Wi-Fi Aware(tm)
also known as Neighbor Awareness Networking (NAN).

Add structures and fields for this as needed so far to keep the driver
compiling.  net80211 has no support for it as a new mode.

We may consider a dedicated header file for these parts in the future
depending on how much more is to come.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 12:00:00 +00:00
Bjoern A. Zeeb f252ce0089 LinuxKPI: 802.11: set IEEE80211_MIN_ACTION_SIZE according to struct
IEEE80211_MIN_ACTION_SIZE came up in the mt76 vendor subtree merge
as one of the non-mechanical changes which made me look.
Rather than (incorrectly) hand counting the offset from the beginning
of a frame, use the offset from the beginning of struct ieee80211_mgmt.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 12:00:00 +00:00
Christos Margiolis c39237a4fd mixer(3): Rename _mixer_readvol() to mixer_readvol()
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-04-18 13:50:04 +02:00
Christos Margiolis ec077230fd Revert "sound: Remove some forward declarations from sound.h and uaudio.h"
This reverts commit 602249f033.
2026-04-18 13:30:20 +02:00
Christos Margiolis 602249f033 sound: Remove some forward declarations from sound.h and uaudio.h
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-04-18 12:50:03 +02:00
Dag-Erling Smørgrav 7e9d974bc0 libarchive: Staticize some variables
This code was not being built due to errors in our libarchive
configuration.  Now that those have been addressed, staticize some
variables that trip a “no previous extern declaration” error.  This
is a subset of upstream PR 2962.

MFC after:	1 week
Reviewed by:	mm
Differential Revision:	https://reviews.freebsd.org/D56471
2026-04-18 10:25:35 +02:00
Dag-Erling Smørgrav 05bbe5e388 libarchive: Update configuration
PR:		294577
MFC after:	1 week
Reviewed by:	mm
Differential Revision:	https://reviews.freebsd.org/D56468
2026-04-18 10:25:31 +02:00
Mateusz Guzik 8c94a1ea15 pipe: retire the unused PIPE_LWANT macro 2026-04-18 08:17:56 +00:00
Warner Losh 4ed20e0236 kshim/usb: Add build option.
Add WITH{,OUT}_LOADER_USB to build the kshim usb library. Nothing
in-tree uses it, but this will make it easier to keep building. Updated
src.conf.5 with a few extra changes...

Sponsored by:		Netflix
2026-04-17 20:41:43 -06:00
Bjoern A. Zeeb f1834d03af LinuxKPI: implement devm_kmemdup_array()
Implement devm_kmemdup_array() using devm_kmemdup() in order to
prepare for Linux v7.0 based drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D56396
2026-04-18 01:12:14 +00:00
Bjoern A. Zeeb c72ac6af08 LinuxKPI: add kmalloc_obj[s], kzalloc_obj[s], and kzalloc_flex
Drivers in Linux v7.0 seem to have changed to the new allocation
macros using a sweep.  Add the ones I encountered with wireless
drivers so far.  They all take an optional argument for a gfp_t,
which default_gfp() deals with.

The plural version "objs" takes an extra nitems argument in addition
to the size.  We use size_mul() to possibly detect overflows.

The "flex" version uses an extra variable to track the variable sized
array allocations and if supported by the compiler will use
__builtin_counted_by_ref() to properly track bounds.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D56395
2026-04-18 01:12:13 +00:00
Bjoern A. Zeeb d2c85255d4 LinuxKPI: sync overflow.h from Linux v7.0
overflow.h was imported directly from Linux in 3208d4ad2b.
Update the file to the newer version as needed for v7.0 driver updates.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Obtained from:	git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
		028ef9c96e96197026887c0f092424679298aae8 (tag: v7.0)
Reviewed by:	emaste, dumbbell
Differential Revision: https://reviews.freebsd.org/D56394
2026-04-18 01:12:13 +00:00
Bjoern A. Zeeb 524df650a9 LinuxKPI: conditionally add __flex_counter()
__flex_counter() is used by overflow.h and needed for "flex allocations".
It is either a void * typed 0 (NULL) (like this for _Generic checks),
or uses __builtin_counted_by_ref.

The latter was added to gcc and llvm fairly recently and while for gcc
the __has_builtin() check suffices, clang had parts broken until recently
so needs an extra check for the next major version.  The fixed hash is
currently not part of any tag to use, so we play it save (and hope 23
will have it).  It will be a while until we will see the builting to be
used but at least we will be prepared for it.  See inline comments for
the commit hashes and versions which added the feature.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D56393
2026-04-18 01:12:12 +00:00
Bjoern A. Zeeb 35b90c21f4 LinuxKPI: add default_gfp()
Various new allocation macros can take an optional gfp_t argument.
If the argument is not given we need to set the GFP_KERNEL default.
While this is only internally used and I initialy called it differently,
should this spread elsewhere having the same name as in Linux will be
good.

Sponsored by:	The FreeBSD Foundaton
MFC after:	3 days
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D56392
2026-04-18 01:12:12 +00:00
Bjoern A. Zeeb 98297ff3cf LinuxKPI: move hex2bin() from kernel.h to new hex.h
New Linux v7.0 drivers include hex.h.  Rather than adding a dummy
header, migrate the kernel.h hex2bin() into hex.h, where it belongs.
Care needs to be taken as the _h2b() helper function is still used by
other bits in kernel.h.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste, dumbbell
Differential Revision: https://reviews.freebsd.org/D56391
2026-04-18 01:12:12 +00:00
Bjoern A. Zeeb 125b09de09 net80211: radiotap: add more VHT flags, and struct
Add the struct for VHT information and flags for the known and flag
field as documented on radiotap.org.  iwlwifi has started filling in
these details.

While here, add Copyright information for all the additions in the
last years.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 01:12:12 +00:00
Bjoern A. Zeeb f5cd992fa9 bnxt_en: fix module Makefile for LinuxKPI
Rather than manually including the include directory for LinuxKPI
use the provided macro.  Before there was no -I for the dummy
directory and as files synced from Linux under a permissive license
may include them the build would fail.  overflow.h will include
linux/const.h which only exists as a dummy header at this point
on FreeBSD.

Sponsored by:	The FreeBSD Foundation
Fixes:		35b53f8c98
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D56424
2026-04-18 01:12:11 +00:00
Bjoern A. Zeeb 99bbfb77e3 rtw89: add a warn about beacon_int or dtim_period being 0
While after the changes to LinuxKPI 802.11 we should never be assoc
and not have dtim_period set, we have seen before that this could
happen.  Add a WARN as that will help debugging the following DIV 0.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 01:12:11 +00:00
Bjoern A. Zeeb 9f20a4ebf0 LinuxKPI: 802.11: make sure dtim_period is set
When going from ASSOC to RUN LinuxKPI based wireless drivers have
certian expectations written in various ways.  I believe mac80211
waits to see a beacon before setting the vif to assoc (or the sta
to AUTHORIZED).  We have some comments in lkpi_update_dtim_tsf()
for that.
In practice we can filter out the beacons already and know when
they came in as we count them but it is hard to split up the
state machine and defer the work.

So we make sure that dtim_period is set to at least 1 before
calling the (*vif_cfg_change) after setting assoc to true;
0 is a reserved value according to the standards.

We will update it once we see a beacon and in case the value
differs from 1 shortly afterwards from the recv_mgmt callback.

While iwlwifi seems to have coped with our initial implementation,
rtw89 may hit a DIV 0 if dtim_period is 0 depending on how well
the rx path races with our unlocking in assoc_to_run.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 01:12:10 +00:00
Bjoern A. Zeeb dc886a4428 LinuxKPI: 802.11: start filling vif->cfg.ap_addr
vif->cfg.ap_addr is used by various drivers now and is the BSSID for
non-MLO or the AP addr for MLO configurations.

If this is unset rtw89 gets cranky and certain packets are likely not
going out correctly (also for iwlwifi).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 01:12:10 +00:00
Bjoern A. Zeeb 72b9dda511 LinuxKPI: 802.11: add chandef tracing
Add chandef tracing so we can follow what is set and unset in the
chanctx emulation for drivers still needing this.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 01:12:09 +00:00
Bjoern A. Zeeb 166a7344df LinuxKPI: 802.11: improve emulate chanctx implementation
Now that all dependencies are implemented improve our chanctx emulation.
Some drivers still rely on chandef information for channel work.

In order to only do chanctx updates within mac80211 in Linux and
likewise in the LinuxKPI 802.11 compat layer, emulation functions
were introduced which claim to support chanctx driver operation but
in reality convert these to chandef field updates and (*config)
downcalls.

This is relevant to several mt76 chipsets (at least 7615, 7915),
and rtw88 and certain rtw89 chipsets (8851b, and the ones not supporting
SCAN_OFFLOAD or BEACON_FILTER) for us.

Migrate the logic out of the header and improve it.

Make use of the introduced dflt_chandef and scan_chandef fields,
add comparison of chandefs to see if we have to update, etc.

Also add strict checks for driver settings in linuxkpi_ieee80211_alloc_hw()
to make sure all preconditions are correctly met.  Store the result
if we are using the emulation functions in a field, so we can later
check on it and also leave a note to the users if emulation is used
in order to improve debugging on possible problem reports.

Use the new field that we use emulation in lkpi_ic_set_channel() instead
of a hand crafted check.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Fixes:		ac1d519c01 ("LinuxKPI: 802.11: adjustments for v6.11..")
2026-04-18 01:12:09 +00:00
Bjoern A. Zeeb 491f5876bf LinuxKPI: 802.11: rework lkpi_ic_set_channel()
We are called by net80211 when channel changes are happening and
we have to map this to LinuxKPI 802.11.  There are multiple cases:
(1) it is a hardware scan and net80211 still changes the channel;
    we do not need to;
(2) it is a software scan (the magic fallback case) in which case
    we let net80211 drive the scan channel and we need to keep
    a copy of the scan_chandef (see follow-up commit);
(3) no scanning but a normal channel change triggerd by net80211;
    in that case we could (should?) setup the full flags right away
    but deferred LinuxKPI logic currently handle this for us as not
    in all cases the information was fully available from net80211
    in times we would have needed it.  We only do this in order
    to handle the emulate chanctx cases but do not change the
    channel otherwise; scan_to_auth will set the correct chanctx.
(3a) we have no (active) chanctx for that, create/set one,
(3b) we do have an (active) chanctx for this, use it but reset to
     defaults.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 01:12:09 +00:00
Bjoern A. Zeeb 88cb1e17f4 LinuxKPI: 802.11: factor out getting and setting a chanctx
Further factor out acquiring the chanctx (either set or new),
as well as populating a chanctx with information.
This further simplifies lkpi_sta_scan_to_auth() and gives us
more reusable function blocks.

Sponsored by:	The FreeBSD Foundation
MFC after;	3 days
2026-04-18 01:12:09 +00:00
Bjoern A. Zeeb e62c92c0a5 LinuxKPI: 802.11: keep chanctx on a reserved list
Keep the chanctx around as we may swap them.

In the future (11be) these lists likely need to be (a) limited to
maximum number of chanctx possible (see struct ieee80211_iface_limit),
and (b) with that also by radio.

For the moment keep this simple and start with a single chanctx
and build up from there when we get there.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 01:12:08 +00:00
Bjoern A. Zeeb ced6909dd6 LinuxKPI: 802.11: save the default channel
Add a field to struct lkpi_hw to save the default channel for later
reuse.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 01:12:08 +00:00
Bjoern A. Zeeb 695f0f0d03 LinuxKPI: 802.11: factor out chandef/chanctx initialization
Factor out chandef and chanctx initialization from lkpi_sta_scan_to_auth().
This makes the code a lot more readable and prepares for the next steps
that will re-use some of this.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-04-18 01:12:07 +00:00
Pouria Mousavizadeh Tehrani f6bcc0925f tests/netinet6: Add test for route information option
Test handling of receiving multiple route information options in RA.

Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D56216
2026-04-18 02:22:26 +03:30
Pouria Mousavizadeh Tehrani c173f02045 tests/netinet6: Add SLAAC and RA validation tests to ndp
* RA hop limit validation
* RA source address validation
* Multi router RA validation
* Two hour rule RA validation
* SLAAC onlink prefix switching test

Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D56128
2026-04-18 02:22:24 +03:30
Pouria Mousavizadeh Tehrani 72043945c3 nd6: Remove goto and unused condition in prelist_update
While here, style it.

Reviewed by: markj, zlei
Differential Revision: https://reviews.freebsd.org/D56136
2026-04-18 02:22:23 +03:30
Pouria Mousavizadeh Tehrani 5f27592e14 nd6: Break nd6_prefix_lifetime_update out of prelist_update
Logic of updating prefix lifetime is big enough that deserves
its own function.
While here, fix style.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D56135
2026-04-18 02:22:21 +03:30
Pouria Mousavizadeh Tehrani e808119061 nd6: Remove anycast check in prelist_update
RFC 2462 is obsoleted by RFC 4862 and it made statements more
clear than before.
Considering SLAAC can't create anycast addresses by itself, remove
its check.
While here, update comments based on RFC 4862.

Reviewed by: markj, zlei
Differential Revision: https://reviews.freebsd.org/D56134
2026-04-18 02:22:19 +03:30
Pouria Mousavizadeh Tehrani 05f2acd344 nd6: Ignore entire PI if violates RFC 4862 section 5.5.3
Ignore prefix information update earlier in `prelist_update()`.
If PI is invalid or autonomous bit is unset, we better to let our
SLAAC address expire and if we don't have any previous matching
prefix, better not to create new one.
Because either our router don't want us to have one anymore, or
the very RA is malicious.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D56133
2026-04-18 02:22:18 +03:30
Pouria Mousavizadeh Tehrani d022dd8205 nd6: Change prelist_update return type to void
The return value of `prelist_update()` is unused.

Reviewed by: markj, zlei
Differential Revision: https://reviews.freebsd.org/D56132
2026-04-18 02:22:17 +03:30
Pouria Mousavizadeh Tehrani ced1de238f nd6: Break pfxrtr_add out of nd6_prelist_add
Updating defrouter only required by `prelist_update()`.
since `nd6_prelist_add()` is a public function, exclude unsed
dr logic from it.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D56131
2026-04-18 02:22:15 +03:30
Pouria Mousavizadeh Tehrani d96e8cb4e7 nd6: Break nd6_prefix_update out of prelist_update
if PI exists, call prefix_update, instead of doing it inside
the prelist_update.
no functional change intended.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D56130
2026-04-18 02:22:13 +03:30
Olivier Certner 0a764beb62 acpi_spmc(4): Remove redundant setting of 'sc->dev' on attach
Should have been part of the previous commit (but PEBCAK).

Reviewed by:    obiwac
Fixes:          bd05b47fbd ("acpi_spmc(4): Small probe improvements/fixes")
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56483
2026-04-17 23:04:50 +02:00
Christos Margiolis 788d71e73f virtual_oss.8: Remove CPU performance example
See also:	https://github.com/freebsd/virtual_oss/issues/2
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-04-17 22:48:38 +02:00