developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 1 | From 47058b5552a9597c2dad3e45b3d0396a5b69dfd7 Mon Sep 17 00:00:00 2001 |
| 2 | From: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 3 | Date: Tue, 29 Aug 2023 09:22:18 +0800 |
| 4 | Subject: [PATCH] wifi: mt76: update debugfs knob to dump token pending time |
| 5 | |
| 6 | Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 7 | --- |
| 8 | mt76.h | 2 ++ |
| 9 | mt7915/mac.c | 6 ++++++ |
| 10 | mt7915/mtk_debugfs.c | 6 ++---- |
| 11 | 3 files changed, 10 insertions(+), 4 deletions(-) |
| 12 | |
| 13 | diff --git a/mt76.h b/mt76.h |
| 14 | index aece4eca..9237b22e 100644 |
| 15 | --- a/mt76.h |
| 16 | +++ b/mt76.h |
| 17 | @@ -365,6 +365,8 @@ struct mt76_txwi_cache { |
| 18 | struct list_head list; |
| 19 | dma_addr_t dma_addr; |
| 20 | |
| 21 | + unsigned long jiffies; |
| 22 | + |
| 23 | union { |
| 24 | struct sk_buff *skb; |
| 25 | void *ptr; |
| 26 | diff --git a/mt7915/mac.c b/mt7915/mac.c |
| 27 | index 21e8383a..67b42006 100644 |
| 28 | --- a/mt7915/mac.c |
| 29 | +++ b/mt7915/mac.c |
| 30 | @@ -802,6 +802,8 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, |
| 31 | if (id < 0) |
| 32 | return id; |
| 33 | |
| 34 | + t->jiffies = jiffies; |
| 35 | + |
| 36 | pid = mt76_tx_status_skb_add(mdev, wcid, tx_info->skb); |
| 37 | mt7915_mac_write_txwi(mdev, txwi_ptr, tx_info->skb, wcid, pid, key, |
| 38 | qid, 0); |
| 39 | @@ -1000,6 +1002,8 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) |
| 40 | if (!txwi) |
| 41 | continue; |
| 42 | |
| 43 | + txwi->jiffies = 0; |
| 44 | + |
| 45 | mt76_connac2_txwi_free(mdev, txwi, sta, &free_list); |
| 46 | } |
| 47 | } |
| 48 | @@ -1032,6 +1036,8 @@ mt7915_mac_tx_free_v0(struct mt7915_dev *dev, void *data, int len) |
| 49 | if (!txwi) |
| 50 | continue; |
| 51 | |
| 52 | + txwi->jiffies = 0; |
| 53 | + |
| 54 | mt76_connac2_txwi_free(mdev, txwi, NULL, &free_list); |
| 55 | } |
| 56 | |
| 57 | diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c |
| 58 | index 80b7bc1a..46f1b0b6 100644 |
| 59 | --- a/mt7915/mtk_debugfs.c |
| 60 | +++ b/mt7915/mtk_debugfs.c |
| 61 | @@ -2211,10 +2211,8 @@ static int mt7915_token_read(struct seq_file *s, void *data) |
| 62 | seq_printf(s, "Cut through token:\n"); |
| 63 | spin_lock_bh(&dev->mt76.token_lock); |
| 64 | idr_for_each_entry(&dev->mt76.token, txwi, id) { |
| 65 | - seq_printf(s, "%4d ", id); |
| 66 | - count++; |
| 67 | - if (count % 8 == 0) |
| 68 | - seq_printf(s, "\n"); |
| 69 | + seq_printf(s, "%4d (token pending %u ms)\n", id, |
| 70 | + jiffies_to_msecs(jiffies - txwi->jiffies)); |
| 71 | } |
| 72 | spin_unlock_bh(&dev->mt76.token_lock); |
| 73 | seq_printf(s, "\n"); |
| 74 | -- |
| 75 | 2.18.0 |
| 76 | |