Skip to content

Commit 2969318

Browse files
Henry Yennbd168
authored andcommitted
wifi: mt76: mt7915: fix bogus Tx/Rx airtime duration values
Do not report measurements if the airtime counter was cleared since the last update (possibly by firmware) Signed-off-by: Henry Yen <henry.yen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
1 parent b7e56fa commit 2969318

File tree

1 file changed

+9
-2
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7915

1 file changed

+9
-2
lines changed

drivers/net/wireless/mediatek/mt76/mt7915/mac.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,15 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
140140
msta->airtime_ac[i] = mt76_rr(dev, addr);
141141
msta->airtime_ac[i + 4] = mt76_rr(dev, addr + 4);
142142

143-
tx_time[i] = msta->airtime_ac[i] - tx_last;
144-
rx_time[i] = msta->airtime_ac[i + 4] - rx_last;
143+
if (msta->airtime_ac[i] <= tx_last)
144+
tx_time[i] = 0;
145+
else
146+
tx_time[i] = msta->airtime_ac[i] - tx_last;
147+
148+
if (msta->airtime_ac[i + 4] <= rx_last)
149+
rx_time[i] = 0;
150+
else
151+
rx_time[i] = msta->airtime_ac[i + 4] - rx_last;
145152

146153
if ((tx_last | rx_last) & BIT(30))
147154
clear = true;

0 commit comments

Comments
 (0)