From c339ab4ddf3c16eaf37ae84d3002a9949d38434a Mon Sep 17 00:00:00 2001 From: sheenam monga Date: Wed, 14 Jul 2021 11:29:30 +0530 Subject: [PATCH] qcacld-3.0: Check Fw capability to support p2p + p2p concurrency Check fw capability to support p2p + p2p concurrency from soc_fw_ext_caps and based on fw capability, set policy mgr concurrency for p2p + p2p. Change-Id: Ia32f81f37174e9d722911b1fae6d4897d0af9816 CRs-Fixed: 2991300 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 19 ++++++ .../src/wlan_policy_mgr_get_set_utils.c | 58 +++++++++++++------ .../mlme/dispatcher/inc/wlan_mlme_api.h | 19 ++++++ .../mlme/dispatcher/src/wlan_mlme_api.c | 9 +++ 4 files changed, 86 insertions(+), 19 deletions(-) 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 536c01ceb2..cc13d3a155 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 @@ -651,6 +651,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 3fc2fea836..9c30e282c6 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 @@ -2681,6 +2681,13 @@ bool policy_mgr_is_mlo_sap_concurrency_allowed(struct wlan_objmgr_psoc *psoc, } #endif +#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, @@ -2706,15 +2713,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) { @@ -2730,7 +2736,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 @@ -2747,13 +2753,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); @@ -2766,14 +2772,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; } } } @@ -2785,21 +2791,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); @@ -2810,7 +2821,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++; } @@ -2819,12 +2830,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; } @@ -4315,8 +4325,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) @@ -4328,6 +4336,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 a0134801e1..ac00c7755f 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -3336,4 +3336,23 @@ QDF_STATUS mlme_set_user_ps(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, * Return: True if user_ps flag is set */ bool mlme_get_user_ps(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id); + +#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 9a639d69e7..bb0a41c703 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -5140,3 +5140,12 @@ bool mlme_get_user_ps(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id) return usr_ps_enable; } + +#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