developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 1 | From 9e31f71efd5909af8d8916285f0816914fd15bac Mon Sep 17 00:00:00 2001 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 2 | From: Benjamin Lin <benjamin-jw.lin@mediatek.com> |
| 3 | Date: Tue, 23 Jul 2024 16:37:57 +0800 |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 4 | Subject: [PATCH 143/223] mtk: mt76: mt7996: add per-link RX MPDU statistics |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 5 | |
| 6 | Add per-link RX MPDU total/failed counts. |
| 7 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 8 | Change-Id: Ibe9acae34bf9eff17da651ec8c33b6a9a9f6f785 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 9 | Signed-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 | |
| 18 | diff --git a/mt76.h b/mt76.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 19 | index de6f2be0..ce34cccc 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 20 | --- a/mt76.h |
| 21 | +++ b/mt76.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 22 | @@ -340,6 +340,8 @@ struct mt76_sta_stats { |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 23 | /* 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; |
| 31 | diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 32 | index 1971c7bf..931b29eb 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 33 | --- a/mt76_connac_mcu.h |
| 34 | +++ b/mt76_connac_mcu.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 35 | @@ -1426,6 +1426,8 @@ enum UNI_ALL_STA_INFO_TAG { |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 36 | 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 | |
| 44 | diff --git a/mt7996/mac.c b/mt7996/mac.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 45 | index 39336832..966cf314 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 46 | --- a/mt7996/mac.c |
| 47 | +++ b/mt7996/mac.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 48 | @@ -2420,6 +2420,7 @@ void mt7996_mac_work(struct work_struct *work) |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 49 | 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)) |
| 56 | diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 57 | index ee27b5df..4a99671f 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 58 | --- a/mt7996/mcu.c |
| 59 | +++ b/mt7996/mcu.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 60 | @@ -808,6 +808,16 @@ mt7996_mcu_rx_all_sta_info_event(struct mt7996_dev *dev, struct sk_buff *skb) |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 61 | 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 | } |
| 77 | diff --git a/mt7996/mcu.h b/mt7996/mcu.h |
| 78 | index 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 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 96 | 2.45.2 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 97 | |