blob: 0afd075e402b7049d60ebde8742aef90c5b237b4 [file] [log] [blame]
From aff4c26706fa1403abca8067cd0073db88c9f6cf 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 011/199] 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.
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 5c9d6c64..45039377 100644
--- a/mt76.h
+++ b/mt76.h
@@ -916,6 +916,7 @@ struct mt76_dev {
};
};
+#define MT76_MAX_AMSDU_NUM 8
/* per-phy stats. */
struct mt76_mib_stats {
u32 ack_fail_cnt;
@@ -975,7 +976,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 109a74a9..503e92c0 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -2103,10 +2103,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;
@@ -2212,12 +2221,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.18.0