developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 1 | From 36d2f10c4ccbcab5c4de2c52961a13c70bcd0ad1 Mon Sep 17 00:00:00 2001 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 2 | From: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 3 | Date: Fri, 17 May 2024 15:28:06 +0800 |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 002/193] mtk: mt76: mt7996: fix amsdu information |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 5 | |
| 6 | The amsdu information is common information for all bands so maintain |
| 7 | it by main phy instead of calculating by each phy. |
| 8 | Without this patch, the statistics of tx_amsdu_cnt and tx_amsdu would |
| 9 | be incorrect. |
| 10 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 11 | Change-Id: Iac324d9dd63ceb3a55b51c0210e3e547e20a71cb |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 12 | Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 13 | --- |
| 14 | mt76.h | 3 ++- |
| 15 | mt7996/debugfs.c | 13 ------------- |
| 16 | mt7996/mac.c | 15 +++++++++------ |
| 17 | 3 files changed, 11 insertions(+), 20 deletions(-) |
| 18 | |
| 19 | diff --git a/mt76.h b/mt76.h |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 20 | index 19c4f11..063c45d 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 21 | --- a/mt76.h |
| 22 | +++ b/mt76.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 23 | @@ -931,6 +931,7 @@ struct mt76_dev { |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 24 | }; |
| 25 | }; |
| 26 | |
| 27 | +#define MT76_MAX_AMSDU_NUM 8 |
| 28 | /* per-phy stats. */ |
| 29 | struct mt76_mib_stats { |
| 30 | u32 ack_fail_cnt; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 31 | @@ -990,7 +991,7 @@ struct mt76_mib_stats { |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 32 | u32 rx_vec_queue_overflow_drop_cnt; |
| 33 | u32 rx_ba_cnt; |
| 34 | |
| 35 | - u32 tx_amsdu[8]; |
| 36 | + u32 tx_amsdu[MT76_MAX_AMSDU_NUM]; |
| 37 | u32 tx_amsdu_cnt; |
| 38 | |
| 39 | /* mcu_muru_stats */ |
| 40 | diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 41 | index 62c03d0..a17c99a 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 42 | --- a/mt7996/debugfs.c |
| 43 | +++ b/mt7996/debugfs.c |
| 44 | @@ -530,7 +530,6 @@ mt7996_tx_stats_show(struct seq_file *file, void *data) |
| 45 | struct mt7996_phy *phy = file->private; |
| 46 | struct mt7996_dev *dev = phy->dev; |
| 47 | struct mt76_mib_stats *mib = &phy->mib; |
| 48 | - int i; |
| 49 | u32 attempts, success, per; |
| 50 | |
| 51 | mutex_lock(&dev->mt76.mutex); |
| 52 | @@ -547,18 +546,6 @@ mt7996_tx_stats_show(struct seq_file *file, void *data) |
| 53 | |
| 54 | mt7996_txbf_stat_read_phy(phy, file); |
| 55 | |
| 56 | - /* Tx amsdu info */ |
| 57 | - seq_puts(file, "Tx MSDU statistics:\n"); |
| 58 | - for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) { |
| 59 | - seq_printf(file, "AMSDU pack count of %d MSDU in TXD: %8d ", |
| 60 | - i + 1, mib->tx_amsdu[i]); |
| 61 | - if (mib->tx_amsdu_cnt) |
| 62 | - seq_printf(file, "(%3d%%)\n", |
| 63 | - mib->tx_amsdu[i] * 100 / mib->tx_amsdu_cnt); |
| 64 | - else |
| 65 | - seq_puts(file, "\n"); |
| 66 | - } |
| 67 | - |
| 68 | mutex_unlock(&dev->mt76.mutex); |
| 69 | |
| 70 | return 0; |
| 71 | diff --git a/mt7996/mac.c b/mt7996/mac.c |
developer | 1f55fcf | 2024-10-17 14:52:33 +0800 | [diff] [blame^] | 72 | index 29297c0..cfcfc3e 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 73 | --- a/mt7996/mac.c |
| 74 | +++ b/mt7996/mac.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 75 | @@ -2114,10 +2114,19 @@ void mt7996_mac_update_stats(struct mt7996_phy *phy) |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 76 | { |
| 77 | struct mt76_mib_stats *mib = &phy->mib; |
| 78 | struct mt7996_dev *dev = phy->dev; |
| 79 | + struct mt76_mib_stats *main_mib = &dev->phy.mib; |
| 80 | u8 band_idx = phy->mt76->band_idx; |
| 81 | u32 cnt; |
| 82 | int i; |
| 83 | |
| 84 | + /* Update per-dev structures */ |
| 85 | + for (i = 0; i < ARRAY_SIZE(main_mib->tx_amsdu); i++) { |
| 86 | + cnt = mt76_rr(dev, MT_PLE_AMSDU_PACK_MSDU_CNT(i)); |
| 87 | + main_mib->tx_amsdu[i] += cnt; |
| 88 | + main_mib->tx_amsdu_cnt += cnt; |
| 89 | + } |
| 90 | + |
| 91 | + /* Update per-phy structures */ |
| 92 | cnt = mt76_rr(dev, MT_MIB_RSCR1(band_idx)); |
| 93 | mib->fcs_err_cnt += cnt; |
| 94 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 95 | @@ -2223,12 +2232,6 @@ void mt7996_mac_update_stats(struct mt7996_phy *phy) |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 96 | cnt = mt76_rr(dev, MT_MIB_BSCR17(band_idx)); |
| 97 | mib->tx_bf_fb_cpl_cnt += cnt; |
| 98 | |
| 99 | - for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) { |
| 100 | - cnt = mt76_rr(dev, MT_PLE_AMSDU_PACK_MSDU_CNT(i)); |
| 101 | - mib->tx_amsdu[i] += cnt; |
| 102 | - mib->tx_amsdu_cnt += cnt; |
| 103 | - } |
| 104 | - |
| 105 | /* rts count */ |
| 106 | cnt = mt76_rr(dev, MT_MIB_BTSCR5(band_idx)); |
| 107 | mib->rts_cnt += cnt; |
| 108 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 109 | 2.45.2 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 110 | |