diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index 16d850df19d2..728d13f948cc 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -611,6 +611,25 @@ static inline void policy_mgr_change_sap_channel_with_csa( } #endif +#ifdef WLAN_FEATURE_P2P_P2P_STA +/** + * policy_mgr_is_p2p_p2p_conc_supported() - p2p concurrency support + * @psoc: pointer to psoc + * + * This API is used to check whether firmware supports p2p concurrency + * + * Return: QDF_STATUS_SUCCESS up on success and any other status for failure. + */ +bool +policy_mgr_is_p2p_p2p_conc_supported(struct wlan_objmgr_psoc *psoc); +#else +static inline bool +policy_mgr_is_p2p_p2p_conc_supported(struct wlan_objmgr_psoc *psoc) +{ + return false; +} +#endif + /** * policy_mgr_set_pcl_for_existing_combo() - SET PCL for existing combo * @psoc: PSOC object information diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index e54d98c61b7a..c1de161d60e0 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -2616,6 +2616,13 @@ static bool policy_mgr_is_6g_channel_allowed( return true; } +#ifdef WLAN_FEATURE_P2P_P2P_STA +bool policy_mgr_is_p2p_p2p_conc_supported(struct wlan_objmgr_psoc *psoc) +{ + return wlan_mlme_get_p2p_p2p_conc_support(psoc); +} +#endif + bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, uint32_t ch_freq, @@ -2641,15 +2648,14 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, if (num_connections && policy_mgr_is_sub_20_mhz_enabled(psoc)) { policy_mgr_rl_debug("dont allow concurrency if Sub 20 MHz is enabled"); - status = false; - goto done; + return status; } if (policy_mgr_max_concurrent_connections_reached(psoc)) { policy_mgr_rl_debug("Reached max concurrent connections: %d", pm_ctx->cfg.max_conc_cxns); policy_mgr_validate_conn_info(psoc); - goto done; + return status; } if (ch_freq) { @@ -2668,7 +2674,7 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, if (!policy_mgr_allow_new_home_channel(psoc, mode, ch_freq, num_connections, is_dfs_ch)) - goto done; + return status; /* * 1) DFS MCC is not yet supported @@ -2685,13 +2691,13 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, */ if (!policy_mgr_is_5g_channel_allowed(psoc, ch_freq, list, PM_P2P_GO_MODE)) - goto done; + return status; if (!policy_mgr_is_5g_channel_allowed(psoc, ch_freq, list, PM_SAP_MODE)) - goto done; + return status; if (!policy_mgr_is_6g_channel_allowed(psoc, mode, ch_freq)) - goto done; + return status; sta_sap_scc_on_dfs_chan = policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(psoc); @@ -2706,14 +2712,14 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, } if (true == match) { policy_mgr_rl_debug("No MCC, SAP/GO about to come up on DFS channel"); - goto done; + return status; } if ((policy_mgr_is_hw_dbs_capable(psoc) != true) && num_connections) { if (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) { if (policy_mgr_is_sap_p2pgo_on_dfs(psoc)) { policy_mgr_rl_debug("MCC not allowed: SAP/P2PGO on DFS"); - goto done; + return status; } } } @@ -2725,21 +2731,26 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, if (mode == PM_STA_MODE && count) { if (count >= 2) { policy_mgr_rl_debug("3rd STA isn't permitted"); - goto done; + return status; } sta_freq = pm_conc_connection_list[list[0]].freq; if (!policy_mgr_allow_multiple_sta_connections(psoc, ch_freq, sta_freq)) - goto done; + return status; } if (!policy_mgr_allow_sap_go_concurrency(psoc, mode, ch_freq, WLAN_INVALID_VDEV_ID)) { policy_mgr_rl_debug("This concurrency combination is not allowed"); - goto done; + return status; } - /* don't allow two P2P GO on same band */ - if (ch_freq && mode == PM_P2P_GO_MODE && num_connections) { + + /* + * don't allow two P2P GO on same band, if fw doesn't + * support p2p +p2p concurrency + */ + if (ch_freq && mode == PM_P2P_GO_MODE && num_connections && + !policy_mgr_is_p2p_p2p_conc_supported(psoc)) { index = 0; count = policy_mgr_mode_specific_connection_count( psoc, PM_P2P_GO_MODE, list); @@ -2750,7 +2761,7 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, pm_conc_connection_list[list[index]].freq)) { policy_mgr_rl_debug("Don't allow P2P GO on same band"); qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); - goto done; + return status; } index++; } @@ -2759,12 +2770,11 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, if (!policy_mgr_allow_wapi_concurrency(pm_ctx)) { policy_mgr_rl_debug("Don't allow new conn when wapi security conn existing"); - goto done; + return status; } status = true; -done: return status; } @@ -4307,8 +4317,6 @@ bool policy_mgr_allow_sap_go_concurrency(struct wlan_objmgr_psoc *psoc, if (mode != PM_SAP_MODE && mode != PM_P2P_GO_MODE) return true; - if (policy_mgr_dual_beacon_on_single_mac_mcc_capable(psoc)) - return true; dbs = policy_mgr_is_hw_dbs_capable(psoc); for (id = 0; id < MAX_NUMBER_OF_CONC_CONNECTIONS; id++) { if (!pm_conc_connection_list[id].in_use) @@ -4320,6 +4328,18 @@ bool policy_mgr_allow_sap_go_concurrency(struct wlan_objmgr_psoc *psoc, if (con_mode != PM_SAP_MODE && con_mode != PM_P2P_GO_MODE) continue; con_freq = pm_conc_connection_list[id].freq; + + if (policy_mgr_is_p2p_p2p_conc_supported(psoc) && + (mode == PM_P2P_GO_MODE) && (con_mode == PM_P2P_GO_MODE)) { + policy_mgr_debug("GO+GO scc is allowed freq = %d ", + ch_freq); + return true; + } + + if (policy_mgr_dual_beacon_on_single_mac_mcc_capable(psoc) && + (mode == PM_SAP_MODE) && (con_mode == PM_SAP_MODE)) + return true; + if (policy_mgr_dual_beacon_on_single_mac_scc_capable(psoc) && (ch_freq == con_freq)) { policy_mgr_debug("SCC enabled, 2 AP on same channel, allow 2nd AP"); diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index 020a96b617cf..1bf5978842d5 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -3242,4 +3242,22 @@ QDF_STATUS wlan_mlme_get_channel_bonding_5ghz(struct wlan_objmgr_psoc *psoc, uint32_t *value); +#ifdef WLAN_FEATURE_P2P_P2P_STA +/** + * wlan_mlme_get_p2p_p2p_conc_support() - Get p2p+p2p conc support + * + * @psoc: pointer to psoc object + * @val : value + * + * Return: Success/failure + */ +bool +wlan_mlme_get_p2p_p2p_conc_support(struct wlan_objmgr_psoc *psoc); +#else +static inline bool +wlan_mlme_get_p2p_p2p_conc_support(struct wlan_objmgr_psoc *psoc) +{ + return false; +} +#endif #endif /* _WLAN_MLME_API_H_ */ diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index ee1347cda4d7..2dc3b418de18 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -5020,3 +5020,12 @@ wlan_mlme_get_channel_bonding_5ghz(struct wlan_objmgr_psoc *psoc, *value = mlme_obj->cfg.feature_flags.channel_bonding_mode_5ghz; return QDF_STATUS_SUCCESS; } + +#ifdef WLAN_FEATURE_P2P_P2P_STA +bool +wlan_mlme_get_p2p_p2p_conc_support(struct wlan_objmgr_psoc *psoc) +{ + return wlan_psoc_nif_fw_ext_cap_get(psoc, + WLAN_SOC_EXT_P2P_P2P_CONC_SUPPORT); +} +#endif