blob: 197a473fc54b89d5451b15ac99a8c698442cbeb1 [file] [log] [blame]
developer849549c2023-08-02 17:26:48 +08001From a6806476cc67d25ab77a3b0aef4fbc4870f12cbe 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
developer8f0d89b2023-07-28 07:16:44 +08004Subject: [PATCH 1034/1034] wifi: mt76: mt7915: report tx and rx byte to
5 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
developer849549c2023-08-02 17:26:48 +080014index ee5177fd..ff3cefad 100644
developerf2cf4ce2023-07-13 08:38:02 +080015--- a/mt76_connac_mac.c
16+++ b/mt76_connac_mac.c
17@@ -608,9 +608,15 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
18
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);
33@@ -651,10 +657,6 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
34 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
developer849549c2023-08-02 17:26:48 +080045index 25c3fe2b..57dfda3a 100644
developerf2cf4ce2023-07-13 08:38:02 +080046--- a/mt7915/mmio.c
47+++ b/mt7915/mmio.c
48@@ -666,6 +666,7 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed,
49 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
56@@ -676,6 +677,10 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed,
57
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--
developer849549c2023-08-02 17:26:48 +0800682.39.2
developerf2cf4ce2023-07-13 08:38:02 +080069