From cbcc6545bae1dd77affac2181eb7723988bf7d14 Mon Sep 17 00:00:00 2001 From: Naveen Rawat Date: Mon, 30 Oct 2017 17:55:03 -0700 Subject: [PATCH] qcacld-3.0: Fix mcs/nss calculations for HE 1) In function lim_populate_he_mcs_set in case 2x2 is disabled, mcs is being set incorrectly. Fix this assignment by using correct macro to disable 2 or higher MCS set. 2) Fix HE_GET_NSS macro to get NSS. 2) In function lim_populate_peer_rate_set, NSS was being calculated on peer MCS, instead of intersected MCS. Fix this by using intersected MCS for NSS calculation. Change-Id: Id674a90b69771b83c75c7aa316ead0b63df93891 CRs-Fixed: 2135014 --- core/mac/inc/sir_api.h | 2 +- core/mac/src/pe/lim/lim_assoc_utils.c | 22 +++++++++++++++++++++- core/mac/src/pe/lim/lim_utils.c | 12 ++++++------ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 79ccbe21cfe3..7f506bb6adcf 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -7668,7 +7668,7 @@ struct he_capability { #define HE_GET_NSS(mcs, nss) \ do { \ (nss) = 0; \ - while ((((mcs) >> ((nss)*2)) & 3) != 3 && nss <= 8) \ + while ((((mcs) >> ((nss)*2)) & 3) != 3 && nss < 8) \ (nss)++; \ } while (0) diff --git a/core/mac/src/pe/lim/lim_assoc_utils.c b/core/mac/src/pe/lim/lim_assoc_utils.c index 39c0f6722fec..d0d1f3fd5529 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.c +++ b/core/mac/src/pe/lim/lim_assoc_utils.c @@ -1638,6 +1638,26 @@ lim_populate_own_rate_set(tpAniSirGlobal mac_ctx, return eSIR_SUCCESS; } +#ifdef WLAN_FEATURE_11AX +/** + * lim_calculate_he_nss() - function to calculate new nss from he rates + * @rates: supported rtes struct object + * @session: pe session entry + * This function calculates nss from rx_he_mcs_map_lt_80 within rates struct + * object and assigns new value to nss within pe_session + * + * Return: None + */ +static void lim_calculate_he_nss(tpSirSupportedRates rates, tpPESession session) +{ + HE_GET_NSS(rates->rx_he_mcs_map_lt_80, session->nss); +} +#else +static void lim_calculate_he_nss(tpSirSupportedRates rates, tpPESession session) +{ +} +#endif + tSirRetStatus lim_populate_peer_rate_set(tpAniSirGlobal pMac, tpSirSupportedRates pRates, uint8_t *pSupportedMCSSet, @@ -1778,7 +1798,7 @@ lim_populate_peer_rate_set(tpAniSirGlobal pMac, psessionEntry, psessionEntry->nss); if (IS_DOT11_MODE_HE(psessionEntry->dot11mode) && he_caps) { - HE_GET_NSS(he_caps->rx_he_mcs_map_lt_80, psessionEntry->nss); + lim_calculate_he_nss(pRates, psessionEntry); } else if (IS_DOT11_MODE_VHT(psessionEntry->dot11mode)) { if ((pRates->vhtRxMCSMap & MCSMAPMASK2x2) == MCSMAPMASK2x2) psessionEntry->nss = NSS_1x1_MODE; diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 5466bff3618c..871fab6bfadc 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -7860,12 +7860,12 @@ QDF_STATUS lim_populate_he_mcs_set(tpAniSirGlobal mac_ctx, WNI_CFG_HE_RX_MCS_MAP_80_80, WNI_CFG_HE_TX_MCS_MAP_80_80); if (!support_2x2) { /* disable 2 and higher NSS MCS sets */ - rates->rx_he_mcs_map_lt_80 |= 0xFFFD; - rates->tx_he_mcs_map_lt_80 |= 0xFFFD; - rates->rx_he_mcs_map_160 |= 0xFFFD; - rates->tx_he_mcs_map_160 |= 0xFFFD; - rates->rx_he_mcs_map_80_80 |= 0xFFFD; - rates->tx_he_mcs_map_80_80 |= 0xFFFD; + rates->rx_he_mcs_map_lt_80 |= HE_MCS_INV_MSK_4_NSS(1); + rates->tx_he_mcs_map_lt_80 |= HE_MCS_INV_MSK_4_NSS(1); + rates->rx_he_mcs_map_160 |= HE_MCS_INV_MSK_4_NSS(1); + rates->tx_he_mcs_map_160 |= HE_MCS_INV_MSK_4_NSS(1); + rates->rx_he_mcs_map_80_80 |= HE_MCS_INV_MSK_4_NSS(1); + rates->tx_he_mcs_map_80_80 |= HE_MCS_INV_MSK_4_NSS(1); } pe_debug("enable2x2 - %d nss %d",