Skip to contentSkip to conversation

Suspending 802.11 drivers

DISCUSSION Michael Buesch 4 participants 10 messages Jun 15, 2006 – Jun 22, 2006 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I am currently thinking about the best way to correctly implement PM suspending for wireless drivers. Currently, the 802.11 stack is not suspend aware (if I talk about "stack" here, I mostly mean devicescape). For example, if we suspend the bcm43xx driver, we don't notify the stack before doing so. That's a bug.

I would say, we should have two functions, which are called from the driver suspend and resume callbacks.
Let's call them
ieee80211_suspend() and ieee80211_resume() for now. The suspend would save all status information, for example to which AP we are associated and so on. After that it would cleanly disassociate from the AP and do other cleanups which are needed.
The resume function would try to re-esablish the connection. Of course, that will not always be possible (the notebook owner traveled around half the world between suspend and resume ;) ). But that does not matter. We simply return silently without a new association (Do a new scan, or whatever).

Are such functions generally desireable?

Signature · 1 line
Greetings Michael.
#1 lore raw

Hi,

Quoted 6 lines

I am currently thinking about the best way to correctly implement PM suspending for wireless drivers. Currently, the 802.11 stack is not suspend aware (if I talk about "stack" here, I mostly mean devicescape). For example, if we suspend the bcm43xx driver, we don't notify the stack before doing so. That's a bug.

Similar in rt2x00. The basic approach in there is calling netdev->open() and netdev->stop() which is not the most clean or correct thing to do.

Quoted 14 lines

I would say, we should have two functions, which are called from the driver suspend and resume callbacks.
Let's call them
ieee80211_suspend() and ieee80211_resume() for now. The suspend would save all status information, for example to which AP we are associated and so on. After that it would cleanly disassociate from the AP and do other cleanups which are needed.
The resume function would try to re-esablish the connection. Of course, that will not always be possible (the notebook owner traveled around half the world between suspend and resume ;) ). But that does not matter. We simply return silently without a new association (Do a new scan, or whatever).

Quoted 1 line

Are such functions generally desireable?

Absolutely, I have been looking into this some time ago as well, but due to lack of time haven't managed to get anything done.

Ivo

#3 lore raw
In reply to a message not in the archive
Quoted 7 lines · Florian Fainelli

Hello Michael,

I think these are really interesting functions. Currently I scripted a bit to do module unloading/loading on suspend/resume requests plus supplicant context saving and restart.

Of course, if the driver is able to manage this by itself, it's far better.

Well, if the _suspend() and _resume() semantics are actually implemented in kernel or userspace is another question. I would say, it should be possible to defer it to userspace, after the userspace MLME stuff is done. But that does not really matter here to get my point. My point is:
ieee80211 subsystem should provide functions which save/restore the whole state of the stack (Well, the state of running connections and associations ,actually). How these functions are implemented internally is another matter.
But I would also say that it sounds sane to put these semantics into userspace, in the long term.

Quoted 1 line

Any news on the power management specifications ?

No. I think I will start another attempt to measure the power consumption of the card, soon. Maybe this time I will be able to figure out the meaning of the PS bits :) I think I forgot to set important bits last time I checked.

Signature · 1 line
Greetings Michael.
#4 lore raw
In reply to Michael Buesch

Am Donnerstag 15 Juni 2006 21:58 schrieb Michael Buesch:

Quoted 6 lines

I am currently thinking about the best way to correctly implement PM suspending for wireless drivers. Currently, the 802.11 stack is not suspend aware (if I talk about "stack" here, I mostly mean devicescape). For example, if we suspend the bcm43xx driver, we don't notify the stack before doing so. That's a bug.

I think the most important question is how a suspend/resume action should be translated. For the managed case, it is clearly an association loss, normally signalled by netif_carrier_on/off() and a corresponding SIOCGIWAP event. Supplicants can act on this. In AP mode, suspend is equal to disassociating all stations. Ad-hoc... dunno.

For a softmac stack like devicescape, it makes sense to have a function that abstracts these scenarios as it is the stack anyway that handles association stuff. However, I'd rather extend the existing function ieee80211_netif_oper().

Quoted 4 lines

The suspend would save all status information, for example to which AP we are associated and so on. After that it would cleanly disassociate from the AP and do other cleanups which are needed.

It would *try* to cleanly disassociate. No way waiting for the management packet to reach the air or even for the AP's acknowledgement while half of userspace is already frozen and the user wants the machine to go down ASAP. (But that's an interesting point. Will sniff whether ipw2200 hardware sends a final packet on suspend.)

Quoted 1 line

The resume function would try to re-esablish the connection.

Don't keep too much state - just notify userspace of the disassociation, then scan and reassociate using the given iwconfig parameters or the running supplicant as it would happen on a normal association loss. ipw2200 acts like this, and it is definitely fast enough.

Stefan

#5 lore raw

Am Freitag 16 Juni 2006 20:36 schrieb Stefan Rompf:

Quoted 2 lines

