Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: sys/iwx: support powersave
To:
kn@openbsd.org, tech@openbsd.org
Date:
Thu, 12 Feb 2026 09:39:54 +0100

Download raw body.

Thread
On Fri, Feb 06, 2026 at 09:52:48PM +0100, Kirill A. Korinsky wrote:
> On Fri, 06 Feb 2026 20:24:42 +0100,
> Stuart Henderson <stu@spacehopper.org> wrote:
> > 
> > On 2026/02/06 19:45, Kirill A. Korinsky wrote:
> > > No, it follow the same pattern like iwn and wpi: to enable it, someone needs
> > > to explicity adds powersave into ifconfig args, and -powersave to disable.
> > > 
> > > But I think I should document in man in this diff that it supports
> > > powersave, similar with iwn and wpi.
> > 
> > Those are "older devices" as per
> > 
> >    powersave
> >            Enable 802.11 power saving mode.  This option is generally only
> >            relevant to older devices where power saving is disabled by
> >            default.  On modern hardware, drivers will ask the firmware to
> >            automatically enable any applicable power-saving features.
> > 
> > I think some of the older ones were a bit unsure whether it works
> > properly on all devices (so allowing it to be disabled) but it should
> > be ok on newer ones..
> > 
> 
> Now it is disabled by default and should be enabled manually, so it should
> be safe, isn't it?

Power management in iwm/iwx is not entirely disabled by default at present.

At present the driver is always setting the POWER_SAVE_ENA_MSK bit which
allows the device to "save power by turning off receiver and transmitter".
I assume (not having made any measurements) that this does save some battery.
It is certain that the firmware is doing something with this because while
monitoring iwx traffic we can see the device sending Null-Data frames to the
AP with the PM snooze/awake bit toggling on/off. Which is not something our
net80211 stack could do by itself.

The proposed diff turns this feature off by default because all calls to
iwx_power_mac_update_mode() are removed (even though this function is not
deleted with this diff?) and replaced with iwx_set_ps_level() which as far
as I can tell doesn't get called if the ioctl which enables power management
does not run. So the proposed diff would probably cost people some battery
because nobody will bother running the additional command to enable power
management. 

I do think enabling support for legacy power management (DTIM) will have some
benefits, so I agree with the direction your diff is taking. If you want to
investigate further, on modern wifi networks there are additional
possibilities. See here for an overview of the state of the art in 2014:
https://mrncciew.com/2014/10/14/cwap-802-11-power-management/

There are probably even more features in modern standards but the intel
firmware supports all the important 2014 features mentioned there and
we leave them all disabled at present apart from POWER_SAVE_ENA_MSK.

DTIM power management is a good start. Also supporting uAPSD and SMSP would
probably help save power quite a bit more. These newer features depend on
negotiation with the AP so having them be controlled by an ioctl which forces
PM on or off makes zero sense.

The only use case I see for the ioctl would be to disable all power
management when using an AP such as ral(4) which cannot handle clients
using DTIM. At this point most APs in active use should be able to handle
DTIM power management as enabled by your patch (smartphones would not have
working wifi otherwise), if not also uAPSD and SMSP, etc.
So if we're going to be making use of this it should be done by default.

By the way, I have quite a bit of diffs built up in order to support
BZ devices which is still work in progress and might clash a little
bit with your diffs, but not very much.