From 8ed3d20d7545eb2345ac808541c5b66b24d8f512 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Mon, 27 Apr 2020 18:50:36 +0800 Subject: [PATCH] qcacld-3.0: Add API policy_mgr_get_can_skip_radar_event Dfs radar processing function dfs_process_radar_ind is called in interrupt context. Add new API policy_mgr_get_can_skip_radar_event to be called in interrupt context to get radar skip flag. The policy_mgr_get_dfs_master_dynamic_enabled will acquire mutex and can't be called in interrupt context. Change-Id: I1a3ce8536465d6f6da86b0cf7312e6430ea8ec89 CRs-Fixed: 2672701 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 14 ++++ .../src/wlan_policy_mgr_get_set_utils.c | 67 ++++++++++++++++--- .../policy_mgr/src/wlan_policy_mgr_i.h | 2 + 3 files changed, 72 insertions(+), 11 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 6ba166eb5c8e..4f5fd716003f 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 @@ -216,6 +216,20 @@ bool policy_mgr_get_dfs_master_dynamic_enabled(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id); +/** + * policy_mgr_get_can_skip_radar_event - Can skip DFS Radar event or not + * @psoc: soc obj + * @vdev_id: sap vdev id + * + * This API is used by dfs component to get decision whether to ignore + * the radar event or not. + * + * Return: true if Radar event should be ignored. + */ +bool +policy_mgr_get_can_skip_radar_event(struct wlan_objmgr_psoc *psoc, + uint8_t vdev_id); + /** * policy_mgr_get_sta_sap_scc_lte_coex_chnl() - to find out if STA & SAP * SCC is allowed on LTE COEX 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 0f0efcb79f27..629868899532 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 @@ -133,15 +133,15 @@ policy_mgr_get_sta_sap_scc_on_dfs_chnl(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } -bool -policy_mgr_get_dfs_master_dynamic_enabled( +static bool +policy_mgr_update_dfs_master_dynamic_enabled( struct wlan_objmgr_psoc *psoc, uint8_t vdev_id) { struct policy_mgr_psoc_priv_obj *pm_ctx; bool sta_on_5g = false; bool sta_on_2g = false; uint32_t i; - bool enable; + bool enable = true; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -149,16 +149,21 @@ policy_mgr_get_dfs_master_dynamic_enabled( return true; } - if (!pm_ctx->cfg.sta_sap_scc_on_dfs_chnl) - return true; + if (!pm_ctx->cfg.sta_sap_scc_on_dfs_chnl) { + enable = true; + goto end; + } if (pm_ctx->cfg.sta_sap_scc_on_dfs_chnl == - PM_STA_SAP_ON_DFS_MASTER_MODE_DISABLED) - return false; + PM_STA_SAP_ON_DFS_MASTER_MODE_DISABLED) { + enable = false; + goto end; + } if (pm_ctx->cfg.sta_sap_scc_on_dfs_chnl != PM_STA_SAP_ON_DFS_MASTER_MODE_FLEX) { policy_mgr_debug("sta_sap_scc_on_dfs_chnl %d unknown", pm_ctx->cfg.sta_sap_scc_on_dfs_chnl); - return true; + enable = true; + goto end; } qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); @@ -181,13 +186,46 @@ policy_mgr_get_dfs_master_dynamic_enabled( enable = true; else enable = false; - policy_mgr_debug("sta_sap_scc_on_dfs_chnl %d sta_on_2g %d sta_on_5g %d enable %d", - pm_ctx->cfg.sta_sap_scc_on_dfs_chnl, sta_on_2g, - sta_on_5g, enable); +end: + pm_ctx->dynamic_dfs_master_disabled = !enable; + if (!enable) + policy_mgr_debug("sta_sap_scc_on_dfs_chnl %d sta_on_2g %d sta_on_5g %d enable %d", + pm_ctx->cfg.sta_sap_scc_on_dfs_chnl, sta_on_2g, + sta_on_5g, enable); return enable; } +bool +policy_mgr_get_dfs_master_dynamic_enabled( + struct wlan_objmgr_psoc *psoc, uint8_t vdev_id) +{ + struct policy_mgr_psoc_priv_obj *pm_ctx; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("pm_ctx is NULL"); + return true; + } + + return policy_mgr_update_dfs_master_dynamic_enabled(psoc, vdev_id); +} + +bool +policy_mgr_get_can_skip_radar_event(struct wlan_objmgr_psoc *psoc, + uint8_t vdev_id) +{ + struct policy_mgr_psoc_priv_obj *pm_ctx; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("pm_ctx is NULL"); + return false; + } + + return pm_ctx->dynamic_dfs_master_disabled; +} + QDF_STATUS policy_mgr_get_sta_sap_scc_lte_coex_chnl(struct wlan_objmgr_psoc *psoc, uint8_t *sta_sap_scc_lte_coex) @@ -1741,6 +1779,9 @@ void policy_mgr_incr_active_session(struct wlan_objmgr_psoc *psoc, if (mode == QDF_SAP_MODE) policy_mgr_init_ap_6ghz_capable(psoc, session_id, conn_6ghz_flag); + if (mode == QDF_SAP_MODE || mode == QDF_P2P_GO_MODE || + mode == QDF_STA_MODE || mode == QDF_P2P_CLIENT_MODE) + policy_mgr_update_dfs_master_dynamic_enabled(psoc, session_id); policy_mgr_dump_current_concurrency(psoc); @@ -1860,6 +1901,10 @@ QDF_STATUS policy_mgr_decr_active_session(struct wlan_objmgr_psoc *psoc, if (mode == QDF_STA_MODE || mode == QDF_P2P_CLIENT_MODE) pm_ctx->do_sap_unsafe_ch_check = true; + if (mode == QDF_SAP_MODE || mode == QDF_P2P_GO_MODE || + mode == QDF_STA_MODE || mode == QDF_P2P_CLIENT_MODE) + policy_mgr_update_dfs_master_dynamic_enabled(psoc, session_id); + return qdf_status; } diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h index ad85f920e7f1..2a81e3f6d9f0 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h @@ -335,6 +335,7 @@ struct policy_mgr_cfg { * @user_config_sap_ch_freq: SAP channel freq configured by user application * @cfg: Policy manager config data * @dynamic_mcc_adaptive_sched: disable/enable mcc adaptive scheduler feature + * @dynamic_dfs_master_disabled: current state of dynamic dfs master * @dual_mac_configuration_complete_evt: qdf event to synchronize dual mac * configuration setting */ @@ -378,6 +379,7 @@ struct policy_mgr_psoc_priv_obj { uint32_t valid_ch_freq_list[NUM_CHANNELS]; uint32_t valid_ch_freq_list_count; bool dynamic_mcc_adaptive_sched; + bool dynamic_dfs_master_disabled; qdf_event_t dual_mac_configuration_complete_evt; };