blob: e35f69e63b0131025888795660e53fd5dfd68017 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From c7dcf0304c6cd1d73b1caf2ce0b35f7913d2b69e Mon Sep 17 00:00:00 2001
2From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
3Date: Tue, 23 Jul 2024 16:37:57 +0800
4Subject: [PATCH 155/199] mtk: mt76: mt7996: add per-link RX MPDU statistics
5
6Add per-link RX MPDU total/failed counts.
7
8Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
9---
10 mt76.h | 2 ++
11 mt76_connac_mcu.h | 2 ++
12 mt7996/mac.c | 1 +
13 mt7996/mcu.c | 10 ++++++++++
14 mt7996/mcu.h | 7 +++++++
15 5 files changed, 22 insertions(+)
16
17diff --git a/mt76.h b/mt76.h
18index a0fc8b1a..f67f0658 100644
19--- a/mt76.h
20+++ b/mt76.h
21@@ -336,6 +336,8 @@ struct mt76_sta_stats {
22 /* WED RX */
23 u64 rx_bytes;
24 u32 rx_packets;
25+ u32 rx_mpdus;
26+ u32 rx_fcs_err;
27 u32 rx_errors;
28 u32 rx_drops;
29 u64 rx_airtime;
30diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
31index 0244b5aa..8de91f62 100644
32--- a/mt76_connac_mcu.h
33+++ b/mt76_connac_mcu.h
34@@ -1421,6 +1421,8 @@ enum UNI_ALL_STA_INFO_TAG {
35 UNI_ALL_STA_DATA_TX_RETRY_COUNT,
36 UNI_ALL_STA_GI_MODE,
37 UNI_ALL_STA_TXRX_MSDU_COUNT,
38+ UNI_ALL_STA_TXOP_ACCESS_DELAY,
39+ UNI_ALL_STA_RX_MPDU_COUNT,
40 UNI_ALL_STA_MAX_NUM
41 };
42
43diff --git a/mt7996/mac.c b/mt7996/mac.c
44index 484b679b..a0406700 100644
45--- a/mt7996/mac.c
46+++ b/mt7996/mac.c
47@@ -2408,6 +2408,7 @@ void mt7996_mac_work(struct work_struct *work)
48 mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_ADM_STAT);
49 mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_MSDU_COUNT);
50 // }
51+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_RX_MPDU_COUNT);
52
53 if (mt7996_mcu_wa_cmd(phy->dev, MCU_WA_PARAM_CMD(QUERY), MCU_WA_PARAM_BSS_ACQ_PKT_CNT,
54 BSS_ACQ_PKT_CNT_BSS_BITMAP_ALL | BSS_ACQ_PKT_CNT_READ_CLR, 0))
55diff --git a/mt7996/mcu.c b/mt7996/mcu.c
56index 8fd9d450..be6b985f 100644
57--- a/mt7996/mcu.c
58+++ b/mt7996/mcu.c
59@@ -803,6 +803,16 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb)
60 tx_airtime, rx_airtime);
61 }
62 break;
63+ case UNI_ALL_STA_RX_MPDU_COUNT:
64+ wlan_idx = le16_to_cpu(res->rx_mpdu_cnt[i].wlan_idx);
65+ wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]);
66+ if (!wcid)
67+ break;
68+
69+ wcid->stats.rx_mpdus += le32_to_cpu(res->rx_mpdu_cnt[i].total);
70+ wcid->stats.rx_fcs_err += le32_to_cpu(res->rx_mpdu_cnt[i].total) -
71+ le32_to_cpu(res->rx_mpdu_cnt[i].success);
72+ break;
73 default:
74 break;
75 }
76diff --git a/mt7996/mcu.h b/mt7996/mcu.h
77index 389aab63..737f426d 100644
78--- a/mt7996/mcu.h
79+++ b/mt7996/mcu.h
80@@ -268,6 +268,13 @@ struct mt7996_mcu_all_sta_info_event {
81 __le32 tx[IEEE80211_NUM_ACS];
82 __le32 rx[IEEE80211_NUM_ACS];
83 } __packed, airtime);
84+
85+ DECLARE_FLEX_ARRAY(struct {
86+ __le16 wlan_idx;
87+ u8 rsv[2];
88+ __le32 total;
89+ __le32 success;
90+ } __packed, rx_mpdu_cnt);
91 } __packed;
92 } __packed;
93
94--
952.18.0
96