blob: bb0bde110ca375ab814e2db60fdd395b8ee0bdcd [file] [log] [blame]
developerd0c89452024-10-11 16:53:27 +08001From 9e31f71efd5909af8d8916285f0816914fd15bac Mon Sep 17 00:00:00 2001
developer05f3b2b2024-08-19 19:17:34 +08002From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
3Date: Tue, 23 Jul 2024 16:37:57 +0800
developerd0c89452024-10-11 16:53:27 +08004Subject: [PATCH 143/223] mtk: mt76: mt7996: add per-link RX MPDU statistics
developer05f3b2b2024-08-19 19:17:34 +08005
6Add per-link RX MPDU total/failed counts.
7
developerd0c89452024-10-11 16:53:27 +08008Change-Id: Ibe9acae34bf9eff17da651ec8c33b6a9a9f6f785
developer05f3b2b2024-08-19 19:17:34 +08009Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
10---
11 mt76.h | 2 ++
12 mt76_connac_mcu.h | 2 ++
13 mt7996/mac.c | 1 +
14 mt7996/mcu.c | 10 ++++++++++
15 mt7996/mcu.h | 7 +++++++
16 5 files changed, 22 insertions(+)
17
18diff --git a/mt76.h b/mt76.h
developerd0c89452024-10-11 16:53:27 +080019index de6f2be0..ce34cccc 100644
developer05f3b2b2024-08-19 19:17:34 +080020--- a/mt76.h
21+++ b/mt76.h
developerd0c89452024-10-11 16:53:27 +080022@@ -340,6 +340,8 @@ struct mt76_sta_stats {
developer05f3b2b2024-08-19 19:17:34 +080023 /* WED RX */
24 u64 rx_bytes;
25 u32 rx_packets;
26+ u32 rx_mpdus;
27+ u32 rx_fcs_err;
28 u32 rx_errors;
29 u32 rx_drops;
30 u64 rx_airtime;
31diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
developerd0c89452024-10-11 16:53:27 +080032index 1971c7bf..931b29eb 100644
developer05f3b2b2024-08-19 19:17:34 +080033--- a/mt76_connac_mcu.h
34+++ b/mt76_connac_mcu.h
developerd0c89452024-10-11 16:53:27 +080035@@ -1426,6 +1426,8 @@ enum UNI_ALL_STA_INFO_TAG {
developer05f3b2b2024-08-19 19:17:34 +080036 UNI_ALL_STA_DATA_TX_RETRY_COUNT,
37 UNI_ALL_STA_GI_MODE,
38 UNI_ALL_STA_TXRX_MSDU_COUNT,
39+ UNI_ALL_STA_TXOP_ACCESS_DELAY,
40+ UNI_ALL_STA_RX_MPDU_COUNT,
41 UNI_ALL_STA_MAX_NUM
42 };
43
44diff --git a/mt7996/mac.c b/mt7996/mac.c
developerd0c89452024-10-11 16:53:27 +080045index 39336832..966cf314 100644
developer05f3b2b2024-08-19 19:17:34 +080046--- a/mt7996/mac.c
47+++ b/mt7996/mac.c
developerd0c89452024-10-11 16:53:27 +080048@@ -2420,6 +2420,7 @@ void mt7996_mac_work(struct work_struct *work)
developer05f3b2b2024-08-19 19:17:34 +080049 mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_ADM_STAT);
50 mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_TXRX_MSDU_COUNT);
51 // }
52+ mt7996_mcu_get_all_sta_info(mdev, UNI_ALL_STA_RX_MPDU_COUNT);
53
54 if (mt7996_mcu_wa_cmd(phy->dev, MCU_WA_PARAM_CMD(QUERY), MCU_WA_PARAM_BSS_ACQ_PKT_CNT,
55 BSS_ACQ_PKT_CNT_BSS_BITMAP_ALL | BSS_ACQ_PKT_CNT_READ_CLR, 0))
56diff --git a/mt7996/mcu.c b/mt7996/mcu.c
developerd0c89452024-10-11 16:53:27 +080057index ee27b5df..4a99671f 100644
developer05f3b2b2024-08-19 19:17:34 +080058--- a/mt7996/mcu.c
59+++ b/mt7996/mcu.c
developerd0c89452024-10-11 16:53:27 +080060@@ -808,6 +808,16 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb)
developer05f3b2b2024-08-19 19:17:34 +080061 tx_airtime, rx_airtime);
62 }
63 break;
64+ case UNI_ALL_STA_RX_MPDU_COUNT:
65+ wlan_idx = le16_to_cpu(res->rx_mpdu_cnt[i].wlan_idx);
66+ wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]);
67+ if (!wcid)
68+ break;
69+
70+ wcid->stats.rx_mpdus += le32_to_cpu(res->rx_mpdu_cnt[i].total);
71+ wcid->stats.rx_fcs_err += le32_to_cpu(res->rx_mpdu_cnt[i].total) -
72+ le32_to_cpu(res->rx_mpdu_cnt[i].success);
73+ break;
74 default:
75 break;
76 }
77diff --git a/mt7996/mcu.h b/mt7996/mcu.h
78index 389aab63..737f426d 100644
79--- a/mt7996/mcu.h
80+++ b/mt7996/mcu.h
81@@ -268,6 +268,13 @@ struct mt7996_mcu_all_sta_info_event {
82 __le32 tx[IEEE80211_NUM_ACS];
83 __le32 rx[IEEE80211_NUM_ACS];
84 } __packed, airtime);
85+
86+ DECLARE_FLEX_ARRAY(struct {
87+ __le16 wlan_idx;
88+ u8 rsv[2];
89+ __le32 total;
90+ __le32 success;
91+ } __packed, rx_mpdu_cnt);
92 } __packed;
93 } __packed;
94
95--
developerd0c89452024-10-11 16:53:27 +0800962.45.2
developer05f3b2b2024-08-19 19:17:34 +080097