diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index e4529a3b8b06..1d9abc89e90f 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -509,6 +509,13 @@ uint8_t sap_select_preferred_channel_from_channel_list(uint8_t best_chnl, tSapChSelSpectInfo *spectinfo_param) { uint8_t i = 0; + tpAniSirGlobal mac_ctx = sme_get_mac_context(); + + if (NULL == mac_ctx) { + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, + "pmac Global Context is NULL"); + return SAP_CHANNEL_NOT_SELECTED; + } /* * If Channel List is not Configured don't do anything @@ -524,7 +531,9 @@ uint8_t sap_select_preferred_channel_from_channel_list(uint8_t best_chnl, /* Select the best channel from allowed list */ for (i = 0; i < sap_ctx->acs_cfg->ch_list_count; i++) { - if (sap_ctx->acs_cfg->ch_list[i] == best_chnl) { + if ((sap_ctx->acs_cfg->ch_list[i] == best_chnl) && + !(wlan_reg_is_dfs_ch(mac_ctx->pdev, best_chnl) && + policy_mgr_disallow_mcc(mac_ctx->psoc, best_chnl))) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, "Best channel is: %d", diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 3b70e1fc4151..18b401495bb8 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1662,6 +1662,15 @@ QDF_STATUS sme_get_peer_info_ext(tHalHandle hal, void (*callbackfn)(struct sir_peer_info_ext_resp *param, void *pcontext)); +/** + * sme_set_5g_band_pref() - sme api to set 5Ghz preference + * @hal: hal handle for getting global mac struct + * @pref_params: preference info request struct + * + * This function will set 5Ghz preference for STA connection + * + * Return: None + */ void sme_set_5g_band_pref(tHalHandle hal_handle, struct sme_5g_band_pref_params *pref_params); @@ -1695,4 +1704,13 @@ QDF_STATUS sme_get_chain_rssi(tHalHandle hal, * Return: QDF_STATUS_SUCCESS or non-zero on failure */ QDF_STATUS sme_get_valid_channels(uint8_t *chan_list, uint32_t *list_len); + +/** + * sme_get_mac_context() - sme api to get the pmac context + * + * This function will return the pmac context + * + * Return: pointer to pmac context + */ +tpAniSirGlobal sme_get_mac_context(void); #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 39d094120459..0edfb0fc45f1 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -120,7 +120,7 @@ QDF_STATUS sme_release_global_lock(tSmeStruct *psSme) return status; } -static tpAniSirGlobal sme_get_mac_context(void) +tpAniSirGlobal sme_get_mac_context(void) { tpAniSirGlobal mac_ctx; tHalHandle h_hal;