aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common
Commit message (Collapse)AuthorAgeFilesLines
...
* linuxkpi: Add `fop_flags` to `struct file_operations`Jean-Sébastien Pédron2026-04-211-0/+11
| | | | | | | | | | | | | ... along with the `FOP_*` flag constants. Note that this `fop_flags` field is not used on FreeBSD. It is added to make the DRM drivers compile out of the box. The DRM generic code and drivers started this in Linux 6.12. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56450
* linuxkpi: Include <linux/uuid.h> from <linux/mod_devicetable.h>Jean-Sébastien Pédron2026-04-211-0/+1
| | | | | | | | | The DRM generic code started to deppend on this indirect include of <linux/uuid.h> in Linux 6.12. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56449
* linuxkpi: Add several `guid_*()` functionsJean-Sébastien Pédron2026-04-212-0/+30
| | | | | | | | | The DRM generic code and the amdgpu DRM driver started to use several of these functions in Linux 6.12. Likewise for `UUID_SIZE`. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56448
* linuxkpi: Define `MINORBITS`Jean-Sébastien Pédron2026-04-211-0/+15
| | | | | | | | | | | | | | | | | We can't really define a proper value for this constant because minor and major are encoded in a complex way on FreeBSD which cannot be represented with a simple shift. The DRM generic code started to use it in Linux 6.12. In this context, `MINORBITS` is used to define an upper limit passed to `xa_alloc()`. Therefore it is not used to encode or decode minors. It is used as an arbitrary value. Therefore, we define the constant to 20, like on Linux. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56447
* linuxkpi: Define `sort_r()`Jean-Sébastien Pédron2026-04-211-0/+5
| | | | | | | | | | | Like Linux `sort()` and FreeBSD `qsort()`, `sort_r()` is a wrapper around FreeBSD `qsort_r()`. The i915 DRM driver started to use it in Linux 6.12. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56437
* linuxkpi: Define `__GFP_THISNODE`Jean-Sébastien Pédron2026-04-211-1/+2
| | | | | | | | | | | | It is used to force the NUMA node to allocate from. This flag is unimplemented for now because we don't have an implementation of `alloc_pages_node()` yet. The DRM TTM code started to use this flag in Linux 6.12. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56436
* linuxkpi: Define `dev_err_probe*()`Jean-Sébastien Pédron2026-04-211-0/+24
| | | | | | | | | | | | They differ from other `dev_*()` logging functions by returning the passed error code. The error code is also used to determine if the message should be logged in the first place and at which log level. The DRM generic code started to use it in Linux 6.12. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56435
* linuxkpi: Define diagnostic macros like `might_resched()` or `cant_sleep()`Jean-Sébastien Pédron2026-04-212-7/+33
| | | | | | | | | | | | | They are no-ops on FreeBSD. While here, move the already defined `might_sleep*()` macros from <linux/wait.h> to <linux/kernel.h> where they belong. The DRM generic code started to use `might_fault()` in Linux 6.12. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56434
* LinuxKPI: 802.11: add struct/fields and functions for v7.0Bjoern A. Zeeb2026-04-182-5/+20
| | | | | | | | | | 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
* LinuxKPI: 802.11: Add structures and functions for NAN supportBjoern A. Zeeb2026-04-182-0/+77
| | | | | | | | | | | | | | 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
* LinuxKPI: 802.11: set IEEE80211_MIN_ACTION_SIZE according to structBjoern A. Zeeb2026-04-181-2/+2
| | | | | | | | | | 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
* LinuxKPI: implement devm_kmemdup_array()Bjoern A. Zeeb2026-04-181-0/+7
| | | | | | | | | | 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
* LinuxKPI: add kmalloc_obj[s], kzalloc_obj[s], and kzalloc_flexBjoern A. Zeeb2026-04-181-1/+23
| | | | | | | | | | | | | | | | | | | 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
* LinuxKPI: sync overflow.h from Linux v7.0Bjoern A. Zeeb2026-04-181-14/+130
| | | | | | | | | | | | overflow.h was imported directly from Linux in 3208d4ad2b8320a. 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
* LinuxKPI: conditionally add __flex_counter()Bjoern A. Zeeb2026-04-181-0/+13
| | | | | | | | | | | | | | | | | | | __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
* LinuxKPI: add default_gfp()Bjoern A. Zeeb2026-04-181-0/+3
| | | | | | | | | | | | | 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
* LinuxKPI: move hex2bin() from kernel.h to new hex.hBjoern A. Zeeb2026-04-182-31/+45
| | | | | | | | | | | | 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
* LinuxKPI: 802.11: make sure dtim_period is setBjoern A. Zeeb2026-04-181-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* LinuxKPI: 802.11: start filling vif->cfg.ap_addrBjoern A. Zeeb2026-04-181-11/+10
| | | | | | | | | | | 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
* LinuxKPI: 802.11: add chandef tracingBjoern A. Zeeb2026-04-182-3/+77
| | | | | | | | 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
* LinuxKPI: 802.11: improve emulate chanctx implementationBjoern A. Zeeb2026-04-183-63/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: ac1d519c01ca8 ("LinuxKPI: 802.11: adjustments for v6.11..")
* LinuxKPI: 802.11: rework lkpi_ic_set_channel()Bjoern A. Zeeb2026-04-182-39/+132
| | | | | | | | | | | | | | | | | | | | | | | 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
* LinuxKPI: 802.11: factor out getting and setting a chanctxBjoern A. Zeeb2026-04-181-56/+92
| | | | | | | | | | 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
* LinuxKPI: 802.11: keep chanctx on a reserved listBjoern A. Zeeb2026-04-182-5/+66
| | | | | | | | | | | | | | 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
* LinuxKPI: 802.11: save the default channelBjoern A. Zeeb2026-04-182-0/+4
| | | | | | | | Add a field to struct lkpi_hw to save the default channel for later reuse. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: factor out chandef/chanctx initializationBjoern A. Zeeb2026-04-181-39/+78
| | | | | | | | | 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
* linuxkpi: Fix an off-by-one error in the kfifo implementationMark Johnston2026-04-151-2/+2
| | | | | | | | | | | | | | "total" is the number of slots in the array, so wraparound needs to be done when "first" or "last" is greater than or equal to the number of slots. Note that no consumers of the code are currently connected to the kernel build. Reported by: Stanislav Fort <stanislav.fort@aisle.com> Reviewed by: bz, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56371
* linuxkpi: Add <linux/ascii85.h>Jean-Sébastien Pédron2026-04-061-0/+46
| | | | | | | | | This is used by the i915 DRM driver for some time to log more details about a GPU error, but the code was commented out. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56282
* linuxkpi: Define missing `SZ_*` below 1 kibJean-Sébastien Pédron2026-04-061-0/+11
| | | | | | | | The amdgpu DRM driver started to use it in Linux 6.11. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55740
* linuxkpi: Define `MIN_T()` and `MAX_T()`Jean-Sébastien Pédron2026-04-061-0/+3
| | | | | | | | | | | There are the same as `MIN()` and `MAX()` except that they take a type to cast both arguments to compare. The DRM generic code started to use it in Linux 6.11. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55739
* linuxkpi: Document why <linux/pci.h> can't include <linux/ioport.h>Jean-Sébastien Pédron2026-04-061-0/+11
| | | | | | Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55738
* linuxkpi: Add field `flags` to `struct resource`Jean-Sébastien Pédron2026-04-061-0/+1
| | | | | | | | | | | This in the Linux version of `struct resource`, not the FreeBSD native structure. The amdgpu DRM driver started to use it in Linux 6.11. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55737
* linuxkpi: Add <linux/mfd/core.h>Jean-Sébastien Pédron2026-04-061-0/+49
| | | | | | | | | | | | | | | | | | | To be exact, there was a dummy file with no content before. This commit defines `struct mfd_cell` and adds two function stubs. The function stubs are not implemented but still return success. They log a message to indicate they need to be implemented. Also, unlike Linux, <linux/mfd/core.h> includes <linux/ioport.h>. This works around the fact that we can't include <linux/ioport.h> from <linux/pci.h>, due to a conflict with the FreeBSD-native `struct resource`. The amdgpu DRM driver started to use it in Linux 6.11. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55736
* linuxkpi: Add <linux/linux_logo.h>Jean-Sébastien Pédron2026-04-061-0/+19
| | | | | | | | | It only defines the `struct linux_logo` structure for now. It does not define any actual logo. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55735
* linuxkpi: Define `PMD_SHIFT`Jean-Sébastien Pédron2026-04-061-0/+34
| | | | | | | | | | For now, only define it for x86 architectures. The DRM generic code started to use it in Linux 6.11. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55734
* linuxkpi: Define `CONFIG_PGTABLE_LEVELS`Jean-Sébastien Pédron2026-04-061-0/+35
| | | | | | | | | | This is a kernel configuration constant that is expected to be defined. The DRM generic code started to use it in Linux 6.11. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55733
* linuxkpi: Add mising functions in <linux/kmsg_dump.h>Jean-Sébastien Pédron2026-04-061-0/+42
| | | | | | | | | The DRM generic code started to use `kmsg_dump_get_buffer()` and `kmsg_dump_rewind()` in Linux 6.11. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55732
* linuxkpi: Define `_THIS_IP_`Jean-Sébastien Pédron2026-04-061-0/+2
| | | | | | | | | | For now, the macro is not implemented and it returns 0. The DRM generic code started to use it in Linux 6.11. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55731
* linuxkpi: Move `_RET_IP_` to <linux/instruction_pointer.h>Jean-Sébastien Pédron2026-04-062-2/+14
| | | | | | | | This matches the declaration on Linux. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55730
* linuxkpi: Add `strtomem()` and `strtomem_pad()`Jean-Sébastien Pédron2026-04-061-0/+16
| | | | | | | | The DRM generic code started to use `strtomem_pad()` in Linux 6.11. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55729
* linuxkpi: Handle bin attributes in sysfs attribute groupsJean-Sébastien Pédron2026-04-011-9/+25
| | | | | | | | | | | | | | | | | | | | | For instance, this is used by DRM drivers to declare the EDID property of an GPU output connector: sysctl -b sys.device.drmn1.card0.card0-DP-1.edid | edid-decode ... Block 0, Base EDID: EDID Structure Version & Revision: 1.4 Vendor & Product Identification: Manufacturer: SAM Model: 29814 Serial Number: 810635354 (0x3051505a) Made in: week 15 of 2025 ... Reviewed by: bz, emaste, wulf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55176
* LinuxKPI: add supporting #includesBjoern A. Zeeb2026-03-213-0/+3
| | | | | | | | | | | | | | Compiling drm-kmod on !X86 does not include asm/smp.h which includes preempt.h on FreeBSD. In order to compile drm-kmod on other architectures add the secondary #includes for preempt.h to spinlock.h and hardirq.h (which now also gets included from highmem.h) to connect the #include chain. Sponsored by: The FreeBSD Foundation MFC after: 3 days PR: 279864 Reviewed by: jhibbits, emaste Differential Revision: https://reviews.freebsd.org/D55974
* LinuxKPI: Fix simple_read_from_buffer for zero-size and off-the-end readsJohn Baldwin2026-03-171-2/+2
| | | | | | | | | | | | I noticed that the buf_size < 0 check can never be true (it's a size_t) and decided to check for this condition by an alternate expression, and I also noticed that a read_size of 0 would incorrectly return -EFAULT. Instead, return success for both of these cases as reading beyond the EOF of a normal file also returns EOF, not EINVAL. Reviewed by: bz Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D55845
* lindebugfs: Pass user buffer pointers to the read/write file operationsJohn Baldwin2026-03-174-29/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux file_operations API expects the read and write operations to take a single user buffer pointer (along with the length and the file offset as an in/out parameter). However, the debugfs_fill function was violating this part of the contract as it was passing down kernel pointers instead. An earlier commit (5668c22a13c6befa9b8486387d38457c40ce7af4) hacked around this by modifying simple_read_from_buffer() to treat its user pointer argument as a kernel pointer instead. However, other commits keep tripping over this same API mismatch (e.g. 78e25e65bf381303c8bdac9a713ab7b26a854b8c passes a kernel pointer to copy_from_user in fops_str_write). Instead, change debugfs_fill to use the "raw" pseudofs mode where the uio is passed down to directly to the fill callback rather than an sbuf. debufs_fill now iterates over the iovec in the uio similar to the implementation of uiomove invoking the read or write operation on each user pointer. This also fixes a tiny bug where the initial file offset from uio_offset was ignored. Instead, the operations were always invoked with a file offset of 0. As part of this, revert the the changes to simple_read_from_buffer() from commit 5668c22a13c6befa9b8486387d38457c40ce7af4. Also as part of this, the simple_attr_read/write methods and seq_read now also need to accept and handle user pointers (also matching the API in Linux). For simple_attr_write*(), copy the user buffer into a kernel buffer before parsing. Also, do not permit writes at an offset as it's unclear what the semantics for those would even be (perhaps you would write out the formatted value into a buffer first and then allow the copy_from_user to overwrite/extend that buffer and then re-parse the integer value?). The old handling of *ppos for writes was definitely wrong before and only worked for an offset of 0 anyway. Reviewed by: bz Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D55833
* LinuxKPI: Use simple_read_from_buffer in simple_attr_read and seq_readJohn Baldwin2026-03-172-20/+4
| | | | | | Reviewed by: bz Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D55879
* LinuxKPI: Clear the sbuf at the start of each call to seq_readJohn Baldwin2026-03-171-0/+1
| | | | | | | | | | Each invocation of seq_read invokes the seq_file.show callback which writes into the sbuf. Then it invokes sbuf_finish before copying the data into the caller's buffer. Without this, a second call to seq_read on the same file would try to append data to a finished sbuf. Reviewed by: bz Sponsored by: AFRL, DARPA
* LinuxKPI: 802.11: lkpi_sta_auth_to_scan() fail graciously on lsta == NULLBjoern A. Zeeb2026-03-081-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | Usually after a firmware crash, we see reports of crashes in lkpi_sta_auth_to_scan(). One of the last ones was in the PR mentioned below. These crashes are often attributed as the problem while the real problem happened before. At this point try avoid the NULL pointer and to fail graciously if lvif->iv_bss (lsta) is no longer set. This way users have a chance to possibly recover using netif restart wlan0 rather than dealing with a panic. See if this helps us to better track down the original problems rather than the follow-up crash. On a debug kernel the KASSERT should normally have caught that condition as well but we see panics on page faults were the log line was there but then the lsta->ni deref has happened, which is after the KASSERT. I have not checked if this is a reordering problem or if the people reporting had IEEE80211_DEBUG on but not INVARIANTS. Sponsored by: The FreeBSD Foundation PR: 286219 #c11 MFC after: 3 days
* LinuxKPI: 802.11: change teardown order of disassoc and sta rmBjoern A. Zeeb2026-03-051-27/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In lkpi_sta_auth_to_scan() we remove the sta from the firmware for everything supporting (*sta_state). We used to run into issues here with iwlwifi in that we had to use a specific order: set vif->cfg.assoc = false, .aid = 0, then remove the sta, and then send the mac update as otherwise we would either have the sta silently removed (if we run (*bss_info_change) first and fail then or silently not have the sta removed and upon sta add we would trigger the fw crash. The order of events seem to have changed now and especially BE200 (iwlwifi/mld) is picky about this and would crash the firmware with something like: iwlwifi0: 0x20103311 | ADVANCED_SYSASSERT iwlwifi0: 0x00000000 | umac branchlink1 iwlwifi0: 0xC00808AA | umac branchlink2 iwlwifi0: 0xD00D6E90 | umac interruptlink1 iwlwifi0: 0x0108C504 | umac interruptlink2 iwlwifi0: 0x00000000 | umac data1 (link_id? seen weird values there though) iwlwifi0: 0x00000006 | umac data2 (fw_sta_id) iwlwifi0: 0x00000001 | umac data3 if it would still think we were assoc. So the new order is as one would have expected initially: set assoc = false, aid = 0; do the remaining bss_conf (vif/link) changes and issue the (*vif_cfg_changed) / (*link_info_changed) or for older drivers (*bss_info_changed). That will tell the mac we are no longer associated. And only then remove the sta from the firmware. Update the comment there along so we do have the paper trail as to when and why this changed. Tested on: BE200, AX210 (11ac) Tested on: AX200. 9260, 8265, 3165 (11a) Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: split (*bss_info_changed) up for more modern driversBjoern A. Zeeb2026-03-053-21/+128
| | | | | | | | | | | | | | | | | | | | | With the advent of MLO some of the updates (*bss_info_changed) would have done are not per-link. This had (*vif_cfg_changed) and (*link_conf_changed) introduced which are used by iwlwifi, rtw89, select mt76 drivers, and ath12k currently it seems. A driver normally only supports on or the other set. Factor out the call to (*bss_info_changed) into an internal function. There split the options up depending on whether they are for the vif or a link and leave a fallback to (*bss_info_changed) for older drivers. Add the mac80211 ops implementations for the two new calls along with a currently unused backup option for (*bss_info_changed) for each as I assume we will eventually call the directly rather than from the internal wrapper function. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: fix typoBjoern A. Zeeb2026-03-051-1/+1
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days