xref: /wlan-driver/qcacld-3.0/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef WLAN_POLICY_MGR_I_H
21 #define WLAN_POLICY_MGR_I_H
22 
23 #include "wlan_policy_mgr_api.h"
24 #include "qdf_event.h"
25 #include "qdf_mc_timer.h"
26 #include "qdf_lock.h"
27 #include "qdf_defer.h"
28 #include "wlan_reg_services_api.h"
29 #include "cds_ieee80211_common_i.h"
30 #include "qdf_delayed_work.h"
31 #define DBS_OPPORTUNISTIC_TIME   5
32 
33 #define POLICY_MGR_SER_CMD_TIMEOUT 4000
34 
35 #ifdef QCA_WIFI_3_0_EMU
36 #define CONNECTION_UPDATE_TIMEOUT (POLICY_MGR_SER_CMD_TIMEOUT + 3000)
37 #else
38 #define CONNECTION_UPDATE_TIMEOUT (POLICY_MGR_SER_CMD_TIMEOUT + 2000)
39 #endif
40 
41 #define PM_24_GHZ_CH_FREQ_6   (2437)
42 #define PM_5_GHZ_CH_FREQ_36   (5180)
43 #define CHANNEL_SWITCH_COMPLETE_TIMEOUT   (2000)
44 #define MAX_NOA_TIME (3000)
45 
46 /* Defer SAP force SCC check by 2000ms due to another SAP/GO start AP in
47  * progress
48  */
49 #define SAP_CONC_CHECK_DEFER_TIMEOUT_MS (2000)
50 
51 /*
52  * Policy Mgr hardware mode list bit-mask definitions.
53  * Bits 4:0, 31:29 are unused.
54  *
55  * The below definitions are added corresponding to WMI DBS HW mode
56  * list to make it independent of firmware changes for WMI definitions.
57  * Currently these definitions have dependency with BIT positions of
58  * the existing WMI macros. Thus, if the BIT positions are changed for
59  * WMI macros, then these macros' BIT definitions are also need to be
60  * changed.
61  */
62 #define POLICY_MGR_HW_MODE_EMLSR_MODE_BITPOS       (32)
63 #define POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_BITPOS  (28)
64 #define POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_BITPOS  (24)
65 #define POLICY_MGR_HW_MODE_MAC1_TX_STREAMS_BITPOS  (20)
66 #define POLICY_MGR_HW_MODE_MAC1_RX_STREAMS_BITPOS  (16)
67 #define POLICY_MGR_HW_MODE_MAC0_BANDWIDTH_BITPOS   (12)
68 #define POLICY_MGR_HW_MODE_MAC1_BANDWIDTH_BITPOS   (8)
69 #define POLICY_MGR_HW_MODE_DBS_MODE_BITPOS         (7)
70 #define POLICY_MGR_HW_MODE_AGILE_DFS_MODE_BITPOS   (6)
71 #define POLICY_MGR_HW_MODE_SBS_MODE_BITPOS         (5)
72 #define POLICY_MGR_HW_MODE_MAC0_BAND_BITPOS        (3)
73 #define POLICY_MGR_HW_MODE_ID_BITPOS               (0)
74 
75 #define POLICY_MGR_HW_MODE_EMLSR_MODE_MASK         \
76 	(0x1 << POLICY_MGR_HW_MODE_EMLSR_MODE_BITPOS)
77 #define POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_MASK    \
78 	(0xf << POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_BITPOS)
79 #define POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_MASK    \
80 	(0xf << POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_BITPOS)
81 #define POLICY_MGR_HW_MODE_MAC1_TX_STREAMS_MASK    \
82 	(0xf << POLICY_MGR_HW_MODE_MAC1_TX_STREAMS_BITPOS)
83 #define POLICY_MGR_HW_MODE_MAC1_RX_STREAMS_MASK    \
84 	(0xf << POLICY_MGR_HW_MODE_MAC1_RX_STREAMS_BITPOS)
85 #define POLICY_MGR_HW_MODE_MAC0_BANDWIDTH_MASK     \
86 	(0xf << POLICY_MGR_HW_MODE_MAC0_BANDWIDTH_BITPOS)
87 #define POLICY_MGR_HW_MODE_MAC1_BANDWIDTH_MASK     \
88 	(0xf << POLICY_MGR_HW_MODE_MAC1_BANDWIDTH_BITPOS)
89 #define POLICY_MGR_HW_MODE_DBS_MODE_MASK           \
90 	(0x1 << POLICY_MGR_HW_MODE_DBS_MODE_BITPOS)
91 #define POLICY_MGR_HW_MODE_AGILE_DFS_MODE_MASK     \
92 	(0x1 << POLICY_MGR_HW_MODE_AGILE_DFS_MODE_BITPOS)
93 #define POLICY_MGR_HW_MODE_SBS_MODE_MASK           \
94 	(0x1 << POLICY_MGR_HW_MODE_SBS_MODE_BITPOS)
95 #define POLICY_MGR_HW_MODE_MAC0_BAND_MASK           \
96 			(0x3 << POLICY_MGR_HW_MODE_MAC0_BAND_BITPOS)
97 #define POLICY_MGR_HW_MODE_ID_MASK           \
98 			(0x7 << POLICY_MGR_HW_MODE_ID_BITPOS)
99 
100 #define POLICY_MGR_HW_MODE_EMLSR_MODE_SET(hw_mode, tmp, value) \
101 	QDF_SET_BITS64(hw_mode, tmp, POLICY_MGR_HW_MODE_EMLSR_MODE_BITPOS,\
102 	1, value)
103 #define POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_SET(hw_mode, value) \
104 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_BITPOS,\
105 	4, value)
106 #define POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_SET(hw_mode, value) \
107 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_BITPOS,\
108 	4, value)
109 #define POLICY_MGR_HW_MODE_MAC1_TX_STREAMS_SET(hw_mode, value) \
110 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_MAC1_TX_STREAMS_BITPOS,\
111 	4, value)
112 #define POLICY_MGR_HW_MODE_MAC1_RX_STREAMS_SET(hw_mode, value) \
113 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_MAC1_RX_STREAMS_BITPOS,\
114 	4, value)
115 #define POLICY_MGR_HW_MODE_MAC0_BANDWIDTH_SET(hw_mode, value)  \
116 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_MAC0_BANDWIDTH_BITPOS,\
117 	4, value)
118 #define POLICY_MGR_HW_MODE_MAC1_BANDWIDTH_SET(hw_mode, value)  \
119 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_MAC1_BANDWIDTH_BITPOS,\
120 	4, value)
121 #define POLICY_MGR_HW_MODE_DBS_MODE_SET(hw_mode, value)        \
122 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_DBS_MODE_BITPOS,\
123 	1, value)
124 #define POLICY_MGR_HW_MODE_AGILE_DFS_SET(hw_mode, value)       \
125 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_AGILE_DFS_MODE_BITPOS,\
126 	1, value)
127 #define POLICY_MGR_HW_MODE_SBS_MODE_SET(hw_mode, value)        \
128 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_SBS_MODE_BITPOS,\
129 	1, value)
130 #define POLICY_MGR_HW_MODE_MAC0_BAND_SET(hw_mode, value)        \
131 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_MAC0_BAND_BITPOS,\
132 	2, value)
133 #define POLICY_MGR_HW_MODE_ID_SET(hw_mode, value)        \
134 	WMI_SET_BITS(hw_mode, POLICY_MGR_HW_MODE_ID_BITPOS,\
135 	3, value)
136 
137 #define POLICY_MGR_HW_MODE_EMLSR_MODE_GET(hw_mode)                     \
138 		QDF_GET_BITS64(hw_mode, POLICY_MGR_HW_MODE_EMLSR_MODE_BITPOS,\
139 		1)
140 #define POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_GET(hw_mode)                \
141 		(((hw_mode) & POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_MASK) >>    \
142 		POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_BITPOS)
143 #define POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_GET(hw_mode)                \
144 		(((hw_mode) & POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_MASK) >>    \
145 		POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_BITPOS)
146 #define POLICY_MGR_HW_MODE_MAC1_TX_STREAMS_GET(hw_mode)                \
147 		(((hw_mode) & POLICY_MGR_HW_MODE_MAC1_TX_STREAMS_MASK) >>    \
148 		POLICY_MGR_HW_MODE_MAC1_TX_STREAMS_BITPOS)
149 #define POLICY_MGR_HW_MODE_MAC1_RX_STREAMS_GET(hw_mode)                \
150 		(((hw_mode) & POLICY_MGR_HW_MODE_MAC1_RX_STREAMS_MASK) >>    \
151 		POLICY_MGR_HW_MODE_MAC1_RX_STREAMS_BITPOS)
152 #define POLICY_MGR_HW_MODE_MAC0_BANDWIDTH_GET(hw_mode)                 \
153 		(((hw_mode) & POLICY_MGR_HW_MODE_MAC0_BANDWIDTH_MASK) >>     \
154 		POLICY_MGR_HW_MODE_MAC0_BANDWIDTH_BITPOS)
155 #define POLICY_MGR_HW_MODE_MAC1_BANDWIDTH_GET(hw_mode)                 \
156 		(((hw_mode) & POLICY_MGR_HW_MODE_MAC1_BANDWIDTH_MASK) >>     \
157 		POLICY_MGR_HW_MODE_MAC1_BANDWIDTH_BITPOS)
158 #define POLICY_MGR_HW_MODE_DBS_MODE_GET(hw_mode)                       \
159 		(((hw_mode) & POLICY_MGR_HW_MODE_DBS_MODE_MASK) >>           \
160 		POLICY_MGR_HW_MODE_DBS_MODE_BITPOS)
161 #define POLICY_MGR_HW_MODE_AGILE_DFS_GET(hw_mode)                      \
162 		(((hw_mode) & POLICY_MGR_HW_MODE_AGILE_DFS_MODE_MASK) >>     \
163 		POLICY_MGR_HW_MODE_AGILE_DFS_MODE_BITPOS)
164 #define POLICY_MGR_HW_MODE_SBS_MODE_GET(hw_mode)                       \
165 		(((hw_mode) & POLICY_MGR_HW_MODE_SBS_MODE_MASK) >>           \
166 		POLICY_MGR_HW_MODE_SBS_MODE_BITPOS)
167 #define POLICY_MGR_HW_MODE_MAC0_BAND_GET(hw_mode)                       \
168 		(((hw_mode) & POLICY_MGR_HW_MODE_MAC0_BAND_MASK) >> \
169 		POLICY_MGR_HW_MODE_MAC0_BAND_BITPOS)
170 #define POLICY_MGR_HW_MODE_ID_GET(hw_mode)                       \
171 		(((hw_mode) & POLICY_MGR_HW_MODE_ID_MASK) >> \
172 		POLICY_MGR_HW_MODE_ID_BITPOS)
173 
174 #define POLICY_MGR_DEFAULT_HW_MODE_INDEX 0xFFFF
175 
176 #define policy_mgr_alert(params...) \
177 	QDF_TRACE_FATAL(QDF_MODULE_ID_POLICY_MGR, params)
178 #define policy_mgr_err(params...) \
179 	QDF_TRACE_ERROR(QDF_MODULE_ID_POLICY_MGR, params)
180 #define policy_mgr_warn(params...) \
181 	QDF_TRACE_WARN(QDF_MODULE_ID_POLICY_MGR, params)
182 #define policy_mgr_notice(params...) \
183 	QDF_TRACE_INFO(QDF_MODULE_ID_POLICY_MGR, params)
184 #define policy_mgr_info(params...) \
185 	QDF_TRACE_INFO(QDF_MODULE_ID_POLICY_MGR, params)
186 #define policy_mgr_debug(params...) \
187 	QDF_TRACE_DEBUG(QDF_MODULE_ID_POLICY_MGR, params)
188 
189 #define policymgr_nofl_alert(params...) \
190 	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_POLICY_MGR, params)
191 #define policymgr_nofl_err(params...) \
192 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_POLICY_MGR, params)
193 #define policymgr_nofl_warn(params...) \
194 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_POLICY_MGR, params)
195 #define policymgr_nofl_info(params...) \
196 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_POLICY_MGR, params)
197 #define policymgr_nofl_debug(params...) \
198 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_POLICY_MGR, params)
199 
200 #define policy_mgr_rl_debug(params...) \
201 	QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_POLICY_MGR, params)
202 
203 #define PM_CONC_CONNECTION_LIST_VALID_INDEX(index) \
204 		((MAX_NUMBER_OF_CONC_CONNECTIONS > index) && \
205 			(pm_conc_connection_list[index].in_use))
206 
207 extern struct policy_mgr_conc_connection_info
208 	pm_conc_connection_list[MAX_NUMBER_OF_CONC_CONNECTIONS];
209 
210 #ifdef WLAN_FEATURE_11BE_MLO
211 extern struct policy_mgr_disabled_ml_link_info
212 	pm_disabled_ml_links[MAX_NUMBER_OF_DISABLE_LINK];
213 #endif
214 
215 extern const enum policy_mgr_pcl_type
216 	first_connection_pcl_table[PM_MAX_NUM_OF_MODE]
217 			[PM_MAX_CONC_PRIORITY_MODE];
218 extern  pm_dbs_pcl_second_connection_table_type
219 	*second_connection_pcl_dbs_table;
220 
221 extern enum policy_mgr_pcl_type const
222 	(*second_connection_pcl_non_dbs_table)[PM_MAX_ONE_CONNECTION_MODE]
223 			[PM_MAX_NUM_OF_MODE][PM_MAX_CONC_PRIORITY_MODE];
224 extern pm_dbs_pcl_third_connection_table_type
225 		*third_connection_pcl_dbs_table;
226 extern enum policy_mgr_pcl_type const
227 	(*third_connection_pcl_non_dbs_table)[PM_MAX_TWO_CONNECTION_MODE]
228 			[PM_MAX_NUM_OF_MODE][PM_MAX_CONC_PRIORITY_MODE];
229 
230 extern policy_mgr_next_action_two_connection_table_type
231 		*next_action_two_connection_table;
232 extern policy_mgr_next_action_three_connection_table_type
233 		*next_action_three_connection_table;
234 
235 #ifdef FEATURE_FOURTH_CONNECTION
236 extern const enum policy_mgr_pcl_type
237 	fourth_connection_pcl_dbs_sbs_table
238 	[PM_MAX_THREE_CONNECTION_MODE][PM_MAX_NUM_OF_MODE]
239 	[PM_MAX_CONC_PRIORITY_MODE];
240 #endif
241 
242 extern policy_mgr_next_action_two_connection_table_type
243 		*next_action_two_connection_2x2_2g_1x1_5g_table;
244 extern policy_mgr_next_action_three_connection_table_type
245 		*next_action_three_connection_2x2_2g_1x1_5g_table;
246 
247 extern enum policy_mgr_conc_next_action
248 	(*policy_mgr_get_current_pref_hw_mode_ptr)
249 	(struct wlan_objmgr_psoc *psoc);
250 
251 /**
252  * struct policy_mgr_cfg - all the policy manager owned configs
253  * @mcc_to_scc_switch: switch to indicate MCC to SCC config
254  * @sys_pref: system's preference while selecting PCLs
255  * @max_conc_cxns: Max allowed concurrenct active connections
256  * @conc_rule1: concurrency rule1
257  * @conc_rule2: concurrency rule2
258  * @allow_mcc_go_diff_bi: Allow GO and STA diff beacon interval in MCC
259  * @dual_mac_feature: To enable/disable dual mac features
260  * @is_force_1x1_enable: Is 1x1 forced for connection
261  * @sta_sap_scc_on_dfs_chnl: STA-SAP SCC on DFS channel
262  * @sta_sap_scc_on_lte_coex_chnl: STA-SAP SCC on LTE Co-ex channel
263  * @sta_sap_scc_on_indoor_channel: Allow STA-SAP scc on indoor only
264  * channels
265  * @nan_sap_scc_on_lte_coex_chnl: NAN-SAP SCC on LTE Co-ex channel
266  * @sap_mandatory_chnl_enable: To enable/disable SAP mandatory channels
267  * @mark_indoor_chnl_disable: Mark indoor channel as disable or enable
268  * @dbs_selection_plcy: DBS selection policy for concurrency
269  * @vdev_priority_list: Priority list for various vdevs
270  * @chnl_select_plcy: Channel selection policy
271  * @enable_mcc_adaptive_sch: Enable/Disable MCC adaptive scheduler
272  * @enable_sta_cxn_5g_band: Enable/Disable STA connection in 5G band
273  * @go_force_scc: Enable/Disable P2P GO force SCC
274  * @pcl_band_priority: PCL channel order between 5G and 6G.
275  * @sbs_enable: To enable/disable SBS
276  * @multi_sap_allowed_on_same_band: Enable/Disable multi sap started
277  *                                  on same band
278  * @sr_in_same_mac_conc: Enable/Disable SR in same MAC concurrency
279  * @use_sap_original_bw: Enable/Disable sap original BW as default
280  *                       BW when do restart
281  * @move_sap_go_1st_on_dfs_sta_csa: Enable/Disable SAP / GO's movement
282  *				    to non-DFS channel before STA
283  */
284 struct policy_mgr_cfg {
285 	uint8_t mcc_to_scc_switch;
286 	uint8_t sys_pref;
287 	uint8_t max_conc_cxns;
288 	uint8_t conc_rule1;
289 	uint8_t conc_rule2;
290 	bool enable_mcc_adaptive_sch;
291 	uint8_t allow_mcc_go_diff_bi;
292 	uint8_t dual_mac_feature;
293 	enum force_1x1_type is_force_1x1_enable;
294 	uint8_t sta_sap_scc_on_dfs_chnl;
295 	uint8_t sta_sap_scc_on_lte_coex_chnl;
296 	bool sta_sap_scc_on_indoor_channel;
297 	uint8_t nan_sap_scc_on_lte_coex_chnl;
298 	uint8_t sap_mandatory_chnl_enable;
299 	uint8_t mark_indoor_chnl_disable;
300 	uint8_t enable_sta_cxn_5g_band;
301 	uint32_t dbs_selection_plcy;
302 	uint32_t vdev_priority_list;
303 	uint32_t chnl_select_plcy;
304 	uint8_t go_force_scc;
305 	enum policy_mgr_pcl_band_priority pcl_band_priority;
306 	bool sbs_enable;
307 	bool multi_sap_allowed_on_same_band;
308 #ifdef WLAN_FEATURE_SR
309 	bool sr_in_same_mac_conc;
310 #endif
311 	bool use_sap_original_bw;
312 	bool move_sap_go_1st_on_dfs_sta_csa;
313 };
314 
315 /**
316  * struct policy_mgr_psoc_priv_obj - Policy manager private data
317  * @psoc: pointer to PSOC object information
318  * @pdev: pointer to PDEV object information
319  * @connection_update_done_evt: qdf event to synchronize
320  *                            connection activities
321  * @qdf_conc_list_lock: To protect connection table
322  * @dbs_opportunistic_timer: Timer to drop down to Single Mac
323  *                         Mode opportunistically
324  * @sap_restart_chan_switch_cb: Callback for channel switch
325  *                            notification for SAP
326  * @hdd_cbacks: callbacks to be registered by HDD for
327  *            interaction with Policy Manager
328  * @sme_cbacks: callbacks to be registered by SME for
329  *            interaction with Policy Manager
330  * @wma_cbacks: callbacks to be registered by SME for
331  * interaction with Policy Manager
332  * @tdls_cbacks: callbacks to be registered by SME for
333  * interaction with Policy Manager
334  * @cdp_cbacks: callbacks to be registered by SME for
335  * interaction with Policy Manager
336  * @dp_cbacks: callbacks to be registered by Datapath for
337  * interaction with Policy Manager
338  * @conc_cbacks: callbacks to be registered by lim for
339  * interaction with Policy Manager
340  * @sap_mandatory_channels: The user preferred master list on
341  *                        which SAP can be brought up. This
342  *                        mandatory channel freq list would be as per
343  *                        OEMs preference & conforming to the
344  *                        regulatory/other considerations
345  * @sap_mandatory_channels_len: Length of the SAP mandatory
346  *                            channel list
347  * @do_sap_unsafe_ch_check: whether need check sap unsafe channel
348  * @last_disconn_sta_freq: last disconnected sta channel freq
349  * @concurrency_mode: active concurrency combination
350  * @no_of_open_sessions: Number of active vdevs
351  * @no_of_active_sessions: Number of active connections
352  * @sta_ap_intf_check_work: delayed sap restart work
353  * @work_fail_count: sta_ap work schedule fail count
354  * @nan_sap_conc_work: Info related to nan sap conc work
355  * @num_dbs_hw_modes: Number of different HW modes supported
356  * @hw_mode: List of HW modes supported
357  * @old_hw_mode_index: Old HW mode from hw_mode table
358  * @new_hw_mode_index: New HW mode from hw_mode table
359  * @dual_mac_cfg: DBS configuration currently used by FW for
360  *              scan & connections
361  * @radio_comb_num: radio combination number
362  * @radio_combinations: radio combination list
363  * @hw_mode_change_in_progress: This is to track if HW mode
364  *                            change is in progress
365  * @enable_mcc_adaptive_scheduler: Enable MCC adaptive scheduler
366  *      value from INI
367  * @user_cfg:
368  * @unsafe_channel_list: LTE coex channel freq avoidance list
369  * @unsafe_channel_count: LTE coex channel avoidance list count
370  * @sta_ap_intf_check_work_info: Info related to sta_ap_intf_check_work
371  * @cur_conc_system_pref:
372  * @opportunistic_update_done_evt: qdf event to synchronize host
373  *                               & FW HW mode
374  * @channel_switch_complete_evt: qdf event for channel switch completion check
375  * @mode_change_cb: Mode change callback
376  * @cfg: Policy manager config data
377  * @valid_ch_freq_list: valid frequencies
378  * @valid_ch_freq_list_count: number of valid frequencies
379  * @dynamic_mcc_adaptive_sched: disable/enable mcc adaptive scheduler feature
380  * @dynamic_dfs_master_disabled: current state of dynamic dfs master
381  * @link_in_progress: To track if set link is in progress
382  * @set_link_update_done_evt: qdf event to synchronize set link
383  * @active_vdev_bitmap: Active vdev id bitmap
384  * @inactive_vdev_bitmap: Inactive vdev id bitmap
385  * @restriction_mask:
386  */
387 struct policy_mgr_psoc_priv_obj {
388 	struct wlan_objmgr_psoc *psoc;
389 	struct wlan_objmgr_pdev *pdev;
390 	qdf_event_t connection_update_done_evt;
391 	qdf_mutex_t qdf_conc_list_lock;
392 	qdf_mc_timer_t dbs_opportunistic_timer;
393 	struct policy_mgr_hdd_cbacks hdd_cbacks;
394 	struct policy_mgr_sme_cbacks sme_cbacks;
395 	struct policy_mgr_wma_cbacks wma_cbacks;
396 	struct policy_mgr_tdls_cbacks tdls_cbacks;
397 	struct policy_mgr_cdp_cbacks cdp_cbacks;
398 	struct policy_mgr_dp_cbacks dp_cbacks;
399 	struct policy_mgr_conc_cbacks conc_cbacks;
400 	uint32_t sap_mandatory_channels[NUM_CHANNELS];
401 	uint32_t sap_mandatory_channels_len;
402 	qdf_freq_t last_disconn_sta_freq;
403 	uint32_t concurrency_mode;
404 	uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
405 	uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
406 	struct qdf_delayed_work sta_ap_intf_check_work;
407 	uint8_t work_fail_count;
408 	qdf_work_t nan_sap_conc_work;
409 	uint32_t num_dbs_hw_modes;
410 	struct dbs_hw_mode_info hw_mode;
411 	uint32_t old_hw_mode_index;
412 	uint32_t new_hw_mode_index;
413 	struct dual_mac_config dual_mac_cfg;
414 	uint32_t radio_comb_num;
415 	struct radio_combination radio_combinations[MAX_RADIO_COMBINATION];
416 	uint32_t hw_mode_change_in_progress;
417 	struct policy_mgr_user_cfg user_cfg;
418 	uint32_t unsafe_channel_list[NUM_CHANNELS];
419 	uint16_t unsafe_channel_count;
420 	struct sta_ap_intf_check_work_ctx *sta_ap_intf_check_work_info;
421 	uint8_t cur_conc_system_pref;
422 	qdf_event_t opportunistic_update_done_evt;
423 	qdf_event_t channel_switch_complete_evt;
424 	send_mode_change_event_cb mode_change_cb;
425 	struct policy_mgr_cfg cfg;
426 	uint32_t valid_ch_freq_list[NUM_CHANNELS];
427 	uint32_t valid_ch_freq_list_count;
428 	bool dynamic_mcc_adaptive_sched;
429 	bool dynamic_dfs_master_disabled;
430 #ifdef WLAN_FEATURE_11BE_MLO
431 	qdf_atomic_t link_in_progress;
432 	qdf_event_t set_link_update_done_evt;
433 #endif
434 	uint32_t active_vdev_bitmap;
435 	uint32_t inactive_vdev_bitmap;
436 #ifdef FEATURE_WLAN_CH_AVOID_EXT
437 	uint32_t restriction_mask;
438 #endif
439 };
440 
441 /**
442  * struct policy_mgr_mac_ss_bw_info - hw_mode_list PHY/MAC params for each MAC
443  * @mac_tx_stream: Max TX stream number supported on MAC
444  * @mac_rx_stream: Max RX stream number supported on MAC
445  * @mac_bw: Max bandwidth(wmi_channel_width enum type)
446  * @mac_band_cap: supported Band bit map(WLAN_2G_CAPABILITY = 0x1,
447  *                            WLAN_5G_CAPABILITY = 0x2)
448  * @support_6ghz_band: support 6 GHz band
449  */
450 struct policy_mgr_mac_ss_bw_info {
451 	uint32_t mac_tx_stream;
452 	uint32_t mac_rx_stream;
453 	uint32_t mac_bw;
454 	uint32_t mac_band_cap;
455 	bool support_6ghz_band;
456 };
457 
458 #ifdef WLAN_FEATURE_SR
459 /**
460  * policy_mgr_get_same_mac_conc_sr_status() - Function returns value of INI
461  * g_enable_sr_in_same_mac_conc
462  *
463  * @psoc: Pointer to PSOC
464  *
465  * Return: Returns True / False
466  */
467 bool policy_mgr_get_same_mac_conc_sr_status(struct wlan_objmgr_psoc *psoc);
468 
469 #else
470 static inline
policy_mgr_get_same_mac_conc_sr_status(struct wlan_objmgr_psoc * psoc)471 bool policy_mgr_get_same_mac_conc_sr_status(struct wlan_objmgr_psoc *psoc)
472 {
473 	return true;
474 }
475 #endif
476 
477 struct policy_mgr_psoc_priv_obj *policy_mgr_get_context(
478 		struct wlan_objmgr_psoc *psoc);
479 
480 /**
481  * policy_mgr_get_updated_scan_config() - Get the updated scan configuration
482  * @psoc: psoc handle
483  * @scan_config: Pointer containing the updated scan config
484  * @dbs_scan: 0 or 1 indicating if DBS scan needs to be enabled/disabled
485  * @dbs_plus_agile_scan: 0 or 1 indicating if DBS plus agile scan needs to be
486  * enabled/disabled
487  * @single_mac_scan_with_dfs: 0 or 1 indicating if single MAC scan with DFS
488  * needs to be enabled/disabled
489  *
490  * Takes the current scan configuration and set the necessary scan config
491  * bits to either 0/1 and provides the updated value to the caller who
492  * can use this to pass it on to the FW
493  *
494  * Return: 0 on success
495  */
496 QDF_STATUS policy_mgr_get_updated_scan_config(
497 		struct wlan_objmgr_psoc *psoc,
498 		uint32_t *scan_config,
499 		bool dbs_scan,
500 		bool dbs_plus_agile_scan,
501 		bool single_mac_scan_with_dfs);
502 
503 /**
504  * policy_mgr_get_updated_fw_mode_config() - Get the updated fw
505  * mode configuration
506  * @psoc: psoc handle
507  * @fw_mode_config: Pointer containing the updated fw mode config
508  * @dbs: 0 or 1 indicating if DBS needs to be enabled/disabled
509  * @agile_dfs: 0 or 1 indicating if agile DFS needs to be enabled/disabled
510  *
511  * Takes the current fw mode configuration and set the necessary fw mode config
512  * bits to either 0/1 and provides the updated value to the caller who
513  * can use this to pass it on to the FW
514  *
515  * Return: 0 on success
516  */
517 QDF_STATUS policy_mgr_get_updated_fw_mode_config(
518 		struct wlan_objmgr_psoc *psoc,
519 		uint32_t *fw_mode_config,
520 		bool dbs,
521 		bool agile_dfs);
522 
523 /**
524  * policy_mgr_is_dual_mac_disabled_in_ini() - Check if dual mac
525  * is disabled in INI
526  * @psoc: psoc handle
527  *
528  * Checks if the dual mac feature is disabled in INI
529  *
530  * Return: true if the dual mac connection is disabled from INI
531  */
532 bool policy_mgr_is_dual_mac_disabled_in_ini(
533 		struct wlan_objmgr_psoc *psoc);
534 
535 /**
536  * policy_mgr_find_if_hwlist_has_dbs() - Find if hw list has DBS modes or not
537  * @psoc: PSOC object information
538  *
539  * Find if hw list has DBS modes or not
540  *
541  * Return: true or false
542  */
543 bool policy_mgr_find_if_hwlist_has_dbs(struct wlan_objmgr_psoc *psoc);
544 
545 /**
546  * policy_mgr_get_mcc_to_scc_switch_mode() - MCC to SCC
547  * switch mode value in the user config
548  * @psoc: PSOC object information
549  *
550  * MCC to SCC switch mode value in user config
551  *
552  * Return: MCC to SCC switch mode value
553  */
554 uint32_t policy_mgr_get_mcc_to_scc_switch_mode(
555 	struct wlan_objmgr_psoc *psoc);
556 
557 /**
558  * policy_mgr_get_dbs_config() - Get DBS bit
559  * @psoc: psoc handle
560  *
561  * Gets the DBS bit of fw_mode_config_bits
562  *
563  * Return: 0 or 1 to indicate the DBS bit
564  */
565 bool policy_mgr_get_dbs_config(struct wlan_objmgr_psoc *psoc);
566 
567 /**
568  * policy_mgr_get_agile_dfs_config() - Get Agile DFS bit
569  * @psoc: psoc handle
570  *
571  * Gets the Agile DFS bit of fw_mode_config_bits
572  *
573  * Return: 0 or 1 to indicate the Agile DFS bit
574  */
575 bool policy_mgr_get_agile_dfs_config(struct wlan_objmgr_psoc *psoc);
576 
577 /**
578  * policy_mgr_get_dbs_scan_config() - Get DBS scan bit
579  * @psoc: psoc handle
580  *
581  * Gets the DBS scan bit of concurrent_scan_config_bits
582  *
583  * Return: 0 or 1 to indicate the DBS scan bit
584  */
585 bool policy_mgr_get_dbs_scan_config(struct wlan_objmgr_psoc *psoc);
586 
587 /**
588  * policy_mgr_get_tx_rx_ss_from_config() - Get Tx/Rx spatial
589  * stream from HW mode config
590  * @mac_ss: Config which indicates the HW mode as per 'hw_mode_ss_config'
591  * @tx_ss: Contains the Tx spatial stream
592  * @rx_ss: Contains the Rx spatial stream
593  *
594  * Returns the number of spatial streams of Tx and Rx
595  *
596  * Return: None
597  */
598 void policy_mgr_get_tx_rx_ss_from_config(enum hw_mode_ss_config mac_ss,
599 		uint32_t *tx_ss, uint32_t *rx_ss);
600 
601 /**
602  * policy_mgr_get_matching_hw_mode_index() - Get matching HW mode index
603  * @psoc: psoc handle
604  * @mac0_tx_ss: Number of tx spatial streams of MAC0
605  * @mac0_rx_ss: Number of rx spatial streams of MAC0
606  * @mac0_bw: Bandwidth of MAC0 of type 'hw_mode_bandwidth'
607  * @mac1_tx_ss: Number of tx spatial streams of MAC1
608  * @mac1_rx_ss: Number of rx spatial streams of MAC1
609  * @mac1_bw: Bandwidth of MAC1 of type 'hw_mode_bandwidth'
610  * @mac0_band_cap: mac0 band capability requirement
611  *     (0: Don't care, 1: 2.4G, 2: 5G)
612  * @dbs: DBS capability of type 'hw_mode_dbs_capab'
613  * @dfs: Agile DFS capability of type 'hw_mode_agile_dfs_capab'
614  * @sbs: SBS capability of type 'hw_mode_sbs_capab'
615  *
616  * Fetches the HW mode index corresponding to the HW mode provided.
617  * In Genoa two DBS HW modes (2x2 5G + 1x1 2G, 2x2 2G + 1x1 5G),
618  * the "ss" number and "bw" value are not enough to specify the expected
619  * HW mode. But in both HW mode, the mac0 can support either 5G or 2G.
620  * So, the Parameter "mac0_band_cap" will specify the expected band support
621  * requirement on mac 0 to find the expected HW mode.
622  *
623  * Return: Positive hw mode index in case a match is found or a negative
624  * value, otherwise
625  */
626 int8_t policy_mgr_get_matching_hw_mode_index(
627 		struct wlan_objmgr_psoc *psoc,
628 		uint32_t mac0_tx_ss, uint32_t mac0_rx_ss,
629 		enum hw_mode_bandwidth mac0_bw,
630 		uint32_t mac1_tx_ss, uint32_t mac1_rx_ss,
631 		enum hw_mode_bandwidth mac1_bw,
632 		enum hw_mode_mac_band_cap mac0_band_cap,
633 		enum hw_mode_dbs_capab dbs,
634 		enum hw_mode_agile_dfs_capab dfs,
635 		enum hw_mode_sbs_capab sbs);
636 
637 /**
638  * policy_mgr_get_hw_mode_idx_from_dbs_hw_list() - Get hw_mode index
639  * @psoc: psoc handle
640  * @mac0_ss: MAC0 spatial stream configuration
641  * @mac0_bw: MAC0 bandwidth configuration
642  * @mac1_ss: MAC1 spatial stream configuration
643  * @mac1_bw: MAC1 bandwidth configuration
644  * @mac0_band_cap: mac0 band capability requirement
645  *     (0: Don't care, 1: 2.4G, 2: 5G)
646  * @dbs: HW DBS capability
647  * @dfs: HW Agile DFS capability
648  * @sbs: HW SBS capability
649  *
650  * Get the HW mode index corresponding to the HW modes spatial stream,
651  * bandwidth, DBS, Agile DFS and SBS capability
652  *
653  * In Genoa two DBS HW modes (2x2 5G + 1x1 2G, 2x2 2G + 1x1 5G),
654  * the "ss" number and "bw" value are not enough to specify the expected
655  * HW mode. But in both HW mode, the mac0 can support either 5G or 2G.
656  * So, the Parameter "mac0_band_cap" will specify the expected band support
657  * requirement on mac 0 to find the expected HW mode.
658  *
659  * Return: Index number if a match is found or -negative value if not found
660  */
661 int8_t policy_mgr_get_hw_mode_idx_from_dbs_hw_list(
662 		struct wlan_objmgr_psoc *psoc,
663 		enum hw_mode_ss_config mac0_ss,
664 		enum hw_mode_bandwidth mac0_bw,
665 		enum hw_mode_ss_config mac1_ss,
666 		enum hw_mode_bandwidth mac1_bw,
667 		enum hw_mode_mac_band_cap mac0_band_cap,
668 		enum hw_mode_dbs_capab dbs,
669 		enum hw_mode_agile_dfs_capab dfs,
670 		enum hw_mode_sbs_capab sbs);
671 
672 /**
673  * policy_mgr_get_old_and_new_hw_index() - Get the old and new HW index
674  * @psoc: psoc handle
675  * @old_hw_mode_index: Value at this pointer contains the old HW mode index
676  * Default value when not configured is POLICY_MGR_DEFAULT_HW_MODE_INDEX
677  * @new_hw_mode_index: Value at this pointer contains the new HW mode index
678  * Default value when not configured is POLICY_MGR_DEFAULT_HW_MODE_INDEX
679  *
680  * Get the old and new HW index configured in the driver
681  *
682  * Return: Failure in case the HW mode indices cannot be fetched and Success
683  * otherwise. When no HW mode transition has happened the values of
684  * old_hw_mode_index and new_hw_mode_index will be the same.
685  */
686 QDF_STATUS policy_mgr_get_old_and_new_hw_index(
687 		struct wlan_objmgr_psoc *psoc,
688 		uint32_t *old_hw_mode_index,
689 		uint32_t *new_hw_mode_index);
690 
691 /**
692  * policy_mgr_update_conc_list() - Update the concurrent connection list
693  * @psoc: PSOC object information
694  * @conn_index: Connection index
695  * @mode: Mode
696  * @freq: channel frequency
697  * @bw: Bandwidth
698  * @mac: Mac id
699  * @chain_mask: Chain mask
700  * @original_nss: Original number of spatial streams
701  * @vdev_id: vdev id
702  * @in_use: Flag to indicate if the index is in use or not
703  * @update_conn: Flag to indicate if mode change event should
704  *  be sent or not
705  * @ch_flagext: channel state flags
706  *
707  * Updates the index value of the concurrent connection list
708  *
709  * Return: None
710  */
711 void policy_mgr_update_conc_list(struct wlan_objmgr_psoc *psoc,
712 		uint32_t conn_index,
713 		enum policy_mgr_con_mode mode,
714 		uint32_t freq,
715 		enum hw_mode_bandwidth bw,
716 		uint8_t mac,
717 		enum policy_mgr_chain_mode chain_mask,
718 		uint32_t original_nss,
719 		uint32_t vdev_id,
720 		bool in_use,
721 		bool update_conn,
722 		uint16_t ch_flagext);
723 
724 void policy_mgr_store_and_del_conn_info(struct wlan_objmgr_psoc *psoc,
725 				enum policy_mgr_con_mode mode,
726 				bool all_matching_cxn_to_del,
727 				struct policy_mgr_conc_connection_info *info,
728 				uint8_t *num_cxn_del);
729 
730 /**
731  * policy_mgr_store_and_del_conn_info_by_vdev_id() - Store and del a
732  * connection info by vdev id
733  * @psoc: PSOC object information
734  * @vdev_id: vdev id whose entry has to be deleted
735  * @info: structure array pointer where the connection info will be saved
736  * @num_cxn_del: number of connection which are going to be deleted
737  *
738  * Saves the connection info corresponding to the provided mode
739  * and deleted that corresponding entry based on vdev from the
740  * connection info structure
741  *
742  * Return: None
743  */
744 void policy_mgr_store_and_del_conn_info_by_vdev_id(
745 			struct wlan_objmgr_psoc *psoc,
746 			uint32_t vdev_id,
747 			struct policy_mgr_conc_connection_info *info,
748 			uint8_t *num_cxn_del);
749 
750 /**
751  * policy_mgr_store_and_del_conn_info_by_chan_and_mode() - Store and del a
752  * connection info by chan number and conn mode
753  * @psoc: PSOC object information
754  * @ch_freq: channel frequency value
755  * @mode: conn mode
756  * @info: structure array pointer where the connection info will be saved
757  * @num_cxn_del: number of connection which are going to be deleted
758  *
759  * Saves and deletes the entries if the active connection entry chan and mode
760  * matches the provided chan & mode from the function parameters.
761  *
762  * Return: None
763  */
764 void policy_mgr_store_and_del_conn_info_by_chan_and_mode(
765 			struct wlan_objmgr_psoc *psoc,
766 			uint32_t ch_freq,
767 			enum policy_mgr_con_mode mode,
768 			struct policy_mgr_conc_connection_info *info,
769 			uint8_t *num_cxn_del);
770 
771 void policy_mgr_restore_deleted_conn_info(struct wlan_objmgr_psoc *psoc,
772 				struct policy_mgr_conc_connection_info *info,
773 				uint8_t num_cxn_del);
774 void policy_mgr_update_hw_mode_conn_info(struct wlan_objmgr_psoc *psoc,
775 				uint32_t num_vdev_mac_entries,
776 				struct policy_mgr_vdev_mac_map *vdev_mac_map,
777 				struct policy_mgr_hw_mode_params hw_mode,
778 				uint32_t num_mac_freq,
779 				struct policy_mgr_pdev_mac_freq_map *freq_info);
780 void policy_mgr_pdev_set_hw_mode_cb(uint32_t status,
781 				uint32_t cfgd_hw_mode_index,
782 				uint32_t num_vdev_mac_entries,
783 				struct policy_mgr_vdev_mac_map *vdev_mac_map,
784 				uint8_t next_action,
785 				enum policy_mgr_conn_update_reason reason,
786 				uint32_t session_id, void *context,
787 				uint32_t request_id);
788 
789 #ifdef WLAN_FEATURE_11BE_MLO
790 void
791 policy_mgr_dump_disabled_ml_links(struct policy_mgr_psoc_priv_obj *pm_ctx);
792 
793 /**
794  * policy_mgr_link_switch_notifier_cb() - link switch notifier callback
795  * @vdev: vdev object
796  * @req: link switch request
797  * @notify_reason: Reason for notification
798  *
799  * This API will be registered to mlo link switch, to be invoked before
800  * do link switch process.
801  *
802  * Return: QDF_STATUS
803  */
804 QDF_STATUS
805 policy_mgr_link_switch_notifier_cb(struct wlan_objmgr_vdev *vdev,
806 				   struct wlan_mlo_link_switch_req *req,
807 				   enum wlan_mlo_link_switch_notify_reason notify_reason);
808 #else
809 static inline void
policy_mgr_dump_disabled_ml_links(struct policy_mgr_psoc_priv_obj * pm_ctx)810 policy_mgr_dump_disabled_ml_links(struct policy_mgr_psoc_priv_obj *pm_ctx) {}
811 #endif
812 
813 /**
814  * policy_mgr_dump_current_concurrency() - To dump the current
815  * concurrency combination
816  * @psoc: psoc handle
817  *
818  * This routine is called to dump the concurrency info
819  *
820  * Return: None
821  */
822 void policy_mgr_dump_current_concurrency(struct wlan_objmgr_psoc *psoc);
823 
824 void pm_dbs_opportunistic_timer_handler(void *data);
825 
826 /**
827  * policy_mgr_get_channel_list() - Get channel list based on PCL and mode
828  * @psoc: psoc object
829  * @pcl: pcl type
830  * @mode: interface mode
831  * @pcl_channels: pcl channel list buffer
832  * @pcl_weights: pcl weight buffer
833  * @pcl_sz: pcl channel list buffer size
834  * @len: pcl channel number returned from API
835  *
836  * Return: QDF_STATUS
837  */
838 QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
839 				       enum policy_mgr_pcl_type pcl,
840 				       enum policy_mgr_con_mode mode,
841 				       uint32_t *pcl_channels,
842 				       uint8_t *pcl_weights,
843 				       uint32_t pcl_sz, uint32_t *len);
844 
845 /**
846  * policy_mgr_allow_new_home_channel() - Check for allowed number of
847  * home channels
848  * @psoc: PSOC Pointer
849  * @mode: Connection mode
850  * @ch_freq: channel frequency on which new connection is coming up
851  * @num_connections: number of current connections
852  * @is_dfs_ch: DFS channel or not
853  * @ext_flags: extended flags for concurrency check
854  *
855  * When a new connection is about to come up check if current
856  * concurrency combination including the new connection is
857  * allowed or not based on the HW capability
858  *
859  * Return: True/False
860  */
861 bool policy_mgr_allow_new_home_channel(
862 	struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode,
863 	uint32_t ch_freq, uint32_t num_connections, bool is_dfs_ch,
864 	uint32_t ext_flags);
865 
866 /**
867  * policy_mgr_is_5g_channel_allowed() - check if 5g channel is allowed
868  * @psoc: PSOC object information
869  * @ch_freq: channel frequency which needs to be validated
870  * @list: list of existing connections.
871  * @mode: mode against which channel needs to be validated
872  *
873  * This API takes the channel frequency as input and compares with existing
874  * connection channels. If existing connection's channel is DFS channel
875  * and provided channel is 5G channel then don't allow concurrency to
876  * happen as MCC with DFS channel is not yet supported
877  *
878  * Return: true if 5G channel is allowed, false if not allowed
879  *
880  */
881 bool policy_mgr_is_5g_channel_allowed(struct wlan_objmgr_psoc *psoc,
882 				uint32_t ch_freq, uint32_t *list,
883 				enum policy_mgr_con_mode mode);
884 
885 /**
886  * policy_mgr_complete_action() - initiates actions needed on
887  * current connections once channel has been decided for the new
888  * connection
889  * @psoc: PSOC object information
890  * @new_nss: the new nss value
891  * @next_action: next action to happen at policy mgr after
892  *		beacon update
893  * @reason: Reason for connection update
894  * @session_id: Session id
895  * @request_id: connection manager req id
896  *
897  * This function initiates actions
898  * needed on current connections once channel has been decided
899  * for the new connection. Notifies UMAC & FW as well
900  *
901  * Return: QDF_STATUS enum
902  */
903 QDF_STATUS policy_mgr_complete_action(struct wlan_objmgr_psoc *psoc,
904 				uint8_t  new_nss, uint8_t next_action,
905 				enum policy_mgr_conn_update_reason reason,
906 				uint32_t session_id, uint32_t request_id);
907 
908 enum policy_mgr_con_mode policy_mgr_get_mode_by_vdev_id(
909 		struct wlan_objmgr_psoc *psoc,
910 		uint8_t vdev_id);
911 QDF_STATUS policy_mgr_init_connection_update(
912 		struct policy_mgr_psoc_priv_obj *pm_ctx);
913 
914 /**
915  * policy_mgr_get_current_pref_hw_mode_dbs_2x2() - Get the
916  * current preferred hw mode
917  * @psoc: psoc handle
918  *
919  * Get the preferred hw mode based on the current connection combinations
920  *
921  * Return: No change (PM_NOP), MCC (PM_SINGLE_MAC),
922  *         DBS (PM_DBS), SBS (PM_SBS)
923  */
924 enum policy_mgr_conc_next_action
925 		policy_mgr_get_current_pref_hw_mode_dbs_2x2(
926 		struct wlan_objmgr_psoc *psoc);
927 
928 /**
929  * policy_mgr_get_current_pref_hw_mode_dbs_1x1() - Get the
930  * current preferred hw mode
931  * @psoc: psoc handle
932  *
933  * Get the preferred hw mode based on the current connection combinations
934  *
935  * Return: No change (PM_NOP), MCC (PM_SINGLE_MAC_UPGRADE),
936  *         DBS (PM_DBS_DOWNGRADE)
937  */
938 enum policy_mgr_conc_next_action
939 		policy_mgr_get_current_pref_hw_mode_dbs_1x1(
940 		struct wlan_objmgr_psoc *psoc);
941 
942 /**
943  * policy_mgr_get_current_pref_hw_mode_dual_dbs() - Get the
944  * current preferred hw mode
945  * @psoc: PSOC object information
946  *
947  * Get the preferred hw mode based on the current connection combinations
948  *
949  * Return: No change (PM_NOP), (PM_SINGLE_MAC_UPGRADE),
950  *         DBS (PM_DBS1_DOWNGRADE or PM_DBS2_DOWNGRADE)
951  */
952 enum policy_mgr_conc_next_action
953 		policy_mgr_get_current_pref_hw_mode_dual_dbs(
954 		struct wlan_objmgr_psoc *psoc);
955 
956 void
957 policy_mgr_dump_freq_range_per_mac(struct policy_mgr_freq_range *freq_range,
958 				   enum policy_mgr_mode hw_mode);
959 
960 /**
961  * policy_mgr_fill_curr_mac_freq_by_hwmode() - Fill Current Mac frequency with
962  * the frequency range of the given Hw Mode
963  *
964  * @pm_ctx: Policy Mgr context
965  * @mode_hw: Policy Mgr Hw mode
966  *
967  * Fill Current Mac frequency with the frequency range of the given Hw Mode
968  *
969  * Return: None
970  */
971 void
972 policy_mgr_fill_curr_mac_freq_by_hwmode(struct policy_mgr_psoc_priv_obj *pm_ctx,
973 					enum policy_mgr_mode mode_hw);
974 
975 /**
976  * policy_mgr_dump_freq_range() - Function to print every frequency range
977  * for both MAC 0 and MAC1 for every Hw mode
978  *
979  * @pm_ctx: Policy Mgr context
980  *
981  * This function will print every frequency range
982  * for both MAC 0 and MAC1 for every Hw mode
983  *
984  * Return: void
985  *
986  */
987 void
988 policy_mgr_dump_freq_range(struct policy_mgr_psoc_priv_obj *pm_ctx);
989 
990 /**
991  * policy_mgr_dump_sbs_freq_range() - Function to print SBS frequency range
992  * for both MAC 0 and MAC1
993  *
994  * @pm_ctx: Policy Mgr context
995  *
996  * Return: void
997  */
998 void
999 policy_mgr_dump_sbs_freq_range(struct policy_mgr_psoc_priv_obj *pm_ctx);
1000 
1001 /**
1002  * policy_mgr_dump_curr_freq_range() - Function to print current frequency range
1003  * for both MAC 0 and MAC1
1004  *
1005  * @pm_ctx: Policy Mgr context
1006  *
1007  * This function will print current frequency range
1008  * for both MAC 0 and MAC1 for every Hw mode
1009  *
1010  * Return: void
1011  *
1012  */
1013 void
1014 policy_mgr_dump_curr_freq_range(struct policy_mgr_psoc_priv_obj *pm_ctx);
1015 
1016 /**
1017  * policy_mgr_reg_chan_change_callback() - Callback to be
1018  * invoked by regulatory module when valid channel list changes
1019  * @psoc: PSOC object information
1020  * @pdev: PDEV object information
1021  * @chan_list: New channel list
1022  * @avoid_freq_ind: LTE coex avoid channel list
1023  * @arg: Information passed at registration
1024  *
1025  * Get updated channel list from regulatory module
1026  *
1027  * Return: None
1028  */
1029 void policy_mgr_reg_chan_change_callback(struct wlan_objmgr_psoc *psoc,
1030 		struct wlan_objmgr_pdev *pdev,
1031 		struct regulatory_channel *chan_list,
1032 		struct avoid_freq_ind_data *avoid_freq_ind,
1033 		void *arg);
1034 
1035 /**
1036  * policy_mgr_update_nss_req() - wrapper API to update nss
1037  * @psoc: psoc object
1038  * @vdev_id: vdev id
1039  * @tx_nss: Tx nss to set
1040  * @rx_nss: Rx nss to set
1041  *
1042  * Return: QDF_STATUS_SUCCESS
1043  */
1044 QDF_STATUS policy_mgr_update_nss_req(struct wlan_objmgr_psoc *psoc,
1045 				     uint8_t vdev_id, uint8_t tx_nss,
1046 				     uint8_t rx_nss);
1047 
1048 /**
1049  * policy_mgr_nss_update() - update nss for AP vdev
1050  * @psoc: PSOC object information
1051  * @new_nss: new NSS value
1052  * @next_action: Next action after nss update
1053  * @band: update AP vdev on the Band.
1054  * @reason: action reason
1055  * @original_vdev_id: original request hwmode change vdev id
1056  * @request_id: request id
1057  *
1058  * The function will update AP vdevs on specific band.
1059  *  eg. band = POLICY_MGR_ANY will request to update all band (2g and 5g)
1060  *
1061  * Return: QDF_STATUS_SUCCESS, update requested successfully.
1062  */
1063 QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc,
1064 		uint8_t  new_nss, uint8_t next_action,
1065 		enum policy_mgr_band band,
1066 		enum policy_mgr_conn_update_reason reason,
1067 		uint32_t original_vdev_id, uint32_t request_id);
1068 
1069 /**
1070  * policy_mgr_is_concurrency_allowed() - Check for allowed
1071  * concurrency combination
1072  * @psoc: PSOC object information
1073  * @mode: new connection mode
1074  * @ch_freq: channel frequency on which new connection is coming up
1075  * @bw: Bandwidth requested by the connection (optional)
1076  * @ext_flags: extended flags for concurrency check (union conc_ext_flag)
1077  * @pcl: Optional PCL for new connection
1078  *
1079  * When a new connection is about to come up check if current
1080  * concurrency combination including the new connection is
1081  * allowed or not based on the HW capability, but no need to
1082  * invoke get_pcl
1083  *
1084  * Return: True/False
1085  */
1086 bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc,
1087 				       enum policy_mgr_con_mode mode,
1088 				       uint32_t ch_freq,
1089 				       enum hw_mode_bandwidth bw,
1090 				       uint32_t ext_flags,
1091 				       struct policy_mgr_pcl_list *pcl);
1092 
1093 /**
1094  * policy_mgr_can_2ghz_share_low_high_5ghz_sbs() - if SBS mode is dynamic where
1095  * 2.4 GHZ can be shared by any of high 5 GHZ or low 5GHZ at a time.
1096  * @pm_ctx: policy mgr psoc priv object
1097  *
1098  * Return: true is sbs is dynamic else false.
1099  */
1100 bool policy_mgr_can_2ghz_share_low_high_5ghz_sbs(
1101 				struct policy_mgr_psoc_priv_obj *pm_ctx);
1102 
1103 /**
1104  * policy_mgr_sbs_24_shared_with_high_5() - if 2.4 GHZ
1105  * can be shared by high 5 GHZ
1106  *
1107  * @pm_ctx: policy mgr psoc priv object
1108  *
1109  * Return: true if 2.4 GHz is shared by high 5 GHZ
1110  */
1111 bool
1112 policy_mgr_sbs_24_shared_with_high_5(struct policy_mgr_psoc_priv_obj *pm_ctx);
1113 
1114 /**
1115  * policy_mgr_sbs_24_shared_with_low_5() - if 2.4 GHZ
1116  * can be shared by low 5 GHZ
1117  *
1118  * @pm_ctx: policy mgr psoc priv object
1119  *
1120  * Return: true if 2.4 GHz is shared by low 5 GHZ
1121  */
1122 bool
1123 policy_mgr_sbs_24_shared_with_low_5(struct policy_mgr_psoc_priv_obj *pm_ctx);
1124 
1125 /**
1126  * policy_mgr_2_freq_same_mac_in_dbs() - to check provided frequencies are
1127  * in dbs freq range or not
1128  *
1129  * @pm_ctx: policy mgr psoc priv object
1130  * @freq_1: first frequency
1131  * @freq_2: second frequency
1132  *
1133  * This API is used to check provided frequencies are in dbs freq range or not
1134  *
1135  * Return: true/false.
1136  */
1137 bool
1138 policy_mgr_2_freq_same_mac_in_dbs(struct policy_mgr_psoc_priv_obj *pm_ctx,
1139 				  qdf_freq_t freq_1, qdf_freq_t freq_2);
1140 
1141 /**
1142  * policy_mgr_2_freq_same_mac_in_sbs() - to check provided frequencies are
1143  * in sbs freq range or not
1144  *
1145  * @pm_ctx: policy mgr psoc priv object
1146  * @freq_1: first frequency
1147  * @freq_2: second frequency
1148  *
1149  * This API is used to check provided frequencies are in sbs freq range or not
1150  *
1151  * Return: true/false.
1152  */
1153 bool policy_mgr_2_freq_same_mac_in_sbs(struct policy_mgr_psoc_priv_obj *pm_ctx,
1154 				       qdf_freq_t freq_1, qdf_freq_t freq_2);
1155 
1156 /**
1157  * policy_mgr_get_connection_for_vdev_id() - provides the
1158  * particular connection with the requested vdev id
1159  * @psoc: PSOC object information
1160  * @vdev_id: vdev id of the connection
1161  *
1162  * This function provides the specific connection with the
1163  * requested vdev id
1164  *
1165  * Return: index in the connection table
1166  */
1167 uint32_t policy_mgr_get_connection_for_vdev_id(struct wlan_objmgr_psoc *psoc,
1168 					       uint32_t vdev_id);
1169 
1170 #ifdef FEATURE_WLAN_CH_AVOID_EXT
1171 /**
1172  * policy_mgr_set_freq_restriction_mask() - fill the restriction_mask
1173  * in pm_ctx
1174  *
1175  * @pm_ctx: policy mgr psoc priv object
1176  * @freq_list: avoid freq indication carries freq/mask/freq count
1177  *
1178  * Return: None
1179  */
1180 void
1181 policy_mgr_set_freq_restriction_mask(struct policy_mgr_psoc_priv_obj *pm_ctx,
1182 				     struct ch_avoid_ind_type *freq_list);
1183 
1184 /**
1185  * policy_mgr_get_freq_restriction_mask() - get restriction_mask from
1186  * pm_ctx
1187  *
1188  * @pm_ctx: policy mgr psoc priv object
1189  *
1190  * Return: Restriction mask
1191  */
1192 uint32_t
1193 policy_mgr_get_freq_restriction_mask(struct policy_mgr_psoc_priv_obj *pm_ctx);
1194 #else
1195 static inline void
policy_mgr_set_freq_restriction_mask(struct policy_mgr_psoc_priv_obj * pm_ctx,struct ch_avoid_ind_type * freq_list)1196 policy_mgr_set_freq_restriction_mask(struct policy_mgr_psoc_priv_obj *pm_ctx,
1197 				     struct ch_avoid_ind_type *freq_list)
1198 {
1199 }
1200 #endif
1201 
1202 /**
1203  * policy_mgr_get_connection_max_channel_width() - Get max channel width
1204  * among vdevs in use
1205  * @psoc: PSOC object pointer
1206  *
1207  * This function returns max channel width among in-use vdevs
1208  *
1209  * Return: enum hw_mode_bandwidth
1210  */
1211 enum hw_mode_bandwidth
1212 policy_mgr_get_connection_max_channel_width(struct wlan_objmgr_psoc *psoc);
1213 
1214 #endif
1215