blob: d9873464352073d0b58834138e4e4ca6a90a00c4 [file] [log] [blame]
developer0443cd32023-09-19 14:11:49 +08001From 1118417f6ad1e37fe5031701522f1287dfd38491 Mon Sep 17 00:00:00 2001
developerf2cf4ce2023-07-13 08:38:02 +08002From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
3Date: Fri, 23 Jun 2023 06:06:21 +0800
developer0443cd32023-09-19 14:11:49 +08004Subject: [PATCH 1034/1040] wifi: mt76: mt7915: report tx and rx byte to
developer8f0d89b2023-07-28 07:16:44 +08005 tpt_led when wed is enabled
developerf2cf4ce2023-07-13 08:38:02 +08006
7Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
8---
9 mt76_connac_mac.c | 10 ++++++----
10 mt7915/mmio.c | 5 +++++
11 2 files changed, 11 insertions(+), 4 deletions(-)
12
13diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
developer0443cd32023-09-19 14:11:49 +080014index e26fcf8..c2f31bf 100644
developerf2cf4ce2023-07-13 08:38:02 +080015--- a/mt76_connac_mac.c
16+++ b/mt76_connac_mac.c
developer0443cd32023-09-19 14:11:49 +080017@@ -596,9 +596,15 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
developerf2cf4ce2023-07-13 08:38:02 +080018
19 txs = le32_to_cpu(txs_data[0]);
20
21+ mphy = mt76_dev_phy(dev, wcid->phy_idx);
22+
23 /* PPDU based reporting */
24 if (mtk_wed_device_active(&dev->mmio.wed) &&
25 FIELD_GET(MT_TXS0_TXS_FORMAT, txs) > 1) {
26+ ieee80211_tpt_led_trig_tx(mphy->hw,
27+ le32_get_bits(txs_data[5], MT_TXS5_MPDU_TX_BYTE) -
28+ le32_get_bits(txs_data[7], MT_TXS7_MPDU_RETRY_BYTE));
29+
30 stats->tx_bytes +=
31 le32_get_bits(txs_data[5], MT_TXS5_MPDU_TX_BYTE) -
32 le32_get_bits(txs_data[7], MT_TXS7_MPDU_RETRY_BYTE);
developer0443cd32023-09-19 14:11:49 +080033@@ -639,10 +645,6 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
developerf2cf4ce2023-07-13 08:38:02 +080034 cck = true;
35 fallthrough;
36 case MT_PHY_TYPE_OFDM:
37- mphy = &dev->phy;
38- if (wcid->phy_idx == MT_BAND1 && dev->phys[MT_BAND1])
39- mphy = dev->phys[MT_BAND1];
40-
41 if (mphy->chandef.chan->band == NL80211_BAND_5GHZ)
42 sband = &mphy->sband_5g.sband;
43 else if (mphy->chandef.chan->band == NL80211_BAND_6GHZ)
44diff --git a/mt7915/mmio.c b/mt7915/mmio.c
developer0443cd32023-09-19 14:11:49 +080045index 6dd6eca..b47bfff 100644
developerf2cf4ce2023-07-13 08:38:02 +080046--- a/mt7915/mmio.c
47+++ b/mt7915/mmio.c
developer0443cd32023-09-19 14:11:49 +080048@@ -704,6 +704,7 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed,
developerf2cf4ce2023-07-13 08:38:02 +080049 int idx = le16_to_cpu(stats->wlan_idx);
50 struct mt7915_dev *dev;
51 struct mt76_wcid *wcid;
52+ struct mt76_phy *mphy;
53
54 dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
55
developer0443cd32023-09-19 14:11:49 +080056@@ -714,6 +715,10 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed,
developerf2cf4ce2023-07-13 08:38:02 +080057
58 wcid = rcu_dereference(dev->mt76.wcid[idx]);
59 if (wcid) {
60+ mphy = mt76_dev_phy(&dev->mt76, wcid->phy_idx);
61+ ieee80211_tpt_led_trig_rx(mphy->hw,
62+ le32_to_cpu(stats->rx_byte_cnt));
63+
64 wcid->stats.rx_bytes += le32_to_cpu(stats->rx_byte_cnt);
65 wcid->stats.rx_packets += le32_to_cpu(stats->rx_pkt_cnt);
66 wcid->stats.rx_errors += le32_to_cpu(stats->rx_err_cnt);
67--
developer0443cd32023-09-19 14:11:49 +0800682.18.0
developerf2cf4ce2023-07-13 08:38:02 +080069