mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 19:51:25 -04:00
mt76: mt7615: fix reading airtime statistics
- change the WTBL LMAC access function to set the mapping window only once - use ac * 2 as offset, since each AC has separate words for rx and tx Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
@@ -88,13 +88,12 @@ bool mt7915_mac_wtbl_update(struct mt7915_dev *dev, int idx, u32 mask)
|
||||
0, 5000);
|
||||
}
|
||||
|
||||
static u32 mt7915_mac_wtbl_lmac_read(struct mt7915_dev *dev, u16 wcid,
|
||||
u16 addr)
|
||||
static u32 mt7915_mac_wtbl_lmac_addr(struct mt7915_dev *dev, u16 wcid)
|
||||
{
|
||||
mt76_wr(dev, MT_WTBLON_TOP_WDUCR,
|
||||
FIELD_PREP(MT_WTBLON_TOP_WDUCR_GROUP, (wcid >> 7)));
|
||||
|
||||
return mt76_rr(dev, MT_WTBL_LMAC_OFFS(wcid, addr));
|
||||
return MT_WTBL_LMAC_OFFS(wcid, 0);
|
||||
}
|
||||
|
||||
/* TODO: use txfree airtime info to avoid runtime accessing in the long run */
|
||||
@@ -121,6 +120,7 @@ void mt7915_mac_sta_poll(struct mt7915_dev *dev)
|
||||
|
||||
while (true) {
|
||||
bool clear = false;
|
||||
u32 addr;
|
||||
u16 idx;
|
||||
|
||||
spin_lock_bh(&dev->sta_poll_lock);
|
||||
@@ -133,20 +133,23 @@ void mt7915_mac_sta_poll(struct mt7915_dev *dev)
|
||||
list_del_init(&msta->poll_list);
|
||||
spin_unlock_bh(&dev->sta_poll_lock);
|
||||
|
||||
for (i = 0, idx = msta->wcid.idx; i < IEEE80211_NUM_ACS; i++) {
|
||||
u32 tx_last = msta->airtime_ac[i];
|
||||
u32 rx_last = msta->airtime_ac[i + IEEE80211_NUM_ACS];
|
||||
idx = msta->wcid.idx;
|
||||
addr = mt7915_mac_wtbl_lmac_addr(dev, idx) + 20 * 4;
|
||||
|
||||
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
|
||||
u32 tx_last = msta->airtime_ac[i];
|
||||
u32 rx_last = msta->airtime_ac[i + 4];
|
||||
|
||||
msta->airtime_ac[i] = mt76_rr(dev, addr);
|
||||
msta->airtime_ac[i + 4] = mt76_rr(dev, addr + 4);
|
||||
|
||||
msta->airtime_ac[i] =
|
||||
mt7915_mac_wtbl_lmac_read(dev, idx, 20 + i);
|
||||
msta->airtime_ac[i + IEEE80211_NUM_ACS] =
|
||||
mt7915_mac_wtbl_lmac_read(dev, idx, 21 + i);
|
||||
tx_time[i] = msta->airtime_ac[i] - tx_last;
|
||||
rx_time[i] = msta->airtime_ac[i + IEEE80211_NUM_ACS] -
|
||||
rx_last;
|
||||
rx_time[i] = msta->airtime_ac[i + 4] - rx_last;
|
||||
|
||||
if ((tx_last | rx_last) & BIT(30))
|
||||
clear = true;
|
||||
|
||||
addr += 8;
|
||||
}
|
||||
|
||||
if (clear) {
|
||||
|
||||
Reference in New Issue
Block a user