developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 1 | From c324616943e4a51d5d288a26bdbb330be11d2d8f Mon Sep 17 00:00:00 2001 |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 2 | From: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| 3 | Date: Thu, 24 Aug 2023 03:01:27 +0800 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 1035/1052] wifi: mt76: update debugfs knob for tx tokens |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 5 | |
| 6 | 1. dump token pending time |
| 7 | 2. dump per-band token counts |
| 8 | |
| 9 | Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 10 | --- |
| 11 | mt76.h | 1 + |
| 12 | mt7915/mac.c | 2 ++ |
| 13 | mt7915/mtk_debugfs.c | 24 +++++++++++++++++++----- |
| 14 | 3 files changed, 22 insertions(+), 5 deletions(-) |
| 15 | |
| 16 | diff --git a/mt76.h b/mt76.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 17 | index 580320fd..16b76b48 100644 |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 18 | --- a/mt76.h |
| 19 | +++ b/mt76.h |
| 20 | @@ -403,6 +403,7 @@ struct mt76_txwi_cache { |
| 21 | dma_addr_t dma_addr; |
| 22 | |
| 23 | u8 phy_idx; |
| 24 | + unsigned long jiffies; |
| 25 | |
| 26 | union { |
| 27 | struct sk_buff *skb; |
| 28 | diff --git a/mt7915/mac.c b/mt7915/mac.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 29 | index 35e97f88..a7314465 100644 |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 30 | --- a/mt7915/mac.c |
| 31 | +++ b/mt7915/mac.c |
| 32 | @@ -811,6 +811,8 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, |
| 33 | if (id < 0) |
| 34 | return id; |
| 35 | |
| 36 | + t->jiffies = jiffies; |
| 37 | + |
| 38 | pid = mt76_tx_status_skb_add(mdev, wcid, tx_info->skb); |
| 39 | mt7915_mac_write_txwi(mdev, txwi_ptr, tx_info->skb, wcid, pid, key, |
| 40 | qid, 0); |
| 41 | diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 42 | index d9323603..2cc0b2d8 100644 |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 43 | --- a/mt7915/mtk_debugfs.c |
| 44 | +++ b/mt7915/mtk_debugfs.c |
| 45 | @@ -2203,17 +2203,31 @@ static int mt7915_mibinfo_band1(struct seq_file *s, void *data) |
| 46 | static int mt7915_token_read(struct seq_file *s, void *data) |
| 47 | { |
| 48 | struct mt7915_dev *dev = dev_get_drvdata(s->private); |
| 49 | - int id, count = 0; |
| 50 | + struct mt76_dev *mdev = &dev->mt76; |
| 51 | + int id, i; |
| 52 | struct mt76_txwi_cache *txwi; |
| 53 | |
| 54 | seq_printf(s, "Cut through token:\n"); |
| 55 | spin_lock_bh(&dev->mt76.token_lock); |
| 56 | idr_for_each_entry(&dev->mt76.token, txwi, id) { |
| 57 | - seq_printf(s, "%4d ", id); |
| 58 | - count++; |
| 59 | - if (count % 8 == 0) |
| 60 | - seq_printf(s, "\n"); |
| 61 | + seq_printf(s, "%4d (token pending %u ms)\n", id, |
| 62 | + jiffies_to_msecs(jiffies - txwi->jiffies)); |
| 63 | + } |
| 64 | + |
| 65 | + if (!dev->dbdc_support) |
| 66 | + goto out; |
| 67 | + |
| 68 | + for (i = 0; i < MT_BAND2; i++) { |
| 69 | + struct mt76_phy *mphy = mdev->phys[i]; |
| 70 | + |
| 71 | + if (!mphy) |
| 72 | + continue; |
| 73 | + |
| 74 | + seq_printf(s, "Band%d consume: %d, free:%d total: %d\n", |
| 75 | + i, mphy->tokens, mdev->token_threshold - mphy->tokens, |
| 76 | + mdev->token_threshold); |
| 77 | } |
| 78 | +out: |
| 79 | spin_unlock_bh(&dev->mt76.token_lock); |
| 80 | seq_printf(s, "\n"); |
| 81 | |
| 82 | -- |
| 83 | 2.18.0 |
| 84 | |