From 575415a8cfcef96dbacd4e6ddea298a8527c3d01 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Wed, 16 Nov 2016 16:51:10 -0800 Subject: qcacld-3.0: Default to MSC 0 when reporting invalid link speed During vdev startup, firmware reports a tx rate of 0, which does not map to a valid MCS. If the last reported tx rate from firmware does not map to a valid MCS, default to MCS 0 when reporting link speed to the kernel. Change-Id: I6a2cb1cc6b328b76ed2f1ddd6ceb0f5ce7c84318 CRs-Fixed: 1091046 --- core/hdd/src/wlan_hdd_stats.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index b6357027e902..11e98cd3cacc 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -1682,6 +1682,7 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; uint8_t rate_flags; + uint8_t mcs_index; hdd_context_t *pHddCtx = (hdd_context_t *) wiphy_priv(wiphy); struct hdd_config *pCfg = pHddCtx->config; @@ -1772,6 +1773,7 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, hdd_lpass_notify_connect(pAdapter); rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; + mcs_index = pAdapter->hdd_stats.ClassA_stat.mcs_index; /* convert to the UI units of 100kbps */ myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; @@ -1785,18 +1787,14 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, promiscuous_rx_frag_cnt; } - if (pAdapter->hdd_stats.ClassA_stat.mcs_index == - INVALID_MCS_IDX) { - rate_flags = eHAL_TX_RATE_LEGACY; - pAdapter->hdd_stats.ClassA_stat.mcs_index = 0; - } + if (mcs_index == INVALID_MCS_IDX) + mcs_index = 0; } hdd_info("RSSI %d, RLMS %u, rate %d, rssi high %d, rssi mid %d, rssi low %d, rate_flags 0x%x, MCS %d", sinfo->signal, pCfg->reportMaxLinkSpeed, myRate, (int)pCfg->linkSpeedRssiHigh, (int)pCfg->linkSpeedRssiMid, - (int)pCfg->linkSpeedRssiLow, (int)rate_flags, - (int)pAdapter->hdd_stats.ClassA_stat.mcs_index); + (int)pCfg->linkSpeedRssiLow, (int)rate_flags, (int)mcs_index); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) || defined(WITH_BACKPORTS) /* assume basic BW. anything else will override this later */ @@ -1957,24 +1955,21 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, if (rate_flags & eHAL_TX_RATE_VHT80) { currentRate = - supported_vht_mcs_rate[pAdapter-> - hdd_stats.ClassA_stat.mcs_index]. + supported_vht_mcs_rate[mcs_index]. supported_VHT80_rate[rateFlag]; maxRate = supported_vht_mcs_rate[maxMCSIdx]. supported_VHT80_rate[rateFlag]; } else if (rate_flags & eHAL_TX_RATE_VHT40) { currentRate = - supported_vht_mcs_rate[pAdapter-> - hdd_stats.ClassA_stat.mcs_index]. + supported_vht_mcs_rate[mcs_index]. supported_VHT40_rate[rateFlag]; maxRate = supported_vht_mcs_rate[maxMCSIdx]. supported_VHT40_rate[rateFlag]; } else if (rate_flags & eHAL_TX_RATE_VHT20) { currentRate = - supported_vht_mcs_rate[pAdapter-> - hdd_stats.ClassA_stat.mcs_index]. + supported_vht_mcs_rate[mcs_index]. supported_VHT20_rate[rateFlag]; maxRate = supported_vht_mcs_rate[maxMCSIdx]. @@ -2036,7 +2031,7 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) { maxRate = myRate; maxSpeedMCS = 1; - maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; + maxMCSIdx = mcs_index; } /* report a value at least as big as current rate */ if ((maxRate < myRate) || (0 == maxRate)) { @@ -2045,8 +2040,7 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, maxSpeedMCS = 0; } else { maxSpeedMCS = 1; - maxMCSIdx = - pAdapter->hdd_stats.ClassA_stat.mcs_index; + maxMCSIdx = mcs_index; /* * IEEE_P802.11ac_2013.pdf page 325, 326 * - MCS9 is valid for VHT20 when @@ -2128,8 +2122,7 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, #endif /* LINKSPEED_DEBUG_ENABLED */ } else { /* must be MCS */ - sinfo->txrate.mcs = - pAdapter->hdd_stats.ClassA_stat.mcs_index; + sinfo->txrate.mcs = mcs_index; sinfo->txrate.nss = nss; sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; if (rate_flags & eHAL_TX_RATE_VHT80) { -- cgit v1.2.3