mt76: explicitly disable energy detect cca during scan
authorFelix Fietkau <nbd@nbd.name>
Sun, 3 Feb 2019 12:59:06 +0000 (13:59 +0100)
committerFelix Fietkau <nbd@nbd.name>
Mon, 18 Feb 2019 18:54:33 +0000 (19:54 +0100)
Avoid reusing the previous channel's tx blocking state

Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c

index 1117cdc15b0443245b2237ced5fd0acdc9e73cdf..cb70b04d38a5973156f1200bff376db047c2b7fc 100644 (file)
@@ -1006,14 +1006,16 @@ int mt76x0_phy_set_channel(struct mt76x02_dev *dev,
 
        /* enable vco */
        mt76x0_rf_set(dev, MT_RF(0, 4), BIT(7));
-       if (scan)
+       if (scan) {
+               mt76x02_edcca_init(dev, false);
                return 0;
+       }
 
        mt76x02_init_agc_gain(dev);
        mt76x0_phy_calibrate(dev, false);
        mt76x0_phy_set_txpower(dev);
 
-       mt76x02_edcca_init(dev);
+       mt76x02_edcca_init(dev, true);
 
        ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
                                     MT_CALIBRATE_INTERVAL);
index 19fdcab746a0a957d8b9ff666e82a230457e3bba..e4649103efd49ab5d77c28f3f01d1aac1c81fc3b 100644 (file)
@@ -886,7 +886,7 @@ mt76x02_dfs_set_domain(struct mt76x02_dev *dev,
                tasklet_disable(&dfs_pd->dfs_tasklet);
 
                dev->ed_monitor = region == NL80211_DFS_ETSI;
-               mt76x02_edcca_init(dev);
+               mt76x02_edcca_init(dev, true);
 
                dfs_pd->region = region;
                mt76x02_dfs_init_params(dev);
index 6bd7f87644a4cc624ac1305687dabf4cb4f42b34..636e69a7a407436f902ea12add405f8c680999ab 100644 (file)
@@ -891,12 +891,12 @@ mt76x02_edcca_tx_enable(struct mt76x02_dev *dev, bool enable)
        dev->ed_tx_blocked = !enable;
 }
 
-void mt76x02_edcca_init(struct mt76x02_dev *dev)
+void mt76x02_edcca_init(struct mt76x02_dev *dev, bool enable)
 {
        dev->ed_trigger = 0;
        dev->ed_silent = 0;
 
-       if (dev->ed_monitor) {
+       if (dev->ed_monitor && enable) {
                struct ieee80211_channel *chan = dev->mt76.chandef.chan;
                u8 ed_th = chan->band == NL80211_BAND_5GHZ ? 0x0e : 0x20;
 
index 3b04b1bd0abdf468f4dac355ef9990b88c01b3d0..6b1f25d2f64c3a931fbf1bd4c695984f9d5bf4ff 100644 (file)
@@ -207,5 +207,5 @@ int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx,
 void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
                                   struct ieee80211_vif *vif, bool val);
 
-void mt76x02_edcca_init(struct mt76x02_dev *dev);
+void mt76x02_edcca_init(struct mt76x02_dev *dev, bool enable);
 #endif
index 65ed62229a5bf8afb56b0743545ba262a56b228c..97ec575699d021e409bd76fd0aeff91418f8d4c2 100644 (file)
@@ -240,8 +240,10 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
        mt76_wr(dev, MT_BBP(AGC, 2), 0x00007070);
        mt76_wr(dev, MT_TXOP_CTRL_CFG, 0x04101B3F);
 
-       if (scan)
+       if (scan) {
+               mt76x02_edcca_init(dev, false);
                return 0;
+       }
 
        mt76x2_phy_channel_calibrate(dev, true);
        mt76x02_init_agc_gain(dev);
@@ -254,7 +256,7 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
                               0x38);
        }
 
-       mt76x02_edcca_init(dev);
+       mt76x02_edcca_init(dev, true);
 
        ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work,
                                     MT_CALIBRATE_INTERVAL);