From: Kalle Valo <kvalo@codeaurora.org>
To: Yu Wang <yyuwang@codeaurora.org>
Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2 2/2] ath10k: correct legacy rate in tx stats
Date: Tue, 24 Mar 2020 16:40:21 +0200 [thread overview]
Message-ID: <87h7yd4y0a.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <0101016e82882548-361b3da4-fd9b-4ba9-95b6-a5d782d4a1c8-000000@us-west-2.amazonses.com> (Yu Wang's message of "Tue, 19 Nov 2019 07:19:50 +0000")
Yu Wang <yyuwang@codeaurora.org> writes:
> When working in station mode, after connected to a legacy
> AP, 11g only, for example, the tx bitrate is incorrect in
> output of command 'iw wlan0 link'.
>
> That's because the legacy tx bitrate value reported by
> firmware is not well handled:
> For QCA6174, the value represents rate index, but treated
> as a real rate;
> For QCA9888, the value is real rate, with unit 'Mbps', but
> treated as '100kbps'.
>
> To fix this issue:
> 1. Translate the rate index to real rate for QCA6174;
> 2. Translate the rate from 'Mbps' to 'kbps' for QCA9888.
>
> Tested with:
> QCA6174 PCIe with firmware WLAN.RM.4.4.1.c3-00031.
> QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.
> QCA9888 PCIe with firmware 10.4-3.9.0.2-00040.
>
> Signed-off-by: Yu Wang <yyuwang@codeaurora.org>
[...]
> @@ -3723,6 +3729,74 @@ static void ath10k_htt_rx_sec_ind_handler(struct ath10k *ar,
> spin_unlock_bh(&ar->data_lock);
> }
>
> +static int
> +ath10k_htt_update_ratecode(struct ath10k *ar, struct ath10k_sta *arsta,
> + u8 *ratecode)
> +{
> + u8 hw_rate, preamble;
> + u16 bitrate;
> + int i;
> + const struct ieee80211_rate *bitrates;
> + bool cck;
> + struct ieee80211_chanctx_conf *conf = NULL;
> + enum nl80211_band band;
> + struct ieee80211_supported_band *sband;
> +
> + if (!ratecode)
> + return -EINVAL;
> +
> + /* only for legacy ratecode */
> + preamble = ATH10K_HW_PREAMBLE(*ratecode);
> + if (preamble != WMI_RATE_PREAMBLE_CCK &&
> + preamble != WMI_RATE_PREAMBLE_OFDM)
> + return 0;
> +
> + if (!arsta->arvif || !arsta->arvif->vif)
> + return -EINVAL;
> +
> + WARN_ON(!rcu_read_lock_held());
> + conf = rcu_dereference(arsta->arvif->vif->chanctx_conf);
> + if (!conf)
> + return -EINVAL;
> +
> + band = conf->def.chan->band;
> + sband = &ar->mac.sbands[band];
> + if (!sband->bitrates)
> + return -EINVAL;
> +
> + if (WARN_ON_ONCE(sband->n_bitrates > S8_MAX))
> + return -EINVAL;
> +
> + cck = (preamble == WMI_RATE_PREAMBLE_CCK);
> + hw_rate = ATH10K_HW_LEGACY_RATE(*ratecode);
> + for (i = 0; i < sband->n_bitrates; i++) {
> + bitrates = &sband->bitrates[i];
> + if (ath10k_mac_bitrate_is_cck(bitrates->bitrate) != cck)
> + continue;
> +
> + if (bitrates->hw_value == hw_rate ||
> + (bitrates->flags & IEEE80211_RATE_SHORT_PREAMBLE &&
> + bitrates->hw_value_short == hw_rate)) {
> + bitrate = bitrates->bitrate;
> +
> + /* The bitrate will be recovered in
> + * ath10k_update_per_peer_tx_stats().
> + */
> + if (bitrate == 55)
> + bitrate = 60;
> +
> + bitrate = bitrate / 10;
Here you use magic value 60 but in ath10k_update_per_peer_tx_stats() you
use magic value 50:
> + /* from 1Mbps to 100Kbps */
> + rate = rate * 10;
> + if (rate == 50)
> + rate = 55;
Am I missing something or how is this supposed to work?
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2020-03-24 14:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1574147982-3956-1-git-send-email-yyuwang@codeaurora.org>
2019-11-19 7:19 ` [PATCH v2 1/2] ath10k: add ppdu stats support for QCA6174/QCA9377 Yu Wang
2020-04-07 5:27 ` Kalle Valo
2019-11-19 7:19 ` [PATCH v2 2/2] ath10k: correct legacy rate in tx stats Yu Wang
2020-04-09 14:21 ` Kalle Valo
[not found] ` <20200409142136.5490EC433BA@smtp.codeaurora.org>
2020-04-14 5:32 ` Yu Wang
2020-04-14 8:53 ` Tom Psyborg
[not found] ` <0101016e82882548-361b3da4-fd9b-4ba9-95b6-a5d782d4a1c8-000000@us-west-2.amazonses.com>
2020-03-24 14:35 ` Kalle Valo
2020-03-24 14:40 ` Kalle Valo [this message]
2020-04-09 14:13 ` Kalle Valo
2019-11-19 0:20 [PATCH v2 0/2] ath10k: correct tx bitrate for QCA6174/QCA9377/QCA9888 root
2019-11-19 0:20 ` [PATCH v2 2/2] ath10k: correct legacy rate in tx stats root
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=87h7yd4y0a.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@codeaurora.org \
--cc=ath10k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=yyuwang@codeaurora.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).