mt76: mt7603: enable/disable pre_tbtt_tasklet in mt7603_set_channel
authorLorenzo Bianconi <lorenzo@kernel.org>
Tue, 30 Apr 2019 13:12:02 +0000 (15:12 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 1 May 2019 11:04:00 +0000 (13:04 +0200)
Disable pre_tbtt_tasklet tasklet before setting the operating channel.
Enable/disable beacon_timer in mt7603_set_channel

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7603/beacon.c
drivers/net/wireless/mediatek/mt76/mt7603/main.c

index f3e7406..58e68fb 100644 (file)
@@ -72,6 +72,9 @@ void mt7603_pre_tbtt_tasklet(unsigned long arg)
        struct sk_buff *skb;
        int i, nframes;
 
+       if (mt76_hw(dev)->conf.flags & IEEE80211_CONF_OFFCHANNEL)
+               return;
+
        data.dev = dev;
        __skb_queue_head_init(&data.q);
 
index be5d430..0a0334d 100644 (file)
@@ -133,10 +133,12 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
        bool failed = false;
 
        cancel_delayed_work_sync(&dev->mt76.mac_work);
+       tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
 
        mutex_lock(&dev->mt76.mutex);
        set_bit(MT76_RESET, &dev->mt76.state);
 
+       mt7603_beacon_set_timer(dev, -1, 0);
        mt76_set_channel(&dev->mt76);
        mt7603_mac_stop(dev);
 
@@ -186,8 +188,12 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
        mt7603_init_edcca(dev);
 
 out:
+       if (!(mt76_hw(dev)->conf.flags & IEEE80211_CONF_OFFCHANNEL))
+               mt7603_beacon_set_timer(dev, -1, dev->mt76.beacon_int);
        mutex_unlock(&dev->mt76.mutex);
 
+       tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
+
        if (failed)
                mt7603_mac_work(&dev->mt76.mac_work.work);
 
@@ -535,7 +541,6 @@ mt7603_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        struct mt7603_dev *dev = hw->priv;
 
        set_bit(MT76_SCANNING, &dev->mt76.state);
-       mt7603_beacon_set_timer(dev, -1, 0);
 }
 
 static void
@@ -544,7 +549,6 @@ mt7603_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
        struct mt7603_dev *dev = hw->priv;
 
        clear_bit(MT76_SCANNING, &dev->mt76.state);
-       mt7603_beacon_set_timer(dev, -1, dev->mt76.beacon_int);
 }
 
 static void