From 1600c7ace64e5bafebc028292174c9a2e2ed643c Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Mon, 4 Nov 2019 09:06:53 +0530 Subject: [PATCH] qcacld-3.0: Use dynamic NSS while reporting stats Presently in the driver, the NSS used for reporting stats to the upper layer is fetched from the VDEV generic NSS. This NSS is not updated dynamically with the set NSS command. As a result, in the case the command is given, the NSS reported to the userspace is not proper. To mitigate this, instead of fetching the generic NSS, fetch the dynamic NSS from the mlme. Change-Id: I9fdbc0625ebe8343a7bf750829db028f4ddd86d0 CRs-Fixed: 2551187 --- core/hdd/src/wlan_hdd_stats.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 844be6aa247e..b19bf2357bff 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -5663,6 +5663,8 @@ int wlan_hdd_get_station_stats(struct hdd_adapter *adapter) { int ret = 0; struct stats_event *stats; + struct wlan_mlme_nss_chains *dynamic_cfg; + uint32_t tx_nss, rx_nss; stats = wlan_cfg80211_mc_cp_stats_get_station_stats(adapter->vdev, &ret); @@ -5709,11 +5711,29 @@ int wlan_hdd_get_station_stats(struct hdd_adapter *adapter) adapter->hdd_stats.peer_stats.fcs_count = stats->peer_adv_stats->fcs_count; + dynamic_cfg = mlme_get_dynamic_vdev_config(adapter->vdev); + if (!dynamic_cfg) { + hdd_err("nss chain dynamic config NULL"); + return -EINVAL; + } + + switch (hdd_conn_get_connected_band(&adapter->session.station)) { + case BAND_2G: + tx_nss = dynamic_cfg->tx_nss[NSS_CHAINS_BAND_2GHZ]; + rx_nss = dynamic_cfg->rx_nss[NSS_CHAINS_BAND_2GHZ]; + break; + case BAND_5G: + tx_nss = dynamic_cfg->tx_nss[NSS_CHAINS_BAND_5GHZ]; + rx_nss = dynamic_cfg->rx_nss[NSS_CHAINS_BAND_5GHZ]; + break; + default: + tx_nss = wlan_vdev_mlme_get_nss(adapter->vdev); + rx_nss = wlan_vdev_mlme_get_nss(adapter->vdev); + } + /* save class a stats to legacy location */ - adapter->hdd_stats.class_a_stat.tx_nss = - wlan_vdev_mlme_get_nss(adapter->vdev); - adapter->hdd_stats.class_a_stat.rx_nss = - wlan_vdev_mlme_get_nss(adapter->vdev); + adapter->hdd_stats.class_a_stat.tx_nss = tx_nss; + adapter->hdd_stats.class_a_stat.rx_nss = rx_nss; adapter->hdd_stats.class_a_stat.tx_rate = stats->tx_rate; 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;