blob: 70aac7a60fbfdfaa5920d793c234bad7889d97b1 [file] [log] [blame]
developer1d6610e2022-12-14 13:09:20 +08001From 4f5ff04c48922ddbbffa73965f086b1b0c2a2e68 Mon Sep 17 00:00:00 2001
developer6a1998b2022-12-08 18:09:45 +08002From: Shayne Chen <shayne.chen@mediatek.com>
3Date: Mon, 6 Jun 2022 19:46:26 +0800
developer1d6610e2022-12-14 13:09:20 +08004Subject: [PATCH 1111/1129] mt76: mt7915: rework testmode init registers
developer6a1998b2022-12-08 18:09:45 +08005
6---
7 mac80211.c | 3 +-
8 mt76.h | 5 ++
9 mt76_connac_mcu.h | 1 +
10 mt7915/mcu.h | 1 +
11 mt7915/mmio.c | 2 +
12 mt7915/regs.h | 16 +++++-
13 mt7915/testmode.c | 134 +++++++++++++++++++++++++++++++++++-----------
14 mt7915/testmode.h | 28 ++++++++++
15 testmode.c | 6 ++-
16 testmode.h | 3 ++
17 10 files changed, 164 insertions(+), 35 deletions(-)
18
19diff --git a/mac80211.c b/mac80211.c
developer79e690d2022-12-13 17:05:25 +080020index 7fe7f68a..19d9efb3 100644
developer6a1998b2022-12-08 18:09:45 +080021--- a/mac80211.c
22+++ b/mac80211.c
developer79e690d2022-12-13 17:05:25 +080023@@ -775,7 +775,8 @@ void mt76_rx(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb)
developer6a1998b2022-12-08 18:09:45 +080024 }
25
26 #ifdef CONFIG_NL80211_TESTMODE
27- if (phy->test.state == MT76_TM_STATE_RX_FRAMES) {
28+ if (!(phy->test.flag & MT_TM_FW_RX_COUNT) &&
29+ phy->test.state == MT76_TM_STATE_RX_FRAMES) {
30 phy->test.rx_stats.packets[q]++;
31 if (status->flag & RX_FLAG_FAILED_FCS_CRC)
32 phy->test.rx_stats.fcs_error[q]++;
33diff --git a/mt76.h b/mt76.h
developer79e690d2022-12-13 17:05:25 +080034index beea57d5..4822ffb7 100644
developer6a1998b2022-12-08 18:09:45 +080035--- a/mt76.h
36+++ b/mt76.h
37@@ -637,6 +637,8 @@ struct mt76_testmode_ops {
38 int (*dump_stats)(struct mt76_phy *phy, struct sk_buff *msg);
39 };
40
41+#define MT_TM_FW_RX_COUNT BIT(0)
42+
43 struct mt76_testmode_data {
44 enum mt76_testmode_state state;
45
46@@ -668,6 +670,8 @@ struct mt76_testmode_data {
47
48 u8 addr[3][ETH_ALEN];
49
50+ u8 flag;
51+
52 u32 tx_pending;
53 u32 tx_queued;
54 u16 tx_queued_limit;
55@@ -675,6 +679,7 @@ struct mt76_testmode_data {
56 struct {
57 u64 packets[__MT_RXQ_MAX];
58 u64 fcs_error[__MT_RXQ_MAX];
59+ u64 len_mismatch;
60 } rx_stats;
61 };
62
63diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
developer79e690d2022-12-13 17:05:25 +080064index 18ae3acb..18d6c669 100644
developer6a1998b2022-12-08 18:09:45 +080065--- a/mt76_connac_mcu.h
66+++ b/mt76_connac_mcu.h
developer79e690d2022-12-13 17:05:25 +080067@@ -1188,6 +1188,7 @@ enum {
developer6a1998b2022-12-08 18:09:45 +080068 MCU_EXT_CMD_OFFCH_SCAN_CTRL = 0x9a,
69 MCU_EXT_CMD_SET_RDD_TH = 0x9d,
70 MCU_EXT_CMD_MURU_CTRL = 0x9f,
71+ MCU_EXT_CMD_RX_STAT = 0xa4,
72 MCU_EXT_CMD_SET_SPR = 0xa8,
73 MCU_EXT_CMD_GROUP_PRE_CAL_INFO = 0xab,
74 MCU_EXT_CMD_DPD_PRE_CAL_INFO = 0xac,
75diff --git a/mt7915/mcu.h b/mt7915/mcu.h
developer79e690d2022-12-13 17:05:25 +080076index eaadd331..2e97db7b 100644
developer6a1998b2022-12-08 18:09:45 +080077--- a/mt7915/mcu.h
78+++ b/mt7915/mcu.h
79@@ -9,6 +9,7 @@
80 enum {
81 MCU_ATE_SET_TRX = 0x1,
82 MCU_ATE_SET_FREQ_OFFSET = 0xa,
83+ MCU_ATE_SET_PHY_COUNT = 0x11,
84 MCU_ATE_SET_SLOT_TIME = 0x13,
85 MCU_ATE_CLEAN_TXQUEUE = 0x1c,
86 };
87diff --git a/mt7915/mmio.c b/mt7915/mmio.c
developer79e690d2022-12-13 17:05:25 +080088index afa558c9..07de3cbd 100644
developer6a1998b2022-12-08 18:09:45 +080089--- a/mt7915/mmio.c
90+++ b/mt7915/mmio.c
91@@ -118,6 +118,7 @@ static const u32 mt7986_reg[] = {
92 };
93
94 static const u32 mt7915_offs[] = {
95+ [TMAC_TCR2] = 0x05c,
96 [TMAC_CDTR] = 0x090,
97 [TMAC_ODTR] = 0x094,
98 [TMAC_ATCR] = 0x098,
99@@ -192,6 +193,7 @@ static const u32 mt7915_offs[] = {
100 };
101
102 static const u32 mt7916_offs[] = {
103+ [TMAC_TCR2] = 0x004,
104 [TMAC_CDTR] = 0x0c8,
105 [TMAC_ODTR] = 0x0cc,
106 [TMAC_ATCR] = 0x00c,
107diff --git a/mt7915/regs.h b/mt7915/regs.h
developer79e690d2022-12-13 17:05:25 +0800108index c8e478a5..d6a05f13 100644
developer6a1998b2022-12-08 18:09:45 +0800109--- a/mt7915/regs.h
110+++ b/mt7915/regs.h
111@@ -48,6 +48,7 @@ enum reg_rev {
112 };
113
114 enum offs_rev {
115+ TMAC_TCR2,
116 TMAC_CDTR,
117 TMAC_ODTR,
118 TMAC_ATCR,
119@@ -198,6 +199,12 @@ enum offs_rev {
120 #define MT_TRB_RXPSR0_RX_WTBL_PTR GENMASK(25, 16)
121 #define MT_TRB_RXPSR0_RX_RMAC_PTR GENMASK(9, 0)
122
123+#define MT_MDP_TOP_DBG_WDT_CTRL MT_MDP(0x0d0)
124+#define MT_MDP_TOP_DBG_WDT_CTRL_TDP_DIS_BLK BIT(7)
125+
126+#define MT_MDP_TOP_DBG_CTRL MT_MDP(0x0dc)
127+#define MT_MDP_TOP_DBG_CTRL_ENQ_MODE BIT(30)
128+
129 /* TMAC: band 0(0x820e4000), band 1(0x820f4000) */
130 #define MT_WF_TMAC_BASE(_band) ((_band) ? 0x820f4000 : 0x820e4000)
131 #define MT_WF_TMAC(_band, ofs) (MT_WF_TMAC_BASE(_band) + (ofs))
132@@ -206,6 +213,9 @@ enum offs_rev {
133 #define MT_TMAC_TCR0_TX_BLINK GENMASK(7, 6)
134 #define MT_TMAC_TCR0_TBTT_STOP_CTRL BIT(25)
135
136+#define MT_TMAC_TCR2(_band) MT_WF_TMAC(_band, __OFFS(TMAC_TCR2))
137+#define MT_TMAC_TCR2_SCH_DET_DIS BIT(19)
138+
139 #define MT_TMAC_CDTR(_band) MT_WF_TMAC(_band, __OFFS(TMAC_CDTR))
140 #define MT_TMAC_ODTR(_band) MT_WF_TMAC(_band, __OFFS(TMAC_ODTR))
141 #define MT_TIMEOUT_VAL_PLCP GENMASK(15, 0)
142@@ -485,8 +495,10 @@ enum offs_rev {
143 #define MT_AGG_PCR0_VHT_PROT BIT(13)
144 #define MT_AGG_PCR0_PTA_WIN_DIS BIT(15)
145
146-#define MT_AGG_PCR1_RTS0_NUM_THRES GENMASK(31, 23)
147-#define MT_AGG_PCR1_RTS0_LEN_THRES GENMASK(19, 0)
148+#define MT_AGG_PCR1_RTS0_NUM_THRES GENMASK(31, 23)
149+#define MT_AGG_PCR1_RTS0_LEN_THRES GENMASK(19, 0)
150+#define MT_AGG_PCR1_RTS0_NUM_THRES_MT7916 GENMASK(29, 24)
151+#define MT_AGG_PCR1_RTS0_LEN_THRES_MT7916 GENMASK(22, 0)
152
153 #define MT_AGG_ACR0(_band) MT_WF_AGG(_band, __OFFS(AGG_ACR0))
154 #define MT_AGG_ACR_CFEND_RATE GENMASK(13, 0)
155diff --git a/mt7915/testmode.c b/mt7915/testmode.c
developer79e690d2022-12-13 17:05:25 +0800156index 0d76ae31..46939191 100644
developer6a1998b2022-12-08 18:09:45 +0800157--- a/mt7915/testmode.c
158+++ b/mt7915/testmode.c
159@@ -30,7 +30,7 @@ struct reg_band {
160 { _list.band[0] = MT_##_reg(0, _idx); \
161 _list.band[1] = MT_##_reg(1, _idx); }
162
163-#define TM_REG_MAX_ID 17
164+#define TM_REG_MAX_ID 20
165 static struct reg_band reg_backup_list[TM_REG_MAX_ID];
166
167
168@@ -133,6 +133,21 @@ mt7915_tm_clean_hwq(struct mt7915_phy *phy, u8 wcid)
169 sizeof(req), false);
170 }
171
172+static int
173+mt7915_tm_set_phy_count(struct mt7915_phy *phy, u8 control)
174+{
175+ struct mt7915_dev *dev = phy->dev;
176+ struct mt7915_tm_cmd req = {
177+ .testmode_en = 1,
178+ .param_idx = MCU_ATE_SET_PHY_COUNT,
179+ .param.cfg.enable = control,
180+ .param.cfg.band = phy != &dev->phy,
181+ };
182+
183+ return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), &req,
184+ sizeof(req), false);
185+}
186+
187 static int
188 mt7915_tm_set_slot_time(struct mt7915_phy *phy, u8 slot_time, u8 sifs)
189 {
developer79e690d2022-12-13 17:05:25 +0800190@@ -336,7 +351,7 @@ mt7915_tm_reg_backup_restore(struct mt7915_phy *phy)
developer6a1998b2022-12-08 18:09:45 +0800191 {
192 int n_regs = ARRAY_SIZE(reg_backup_list);
193 struct mt7915_dev *dev = phy->dev;
194- u32 *b = phy->test.reg_backup;
195+ u32 *b = phy->test.reg_backup, val;
developer79e690d2022-12-13 17:05:25 +0800196 u8 band = phy->mt76->band_idx;
developer6a1998b2022-12-08 18:09:45 +0800197 int i;
198
developer79e690d2022-12-13 17:05:25 +0800199@@ -349,18 +364,28 @@ mt7915_tm_reg_backup_restore(struct mt7915_phy *phy)
developer6a1998b2022-12-08 18:09:45 +0800200 REG_BAND(reg_backup_list[6], AGG_MRCR);
201 REG_BAND(reg_backup_list[7], TMAC_TFCR0);
202 REG_BAND(reg_backup_list[8], TMAC_TCR0);
203- REG_BAND(reg_backup_list[9], AGG_ATCR1);
204- REG_BAND(reg_backup_list[10], AGG_ATCR3);
205- REG_BAND(reg_backup_list[11], TMAC_TRCR0);
206- REG_BAND(reg_backup_list[12], TMAC_ICR0);
207- REG_BAND_IDX(reg_backup_list[13], ARB_DRNGR0, 0);
208- REG_BAND_IDX(reg_backup_list[14], ARB_DRNGR0, 1);
209- REG_BAND(reg_backup_list[15], WF_RFCR);
210- REG_BAND(reg_backup_list[16], WF_RFCR1);
211+ REG_BAND(reg_backup_list[9], TMAC_TCR2);
212+ REG_BAND(reg_backup_list[10], AGG_ATCR1);
213+ REG_BAND(reg_backup_list[11], AGG_ATCR3);
214+ REG_BAND(reg_backup_list[12], TMAC_TRCR0);
215+ REG_BAND(reg_backup_list[13], TMAC_ICR0);
216+ REG_BAND_IDX(reg_backup_list[14], ARB_DRNGR0, 0);
217+ REG_BAND_IDX(reg_backup_list[15], ARB_DRNGR0, 1);
218+ REG_BAND(reg_backup_list[16], WF_RFCR);
219+ REG_BAND(reg_backup_list[17], WF_RFCR1);
220+
221+ if (is_mt7916(&dev->mt76)) {
developer79e690d2022-12-13 17:05:25 +0800222+ reg_backup_list[18].band[band] = MT_MDP_TOP_DBG_WDT_CTRL;
223+ reg_backup_list[19].band[band] = MT_MDP_TOP_DBG_CTRL;
developer6a1998b2022-12-08 18:09:45 +0800224+ }
225
226 if (phy->mt76->test.state == MT76_TM_STATE_OFF) {
227- for (i = 0; i < n_regs; i++)
developer79e690d2022-12-13 17:05:25 +0800228- mt76_wr(dev, reg_backup_list[i].band[band], b[i]);
developer6a1998b2022-12-08 18:09:45 +0800229+ for (i = 0; i < n_regs; i++) {
developer79e690d2022-12-13 17:05:25 +0800230+ u8 reg = reg_backup_list[i].band[band];
developer6a1998b2022-12-08 18:09:45 +0800231+
232+ if (reg)
233+ mt76_wr(dev, reg, b[i]);
234+ }
235 return;
236 }
237
developer79e690d2022-12-13 17:05:25 +0800238@@ -380,8 +405,13 @@ mt7915_tm_reg_backup_restore(struct mt7915_phy *phy)
developer6a1998b2022-12-08 18:09:45 +0800239 MT_AGG_PCR0_BW40_PROT | MT_AGG_PCR0_BW80_PROT);
developer79e690d2022-12-13 17:05:25 +0800240 mt76_set(dev, MT_AGG_PCR0(band, 0), MT_AGG_PCR0_PTA_WIN_DIS);
developer6a1998b2022-12-08 18:09:45 +0800241
developer79e690d2022-12-13 17:05:25 +0800242- mt76_wr(dev, MT_AGG_PCR0(band, 1), MT_AGG_PCR1_RTS0_NUM_THRES |
developer6a1998b2022-12-08 18:09:45 +0800243- MT_AGG_PCR1_RTS0_LEN_THRES);
244+ if (is_mt7915(&dev->mt76))
245+ val = MT_AGG_PCR1_RTS0_NUM_THRES | MT_AGG_PCR1_RTS0_LEN_THRES;
246+ else
247+ val = MT_AGG_PCR1_RTS0_NUM_THRES_MT7916 |
248+ MT_AGG_PCR1_RTS0_LEN_THRES_MT7916;
249+
developer79e690d2022-12-13 17:05:25 +0800250+ mt76_wr(dev, MT_AGG_PCR0(band, 1), val);
developer6a1998b2022-12-08 18:09:45 +0800251
developer79e690d2022-12-13 17:05:25 +0800252 mt76_clear(dev, MT_AGG_MRCR(band), MT_AGG_MRCR_BAR_CNT_LIMIT |
developer6a1998b2022-12-08 18:09:45 +0800253 MT_AGG_MRCR_LAST_RTS_CTS_RN | MT_AGG_MRCR_RTS_FAIL_LIMIT |
developer79e690d2022-12-13 17:05:25 +0800254@@ -394,10 +424,19 @@ mt7915_tm_reg_backup_restore(struct mt7915_phy *phy)
developer6a1998b2022-12-08 18:09:45 +0800255
developer79e690d2022-12-13 17:05:25 +0800256 mt76_wr(dev, MT_TMAC_TFCR0(band), 0);
257 mt76_clear(dev, MT_TMAC_TCR0(band), MT_TMAC_TCR0_TBTT_STOP_CTRL);
258+ mt76_set(dev, MT_TMAC_TCR2(band), MT_TMAC_TCR2_SCH_DET_DIS);
developer6a1998b2022-12-08 18:09:45 +0800259
260 /* config rx filter for testmode rx */
developer79e690d2022-12-13 17:05:25 +0800261 mt76_wr(dev, MT_WF_RFCR(band), 0xcf70a);
262 mt76_wr(dev, MT_WF_RFCR1(band), 0);
developer6a1998b2022-12-08 18:09:45 +0800263+
264+ if (is_mt7916(&dev->mt76)) {
265+ /* enable MDP Tx block mode */
266+ mt76_clear(dev, MT_MDP_TOP_DBG_WDT_CTRL,
267+ MT_MDP_TOP_DBG_WDT_CTRL_TDP_DIS_BLK);
268+ mt76_clear(dev, MT_MDP_TOP_DBG_CTRL,
269+ MT_MDP_TOP_DBG_CTRL_ENQ_MODE);
270+ }
271 }
272
273 static void
developer79e690d2022-12-13 17:05:25 +0800274@@ -417,6 +456,8 @@ mt7915_tm_init(struct mt7915_phy *phy, bool en)
developer6a1998b2022-12-08 18:09:45 +0800275 mt7915_mcu_add_bss_info(phy, phy->monitor_vif, en);
276 mt7915_mcu_add_sta(dev, phy->monitor_vif, NULL, en);
277
278+ phy->mt76->test.flag |= MT_TM_FW_RX_COUNT;
279+
280 if (!en)
281 mt7915_tm_set_tam_arb(phy, en, 0);
282 }
developer79e690d2022-12-13 17:05:25 +0800283@@ -479,18 +520,63 @@ mt7915_tm_set_tx_frames(struct mt7915_phy *phy, bool en)
developer6a1998b2022-12-08 18:09:45 +0800284 mt7915_tm_set_trx(phy, TM_MAC_TX, en);
285 }
286
287+static int
288+mt7915_tm_get_rx_stats(struct mt7915_phy *phy, bool clear)
289+{
290+#define CMD_RX_STAT_BAND 0x3
291+ struct mt76_testmode_data *td = &phy->mt76->test;
292+ struct mt7915_tm_rx_stat_band *rs_band;
293+ struct mt7915_dev *dev = phy->dev;
294+ struct sk_buff *skb;
295+ struct {
296+ u8 format_id;
297+ u8 band;
298+ u8 _rsv[2];
299+ } __packed req = {
300+ .format_id = CMD_RX_STAT_BAND,
developer79e690d2022-12-13 17:05:25 +0800301+ .band = phy->mt76->band_idx,
developer6a1998b2022-12-08 18:09:45 +0800302+ };
303+ int ret;
304+
305+ ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_EXT_CMD(RX_STAT),
306+ &req, sizeof(req), true, &skb);
307+ if (ret)
308+ return ret;
309+
310+ rs_band = (struct mt7915_tm_rx_stat_band *)skb->data;
311+ /* pr_info("mdrdy_cnt = %d\n", le32_to_cpu(rs_band->mdrdy_cnt)); */
312+ /* pr_info("fcs_err = %d\n", le16_to_cpu(rs_band->fcs_err)); */
313+ /* pr_info("len_mismatch = %d\n", le16_to_cpu(rs_band->len_mismatch)); */
314+ /* pr_info("fcs_ok = %d\n", le16_to_cpu(rs_band->fcs_succ)); */
315+
316+ if (!clear) {
317+ enum mt76_rxq_id q = req.band ? MT_RXQ_BAND1 : MT_RXQ_MAIN;
318+
319+ td->rx_stats.packets[q] += le32_to_cpu(rs_band->mdrdy_cnt);
320+ td->rx_stats.fcs_error[q] += le16_to_cpu(rs_band->fcs_err);
321+ td->rx_stats.len_mismatch += le16_to_cpu(rs_band->len_mismatch);
322+ }
323+
324+ dev_kfree_skb(skb);
325+
326+ return 0;
327+}
328+
329 static void
330 mt7915_tm_set_rx_frames(struct mt7915_phy *phy, bool en)
331 {
332 mt7915_tm_set_trx(phy, TM_MAC_RX_RXV, false);
333
334 if (en) {
335- struct mt7915_dev *dev = phy->dev;
336-
337 mt7915_tm_update_channel(phy);
338
339 /* read-clear */
developer79e690d2022-12-13 17:05:25 +0800340- mt76_rr(dev, MT_MIB_SDR3(phy->mt76->band_idx));
developer6a1998b2022-12-08 18:09:45 +0800341+ mt7915_tm_get_rx_stats(phy, true);
342+
343+ /* clear fw count */
344+ mt7915_tm_set_phy_count(phy, 0);
345+ mt7915_tm_set_phy_count(phy, 1);
346+
347 mt7915_tm_set_trx(phy, TM_MAC_RX_RXV, en);
348 }
349 }
developer79e690d2022-12-13 17:05:25 +0800350@@ -721,12 +807,8 @@ static int
developer6a1998b2022-12-08 18:09:45 +0800351 mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg)
352 {
353 struct mt7915_phy *phy = mphy->priv;
354- struct mt7915_dev *dev = phy->dev;
355- enum mt76_rxq_id q;
356 void *rx, *rssi;
357- u16 fcs_err;
358 int i;
359- u32 cnt;
360
361 rx = nla_nest_start(msg, MT76_TM_STATS_ATTR_LAST_RX);
362 if (!rx)
developer79e690d2022-12-13 17:05:25 +0800363@@ -770,15 +852,7 @@ mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg)
developer6a1998b2022-12-08 18:09:45 +0800364
365 nla_nest_end(msg, rx);
366
developer79e690d2022-12-13 17:05:25 +0800367- cnt = mt76_rr(dev, MT_MIB_SDR3(phy->mt76->band_idx));
developer6a1998b2022-12-08 18:09:45 +0800368- fcs_err = is_mt7915(&dev->mt76) ? FIELD_GET(MT_MIB_SDR3_FCS_ERR_MASK, cnt) :
369- FIELD_GET(MT_MIB_SDR3_FCS_ERR_MASK_MT7916, cnt);
370-
developer79e690d2022-12-13 17:05:25 +0800371- q = phy->mt76->band_idx ? MT_RXQ_BAND1 : MT_RXQ_MAIN;
developer6a1998b2022-12-08 18:09:45 +0800372- mphy->test.rx_stats.packets[q] += fcs_err;
373- mphy->test.rx_stats.fcs_error[q] += fcs_err;
374-
375- return 0;
376+ return mt7915_tm_get_rx_stats(phy, false);
377 }
378
379 const struct mt76_testmode_ops mt7915_testmode_ops = {
380diff --git a/mt7915/testmode.h b/mt7915/testmode.h
381index 5573ac30..a1c54c89 100644
382--- a/mt7915/testmode.h
383+++ b/mt7915/testmode.h
384@@ -33,6 +33,12 @@ struct mt7915_tm_clean_txq {
385 u8 rsv;
386 };
387
388+struct mt7915_tm_cfg {
389+ u8 enable;
390+ u8 band;
391+ u8 _rsv[2];
392+};
393+
394 struct mt7915_tm_cmd {
395 u8 testmode_en;
396 u8 param_idx;
397@@ -43,6 +49,7 @@ struct mt7915_tm_cmd {
398 struct mt7915_tm_freq_offset freq;
399 struct mt7915_tm_slot_time slot;
400 struct mt7915_tm_clean_txq clean;
401+ struct mt7915_tm_cfg cfg;
402 u8 test[72];
403 } param;
404 } __packed;
405@@ -102,4 +109,25 @@ enum {
406 TAM_ARB_OP_MODE_FORCE_SU = 5,
407 };
408
409+struct mt7915_tm_rx_stat_band {
410+ u8 category;
411+
412+ /* mac */
413+ __le16 fcs_err;
414+ __le16 len_mismatch;
415+ __le16 fcs_succ;
416+ __le32 mdrdy_cnt;
417+ /* phy */
418+ __le16 fcs_err_cck;
419+ __le16 fcs_err_ofdm;
420+ __le16 pd_cck;
421+ __le16 pd_ofdm;
422+ __le16 sig_err_cck;
423+ __le16 sfd_err_cck;
424+ __le16 sig_err_ofdm;
425+ __le16 tag_err_ofdm;
426+ __le16 mdrdy_cnt_cck;
427+ __le16 mdrdy_cnt_ofdm;
428+};
429+
430 #endif
431diff --git a/testmode.c b/testmode.c
432index 0accc71a..1d0d5d30 100644
433--- a/testmode.c
434+++ b/testmode.c
435@@ -447,8 +447,7 @@ int mt76_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
436 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_LDPC], &td->tx_rate_ldpc, 0, 1) ||
437 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_STBC], &td->tx_rate_stbc, 0, 1) ||
438 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_LTF], &td->tx_ltf, 0, 2) ||
439- mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_ANTENNA],
440- &td->tx_antenna_mask, 0, 0xff) ||
441+ mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_ANTENNA], &td->tx_antenna_mask, 1, 0xff) ||
442 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_SPE_IDX], &td->tx_spe_idx, 0, 27) ||
443 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_DUTY_CYCLE],
444 &td->tx_duty_cycle, 0, 99) ||
445@@ -560,6 +559,9 @@ mt76_testmode_dump_stats(struct mt76_phy *phy, struct sk_buff *msg)
446 nla_put_u64_64bit(msg, MT76_TM_STATS_ATTR_RX_PACKETS, rx_packets,
447 MT76_TM_STATS_ATTR_PAD) ||
448 nla_put_u64_64bit(msg, MT76_TM_STATS_ATTR_RX_FCS_ERROR, rx_fcs_error,
449+ MT76_TM_STATS_ATTR_PAD) ||
450+ nla_put_u64_64bit(msg, MT76_TM_STATS_ATTR_RX_LEN_MISMATCH,
451+ td->rx_stats.len_mismatch,
452 MT76_TM_STATS_ATTR_PAD))
453 return -EMSGSIZE;
454
455diff --git a/testmode.h b/testmode.h
456index 5e2792d8..89613266 100644
457--- a/testmode.h
458+++ b/testmode.h
459@@ -101,6 +101,8 @@ enum mt76_testmode_attr {
460 * @MT76_TM_STATS_ATTR_RX_FCS_ERROR: number of rx packets with FCS error (u64)
461 * @MT76_TM_STATS_ATTR_LAST_RX: information about the last received packet
462 * see &enum mt76_testmode_rx_attr
463+ * @MT76_TM_STATS_ATTR_RX_LEN_MISMATCH: number of rx packets with length
464+ * mismatch error (u64)
465 */
466 enum mt76_testmode_stats_attr {
467 MT76_TM_STATS_ATTR_UNSPEC,
468@@ -113,6 +115,7 @@ enum mt76_testmode_stats_attr {
469 MT76_TM_STATS_ATTR_RX_PACKETS,
470 MT76_TM_STATS_ATTR_RX_FCS_ERROR,
471 MT76_TM_STATS_ATTR_LAST_RX,
472+ MT76_TM_STATS_ATTR_RX_LEN_MISMATCH,
473
474 /* keep last */
475 NUM_MT76_TM_STATS_ATTRS,
476--
developer79e690d2022-12-13 17:05:25 +08004772.25.1
developer6a1998b2022-12-08 18:09:45 +0800478