blob: 39a7cdf4a6f937383cb7a84c5c551220d23edb27 [file] [log] [blame]
developer43a264f2024-03-26 14:09:54 +08001From 517ac9b79c668a68109f1c3d861a6506dd59b3c7 Mon Sep 17 00:00:00 2001
developer26d6cc52023-07-31 12:27:06 +08002From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
3Date: Fri, 23 Jun 2023 06:06:21 +0800
developer43a264f2024-03-26 14:09:54 +08004Subject: [PATCH 1031/1051] wifi: mt76: mt7915: report tx and rx byte to
developerebda9012024-02-22 13:42:45 +08005 tpt_led when wed is enabled
developer26d6cc52023-07-31 12:27:06 +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
developer43a264f2024-03-26 14:09:54 +080014index 630c6402..949df63f 100644
developer26d6cc52023-07-31 12:27:06 +080015--- a/mt76_connac_mac.c
16+++ b/mt76_connac_mac.c
developerd243af02023-12-21 14:49:33 +080017@@ -597,9 +597,15 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
developer26d6cc52023-07-31 12:27:06 +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);
developerd243af02023-12-21 14:49:33 +080033@@ -640,10 +646,6 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
developer26d6cc52023-07-31 12:27:06 +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
developer43a264f2024-03-26 14:09:54 +080045index ddf1b72a..437a9b0e 100644
developer26d6cc52023-07-31 12:27:06 +080046--- a/mt7915/mmio.c
47+++ b/mt7915/mmio.c
developerebda9012024-02-22 13:42:45 +080048@@ -588,6 +588,7 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed,
developer26d6cc52023-07-31 12:27:06 +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
developerebda9012024-02-22 13:42:45 +080056@@ -598,6 +599,10 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed,
developer26d6cc52023-07-31 12:27:06 +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--
developere35b8e42023-10-16 11:04:00 +0800682.18.0
developer26d6cc52023-07-31 12:27:06 +080069