qcacld-3.0: Fix unsafe check failure for SAP

With MACRO FEATURE_WLAN_CH_AVOID_EXT enabled,
"restriction_mask" can only be checked if
coex_unsafe_chan_nb_user_prefer = 1. If the INI
coex_unsafe_chan_nb_user_prefer = 0, do not need to check
"restriction_mask". It will remain uninitialized 0.

Change-Id: If7bd1223ee3779b72fadb40e622f682db03f4ea5
CRs-Fixed: 3287634
This commit is contained in:
Liangwei Dong
2022-09-09 10:55:24 +08:00
parent d68f680db2
commit be5cc24258
5 changed files with 40 additions and 11 deletions

View File

@@ -1563,7 +1563,8 @@ bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc,
(unsigned long)policy_mgr_get_freq_restriction_mask(pm_ctx); (unsigned long)policy_mgr_get_freq_restriction_mask(pm_ctx);
for (j = 0; j < pm_ctx->unsafe_channel_count; j++) { for (j = 0; j < pm_ctx->unsafe_channel_count; j++) {
if ((ch_freq == pm_ctx->unsafe_channel_list[j]) && if ((ch_freq == pm_ctx->unsafe_channel_list[j]) &&
(qdf_test_bit(QDF_SAP_MODE, &restriction_mask))) { (qdf_test_bit(QDF_SAP_MODE, &restriction_mask) ||
!wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(psoc))) {
is_safe = false; is_safe = false;
policy_mgr_warn("Freq %d is not safe, restriction mask %lu", ch_freq, restriction_mask); policy_mgr_warn("Freq %d is not safe, restriction mask %lu", ch_freq, restriction_mask);
break; break;

View File

@@ -291,6 +291,26 @@ wlan_mlme_get_wlm_multi_client_ll_caps(struct wlan_objmgr_psoc *psoc)
} }
#endif #endif
#ifdef FEATURE_WLAN_CH_AVOID_EXT
/**
* wlan_mlme_get_coex_unsafe_chan_nb_user_prefer() - get coex unsafe nb
* support
* @psoc: pointer to psoc object
* @value: pointer to the value which will be filled for the caller
*
* Return: coex_unsafe_chan_nb_user_prefer
*/
bool wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(
struct wlan_objmgr_psoc *psoc);
#else
static inline
bool wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(
struct wlan_objmgr_psoc *psoc)
{
return false;
}
#endif
/** /**
* wlan_mlme_set_band_capability() - Set the Band capability config * wlan_mlme_set_band_capability() - Set the Band capability config
* @psoc: pointer to psoc object * @psoc: pointer to psoc object

View File

@@ -216,6 +216,21 @@ bool wlan_mlme_get_wlm_multi_client_ll_caps(struct wlan_objmgr_psoc *psoc)
} }
#endif #endif
#ifdef FEATURE_WLAN_CH_AVOID_EXT
bool wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(
struct wlan_objmgr_psoc *psoc)
{
struct wlan_mlme_psoc_ext_obj *mlme_obj;
mlme_obj = mlme_get_psoc_ext_obj(psoc);
if (!mlme_obj) {
mlme_legacy_err("Failed to get MLME Obj");
return cfg_default(CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER);
}
return mlme_obj->cfg.reg.coex_unsafe_chan_nb_user_prefer;
}
#endif
QDF_STATUS wlan_mlme_get_band_capability(struct wlan_objmgr_psoc *psoc, QDF_STATUS wlan_mlme_get_band_capability(struct wlan_objmgr_psoc *psoc,
uint32_t *band_capability) uint32_t *band_capability)
{ {

View File

@@ -1821,14 +1821,7 @@ bool ucfg_mlme_validate_scan_period(struct wlan_objmgr_psoc *psoc,
bool ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer( bool ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer(
struct wlan_objmgr_psoc *psoc) struct wlan_objmgr_psoc *psoc)
{ {
struct wlan_mlme_psoc_ext_obj *mlme_obj; return wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(psoc);
mlme_obj = mlme_get_psoc_ext_obj(psoc);
if (!mlme_obj) {
mlme_legacy_err("Failed to get MLME Obj");
return cfg_default(CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER);
}
return mlme_obj->cfg.reg.coex_unsafe_chan_nb_user_prefer;
} }
bool ucfg_mlme_get_coex_unsafe_chan_reg_disable( bool ucfg_mlme_get_coex_unsafe_chan_reg_disable(

View File

@@ -1175,8 +1175,8 @@ validation_done:
sap_debug("for configured channel, Ch_freq = %d", sap_debug("for configured channel, Ch_freq = %d",
sap_context->chan_freq); sap_context->chan_freq);
if (!policy_mgr_is_safe_channel(mac_ctx->psoc, if (!policy_mgr_is_sap_freq_allowed(mac_ctx->psoc,
sap_context->chan_freq)) { sap_context->chan_freq)) {
sap_warn("Abort SAP start due to unsafe channel"); sap_warn("Abort SAP start due to unsafe channel");
return QDF_STATUS_E_ABORTED; return QDF_STATUS_E_ABORTED;
} }