Re: some wireless suspend thoughts

Johannes Berg
2009-05-17T11:21:39Z

[-- Attachment #1: Type: text/plain, Size: 2829 bytes --]

On Sat, 2009-05-16 at 15:07 -0700, Luis R. Rodriguez wrote:

> > --- wireless-testing.orig/net/mac80211/pm.c 2009-05-15 15:17:08.851827827 +0200
> > +++ wireless-testing/net/mac80211/pm.c 2009-05-15 15:17:09.891708511 +0200
> > @@ -16,6 +16,17 @@ int __ieee80211_suspend(struct ieee80211
> >
> > ieee80211_scan_cancel(local);
> >
> > + local->ps_before_suspend = !!(local->hw.conf.flags & IEEE80211_CONF_PS);
> > + local->hw.conf.flags &= ~IEEE80211_CONF_PS;
>
> Why clear it? Wasn't the goal to go to PS mode during suspend? Also if
> we're already in PS mode no point in calling hw_config.
>
> I take it we don't want to go to PS mode when we don't have WoW
> enabled then, because as you noted you're going to disassoc pretty
> quickly otherwise, unless your AP has long idle detection times. PS
> mode requires you to be able to be up at least every DTIM it would
> seem better to just disassoc unless wow is enabled.

Yes, I don't really know why I did that, I think I only did because I
wanted to be able to control what the AP thought by sending that
nullfunc frame in mac80211. We probably should do the reverse and enable
CONF_PS if supported and not active yet, and only if not supported send
the nullfunc frame 'manually'.

But note that for the AP we are in PS anyway since I send the nullfunc
frame.

> We need to consider ahb as well but that's a quick fix.

Yes, of course. Like I said -- a hack.

> I noticed you nuked pci_save_state() and pci_restore_state(), that
> saves PCI config space so seems required, so we'll have to still
> inform drv_stop of the suspend case -- and not sure that is worth it.

Yeah I wasn't sure about that myself. I suspect moving
* pci cache line adjustment,
* pci latency timer thing,
* and pci_set_master
into ->start would be sufficient instead of using
save_state/restore_state.

> What we save here is more control in mac80211 / cfg80211 but the
> things we need to added makes me wonder if its worth it in this case.

Yeah, not sure really. I was just playing with the code mostly tbh. I
thought it was nice that I didn't need code in two places in the driver,
only in ->start/->stop rather than the PCI resume hooks too.

Also, because I decided to use ->shutdown in cfg80211 so we could in
theory have WoW while the machine is off... of course, that doesn't
really work since wpa_supplicant will long have been killed thereby
deconfiguring the interface and userspace will have taken the interface
down itself. Of course, the immediate reason I added a shutdown hook was
that quirk with my platform where the wireless card would have woken up
for writing the hibernate image, but then never told the AP it's going
to PS again because the machine just turns off after that...

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]