Commit 55f40ea9 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Greg Kroah-Hartman

mac80211: synchronize scan off/on-channel and PS states

commit aacde9ee upstream.

Since:

commit b23b025f
Author: Ben Greear <greearb@candelatech.com>
Date:   Fri Feb 4 11:54:17 2011 -0800

    mac80211: Optimize scans on current operating channel.

we do not disable PS while going back to operational channel (on
ieee80211_scan_state_suspend) and deffer that until scan finish.
But since we are allowed to send frames, we can send a frame to AP
without PM bit set, so disable PS on AP side. Then when we switch
to off-channel (in ieee80211_scan_state_resume) we do not enable PS.
Hence we are off-channel with PS disabled, frames are not buffered
by AP.

To fix remove offchannel_ps_disable argument and always enable PS when
going off-channel and disable it when going on-channel, like it was
before.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Tested-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarCAI Qian <caiqian@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4d973b29
...@@ -1169,11 +1169,9 @@ void ieee80211_sched_scan_stopped_work(struct work_struct *work); ...@@ -1169,11 +1169,9 @@ void ieee80211_sched_scan_stopped_work(struct work_struct *work);
bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local); bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local);
void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local, void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
bool tell_ap); bool tell_ap);
void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local);
bool offchannel_ps_enable);
void ieee80211_offchannel_return(struct ieee80211_local *local, void ieee80211_offchannel_return(struct ieee80211_local *local,
bool enable_beaconing, bool enable_beaconing);
bool offchannel_ps_disable);
void ieee80211_hw_roc_setup(struct ieee80211_local *local); void ieee80211_hw_roc_setup(struct ieee80211_local *local);
/* interface handling */ /* interface handling */
......
...@@ -102,8 +102,7 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata) ...@@ -102,8 +102,7 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata)
ieee80211_sta_reset_conn_monitor(sdata); ieee80211_sta_reset_conn_monitor(sdata);
} }
void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local)
bool offchannel_ps_enable)
{ {
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
...@@ -128,8 +127,7 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, ...@@ -128,8 +127,7 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
netif_tx_stop_all_queues(sdata->dev); netif_tx_stop_all_queues(sdata->dev);
if (offchannel_ps_enable && if (sdata->vif.type == NL80211_IFTYPE_STATION &&
(sdata->vif.type == NL80211_IFTYPE_STATION) &&
sdata->u.mgd.associated) sdata->u.mgd.associated)
ieee80211_offchannel_ps_enable(sdata, true); ieee80211_offchannel_ps_enable(sdata, true);
} }
...@@ -155,8 +153,7 @@ void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local, ...@@ -155,8 +153,7 @@ void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
} }
void ieee80211_offchannel_return(struct ieee80211_local *local, void ieee80211_offchannel_return(struct ieee80211_local *local,
bool enable_beaconing, bool enable_beaconing)
bool offchannel_ps_disable)
{ {
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
...@@ -166,11 +163,9 @@ void ieee80211_offchannel_return(struct ieee80211_local *local, ...@@ -166,11 +163,9 @@ void ieee80211_offchannel_return(struct ieee80211_local *local,
continue; continue;
/* Tell AP we're back */ /* Tell AP we're back */
if (offchannel_ps_disable && if (sdata->vif.type == NL80211_IFTYPE_STATION &&
sdata->vif.type == NL80211_IFTYPE_STATION) { sdata->u.mgd.associated)
if (sdata->u.mgd.associated) ieee80211_offchannel_ps_disable(sdata);
ieee80211_offchannel_ps_disable(sdata);
}
if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
......
...@@ -314,7 +314,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted, ...@@ -314,7 +314,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted,
if (on_oper_chan2 && (on_oper_chan != on_oper_chan2)) if (on_oper_chan2 && (on_oper_chan != on_oper_chan2))
enable_beacons = true; enable_beacons = true;
ieee80211_offchannel_return(local, enable_beacons, true); ieee80211_offchannel_return(local, enable_beacons);
} }
ieee80211_recalc_idle(local); ieee80211_recalc_idle(local);
...@@ -563,7 +563,7 @@ static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *loca ...@@ -563,7 +563,7 @@ static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *loca
/* PS will already be in off-channel mode, /* PS will already be in off-channel mode,
* we do that once at the beginning of scanning. * we do that once at the beginning of scanning.
*/ */
ieee80211_offchannel_stop_vifs(local, false); ieee80211_offchannel_stop_vifs(local);
/* /*
* What if the nullfunc frames didn't arrive? * What if the nullfunc frames didn't arrive?
...@@ -594,7 +594,7 @@ static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *loca ...@@ -594,7 +594,7 @@ static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *loca
* in off-channel state..will put that back * in off-channel state..will put that back
* on-channel at the end of scanning. * on-channel at the end of scanning.
*/ */
ieee80211_offchannel_return(local, true, false); ieee80211_offchannel_return(local, true);
*next_delay = HZ / 5; *next_delay = HZ / 5;
local->next_scan_state = SCAN_DECISION; local->next_scan_state = SCAN_DECISION;
......
...@@ -973,16 +973,14 @@ static void ieee80211_work_work(struct work_struct *work) ...@@ -973,16 +973,14 @@ static void ieee80211_work_work(struct work_struct *work)
if (on_oper_chan != on_oper_chan2) { if (on_oper_chan != on_oper_chan2) {
if (on_oper_chan2) { if (on_oper_chan2) {
/* going off oper channel, PS too */ /* going off oper channel, PS too */
ieee80211_offchannel_stop_vifs(local, ieee80211_offchannel_stop_vifs(local);
true);
ieee80211_hw_config(local, 0); ieee80211_hw_config(local, 0);
} else { } else {
/* going on channel, but leave PS /* going on channel, but leave PS
* off-channel. */ * off-channel. */
ieee80211_hw_config(local, 0); ieee80211_hw_config(local, 0);
ieee80211_offchannel_return(local, ieee80211_offchannel_return(local,
true, true);
false);
} }
} else if (tmp_chan_changed) } else if (tmp_chan_changed)
/* Still off-channel, but on some other /* Still off-channel, but on some other
...@@ -1085,7 +1083,7 @@ static void ieee80211_work_work(struct work_struct *work) ...@@ -1085,7 +1083,7 @@ static void ieee80211_work_work(struct work_struct *work)
* beaconing if we were already on-oper-channel * beaconing if we were already on-oper-channel
* as a future optimization. * as a future optimization.
*/ */
ieee80211_offchannel_return(local, true, true); ieee80211_offchannel_return(local, true);
/* give connection some time to breathe */ /* give connection some time to breathe */
run_again(local, jiffies + HZ/2); run_again(local, jiffies + HZ/2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment