diff --git a/inc/wlan_policy_mgr_api.h b/inc/wlan_policy_mgr_api.h index 62a140fb6120..e601636c8a00 100644 --- a/inc/wlan_policy_mgr_api.h +++ b/inc/wlan_policy_mgr_api.h @@ -176,10 +176,10 @@ static inline void policy_mgr_check_concurrent_intf_and_restart_sap( * This function is used to check for MCC operation in 2.4GHz band. * STA, P2P and SAP adapters are only considered. * - * Return: Non zero value if MCC is detected in 2.4GHz band + * Return: True if mcc is detected in 2.4 Ghz, false otherwise * */ -uint8_t policy_mgr_is_mcc_in_24G(struct wlan_objmgr_psoc *psoc); +bool policy_mgr_is_mcc_in_24G(struct wlan_objmgr_psoc *psoc); /** * policy_mgr_change_mcc_go_beacon_interval() - Change MCC beacon interval diff --git a/src/wlan_policy_mgr_action.c b/src/wlan_policy_mgr_action.c index dd6a622e22a0..31dd59904587 100644 --- a/src/wlan_policy_mgr_action.c +++ b/src/wlan_policy_mgr_action.c @@ -593,6 +593,31 @@ void policy_mgr_check_concurrent_intf_and_restart_sap( struct wlan_objmgr_psoc *psoc, uint8_t operation_channel) { + struct policy_mgr_psoc_priv_obj *pm_ctx; + uint32_t mcc_to_scc_switch; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("Invalid context"); + return; + } + + mcc_to_scc_switch = + policy_mgr_mcc_to_scc_switch_mode_in_user_cfg(psoc); + policy_mgr_info("MCC to SCC switch: %d chan: %d", + mcc_to_scc_switch, operation_channel); + if ((mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE) +#ifdef FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE + && !wlan_reg_is_dfs_ch(psoc, + operationChannel) +#endif + ) { + qdf_create_work(0, &pm_ctx->sta_ap_intf_check_work, + policy_mgr_check_sta_ap_concurrent_ch_intf, + (void *)psoc); + qdf_sched_work(0, &pm_ctx->sta_ap_intf_check_work); + policy_mgr_info("Checking for Concurrent Change interference"); + } } #endif /* FEATURE_WLAN_MCC_TO_SCC_SWITCH */ diff --git a/src/wlan_policy_mgr_get_set_utils.c b/src/wlan_policy_mgr_get_set_utils.c index 9fd56da450a5..992728ecb412 100644 --- a/src/wlan_policy_mgr_get_set_utils.c +++ b/src/wlan_policy_mgr_get_set_utils.c @@ -1258,9 +1258,75 @@ uint8_t policy_mgr_search_and_check_for_session_conc( return channel; } -uint8_t policy_mgr_is_mcc_in_24G(struct wlan_objmgr_psoc *psoc) +/** + * policy_mgr_is_two_connection_mcc() - Check if MCC scenario + * when there are two connections + * + * If if MCC scenario when there are two connections + * + * Return: true or false + */ +static bool policy_mgr_is_two_connection_mcc(void) { - return 0; + return ((pm_conc_connection_list[0].chan != + pm_conc_connection_list[1].chan) && + (pm_conc_connection_list[0].mac == + pm_conc_connection_list[1].mac) && + (pm_conc_connection_list[0].chan <= + WLAN_REG_MAX_24GHZ_CH_NUM) && + (pm_conc_connection_list[1].chan <= + WLAN_REG_MAX_24GHZ_CH_NUM)) ? true : false; +} + +/** + * policy_mgr_is_three_connection_mcc() - Check if MCC scenario + * when there are three connections + * + * If if MCC scenario when there are three connections + * + * Return: true or false + */ +static bool policy_mgr_is_three_connection_mcc(void) +{ + return (((pm_conc_connection_list[0].chan != + pm_conc_connection_list[1].chan) || + (pm_conc_connection_list[0].chan != + pm_conc_connection_list[2].chan) || + (pm_conc_connection_list[1].chan != + pm_conc_connection_list[2].chan)) && + (pm_conc_connection_list[0].chan <= + WLAN_REG_MAX_24GHZ_CH_NUM) && + (pm_conc_connection_list[1].chan <= + WLAN_REG_MAX_24GHZ_CH_NUM) && + (pm_conc_connection_list[2].chan <= + WLAN_REG_MAX_24GHZ_CH_NUM)) ? true : false; +} + +bool policy_mgr_is_mcc_in_24G(struct wlan_objmgr_psoc *psoc) +{ + uint32_t num_connections = 0; + bool is_24G_mcc = false; + + num_connections = policy_mgr_get_connection_count(psoc); + + switch (num_connections) { + case 1: + break; + case 2: + if (policy_mgr_is_two_connection_mcc()) + is_24G_mcc = true; + break; + case 3: + if (policy_mgr_is_three_connection_mcc()) + is_24G_mcc = true; + break; + default: + policy_mgr_err("unexpected num_connections value %d", + num_connections); + break; + } + + return is_24G_mcc; } bool policy_mgr_check_for_session_conc(struct wlan_objmgr_psoc *psoc, @@ -1290,16 +1356,6 @@ bool policy_mgr_check_for_session_conc(struct wlan_objmgr_psoc *psoc, return true; } -/** - * policy_mgr_is_mcc_adaptive_scheduler_enabled() - Function to - * gets the policy manager mcc adaptive scheduler enabled - * @psoc: PSOC object information - * - * This function gets the value mcc adaptive scheduler - * - * Return: true if MCC adaptive scheduler is set else false - * - */ bool policy_mgr_is_mcc_adaptive_scheduler_enabled( struct wlan_objmgr_psoc *psoc) { struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -1313,16 +1369,6 @@ bool policy_mgr_is_mcc_adaptive_scheduler_enabled( return pm_ctx->enable_mcc_adaptive_scheduler ? true : false; } -/** - * policy_mgr_change_mcc_go_beacon_interval() - Change MCC beacon interval - * @psoc: PSOC object information - * @vdev_id: vdev id - * @dev_mode: device mode - * - * Updates the beacon parameters of the GO in MCC scenario - * - * Return: Success or Failure depending on the overall function behavior - */ QDF_STATUS policy_mgr_change_mcc_go_beacon_interval( struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, enum tQDF_ADAPTER_MODE dev_mode)