aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev/rtw89
Commit message (Collapse)AuthorAgeFilesLines
* LinuxKPI: 802.11: add support for suspend/resumeBjoern A. Zeeb2026-05-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for automatic suspend/resume as we know it for wireless. The problem is that the PCI driver which would normally gets the code is the LinuxKPI PCI framework/Linux wireless driver, which we cannot ammend or generally add extra suspend/resume code to. A further problem is that with growing support, the LinuxKPI 802.11 (mac80211) layer also is involved in suspend/resume for WoWLAN (not yet supported) meaning that we need to hook the suspend/resume framework into that as well. Unlike Linux we do not have a general suspend/resume "hook" we can hang into and we need to tie this one to the hardware so cannot indepedently (after the driver one) run it. The solution for FreeBSD, in order to not mangle the Linux native drivers and get extra maintanace overhead, is to add a bus child which inherits the general framework and thus is 2 lines + #includes for each driver extra to add to. The general suspend/resume framework lives in LinuxKPI (linuxkpi_80211_pm) and imitates the normal suspend/resume path overloading it (there is a slight code/logic duplication from the PCI code). Given we are passed the LinuxKPI p(ci)dev, we can go and peel out the net80211 ic from the native bsddev and that way get access to the wireless stack. We then call into LinuxKPI 802.11 in order to do the suspend/resume dance there, and, if needed also call the official suspend/resume routine from the device driver after (reverse for resume). If any in this fails, suspend will be blocked as we will return the error (no different to any native driver could do). The LinuxKPI 802.11 suspend/resume code has the initial code for doing a WoWLAN suspend (one could change the sysctl) but other bits like access to ifnet flags etc. has to be sorted out before we can go and support that. The default code path calles into net80211 to clear everything like native wireless drivers do. The one thing we need to do in addition is to remove the vif devices from the firmware and restore them prior to net80211 resume. We also check for a possible HW SCAN to still be runinng on resume and warn as that may cause problems though the scan should be stopped before suspend (we may still get a callback). You can easily see these problems if you suspend/resume without stopping the wlan. Enable the PM framework for iwlwifi in the module Makefile to be able to use all this; others can follow as tested. In case anyone has problems with this, they can change the sysctl back to 0 until we can figure out any further problems. The linuxkpi_wlan.4 man page got adjusted to document this. Sponsored by: The FreeBSD Foundation Tested on: Dell XPS 13 (AX200), Lenovo TP X270 (AX210) MFC after: 3 days PR: 263632
* rtw89: firmware: extend script to extract fwget entriesBjoern A. Zeeb2026-05-171-2/+2
| | | | | | | | The so far so consistent (file)names got an outlier so add the one character longer pattern as well to catch that. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* rtw89: fix mismergeBjoern A. Zeeb2026-04-211-0/+2
| | | | | | | | | | Due to FreeBSD-specific code it seems a code update was not applied to the FreeBSD part during the v6.17 driver update. Add the missing lines. Sponsored by: The FreeBSD Foundation MFC after: 3 days Fixes: b35044b38f74c
* rtw89: update Realtek's rtw89 driverBjoern A. Zeeb2026-04-1844-535/+5675
| | | | | | | | | 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
* rtw89: add a warn about beacon_int or dtim_period being 0Bjoern A. Zeeb2026-04-181-0/+4
| | | | | | | | | 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
* rtw89: harmonize all MODULE_DEPEND to rtw89Bjoern A. Zeeb2026-02-104-8/+13
| | | | | | | | rtw89 came like rtw88 was done. Given rtw88 once was split up rtw89 got modelled the same way. Clean this up too. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* rtw89: cleanup static_assert() callsBjoern A. Zeeb2026-02-109-58/+0
| | | | | | | | | These days we can use static_assert() without trouble so remove the FreeBSD-specific rtw89_static_assert implementation. This reduces the diff to upstream and will ease future driver updates. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* rtw89: update Realtek's rtw89 driverBjoern A. Zeeb2026-02-1057-1093/+4642
| | | | | | | | | | This version is based on git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 24d479d26b25bce5faea3ddd9fa8f3a6c3129ea7 ( tag: v6.19-rc6 ). Sponsored by: The FreeBSD Foundation MFC after: 3 days PR: 285228
* rtw89: update Realtek's rtw89 driverBjoern A. Zeeb2025-10-2362-5047/+14235
| | | | | | | | This version is based on git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e5f0a698b34ed76002dc5cff3804a61c80233a7a ( tag: v6.17 ). MFC after: 3 days
* rtw89: Remove an unneeded __DECONSTJohn Baldwin2025-09-041-4/+0
| | | | | | | | | | | | | | | | | | Originally in e2340276fc73 the function argument was a "const void *data" which we changed to "const int" in FreeBSD. The Linux version simply cast the const void * to (enum rtw89_rf_path) both losing the const and changing the type. When later the function argument became a const union rtw89_fw_element_arg in 5b760eaecd6c3 it seems we tried to undo the older FreeBSD specific part and initially mismerged it leading to the const void *; but when fixing the type we did not undo the __DECONST but did a mechanical copy. Reviewed by: bz Co-authored-by: bz (commit message) Obtained from: CheriBSD Sponsored by: AFRL, DARPA Fixes: 6d67aabd6355 ("rtw89: update Realtek's rtw89 driver.") Differential Revision: https://reviews.freebsd.org/D52359
* rtw89: enable ACPI support on FreeBSDBjoern A. Zeeb2025-07-041-26/+0
| | | | | | | | | Now that LinuxKPI supports the lower case Linux ACPI spellings under LINUXKPI_WANT_LINUX_ACPI remove the #ifdef around the code and compile in ACPI support. Sponsored by: The FreeBSD Foundation MFC after; 3 days
* rtw89: prevent a NULL pointer deref in rtw89_swap_chanctx()Bjoern A. Zeeb2025-06-081-0/+21
| | | | | | | | | | | | | | | | | | It is currently unclear if this is a result of the driver itself already or the way LinuxKPI drives channels and the driver simply accepting and acting on things it no longer should. For now put the bandaid into place to make the driver work and pass packets. For better resilience the check does not hurt anyway. The moment we enter rtw89_chanctx_ops_add() the first time, entity_map 0x00000001 has the lowest bit set and find_next_zero_bit() will return 1. As a result the driver will try to swap chanctxs and trip over a NULL pointer in rtw89_swap_chanctx(). See comment there for how to (likely) trigger it. Sponsored by: The FreeBSD Foundation Reported by: Axel Rau (Axel.Rau Chaos1.DE) with 8852CE MFC after: 3 days
* rtw89: merge Realtek's rtw89 driver based on Linux v6.14Bjoern A. Zeeb2025-04-2767-3498/+11529
| | | | | | | | This version is based on git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 38fec10eb60d687e30c8c6b5420d86e8149f7557 ( tag: v6.14 ). Sponsored by: The FreeBSD Foundation
* rtw89: make wow.c compileBjoern A. Zeeb2025-03-181-0/+35
| | | | | | | | | | So far we have not compiled wow.c given we do not enable CONFIG_PM yet. Make the necessary file local adjustments to make the file compile once further changes in LinuxKPI 802.11 code are comitted. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* rtw88/rtw89: add module_param to enable/disable HT/VHT and EHTBjoern A. Zeeb2025-01-311-0/+30
| | | | | | | | | | | | In order to better test HT and VHT support with LinuxKPI add (tunable) options disabled by default to on-demand enable HT/VHT and for rtw89 also EHT. It is expected that we will remove this FreeBSD-specific code again in the future. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* rtw88/rtw89: avoid duplicate top-level directory with debugfsBjoern A. Zeeb2025-01-311-0/+4
| | | | | | | | | | | | | | If people like me having multiple cards in the same system creating the debugfs dirctory leads to a panic upon attaching the 2nd card due to the duplicate name. Rather than using the hard coded driver name, use the device name (e.g., rtw880, rtw881, rtw882). This solves two issues: it avoids the duplicate name and we get individual debugging/statistic information for each card. Sponsored by: The FreeBSD Foundation MFC after: 3 days X-Note: ath1[01]k and mt76 likely will need a similar change
* rtw89: update Realtek's rtw89 driver.Bjoern A. Zeeb2024-10-2875-8106/+45002
| | | | | | | | | | | | This adds support for the Realtek 8922AE PCI wireless network (Wi-Fi 7) adapter. This version is based on git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 98f7e32f20d28ec452afb208f9cffc08448a2652 ( tag: v6.11 ). Sponsored by: The FreeBSD Foundation MFC after: 14 days
* LinuxKPI based WiFi drivers: scripts to extract fwget(8) and port detailsBjoern A. Zeeb2024-10-171-0/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a "zzz_fw_ports_fwget.sh" script to each LinuxKPI based wireless driver which in essential are all the same and in detail all different. The scripts have been referenced in fwget(8) sources since d33f5a0afa54b but were never committed. The scripts do the full job compared to `single-line-scripts` I tried to use before to ease maintainance life. Some use hacks like calling cpp and extracting bits from the output to piece them together over multiple files. It will be left as an exercise for the future to see if what was done (a longer while ago) for iwlwifi(4) would be a good idea for some other drivers too, to have a FreeBSD-specific sysctl to export some of the accumulated data in an easily processable way. The scripts are written in the "perl spirit" -- "to get the job done" -- and not to be nice or neat or efficient. For that we do not need them often enough or in any critical path. People are welcome to improve them if they feel like. I've used them for two version updates now and even if ports enforce some other (manual) editing to keep support for multiple branches for now they worked extremly well. For the most the scripts extract 2 parts: PCI IDs and firmware name; then they add "flavor"s to both and put the information together. That output is then separated into: - fwget(8) lines of PCI ID to port/package wifi-firmware-${name}-kmod-${flavor} mappings and - distfiles per flavor for the ports. - For iwlwififw(4) we also generate the tables for the man page (and the wiki) and hopefully the .Sh HARDWARE section for iwlwifi.4 soon too. Depending on driver various other checks are done, e.g., - does the PCI ID have one or more firmware files/flavors associated, - does the referenced firmware exist in the linux-firmware.git repo, - are there duplicates, - find the latest version of the firmware API. Sponsored by: The FreeBSD Foundation Suggested by: imp (to have automation in D44918) MFC after: 3 days
* rtw89: add missing bsddriver.name assignments for two chipsetsBjoern A. Zeeb2024-10-112-0/+6
| | | | | | | | | On FreeBSDs we locally set bsddriver.name in struct pci_driver to have the same name for all chipsets. This helps with, e.g., device enumeration. For two chipsets the manual entry was missing. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* ath10k/rtw89: make compile again after LinuxKPI changesBjoern A. Zeeb2024-01-081-0/+3
| | | | | | | | | | | | | | | Both drivers are not yet attached to the build so this change is for people currently trying them out. In 96ab16ebab6319dce9b3041961b0ab6e20a4fecc the sys/rman.h include was removed. In various wireless drivers we prefer to directly use bus_dma functions rather than io* LinuxKPI once. In order to cast the pointer we need sys/rman.h back for our native 'struct resource' in their pci.c implementations. Long-term we should consider providing some lkpi_-FreeBSD-specific wrapper functions to avoid this problem. MFC after: 3 days
* rtw89: improve debugging and fix a sleep issueBjoern A. Zeeb2024-01-082-0/+13
| | | | | | | | | Improve log messages to be more helpful in error cases. Change one LinuxKPI sleep function as we cannot call the original one from a context we cannot sleep. Both cases were hit during testing. MFC after: 3 days
* rtw89: update driver from upstreamBjoern A. Zeeb2023-08-2163-7986/+92862
| | | | | | | | | | | This is a set of updates of the rtw89 driver based on wireless-testing (wt-2023-05-11) 711dca0ca3d77414f8f346e564e9c8640147f40d (after v6.4-rc1). (wt-2023-06-09) 7bd20e011626ccc3ad53e57873452b1716fcfaaa (after v6.4-rc5). (wt-2023-07-24) 62e409149b62a285e89018e49b2e115757fb9022 (after v6.5-rc3). (wt-2023-08-06) 2a220a15be657a24868368892e3e2caba2115283 (after v6.5-rc4). (wt-2023-08-13) 81e147b1317ee7cde8b624ee8c0501b470d7e91c (after v6.5-rc5). MFC after: 20 days
* iwlwifi: rtw88: rtw89: fix gcc warningsBjoern A. Zeeb2023-04-191-1/+1
| | | | | | | | | | | Fix -Wno-format and unused variables warnings with gcc by adopting (to|the) FreeBSD-specific code. Reported by: jhb Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D39673
* rtw89: fix -Wunused-but-set-variableBjoern A. Zeeb2023-03-231-0/+5
| | | | | | | Fix a -Wunused-but-set-variable warning by adding the field to the debug logging as is done for other versions handler functions. MFC after: 3 days
* LinuxKPI: iwlwifi: rtw88: rtw89: remove budget argument from netif_napi_add()Bjoern A. Zeeb2022-11-281-1/+1
| | | | | | | | | | In preparation for future updates remove the budget argument from the netif_napi_add() in drivers and update LinuxKPI to reflect that it is gone and only set it internally. This required changes to the currently committed wireless drivers based on LinuxKPI (iwlwifi, rtw88, rtw89). Sponsored by: The FreeBSD Foundation MFC after: 3 days
* lindebugfs,rtw88,rtw89: correct module dependenciesBjoern A. Zeeb2022-09-251-1/+1
| | | | | | | | | | In f697b9432d9c7aa4c5ab5f5445ef5dc1bd40ce00 the name of the PSEUDOFS was changed from debugsfs to lindebugfs but the in-tree consumers were not updated now leaving the drivers not loading if compiled with debugfs support due to missing dependencies. MFC after: 3 days X-MFC-with-after: f697b9432d9c7aa4c5ab5f5445ef5dc1bd40ce00
* rtw89: import Realtek's rtw89 driverBjoern A. Zeeb2022-09-0951-0/+150661
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