Skip to contentSkip to conversation

mac80211: Always send a null data frame if TIM bit is set.

PATCH In review Vivek Natarajan 4 participants 6 messages Mar 2, 2009 – Apr 2, 2009 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: Always send a null data frame if TIM bit is set.

If the AP thinks we are in power save state eventhough we are not truly in that state, it sets the TIM bit and does not send a data frame unless we send a null data frame to correct the state in the AP. This might happen if the null data frame for wake up is lost in the air after we disable power save.

---
 net/mac80211/mlme.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
net/mac80211/mlme.c +1 -2
index 7f23858..ac10b21 100644
@@ -1457,8 +1457,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 	ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param,
 				 elems.wmm_param_len);
 
-	if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK &&
-	    local->hw.conf.flags & IEEE80211_CONF_PS) {
+	if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) {
 		directed_tim = ieee80211_check_tim(&elems, ifmgd->aid);
 
 		if (directed_tim) {
Signature · 1 line
1.6.0.1
#1 lore raw
Quoted 5 lines · Vivek Natarajan

If the AP thinks we are in power save state eventhough we are not truly in that state, it sets the TIM bit and does not send a data frame unless we send a null data frame to correct the state in the AP. This might happen if the null data frame for wake up is lost in the air after we disable power save.

Not a bad idea. Of course the proper fix would be that the stack is notified when the null frames transmission fails, but we don't have that yet.

net/mac80211/mlme.c static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, · line 1461

Quoted 10 lines
net/mac80211/mlme.c +1 -2
@@ -1457,8 +1457,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 	ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param,
 				 elems.wmm_param_len);
 
-	if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK &&
-	    local->hw.conf.flags & IEEE80211_CONF_PS) {
+	if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) {
 		directed_tim = ieee80211_check_tim(&elems, ifmgd->aid);

Please add a comment why IEEE80211_CONF_PS is not checked.

Signature · 1 line
Kalle Valo
#2 lore raw
In reply to Vivek Natarajan

On Mon, Mar 2, 2009 at 8:20 PM, Vivek Natarajan <[email protected]=

Quoted 2 lines

wrote:
If the AP thinks we are in power save state eventhough we are not tru=

ly

Quoted 1 line

in that state, it sets the TIM bit and does not send a data frame unl=

ess

Quoted 2 lines

we send a null data frame to correct the state in the AP. This might happen if the null data frame for wake up is lost in the a=

ir

net/mac80211/mlme.c static void ieee80211_rx_mgmt_beacon(struct iee=

Quoted 12 lines

after we disable power save.

---
=A0net/mac80211/mlme.c | =A0 =A03 +--
=A01 files changed, 1 insertions(+), 2 deletions(-)

net/mac80211/mlme.c +0 -0
index 7f23858..ac10b21 100644
@@ -1457,8 +1457,7 @@ static void ieee80211_rx_mgmt_beacon(struct iee=

e80211_sub_if_data *sdata,

Quoted 1 line

=A0 =A0 =A0 =A0ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param=

,

Quoted 1 line

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 elems=

=2Ewmm_param_len);

Quoted 5 lines

- =A0 =A0 =A0 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK &&
- =A0 =A0 =A0 =A0 =A0 local->hw.conf.flags & IEEE80211_CONF_PS) {
+ =A0 =A0 =A0 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) { =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0directed_tim =3D ieee80211_check_tim(&=

elems, ifmgd->aid);

Quoted 2 lines

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (directed_tim) {

	                 if (local->hw.conf.dynamic_ps_timeout > 0) {
				local->hw.conf.flags &=3D ~IEEE80211_CONF_PS;
				ieee80211_hw_config(local,
						    IEEE80211_CONF_CHANGE_PS);
				ieee80211_send_nullfunc(local, sdata, 0);
			} else {
				local->pspolling =3D true;
				ieee80211_send_pspoll(local, sdata);

Although the above patch is a right approach, it opens up an issue with pspolling.

In the above chunk of code, if the timeout is zero, instead of sending a null frame to
correct the state in the AP, we may keep on sending ps poll frames ( And the ps state
in the AP will never be corrected)

I have not tested pspolling with ath9k. But this seems to be an issue. Thoughts?

VIvek.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 10 lines · Vivek Natarajan

Although the above patch is a right approach, it opens up an issue with pspolling.

In the above chunk of code, if the timeout is zero, instead of sending a null frame to correct the state in the AP, we may keep on sending ps poll frames ( And the ps state in the AP will never be corrected)

I have not tested pspolling with ath9k. But this seems to be an issue. Thoughts?

Maybe it's better to have a separate test for the case that TIM bit is set but we are not in power save and just send a nullfunc frame without psm bit. And leave the original power save code as it was.

I really would like to have some frame ack callback to mac80211, even not all drivers support that. Otherwise we cannot reliably go to power save because the AP might not receive our nullfunc frame. I have to think about this and I'll try to propose something later on.

Signature · 1 line
Kalle Valo
maintainer
#4 lore raw
Quoted 4 lines · Kalle Valo

I really would like to have some frame ack callback to mac80211, even not all drivers support that. Otherwise we cannot reliably go to power save because the AP might not receive our nullfunc frame. I have to think about this and I'll try to propose something later on.

I suppose we could well assume that we do get TX status for those devices that do support power save -- which devices would that affect?

johannes

#5 lore raw
Quoted 9 lines · Johannes Berg
Quoted 4 lines · Kalle Valo

I really would like to have some frame ack callback to mac80211, even not all drivers support that. Otherwise we cannot reliably go to power save because the AP might not receive our nullfunc frame. I have to think about this and I'll try to propose something later on.

I suppose we could well assume that we do get TX status for those devices that do support power save -- which devices would that affect?

rt2500usb and rt73usb don't provide a valid TX status but do support power save at he moment. I have to add that I'm in contact with somebody who is looking into supporting Ack-based TX status reporting in mac80211 which could cure this problem. I have directed him to the linux-wireless list so he will probably soon send his ideas to the list.

In any case, for now we can assume rt2500usb and rt73usb to be a problem.

Ivo