mt76: mt7615: fix survey channel busy time
authorFelix Fietkau <nbd@nbd.name>
Thu, 26 Sep 2019 16:23:56 +0000 (18:23 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 20 Nov 2019 12:23:49 +0000 (13:23 +0100)
Like on mt7603, MIB status register 16 tracks CCA time, but does not
include tx time. Switch to status register 9 to includ NAV and tx
time as well.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7615/mac.c
drivers/net/wireless/mediatek/mt76/mt7615/regs.h

index 9b11303..f688390 100644 (file)
@@ -53,7 +53,7 @@ void mt7615_mac_reset_counters(struct mt7615_dev *dev)
        /* TODO: add DBDC support */
 
        /* reset airtime counters */
-       mt76_rr(dev, MT_MIB_SDR16(0));
+       mt76_rr(dev, MT_MIB_SDR9(0));
        mt76_rr(dev, MT_MIB_SDR36(0));
        mt76_rr(dev, MT_MIB_SDR37(0));
        mt76_set(dev, MT_WF_RMAC_MIB_TIME0, MT_WF_RMAC_MIB_RXTIME_CLR);
@@ -1274,7 +1274,8 @@ void mt7615_update_channel(struct mt76_dev *mdev)
        u64 busy_time, tx_time, rx_time, obss_time;
 
        /* TODO: add DBDC support */
-       busy_time = mt76_get_field(dev, MT_MIB_SDR16(0), MT_MIB_BUSY_MASK);
+       busy_time = mt76_get_field(dev, MT_MIB_SDR9(0),
+                                  MT_MIB_SDR9_BUSY_MASK);
        tx_time = mt76_get_field(dev, MT_MIB_SDR36(0),
                                 MT_MIB_SDR36_TXTIME_MASK);
        rx_time = mt76_get_field(dev, MT_MIB_SDR37(0),
index 9a2ff1f..226b9ad 100644 (file)
 #define MT_MIB_RTS_RETRIES_COUNT_MASK  GENMASK(31, 16)
 #define MT_MIB_RTS_COUNT_MASK          GENMASK(15, 0)
 
-#define MT_MIB_SDR16(n)                        MT_WF_MIB(0x48 + ((n) << 9))
-#define MT_MIB_BUSY_MASK               GENMASK(23, 0)
+#define MT_MIB_SDR9(n)                 MT_WF_MIB(0x02c + ((n) << 9))
+#define MT_MIB_SDR9_BUSY_MASK          GENMASK(23, 0)
+
+#define MT_MIB_SDR16(n)                        MT_WF_MIB(0x048 + ((n) << 9))
+#define MT_MIB_SDR16_BUSY_MASK         GENMASK(23, 0)
 
 #define MT_MIB_SDR36(n)                        MT_WF_MIB(0x098 + ((n) << 9))
 #define MT_MIB_SDR36_TXTIME_MASK       GENMASK(23, 0)