From 1d8bd6255d44883b44df7302f0fa9e1ce4ff1666 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Tue, 13 Nov 2018 11:43:55 +0530 Subject: [PATCH] qcacld-3.0: Fix 80Mhz BW allowed for PEER in 2.4GHz SAP In case PEER send BW as 80Mhz in OPmode IE in 2.4Ghz, driver doesn't check the SAP session BW and allow this BW in PEER assoc command to firmware. Fix this by limiting the PEER BW to less than or equal to SAP session BW. Change-Id: Icf9e53fec32d30e5620e51b8664b0e92ba2b26d6 CRs-Fixed: 2346537 --- .../mac/src/pe/lim/lim_process_assoc_req_frame.c | 16 +++++++++++++--- core/wma/src/wma_mgmt.c | 7 +++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c index c33d293642d4..48284f361ab9 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c @@ -1402,13 +1402,18 @@ static bool lim_update_sta_ds(tpAniSirGlobal mac_ctx, tpSirMacMgmtHdr hdr, (sta_ds->htSupportedChannelWidthSet) ? session->htSecondaryChannelOffset : 0; if (assoc_req->operMode.present) { + enum phy_ch_width ch_width; + + ch_width = assoc_req->operMode.chanWidth; + if (session->ch_width < ch_width) + ch_width = session->ch_width; + sta_ds->vhtSupportedChannelWidthSet = - (uint8_t) ((assoc_req->operMode.chanWidth == - eHT_CHANNEL_WIDTH_80MHZ) ? + (uint8_t) ((ch_width == CH_WIDTH_80MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ); sta_ds->htSupportedChannelWidthSet = - (uint8_t) (assoc_req->operMode.chanWidth ? + (uint8_t) (ch_width ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ); } else if ((vht_caps != NULL) && vht_caps->present) { @@ -1432,6 +1437,11 @@ static bool lim_update_sta_ds(tpAniSirGlobal mac_ctx, tpSirMacMgmtHdr hdr, session->htSupportedChannelWidthSet) ? sta_ds->htSupportedChannelWidthSet : session->htSupportedChannelWidthSet; + + if (!sta_ds->htSupportedChannelWidthSet) + sta_ds->vhtSupportedChannelWidthSet = + WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ; + sta_ds->baPolicyFlag = 0xFF; sta_ds->htLdpcCapable = (uint8_t) assoc_req->HTCaps.advCodingCap; diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index 5102100dba75..0e3349f9ab76 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -1225,6 +1225,13 @@ QDF_STATUS wma_send_peer_assoc(tp_wma_handle wma, qdf_mem_zero(cmd, sizeof(struct peer_assoc_params)); is_he = wma_is_peer_he_capable(params); + if ((params->ch_width > CH_WIDTH_40MHZ) && + ((nw_type == eSIR_11G_NW_TYPE) || + (nw_type == eSIR_11B_NW_TYPE))) { + WMA_LOGE("ch_width %d sent in 11G, configure to 40MHz", + params->ch_width); + params->ch_width = CH_WIDTH_40MHZ; + } phymode = wma_peer_phymode(nw_type, params->staType, params->htCapable, params->ch_width, params->vhtCapable, is_he);