developer | 67bb121 | 2024-02-04 16:58:38 +0800 | [diff] [blame^] | 1 | From 4aa0ffd5f06256ed4b2c128d7e975e7ede6702af Mon Sep 17 00:00:00 2001 |
developer | 5f4e6c3 | 2023-12-20 06:12:53 +0800 | [diff] [blame] | 2 | From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 3 | Date: Tue, 28 Nov 2023 16:01:33 +0800 |
developer | 07b5baf | 2024-01-10 04:38:47 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1001/1044] mtk: wifi: mt76: mt7996: support record muru algo |
developer | 5f4e6c3 | 2023-12-20 06:12:53 +0800 | [diff] [blame] | 5 | log when record fw log |
| 6 | |
| 7 | Support record muru algorithm debug log in firmware when we use |
| 8 | chihuahua tool to record fw log. This can help us to check some key |
| 9 | point of muru algorithm result, like bsrp status, airtime busy status, |
| 10 | ru candidate... |
| 11 | Corresponding to Logan driver, it is the same as execute the iwpriv |
| 12 | command: iwpriv rax0 set muruDbgInfo=[category]-1 |
| 13 | |
| 14 | Disable muru debug log when we stop record fwlog. Without this commit, |
| 15 | if we run $ echo 2 > fw_debug_wm after recording fwlog, it will print |
| 16 | out too many fw debug log. |
| 17 | |
| 18 | Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 19 | --- |
| 20 | mt7996/debugfs.c | 35 +++++++++++++++++++++++++++++++++++ |
| 21 | mt7996/mt7996.h | 1 + |
| 22 | mt7996/mtk_mcu.c | 21 +++++++++++++++++++++ |
| 23 | mt7996/mtk_mcu.h | 3 +++ |
| 24 | 4 files changed, 60 insertions(+) |
| 25 | |
| 26 | diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c |
| 27 | index c4b82cb2..f4ce3b55 100644 |
| 28 | --- a/mt7996/debugfs.c |
| 29 | +++ b/mt7996/debugfs.c |
| 30 | @@ -423,6 +423,36 @@ remove_buf_file_cb(struct dentry *f) |
| 31 | return 0; |
| 32 | } |
| 33 | |
| 34 | +static int |
| 35 | +mt7996_fw_debug_muru_set(void *data) |
| 36 | +{ |
| 37 | + struct mt7996_dev *dev = data; |
| 38 | + enum { |
| 39 | + DEBUG_BSRP_STATUS = 256, |
| 40 | + DEBUG_TX_DATA_BYTE_CONUT, |
| 41 | + DEBUG_RX_DATA_BYTE_CONUT, |
| 42 | + DEBUG_RX_TOTAL_BYTE_CONUT, |
| 43 | + DEBUG_INVALID_TID_BSR, |
| 44 | + DEBUG_UL_LONG_TERM_PPDU_TYPE, |
| 45 | + DEBUG_DL_LONG_TERM_PPDU_TYPE, |
| 46 | + DEBUG_PPDU_CLASS_TRIG_ONOFF, |
| 47 | + DEBUG_AIRTIME_BUSY_STATUS, |
| 48 | + DEBUG_UL_OFDMA_MIMO_STATUS, |
| 49 | + DEBUG_RU_CANDIDATE, |
| 50 | + DEBUG_MEC_UPDATE_AMSDU, |
| 51 | + } debug; |
| 52 | + int ret; |
| 53 | + |
| 54 | + for (debug = DEBUG_BSRP_STATUS; debug <= DEBUG_MEC_UPDATE_AMSDU; debug++) { |
| 55 | + ret = mt7996_mcu_muru_dbg_info(dev, debug, |
| 56 | + dev->fw_debug_bin & BIT(0)); |
| 57 | + if (ret) |
| 58 | + return ret; |
| 59 | + } |
| 60 | + |
| 61 | + return 0; |
| 62 | +} |
| 63 | + |
| 64 | static int |
| 65 | mt7996_fw_debug_bin_set(void *data, u64 val) |
| 66 | { |
| 67 | @@ -431,6 +461,7 @@ mt7996_fw_debug_bin_set(void *data, u64 val) |
| 68 | .remove_buf_file = remove_buf_file_cb, |
| 69 | }; |
| 70 | struct mt7996_dev *dev = data; |
| 71 | + int ret; |
| 72 | |
| 73 | if (!dev->relay_fwlog) { |
| 74 | dev->relay_fwlog = relay_open("fwlog_data", dev->debugfs_dir, |
| 75 | @@ -443,6 +474,10 @@ mt7996_fw_debug_bin_set(void *data, u64 val) |
| 76 | |
| 77 | relay_reset(dev->relay_fwlog); |
| 78 | |
| 79 | + ret = mt7996_fw_debug_muru_set(dev); |
| 80 | + if (ret) |
| 81 | + return ret; |
| 82 | + |
| 83 | return mt7996_fw_debug_wm_set(dev, dev->fw_debug_wm); |
| 84 | } |
| 85 | |
| 86 | diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
| 87 | index 34159f97..29976860 100644 |
| 88 | --- a/mt7996/mt7996.h |
| 89 | +++ b/mt7996/mt7996.h |
| 90 | @@ -677,6 +677,7 @@ u32 mt7996_wed_init_buf(void *ptr, dma_addr_t phys, int token_id); |
| 91 | |
| 92 | #ifdef CONFIG_MTK_DEBUG |
| 93 | int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir); |
| 94 | +int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val); |
| 95 | #endif |
| 96 | |
| 97 | #ifdef CONFIG_NET_MEDIATEK_SOC_WED |
| 98 | diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c |
| 99 | index e8870166..c16b25ab 100644 |
| 100 | --- a/mt7996/mtk_mcu.c |
| 101 | +++ b/mt7996/mtk_mcu.c |
| 102 | @@ -15,4 +15,25 @@ |
| 103 | |
| 104 | |
| 105 | |
| 106 | +int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val) |
| 107 | +{ |
| 108 | + struct { |
| 109 | + u8 __rsv1[4]; |
| 110 | + |
| 111 | + __le16 tag; |
| 112 | + __le16 len; |
| 113 | + |
| 114 | + __le16 item; |
| 115 | + u8 __rsv2[2]; |
| 116 | + __le32 value; |
| 117 | + } __packed req = { |
| 118 | + .tag = cpu_to_le16(UNI_CMD_MURU_DBG_INFO), |
| 119 | + .len = cpu_to_le16(sizeof(req) - 4), |
| 120 | + .item = cpu_to_le16(item), |
| 121 | + .value = cpu_to_le32(val), |
| 122 | + }; |
| 123 | + |
| 124 | + return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &req, |
| 125 | + sizeof(req), true); |
| 126 | +} |
| 127 | #endif |
| 128 | diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h |
| 129 | index e741aa27..7f4d4e02 100644 |
| 130 | --- a/mt7996/mtk_mcu.h |
| 131 | +++ b/mt7996/mtk_mcu.h |
| 132 | @@ -10,6 +10,9 @@ |
| 133 | |
| 134 | #ifdef CONFIG_MTK_DEBUG |
| 135 | |
| 136 | +enum { |
| 137 | + UNI_CMD_MURU_DBG_INFO = 0x18, |
| 138 | +}; |
| 139 | |
| 140 | #endif |
| 141 | |
| 142 | -- |
| 143 | 2.18.0 |
| 144 | |