Krunal Soni | 42e98ab | 2018-09-27 18:35:21 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | #include "wlan_policy_mgr_ucfg.h" |
| 19 | #include "wlan_policy_mgr_i.h" |
| 20 | #include "cfg_ucfg_api.h" |
| 21 | #include "wlan_policy_mgr_api.h" |
| 22 | |
| 23 | static QDF_STATUS policy_mgr_init_cfg(struct wlan_objmgr_psoc *psoc) |
| 24 | { |
| 25 | struct policy_mgr_psoc_priv_obj *pm_ctx; |
| 26 | struct policy_mgr_cfg *cfg; |
| 27 | |
| 28 | pm_ctx = policy_mgr_get_context(psoc); |
| 29 | if (!pm_ctx) { |
| 30 | policy_mgr_err("pm_ctx is NULL"); |
| 31 | return QDF_STATUS_E_FAILURE; |
| 32 | } |
| 33 | cfg = &pm_ctx->cfg; |
| 34 | |
| 35 | cfg->mcc_to_scc_switch = cfg_get(psoc, CFG_MCC_TO_SCC_SWITCH); |
| 36 | cfg->sys_pref = cfg_get(psoc, CFG_CONC_SYS_PREF); |
| 37 | cfg->max_conc_cxns = cfg_get(psoc, CFG_MAX_CONC_CXNS); |
| 38 | cfg->conc_rule1 = cfg_get(psoc, CFG_ENABLE_CONC_RULE1); |
| 39 | cfg->conc_rule2 = cfg_get(psoc, CFG_ENABLE_CONC_RULE2); |
| 40 | cfg->dbs_selection_plcy = cfg_get(psoc, CFG_DBS_SELECTION_PLCY); |
| 41 | cfg->vdev_priority_list = cfg_get(psoc, CFG_VDEV_CUSTOM_PRIORITY_LIST); |
| 42 | cfg->chnl_select_plcy = cfg_get(psoc, CFG_CHNL_SELECT_LOGIC_CONC); |
Krunal Soni | c9af406 | 2018-09-27 14:31:20 -0700 | [diff] [blame] | 43 | cfg->enable_mcc_adaptive_sch = |
| 44 | cfg_get(psoc, CFG_ENABLE_MCC_ADATIVE_SCH_ENABLED_NAME); |
Krunal Soni | dd8bf40 | 2018-09-27 17:34:25 -0700 | [diff] [blame] | 45 | cfg->enable_sta_cxn_5g_band = |
| 46 | cfg_get(psoc, CFG_ENABLE_STA_CONNECTION_IN_5GHZ); |
Krunal Soni | 1680e41 | 2018-12-07 19:42:06 +0800 | [diff] [blame] | 47 | cfg->allow_mcc_go_diff_bi = |
| 48 | cfg_get(psoc, CFG_ALLOW_MCC_GO_DIFF_BI); |
| 49 | cfg->enable_overlap_chnl = |
| 50 | cfg_get(psoc, CFG_ENABLE_OVERLAP_CH); |
| 51 | cfg->dual_mac_feature = |
| 52 | cfg_get(psoc, CFG_DUAL_MAC_FEATURE_DISABLE); |
| 53 | cfg->is_force_1x1_enable = |
| 54 | cfg_get(psoc, CFG_FORCE_1X1_FEATURE); |
| 55 | cfg->sta_sap_scc_on_dfs_chnl = |
| 56 | cfg_get(psoc, CFG_STA_SAP_SCC_ON_DFS_CHAN); |
| 57 | cfg->sta_sap_scc_on_lte_coex_chnl = |
| 58 | cfg_get(psoc, CFG_STA_SAP_SCC_ON_LTE_COEX_CHAN); |
| 59 | cfg->sap_mandatory_chnl_enable = |
| 60 | cfg_get(psoc, CFG_ENABLE_SAP_MANDATORY_CHAN_LIST); |
| 61 | cfg->mark_indoor_chnl_disable = |
| 62 | cfg_get(psoc, CFG_MARK_INDOOR_AS_DISABLE_FEATURE); |
Krunal Soni | 42e98ab | 2018-09-27 18:35:21 -0700 | [diff] [blame] | 63 | |
| 64 | return QDF_STATUS_SUCCESS; |
| 65 | } |
| 66 | |
| 67 | static void policy_mgr_deinit_cfg(struct wlan_objmgr_psoc *psoc) |
| 68 | { |
| 69 | struct policy_mgr_psoc_priv_obj *pm_ctx; |
| 70 | |
| 71 | pm_ctx = policy_mgr_get_context(psoc); |
| 72 | if (!pm_ctx) { |
| 73 | policy_mgr_err("pm_ctx is NULL"); |
| 74 | return; |
| 75 | } |
| 76 | |
| 77 | qdf_mem_zero(&pm_ctx->cfg, sizeof(pm_ctx->cfg)); |
| 78 | } |
| 79 | |
| 80 | QDF_STATUS ucfg_policy_mgr_psoc_open(struct wlan_objmgr_psoc *psoc) |
| 81 | { |
| 82 | QDF_STATUS status; |
| 83 | |
| 84 | status = policy_mgr_init_cfg(psoc); |
Wu Gao | d6b5e40 | 2018-12-03 22:09:24 +0800 | [diff] [blame^] | 85 | if (QDF_IS_STATUS_ERROR(status)) { |
Krunal Soni | 42e98ab | 2018-09-27 18:35:21 -0700 | [diff] [blame] | 86 | policy_mgr_err("pm_ctx is NULL"); |
| 87 | return status; |
| 88 | } |
Wu Gao | d6b5e40 | 2018-12-03 22:09:24 +0800 | [diff] [blame^] | 89 | |
| 90 | status = policy_mgr_psoc_open(psoc); |
| 91 | if (QDF_IS_STATUS_ERROR(status)) { |
| 92 | policy_mgr_err("psoc open fail"); |
| 93 | policy_mgr_psoc_close(psoc); |
| 94 | return status; |
| 95 | } |
| 96 | |
Krunal Soni | 42e98ab | 2018-09-27 18:35:21 -0700 | [diff] [blame] | 97 | return QDF_STATUS_SUCCESS; |
| 98 | } |
| 99 | |
| 100 | void ucfg_policy_mgr_psoc_close(struct wlan_objmgr_psoc *psoc) |
| 101 | { |
Wu Gao | d6b5e40 | 2018-12-03 22:09:24 +0800 | [diff] [blame^] | 102 | policy_mgr_psoc_close(psoc); |
Krunal Soni | 42e98ab | 2018-09-27 18:35:21 -0700 | [diff] [blame] | 103 | policy_mgr_deinit_cfg(psoc); |
| 104 | } |
| 105 | |
| 106 | QDF_STATUS ucfg_policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc, |
| 107 | uint8_t *mcc_scc_switch) |
| 108 | { |
| 109 | return policy_mgr_get_mcc_scc_switch(psoc, mcc_scc_switch); |
| 110 | } |
| 111 | |
| 112 | QDF_STATUS ucfg_policy_mgr_get_sys_pref(struct wlan_objmgr_psoc *psoc, |
| 113 | uint8_t *sys_pref) |
| 114 | { |
| 115 | return policy_mgr_get_sys_pref(psoc, sys_pref); |
| 116 | } |
| 117 | |
Krunal Soni | 6dd2208 | 2018-09-27 10:40:24 -0700 | [diff] [blame] | 118 | QDF_STATUS ucfg_policy_mgr_set_sys_pref(struct wlan_objmgr_psoc *psoc, |
| 119 | uint8_t sys_pref) |
| 120 | { |
| 121 | return policy_mgr_set_sys_pref(psoc, sys_pref); |
| 122 | } |
| 123 | |
Krunal Soni | 42e98ab | 2018-09-27 18:35:21 -0700 | [diff] [blame] | 124 | QDF_STATUS ucfg_policy_mgr_get_max_conc_cxns(struct wlan_objmgr_psoc *psoc, |
| 125 | uint8_t *max_conc_cxns) |
| 126 | { |
| 127 | return policy_mgr_get_max_conc_cxns(psoc, max_conc_cxns);; |
| 128 | } |
| 129 | |
| 130 | QDF_STATUS ucfg_policy_mgr_get_conc_rule1(struct wlan_objmgr_psoc *psoc, |
| 131 | uint8_t *conc_rule1) |
| 132 | { |
| 133 | return policy_mgr_get_conc_rule1(psoc, conc_rule1); |
| 134 | } |
| 135 | |
| 136 | QDF_STATUS ucfg_policy_mgr_get_conc_rule2(struct wlan_objmgr_psoc *psoc, |
| 137 | uint8_t *conc_rule2) |
| 138 | { |
| 139 | return policy_mgr_get_conc_rule2(psoc, conc_rule2); |
| 140 | } |
| 141 | |
| 142 | QDF_STATUS ucfg_policy_mgr_get_dbs_selection_plcy(struct wlan_objmgr_psoc *psoc, |
| 143 | uint32_t *dbs_selection_plcy) |
| 144 | { |
| 145 | return policy_mgr_get_dbs_selection_plcy(psoc, dbs_selection_plcy); |
| 146 | } |
| 147 | |
| 148 | QDF_STATUS ucfg_policy_mgr_get_vdev_priority_list(struct wlan_objmgr_psoc *psoc, |
| 149 | uint32_t *vdev_priority_list) |
| 150 | { |
| 151 | return policy_mgr_get_vdev_priority_list(psoc, vdev_priority_list); |
| 152 | } |
| 153 | |
| 154 | QDF_STATUS ucfg_policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc, |
| 155 | uint32_t *chnl_select_plcy) |
| 156 | { |
| 157 | return policy_mgr_get_chnl_select_plcy(psoc, chnl_select_plcy); |
| 158 | } |
Krunal Soni | c9af406 | 2018-09-27 14:31:20 -0700 | [diff] [blame] | 159 | |
| 160 | |
| 161 | QDF_STATUS ucfg_policy_mgr_get_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc, |
| 162 | uint8_t *mcc_adaptive_sch) |
| 163 | { |
| 164 | return policy_mgr_get_mcc_adaptive_sch(psoc, mcc_adaptive_sch); |
| 165 | } |
Krunal Soni | dd8bf40 | 2018-09-27 17:34:25 -0700 | [diff] [blame] | 166 | |
| 167 | QDF_STATUS ucfg_policy_mgr_get_sta_cxn_5g_band(struct wlan_objmgr_psoc *psoc, |
| 168 | uint8_t *enable_sta_cxn_5g_band) |
| 169 | { |
| 170 | return policy_mgr_get_sta_cxn_5g_band(psoc, enable_sta_cxn_5g_band); |
| 171 | } |
Krunal Soni | 1680e41 | 2018-12-07 19:42:06 +0800 | [diff] [blame] | 172 | |
| 173 | QDF_STATUS |
| 174 | ucfg_policy_mgr_get_allow_mcc_go_diff_bi(struct wlan_objmgr_psoc *psoc, |
| 175 | uint8_t *allow_mcc_go_diff_bi) |
| 176 | { |
| 177 | return policy_mgr_get_allow_mcc_go_diff_bi(psoc, allow_mcc_go_diff_bi); |
| 178 | } |
| 179 | |
| 180 | QDF_STATUS |
| 181 | ucfg_policy_mgr_get_enable_overlap_chnl(struct wlan_objmgr_psoc *psoc, |
| 182 | uint8_t *enable_overlap_chnl) |
| 183 | { |
| 184 | return policy_mgr_get_enable_overlap_chnl(psoc, enable_overlap_chnl); |
| 185 | } |
| 186 | |
| 187 | QDF_STATUS ucfg_policy_mgr_get_dual_mac_feature(struct wlan_objmgr_psoc *psoc, |
| 188 | uint8_t *dual_mac_feature) |
| 189 | { |
| 190 | return policy_mgr_get_dual_mac_feature(psoc, dual_mac_feature); |
| 191 | } |
| 192 | |
| 193 | QDF_STATUS ucfg_policy_mgr_get_force_1x1(struct wlan_objmgr_psoc *psoc, |
| 194 | uint8_t *force_1x1) |
| 195 | { |
| 196 | return policy_mgr_get_force_1x1(psoc, force_1x1); |
| 197 | } |
| 198 | |
| 199 | QDF_STATUS |
| 200 | ucfg_policy_mgr_get_sta_sap_scc_on_dfs_chnl(struct wlan_objmgr_psoc *psoc, |
| 201 | uint8_t *sta_sap_scc_on_dfs_chnl) |
| 202 | { |
| 203 | return policy_mgr_get_sta_sap_scc_on_dfs_chnl(psoc, |
| 204 | sta_sap_scc_on_dfs_chnl); |
| 205 | } |
| 206 | |
| 207 | QDF_STATUS |
| 208 | ucfg_policy_mgr_get_sta_sap_scc_lte_coex_chnl(struct wlan_objmgr_psoc *psoc, |
| 209 | uint8_t *sta_sap_scc_lte_coex) |
| 210 | { |
| 211 | return policy_mgr_get_sta_sap_scc_lte_coex_chnl(psoc, |
| 212 | sta_sap_scc_lte_coex); |
| 213 | } |
| 214 | |
| 215 | QDF_STATUS ucfg_policy_mgr_get_sap_mandt_chnl(struct wlan_objmgr_psoc *psoc, |
| 216 | uint8_t *sap_mandt_chnl) |
| 217 | { |
| 218 | return policy_mgr_get_sap_mandt_chnl(psoc, sap_mandt_chnl); |
| 219 | } |
| 220 | |
| 221 | QDF_STATUS |
| 222 | ucfg_policy_mgr_get_indoor_chnl_marking(struct wlan_objmgr_psoc *psoc, |
| 223 | uint8_t *indoor_chnl_marking) |
| 224 | { |
| 225 | return policy_mgr_get_indoor_chnl_marking(psoc, indoor_chnl_marking); |
| 226 | } |