|
Revision tags: release/14.4.0-p5, release/14.3.0-p14, release/15.0.0-p9, release/14.4.0-p4, release/14.3.0-p13, release/13.5.0-p14, release/15.0.0-p8, release/14.4.0-p3, release/14.3.0-p12, release/13.5.0-p13, release/15.0.0-p7, release/13.5.0-p12, release/14.3.0-p11, release/14.4.0-p2, release/15.0.0-p6, release/13.5.0-p11, release/14.3.0-p10, release/14.4.0-p1, release/15.0.0-p5, release/14.4.0, release/13.5.0-p10, release/14.3.0-p9, release/15.0.0-p4, release/15.0.0-p3, release/13.5.0-p9, release/15.0.0-p2, release/14.3.0-p8, release/15.0.0-p1, release/13.5.0-p8, release/14.3.0-p7, release/15.0.0, release/14.3.0-p6, release/13.5.0-p7, release/13.5.0-p6, release/14.3.0-p5, release/13.5.0-p5, release/14.2.0-p7, release/14.3.0-p4, release/14.3.0-p3, release/14.2.0-p6, release/13.5.0-p4, release/13.5.0-p3, release/14.2.0-p5, release/14.3.0-p2, release/14.3.0-p1, release/14.2.0-p4, release/13.5.0-p2, release/14.3.0, release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3 |
|
| #
11d69a45 |
| 09-Apr-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: 802.11: add support for suspend/resume
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 Lin
LinuxKPI: 802.11: add support for suspend/resume
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
show more ...
|