diff --git a/core/mac/src/pe/include/lim_ft_defs.h b/core/mac/src/pe/include/lim_ft_defs.h index 476d1d3561..9ca4e83aa1 100644 --- a/core/mac/src/pe/include/lim_ft_defs.h +++ b/core/mac/src/pe/include/lim_ft_defs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -54,6 +54,7 @@ typedef struct sSirFTPreAuthReq { uint16_t messageType; /* eWNI_SME_FT_PRE_AUTH_REQ */ uint16_t length; + uint32_t dot11mode; /* * Track if response is processed for this request * We expect only one response per request. diff --git a/core/mac/src/pe/lim/lim_ft.c b/core/mac/src/pe/lim/lim_ft.c index df58b09d5b..fbbba46d49 100644 --- a/core/mac/src/pe/lim/lim_ft.c +++ b/core/mac/src/pe/lim/lim_ft.c @@ -493,7 +493,6 @@ void lim_fill_ft_session(tpAniSirGlobal pMac, int8_t localPowerConstraint; int8_t regMax; tSchBeaconStruct *pBeaconStruct; - uint32_t selfDot11Mode; ePhyChanBondState cbEnabledMode; pBeaconStruct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); @@ -534,9 +533,9 @@ void lim_fill_ft_session(tpAniSirGlobal pMac, qdf_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId, pftSessionEntry->ssId.length); - wlan_cfg_get_int(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode); - pe_debug("selfDot11Mode: %d", selfDot11Mode); - pftSessionEntry->dot11mode = selfDot11Mode; + pftSessionEntry->dot11mode = + psessionEntry->ftPEContext.pFTPreAuthReq->dot11mode; + pe_debug("dot11mode: %d", pftSessionEntry->dot11mode); pftSessionEntry->vhtCapability = (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode) && IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps)); diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 5218503248..4647bf8044 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -4207,6 +4207,10 @@ QDF_STATUS csr_roam_prepare_bss_config(tpAniSirGlobal pMac, else pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; } + + sme_debug("phyMode=%d, uCfgDot11Mode=%d", + pProfile->phyMode, pBssConfig->uCfgDot11Mode); + /* Qos */ if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) && (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos)) { @@ -14095,6 +14099,9 @@ QDF_STATUS csr_send_join_req_msg(tpAniSirGlobal pMac, uint32_t sessionId, ucDot11Mode = WNI_CFG_DOT11_MODE_11N; } csr_join_req->dot11mode = (uint8_t) ucDot11Mode; + sme_debug("dot11mode=%d, uCfgDot11Mode=%d", + csr_join_req->dot11mode, + pSession->bssParams.uCfgDot11Mode); #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH csr_join_req->cc_switch_mode = pMac->roam.configParam.cc_switch_mode; diff --git a/core/sme/src/csr/csr_roam_preauth.c b/core/sme/src/csr/csr_roam_preauth.c index 72293fffea..b4812a1952 100644 --- a/core/sme/src/csr/csr_roam_preauth.c +++ b/core/sme/src/csr/csr_roam_preauth.c @@ -40,6 +40,18 @@ static void csr_reinit_preauth_cmd(tpAniSirGlobal pMac, tSmeCmd *pCommand); static QDF_STATUS csr_neighbor_roam_add_preauth_fail(tpAniSirGlobal mac_ctx, uint8_t session_id, tSirMacAddr bssid); + +/** + * csr_get_dot11_mode() - Derives dot11mode + * @hal: Global Handle + * @session_id: SME Session ID + * @bss_desc: BSS descriptor + * + * Return: dot11mode + */ +static uint32_t csr_get_dot11_mode(tHalHandle hal, uint32_t session_id, + tpSirBssDescription bss_desc); + /** * csr_neighbor_roam_state_preauth_done() - Check if state is preauth done * @mac_ctx: Global MAC context @@ -471,6 +483,59 @@ bool csr_neighbor_roam_is_preauth_candidate(tpAniSirGlobal pMac, return true; } +uint32_t csr_get_dot11_mode(tHalHandle hal, uint32_t session_id, + tpSirBssDescription bss_desc) +{ + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + tCsrRoamSession *csr_session = CSR_GET_SESSION(mac_ctx, session_id); + eCsrCfgDot11Mode ucfg_dot11_mode, cfg_dot11_mode; + QDF_STATUS status; + tDot11fBeaconIEs *ies_local = NULL; + uint32_t dot11mode = 0; + + sme_debug("phyMode %d", csr_session->pCurRoamProfile->phyMode); + + /* Get IE's */ + status = csr_get_parsed_bss_description_ies(mac_ctx, bss_desc, + &ies_local); + if (!QDF_IS_STATUS_SUCCESS(status)) { + sme_err("csr_get_parsed_bss_description_ies failed"); + return 0; + } + if (ies_local == NULL) { + sme_err("ies_local is NULL"); + return 0; + } + + if (csr_is_phy_mode_match(mac_ctx, + csr_session->pCurRoamProfile->phyMode, + bss_desc, csr_session->pCurRoamProfile, + &cfg_dot11_mode, ies_local)) + ucfg_dot11_mode = cfg_dot11_mode; + else { + sme_err("Can not find match phy mode"); + if (WLAN_REG_IS_5GHZ_CH(bss_desc->channelId)) + ucfg_dot11_mode = eCSR_CFG_DOT11_MODE_11A; + else + ucfg_dot11_mode = eCSR_CFG_DOT11_MODE_11G; + } + + /* dot11mode */ + dot11mode = csr_translate_to_wni_cfg_dot11_mode(mac_ctx, + ucfg_dot11_mode); + sme_debug("dot11mode %d ucfg_dot11_mode %d", + dot11mode, ucfg_dot11_mode); + + if (bss_desc->channelId <= 14 && + false == mac_ctx->roam.configParam.enableVhtFor24GHz && + WNI_CFG_DOT11_MODE_11AC == dot11mode) { + /* Need to disable VHT operation in 2.4 GHz band */ + dot11mode = WNI_CFG_DOT11_MODE_11N; + } + qdf_mem_free(ies_local); + return dot11mode; +} + /** * csr_roam_issue_ft_preauth_req() - Initiate Preauthentication request * @hal: Global Handle @@ -513,6 +578,13 @@ QDF_STATUS csr_roam_issue_ft_preauth_req(tHalHandle hal, uint32_t session_id, preauth_req->messageType = eWNI_SME_FT_PRE_AUTH_REQ; preauth_req->preAuthchannelNum = bss_desc->channelId; + preauth_req->dot11mode = + csr_get_dot11_mode(hal, session_id, bss_desc); + if (!preauth_req->dot11mode) { + sme_err("preauth_req->dot11mode is zero"); + qdf_mem_free(preauth_req); + return QDF_STATUS_E_FAILURE; + } qdf_mem_copy((void *)&preauth_req->currbssId, (void *)csr_session->connectedProfile.bssid.bytes,