Commit 5b714c6a authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: fix offchannel queue stop

Somebody noticed this problem, and I outlined
to them how to fix it, but haven't heard back
from them. So while I was adding the state
field I figured I could use it to fix it.

The problem, as I understand it, is that when
we go offchannel while the driver has a queue
stopped, the driver will likely start draining
the queue and then enable it while offchannel.
This in turn will enable the interface queue,
and that leads to transmitting data frames on
the wrong channel.

Fix this by keeping track of offchannel status
per interface, and not enabling the interface
queues on interfaces that are offchannel when
the driver enables a queue.
Signed-off-by: default avatarJohannes Berg <>
Signed-off-by: default avatarJohn W. Linville <>
parent c35d0270
......@@ -477,9 +477,12 @@ enum ieee80211_sub_if_data_flags {
* @SDATA_STATE_RUNNING: virtual interface is up & running; this
* mirrors netif_running() but is separate for interface type
* change handling while the interface is up
* @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel
* mode, so queues are stopped
enum ieee80211_sdata_state_bits {
struct ieee80211_sub_if_data {
......@@ -112,8 +112,10 @@ void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local)
* used from user space controlled off-channel operations.
if (sdata->vif.type != NL80211_IFTYPE_STATION &&
sdata->vif.type != NL80211_IFTYPE_MONITOR)
sdata->vif.type != NL80211_IFTYPE_MONITOR) {
set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
......@@ -131,6 +133,7 @@ void ieee80211_offchannel_stop_station(struct ieee80211_local *local)
if (sdata->vif.type == NL80211_IFTYPE_STATION) {
set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
if (sdata->u.mgd.associated)
......@@ -155,8 +158,20 @@ void ieee80211_offchannel_return(struct ieee80211_local *local,
if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
* This may wake up queues even though the driver
* currently has them stopped. This is not very
* likely, since the driver won't have gotten any
* (or hardly any) new packets while we weren't
* on the right channel, and even if it happens
* it will at most lead to queueing up one more
* packet per queue in mac80211 rather than on
* the interface qdisc.
/* re-enable beaconing */
if (enable_beaconing &&
......@@ -283,8 +283,11 @@ static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue,
if (skb_queue_empty(&local->pending[queue])) {
list_for_each_entry_rcu(sdata, &local->interfaces, list)
list_for_each_entry_rcu(sdata, &local->interfaces, list) {
if (test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state))
netif_wake_subqueue(sdata->dev, queue);
} else
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