Latest version of wifi-firmware-iwlwifi-kmod behaving better

From: S. Ross Gohlke <ross_at_bisd.ro>
Date: Mon, 04 Aug 2025 16:30:18 UTC
I am running the latest CURRENT snapshot with the latest 
wifi-firmware-iwiwifi-kmod built from ports, and so far it seems to be 
experiencing fewer glitches.

% uname -a
FreeBSD mustang 15.0-CURRENT FreeBSD 15.0-CURRENT #2: Fri Aug  1 
18:03:28 UTC 2025     builder@mustang:/mnt/usr/src/amd64.amd64/sys/B amd64
% sysctl kern.osreldate
kern.osreldate: 1500056
% pkg info -x wifi-firmware
wifi-firmware-iwlwifi-kmod-22000-20241017.1500056_2

The newest packaged versions are older.

% pkg rquery -e "%n ~ *iwlwifi*" "%n-%v %R"
...
wifi-firmware-iwlwifi-kmod-22000-20241017.1500051_2 FreeBSD
...
wifi-firmware-iwlwifi-kmod-22000-20241017.1500053_2 FreeBSD-kmods
...

Despite the fact that FLAVOR options are absent in the Makefile, the 
various firmwares are indeed implemented as flavors.
Unlike other kmods, this one does not require that /usr/src be populated.
I am using git for ports management.
Here are my make/install commands.

% cd /usr/ports
% doas git pull
% env FLAVOR=22000 TMPDIR=/var/tmp WRKDIRPREFIX=/var/tmp BATCH=YES make 
-C net/wifi-firmware-iwlwifi-kmod -j`sysctl -n hw.ncpu`
% doas pkg delete -f wifi-firmware-iwlwifi-kmod
% doas env FLAVOR=22000 TMPDIR=/var/tmp WRKDIRPREFIX=/var/tmp BATCH=YES 
make -C net/wifi-firmware-iwlwifi-kmod install clean

Over several days of regular usage, common symptoms which were resolved 
by restarting netif service -- restarting wpa_supplicant service did not 
work -- have mostly disappeared.

* Large downloads bring down the interface; with my current installation 
I was able to download libreoffice distfiles, about 400MB, without incident
* Interface stops working periodically (every one to 30 minutes), 
perhaps due to having too many misbehaving websites simultaneously 
loaded in Firefox; so far I have not had to manually restart netif service
* Occasionally over the last few months, frequently restarting netif 
service freezes the system; I have not used the current installation 
long enough to say if this is resolved

I still need to stop/start the interface in conjunction with system 
suspend/resume.
I wrote an rc(8) service, sleep, to automate this process without having 
to edit /etc/rc.suspend and /etc/rc.resume.
It simply executes configured commands before system suspend and after 
system resume.

The raw file can be downloaded here:

https://forge.bisd.ro/rossgohlke/sleeper/raw/1eb0295bcc44431fe9fe313e3fa9c42a9372f52fc17e6e93f521472e81089ac0?at=sleep

It must be renamed as "sleep", have execution bits set and moved to 
/etc/rc.d or /usr/local/etc/rc.d.

It is also available as a package:

https://pkg.bisd.ro/freebsd/depot/uv/All/sleep-0.1.0.pkg

If you want to install the signed package you will need to install the 
Depot repository first.

% fetch -o /var/tmp https://pkg.bisd.ro/freebsd/depot/uv/Depot.conf
% doas pkg -R /var/tmp install repo-depot
% doas pkg install -f repo-depot
% doas pkg install sleep

You are welcome to investigate the other packages in the repository.

% pkg rquery -r Depot -e "%n ~ *" %n

Everything in this repository is version- and architecture-agnostic and 
released under the FreeBSD license.
It mostly contains custom utilities required for my own optimized 
distribution of stock FreeBSD which are not relevant for a standard 
installation.

You may also want to remove, or at least disable, the repository to 
avoid the occasional flakiness of my internet connection; this simple 
service is not likely to change.

% doas pkg remove repo-depot

Enable the service with your preferred mechanism.
Since my /etc is composed in memory, I edit my externally stored 
rc.conf.local file and copy it in.

sleep_enable="YES"

Add the following lines, appropriately modified if you use a different 
interface name, to rc.conf(5) using your preferred mechanism.
I use an externally stored /etc/rc.conf.d/sleep/local and copy it in.

sleep_suspend="service netif stop wlan0"
sleep_resume="service netif start wlan0"