diff options
author | Felix Fietkau <nbd@nbd.name> | 2019-09-05 18:29:13 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2019-11-20 13:23:49 +0100 |
commit | aec65e484779c6326116be921cc1bf1aa8e85ecc (patch) | |
tree | e1d05e33c55da31560e1f5fd7f5e662c2ef4e45f /drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | |
parent | dcff8d4dc301c0601625ccae0dffec1bbef83234 (diff) | |
download | linux-stable-aec65e484779c6326116be921cc1bf1aa8e85ecc.tar.gz linux-stable-aec65e484779c6326116be921cc1bf1aa8e85ecc.tar.bz2 linux-stable-aec65e484779c6326116be921cc1bf1aa8e85ecc.zip |
mt76: unify channel survey update code
Host time is used to calculate the channel active time on mt7603 and mt7615.
Use the same on mt76x02 and move the lock to core code to get rid of some
duplicated code.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt76x02_mac.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c index c987e57db0b4..e49d0136adbc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c @@ -984,17 +984,9 @@ void mt76x02_update_channel(struct mt76_dev *mdev) { struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); struct mt76_channel_state *state; - u32 active, busy; state = mdev->chan_state; - - busy = mt76_rr(dev, MT_CH_BUSY); - active = busy + mt76_rr(dev, MT_CH_IDLE); - - spin_lock_bh(&dev->mt76.cc_lock); - state->cc_busy += busy; - state->cc_active += active; - spin_unlock_bh(&dev->mt76.cc_lock); + state->cc_busy += mt76_rr(dev, MT_CH_BUSY); } EXPORT_SYMBOL_GPL(mt76x02_update_channel); @@ -1152,6 +1144,16 @@ void mt76x02_mac_work(struct work_struct *work) MT_MAC_WORK_INTERVAL); } +void mt76x02_mac_cc_reset(struct mt76x02_dev *dev) +{ + dev->mt76.survey_time = ktime_get_boottime(); + + /* channel cycle counters read-and-clear */ + mt76_rr(dev, MT_CH_BUSY); + mt76_rr(dev, MT_CH_IDLE); +} +EXPORT_SYMBOL_GPL(mt76x02_mac_cc_reset); + void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) { idx &= 7; |