diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index 89a7bf2d67..abac2ce2d2 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -1605,30 +1605,35 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, if (!wlan_nan_get_sap_conc_support(pm_ctx->psoc)) { policy_mgr_debug("NAN+SAP not supported in fw"); + /* Reject NAN as SAP is of high priority */ if (mode == PM_NAN_DISC_MODE) return false; /* Before SAP start disable NAN */ ucfg_nan_disable_concurrency(pm_ctx->psoc); + return true; } + if (mode == PM_NAN_DISC_MODE) { sap_freq = policy_mgr_mode_specific_get_channel(pm_ctx->psoc, PM_SAP_MODE); policy_mgr_debug("FREQ SAP: %d NAN: %d", sap_freq, ch_freq); - if (WLAN_REG_IS_SAME_BAND_FREQS(sap_freq, ch_freq)) { - if (sap_freq == ch_freq) { - policy_mgr_debug("NAN+SAP SCC"); - return true; - } + if (ucfg_is_nan_dbs_supported(pm_ctx->psoc) && + !WLAN_REG_IS_SAME_BAND_FREQS(sap_freq, ch_freq)) + return true; - if (!policy_mgr_is_force_scc(pm_ctx->psoc)) { - policy_mgr_debug("SAP force SCC disabled"); - return false; - } - if (!policy_mgr_is_nan_sap_unsafe_ch_scc_allowed( - pm_ctx, ch_freq)) { - policy_mgr_debug("NAN+SAP unsafe ch SCC disabled"); - return false; - } + if (sap_freq == ch_freq) { + policy_mgr_debug("NAN+SAP SCC"); + return true; + } + + if (!policy_mgr_is_force_scc(pm_ctx->psoc)) { + policy_mgr_debug("SAP force SCC disabled"); + return false; + } + if (!policy_mgr_is_nan_sap_unsafe_ch_scc_allowed( + pm_ctx, ch_freq)) { + policy_mgr_debug("NAN+SAP unsafe ch SCC disabled"); + return false; } } else if (mode == PM_SAP_MODE) { nan_2g_freq = @@ -1637,8 +1642,16 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, nan_5g_freq = wlan_nan_get_disc_5g_ch_freq(pm_ctx->psoc); policy_mgr_debug("SAP CH: %d NAN Ch: %d %d", ch_freq, nan_2g_freq, nan_5g_freq); - if (WLAN_REG_IS_SAME_BAND_FREQS(nan_2g_freq, ch_freq) || - WLAN_REG_IS_SAME_BAND_FREQS(nan_5g_freq, ch_freq)) { + if (ucfg_is_nan_conc_control_supported(pm_ctx->psoc) && + !ucfg_is_nan_dbs_supported(pm_ctx->psoc) && + !WLAN_REG_IS_SAME_BAND_FREQS(nan_2g_freq, ch_freq)) { + if (!policy_mgr_is_force_scc(pm_ctx->psoc)) { + policy_mgr_debug("NAN and SAP are in different bands but SAP force SCC disabled"); + ucfg_nan_disable_concurrency(pm_ctx->psoc); + return true; + } + } else if (WLAN_REG_IS_SAME_BAND_FREQS(nan_2g_freq, ch_freq) || + WLAN_REG_IS_SAME_BAND_FREQS(nan_5g_freq, ch_freq)) { if (ch_freq == nan_2g_freq || ch_freq == nan_5g_freq) { policy_mgr_debug("NAN+SAP SCC"); return true; @@ -1646,7 +1659,7 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, if (!policy_mgr_is_force_scc(pm_ctx->psoc)) { policy_mgr_debug("SAP force SCC disabled"); ucfg_nan_disable_concurrency(pm_ctx->psoc); - return false; + return true; } if ((WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq) && !policy_mgr_is_nan_sap_unsafe_ch_scc_allowed( @@ -1656,7 +1669,7 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, pm_ctx, nan_2g_freq))) { policy_mgr_debug("NAN+SAP unsafe ch SCC disabled"); ucfg_nan_disable_concurrency(pm_ctx->psoc); - return false; + return true; } } } diff --git a/components/nan/core/src/nan_main.c b/components/nan/core/src/nan_main.c index 67a19aace3..9033287260 100644 --- a/components/nan/core/src/nan_main.c +++ b/components/nan/core/src/nan_main.c @@ -1146,7 +1146,9 @@ QDF_STATUS nan_discovery_pre_enable(struct wlan_objmgr_psoc *psoc, goto pre_enable_failure; } - if (!policy_mgr_nan_sap_pre_enable_conc_check(psoc, PM_NAN_DISC_MODE, + if (policy_mgr_mode_specific_connection_count(psoc, PM_SAP_MODE, + NULL) && + !policy_mgr_nan_sap_pre_enable_conc_check(psoc, PM_NAN_DISC_MODE, nan_ch_freq)) { nan_debug("NAN not enabled due to concurrency constraints"); status = QDF_STATUS_E_INVAL; @@ -1386,6 +1388,5 @@ bool wlan_nan_get_sap_conc_support(struct wlan_objmgr_psoc *psoc) } return (psoc_nan_obj->nan_caps.nan_sap_supported && - psoc_nan_obj->nan_caps.nan_dbs_supported && - psoc_nan_obj->nan_caps.nan_conc_control); + ucfg_is_nan_conc_control_supported(psoc)); } diff --git a/components/nan/dispatcher/inc/nan_ucfg_api.h b/components/nan/dispatcher/inc/nan_ucfg_api.h index 91b1753140..9673f8d1a6 100644 --- a/components/nan/dispatcher/inc/nan_ucfg_api.h +++ b/components/nan/dispatcher/inc/nan_ucfg_api.h @@ -546,5 +546,11 @@ bool ucfg_is_nan_vdev(struct wlan_objmgr_vdev *vdev) { return false; } + +static inline +bool ucfg_is_nan_dbs_supported(struct wlan_objmgr_psoc *psoc) +{ + return false; +} #endif /* WLAN_FEATURE_NAN */ #endif /* _NAN_UCFG_API_H_ */ diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index eea1ce5402..f8a1171d01 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -6482,8 +6482,11 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, /* NDI + SAP conditional supported */ hdd_sap_nan_check_and_disable_unsupported_ndi(hdd_ctx->psoc, true); - if (!policy_mgr_nan_sap_pre_enable_conc_check( - hdd_ctx->psoc, PM_SAP_MODE, wlan_chan_to_freq(channel))) + + if (policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, + PM_NAN_DISC_MODE, NULL) && + !policy_mgr_nan_sap_pre_enable_conc_check(hdd_ctx->psoc, + PM_SAP_MODE, wlan_chan_to_freq(channel))) hdd_debug("NAN disabled due to concurrency constraints"); /* check if concurrency is allowed */