linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: greearb@candelatech.com
To: linux-wireless@vger.kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: [PATCH 03/15] mt76: mt7915:  tx_stats debugfs to read from mib
Date: Wed, 11 Aug 2021 14:44:27 -0700	[thread overview]
Message-ID: <20210811214439.17458-4-greearb@candelatech.com> (raw)
In-Reply-To: <20210811214439.17458-1-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

Read from accumulated mib values instead of directly from
registers since registers are clear-on-read.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 .../wireless/mediatek/mt76/mt7915/debugfs.c   | 20 ++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
index f2ff0d3f52cd..b48fda497ab6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
@@ -444,7 +444,9 @@ static int
 mt7915_tx_stats_show(struct seq_file *file, void *data)
 {
 	struct mt7915_dev *dev = file->private;
-	int stat[8], i, n;
+	int i;
+	long n;
+	struct mib_stats *mib = &dev->phy.mib;
 
 	mt7915_ampdu_stat_read_phy(&dev->phy, file);
 	mt7915_txbf_stat_read_phy(&dev->phy, file);
@@ -454,16 +456,16 @@ mt7915_tx_stats_show(struct seq_file *file, void *data)
 
 	/* Tx amsdu info */
 	seq_puts(file, "Tx MSDU statistics:\n");
-	for (i = 0, n = 0; i < ARRAY_SIZE(stat); i++) {
-		stat[i] = mt76_rr(dev,  MT_PLE_AMSDU_PACK_MSDU_CNT(i));
-		n += stat[i];
-	}
+	for (i = 0, n = 0; i < ARRAY_SIZE(mib->amsdu_pack_stats); i++)
+		n += mib->amsdu_pack_stats[i];
+
+	for (i = 0; i < ARRAY_SIZE(mib->amsdu_pack_stats); i++) {
+		long si = mib->amsdu_pack_stats[i];
 
-	for (i = 0; i < ARRAY_SIZE(stat); i++) {
-		seq_printf(file, "AMSDU pack count of %d MSDU in TXD: 0x%x ",
-			   i + 1, stat[i]);
+		seq_printf(file, "AMSDU pack count of %d MSDU in TXD: %ld ",
+			   i + 1, si);
 		if (n != 0)
-			seq_printf(file, "(%d%%)\n", stat[i] * 100 / n);
+			seq_printf(file, "(%ld%%)\n", si * 100 / n);
 		else
 			seq_puts(file, "\n");
 	}
-- 
2.20.1


  parent reply	other threads:[~2021-08-11 21:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 21:44 [PATCH 00/15] mt7915 stats and debugging improvements greearb
2021-08-11 21:44 ` [PATCH 01/15] mt76: mt7915: add comments about rx descriptor parsing greearb
2021-08-11 21:44 ` [PATCH 02/15] mt76: mt7915: print out hw revision greearb
2021-08-11 21:44 ` greearb [this message]
2021-08-11 21:44 ` [PATCH 04/15] mt76: mt7915: support enabling rx group-5 status greearb
2021-08-11 21:44 ` [PATCH 05/15] mt76: mt7915: use nss for calculating rx-chains greearb
2021-08-11 21:44 ` [PATCH 06/15] mt76: mt7915: rename amsdu_pack_stats to tx_amsdu_pack_stats greearb
2021-08-11 21:44 ` [PATCH 07/15] mt76: mt7915: ethtool group-5 rx stats information greearb
2021-08-11 21:44 ` [PATCH 08/15] mt76: mt7915: ethtool counters for driver rx path greearb
2021-08-11 21:44 ` [PATCH 09/15] mt76: mt7915: fix rate rix and flags in txs path greearb
2021-08-11 21:44 ` [PATCH 10/15] mt76: mt7915: add ethtool tx/rx pkts/bytes greearb
2021-08-11 21:44 ` [PATCH 11/15] mt76: mt7915: debugfs display for pse non-empty queues greearb
2021-08-11 21:44 ` [PATCH 12/15] mt76: mt7915: add more pse queue data to debugfs greearb
2021-08-11 21:44 ` [PATCH 13/15] mt76: mt7915: add rx-ppdu-size-out-of-range ethtool counter greearb
2021-08-11 21:44 ` [PATCH 14/15] mt76: mt7915: ethtool and mib rx stats greearb
2021-08-11 21:44 ` [PATCH 15/15] mt76: mt7915: poll mib counters every 200ms greearb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210811214439.17458-4-greearb@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).