diff options
| author | Abhishek Singh <absingh@codeaurora.org> | 2017-10-11 17:59:48 +0530 |
|---|---|---|
| committer | snandini <snandini@codeaurora.org> | 2017-10-12 05:46:43 -0700 |
| commit | 751b18b8c2e2dcb766a0c271cf11b7dcfafde616 (patch) | |
| tree | ffe72d5ae592c17069588b79cef8f6b98c325da3 | |
| parent | 04753fc8c751dd172013627b2d72945788b2b6bd (diff) | |
qcacld-3.0: Use per session cb mode to validate channel bw switch
In driver as part of __wlan_hdd_cfg80211_set_ap_channel_width() driver
modify the channelBondingMode24GHz and this modified value is not
changed to default value once hostapd restarts.
Due to this when the 20/40 BSS Coexistence Management frame is
received and hostapd tries to change the width to 20Mhz using
__wlan_hdd_cfg80211_set_ap_channel_width(), as
channelBondingMode24GHz is already set to 0, the request is
ignored and SAP doesn’t switch to 20Mhz.
To fix this use per session cb mode to validate bw switch.
Change-Id: Ia233c478794602aa6909cf637c5fc8c82fc3433a
CRs-Fixed: 2058315
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg80211.c | 58 | ||||
| -rw-r--r-- | core/sme/src/common/sme_api.c | 21 |
2 files changed, 22 insertions, 57 deletions
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 6bf0a84d04f4..e387fe101b07 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -18928,8 +18928,6 @@ __wlan_hdd_cfg80211_set_ap_channel_width(struct wiphy *wiphy, hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); hdd_context_t *pHddCtx; QDF_STATUS status; - tSmeConfigParams *sme_config; - bool cbModeChange = false; int retval = 0; if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { @@ -18937,6 +18935,10 @@ __wlan_hdd_cfg80211_set_ap_channel_width(struct wiphy *wiphy, return -EINVAL; } + if (!(pAdapter->device_mode == QDF_SAP_MODE || + pAdapter->device_mode == QDF_P2P_GO_MODE)) + return -EOPNOTSUPP; + if (wlan_hdd_validate_session_id(pAdapter->sessionId)) { hdd_err("invalid session id: %d", pAdapter->sessionId); return -EINVAL; @@ -18947,54 +18949,8 @@ __wlan_hdd_cfg80211_set_ap_channel_width(struct wiphy *wiphy, if (status) return status; - sme_config = qdf_mem_malloc(sizeof(*sme_config)); - if (!sme_config) { - hdd_err("failed to allocate memory for sme_config"); - return -ENOMEM; - } - qdf_mem_zero(sme_config, sizeof(*sme_config)); - sme_get_config_param(pHddCtx->hHal, sme_config); - switch (chandef->width) { - case NL80211_CHAN_WIDTH_20: - case NL80211_CHAN_WIDTH_20_NOHT: - if (sme_config->csrConfig.channelBondingMode24GHz != - eCSR_INI_SINGLE_CHANNEL_CENTERED) { - sme_config->csrConfig.channelBondingMode24GHz = - eCSR_INI_SINGLE_CHANNEL_CENTERED; - sme_update_config(pHddCtx->hHal, sme_config); - cbModeChange = true; - } - break; - - case NL80211_CHAN_WIDTH_40: - if (sme_config->csrConfig.channelBondingMode24GHz == - eCSR_INI_SINGLE_CHANNEL_CENTERED) { - if (NL80211_CHAN_HT40MINUS == - cfg80211_get_chandef_type(chandef)) - sme_config->csrConfig.channelBondingMode24GHz = - eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY; - else - sme_config->csrConfig.channelBondingMode24GHz = - eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY; - sme_update_config(pHddCtx->hHal, sme_config); - cbModeChange = true; - } - break; - - default: - hdd_err("Error!!! Invalid HT20/40 mode !"); - retval = -EINVAL; - goto free; - } - - if (!cbModeChange) - goto free; - - if (QDF_SAP_MODE != pAdapter->device_mode) - goto free; - - hdd_debug("Channel bonding changed to %d", - sme_config->csrConfig.channelBondingMode24GHz); + hdd_debug("Channel width changed to %d ", + cfg80211_get_chandef_type(chandef)); /* Change SAP ht2040 mode */ status = hdd_set_sap_ht2040_mode(pAdapter, @@ -19004,8 +18960,6 @@ __wlan_hdd_cfg80211_set_ap_channel_width(struct wiphy *wiphy, retval = -EINVAL; } -free: - qdf_mem_free(sme_config); return retval; } diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 0baadd92dfb4..1f0b1f838602 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -12341,26 +12341,37 @@ QDF_STATUS sme_set_ht2040_mode(tHalHandle hHal, uint8_t sessionId, QDF_STATUS status = QDF_STATUS_E_FAILURE; tpAniSirGlobal pMac = PMAC_STRUCT(hHal); ePhyChanBondState cbMode; + tCsrRoamSession *session = CSR_GET_SESSION(pMac, sessionId); - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, - "%s: Update HT operation beacon IE, channel_type=%d", - __func__, channel_type); + if (!CSR_IS_SESSION_VALID(pMac, sessionId)) { + sme_err("Session not valid for session id %d", sessionId); + return QDF_STATUS_E_INVAL; + } + session = CSR_GET_SESSION(pMac, sessionId); + sme_debug("Update HT operation beacon IE, channel_type=%d cur cbmode %d", + channel_type, session->bssParams.cbMode); switch (channel_type) { case eHT_CHAN_HT20: + if (!session->bssParams.cbMode) + return QDF_STATUS_SUCCESS; cbMode = PHY_SINGLE_CHANNEL_CENTERED; break; case eHT_CHAN_HT40MINUS: + if (session->bssParams.cbMode) + return QDF_STATUS_SUCCESS; cbMode = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; break; case eHT_CHAN_HT40PLUS: + if (session->bssParams.cbMode) + return QDF_STATUS_SUCCESS; cbMode = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; break; default: - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - "%s:Error!!! Invalid HT20/40 mode !", __func__); + sme_err("Error!!! Invalid HT20/40 mode !"); return QDF_STATUS_E_FAILURE; } + session->bssParams.cbMode = cbMode; status = sme_acquire_global_lock(&pMac->sme); if (QDF_IS_STATUS_SUCCESS(status)) { status = csr_set_ht2040_mode(pMac, sessionId, |
