| From afaacba412a34baf39e58b27003d4d09516a15c2 Mon Sep 17 00:00:00 2001 |
| From: Peter Chiu <chui-hao.chiu@mediatek.com> |
| Date: Fri, 17 May 2024 15:28:06 +0800 |
| Subject: [PATCH 002/223] mtk: mt76: mt7996: fix amsdu information |
| |
| The amsdu information is common information for all bands so maintain |
| it by main phy instead of calculating by each phy. |
| Without this patch, the statistics of tx_amsdu_cnt and tx_amsdu would |
| be incorrect. |
| |
| Change-Id: Iac324d9dd63ceb3a55b51c0210e3e547e20a71cb |
| Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
| --- |
| mt76.h | 3 ++- |
| mt7996/debugfs.c | 13 ------------- |
| mt7996/mac.c | 15 +++++++++------ |
| 3 files changed, 11 insertions(+), 20 deletions(-) |
| |
| diff --git a/mt76.h b/mt76.h |
| index 19c4f11c..063c45d2 100644 |
| --- a/mt76.h |
| +++ b/mt76.h |
| @@ -931,6 +931,7 @@ struct mt76_dev { |
| }; |
| }; |
| |
| +#define MT76_MAX_AMSDU_NUM 8 |
| /* per-phy stats. */ |
| struct mt76_mib_stats { |
| u32 ack_fail_cnt; |
| @@ -990,7 +991,7 @@ struct mt76_mib_stats { |
| u32 rx_vec_queue_overflow_drop_cnt; |
| u32 rx_ba_cnt; |
| |
| - u32 tx_amsdu[8]; |
| + u32 tx_amsdu[MT76_MAX_AMSDU_NUM]; |
| u32 tx_amsdu_cnt; |
| |
| /* mcu_muru_stats */ |
| diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c |
| index 62c03d08..a17c99a2 100644 |
| --- a/mt7996/debugfs.c |
| +++ b/mt7996/debugfs.c |
| @@ -530,7 +530,6 @@ mt7996_tx_stats_show(struct seq_file *file, void *data) |
| struct mt7996_phy *phy = file->private; |
| struct mt7996_dev *dev = phy->dev; |
| struct mt76_mib_stats *mib = &phy->mib; |
| - int i; |
| u32 attempts, success, per; |
| |
| mutex_lock(&dev->mt76.mutex); |
| @@ -547,18 +546,6 @@ mt7996_tx_stats_show(struct seq_file *file, void *data) |
| |
| mt7996_txbf_stat_read_phy(phy, file); |
| |
| - /* Tx amsdu info */ |
| - seq_puts(file, "Tx MSDU statistics:\n"); |
| - for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) { |
| - seq_printf(file, "AMSDU pack count of %d MSDU in TXD: %8d ", |
| - i + 1, mib->tx_amsdu[i]); |
| - if (mib->tx_amsdu_cnt) |
| - seq_printf(file, "(%3d%%)\n", |
| - mib->tx_amsdu[i] * 100 / mib->tx_amsdu_cnt); |
| - else |
| - seq_puts(file, "\n"); |
| - } |
| - |
| mutex_unlock(&dev->mt76.mutex); |
| |
| return 0; |
| diff --git a/mt7996/mac.c b/mt7996/mac.c |
| index 29297c07..cfcfc3ea 100644 |
| --- a/mt7996/mac.c |
| +++ b/mt7996/mac.c |
| @@ -2114,10 +2114,19 @@ void mt7996_mac_update_stats(struct mt7996_phy *phy) |
| { |
| struct mt76_mib_stats *mib = &phy->mib; |
| struct mt7996_dev *dev = phy->dev; |
| + struct mt76_mib_stats *main_mib = &dev->phy.mib; |
| u8 band_idx = phy->mt76->band_idx; |
| u32 cnt; |
| int i; |
| |
| + /* Update per-dev structures */ |
| + for (i = 0; i < ARRAY_SIZE(main_mib->tx_amsdu); i++) { |
| + cnt = mt76_rr(dev, MT_PLE_AMSDU_PACK_MSDU_CNT(i)); |
| + main_mib->tx_amsdu[i] += cnt; |
| + main_mib->tx_amsdu_cnt += cnt; |
| + } |
| + |
| + /* Update per-phy structures */ |
| cnt = mt76_rr(dev, MT_MIB_RSCR1(band_idx)); |
| mib->fcs_err_cnt += cnt; |
| |
| @@ -2223,12 +2232,6 @@ void mt7996_mac_update_stats(struct mt7996_phy *phy) |
| cnt = mt76_rr(dev, MT_MIB_BSCR17(band_idx)); |
| mib->tx_bf_fb_cpl_cnt += cnt; |
| |
| - for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) { |
| - cnt = mt76_rr(dev, MT_PLE_AMSDU_PACK_MSDU_CNT(i)); |
| - mib->tx_amsdu[i] += cnt; |
| - mib->tx_amsdu_cnt += cnt; |
| - } |
| - |
| /* rts count */ |
| cnt = mt76_rr(dev, MT_MIB_BTSCR5(band_idx)); |
| mib->rts_cnt += cnt; |
| -- |
| 2.45.2 |
| |