Skip to content

Commit d0b7500

Browse files
committed
wifi: mt76: mt7996: fix MIB TX aggregation counter registers for mt7990
The MIB_TSCR0-7 counters read by mt7996_mac_update_stats() are hardcoded at the mt7996/mt7992 offsets 0x6b0-0x6d0, but mt7990 moved them to 0x750-0x770, so TX AMPDU statistics were read from unrelated registers on that chip. Move the offsets into the per-chip register tables. Fixes: f6c8741 ("wifi: mt76: mt7996: rework register mapping for mt7990") Link: https://patch.msgid.link/20260727150434.1778520-1-nbd@nbd.name Signed-off-by: Felix Fietkau <nbd@nbd.name>
1 parent a3da1f2 commit d0b7500

2 files changed

Lines changed: 40 additions & 8 deletions

File tree

drivers/net/wireless/mediatek/mt76/mt7996/mmio.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ static const u32 mt7996_offs[] = {
5454
[MIB_BSCR7] = 0x9e8,
5555
[MIB_BSCR17] = 0xa10,
5656
[MIB_TRDR1] = 0xa28,
57+
[MIB_TSCR0] = 0x6b0,
58+
[MIB_TSCR1] = 0x6b4,
59+
[MIB_TSCR2] = 0x6b8,
60+
[MIB_TSCR3] = 0x6bc,
61+
[MIB_TSCR4] = 0x6c0,
62+
[MIB_TSCR5] = 0x6c4,
63+
[MIB_TSCR6] = 0x6c8,
64+
[MIB_TSCR7] = 0x6d0,
5765
[HIF_REMAP_L1] = 0x24,
5866
[HIF_REMAP_BASE_L1] = 0x130000,
5967
[HIF_REMAP_L2] = 0x1b4,
@@ -91,6 +99,14 @@ static const u32 mt7992_offs[] = {
9199
[MIB_BSCR7] = 0xae4,
92100
[MIB_BSCR17] = 0xb0c,
93101
[MIB_TRDR1] = 0xb24,
102+
[MIB_TSCR0] = 0x6b0,
103+
[MIB_TSCR1] = 0x6b4,
104+
[MIB_TSCR2] = 0x6b8,
105+
[MIB_TSCR3] = 0x6bc,
106+
[MIB_TSCR4] = 0x6c0,
107+
[MIB_TSCR5] = 0x6c4,
108+
[MIB_TSCR6] = 0x6c8,
109+
[MIB_TSCR7] = 0x6d0,
94110
[HIF_REMAP_L1] = 0x8,
95111
[HIF_REMAP_BASE_L1] = 0x40000,
96112
[HIF_REMAP_L2] = 0x1b4,
@@ -128,6 +144,14 @@ static const u32 mt7990_offs[] = {
128144
[MIB_BSCR7] = 0xbd4,
129145
[MIB_BSCR17] = 0xbfc,
130146
[MIB_TRDR1] = 0xc14,
147+
[MIB_TSCR0] = 0x750,
148+
[MIB_TSCR1] = 0x754,
149+
[MIB_TSCR2] = 0x758,
150+
[MIB_TSCR3] = 0x75c,
151+
[MIB_TSCR4] = 0x760,
152+
[MIB_TSCR5] = 0x764,
153+
[MIB_TSCR6] = 0x768,
154+
[MIB_TSCR7] = 0x770,
131155
[HIF_REMAP_L1] = 0x8,
132156
[HIF_REMAP_BASE_L1] = 0x40000,
133157
[HIF_REMAP_L2] = 0x1b8,

drivers/net/wireless/mediatek/mt76/mt7996/regs.h

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ enum offs_rev {
6464
MIB_BSCR7,
6565
MIB_BSCR17,
6666
MIB_TRDR1,
67+
MIB_TSCR0,
68+
MIB_TSCR1,
69+
MIB_TSCR2,
70+
MIB_TSCR3,
71+
MIB_TSCR4,
72+
MIB_TSCR5,
73+
MIB_TSCR6,
74+
MIB_TSCR7,
6775
HIF_REMAP_L1,
6876
HIF_REMAP_BASE_L1,
6977
HIF_REMAP_L2,
@@ -250,9 +258,9 @@ enum offs_rev {
250258
#define MT_MIB_BSCR7(_band) MT_WF_MIB(_band, __OFFS(MIB_BSCR7))
251259
#define MT_MIB_BSCR17(_band) MT_WF_MIB(_band, __OFFS(MIB_BSCR17))
252260

253-
#define MT_MIB_TSCR5(_band) MT_WF_MIB(_band, 0x6c4)
254-
#define MT_MIB_TSCR6(_band) MT_WF_MIB(_band, 0x6c8)
255-
#define MT_MIB_TSCR7(_band) MT_WF_MIB(_band, 0x6d0)
261+
#define MT_MIB_TSCR5(_band) MT_WF_MIB(_band, __OFFS(MIB_TSCR5))
262+
#define MT_MIB_TSCR6(_band) MT_WF_MIB(_band, __OFFS(MIB_TSCR6))
263+
#define MT_MIB_TSCR7(_band) MT_WF_MIB(_band, __OFFS(MIB_TSCR7))
256264

257265
#define MT_MIB_RSCR1(_band) MT_WF_MIB(_band, __OFFS(MIB_RSCR1))
258266
/* rx mpdu counter, full 32 bits */
@@ -268,14 +276,14 @@ enum offs_rev {
268276
#define MT_MIB_RSCR36(_band) MT_WF_MIB(_band, __OFFS(MIB_RSCR36))
269277

270278
/* tx ampdu cnt, full 32 bits */
271-
#define MT_MIB_TSCR0(_band) MT_WF_MIB(_band, 0x6b0)
272-
#define MT_MIB_TSCR2(_band) MT_WF_MIB(_band, 0x6b8)
279+
#define MT_MIB_TSCR0(_band) MT_WF_MIB(_band, __OFFS(MIB_TSCR0))
280+
#define MT_MIB_TSCR2(_band) MT_WF_MIB(_band, __OFFS(MIB_TSCR2))
273281

274282
/* counts all mpdus in ampdu, regardless of success */
275-
#define MT_MIB_TSCR3(_band) MT_WF_MIB(_band, 0x6bc)
283+
#define MT_MIB_TSCR3(_band) MT_WF_MIB(_band, __OFFS(MIB_TSCR3))
276284

277285
/* counts all successfully tx'd mpdus in ampdu */
278-
#define MT_MIB_TSCR4(_band) MT_WF_MIB(_band, 0x6c0)
286+
#define MT_MIB_TSCR4(_band) MT_WF_MIB(_band, __OFFS(MIB_TSCR4))
279287

280288
/* rx ampdu count, 32-bit */
281289
#define MT_MIB_RSCR27(_band) MT_WF_MIB(_band, __OFFS(MIB_RSCR27))
@@ -299,7 +307,7 @@ enum offs_rev {
299307
#define MT_MIB_RVSR1(_band) MT_WF_MIB(_band, __OFFS(MIB_RVSR1))
300308

301309
/* rx blockack count, 32 bits */
302-
#define MT_MIB_TSCR1(_band) MT_WF_MIB(_band, 0x6b4)
310+
#define MT_MIB_TSCR1(_band) MT_WF_MIB(_band, __OFFS(MIB_TSCR1))
303311

304312
#define MT_MIB_BTSCR0(_band) MT_WF_MIB(_band, 0x5e0)
305313
#define MT_MIB_BTSCR5(_band) MT_WF_MIB(_band, __OFFS(MIB_BTSCR5))

0 commit comments

Comments
 (0)