xref: /wlan-dirver/qcacld-3.0/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h (revision e22f9adc774eb030715d9a453ec9ea346916ed3b)
1 /*
2  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 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  * @nan_sap_conc_work: Info related to nan sap conc work
354  * @num_dbs_hw_modes: Number of different HW modes supported
355  * @hw_mode: List of HW modes supported
356  * @old_hw_mode_index: Old HW mode from hw_mode table
357  * @new_hw_mode_index: New HW mode from hw_mode table
358  * @dual_mac_cfg: DBS configuration currently used by FW for
359  *              scan & connections
360  * @radio_comb_num: radio combination number
361  * @radio_combinations: radio combination list
362  * @hw_mode_change_in_progress: This is to track if HW mode
363  *                            change is in progress
364  * @enable_mcc_adaptive_scheduler: Enable MCC adaptive scheduler
365  *      value from INI
366  * @user_cfg:
367  * @unsafe_channel_list: LTE coex channel freq avoidance list
368  * @unsafe_channel_count: LTE coex channel avoidance list count
369  * @sta_ap_intf_check_work_info: Info related to sta_ap_intf_check_work
370  * @cur_conc_system_pref:
371  * @opportunistic_update_done_evt: qdf event to synchronize host
372  *                               & FW HW mode
373  * @channel_switch_complete_evt: qdf event for channel switch completion check
374  * @mode_change_cb: Mode change callback
375  * @cfg: Policy manager config data
376  * @valid_ch_freq_list: valid frequencies
377  * @valid_ch_freq_list_count: number of valid frequencies
378  * @dynamic_mcc_adaptive_sched: disable/enable mcc adaptive scheduler feature
379  * @dynamic_dfs_master_disabled: current state of dynamic dfs master
380  * @link_in_progress: To track if set link is in progress
381  * @set_link_update_done_evt: qdf event to synchronize set link
382  * @active_vdev_bitmap: Active vdev id bitmap
383  * @inactive_vdev_bitmap: Inactive vdev id bitmap
384  * @restriction_mask:
385  */
386 struct policy_mgr_psoc_priv_obj {
387 	struct wlan_objmgr_psoc *psoc;
388 	struct wlan_objmgr_pdev *pdev;
389 	qdf_event_t connection_update_done_evt;
390 	qdf_mutex_t qdf_conc_list_lock;
391 	qdf_mc_timer_t dbs_opportunistic_timer;
392 	struct policy_mgr_hdd_cbacks hdd_cbacks;
393 	struct policy_mgr_sme_cbacks sme_cbacks;
394 	struct policy_mgr_wma_cbacks wma_cbacks;
395 	struct policy_mgr_tdls_cbacks tdls_cbacks;
396 	struct policy_mgr_cdp_cbacks cdp_cbacks;
397 	struct policy_mgr_dp_cbacks dp_cbacks;
398 	struct policy_mgr_conc_cbacks conc_cbacks;
399 	uint32_t sap_mandatory_channels[NUM_CHANNELS];
400 	uint32_t sap_mandatory_channels_len;
401 	qdf_freq_t last_disconn_sta_freq;
402 	uint32_t concurrency_mode;
403 	uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
404 	uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
405 	struct qdf_delayed_work sta_ap_intf_check_work;
406 	qdf_work_t nan_sap_conc_work;
407 	uint32_t num_dbs_hw_modes;
408 	struct dbs_hw_mode_info hw_mode;
409 	uint32_t old_hw_mode_index;
410 	uint32_t new_hw_mode_index;
411 	struct dual_mac_config dual_mac_cfg;
412 	uint32_t radio_comb_num;
413 	struct radio_combination radio_combinations[MAX_RADIO_COMBINATION];
414 	uint32_t hw_mode_change_in_progress;
415 	struct policy_mgr_user_cfg user_cfg;
416 	uint32_t unsafe_channel_list[NUM_CHANNELS];
417 	uint16_t unsafe_channel_count;
418 	struct sta_ap_intf_check_work_ctx *sta_ap_intf_check_work_info;
419 	uint8_t cur_conc_system_pref;
420 	qdf_event_t opportunistic_update_done_evt;
421 	qdf_event_t channel_switch_complete_evt;
422 	send_mode_change_event_cb mode_change_cb;
423 	struct policy_mgr_cfg cfg;
424 	uint32_t valid_ch_freq_list[NUM_CHANNELS];
425 	uint32_t valid_ch_freq_list_count;
426 	bool dynamic_mcc_adaptive_sched;
427 	bool dynamic_dfs_master_disabled;
428 #ifdef WLAN_FEATURE_11BE_MLO
429 	qdf_atomic_t link_in_progress;
430 	qdf_event_t set_link_update_done_evt;
431 #endif
432 	uint32_t active_vdev_bitmap;
433 	uint32_t inactive_vdev_bitmap;
434 #ifdef FEATURE_WLAN_CH_AVOID_EXT
435 	uint32_t restriction_mask;
436 #endif
437 };
438 
439 /**
440  * struct policy_mgr_mac_ss_bw_info - hw_mode_list PHY/MAC params for each MAC
441  * @mac_tx_stream: Max TX stream number supported on MAC
442  * @mac_rx_stream: Max RX stream number supported on MAC
443  * @mac_bw: Max bandwidth(wmi_channel_width enum type)
444  * @mac_band_cap: supported Band bit map(WLAN_2G_CAPABILITY = 0x1,
445  *                            WLAN_5G_CAPABILITY = 0x2)
446  * @support_6ghz_band: support 6 GHz band
447  */
448 struct policy_mgr_mac_ss_bw_info {
449 	uint32_t mac_tx_stream;
450 	uint32_t mac_rx_stream;
451 	uint32_t mac_bw;
452 	uint32_t mac_band_cap;
453 	bool support_6ghz_band;
454 };
455 
456 #ifdef WLAN_FEATURE_SR
457 /**
458  * policy_mgr_get_same_mac_conc_sr_status() - Function returns value of INI
459  * g_enable_sr_in_same_mac_conc
460  *
461  * @psoc: Pointer to PSOC
462  *
463  * Return: Returns True / False
464  */
465 bool policy_mgr_get_same_mac_conc_sr_status(struct wlan_objmgr_psoc *psoc);
466 
467 #else
468 static inline
469 bool policy_mgr_get_same_mac_conc_sr_status(struct wlan_objmgr_psoc *psoc)
470 {
471 	return true;
472 }
473 #endif
474 
475 struct policy_mgr_psoc_priv_obj *policy_mgr_get_context(
476 		struct wlan_objmgr_psoc *psoc);
477 
478 /**
479  * policy_mgr_get_updated_scan_config() - Get the updated scan configuration
480  * @psoc: psoc handle
481  * @scan_config: Pointer containing the updated scan config
482  * @dbs_scan: 0 or 1 indicating if DBS scan needs to be enabled/disabled
483  * @dbs_plus_agile_scan: 0 or 1 indicating if DBS plus agile scan needs to be
484  * enabled/disabled
485  * @single_mac_scan_with_dfs: 0 or 1 indicating if single MAC scan with DFS
486  * needs to be enabled/disabled
487  *
488  * Takes the current scan configuration and set the necessary scan config
489  * bits to either 0/1 and provides the updated value to the caller who
490  * can use this to pass it on to the FW
491  *
492  * Return: 0 on success
493  */
494 QDF_STATUS policy_mgr_get_updated_scan_config(
495 		struct wlan_objmgr_psoc *psoc,
496 		uint32_t *scan_config,
497 		bool dbs_scan,
498 		bool dbs_plus_agile_scan,
499 		bool single_mac_scan_with_dfs);
500 
501 /**
502  * policy_mgr_get_updated_fw_mode_config() - Get the updated fw
503  * mode configuration
504  * @psoc: psoc handle
505  * @fw_mode_config: Pointer containing the updated fw mode config
506  * @dbs: 0 or 1 indicating if DBS needs to be enabled/disabled
507  * @agile_dfs: 0 or 1 indicating if agile DFS needs to be enabled/disabled
508  *
509  * Takes the current fw mode configuration and set the necessary fw mode config
510  * bits to either 0/1 and provides the updated value to the caller who
511  * can use this to pass it on to the FW
512  *
513  * Return: 0 on success
514  */
515 QDF_STATUS policy_mgr_get_updated_fw_mode_config(
516 		struct wlan_objmgr_psoc *psoc,
517 		uint32_t *fw_mode_config,
518 		bool dbs,
519 		bool agile_dfs);
520 
521 /**
522  * policy_mgr_is_dual_mac_disabled_in_ini() - Check if dual mac
523  * is disabled in INI
524  * @psoc: psoc handle
525  *
526  * Checks if the dual mac feature is disabled in INI
527  *
528  * Return: true if the dual mac connection is disabled from INI
529  */
530 bool policy_mgr_is_dual_mac_disabled_in_ini(
531 		struct wlan_objmgr_psoc *psoc);
532 
533 /**
534  * policy_mgr_find_if_hwlist_has_dbs() - Find if hw list has DBS modes or not
535  * @psoc: PSOC object information
536  *
537  * Find if hw list has DBS modes or not
538  *
539  * Return: true or false
540  */
541 bool policy_mgr_find_if_hwlist_has_dbs(struct wlan_objmgr_psoc *psoc);
542 
543 /**
544  * policy_mgr_get_mcc_to_scc_switch_mode() - MCC to SCC
545  * switch mode value in the user config
546  * @psoc: PSOC object information
547  *
548  * MCC to SCC switch mode value in user config
549  *
550  * Return: MCC to SCC switch mode value
551  */
552 uint32_t policy_mgr_get_mcc_to_scc_switch_mode(
553 	struct wlan_objmgr_psoc *psoc);
554 
555 /**
556  * policy_mgr_get_dbs_config() - Get DBS bit
557  * @psoc: psoc handle
558  *
559  * Gets the DBS bit of fw_mode_config_bits
560  *
561  * Return: 0 or 1 to indicate the DBS bit
562  */
563 bool policy_mgr_get_dbs_config(struct wlan_objmgr_psoc *psoc);
564 
565 /**
566  * policy_mgr_get_agile_dfs_config() - Get Agile DFS bit
567  * @psoc: psoc handle
568  *
569  * Gets the Agile DFS bit of fw_mode_config_bits
570  *
571  * Return: 0 or 1 to indicate the Agile DFS bit
572  */
573 bool policy_mgr_get_agile_dfs_config(struct wlan_objmgr_psoc *psoc);
574 
575 /**
576  * policy_mgr_get_dbs_scan_config() - Get DBS scan bit
577  * @psoc: psoc handle
578  *
579  * Gets the DBS scan bit of concurrent_scan_config_bits
580  *
581  * Return: 0 or 1 to indicate the DBS scan bit
582  */
583 bool policy_mgr_get_dbs_scan_config(struct wlan_objmgr_psoc *psoc);
584 
585 /**
586  * policy_mgr_get_tx_rx_ss_from_config() - Get Tx/Rx spatial
587  * stream from HW mode config
588  * @mac_ss: Config which indicates the HW mode as per 'hw_mode_ss_config'
589  * @tx_ss: Contains the Tx spatial stream
590  * @rx_ss: Contains the Rx spatial stream
591  *
592  * Returns the number of spatial streams of Tx and Rx
593  *
594  * Return: None
595  */
596 void policy_mgr_get_tx_rx_ss_from_config(enum hw_mode_ss_config mac_ss,
597 		uint32_t *tx_ss, uint32_t *rx_ss);
598 
599 /**
600  * policy_mgr_get_matching_hw_mode_index() - Get matching HW mode index
601  * @psoc: psoc handle
602  * @mac0_tx_ss: Number of tx spatial streams of MAC0
603  * @mac0_rx_ss: Number of rx spatial streams of MAC0
604  * @mac0_bw: Bandwidth of MAC0 of type 'hw_mode_bandwidth'
605  * @mac1_tx_ss: Number of tx spatial streams of MAC1
606  * @mac1_rx_ss: Number of rx spatial streams of MAC1
607  * @mac1_bw: Bandwidth of MAC1 of type 'hw_mode_bandwidth'
608  * @mac0_band_cap: mac0 band capability requirement
609  *     (0: Don't care, 1: 2.4G, 2: 5G)
610  * @dbs: DBS capability of type 'hw_mode_dbs_capab'
611  * @dfs: Agile DFS capability of type 'hw_mode_agile_dfs_capab'
612  * @sbs: SBS capability of type 'hw_mode_sbs_capab'
613  *
614  * Fetches the HW mode index corresponding to the HW mode provided.
615  * In Genoa two DBS HW modes (2x2 5G + 1x1 2G, 2x2 2G + 1x1 5G),
616  * the "ss" number and "bw" value are not enough to specify the expected
617  * HW mode. But in both HW mode, the mac0 can support either 5G or 2G.
618  * So, the Parameter "mac0_band_cap" will specify the expected band support
619  * requirement on mac 0 to find the expected HW mode.
620  *
621  * Return: Positive hw mode index in case a match is found or a negative
622  * value, otherwise
623  */
624 int8_t policy_mgr_get_matching_hw_mode_index(
625 		struct wlan_objmgr_psoc *psoc,
626 		uint32_t mac0_tx_ss, uint32_t mac0_rx_ss,
627 		enum hw_mode_bandwidth mac0_bw,
628 		uint32_t mac1_tx_ss, uint32_t mac1_rx_ss,
629 		enum hw_mode_bandwidth mac1_bw,
630 		enum hw_mode_mac_band_cap mac0_band_cap,
631 		enum hw_mode_dbs_capab dbs,
632 		enum hw_mode_agile_dfs_capab dfs,
633 		enum hw_mode_sbs_capab sbs);
634 
635 /**
636  * policy_mgr_get_hw_mode_idx_from_dbs_hw_list() - Get hw_mode index
637  * @psoc: psoc handle
638  * @mac0_ss: MAC0 spatial stream configuration
639  * @mac0_bw: MAC0 bandwidth configuration
640  * @mac1_ss: MAC1 spatial stream configuration
641  * @mac1_bw: MAC1 bandwidth configuration
642  * @mac0_band_cap: mac0 band capability requirement
643  *     (0: Don't care, 1: 2.4G, 2: 5G)
644  * @dbs: HW DBS capability
645  * @dfs: HW Agile DFS capability
646  * @sbs: HW SBS capability
647  *
648  * Get the HW mode index corresponding to the HW modes spatial stream,
649  * bandwidth, DBS, Agile DFS and SBS capability
650  *
651  * In Genoa two DBS HW modes (2x2 5G + 1x1 2G, 2x2 2G + 1x1 5G),
652  * the "ss" number and "bw" value are not enough to specify the expected
653  * HW mode. But in both HW mode, the mac0 can support either 5G or 2G.
654  * So, the Parameter "mac0_band_cap" will specify the expected band support
655  * requirement on mac 0 to find the expected HW mode.
656  *
657  * Return: Index number if a match is found or -negative value if not found
658  */
659 int8_t policy_mgr_get_hw_mode_idx_from_dbs_hw_list(
660 		struct wlan_objmgr_psoc *psoc,
661 		enum hw_mode_ss_config mac0_ss,
662 		enum hw_mode_bandwidth mac0_bw,
663 		enum hw_mode_ss_config mac1_ss,
664 		enum hw_mode_bandwidth mac1_bw,
665 		enum hw_mode_mac_band_cap mac0_band_cap,
666 		enum hw_mode_dbs_capab dbs,
667 		enum hw_mode_agile_dfs_capab dfs,
668 		enum hw_mode_sbs_capab sbs);
669 
670 /**
671  * policy_mgr_get_old_and_new_hw_index() - Get the old and new HW index
672  * @psoc: psoc handle
673  * @old_hw_mode_index: Value at this pointer contains the old HW mode index
674  * Default value when not configured is POLICY_MGR_DEFAULT_HW_MODE_INDEX
675  * @new_hw_mode_index: Value at this pointer contains the new HW mode index
676  * Default value when not configured is POLICY_MGR_DEFAULT_HW_MODE_INDEX
677  *
678  * Get the old and new HW index configured in the driver
679  *
680  * Return: Failure in case the HW mode indices cannot be fetched and Success
681  * otherwise. When no HW mode transition has happened the values of
682  * old_hw_mode_index and new_hw_mode_index will be the same.
683  */
684 QDF_STATUS policy_mgr_get_old_and_new_hw_index(
685 		struct wlan_objmgr_psoc *psoc,
686 		uint32_t *old_hw_mode_index,
687 		uint32_t *new_hw_mode_index);
688 
689 /**
690  * policy_mgr_update_conc_list() - Update the concurrent connection list
691  * @psoc: PSOC object information
692  * @conn_index: Connection index
693  * @mode: Mode
694  * @freq: channel frequency
695  * @bw: Bandwidth
696  * @mac: Mac id
697  * @chain_mask: Chain mask
698  * @original_nss: Original number of spatial streams
699  * @vdev_id: vdev id
700  * @in_use: Flag to indicate if the index is in use or not
701  * @update_conn: Flag to indicate if mode change event should
702  *  be sent or not
703  * @ch_flagext: channel state flags
704  *
705  * Updates the index value of the concurrent connection list
706  *
707  * Return: None
708  */
709 void policy_mgr_update_conc_list(struct wlan_objmgr_psoc *psoc,
710 		uint32_t conn_index,
711 		enum policy_mgr_con_mode mode,
712 		uint32_t freq,
713 		enum hw_mode_bandwidth bw,
714 		uint8_t mac,
715 		enum policy_mgr_chain_mode chain_mask,
716 		uint32_t original_nss,
717 		uint32_t vdev_id,
718 		bool in_use,
719 		bool update_conn,
720 		uint16_t ch_flagext);
721 
722 void policy_mgr_store_and_del_conn_info(struct wlan_objmgr_psoc *psoc,
723 				enum policy_mgr_con_mode mode,
724 				bool all_matching_cxn_to_del,
725 				struct policy_mgr_conc_connection_info *info,
726 				uint8_t *num_cxn_del);
727 
728 /**
729  * policy_mgr_store_and_del_conn_info_by_vdev_id() - Store and del a
730  * connection info by vdev id
731  * @psoc: PSOC object information
732  * @vdev_id: vdev id whose entry has to be deleted
733  * @info: structure array pointer where the connection info will be saved
734  * @num_cxn_del: number of connection which are going to be deleted
735  *
736  * Saves the connection info corresponding to the provided mode
737  * and deleted that corresponding entry based on vdev from the
738  * connection info structure
739  *
740  * Return: None
741  */
742 void policy_mgr_store_and_del_conn_info_by_vdev_id(
743 			struct wlan_objmgr_psoc *psoc,
744 			uint32_t vdev_id,
745 			struct policy_mgr_conc_connection_info *info,
746 			uint8_t *num_cxn_del);
747 
748 /**
749  * policy_mgr_store_and_del_conn_info_by_chan_and_mode() - Store and del a
750  * connection info by chan number and conn mode
751  * @psoc: PSOC object information
752  * @ch_freq: channel frequency value
753  * @mode: conn mode
754  * @info: structure array pointer where the connection info will be saved
755  * @num_cxn_del: number of connection which are going to be deleted
756  *
757  * Saves and deletes the entries if the active connection entry chan and mode
758  * matches the provided chan & mode from the function parameters.
759  *
760  * Return: None
761  */
762 void policy_mgr_store_and_del_conn_info_by_chan_and_mode(
763 			struct wlan_objmgr_psoc *psoc,
764 			uint32_t ch_freq,
765 			enum policy_mgr_con_mode mode,
766 			struct policy_mgr_conc_connection_info *info,
767 			uint8_t *num_cxn_del);
768 
769 void policy_mgr_restore_deleted_conn_info(struct wlan_objmgr_psoc *psoc,
770 				struct policy_mgr_conc_connection_info *info,
771 				uint8_t num_cxn_del);
772 void policy_mgr_update_hw_mode_conn_info(struct wlan_objmgr_psoc *psoc,
773 				uint32_t num_vdev_mac_entries,
774 				struct policy_mgr_vdev_mac_map *vdev_mac_map,
775 				struct policy_mgr_hw_mode_params hw_mode,
776 				uint32_t num_mac_freq,
777 				struct policy_mgr_pdev_mac_freq_map *freq_info);
778 void policy_mgr_pdev_set_hw_mode_cb(uint32_t status,
779 				uint32_t cfgd_hw_mode_index,
780 				uint32_t num_vdev_mac_entries,
781 				struct policy_mgr_vdev_mac_map *vdev_mac_map,
782 				uint8_t next_action,
783 				enum policy_mgr_conn_update_reason reason,
784 				uint32_t session_id, void *context,
785 				uint32_t request_id);
786 
787 #ifdef WLAN_FEATURE_11BE_MLO
788 void
789 policy_mgr_dump_disabled_ml_links(struct policy_mgr_psoc_priv_obj *pm_ctx);
790 
791 /**
792  * policy_mgr_link_switch_notifier_cb() - link switch notifier callback
793  * @vdev: vdev object
794  * @req: link switch request
795  * @notify_reason: Reason for notification
796  *
797  * This API will be registered to mlo link switch, to be invoked before
798  * do link switch process.
799  *
800  * Return: QDF_STATUS
801  */
802 QDF_STATUS
803 policy_mgr_link_switch_notifier_cb(struct wlan_objmgr_vdev *vdev,
804 				   struct wlan_mlo_link_switch_req *req,
805 				   enum wlan_mlo_link_switch_notify_reason notify_reason);
806 #else
807 static inline void
808 policy_mgr_dump_disabled_ml_links(struct policy_mgr_psoc_priv_obj *pm_ctx) {}
809 #endif
810 
811 /**
812  * policy_mgr_dump_current_concurrency() - To dump the current
813  * concurrency combination
814  * @psoc: psoc handle
815  *
816  * This routine is called to dump the concurrency info
817  *
818  * Return: None
819  */
820 void policy_mgr_dump_current_concurrency(struct wlan_objmgr_psoc *psoc);
821 
822 void pm_dbs_opportunistic_timer_handler(void *data);
823 
824 /**
825  * policy_mgr_get_channel_list() - Get channel list based on PCL and mode
826  * @psoc: psoc object
827  * @pcl: pcl type
828  * @mode: interface mode
829  * @pcl_channels: pcl channel list buffer
830  * @pcl_weights: pcl weight buffer
831  * @pcl_sz: pcl channel list buffer size
832  * @len: pcl channel number returned from API
833  *
834  * Return: QDF_STATUS
835  */
836 QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
837 				       enum policy_mgr_pcl_type pcl,
838 				       enum policy_mgr_con_mode mode,
839 				       uint32_t *pcl_channels,
840 				       uint8_t *pcl_weights,
841 				       uint32_t pcl_sz, uint32_t *len);
842 
843 /**
844  * policy_mgr_allow_new_home_channel() - Check for allowed number of
845  * home channels
846  * @psoc: PSOC Pointer
847  * @mode: Connection mode
848  * @ch_freq: channel frequency on which new connection is coming up
849  * @num_connections: number of current connections
850  * @is_dfs_ch: DFS channel or not
851  * @ext_flags: extended flags for concurrency check
852  *
853  * When a new connection is about to come up check if current
854  * concurrency combination including the new connection is
855  * allowed or not based on the HW capability
856  *
857  * Return: True/False
858  */
859 bool policy_mgr_allow_new_home_channel(
860 	struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode,
861 	uint32_t ch_freq, uint32_t num_connections, bool is_dfs_ch,
862 	uint32_t ext_flags);
863 
864 /**
865  * policy_mgr_is_5g_channel_allowed() - check if 5g channel is allowed
866  * @psoc: PSOC object information
867  * @ch_freq: channel frequency which needs to be validated
868  * @list: list of existing connections.
869  * @mode: mode against which channel needs to be validated
870  *
871  * This API takes the channel frequency as input and compares with existing
872  * connection channels. If existing connection's channel is DFS channel
873  * and provided channel is 5G channel then don't allow concurrency to
874  * happen as MCC with DFS channel is not yet supported
875  *
876  * Return: true if 5G channel is allowed, false if not allowed
877  *
878  */
879 bool policy_mgr_is_5g_channel_allowed(struct wlan_objmgr_psoc *psoc,
880 				uint32_t ch_freq, uint32_t *list,
881 				enum policy_mgr_con_mode mode);
882 
883 /**
884  * policy_mgr_complete_action() - initiates actions needed on
885  * current connections once channel has been decided for the new
886  * connection
887  * @psoc: PSOC object information
888  * @new_nss: the new nss value
889  * @next_action: next action to happen at policy mgr after
890  *		beacon update
891  * @reason: Reason for connection update
892  * @session_id: Session id
893  * @request_id: connection manager req id
894  *
895  * This function initiates actions
896  * needed on current connections once channel has been decided
897  * for the new connection. Notifies UMAC & FW as well
898  *
899  * Return: QDF_STATUS enum
900  */
901 QDF_STATUS policy_mgr_complete_action(struct wlan_objmgr_psoc *psoc,
902 				uint8_t  new_nss, uint8_t next_action,
903 				enum policy_mgr_conn_update_reason reason,
904 				uint32_t session_id, uint32_t request_id);
905 
906 enum policy_mgr_con_mode policy_mgr_get_mode_by_vdev_id(
907 		struct wlan_objmgr_psoc *psoc,
908 		uint8_t vdev_id);
909 QDF_STATUS policy_mgr_init_connection_update(
910 		struct policy_mgr_psoc_priv_obj *pm_ctx);
911 
912 /**
913  * policy_mgr_get_current_pref_hw_mode_dbs_2x2() - Get the
914  * current preferred hw mode
915  * @psoc: psoc handle
916  *
917  * Get the preferred hw mode based on the current connection combinations
918  *
919  * Return: No change (PM_NOP), MCC (PM_SINGLE_MAC),
920  *         DBS (PM_DBS), SBS (PM_SBS)
921  */
922 enum policy_mgr_conc_next_action
923 		policy_mgr_get_current_pref_hw_mode_dbs_2x2(
924 		struct wlan_objmgr_psoc *psoc);
925 
926 /**
927  * policy_mgr_get_current_pref_hw_mode_dbs_1x1() - Get the
928  * current preferred hw mode
929  * @psoc: psoc handle
930  *
931  * Get the preferred hw mode based on the current connection combinations
932  *
933  * Return: No change (PM_NOP), MCC (PM_SINGLE_MAC_UPGRADE),
934  *         DBS (PM_DBS_DOWNGRADE)
935  */
936 enum policy_mgr_conc_next_action
937 		policy_mgr_get_current_pref_hw_mode_dbs_1x1(
938 		struct wlan_objmgr_psoc *psoc);
939 
940 /**
941  * policy_mgr_get_current_pref_hw_mode_dual_dbs() - Get the
942  * current preferred hw mode
943  * @psoc: PSOC object information
944  *
945  * Get the preferred hw mode based on the current connection combinations
946  *
947  * Return: No change (PM_NOP), (PM_SINGLE_MAC_UPGRADE),
948  *         DBS (PM_DBS1_DOWNGRADE or PM_DBS2_DOWNGRADE)
949  */
950 enum policy_mgr_conc_next_action
951 		policy_mgr_get_current_pref_hw_mode_dual_dbs(
952 		struct wlan_objmgr_psoc *psoc);
953 
954 void
955 policy_mgr_dump_freq_range_per_mac(struct policy_mgr_freq_range *freq_range,
956 				   enum policy_mgr_mode hw_mode);
957 
958 /**
959  * policy_mgr_fill_curr_mac_freq_by_hwmode() - Fill Current Mac frequency with
960  * the frequency range of the given Hw Mode
961  *
962  * @pm_ctx: Policy Mgr context
963  * @mode_hw: Policy Mgr Hw mode
964  *
965  * Fill Current Mac frequency with the frequency range of the given Hw Mode
966  *
967  * Return: None
968  */
969 void
970 policy_mgr_fill_curr_mac_freq_by_hwmode(struct policy_mgr_psoc_priv_obj *pm_ctx,
971 					enum policy_mgr_mode mode_hw);
972 
973 /**
974  * policy_mgr_dump_freq_range() - Function to print every frequency range
975  * for both MAC 0 and MAC1 for every Hw mode
976  *
977  * @pm_ctx: Policy Mgr context
978  *
979  * This function will print every frequency range
980  * for both MAC 0 and MAC1 for every Hw mode
981  *
982  * Return: void
983  *
984  */
985 void
986 policy_mgr_dump_freq_range(struct policy_mgr_psoc_priv_obj *pm_ctx);
987 
988 /**
989  * policy_mgr_dump_sbs_freq_range() - Function to print SBS frequency range
990  * for both MAC 0 and MAC1
991  *
992  * @pm_ctx: Policy Mgr context
993  *
994  * Return: void
995  */
996 void
997 policy_mgr_dump_sbs_freq_range(struct policy_mgr_psoc_priv_obj *pm_ctx);
998 
999 /**
1000  * policy_mgr_dump_curr_freq_range() - Function to print current frequency range
1001  * for both MAC 0 and MAC1
1002  *
1003  * @pm_ctx: Policy Mgr context
1004  *
1005  * This function will print current frequency range
1006  * for both MAC 0 and MAC1 for every Hw mode
1007  *
1008  * Return: void
1009  *
1010  */
1011 void
1012 policy_mgr_dump_curr_freq_range(struct policy_mgr_psoc_priv_obj *pm_ctx);
1013 
1014 /**
1015  * policy_mgr_reg_chan_change_callback() - Callback to be
1016  * invoked by regulatory module when valid channel list changes
1017  * @psoc: PSOC object information
1018  * @pdev: PDEV object information
1019  * @chan_list: New channel list
1020  * @avoid_freq_ind: LTE coex avoid channel list
1021  * @arg: Information passed at registration
1022  *
1023  * Get updated channel list from regulatory module
1024  *
1025  * Return: None
1026  */
1027 void policy_mgr_reg_chan_change_callback(struct wlan_objmgr_psoc *psoc,
1028 		struct wlan_objmgr_pdev *pdev,
1029 		struct regulatory_channel *chan_list,
1030 		struct avoid_freq_ind_data *avoid_freq_ind,
1031 		void *arg);
1032 
1033 /**
1034  * policy_mgr_nss_update() - update nss for AP vdev
1035  * @psoc: PSOC object information
1036  * @new_nss: new NSS value
1037  * @next_action: Next action after nss update
1038  * @band: update AP vdev on the Band.
1039  * @reason: action reason
1040  * @original_vdev_id: original request hwmode change vdev id
1041  * @request_id: request id
1042  *
1043  * The function will update AP vdevs on specific band.
1044  *  eg. band = POLICY_MGR_ANY will request to update all band (2g and 5g)
1045  *
1046  * Return: QDF_STATUS_SUCCESS, update requested successfully.
1047  */
1048 QDF_STATUS policy_mgr_nss_update(struct wlan_objmgr_psoc *psoc,
1049 		uint8_t  new_nss, uint8_t next_action,
1050 		enum policy_mgr_band band,
1051 		enum policy_mgr_conn_update_reason reason,
1052 		uint32_t original_vdev_id, uint32_t request_id);
1053 
1054 /**
1055  * policy_mgr_is_concurrency_allowed() - Check for allowed
1056  * concurrency combination
1057  * @psoc: PSOC object information
1058  * @mode: new connection mode
1059  * @ch_freq: channel frequency on which new connection is coming up
1060  * @bw: Bandwidth requested by the connection (optional)
1061  * @ext_flags: extended flags for concurrency check (union conc_ext_flag)
1062  * @pcl: Optional PCL for new connection
1063  *
1064  * When a new connection is about to come up check if current
1065  * concurrency combination including the new connection is
1066  * allowed or not based on the HW capability, but no need to
1067  * invoke get_pcl
1068  *
1069  * Return: True/False
1070  */
1071 bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc,
1072 				       enum policy_mgr_con_mode mode,
1073 				       uint32_t ch_freq,
1074 				       enum hw_mode_bandwidth bw,
1075 				       uint32_t ext_flags,
1076 				       struct policy_mgr_pcl_list *pcl);
1077 
1078 /**
1079  * policy_mgr_can_2ghz_share_low_high_5ghz_sbs() - if SBS mode is dynamic where
1080  * 2.4 GHZ can be shared by any of high 5 GHZ or low 5GHZ at a time.
1081  * @pm_ctx: policy mgr psoc priv object
1082  *
1083  * Return: true is sbs is dynamic else false.
1084  */
1085 bool policy_mgr_can_2ghz_share_low_high_5ghz_sbs(
1086 				struct policy_mgr_psoc_priv_obj *pm_ctx);
1087 
1088 /**
1089  * policy_mgr_sbs_24_shared_with_high_5() - if 2.4 GHZ
1090  * can be shared by high 5 GHZ
1091  *
1092  * @pm_ctx: policy mgr psoc priv object
1093  *
1094  * Return: true if 2.4 GHz is shared by high 5 GHZ
1095  */
1096 bool
1097 policy_mgr_sbs_24_shared_with_high_5(struct policy_mgr_psoc_priv_obj *pm_ctx);
1098 
1099 /**
1100  * policy_mgr_sbs_24_shared_with_low_5() - if 2.4 GHZ
1101  * can be shared by low 5 GHZ
1102  *
1103  * @pm_ctx: policy mgr psoc priv object
1104  *
1105  * Return: true if 2.4 GHz is shared by low 5 GHZ
1106  */
1107 bool
1108 policy_mgr_sbs_24_shared_with_low_5(struct policy_mgr_psoc_priv_obj *pm_ctx);
1109 
1110 /**
1111  * policy_mgr_2_freq_same_mac_in_dbs() - to check provided frequencies are
1112  * in dbs freq range or not
1113  *
1114  * @pm_ctx: policy mgr psoc priv object
1115  * @freq_1: first frequency
1116  * @freq_2: second frequency
1117  *
1118  * This API is used to check provided frequencies are in dbs freq range or not
1119  *
1120  * Return: true/false.
1121  */
1122 bool
1123 policy_mgr_2_freq_same_mac_in_dbs(struct policy_mgr_psoc_priv_obj *pm_ctx,
1124 				  qdf_freq_t freq_1, qdf_freq_t freq_2);
1125 
1126 /**
1127  * policy_mgr_2_freq_same_mac_in_sbs() - to check provided frequencies are
1128  * in sbs freq range or not
1129  *
1130  * @pm_ctx: policy mgr psoc priv object
1131  * @freq_1: first frequency
1132  * @freq_2: second frequency
1133  *
1134  * This API is used to check provided frequencies are in sbs freq range or not
1135  *
1136  * Return: true/false.
1137  */
1138 bool policy_mgr_2_freq_same_mac_in_sbs(struct policy_mgr_psoc_priv_obj *pm_ctx,
1139 				       qdf_freq_t freq_1, qdf_freq_t freq_2);
1140 
1141 /**
1142  * policy_mgr_get_connection_for_vdev_id() - provides the
1143  * particular connection with the requested vdev id
1144  * @psoc: PSOC object information
1145  * @vdev_id: vdev id of the connection
1146  *
1147  * This function provides the specific connection with the
1148  * requested vdev id
1149  *
1150  * Return: index in the connection table
1151  */
1152 uint32_t policy_mgr_get_connection_for_vdev_id(struct wlan_objmgr_psoc *psoc,
1153 					       uint32_t vdev_id);
1154 
1155 #ifdef FEATURE_WLAN_CH_AVOID_EXT
1156 /**
1157  * policy_mgr_set_freq_restriction_mask() - fill the restriction_mask
1158  * in pm_ctx
1159  *
1160  * @pm_ctx: policy mgr psoc priv object
1161  * @freq_list: avoid freq indication carries freq/mask/freq count
1162  *
1163  * Return: None
1164  */
1165 void
1166 policy_mgr_set_freq_restriction_mask(struct policy_mgr_psoc_priv_obj *pm_ctx,
1167 				     struct ch_avoid_ind_type *freq_list);
1168 
1169 /**
1170  * policy_mgr_get_freq_restriction_mask() - get restriction_mask from
1171  * pm_ctx
1172  *
1173  * @pm_ctx: policy mgr psoc priv object
1174  *
1175  * Return: Restriction mask
1176  */
1177 uint32_t
1178 policy_mgr_get_freq_restriction_mask(struct policy_mgr_psoc_priv_obj *pm_ctx);
1179 #else
1180 static inline 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 #endif
1186 
1187 /**
1188  * policy_mgr_get_connection_max_channel_width() - Get max channel width
1189  * among vdevs in use
1190  * @psoc: PSOC object pointer
1191  *
1192  * This function returns max channel width among in-use vdevs
1193  *
1194  * Return: enum hw_mode_bandwidth
1195  */
1196 enum hw_mode_bandwidth
1197 policy_mgr_get_connection_max_channel_width(struct wlan_objmgr_psoc *psoc);
1198 
1199 #endif
1200