iwlwifi bouncing after resume; often needs service netif restart

From: <ltning-freebsd-wireless_at_anduin.net>
Date: Thu, 19 Jun 2025 21:57:38 UTC
Hi,

after resuming from sleep I very often need to restart the wlan device 
(service netif restart wlan0) to get a stable connection. This happens 
regardless of which network I connect to/am near.

When running ifconfig wlan0 repeatedly after resume, I can see it 
associating, and even getting an IP address, several times - before 
immediately disassociating again. At some point it ends up in the state 
where scanning just doesn't work:

iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5

Attached dmesg/messages and wpa_supplicant logs.

Not important, and probably my own fault, but an observation:
It now often takes a long time for the iwlwifi kmod to load after 
resume. I'm kldunloading and devctl disable-ing it on suspend then 
reenabling the device on resume. Up until about a month ago, the kld 
would load again pretty much right away after enabling the device; 
nowadays it takes a longer time.

Since wifi has improved by leaps and bounds over the last few months, I 
guess it's time to bring up nuisances like this :)

/Eirik