From a813462a02d1f336e99445739f9e238227723446 Mon Sep 17 00:00:00 2001 From: Vignesh Viswanathan Date: Fri, 28 Sep 2018 16:30:22 +0530 Subject: [PATCH] qcacld-3.0: Fill Channel width for add_sta params from session entry Currently the sta_context in add_bss params which is used to send the peer_assoc command to the FW, the ht_enable and vht_enable are set based on the AP's capability from the beacon. However, the channel width is set based on the assoc response frame from the AP. In a scenario where the AP advertises HT and VHT IEs in the beacon but does not send HT and VHT IEs in the assoc response frame, we will end up connecting in VHT/HT mode but with incorrect channel width. Update the sta_context channel width also based on the AP's capability from the beacon so that the connection would happen in the right channel width even if HT/VHT IEs are missing in the assoc response frame. Change-Id: Idb1907abebf32a34f88e935a30ebb8f1bce1d59c CRs-Fixed: 2324434 --- core/mac/src/pe/lim/lim_assoc_utils.c | 52 ++++++++++++--------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/core/mac/src/pe/lim/lim_assoc_utils.c b/core/mac/src/pe/lim/lim_assoc_utils.c index ee5aec1394af..bd1ff3d43aee 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.c +++ b/core/mac/src/pe/lim/lim_assoc_utils.c @@ -3666,8 +3666,12 @@ QDF_STATUS lim_sta_send_add_bss(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp, pAddBssParams->dot11_mode = psessionEntry->dot11mode; pe_debug("dot11_mode: %d", pAddBssParams->dot11_mode); - /* Use the advertised capabilities from the received beacon/PR */ + if (IS_DOT11_MODE_HT(psessionEntry->dot11mode)) + chanWidthSupp = lim_get_ht_capability(pMac, + eHT_SUPPORTED_CHANNEL_WIDTH_SET, + psessionEntry); + /* Use the advertised capabilities from the received beacon/PR */ if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && (pAssocRsp->HTCaps.present)) { pAddBssParams->htCapable = pAssocRsp->HTCaps.present; @@ -3677,10 +3681,7 @@ QDF_STATUS lim_sta_send_add_bss(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp, (tSirMacHTOperatingMode) pAssocRsp->HTInfo.opMode; pAddBssParams->dualCTSProtection = (uint8_t) pAssocRsp->HTInfo.dualCTSProtection; - chanWidthSupp = - lim_get_ht_capability(pMac, - eHT_SUPPORTED_CHANNEL_WIDTH_SET, - psessionEntry); + if ((pAssocRsp->HTCaps.supportedChannelWidthSet) && (chanWidthSupp)) { pAddBssParams->ch_width = (uint8_t) @@ -3850,37 +3851,30 @@ QDF_STATUS lim_sta_send_add_bss(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp, lim_update_he_stbc_capable(&pAddBssParams->staContext); } - if ((pAssocRsp->HTCaps.supportedChannelWidthSet) && - (chanWidthSupp)) { - pAddBssParams->staContext.ch_width = (uint8_t) - pAssocRsp->HTInfo.recommendedTxWidthSet; - if (pAssocRsp->VHTCaps.present) - vht_oper = &pAssocRsp->VHTOperation; - else if (pAssocRsp->vendor_vht_ie.VHTCaps.present) { - vht_oper = &pAssocRsp-> - vendor_vht_ie.VHTOperation; - pe_debug("VHT Op IE is in vendor Specific IE"); - } - /* - * in limExtractApCapability function intersection of FW - * advertised channel width and AP advertised channel - * width has been taken into account for calculating - * psessionEntry->ch_width - */ + /* + * in limExtractApCapability function intersection of FW + * advertised channel width and AP advertised channel + * width has been taken into account for calculating + * psessionEntry->ch_width + */ + if (chanWidthSupp && + ((pAssocRsp->HTCaps.supportedChannelWidthSet) || + (pBeaconStruct->HTCaps.supportedChannelWidthSet))) { pAddBssParams->staContext.ch_width = psessionEntry->ch_width; - - pe_debug("StaCtx: vhtCap %d ChBW %d TxBF %d", - pAddBssParams->staContext.vhtCapable, - pAddBssParams->staContext.ch_width, - sta_context->vhtTxBFCapable); - pe_debug("StaContext su_tx_bfer %d", - sta_context->enable_su_tx_bformer); } else { sta_context->ch_width = CH_WIDTH_20MHZ; if (vht_cap_info.enable_txbf_20mhz) sta_context->vhtTxBFCapable = 0; } + + pe_debug("StaCtx: vhtCap %d ChBW %d TxBF %d", + pAddBssParams->staContext.vhtCapable, + pAddBssParams->staContext.ch_width, + sta_context->vhtTxBFCapable); + pe_debug("StaContext su_tx_bfer %d", + sta_context->enable_su_tx_bformer); + pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState) pAssocRsp->HTCaps.mimoPowerSave;