From e9cf08519595e2d8c5c227486948d8cb00db626a Mon Sep 17 00:00:00 2001 From: Evelyn Tsai Date: Thu, 24 Aug 2023 03:01:27 +0800 Subject: [PATCH 1035/1053] wifi: mt76: update debugfs knob for tx tokens 1. dump token pending time 2. dump per-band token counts Signed-off-by: Peter Chiu --- 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 5c26715..6f78c07 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 14367fd..71b4e2d 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 f00ac10..3c248ee 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