Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2026 06:26:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        wireless@FreeBSD.org
Subject:   [Bug 263632] iwlwifi(4) crashes (freezes) a few seconds after resuming from sleep (suspend/resume not working; workaround known for now)
Message-ID:  <bug-263632-21060-AuI8vdi7rH@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-263632-21060@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263632

--- Comment #50 from commit-hook@FreeBSD.org ---
A commit in branch stable/15 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=0c0f66541aa220af38261af6360713ded6e3f15d

commit 0c0f66541aa220af38261af6360713ded6e3f15d
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-04-09 18:00:20 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-05-27 01:31:08 +0000

    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)
    PR:             263632

    (cherry picked from commit 11d69a4558de2a5427d8191caed315c5f7e9a5d6)

 share/man/man4/linuxkpi_wlan.4                     |   8 +-
 sys/compat/linuxkpi/common/src/linux_80211.c       | 137 +++++++++++++
 sys/compat/linuxkpi/common/src/linux_80211.h       |  16 +-
 .../linuxkpi/common/src/linux_80211_macops.c       | 116 +++++++++++
 .../linuxkpi/common/src/linuxkpi_80211_pm.c (new)  | 214 +++++++++++++++++++++
 sys/conf/files                                     |   2 +
 sys/contrib/dev/iwlwifi/lkpi_iwlwifi_pm.c (new)    |   8 +
 sys/contrib/dev/rtw88/lkpi_rtw88_pm.c (new)        |   8 +
 sys/contrib/dev/rtw89/lkpi_rtw89_pm.c (new)        |   8 +
 sys/modules/iwlwifi/Makefile                       |   3 +-
 sys/modules/linuxkpi_wlan/Makefile                 |   1 +
 sys/modules/rtw88/Makefile                         |   1 +
 sys/modules/rtw89/Makefile                         |   3 +-
 13 files changed, 521 insertions(+), 4 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-263632-21060-AuI8vdi7rH>