wifi: rtw89: coex: Parsing Wi-Fi firmware error message from reports
authorChing-Te Ku <ku920601@realtek.com>
Tue, 13 Sep 2022 09:25:43 +0000 (17:25 +0800)
committerKalle Valo <kvalo@kernel.org>
Mon, 19 Sep 2022 10:01:37 +0000 (13:01 +0300)
Parsing firmware error message from original version and v1 reports to
show up exception counter of commands from firmware in debug message.
Then, we can make sure exchange commands are correct totally.

In the later version Wi-Fi firmware(v1), the report format was changed.
With this update, we can yield correct report from proper struct.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220913092546.43722-5-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/coex.c

index 6fdc2c33b7c6af86d71a7932b7fe6e2527cc92ba..66adf4eb4455925799d6c563aef1f76f54d3c5e3 100644 (file)
@@ -5963,14 +5963,24 @@ static void _show_dm_info(struct rtw89_dev *rtwdev, struct seq_file *m)
 
 static void _show_error(struct rtw89_dev *rtwdev, struct seq_file *m)
 {
+       const struct rtw89_chip_info *chip = rtwdev->chip;
        struct rtw89_btc *btc = &rtwdev->btc;
        struct rtw89_btc_btf_fwinfo *pfwinfo = &btc->fwinfo;
-       struct rtw89_btc_fbtc_cysta *pcysta = NULL;
+       struct rtw89_btc_fbtc_cysta *pcysta;
+       struct rtw89_btc_fbtc_cysta_v1 *pcysta_v1;
+       u32 except_cnt, exception_map;
 
-       pcysta = &pfwinfo->rpt_fbtc_cysta.finfo;
+       if (chip->chip_id == RTL8852A) {
+               pcysta = &pfwinfo->rpt_fbtc_cysta.finfo;
+               except_cnt = le32_to_cpu(pcysta->except_cnt);
+               exception_map = le32_to_cpu(pcysta->exception);
+       } else {
+               pcysta_v1 = &pfwinfo->rpt_fbtc_cysta.finfo_v1;
+               except_cnt = le32_to_cpu(pcysta_v1->except_cnt);
+               exception_map = le32_to_cpu(pcysta_v1->except_map);
+       }
 
-       if (pfwinfo->event[BTF_EVNT_BUF_OVERFLOW] == 0 &&
-           pcysta->except_cnt == 0 &&
+       if (pfwinfo->event[BTF_EVNT_BUF_OVERFLOW] == 0 && except_cnt == 0 &&
            !pfwinfo->len_mismch && !pfwinfo->fver_mismch)
                return;
 
@@ -5995,10 +6005,10 @@ static void _show_error(struct rtw89_dev *rtwdev, struct seq_file *m)
        }
 
        /* cycle statistics exceptions */
-       if (pcysta->exception || pcysta->except_cnt) {
+       if (exception_map || except_cnt) {
                seq_printf(m,
                           "exception-type: 0x%x, exception-cnt = %d",
-                          pcysta->exception, pcysta->except_cnt);
+                          exception_map, except_cnt);
        }
        seq_puts(m, "\n");
 }