qcacld-3.0: Populate proper rates received by FW

Due to unknown legacy reason, the rates received by the driver from the
firmware are currently divided by 500 to convert it into units of
500kbps. This division by 500 is later compensated by a multiplication
with 5 to maintain units of 100kbps before being sent to the upper
layer. This division and then subsequent multiplication results in the
loss of precision (in the case the rate is not divisible by 5).
Consequently, the rate being sent to the upper layer becomes inaccurate.
Also the calculation of the MCS rate flags is affected.

Do not carry out the unnecessary division and multiplication by 5.
Instead just convert the rates into units of 100kbps (which is as
mandated by the kernel) when driver receives the rate from the firmware.

Change-Id: I05e67816651754e3b3e27b13dabc1d55b29251dd
CRs-Fixed: 2378166
This commit is contained in:
Sourav Mohapatra 2019-01-09 09:45:08 +05:30 committed by nshrivas
parent 3d27ab89c2
commit d204a81b4b

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -4459,8 +4459,8 @@ static int wlan_hdd_get_sta_stats(struct wiphy *wiphy,
mac_handle = hdd_ctx->mac_handle;
/* convert to the UI units of 100kbps */
my_tx_rate = adapter->hdd_stats.class_a_stat.tx_rate * 5;
my_rx_rate = adapter->hdd_stats.class_a_stat.rx_rate * 5;
my_tx_rate = adapter->hdd_stats.class_a_stat.tx_rate;
my_rx_rate = adapter->hdd_stats.class_a_stat.rx_rate;
if (!(rate_flags & TX_RATE_LEGACY)) {
tx_nss = adapter->hdd_stats.class_a_stat.tx_nss;
@ -5938,12 +5938,12 @@ int wlan_hdd_get_station_stats(struct hdd_adapter *adapter)
adapter->hdd_stats.class_a_stat.rx_rate = stats->rx_rate;
adapter->hdd_stats.class_a_stat.tx_rx_rate_flags = stats->tx_rate_flags;
adapter->hdd_stats.class_a_stat.tx_mcs_index =
sme_get_mcs_idx(stats->tx_rate * 5, stats->tx_rate_flags,
sme_get_mcs_idx(stats->tx_rate, stats->tx_rate_flags,
&adapter->hdd_stats.class_a_stat.tx_nss,
&mcs_rate_flags);
adapter->hdd_stats.class_a_stat.tx_mcs_rate_flags = mcs_rate_flags;
adapter->hdd_stats.class_a_stat.rx_mcs_index =
sme_get_mcs_idx(stats->rx_rate * 5, stats->tx_rate_flags,
sme_get_mcs_idx(stats->rx_rate, stats->tx_rate_flags,
&adapter->hdd_stats.class_a_stat.rx_nss,
&mcs_rate_flags);
adapter->hdd_stats.class_a_stat.rx_mcs_rate_flags = mcs_rate_flags;