linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Surabhi Vishnoi <svishnoi@codeaurora.org>
To: ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org,
	Surabhi Vishnoi <svishnoi@codeaurora.org>
Subject: [PATCH 4/4] ath10k: Fix the wrong calculation ht_idx and idx of rate table for tx_stats
Date: Fri, 22 Feb 2019 12:50:34 +0530	[thread overview]
Message-ID: <1550820034-18603-5-git-send-email-svishnoi@codeaurora.org> (raw)
In-Reply-To: <1550820034-18603-1-git-send-email-svishnoi@codeaurora.org>

ht_idx (ht rate index) and idx (rate table index) are calculated based on
mcs index. This mcs index used in the above calculation should be 0-9 for
getting the correct ht_idx and idx.

Currently the mcs index used for the above calculations is mcs index which
can be 0-31 (in case of HT), leading to incorrect rate index and ht index
values.

Fix the issue by obtaining mcs value from the ratecode reported by firmware
and use it for calculating ht_idx and idx (rate-table index).

Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1

Fixes: e88975ca37d1 ("ath10k: dump tx stats in rate table format")
Signed-off-by: Surabhi Vishnoi <svishnoi@codeaurora.org>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 5b1dd58..b504c4f 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2931,11 +2931,11 @@ static inline s8 ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate)
 
 	tx_stats = arsta->tx_stats;
 	gi = test_bit(ATH10K_RATE_INFO_FLAGS_SGI_BIT, &flags);
-	ht_idx = txrate->mcs + txrate->nss * 8;
-	mcs = txrate->mcs;
+	mcs = ATH10K_HW_MCS_RATE(pstats->ratecode);
 	bw = txrate->bw;
 	nss = txrate->nss;
-	idx = mcs * 8 + 8 * 10 * nss;
+	ht_idx = mcs + (nss - 1) * 8;
+	idx = mcs * 8 + 8 * 10 * (nss - 1);
 	idx += bw * 2 + gi;
 
 #define STATS_OP_FMT(name) tx_stats->stats[ATH10K_STATS_TYPE_##name]
-- 
1.9.1


      parent reply	other threads:[~2019-02-22  7:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22  7:20 [PATCH 0/4] Fix inconsistencies observed in population of tx_stats in debugfs Surabhi Vishnoi
2019-02-22  7:20 ` [PATCH 1/4] ath10k: Fix the incorrect updation of NSS data in tx stats Surabhi Vishnoi
2019-02-22  7:20 ` [PATCH 2/4] ath10k: Fix the wrong updation of BW in tx_stats debugfs entry Surabhi Vishnoi
2019-02-22  7:20 ` [PATCH 3/4] ath10k: Fix the wrong updation of SGI in tx_stats debugfs Surabhi Vishnoi
2019-02-24 21:13   ` kbuild test robot
2019-02-24 21:35   ` kbuild test robot
2019-02-22  7:20 ` Surabhi Vishnoi [this message]

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=1550820034-18603-5-git-send-email-svishnoi@codeaurora.org \
    --to=svishnoi@codeaurora.org \
    --cc=ath10k@lists.infradead.org \
    --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).