From b52dadc0b5f65d908c48ba0d275c6c30aa05f4f4 Mon Sep 17 00:00:00 2001 From: Alan Chen Date: Wed, 27 Jan 2021 13:56:52 -0800 Subject: [PATCH] qcacld-3.0: Split SAP and GO modes ini Rename existing INI to enable_bus_suspend_in_sap_mode and define a new enable_bus_suspend_in_go_mode. Also define new APIs wma_is_vdev_in_sap_mode and wma_is_vdev_in_go_mode. Change-Id: If38c4db7b3d1f7323df45d9a7d80a02a44e7ca41 CRs-Fixed: 2864596 --- components/pmo/core/src/wlan_pmo_main.c | 6 +- .../pmo/dispatcher/inc/wlan_pmo_common_cfg.h | 51 ++++++++--- .../inc/wlan_pmo_common_public_struct.h | 3 +- .../pmo/dispatcher/inc/wlan_pmo_ucfg_api.h | 16 +++- .../pmo/dispatcher/src/wlan_pmo_ucfg_api.c | 11 ++- core/wma/src/wma_dev_if.c | 89 ++++++++++++++++--- 6 files changed, 144 insertions(+), 32 deletions(-) diff --git a/components/pmo/core/src/wlan_pmo_main.c b/components/pmo/core/src/wlan_pmo_main.c index 67458c20b8..aafa93f758 100644 --- a/components/pmo/core/src/wlan_pmo_main.c +++ b/components/pmo/core/src/wlan_pmo_main.c @@ -206,8 +206,10 @@ static void wlan_pmo_init_cfg(struct wlan_objmgr_psoc *psoc, psoc_cfg->power_save_mode = cfg_get(psoc, CFG_PMO_POWERSAVE_MODE); psoc_cfg->is_mod_dtim_on_sys_suspend_enabled = cfg_get(psoc, CFG_PMO_MOD_DTIM_ON_SYS_SUSPEND); - psoc_cfg->is_bus_suspend_enabled_in_beaconing_mode = - cfg_get(psoc, CFG_ENABLE_BUS_SUSPEND_IN_BEACONING_MODE); + psoc_cfg->is_bus_suspend_enabled_in_sap_mode = + cfg_get(psoc, CFG_ENABLE_BUS_SUSPEND_IN_SAP_MODE); + psoc_cfg->is_bus_suspend_enabled_in_go_mode = + cfg_get(psoc, CFG_ENABLE_BUS_SUSPEND_IN_GO_MODE); psoc_cfg->default_power_save_mode = psoc_cfg->power_save_mode; psoc_cfg->max_ps_poll = cfg_get(psoc, CFG_PMO_MAX_PS_POLL); diff --git a/components/pmo/dispatcher/inc/wlan_pmo_common_cfg.h b/components/pmo/dispatcher/inc/wlan_pmo_common_cfg.h index 8fd2d8f271..5af49a4777 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_common_cfg.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_common_cfg.h @@ -406,19 +406,19 @@ /* * - * enable_bus_suspend_in_beaconing_mode - enable PCIe bus suspend as part of - * platform system suspend for SAP/P2PGO/NDP with one or more clients connected + * enable_bus_suspend_in_sap_mode - enable PCIe bus suspend as part of + * platform system suspend for SAP with one or more clients connected * @Min: 0 * @Max: 1 * @Default: 0 * * This ini is used to PCIe bus suspend as part of platform system suspend for - * SAP/P2PGO/NDP with one or more clients connected + * SAP with one or more clients connected * - * 0: PCIe Bus suspend is not supported in beaconing mode (SAP/P2PGO/NDP) with - * one or more clients connected - * 1: PCIe Bus suspend is supported in beaconing mode (SAP/P2PGO/NDP) with one - * or more clients connected + * 0: PCIe Bus suspend is not supported in SAP mode with one or more clients + * connected + * 1: PCIe Bus suspend is supported in SAP mode with one or more clients + * connected * Related: None * * Supported Feature: Power Save @@ -427,10 +427,38 @@ * * */ -#define CFG_ENABLE_BUS_SUSPEND_IN_BEACONING_MODE CFG_INI_BOOL( \ - "enable_bus_suspend_in_beaconing_mode", \ +#define CFG_ENABLE_BUS_SUSPEND_IN_SAP_MODE CFG_INI_BOOL( \ + "enable_bus_suspend_in_sap_mode", \ 0, \ - "This ini is used to enable bus suspend in beaconing mode") + "This ini is used to enable bus suspend in SAP mode") + +/* + * + * enable_bus_suspend_in_go_mode - enable PCIe bus suspend as part of + * platform system suspend for P2PGO with one or more clients connected + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used to PCIe bus suspend as part of platform system suspend for + * P2PGO with one or more clients connected + * + * 0: PCIe Bus suspend is not supported in P2PGO mode with one or more clients + * connected + * 1: PCIe Bus suspend is supported in P2PGO mode with one or more clients + * connected + * Related: None + * + * Supported Feature: Power Save + * + * Usage: Internal + * + * + */ +#define CFG_ENABLE_BUS_SUSPEND_IN_GO_MODE CFG_INI_BOOL( \ + "enable_bus_suspend_in_go_mode", \ + 0, \ + "This ini is used to enable bus suspend in P2PGO mode") #define CFG_PMO_COMMON_ALL \ CFG(CFG_ENABLE_SAP_SUSPEND) \ @@ -449,6 +477,7 @@ CFG(CFG_PMO_WOW_DATA_INACTIVITY_TIMEOUT) \ CFG(CFG_RA_RATE_LIMIT_INTERVAL) \ CFG(CFG_PMO_MOD_DTIM_ON_SYS_SUSPEND) \ - CFG(CFG_ENABLE_BUS_SUSPEND_IN_BEACONING_MODE) + CFG(CFG_ENABLE_BUS_SUSPEND_IN_SAP_MODE) \ + CFG(CFG_ENABLE_BUS_SUSPEND_IN_GO_MODE) #endif /* WLAN_PMO_COMMON_CFG_H__ */ diff --git a/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h b/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h index 00c6decc85..3b4aab7e7a 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h @@ -390,7 +390,8 @@ struct pmo_psoc_cfg { enum active_apf_mode active_mc_bc_apf_mode; uint8_t ito_repeat_count; bool is_mod_dtim_on_sys_suspend_enabled; - bool is_bus_suspend_enabled_in_beaconing_mode; + bool is_bus_suspend_enabled_in_sap_mode; + bool is_bus_suspend_enabled_in_go_mode; #ifdef WLAN_ENABLE_GPIO_WAKEUP bool enable_gpio_wakeup; uint32_t gpio_wakeup_pin; diff --git a/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h b/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h index 26afb3ff1d..98b1549f28 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_ucfg_api.h @@ -2029,13 +2029,23 @@ bool ucfg_pmo_get_enable_sap_suspend(struct wlan_objmgr_psoc *psoc); /** - * ucfg_pmo_get_beacoing_mode_bus_suspend() - get PMO config for PCIe bus - * suspend in beaconing mode (SAP/P2PGO/NDP) with one or more clients + * ucfg_pmo_get_sap_mode_bus_suspend() - get PMO config for PCIe bus + * suspend in SAP mode with one or more clients * @psoc: pointer to psoc object * * Return: bool */ bool -ucfg_pmo_get_beaconing_mode_bus_suspend(struct wlan_objmgr_psoc *psoc); +ucfg_pmo_get_sap_mode_bus_suspend(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_pmo_get_go_mode_bus_suspend() - get PMO config for PCIe bus + * suspend in P2PGO mode with one or more clients + * @psoc: pointer to psoc object + * + * Return: bool + */ +bool +ucfg_pmo_get_go_mode_bus_suspend(struct wlan_objmgr_psoc *psoc); #endif /* end of _WLAN_PMO_UCFG_API_H_ */ diff --git a/components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c b/components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c index 767895ebdf..c90d9e483c 100644 --- a/components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c +++ b/components/pmo/dispatcher/src/wlan_pmo_ucfg_api.c @@ -895,10 +895,17 @@ ucfg_pmo_get_gpio_wakeup_mode(struct wlan_objmgr_psoc *psoc) #endif bool -ucfg_pmo_get_beaconing_mode_bus_suspend(struct wlan_objmgr_psoc *psoc) +ucfg_pmo_get_sap_mode_bus_suspend(struct wlan_objmgr_psoc *psoc) { struct pmo_psoc_priv_obj *pmo_psoc_ctx = pmo_psoc_get_priv(psoc); - return pmo_psoc_ctx->psoc_cfg.is_bus_suspend_enabled_in_beaconing_mode; + return pmo_psoc_ctx->psoc_cfg.is_bus_suspend_enabled_in_sap_mode; } +bool +ucfg_pmo_get_go_mode_bus_suspend(struct wlan_objmgr_psoc *psoc) +{ + struct pmo_psoc_priv_obj *pmo_psoc_ctx = pmo_psoc_get_priv(psoc); + + return pmo_psoc_ctx->psoc_cfg.is_bus_suspend_enabled_in_go_mode; +} diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index b0f7410465..dd421b6183 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -4731,12 +4731,44 @@ static bool wma_add_sta_allow_sta_mode_vote_link(uint8_t oper_mode) } #endif /* FEATURE_STA_MODE_VOTE_LINK */ +static bool wma_is_vdev_in_sap_mode(tp_wma_handle wma, uint8_t vdev_id) +{ + struct wma_txrx_node *intf = wma->interfaces; + + if (vdev_id >= wma->max_bssid) { + wma_err("Invalid vdev_id %hu", vdev_id); + QDF_ASSERT(0); + return false; + } + + if ((intf[vdev_id].type == WMI_VDEV_TYPE_AP) && + (intf[vdev_id].sub_type == 0)) + return true; + + return false; +} + +static bool wma_is_vdev_in_go_mode(tp_wma_handle wma, uint8_t vdev_id) +{ + struct wma_txrx_node *intf = wma->interfaces; + + if (vdev_id >= wma->max_bssid) { + wma_err("Invalid vdev_id %hu", vdev_id); + QDF_ASSERT(0); + return false; + } + + if ((intf[vdev_id].type == WMI_VDEV_TYPE_AP) && + (intf[vdev_id].sub_type == WMI_UNIFIED_VDEV_SUBTYPE_P2P_GO)) + return true; + + return false; +} + void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta) { uint8_t oper_mode = BSS_OPERATIONAL_MODE_STA; void *htc_handle; - bool is_bus_suspend_allowed_in_beaconing_mode = - ucfg_pmo_get_beaconing_mode_bus_suspend(wma->psoc); htc_handle = lmac_get_htc_hdl(wma->psoc); if (!htc_handle) { @@ -4765,13 +4797,30 @@ void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta) break; } - /* handle wow for sap/p2pgo with 1 or more peer in same way */ - if (BSS_OPERATIONAL_MODE_AP == oper_mode) { - wma_debug("disable runtime pm and bus suspend: %d", - is_bus_suspend_allowed_in_beaconing_mode); - if (!is_bus_suspend_allowed_in_beaconing_mode) + /* handle wow for sap with 1 or more peer in same way */ + if (wma_is_vdev_in_sap_mode(wma, add_sta->smesessionId)) { + bool is_bus_suspend_allowed_in_sap_mode = + ucfg_pmo_get_sap_mode_bus_suspend(wma->psoc); + wma_info("sap mode: disable runtime pm and bus suspend: %d", + is_bus_suspend_allowed_in_sap_mode); + if (!is_bus_suspend_allowed_in_sap_mode) htc_vote_link_up(htc_handle); wma_sap_prevent_runtime_pm(wma); + + return; + } + + /* handle wow for p2pgo with 1 or more peer in same way */ + if (wma_is_vdev_in_go_mode(wma, add_sta->smesessionId)) { + bool is_bus_suspend_allowed_in_go_mode = + ucfg_pmo_get_go_mode_bus_suspend(wma->psoc); + wma_info("p2pgo mode: disable runtime pm and bus suspend: %d", + is_bus_suspend_allowed_in_go_mode); + if (!is_bus_suspend_allowed_in_go_mode) + htc_vote_link_up(htc_handle); + wma_sap_prevent_runtime_pm(wma); + + return; } /* handle wow for nan with 1 or more peer in same way */ @@ -4791,8 +4840,6 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta) uint8_t smesession_id = del_sta->smesessionId; bool rsp_requested = del_sta->respReqd; void *htc_handle; - bool is_bus_suspend_allowed_in_beaconing_mode = - ucfg_pmo_get_beaconing_mode_bus_suspend(wma->psoc); htc_handle = lmac_get_htc_hdl(wma->psoc); if (!htc_handle) { @@ -4840,12 +4887,28 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta) qdf_mem_free(del_sta); } - if (BSS_OPERATIONAL_MODE_AP == oper_mode) { - wma_debug("allow runtime pm and bus suspend: %d", - is_bus_suspend_allowed_in_beaconing_mode); - if (!is_bus_suspend_allowed_in_beaconing_mode) + if (wma_is_vdev_in_sap_mode(wma, del_sta->smesessionId)) { + bool is_bus_suspend_allowed_in_sap_mode = + ucfg_pmo_get_sap_mode_bus_suspend(wma->psoc); + wma_info("sap mode: allow runtime pm and bus suspend: %d", + is_bus_suspend_allowed_in_sap_mode); + if (!is_bus_suspend_allowed_in_sap_mode) htc_vote_link_down(htc_handle); wma_sap_allow_runtime_pm(wma); + + return; + } + + if (wma_is_vdev_in_go_mode(wma, del_sta->smesessionId)) { + bool is_bus_suspend_allowed_in_go_mode = + ucfg_pmo_get_go_mode_bus_suspend(wma->psoc); + wma_info("p2pgo mode: allow runtime pm and bus suspend: %d", + is_bus_suspend_allowed_in_go_mode); + if (!is_bus_suspend_allowed_in_go_mode) + htc_vote_link_down(htc_handle); + wma_sap_allow_runtime_pm(wma); + + return; } if (BSS_OPERATIONAL_MODE_NDI == oper_mode) {