developer | 0443cd3 | 2023-09-19 14:11:49 +0800 | [diff] [blame] | 1 | From 1118417f6ad1e37fe5031701522f1287dfd38491 Mon Sep 17 00:00:00 2001 |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 2 | From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com> |
| 3 | Date: Fri, 23 Jun 2023 06:06:21 +0800 |
developer | 0443cd3 | 2023-09-19 14:11:49 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1034/1040] wifi: mt76: mt7915: report tx and rx byte to |
developer | 8f0d89b | 2023-07-28 07:16:44 +0800 | [diff] [blame] | 5 | tpt_led when wed is enabled |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 6 | |
| 7 | Signed-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 | |
| 13 | diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c |
developer | 0443cd3 | 2023-09-19 14:11:49 +0800 | [diff] [blame] | 14 | index e26fcf8..c2f31bf 100644 |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 15 | --- a/mt76_connac_mac.c |
| 16 | +++ b/mt76_connac_mac.c |
developer | 0443cd3 | 2023-09-19 14:11:49 +0800 | [diff] [blame] | 17 | @@ -596,9 +596,15 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid, |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 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); |
developer | 0443cd3 | 2023-09-19 14:11:49 +0800 | [diff] [blame] | 33 | @@ -639,10 +645,6 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid, |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 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) |
| 44 | diff --git a/mt7915/mmio.c b/mt7915/mmio.c |
developer | 0443cd3 | 2023-09-19 14:11:49 +0800 | [diff] [blame] | 45 | index 6dd6eca..b47bfff 100644 |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 46 | --- a/mt7915/mmio.c |
| 47 | +++ b/mt7915/mmio.c |
developer | 0443cd3 | 2023-09-19 14:11:49 +0800 | [diff] [blame] | 48 | @@ -704,6 +704,7 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed, |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 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 | |
developer | 0443cd3 | 2023-09-19 14:11:49 +0800 | [diff] [blame] | 56 | @@ -714,6 +715,10 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed, |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 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 | -- |
developer | 0443cd3 | 2023-09-19 14:11:49 +0800 | [diff] [blame] | 68 | 2.18.0 |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 69 | |