(But that's an interesting point. Will sniff whether ipw2200 hardware sends a final packet on suspend.)

neither on suspend to RAM nor on suspend to disk a disassociation is sent by ipw2200 - for the AP, the client just vanishes.

Stefan

#6 lore raw
In reply to Stefan Rompf
Quoted 8 lines · Stefan Rompf

Am Donnerstag 15 Juni 2006 21:58 schrieb Michael Buesch:

I think the most important question is how a suspend/resume action should be translated. For the managed case, it is clearly an association loss, normally signalled by netif_carrier_on/off() and a corresponding SIOCGIWAP event. Supplicants can act on this. In AP mode, suspend is equal to disassociating all stations. Ad-hoc... dunno.

Quoted 4 lines

For a softmac stack like devicescape, it makes sense to have a function that abstracts these scenarios as it is the stack anyway that handles association stuff. However, I'd rather extend the existing function ieee80211_netif_oper().

Since d80211 is already being patched for sysfs how about we use sysfs (and kobjects) to maintain the state at suspend() and resume(). This would allow userspace tools like supplicant running in the background to pick up from sysfs where it left off and for our drivers to save where we left off. ieee80211_hw can then just refer to their suspend() and resume() routines from its respective struct pci_driver or struct usb_device.

Luis

#7 lore raw
Quoted 14 lines · Luis R. Rodriguez
Quoted 8 lines · Stefan Rompf

Am Donnerstag 15 Juni 2006 21:58 schrieb Michael Buesch:

I think the most important question is how a suspend/resume action should be translated. For the managed case, it is clearly an association loss, normally signalled by netif_carrier_on/off() and a corresponding SIOCGIWAP event. Supplicants can act on this. In AP mode, suspend is equal to disassociating all stations. Ad-hoc... dunno.

Quoted 4 lines

For a softmac stack like devicescape, it makes sense to have a function that abstracts these scenarios as it is the stack anyway that handles association stuff. However, I'd rather extend the existing function ieee80211_netif_oper().

Quoted 7 lines

Since d80211 is already being patched for sysfs how about we use sysfs (and kobjects) to maintain the state at suspend() and resume(). This would allow userspace tools like supplicant running in the background to pick up from sysfs where it left off and for our drivers to save where we left off. ieee80211_hw can then just refer to their suspend() and resume() routines from its respective struct pci_driver or struct usb_device.

Ok, so you mean we remove the full responsibility to recover a connection from the driver resume() handler and let a userspace daemon keep track of this?
So basically stay with the current implementation of suspend() and resume() in the drivers and assume userspace does the right thing and detects a resume and recovers connections and so on?
Did I understand that right? If yes, I think that's a very nice idea, too. Probably the best.

Signature · 1 line
Greetings Michael.
#9 lore raw
In reply to Luis R. Rodriguez

Am Mittwoch 21 Juni 2006 17:08 schrieb Luis R. Rodriguez:

Quoted 5 lines

Since d80211 is already being patched for sysfs how about we use sysfs (and kobjects) to maintain the state at suspend() and resume(). This would allow userspace tools like supplicant running in the background to pick up from sysfs where it left off and for our drivers to save where we left off.

Forgive me that I'm so insistant on this question, but this is important: What state that goes beyond the data settable with wireless ioctls/iwconfig (that is kept anyway) needs to be saved by the stack? Last association info is worthless, the assocation can be restored using the ESSID/BSSID/channel set with iwconfig or by wpa_supplicant. Important is that userspace is notified about the connection loss. Is there _any_ other information not recreatable from iwconfig settings that needs to be kept?

Stefan

#8 lore raw
In reply to Michael Buesch
Quoted 23 lines · Michael Buesch
Quoted 14 lines · Luis R. Rodriguez
Quoted 8 lines · Stefan Rompf

Am Donnerstag 15 Juni 2006 21:58 schrieb Michael Buesch:

I think the most important question is how a suspend/resume action should be translated. For the managed case, it is clearly an association loss, normally signalled by netif_carrier_on/off() and a corresponding SIOCGIWAP event. Supplicants can act on this. In AP mode, suspend is equal to disassociating all stations. Ad-hoc... dunno.

Quoted 4 lines

For a softmac stack like devicescape, it makes sense to have a function that abstracts these scenarios as it is the stack anyway that handles association stuff. However, I'd rather extend the existing function ieee80211_netif_oper().

Quoted 7 lines

Since d80211 is already being patched for sysfs how about we use sysfs (and kobjects) to maintain the state at suspend() and resume(). This would allow userspace tools like supplicant running in the background to pick up from sysfs where it left off and for our drivers to save where we left off. ieee80211_hw can then just refer to their suspend() and resume() routines from its respective struct pci_driver or struct usb_device.

Quoted 8 lines

Ok, so you mean we remove the full responsibility to recover a connection from the driver resume() handler and let a userspace daemon keep track of this?
So basically stay with the current implementation of suspend() and resume() in the drivers and assume userspace does the right thing and detects a resume and recovers connections and so on?
Did I understand that right? If yes, I think that's a very nice idea, too. Probably the best.

Michael, yes that was what I meant.

#10 lore raw
In reply to Stefan Rompf
Quoted 16 lines · Stefan Rompf

Am Mittwoch 21 Juni 2006 17:08 schrieb Luis R. Rodriguez:

Quoted 5 lines

Since d80211 is already being patched for sysfs how about we use sysfs (and kobjects) to maintain the state at suspend() and resume(). This would allow userspace tools like supplicant running in the background to pick up from sysfs where it left off and for our drivers to save where we left off.

Forgive me that I'm so insistant on this question, but this is important: What state that goes beyond the data settable with wireless ioctls/iwconfig (that is kept anyway) needs to be saved by the stack? Last association info is worthless, the assocation can be restored using the ESSID/BSSID/channel set with iwconfig or by wpa_supplicant. Important is that userspace is notified about the connection loss. Is there _any_ other information not recreatable from iwconfig settings that needs to be kept?

Quoted 1 line

Stefan

Stefan, this is an excellent and valid question. Let me elaborate -- Its exactly those settings you mention I'm suggesting get saved onto sysfs by the driver and later get picked up by userspace. There are, however, other settings which could get saved when suspending too though, settings for example, which otherwise would get set by current private wireless ioctls. There are too many here to describe really, each device has their own set of of private attributes.

More on this in another e-mail I'm about to send to netdev.

Luis