aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
* linuxkpi: Support s2idle in `pm_suspend_target_state`Aymeric Wibo36 hours1-10/+20
| | | | | | | | | | | | | | | When going to s2idle, set Linux' pm_suspend_target_state to PM_SUSPEND_TO_IDLE instead of setting PM_SUSPEND_MEM (for S3) in all cases. This is necessary because more recent versions of the amdgpu DRM drivers have different paths for when entering s2idle & S0ix is supported than S3. Reviewed by: bz Approved by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51591
* power: Add stype parameter in power_suspend/resume eventhandlersAymeric Wibo36 hours1-2/+5
| | | | | | | | | | Add enum sleep_type stype parameter in power_suspend/resume event handlers, as with the introduction of s2idle there are more than one type of suspend. Reviewed by: bz Approved by: bz Sponsored by: The FreeBSD Foundation
* LinuxKPI: pci: implementation of [lkpi_]pci_get_slot()Bjoern A. Zeeb8 days2-0/+21
| | | | | | | | | | | | | | | | | Like lkpi_pci_get_domain_bus_and_slot() implement lkpi_pci_get_slot() using pci_find_bsf() instead of pci_find_dbsf() (no domain). This is needed for a wireless driver. Unfortunately the name [pci_get_slot()] collides with the native PCI function. Add a guard around it and disable the use when the native version is required (in lkpifill_pci_dev() and in bnxt/bnxt_en; if the latter gets fixed we can probably also fix work around it in the former; further conflicts in drm-kmod 6.1-lts, 6.6-lts, and master were resolved). Sponsored by: The FreeBSD Foundation (initially) MFC aftre: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52065
* Reapply "LinuxKPI: pci: allocate entire pci_dev hiereachy up to root port on ↵Bjoern A. Zeeb8 days1-7/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | attach" In linux_pci_attach_device() allocate a LinuxKPI pci_dev for each device in the hierarchy up to the root port[1] as we cannot do that later on demand as we may be in a context where we may not sleep. Take special care of DRM as there is a non-PCI device in the chain which needs to be skipped. iwlwifi(4) can hit this case called from a callout. While here leave a comment sa the cleanup order of linux_pci_attach_device() needs correction seperately. This reverts commit 3860afe99ec39b9942967941181f28f27f3fc548. Sponsored by: The FreeBSD Foundation (initially) PR: 283027 PR: 289647 Suggested by: jhb [1] MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52069
* linuxkpi: Move string_helpers.h to string_choices.hEd Maste2025-09-192-63/+75
| | | | | | | | | | | | Chace Linux change fca76071bab2 ("lib/string_helpers: Split out string_choices.h") from v6.5. Everything that we implemented from string_helpers.h has moved, so rename the file, update the include guards, and add a new dummy string_helpers.h that just #includes it. This matches Linux for the functionality that we have. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52606
* linux: getsockopt(): Simplify exporting groups a bitOlivier Certner2025-09-171-6/+6
| | | | | | | | | | | | | | | | | | | No functional change (intended). Go through conversion to a 'l_gid_t' before copying out in order to cope with differing group types (except for not representable values, of course). This is what is done, e.g., for getgroups() in 'linux_misc.c'. As Linux's group type is the same as ours on all architectures, we could as well just stop bothering and copy out our memory representation, eliminating the loop here. Whatever the choice, though, it has to be consistent here and there. Introduce 'out' of type 'l_gid_t' to avoid performing "by hand" array arithmetics when copying out. MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52280
* linux: setgroups16(): Pre-extend the groups arrayOlivier Certner2025-09-171-0/+1
| | | | | | | | | | For the size we know we will need in the end. No functional change (intended). MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52279
* linux: setgroups(): Avoid allocation under the process lockOlivier Certner2025-09-171-2/+1
| | | | | | | | | | | This was missed in commit 838d9858251e ("Rework the credential code to support larger values of NGROUPS (...)"). No functional change (intended). MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52278
* linux: setgroups(): Fix the group number's upper limitOlivier Certner2025-09-172-2/+2
| | | | | | | | | | | 'ngroups_max' is the maximum number of supplementary groups the system will accept, and this has not changed. Fixes: 9da2fe96ff2e ("kern: fix setgroups(2) and getgroups(2) to match other platforms") MFC after: 5 days MFC to: stable/15 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52277
* linux: Simplify further getgroups() after 'cr_gid' not in cr_groups[]Olivier Certner2025-09-172-40/+32
| | | | | | | | | | | No functional change (intended). While here, fix/improve style a bit and in setgroups(). MFC after: 5 days MFC to: stable/15 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52276
* Revert "linux: fix reporting NL_RTM_DELLINK to Netlink sockets"Gleb Smirnoff2025-09-111-13/+26
| | | | | | | | | I received a report that certain Linux application would crash on a message of a departure of an interface with FreeBSD name. Looks like dropping NL_RTM_DELLINK is a lesser evil than relay them with FreeBSD names. This reverts commit 554907bac3b264863a051f75eedc35d180d3e18c.
* LinuxKPI: 802.11: avoid recursive wiphy lockBjoern A. Zeeb2025-09-111-18/+36
| | | | | | | | | | | When freeing the last reference of the net80211 node the net80211 node_free() code may directly call into the crypto code to delete the keys. While we still holding the wiphy lock this would lead to a recursion on the non-recursive wiphy lock. Defer freeing the reference until we are back under the net80211 com lock. Reported by: Mark Phillips (mark freebsdfoundation.org) on 15.0-ALPHA1 MFC after: 3 days
* Revert "LinuxKPI: pci: allocate entire pci_dev hiereachy up to root port on ↵Bjoern A. Zeeb2025-09-081-40/+7
| | | | | | | | | attach" It turns out this breaks the nvidia-drm drviers. We'll try to rework things and put it back later. This reverts commit bbeeb585315645db20118ef349a4e3dc83b148cc.
* LinuxKPI: devres: divorce dem_kfree from lkpi_devm_kmalloc_releaseBjoern A. Zeeb2025-09-052-3/+28
| | | | | | | | | | | | | | dem_kfree() is called from all over the place and should actually do something; contrary to lkpi_devm_kmalloc_release() it can also take a const void *. We have to __DECONST() that though as the entire devres framework does otherwise not take a const argument. This was discovered during the rtw89 upadte to 6.16. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52082
* LinuxKPI: maths64: implement roundup_u64()Bjoern A. Zeeb2025-09-051-0/+6
| | | | | | | | | Needed by a wifi driver update. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52080
* LinuxKPI: kunit: add static_stub.h and more dummy headersBjoern A. Zeeb2025-09-054-0/+15
| | | | | | | | | These came up during a wifi driver update. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52079
* LinuxKPI: sync overflow.h from Linux v6.16Bjoern A. Zeeb2025-09-051-27/+153
| | | | | | | | | | | | It seems overflow.h wsa imported directly from Linux in 3208d4ad2b8320a. Update the file to the newer version as needed for wireless driver updates. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Obtained from: git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 038d61fd642278 (tag: v6.16) Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52078
* LinuxKPI: add __struct_sizeBjoern A. Zeeb2025-09-051-0/+6
| | | | | | | | | | | | | | Use __builtin_object_size() by default. If __builtin_dynamic_object_size() is available use that instead. I would hope that in a future version we can remove the conditional checks but in order to be able to MFC this without checking all compiler versions simply keep it this way for now. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52077
* LinuxKPI: add DEFINE_LOCK_GUARD_0 for rcuBjoern A. Zeeb2025-09-052-1/+39
| | | | | | | | | | | | | This adds guard support for non-real-types like rcu locking meaning that we need to keep the lock state separately ourselves. _T is still special and needs to be updated. Given it may not be used it needs an __unused attribute (we are using the LinuxKPI __maybe_unused which indeed is more expressive in this case). Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52076
* LinuxKPI: cleanup: implement __free() and DEFINE_FREE(); use for kfree()Bjoern A. Zeeb2025-09-052-1/+17
| | | | | | | | | A wifi driver update needs this. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52075
* LinuxKPI: timer KPI *_timer -> timer_*Bjoern A. Zeeb2025-09-052-11/+16
| | | | | | | | | | | | | | del_timer() got renamed to timer_delete() approximately in Linux 6.2 (similar for *_sync and likely others). Keep the old functions as compat; unclear when we can gc them. We should also re-define them with a linuxkpi_ prefix to avoid possible conflicts in the future if we do a full pass over this at some point. Sponsored by: The FreeBSD Foundation (intiially) MFC after: 3 days X-MFC; preserve symbols, not inline Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52074
* LinuxKPI: rename from_timer() to timer_container_of()Bjoern A. Zeeb2025-09-052-1/+6
| | | | | | | | | | | | With Linux 6.16 from_timer() got renamed to timer_container_of(); add the LINUXKPI_VERSION check with a default to the current version. Update all in-tree consumers (apart from wireless drivers managed otherwise). Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52073
* LinuxKPI: acpi; fix type to acpi_get_handle()Bjoern A. Zeeb2025-09-051-1/+1
| | | | | | | | | | | The native AcpiGetHandle() and acpi_get_handle() take a const char * argument for pathname and not an acpi_string (char *). For that they spell it out fully as 'const char *', so should we. Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52072
* LinuxKPI: correct the LINUXKPI_VERSION check for abs_diff()Bjoern A. Zeeb2025-09-051-1/+1
| | | | | | | | | | | | | The code introduced abs_diff() as migrated from drm to standard linux headers. The LINUXKPI_VERSION check did not allow this to be visible by default in-tree. Make sure the v6.6 check is optional. drm-kmod always defines LINUXKPI_VERSION so this should be fine. Sponsored by: The FreeBSD Foundation (initially) Fixes: afc450fac9f04 MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52071
* LinuxKPI: pci: allow children to be attached to a pci_devBjoern A. Zeeb2025-09-051-0/+3
| | | | | | | | | | This will be used for hooking suspend/resume in for LinuxKPI 802.11 based drivers. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52070
* LinuxKPI: pci: allocate entire pci_dev hiereachy up to root port on attachBjoern A. Zeeb2025-09-051-7/+40
| | | | | | | | | | | | | | | | | | | | | In linux_pci_attach_device() allocate a LinuxKPI pci_dev for each device in the hierarchy up to the root port[1] as we cannot do that later on demand as we may be in a context where we may not sleep. Take special care of DRM as there is a non-PCI device in the chain which needs to be skipped. iwlwifi(4) can hit this case called from a callout. While here leave a comment sa the cleanup order of linux_pci_attach_device() needs correction seperately. Sponsored by: The FreeBSD Foundation (initially) PR: 283027 Suggested by: jhb [1] MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52069
* LinuxKPI: pci: implement [linuxkpi_]pcim_request_all_regions()Bjoern A. Zeeb2025-09-052-10/+56
| | | | | | | | | | | | | | | | | | Factor out the pci_request_region() implementation into an internal function and make pci_request_region() a simple wrapperaround it. Likewise implement pcim_request_all_regions() as a loop calling pci_request_region() for each entry. In two cases which we returned an error before (bar index is valid but bar is not (no len), and neither IO nor MEM) we now reutrn success (nothing to do for us). Otherwise callers, especially pcim_request_all_regions() would error out for the wrong reasons. This seems to also match the expected behaviour of pci_request_region(). Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52068
* LinuxKPI: pci: implement pcim_iomap()Bjoern A. Zeeb2025-09-052-2/+59
| | | | | | | | | | | | | Like pci_iomap() add the devres version pcim_iomap() using the former to get the resource. Add a helper function to validate that the bar is within a valid range and sprinkle that check also to other related functions. Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52067
* LinuxKPI: pci: implement for_each_pci_dev() and improve pci_get_device()Bjoern A. Zeeb2025-09-052-3/+12
| | | | | | | | | | | Implement for_each_pci_dev() needed by a wireless driver update. For that also improve pci_get_device() and add the functionality to support the odev argument to start searching from that. Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52066
* jail: add jail descriptorsJamie Gritton2025-09-044-1/+51
| | | | | | | | | | | | Similar to process descriptors, jail desriptors are allow jail administration using the file descriptor interface instead of JIDs. They come from and can be used by jail_set(2) and jail_get(2), and there are two new system calls, jail_attach_jd(2) and jail_remove_jd(2). Reviewed by: bz, brooks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D43696
* pseudofs: return errors from pfs_create_*()Kyle Evans2025-09-044-202/+205
| | | | | | | | | | | | | | | | | | In D52038, we kind of guess at the reason that pfs_create_dir() failed, which isn't great: it could be EEXISTS, or it could even be ENOMEM. Change the pfs_create_*() interfaces to return an error and use a double pointer to return the new node as requested. Outside of the changes in sys/fs/pseudofs, this diff is the result of running the added coccinelle script against in-tree pseudofs and fixing all of the style(9) violations that spatch added. We set *opn to NULL in the failure cases to avoid breaking callers that did actually error-check their results, since the cocci patch does not attempt to handle that in any way. Reviewed by: des (previous version), kib Differential Revision: https://reviews.freebsd.org/D52157
* linsysfs: error check device-directory creationKyle Evans2025-09-041-9/+37
| | | | | | | | | | | | | | | | | | | This one in particular is ripe with opportunities to trigger a duplicate node error in pfs_create_dir(), so we do actually want to error-check it. The rest, more or less, should be expected not to fail. We'll propagate the error from pfs_create_dir() up through linsysfs_run_bus and complain about the device node that caused the error. Note that we avoid failing vfs_init() since a partially-constructed linsysfs with missing devices is probably more useful than missing linsysfs entirely. While we're here, convert two malloc() that weren't being error checked to M_WAITOK -- we already wait in the rest of the function, might as well do the same here. Add a missing newline to the pseudofs error mesage. Reviewed by: fuz, kib Differential Revision: https://reviews.freebsd.org/D52038
* LinuxKPI: skbuff: no longer use IEEE80211_DEBUG to turn on debugBjoern A. Zeeb2025-09-031-8/+6
| | | | | | | | | | | | | | A port using linux(kpi) header files but not using skbuffs is hitting the case that it cannot find opt_wlan.h. Give up to the idea that skbuff.h is only used by wireless drivers (or in-tree) and that IEEE80211_DEBUG (via opt_lwan.h) could autmatically compile in debug support. It is likely time to add a LINUXKPI_DEBUG knob in the near future (also for linuxkpi_debug or linuxkpi_debug_rcu). PR: 289268 MFC after: 3 days
* LinuxKPI: 802.11: counting beacons for debug only when assocBjoern A. Zeeb2025-09-021-2/+8
| | | | | | | | Simplify the logic and only count beacons when we are assoc, given we only do this for debugging purposes of beacon/connection loss. Fixes: bdfe17f129db0 MFC after: 3 days
* LinuxKPI: 802.11: only change dtim_period once assocBjoern A. Zeeb2025-09-021-1/+19
| | | | | | | | | | At least iwlwifi(4) seems to expect us to be assoc when seeing BSS_CHANGED_BEACON_INFO as it will stop session protection and update the beacon filter amongst other things. Check for the vif to be assoc before applying any dtim_period updates. See comment for more details on the entire flow. MFC after: 3 days
* LinuxKPI: 802.11: use IEEE80211_FEXT_AMPDU_OFFLOADBjoern A. Zeeb2025-09-021-5/+9
| | | | | | | | | | | | | | | | | | Set IEEE80211_FEXT_AMPDU_OFFLOAD if the driver/firmware does AMPDU[-TX] offload and net80211 should stay out of the way. Later use IEEE80211_CONF_AMPDU_OFFLOAD() (the IEEE80211_FEXT_AMPDU_OFFLOAD net80211 flag) rather than the LinuxKPI check to clear AMPDU-RX if we do not support crypto offload. This may seem odd at first as AMPDU-RX is mandatory but we would not be able to get anything working if we would let net80211 do a (*ic_ampdu_rx_start)() call. Some of this is neccessary until we have the code for all drivers (rtw8x use further interfaces) sorted. Sponsored by: The FreeBSD Foundation (originally) MFC after: 3 days Fixes: ac2c7271b7c26
* net80211 / LinuxKPI: 802.11: revert / redo enum ieee80211_sta_rx_bwBjoern A. Zeeb2025-08-303-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | The initial thought of migrating the LinuxKPI 802.11 enum into net80211 for shared use did not work out well. Currently in the need for yet another adjustment, I decided to undo/de-couple net80211 and LinuxKPI 802.11 again. The enum name now gets used in LinuxKPI based wifi drivers and it turns out it is spelt differntly than what I used initially. This creates a conflict. net80211 still in the need to be able to express BW_320 in an uint8_t will likely be fine with the current solution as well. Rename the enum and prefixes in net80211 to "net80211" instead of "ieee80211". Apart from the names/prefix we leave the values the same. In LinuxKPI add the enum with the expected name and use it there throughout to make modern versions of LinuxKPI based wifi drivers compile. Sponsored by: The FreeBSD Foundation Fixes: ca389486a9599, 2c8b0d6205f6f MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D52064
* LinuxKPI: skbuff: checksum offloading flagsBjoern A. Zeeb2025-08-291-2/+2
| | | | | | | | | | | Given the checksum offloading flags are mutually exclusive and are not a bit mask, we can compress them into 2 bit for the four possible values. Change the define but leave the type at uint8_t for now with a comment. We can possible combine them with another sub-octet field in the future. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: do not delete keys while still assocBjoern A. Zeeb2025-08-291-1/+39
| | | | | | | | | | | | | While we are still associated we cannot delete the keys as packets may still go out and if the firmware has no more keys it will raise and exception. This can happen given net80211 has its own mind when to do this and we, in various places, unlock and re-lock the com lock, so are open to races. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: introduce a debug flag for scan/beacon loggingBjoern A. Zeeb2025-08-292-4/+10
| | | | | | | | | Split the scan logging up into scan and scan/beacon in order to not log every beacon if we are trying to debug the scan machinery but not the actual results. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: sort the fallback to software scan for rtw88Bjoern A. Zeeb2025-08-292-19/+81
| | | | | | | | | | | | | | | | | | | | | In the special case hardware scan fails to start, we cancel the scan with net80211 and cleanup our part. In that case we now sleep and wait for a wakeup. The wakeup was moved to a different callback function to serve both cases (hw scan cancelled, and hw scan failed). In the very special case the hardware scan fails with a return code of 1, we need to start a software scan. I cannot fully imagine this ever worked well (some rtw88 chipsets are using this). The trouble is that the cancael_scan runs in a taskq in net80211 and by the time we tried to start the new scan, the old one was not fully cleaned up and finished (or could have been restarted in case we enable bgscan). So defer starting the software scan to the taskq as well and it will run once the previous finished. The RTW8821ce I tested with seemed a lot more happy. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: improve scan/beacon tracing in RX pathBjoern A. Zeeb2025-08-291-7/+67
| | | | | | | | | | | | | In one of my setups I am sometimes seeing "ghost beacons" (beacons from a BSSID on a 2nd channel where it is not sending beacons; also checked with a monitor node to be sure). In order to rule out later processing errors I added debugging early on in the LinuxKPI 802.11 RX path. This will at least help us (users) to debug possible problems more easily by turning on scan debugging (either here, or using wlandebug +scan to get the net80211 view on it, or both). Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: improve scanning when not using the net80211 chanlistBjoern A. Zeeb2025-08-291-10/+53
| | | | | | | | | | | | | | | | | With the option to not use the net80211 scan list but scan all channels (if we can scan all bands at once, etc.) we possibly scanned more channels than needed (or we should have). Add a helper function to sort out disabled channels and channels which are not on the net80211 ic_chan_active list (e.g. removed by regdomain). This could potentially also remove channels for a 2nd band for software scanning, but in the offload cases it should not. Add scan logging for the disabled channels and add scan logging to print the finalized channel list we are using for this scan (as net80211 has a similar logging). Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: use ni_dtim_period instead of iv_dtim_periodBjoern A. Zeeb2025-08-291-4/+4
| | | | | | | | | | | | | | | | | | | Both iwm(4) and iwx(4) are using the iv_dtim_period from the vap. This likely stems from the fact that ieee80211_sta_join() while setting up the ni basics does set the dtim_period on the vap (we should revist this in net80211) from the scan results. The problem with that is that once we are associated and are receiving beacons, sta_recv_mgmt() will handle the TIM IE and and save the tim period and tim count in ni_dtim_period and ni_dtim_count on the node. Given we need to inform the driver/firmware (at least for iwlwifi) with values from beacons received after assoc, the ni is the better place the take the value from (though the beacons hopefully stay consistent). Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: scanning improvements and experimentsBjoern A. Zeeb2025-08-292-30/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce SCAN tracing by adding a dedicated debug category for it and sprinkle some TRACE_SCAN() lines in hopefully helpful places. Add an experimental sysctl to re-sort the scan channel list based on "primary" channels first and 5Ghz before 2Ghz. Also start scanning the higher bands first (5Ghz before 2.4 even without the sysctl set). These are largely a result of various reports of people not able to see their BSSID on 5Ghz. How much of a difference this will make in real world and depending on driver/firmware is for the people to experiment. In my observations iwlwifi(4) independent on all this presents scan results 2.4 band channels 1..14 first, and then the 5Ghz band channels 177..32. Factor out re-enabling hardware scan. This is used especially in case of rtw88 to not be stuck on software scan forever if the rtw88 driver decides that it currently cannot do a full hw offload scan. Add compile time support for BGSCANs but keep it disabled by default as during testing races with net80211 and some APs idle-disconnect were found. Still check in the code in case we do see a bgscan despite it being disabled. This stems from 32af70fae827ec. Minor improvements like recording the scan_start time and making sure we properly cancel/restart scans if hw offload scan fails. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: adjust lower wake_queue lockingBjoern A. Zeeb2025-08-292-4/+16
| | | | | | | | | | | In bc24342d96aa8 we added lower wake_queue locking. There are paths, such as in rtw89 from a (*hw_scan_cancel)() that we can get to there and then would recursively acquire the wiphy lock which is not allowed. Adjust locking to a spin lock to match Linux driver expectations. Sponsored by: The FreeBSD Foundation Fixes: bc24342d96aa8 MFC after: 3 days
* LinuxKPI: 802.11: mark all structs in struct ieee80211_mgmt __packedBjoern A. Zeeb2025-08-291-10/+10
| | | | | | | | These structs as part of the union are used to handle raw packet data so mark them all __packed. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: implement str_disable_enable()Bjoern A. Zeeb2025-08-291-0/+2
| | | | | | | | | | Implement str_disable_enable() needed by a wireless driver by using the already existing str_enable_disable() with a toggled argument. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D52081
* linuxkpi: Fix a typo in a source code commentGordon Bergling2025-08-261-1/+1
| | | | | | - s/__FreeBSD_verison/__FreeBSD_version/ MFC after: 3 days
* LinuxKPI: 802.11: rework multicat filter updatesBjoern A. Zeeb2025-08-254-46/+102
| | | | | | | | | | | | Multicast filter updates are done at different times and either triggered by net80211/if code or within LinuxKPI. Keep the setting and address list and update that (only) if triggered from net80211. Otherwise we will (depending on state) just update additional flags. Sponsored by: The FreeBSD Foundation MFC after: 3 days