mt76: mt76x02: only reset beacon drift counter when enabling beacons
authorFelix Fietkau <nbd@nbd.name>
Sun, 24 Feb 2019 12:03:18 +0000 (13:03 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 26 Feb 2019 09:28:19 +0000 (10:28 +0100)
When the timer is already running, there is no need to reset the counter,
because the drift will remain the same.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
drivers/net/wireless/mediatek/mt76/mt76x02_util.c

index be2979f34f31a2927649f2cd14dbc57e5677013d..82b178fa83bb7d63d646fa261e4e587c94a55fed 100644 (file)
@@ -1126,6 +1126,9 @@ void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
        else if (val)
                skb = ieee80211_beacon_get(mt76_hw(dev), vif);
 
+       if (!dev->beacon_mask)
+               dev->tbtt_count = 0;
+
        __mt76x02_mac_set_beacon_enable(dev, vif_idx, val, skb);
 
        if (mt76_is_mmio(dev))
index 2e899d30e00d96af92a7ea6af7fc21155da8653a..a48c261b0c634bca601f8d9fcd496b99a5bc2fa7 100644 (file)
@@ -713,7 +713,6 @@ void mt76x02_bss_info_changed(struct ieee80211_hw *hw,
                               MT_BEACON_TIME_CFG_INTVAL,
                               info->beacon_int << 4);
                dev->beacon_int = info->beacon_int;
-               dev->tbtt_count = 0;
        }
 
        if (changed & BSS_CHANGED_BEACON_ENABLED)