From 195164b7bb267af7a9f845b1be7e6f82d56ebd2f Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Wed, 9 Jan 2019 09:56:46 +0530 Subject: [PATCH] qcacmn: 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: Iab7b825f4067ad51174a0c545cf4a7d0ab426171 CRs-Fixed: 2378167 --- umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c index 21c2f45533b5..8ab809a404e2 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-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 @@ -571,10 +571,10 @@ tgt_mc_cp_stats_prepare_n_send_raw_station_stats(struct wlan_objmgr_psoc *psoc, peer_mc_stats = peer_cp_stats_priv->peer_stats; /* * The linkspeed returned by fw is in kbps so convert - * it in units of 500kbps which is expected by UMAC + * it in units of 100kbps which is expected by UMAC */ - info.tx_rate = peer_mc_stats->tx_rate / 500; - info.rx_rate = peer_mc_stats->rx_rate / 500; + info.tx_rate = peer_mc_stats->tx_rate / 100; + info.rx_rate = peer_mc_stats->rx_rate / 100; wlan_cp_stats_peer_obj_unlock(peer_cp_stats_priv); end: