blob: 8f37b00efd8e6f199d931a4e91a63930886c0ad4 [file] [log] [blame]
From cd98785cf20f1cd99ae5bcb84915171fd8323f64 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Thu, 24 Aug 2023 03:01:27 +0800
Subject: [PATCH 1035/1051] wifi: mt76: update debugfs knob for tx tokens
1. dump token pending time
2. dump per-band token counts
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
mt76.h | 1 +
mt7915/mac.c | 2 ++
mt7915/mtk_debugfs.c | 24 +++++++++++++++++++-----
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/mt76.h b/mt76.h
index 5c267154..6f78c07c 100644
--- a/mt76.h
+++ b/mt76.h
@@ -403,6 +403,7 @@ struct mt76_txwi_cache {
dma_addr_t dma_addr;
u8 phy_idx;
+ unsigned long jiffies;
union {
struct sk_buff *skb;
diff --git a/mt7915/mac.c b/mt7915/mac.c
index 14367fd7..71b4e2d7 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -811,6 +811,8 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
if (id < 0)
return id;
+ t->jiffies = jiffies;
+
pid = mt76_tx_status_skb_add(mdev, wcid, tx_info->skb);
mt7915_mac_write_txwi(mdev, txwi_ptr, tx_info->skb, wcid, pid, key,
qid, 0);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
index 2953eb58..e7be3d6c 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2203,17 +2203,31 @@ static int mt7915_mibinfo_band1(struct seq_file *s, void *data)
static int mt7915_token_read(struct seq_file *s, void *data)
{
struct mt7915_dev *dev = dev_get_drvdata(s->private);
- int id, count = 0;
+ struct mt76_dev *mdev = &dev->mt76;
+ int id, i;
struct mt76_txwi_cache *txwi;
seq_printf(s, "Cut through token:\n");
spin_lock_bh(&dev->mt76.token_lock);
idr_for_each_entry(&dev->mt76.token, txwi, id) {
- seq_printf(s, "%4d ", id);
- count++;
- if (count % 8 == 0)
- seq_printf(s, "\n");
+ seq_printf(s, "%4d (token pending %u ms)\n", id,
+ jiffies_to_msecs(jiffies - txwi->jiffies));
+ }
+
+ if (!dev->dbdc_support)
+ goto out;
+
+ for (i = 0; i < MT_BAND2; i++) {
+ struct mt76_phy *mphy = mdev->phys[i];
+
+ if (!mphy)
+ continue;
+
+ seq_printf(s, "Band%d consume: %d, free:%d total: %d\n",
+ i, mphy->tokens, mdev->token_threshold - mphy->tokens,
+ mdev->token_threshold);
}
+out:
spin_unlock_bh(&dev->mt76.token_lock);
seq_printf(s, "\n");
--
2.18.0