blob: cd4a4bb1d09c334b08c56d55c7654fb523a3fc56 [file] [log] [blame]
developera20cdc22024-05-31 18:57:31 +08001From cf2a6fb7145d4083bd06558fcad669f91517b6ad Mon Sep 17 00:00:00 2001
developera46f6132024-03-26 14:09:54 +08002From: Evelyn Tsai <evelyn.tsai@mediatek.com>
3Date: Thu, 24 Aug 2023 03:01:27 +0800
developera20cdc22024-05-31 18:57:31 +08004Subject: [PATCH 1035/1051] wifi: mt76: update debugfs knob for tx tokens
developera46f6132024-03-26 14:09:54 +08005
61. dump token pending time
72. dump per-band token counts
8
9Signed-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
16diff --git a/mt76.h b/mt76.h
developera20cdc22024-05-31 18:57:31 +080017index 54f805e..cff22f5 100644
developera46f6132024-03-26 14:09:54 +080018--- 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;
28diff --git a/mt7915/mac.c b/mt7915/mac.c
developera20cdc22024-05-31 18:57:31 +080029index 35e97f8..a731446 100644
developera46f6132024-03-26 14:09:54 +080030--- 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);
41diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
developera20cdc22024-05-31 18:57:31 +080042index ad7abda..5ce2b93 100644
developera46f6132024-03-26 14:09:54 +080043--- 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--
832.18.0
84