Skip to content

Commit

Permalink
mac80211: Add flushes before going off-channel
Browse files Browse the repository at this point in the history
We've got a couple of races when enabling powersave with an AP for
off-channel operation. The first is fairly simple. If we go off-channel
before the nullfunc frame to enable PS is transmitted then it may not be
received by the AP. Add a flush after enabling off-channel PS to prevent
this from happening.

The second race is a bit more subtle. If the driver supports QoS and has
frames queued when the nullfunc frame is queued, those frames may get
transmitted after the nullfunc frame. If PM is not set then the AP is
being told that we've exited PS before we go off-channel and may try to
deliver frames. To prevent this, add a flush after stopping the queues
but before passing the nullfunc frame to the driver.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Seth Forshee authored and Johannes Berg committed Feb 11, 2013
1 parent 6c17b77 commit 9c35d7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/mac80211/offchannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,13 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local)
* STA interfaces.
*/

/*
* Stop queues and transmit all frames queued by the driver
* before sending nullfunc to enable powersave at the AP.
*/
ieee80211_stop_queues_by_reason(&local->hw,
IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL);
drv_flush(local, false);

mutex_lock(&local->iflist_mtx);
list_for_each_entry(sdata, &local->interfaces, list) {
Expand Down
3 changes: 3 additions & 0 deletions net/mac80211/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)

ieee80211_offchannel_stop_vifs(local);

/* ensure nullfunc is transmitted before leaving operating channel */
drv_flush(local, false);

ieee80211_configure_filter(local);

/* We need to set power level at maximum rate for scanning. */
Expand Down

0 comments on commit 9c35d7d

Please sign in to comment.