xref: /wlan-driver/qcacld-3.0/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.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_API_H
21 #define __WLAN_POLICY_MGR_API_H
22 
23 /**
24  * DOC: wlan_policy_mgr_api.h
25  *
26  * Concurrenct Connection Management entity
27  */
28 
29 /* Include files */
30 #include "qdf_types.h"
31 #include "qdf_status.h"
32 #include "wlan_objmgr_psoc_obj.h"
33 #include "wlan_mlo_mgr_public_structs.h"
34 #include "wlan_policy_mgr_public_struct.h"
35 #include "wlan_cm_roam_public_struct.h"
36 #include "wlan_utility.h"
37 #include "sir_types.h"
38 
39 struct target_psoc_info;
40 
41 typedef const enum policy_mgr_pcl_type
42 	pm_dbs_pcl_second_connection_table_type
43 	[PM_MAX_ONE_CONNECTION_MODE][PM_MAX_NUM_OF_MODE]
44 	[PM_MAX_CONC_PRIORITY_MODE];
45 
46 typedef const enum policy_mgr_pcl_type
47 	pm_dbs_pcl_third_connection_table_type
48 	[PM_MAX_TWO_CONNECTION_MODE][PM_MAX_NUM_OF_MODE]
49 	[PM_MAX_CONC_PRIORITY_MODE];
50 
51 typedef const enum policy_mgr_conc_next_action
52 	policy_mgr_next_action_two_connection_table_type
53 	[PM_MAX_ONE_CONNECTION_MODE][POLICY_MGR_MAX_BAND];
54 
55 typedef const enum policy_mgr_conc_next_action
56 	policy_mgr_next_action_three_connection_table_type
57 	[PM_MAX_TWO_CONNECTION_MODE][POLICY_MGR_MAX_BAND];
58 
59 #define PM_FW_MODE_STA_STA_BIT_POS       0
60 #define PM_FW_MODE_STA_P2P_BIT_POS       1
61 
62 #define PM_FW_MODE_STA_STA_BIT_MASK      (0x1 << PM_FW_MODE_STA_STA_BIT_POS)
63 #define PM_FW_MODE_STA_P2P_BIT_MASK      (0x1 << PM_FW_MODE_STA_P2P_BIT_POS)
64 
65 #define PM_CHANNEL_SELECT_LOGIC_STA_STA_GET(channel_select_logic_conc)  \
66 	((channel_select_logic_conc & PM_FW_MODE_STA_STA_BIT_MASK) >>   \
67 	 PM_FW_MODE_STA_STA_BIT_POS)
68 #define PM_CHANNEL_SELECT_LOGIC_STA_P2P_GET(channel_select_logic_conc)  \
69 	((channel_select_logic_conc & PM_FW_MODE_STA_P2P_BIT_MASK) >>   \
70 	 PM_FW_MODE_STA_P2P_BIT_POS)
71 
72 /**
73  * enum PM_AP_DFS_MASTER_MODE - AP dfs master mode
74  * @PM_STA_SAP_ON_DFS_DEFAULT: Disallow STA+SAP SCC on DFS channel
75  * @PM_STA_SAP_ON_DFS_MASTER_MODE_DISABLED: Allow STA+SAP SCC
76  *        on DFS channel with master mode disabled
77  * @PM_STA_SAP_ON_DFS_MASTER_MODE_FLEX: enhance
78  *        "PM_STA_SAP_ON_DFS_MASTER_MODE_DISABLED" with below requirement:
79  *	 a. Allow single SAP (GO) start on DFS channel.
80  *	 b. Allow CAC process on DFS channel in single SAP (GO) mode
81  *	 c. Allow DFS radar event process in single SAP (GO) mode
82  *	 d. Disallow CAC and radar event process in SAP (GO) + STA mode.
83  *
84  * This enum value will be used to set to INI g_sta_sap_scc_on_dfs_chan to
85  * config the sta+sap on dfs channel behaviour expected by user.
86  */
87 enum PM_AP_DFS_MASTER_MODE {
88 	PM_STA_SAP_ON_DFS_DEFAULT,
89 	PM_STA_SAP_ON_DFS_MASTER_MODE_DISABLED,
90 	PM_STA_SAP_ON_DFS_MASTER_MODE_FLEX,
91 };
92 
pcl_type_to_string(uint32_t idx)93 static inline const char *pcl_type_to_string(uint32_t idx)
94 {
95 	switch (idx) {
96 	CASE_RETURN_STRING(PM_NONE);
97 	CASE_RETURN_STRING(PM_24G);
98 	CASE_RETURN_STRING(PM_5G);
99 	CASE_RETURN_STRING(PM_SCC_CH);
100 	CASE_RETURN_STRING(PM_MCC_CH);
101 	CASE_RETURN_STRING(PM_SCC_CH_24G);
102 	CASE_RETURN_STRING(PM_SCC_CH_5G);
103 	CASE_RETURN_STRING(PM_24G_SCC_CH);
104 	CASE_RETURN_STRING(PM_5G_SCC_CH);
105 	CASE_RETURN_STRING(PM_SCC_ON_5_CH_5G);
106 	CASE_RETURN_STRING(PM_SCC_ON_5_SCC_ON_24_24G);
107 	CASE_RETURN_STRING(PM_SCC_ON_5_SCC_ON_24_5G);
108 	CASE_RETURN_STRING(PM_SCC_ON_5_5G_24G);
109 	CASE_RETURN_STRING(PM_SCC_ON_5_5G_SCC_ON_24G);
110 	CASE_RETURN_STRING(PM_SCC_ON_24_SCC_ON_5_24G);
111 	CASE_RETURN_STRING(PM_SCC_ON_24_SCC_ON_5_5G);
112 	CASE_RETURN_STRING(PM_SCC_ON_24_CH_24G);
113 	CASE_RETURN_STRING(PM_SCC_ON_5_SCC_ON_24);
114 	CASE_RETURN_STRING(PM_SCC_ON_24_SCC_ON_5);
115 	CASE_RETURN_STRING(PM_MCC_CH_24G);
116 	CASE_RETURN_STRING(PM_MCC_CH_5G);
117 	CASE_RETURN_STRING(PM_24G_MCC_CH);
118 	CASE_RETURN_STRING(PM_5G_MCC_CH);
119 	CASE_RETURN_STRING(PM_SBS_CH);
120 	CASE_RETURN_STRING(PM_SBS_CH_5G);
121 	CASE_RETURN_STRING(PM_24G_SCC_CH_SBS_CH);
122 	CASE_RETURN_STRING(PM_24G_SCC_CH_SBS_CH_5G);
123 	CASE_RETURN_STRING(PM_24G_SBS_CH_MCC_CH);
124 	/* New PCL type for DBS-SBS HW */
125 	CASE_RETURN_STRING(PM_SBS_CH_24G_SCC_CH);
126 	CASE_RETURN_STRING(PM_SBS_CH_SCC_CH_24G);
127 	CASE_RETURN_STRING(PM_SCC_CH_SBS_CH_24G);
128 	CASE_RETURN_STRING(PM_SBS_CH_SCC_CH_5G_24G);
129 	CASE_RETURN_STRING(PM_SCC_CH_MCC_CH_SBS_CH_24G);
130 	CASE_RETURN_STRING(PM_SBS_CH_2G);
131 	CASE_RETURN_STRING(PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G);
132 	CASE_RETURN_STRING(PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G);
133 	CASE_RETURN_STRING(PM_SCC_ON_5G_HIGH_5G_HIGH_SCC_ON_5G_LOW_PLUS_SHARED_2G);
134 	CASE_RETURN_STRING(PM_SBS_CH_MCC_CH);
135 	CASE_RETURN_STRING(PM_SBS_5G_MCC_24G);
136 	default:
137 		return "Unknown";
138 	}
139 }
140 
device_mode_to_string(uint32_t idx)141 static inline const char *device_mode_to_string(uint32_t idx)
142 {
143 	switch (idx) {
144 	CASE_RETURN_STRING(PM_STA_MODE);
145 	CASE_RETURN_STRING(PM_SAP_MODE);
146 	CASE_RETURN_STRING(PM_P2P_CLIENT_MODE);
147 	CASE_RETURN_STRING(PM_P2P_GO_MODE);
148 	CASE_RETURN_STRING(PM_NDI_MODE);
149 	CASE_RETURN_STRING(PM_NAN_DISC_MODE);
150 	CASE_RETURN_STRING(PM_LL_LT_SAP_MODE);
151 	default:
152 		return "Unknown";
153 	}
154 };
155 
156 /**
157  * struct trim_chan_info - trim channel info
158  * @band_capability: band capability
159  * @sap_count: sap count
160  * @trim: enum trim channel list
161  */
162 struct trim_chan_info {
163 	uint32_t band_capability;
164 	uint32_t sap_count;
165 	uint16_t trim;
166 };
167 
168 /**
169  * policy_mgr_get_allow_mcc_go_diff_bi() - to get information on whether GO
170  *						can have diff BI than STA in MCC
171  * @psoc: pointer to psoc
172  * @allow_mcc_go_diff_bi: value to be filled
173  *
174  * This API is used to find out whether GO's BI can different than STA in MCC
175  * scenario
176  *
177  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
178  */
179 QDF_STATUS
180 policy_mgr_get_allow_mcc_go_diff_bi(struct wlan_objmgr_psoc *psoc,
181 				    uint8_t *allow_mcc_go_diff_bi);
182 /**
183  * policy_mgr_get_dual_mac_feature() - to find out if DUAL MAC feature is
184  *				       enabled
185  * @psoc: pointer to psoc
186  * @dual_mac_feature: value to be filled
187  *
188  * This API is used to find out whether dual mac (dual radio) specific feature
189  * is enabled or not
190  *
191  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
192  */
193 QDF_STATUS policy_mgr_get_dual_mac_feature(struct wlan_objmgr_psoc *psoc,
194 					   uint8_t *dual_mac_feature);
195 
196 /**
197  * policy_mgr_allow_multiple_sta_connections() - to find out if STA+STA feature
198  * is enabled.
199  * @psoc: pointer to psoc
200  *
201  * This API is used to find out whether STA+STA specific feature is enabled
202  * or not
203  *
204  * Return: true if supports else false.
205  */
206 bool policy_mgr_allow_multiple_sta_connections(struct wlan_objmgr_psoc *psoc);
207 
208 /**
209  * policy_mgr_set_dual_mac_feature() - to set the dual mac feature value
210  * @psoc: pointer to psoc
211  * @dual_mac_feature: value to be updated
212  *
213  * This API is used to update the dual mac (dual radio) specific feature value
214  *
215  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
216  */
217 QDF_STATUS policy_mgr_set_dual_mac_feature(struct wlan_objmgr_psoc *psoc,
218 					   uint8_t dual_mac_feature);
219 
220 /**
221  * policy_mgr_get_force_1x1() - to find out if 1x1 connection is enforced
222  *
223  * @psoc: pointer to psoc
224  * @force_1x1: value to be filled
225  *
226  * This API is used to find out if 1x1 connection is enforced.
227  *
228  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
229  */
230 QDF_STATUS policy_mgr_get_force_1x1(struct wlan_objmgr_psoc *psoc,
231 				    uint8_t *force_1x1);
232 
233 /**
234  * policy_mgr_get_max_conc_cxns() - to get configured max concurrent active
235  * connection count
236  *
237  * @psoc: pointer to psoc
238  *
239  * This API is used to query the configured max concurrent active connection
240  * count.
241  *
242  * Return: max active connection count
243  */
244 uint32_t policy_mgr_get_max_conc_cxns(struct wlan_objmgr_psoc *psoc);
245 
246 /**
247  * policy_mgr_set_max_conc_cxns() - to set supported max concurrent active
248  * connection count to policy mgr
249  *
250  * @psoc: pointer to psoc
251  * @max_conc_cxns: max active connection count
252  *
253  * This API is used to update the max concurrent active connection
254  * count to policy mgr
255  *
256  * Return: QDF_STATUS_SUCCESS if set successfully
257  */
258 QDF_STATUS policy_mgr_set_max_conc_cxns(struct wlan_objmgr_psoc *psoc,
259 					uint32_t max_conc_cxns);
260 
261 /**
262  * policy_mgr_set_sta_sap_scc_on_dfs_chnl() - to set sta_sap_scc_on_dfs_chnl
263  * @psoc: pointer to psoc
264  * @sta_sap_scc_on_dfs_chnl: value to be set
265  *
266  * This API is used to set sta_sap_scc_on_dfs_chnl
267  *
268  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
269  */
270 QDF_STATUS
271 policy_mgr_set_sta_sap_scc_on_dfs_chnl(struct wlan_objmgr_psoc *psoc,
272 				       uint8_t sta_sap_scc_on_dfs_chnl);
273 
274 /**
275  * policy_mgr_get_sta_sap_scc_on_dfs_chnl() - to find out if STA and SAP
276  *						   SCC is allowed on DFS channel
277  * @psoc: pointer to psoc
278  * @sta_sap_scc_on_dfs_chnl: value to be filled
279  *
280  * This API is used to find out whether STA and SAP SCC is allowed on
281  * DFS channels
282  *
283  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
284  */
285 QDF_STATUS
286 policy_mgr_get_sta_sap_scc_on_dfs_chnl(struct wlan_objmgr_psoc *psoc,
287 				       uint8_t *sta_sap_scc_on_dfs_chnl);
288 
289 /**
290  * policy_mgr_set_multi_sap_allowed_on_same_band() - to set
291  * multi_sap_allowed_on_same_band
292  * @psoc: pointer to psoc
293  * @multi_sap_allowed_on_same_band: value to be set
294  *
295  * This API is used to set multi_sap_allowed_on_same_band
296  *
297  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
298  */
299 QDF_STATUS
300 policy_mgr_set_multi_sap_allowed_on_same_band(struct wlan_objmgr_psoc *psoc,
301 				bool multi_sap_allowed_on_same_band);
302 
303 /**
304  * policy_mgr_get_sta_sap_scc_allowed_on_indoor_chnl() - Get if STA-SAP scc is
305  * allowed on indoor channel
306  * @psoc: Global psoc pointer
307  *
308  * Return: true if STA-SAP SCC on indoor channel is allowed
309  */
310 bool policy_mgr_get_sta_sap_scc_allowed_on_indoor_chnl(
311 				struct wlan_objmgr_psoc *psoc);
312 
313 /**
314  * policy_mgr_get_multi_sap_allowed_on_same_band() - to find out if multi sap
315  * is allowed on same band
316  * @psoc: pointer to psoc
317  * @multi_sap_allowed_on_same_band: value to be filled
318  *
319  * This API is used to find out whether multi sap is allowed on same band
320  *
321  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
322  */
323 QDF_STATUS
324 policy_mgr_get_multi_sap_allowed_on_same_band(struct wlan_objmgr_psoc *psoc,
325 				bool *multi_sap_allowed_on_same_band);
326 
327 /**
328  * policy_mgr_set_original_bw_for_sap_restart() - to set use_sap_original_bw
329  * @psoc: pointer to psoc
330  * @use_sap_original_bw: value to be set
331  *
332  * This API is used to set use_sap_original_bw
333  *
334  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
335  */
336 QDF_STATUS
337 policy_mgr_set_original_bw_for_sap_restart(struct wlan_objmgr_psoc *psoc,
338 					   bool use_sap_original_bw);
339 
340 /**
341  * policy_mgr_get_original_bw_for_sap_restart() - to find out if sap original
342  * bw is used as default BW when do sap restart
343  * @psoc: pointer to psoc
344  * @use_sap_original_bw: value to be filled
345  *
346  * This API is used to find out whether sap original BW is used as default BW
347  *
348  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
349  */
350 QDF_STATUS
351 policy_mgr_get_original_bw_for_sap_restart(struct wlan_objmgr_psoc *psoc,
352 					   bool *use_sap_original_bw);
353 
354 /**
355  * policy_mgr_get_dfs_sta_sap_go_scc_movement() - returns SAP / GO's movement
356  * in STA+SAP DFS SCC concurrency to whether SAP / GO should be moved first
357  * or not.
358  * @psoc: pointer to psoc
359  * @move_sap_go_first: value to be filled
360  *
361  * In STA+SAP DFS SCC concurrency, this API returns config on whether to move
362  * SAP / GO first on getting CSA STA side or not.
363  *
364  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
365  */
366 QDF_STATUS
367 policy_mgr_get_dfs_sta_sap_go_scc_movement(struct wlan_objmgr_psoc *psoc,
368 					   bool *move_sap_go_first);
369 
370  /**
371   * policy_mgr_nss_update_cb() - callback from SME confirming nss
372   * update
373   * @psoc: psoc handle
374   * @tx_status: tx completion status for updated beacon with new
375   *              nss value
376   * @vdev_id: vdev id for the specific connection
377   * @next_action: next action to happen at policy mgr after
378   *              beacon update
379   * @reason: Reason for nss update
380   * @original_vdev_id: original request hwmode change vdev id
381   * @request_id: request ID
382   *
383   * This function is the callback registered with SME at nss
384   * update request time
385   *
386   * Return: None
387   */
388 
389 void policy_mgr_nss_update_cb(struct wlan_objmgr_psoc *psoc,
390 			      uint8_t tx_status, uint8_t vdev_id,
391 			      uint8_t next_action,
392 			      enum policy_mgr_conn_update_reason reason,
393 			      uint32_t original_vdev_id, uint32_t request_id);
394 /*
395  * policy_mgr_get_connected_vdev_band_mask() - to get the connected vdev band
396  * mask
397  * @vdev: pointer to vdev
398  *
399  * This API is used to get band of the frequency.
400  *
401  * Return: band mask of the frequency associated with the vdev
402  */
403 uint32_t policy_mgr_get_connected_vdev_band_mask(struct wlan_objmgr_vdev *vdev);
404 
405 /**
406  * policy_mgr_get_dfs_master_dynamic_enabled() - support dfs master or not
407  * on AP interface when STA+SAP(GO) concurrency
408  * @psoc: pointer to psoc
409  * @vdev_id: sap vdev id
410  *
411  * This API is used to check AP dfs master functionality enabled or not when
412  * STA+SAP(GO) concurrency.
413  * If g_sta_sap_scc_on_dfs_chan is non-zero, the STA+SAP(GO) concurrency
414  * is allowed on DFS channel SCC and the SAP's DFS master functionality
415  * should be enable/disable according to:
416  * 1. g_sta_sap_scc_on_dfs_chan is 0: function return true - dfs master
417  *     capability enabled.
418  * 2. g_sta_sap_scc_on_dfs_chan is 1: function return false - dfs master
419  *     capability disabled.
420  * 3. g_sta_sap_scc_on_dfs_chan is 2: dfs master capability based on STA on
421  *     5G or not:
422  *      a. 5G STA active - return false
423  *      b. no 5G STA active -return true
424  *
425  * Return: true if dfs master functionality should be enabled.
426  */
427 bool
428 policy_mgr_get_dfs_master_dynamic_enabled(struct wlan_objmgr_psoc *psoc,
429 					  uint8_t vdev_id);
430 
431 /**
432  * policy_mgr_get_can_skip_radar_event - Can skip DFS Radar event or not
433  * @psoc: soc obj
434  * @vdev_id: sap vdev id
435  *
436  * This API is used by dfs component to get decision whether to ignore
437  * the radar event or not.
438  *
439  * Return: true if Radar event should be ignored.
440  */
441 bool
442 policy_mgr_get_can_skip_radar_event(struct wlan_objmgr_psoc *psoc,
443 				    uint8_t vdev_id);
444 
445 /**
446  * policy_mgr_get_sta_sap_scc_lte_coex_chnl() - to find out if STA & SAP
447  *						     SCC is allowed on LTE COEX
448  * @psoc: pointer to psoc
449  * @sta_sap_scc_lte_coex: value to be filled
450  *
451  * This API is used to find out whether STA and SAP scc is allowed on LTE COEX
452  * channel
453  *
454  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
455  */
456 QDF_STATUS
457 policy_mgr_get_sta_sap_scc_lte_coex_chnl(struct wlan_objmgr_psoc *psoc,
458 					 uint8_t *sta_sap_scc_lte_coex);
459 /**
460  * policy_mgr_get_sap_mandt_chnl() - to find out if SAP mandatory channel
461  *					  support is enabled
462  * @psoc: pointer to psoc
463  * @sap_mandt_chnl: value to be filled
464  *
465  * This API is used to find out whether SAP's mandatory channel support
466  * is enabled
467  *
468  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
469  */
470 QDF_STATUS policy_mgr_get_sap_mandt_chnl(struct wlan_objmgr_psoc *psoc,
471 					 uint8_t *sap_mandt_chnl);
472 /**
473  * policy_mgr_get_indoor_chnl_marking() - to get if indoor channel can be
474  *						marked as disabled
475  * @psoc: pointer to psoc
476  * @indoor_chnl_marking: value to be filled
477  *
478  * This API is used to find out whether indoor channel can be marked as disabled
479  *
480  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
481  */
482 QDF_STATUS
483 policy_mgr_get_indoor_chnl_marking(struct wlan_objmgr_psoc *psoc,
484 				   uint8_t *indoor_chnl_marking);
485 /**
486  * policy_mgr_get_mcc_scc_switch() - To mcc to scc switch setting from INI
487  * @psoc: pointer to psoc
488  * @mcc_scc_switch: value to be filled
489  *
490  * This API pulls mcc to scc switch setting which is given as part of INI and
491  * stored in policy manager's CFGs.
492  *
493  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
494  */
495 QDF_STATUS policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
496 					 uint8_t *mcc_scc_switch);
497 /**
498  * policy_mgr_get_sys_pref() - to get system preference
499  * @psoc: pointer to psoc
500  * @sys_pref: value to be filled
501  *
502  * This API pulls the system preference for policy manager to provide
503  * PCL
504  *
505  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
506  */
507 QDF_STATUS policy_mgr_get_sys_pref(struct wlan_objmgr_psoc *psoc,
508 				   uint8_t *sys_pref);
509 /**
510  * policy_mgr_set_sys_pref() - to set system preference
511  * @psoc: pointer to psoc
512  * @sys_pref: value to be applied as new INI setting
513  *
514  * This API is meant to override original INI setting for system pref
515  * with new value which is used by policy manager to provide PCL
516  *
517  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
518  */
519 QDF_STATUS policy_mgr_set_sys_pref(struct wlan_objmgr_psoc *psoc,
520 				   uint8_t sys_pref);
521 
522 /**
523  * policy_mgr_get_conc_rule1() - to find out if conc rule1 is enabled
524  * @psoc: pointer to psoc
525  * @conc_rule1: value to be filled
526  *
527  * This API is used to find out if conc rule-1 is enabled by user
528  *
529  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
530  */
531 QDF_STATUS policy_mgr_get_conc_rule1(struct wlan_objmgr_psoc *psoc,
532 				     uint8_t *conc_rule1);
533 /**
534  * policy_mgr_get_conc_rule2() - to find out if conc rule2 is enabled
535  * @psoc: pointer to psoc
536  * @conc_rule2: value to be filled
537  *
538  * This API is used to find out if conc rule-2 is enabled by user
539  *
540  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
541  */
542 QDF_STATUS policy_mgr_get_conc_rule2(struct wlan_objmgr_psoc *psoc,
543 				     uint8_t *conc_rule2);
544 
545 /**
546  * policy_mgr_get_chnl_select_plcy() - to get channel selection policy
547  * @psoc: pointer to psoc
548  * @chnl_select_plcy: value to be filled
549  *
550  * This API is used to find out which channel selection policy has been
551  * configured
552  *
553  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
554  */
555 QDF_STATUS policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc,
556 					   uint32_t *chnl_select_plcy);
557 
558 /**
559  * policy_mgr_set_ch_select_plcy() - to set channel selection policy
560  * @psoc: pointer to psoc
561  * @ch_select_policy: value to be set
562  *
563  * This API is used to set the ch selection policy.
564  *
565  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
566  */
567 QDF_STATUS policy_mgr_set_ch_select_plcy(struct wlan_objmgr_psoc *psoc,
568 					 uint32_t ch_select_policy);
569 
570 /**
571  * policy_mgr_get_dynamic_mcc_adaptive_sch() - to get dynamic mcc adaptive
572  *                                             scheduler
573  * @psoc: pointer to psoc
574  * @dynamic_mcc_adaptive_sched: value to be filled
575  *
576  * This API is used to get dynamic mcc adaptive scheduler
577  *
578  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
579  */
580 QDF_STATUS policy_mgr_get_dynamic_mcc_adaptive_sch(
581 				struct wlan_objmgr_psoc *psoc,
582 				bool *dynamic_mcc_adaptive_sched);
583 
584 /**
585  * policy_mgr_set_dynamic_mcc_adaptive_sch() - to set dynamic mcc adaptive
586  *                                             scheduler
587  * @psoc: pointer to psoc
588  * @dynamic_mcc_adaptive_sched: value to be set
589  *
590  * This API is used to set dynamic mcc adaptive scheduler
591  *
592  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
593  */
594 QDF_STATUS policy_mgr_set_dynamic_mcc_adaptive_sch(
595 				struct wlan_objmgr_psoc *psoc,
596 				bool dynamic_mcc_adaptive_sched);
597 
598 /**
599  * policy_mgr_get_mcc_adaptive_sch() - to get mcc adaptive scheduler
600  * @psoc: pointer to psoc
601  * @enable_mcc_adaptive_sch: value to be filled
602  *
603  * This API is used to find out if mcc adaptive scheduler enabled or disabled
604  *
605  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
606  */
607 QDF_STATUS policy_mgr_get_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
608 					   bool *enable_mcc_adaptive_sch);
609 
610 /**
611  * policy_mgr_get_sta_cxn_5g_band() - to get STA's connection in 5G config
612  *
613  * @psoc: pointer to psoc
614  * @enable_sta_cxn_5g_band: value to be filled
615  *
616  * This API is used to find out if STA connection in 5G band is allowed or
617  * disallowed.
618  *
619  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
620  */
621 QDF_STATUS policy_mgr_get_sta_cxn_5g_band(struct wlan_objmgr_psoc *psoc,
622 					  uint8_t *enable_sta_cxn_5g_band);
623 /**
624  * policy_mgr_set_concurrency_mode() - To set concurrency mode
625  * @psoc: PSOC object data
626  * @mode: device mode
627  *
628  * This routine is called to set the concurrency mode
629  *
630  * Return: NONE
631  */
632 void policy_mgr_set_concurrency_mode(struct wlan_objmgr_psoc *psoc,
633 				     enum QDF_OPMODE mode);
634 
635 /**
636  * policy_mgr_clear_concurrency_mode() - To clear concurrency mode
637  * @psoc: PSOC object data
638  * @mode: device mode
639  *
640  * This routine is called to clear the concurrency mode
641  *
642  * Return: NONE
643  */
644 void policy_mgr_clear_concurrency_mode(struct wlan_objmgr_psoc *psoc,
645 				       enum QDF_OPMODE mode);
646 
647 /**
648  * policy_mgr_get_connection_count() - provides the count of
649  * current connections
650  * @psoc: PSOC object information
651  *
652  * This function provides the count of current connections
653  *
654  * Return: connection count
655  */
656 uint32_t policy_mgr_get_connection_count(struct wlan_objmgr_psoc *psoc);
657 
658 /**
659  * policy_mgr_get_connection_count_with_mlo() - provides the count of
660  * current connections
661  * @psoc: PSOC object information
662  *
663  * This function provides the count of current connections, MLD dev count
664  * 1 connection no matter how many links connection.
665  *
666  * Return: connection count
667  */
668 uint32_t
669 policy_mgr_get_connection_count_with_mlo(struct wlan_objmgr_psoc *psoc);
670 
671 /**
672  * policy_mgr_get_concurrency_mode() - return concurrency mode
673  * @psoc: PSOC object information
674  *
675  * This routine is used to retrieve concurrency mode
676  *
677  * Return: uint32_t value of concurrency mask
678  */
679 uint32_t policy_mgr_get_concurrency_mode(struct wlan_objmgr_psoc *psoc);
680 
681 /**
682  * policy_mgr_is_chnl_in_diff_band() - to check that given channel
683  * is in diff band from existing channel or not
684  * @psoc: pointer to psoc
685  * @ch_freq: given channel frequency
686  *
687  * This API will check that if the passed channel is in diff band than the
688  * already existing connections or not.
689  *
690  * Return: true if channel is in diff band
691  */
692 bool policy_mgr_is_chnl_in_diff_band(struct wlan_objmgr_psoc *psoc,
693 				     uint32_t ch_freq);
694 
695 /**
696  * policy_mgr_is_pcl_weightage_required() - to check that PCL weightage req or
697  * not
698  * @psoc: pointer to psoc
699  *
700  * This API will check that whether PCL weightage need to consider in best
701  * candidate selection or not. If some APs are in PCL list, those AP will get
702  * additional weightage.
703  *
704  * Return: true if pcl weightage is not required
705  */
706 bool policy_mgr_is_pcl_weightage_required(struct wlan_objmgr_psoc *psoc);
707 
708 /**
709  * policy_mgr_check_for_session_conc() - Check if concurrency is
710  * allowed for a session
711  * @psoc: PSOC object information
712  * @vdev_id: Vdev ID
713  * @ch_freq: Channel frequency
714  *
715  * Checks if connection is allowed for a given session_id
716  *
717  * True if the concurrency is allowed, false otherwise
718  */
719 bool policy_mgr_check_for_session_conc(struct wlan_objmgr_psoc *psoc,
720 				       uint8_t vdev_id, uint32_t ch_freq);
721 
722 /**
723  * policy_mgr_handle_conc_multiport() - to handle multiport concurrency
724  * @psoc: PSOC object information
725  * @vdev_id: Vdev ID
726  * @ch_freq: Channel frequency
727  * @reason: reason for connection update
728  * @request_id: Request id provided by the requester, can be used while
729  * calling callback to the requester
730  *
731  * This routine will handle STA side concurrency when policy manager
732  * is enabled.
733  *
734  * Return: QDF_STATUS
735  */
736 QDF_STATUS
737 policy_mgr_handle_conc_multiport(struct wlan_objmgr_psoc *psoc,
738 				 uint8_t vdev_id, uint32_t ch_freq,
739 				 enum policy_mgr_conn_update_reason reason,
740 				 uint32_t request_id);
741 
742 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
743 /**
744  * policy_mgr_check_concurrent_intf_and_restart_sap() - Check
745  * concurrent change intf
746  * @psoc: PSOC object information
747  * @is_acs_mode: Indicates whether SAP is started in ACS mode
748  *
749  * Checks the concurrent change interface and restarts SAP
750  *
751  * Return: None
752  */
753 void policy_mgr_check_concurrent_intf_and_restart_sap(
754 		struct wlan_objmgr_psoc *psoc, bool is_acs_mode);
755 #else
policy_mgr_check_concurrent_intf_and_restart_sap(struct wlan_objmgr_psoc * psoc,bool is_acs_mode)756 void policy_mgr_check_concurrent_intf_and_restart_sap(
757 		struct wlan_objmgr_psoc *psoc, bool is_acs_mode)
758 {
759 
760 }
761 #endif /* FEATURE_WLAN_MCC_TO_SCC_SWITCH */
762 
763 /**
764  * policy_mgr_is_chan_switch_in_progress() - Check if any SAP/GO
765  * CSA is in progress or not
766  * @psoc: PSOC object information
767  *
768  * Return: true if AP CSA is in progress
769  */
770 bool policy_mgr_is_chan_switch_in_progress(struct wlan_objmgr_psoc *psoc);
771 
772 /**
773  * policy_mgr_wait_chan_switch_complete_evt() - Wait for SAP/GO CSA complete
774  * event
775  * @psoc: PSOC object information
776  *
777  * Return: QDF_STATUS_SUCCESS if CSA complete
778  */
779 QDF_STATUS policy_mgr_wait_chan_switch_complete_evt(
780 		struct wlan_objmgr_psoc *psoc);
781 
782 /**
783  * policy_mgr_is_ap_start_in_progress() - Check if any SAP/GO
784  * start is in progress or not
785  * @psoc: PSOC object information
786  *
787  * Return: true if AP starting is in progress
788  */
789 bool policy_mgr_is_ap_start_in_progress(struct wlan_objmgr_psoc *psoc);
790 
791 /**
792  * policy_mgr_get_conc_vdev_on_same_mac() - Function to get concurrent
793  *                                          vdev on same mac
794  * @psoc: PSOC object information
795  * @vdev_id: vdev id
796  * @mac_id: mac id
797  *
798  * This function is used to get the concurrent vdev on same mac
799  *
800  * Return: vdev id of the concurrent interface running on same mac
801  *
802  */
803 uint32_t policy_mgr_get_conc_vdev_on_same_mac(struct wlan_objmgr_psoc *psoc,
804 					      uint32_t vdev_id, uint8_t mac_id);
805 
806 #ifdef WLAN_FEATURE_SR
807 /**
808  * policy_mgr_sr_same_mac_conc_enabled() - Function to check same MAC
809  *					   concurrency support in Spatial Reuse
810  * @psoc: PSOC object information
811  *
812  * This function is used to check whether concurrency is supported
813  * on same mac or not with Spatial Reuse enabled.
814  *
815  * Return: True if same MAC concurrency is supported with Spatial Reuse
816  *	   else False.
817  */
818 bool policy_mgr_sr_same_mac_conc_enabled(struct wlan_objmgr_psoc *psoc);
819 #else
820 static inline
policy_mgr_sr_same_mac_conc_enabled(struct wlan_objmgr_psoc * psoc)821 bool policy_mgr_sr_same_mac_conc_enabled(struct wlan_objmgr_psoc *psoc)
822 {
823 	return false;
824 }
825 
826 #endif
827 
828 /**
829  * policy_mgr_is_mcc_in_24G() - Function to check for MCC in 2.4GHz
830  * @psoc: PSOC object information
831  *
832  * This function is used to check for MCC operation in 2.4GHz band.
833  * STA, P2P and SAP adapters are only considered.
834  *
835  * Return: True if mcc is detected in 2.4 Ghz, false otherwise
836  *
837  */
838 bool policy_mgr_is_mcc_in_24G(struct wlan_objmgr_psoc *psoc);
839 
840 /**
841  * policy_mgr_change_mcc_go_beacon_interval() - Change MCC beacon interval
842  * @psoc: PSOC object information
843  * @vdev_id: vdev id
844  * @dev_mode: device mode
845  *
846  * Updates the beacon parameters of the GO in MCC scenario
847  *
848  * Return: Success or Failure depending on the overall function behavior
849  */
850 QDF_STATUS policy_mgr_change_mcc_go_beacon_interval(
851 		struct wlan_objmgr_psoc *psoc,
852 		uint8_t vdev_id, enum QDF_OPMODE dev_mode);
853 
854 #if defined(FEATURE_WLAN_MCC_TO_SCC_SWITCH)
855 /**
856  * policy_mgr_check_bw_with_unsafe_chan_freq() - valid SAP channel bw against
857  *                                               unsafe channel list
858  * @psoc: PSOC object information
859  * @center_freq: SAP channel center frequency
860  * @ch_width: SAP channel width
861  *
862  * Return: true if no unsafe channel fall in SAP channel bandwidth range,
863  *         false otherwise
864  */
865 bool policy_mgr_check_bw_with_unsafe_chan_freq(struct wlan_objmgr_psoc *psoc,
866 					       qdf_freq_t center_freq,
867 					       enum phy_ch_width ch_width);
868 /**
869  * policy_mgr_change_sap_channel_with_csa() - Move SAP channel using (E)CSA
870  * @psoc: PSOC object information
871  * @vdev_id: Vdev id
872  * @ch_freq: Channel frequency to change
873  * @ch_width: channel width to change
874  * @forced: Force to switch channel, ignore SCC/MCC check
875  *
876  * Invoke the callback function to change SAP channel using (E)CSA
877  *
878  * Return: QDF_STATUS_SUCCESS on success
879  */
880 QDF_STATUS
881 policy_mgr_change_sap_channel_with_csa(struct wlan_objmgr_psoc *psoc,
882 				       uint8_t vdev_id, uint32_t ch_freq,
883 				       uint32_t ch_width, bool forced);
884 
885 #else
886 static inline QDF_STATUS
policy_mgr_change_sap_channel_with_csa(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint32_t ch_freq,uint32_t ch_width,bool forced)887 policy_mgr_change_sap_channel_with_csa(struct wlan_objmgr_psoc *psoc,
888 				       uint8_t vdev_id, uint32_t ch_freq,
889 				       uint32_t ch_width, bool forced)
890 {
891 	return QDF_STATUS_SUCCESS;
892 }
893 #endif
894 
895 /**
896  * policy_mgr_sta_sap_dfs_scc_conc_check() - validate and Move SAP channel
897  * using (E)CSA
898  *
899  * @psoc: PSOC object information
900  * @vdev_id: Vdev id
901  * @csa_event: Pointer to CSA IE Received event data
902  *
903  * Invoke the function to change SAP channel using (E)CSA for STA+GO / SAP
904  * SCC scenario only. This function will move P2P-GO / SAP first and then STA
905  * will follow.
906  *
907  * Return: QDF_STATUS_SUCCESS on success
908  */
909 QDF_STATUS
910 policy_mgr_sta_sap_dfs_scc_conc_check(struct wlan_objmgr_psoc *psoc,
911 				      uint8_t vdev_id,
912 				      struct csa_offload_params *csa_event);
913 
914 /**
915  * policy_mgr_sta_sap_dfs_enforce_scc() - validate and enforce SCC
916  * using (E)CSA upon receiving 1st beacon
917  *
918  * @psoc: PSOC object information
919  * @vdev_id: Vdev id
920  *
921  * Invoke the function to enforce SCC upon receiving 1st beacon. SAP / GO
922  * movement will be triggered using (E)CSA for STA+GO / SAP DFS scenario only.
923  * The pre-requisite for this function is SAP / GO shall already moved to new
924  * channel by policy_mgr_sta_sap_dfs_scc_conc_check() function.
925  *
926  * Return: void
927  */
928 void policy_mgr_sta_sap_dfs_enforce_scc(struct wlan_objmgr_psoc *psoc,
929 					uint8_t vdev_id);
930 
931 #ifdef WLAN_FEATURE_P2P_P2P_STA
932 /**
933  * policy_mgr_is_p2p_p2p_conc_supported() - p2p concurrency support
934  * @psoc: pointer to psoc
935  *
936  * This API is used to check whether firmware supports p2p concurrency
937  *
938  * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
939  */
940 bool
941 policy_mgr_is_p2p_p2p_conc_supported(struct wlan_objmgr_psoc *psoc);
942 #else
943 static inline bool
policy_mgr_is_p2p_p2p_conc_supported(struct wlan_objmgr_psoc * psoc)944 policy_mgr_is_p2p_p2p_conc_supported(struct wlan_objmgr_psoc *psoc)
945 {
946 	return false;
947 }
948 #endif
949 
950 /**
951  * policy_mgr_fetch_existing_con_info() - check if another vdev
952  * is present and find mode, freq , vdev id and chan width
953  *
954  * @psoc: psoc object
955  * @vdev_id: vdev id
956  * @curr_go_freq: frequency
957  * @mode: existing vdev mode
958  * @con_freq: existing connection freq
959  * @ch_width: ch_width of existing connection
960  *
961  * This function checks if another vdev is there and fetch connection
962  * info for that vdev.This is mainly for force SCC implementation of GO+GO ,
963  * GO+SAP or GO+STA where we fetch other existing GO, STA, SAP on the same
964  * band with MCC.
965  *
966  * Return: vdev_id
967  */
968 uint8_t
969 policy_mgr_fetch_existing_con_info(struct wlan_objmgr_psoc *psoc,
970 				   uint8_t vdev_id, uint32_t curr_go_freq,
971 				   enum policy_mgr_con_mode *mode,
972 				   uint32_t *con_freq,
973 				   enum phy_ch_width *ch_width);
974 
975 #define GO_FORCE_SCC_DISABLE 0
976 #define GO_FORCE_SCC_STRICT 1
977 #define GO_FORCE_SCC_LIBERAL 2
978 /*
979  * Stay in MCC for 1 second, in case of first p2p go channel
980  * needs to be moved to curr go channel
981  */
982 #define WAIT_BEFORE_GO_FORCESCC_RESTART (1000)
983 
984 #ifdef WLAN_FEATURE_P2P_P2P_STA
985 /**
986  * policy_mgr_is_go_scc_strict() - Get GO force SCC enabled or not
987  * @psoc: psoc object
988  *
989  * This function checks if force SCC logic should be used on GO interface
990  * as a strict mode.
991  *
992  * Return: True if p2p needs o be start on provided channel only.
993  */
994 bool policy_mgr_is_go_scc_strict(struct wlan_objmgr_psoc *psoc);
995 
996 /**
997  * policy_mgr_process_forcescc_for_go () - start work queue to move first p2p go
998  * to new p2p go's channel
999  *
1000  * @psoc: PSOC object information
1001  * @vdev_id: Vdev id
1002  * @ch_freq: Channel frequency to change
1003  * @ch_width: channel width to change
1004  * @mode: existing vdev mode
1005  *
1006  * starts delayed work queue of 1 second to move first p2p go to new
1007  * p2p go's channel.
1008  *
1009  * Return: None
1010  */
1011 void policy_mgr_process_forcescc_for_go(
1012 		struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
1013 		uint32_t ch_freq, uint32_t ch_width,
1014 		enum policy_mgr_con_mode mode);
1015 
1016 /**
1017  * policy_mgr_do_go_plus_go_force_scc() - First p2p go
1018  * to new p2p go's channel
1019  *
1020  * @psoc: PSOC object information
1021  * @vdev_id: Vdev id
1022  * @ch_freq: Channel frequency to change
1023  * @ch_width: channel width to change
1024  *
1025  * Move first p2p go to new
1026  * p2p go's channel.
1027  *
1028  * Return: None
1029  */
1030 void policy_mgr_do_go_plus_go_force_scc(
1031 		struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
1032 		uint32_t ch_freq, uint32_t ch_width);
1033 #else
1034 static inline
policy_mgr_is_go_scc_strict(struct wlan_objmgr_psoc * psoc)1035 bool policy_mgr_is_go_scc_strict(struct wlan_objmgr_psoc *psoc)
1036 {
1037 	return false;
1038 }
1039 
1040 static inline
policy_mgr_process_forcescc_for_go(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint32_t ch_freq,uint32_t ch_width,enum policy_mgr_con_mode mode)1041 void policy_mgr_process_forcescc_for_go(
1042 		struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
1043 		uint32_t ch_freq, uint32_t ch_width,
1044 		enum policy_mgr_con_mode mode)
1045 {}
1046 
1047 static inline
policy_mgr_do_go_plus_go_force_scc(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint32_t ch_freq,uint32_t ch_width)1048 void policy_mgr_do_go_plus_go_force_scc(
1049 		struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
1050 		uint32_t ch_freq, uint32_t ch_width)
1051 {}
1052 #endif
1053 
1054 /**
1055  * policy_mgr_process_force_scc_for_nan () - force SAP scc on nan freq
1056  *
1057  * @psoc: PSOC object information
1058  *
1059  * Return: None
1060  */
1061 void policy_mgr_process_force_scc_for_nan(struct wlan_objmgr_psoc *psoc);
1062 
1063 /**
1064  * policy_mgr_check_sap_go_force_scc() - Check SAP GO MCC and save interface
1065  * information
1066  * @psoc: pointer to psoc
1067  * @vdev: initiator vdev
1068  * @reason_code: CSA reason code
1069  *
1070  * This API will check SAP and GO are coexistent on same band MCC or not. If
1071  * it is, the interface ids will be saved and a delayed workqueue will be
1072  * scheduled. The workqueue will handle the new channel selection and change
1073  * the channel of second interface to avoid MCC.
1074  *
1075  * Return: QDF_STATUS
1076  */
1077 QDF_STATUS
1078 policy_mgr_check_sap_go_force_scc(struct wlan_objmgr_psoc *psoc,
1079 				  struct wlan_objmgr_vdev *vdev,
1080 				  enum sap_csa_reason_code reason_code);
1081 
1082 /**
1083  * policy_mgr_set_pcl_for_existing_combo() - SET PCL for existing combo
1084  * @psoc: PSOC object information
1085  * @mode: Adapter mode
1086  * @vdev_id: Vdev Id
1087  *
1088  * Return: None
1089  */
1090 void policy_mgr_set_pcl_for_existing_combo(struct wlan_objmgr_psoc *psoc,
1091 					   enum policy_mgr_con_mode mode,
1092 					   uint8_t vdev_id);
1093 
1094 /**
1095  * policy_mgr_set_pcl_for_connected_vdev() - Set the PCL for connected vdevs
1096  * @psoc: PSOC object information
1097  * @vdev_id: Vdev Id
1098  * @clear_pcl: option to clear the PCL first before setting the new one
1099  *
1100  * This API will set the preferred channel list for other connected vdevs aside
1101  * from the calling function's vdev
1102  *
1103  * Context: Any kernel thread
1104  * Return: None
1105  */
1106 void policy_mgr_set_pcl_for_connected_vdev(struct wlan_objmgr_psoc *psoc,
1107 					   uint8_t vdev_id, bool clear_pcl);
1108 
1109 /**
1110  * policy_mgr_set_pcl() - Set preferred channel list in the FW
1111  * @psoc: PSOC object information
1112  * @msg: message containing preferred channel list information
1113  * @vdev_id: Vdev Id
1114  * @clear_vdev_pcl: clear PCL flag
1115  *
1116  * Sends the set pcl command and PCL info to FW
1117  *
1118  * Context: Any kernel thread
1119  * Return: QDF_STATUS_SUCCESS on successful posting, fail status in any other
1120  *	   case
1121  */
1122 QDF_STATUS policy_mgr_set_pcl(struct wlan_objmgr_psoc *psoc,
1123 			      struct policy_mgr_pcl_list *msg,
1124 			      uint8_t vdev_id,
1125 			      bool clear_vdev_pcl);
1126 
1127 /**
1128  * policy_mgr_incr_active_session() - increments the number of active sessions
1129  * @psoc: PSOC object information
1130  * @mode:	Adapter mode
1131  * @session_id: session ID for the connection session
1132  *
1133  * This function increments the number of active sessions maintained per device
1134  * mode. In the case of STA/P2P CLI/IBSS upon connection indication it is
1135  * incremented; In the case of SAP/P2P GO upon bss start it is incremented
1136  *
1137  * Return: None
1138  */
1139 void policy_mgr_incr_active_session(struct wlan_objmgr_psoc *psoc,
1140 		enum QDF_OPMODE mode, uint8_t session_id);
1141 
1142 /**
1143  * policy_mgr_decr_active_session() - decrements the number of active sessions
1144  * @psoc: PSOC object information
1145  * @mode: Adapter mode
1146  * @session_id: session ID for the connection session
1147  *
1148  * This function decrements the number of active sessions maintained per device
1149  * mode. In the case of STA/P2P CLI/IBSS upon disconnection it is decremented
1150  * In the case of SAP/P2P GO upon bss stop it is decremented
1151  *
1152  * Return: QDF_STATUS
1153  */
1154 QDF_STATUS policy_mgr_decr_active_session(struct wlan_objmgr_psoc *psoc,
1155 		enum QDF_OPMODE mode, uint8_t session_id);
1156 
1157 /**
1158  * policy_mgr_decr_session_set_pcl() - Decrement session count and set PCL
1159  * @psoc: PSOC object information
1160  * @mode: Adapter mode
1161  * @session_id: Session id
1162  *
1163  * Decrements the active session count and sets the PCL if a STA connection
1164  * exists
1165  *
1166  * Return: None
1167  */
1168 void policy_mgr_decr_session_set_pcl(struct wlan_objmgr_psoc *psoc,
1169 		enum QDF_OPMODE mode, uint8_t session_id);
1170 
1171 /**
1172  * polic_mgr_send_pcl_to_fw() - Send PCL to fw
1173  * @psoc: PSOC object information
1174  * @mode: Adapter mode
1175  *
1176  * Loop through all existing connections, stop RSO, send PCL to firmware
1177  * and start RSO. If Roaming is in progress on any of the interface,
1178  * avoid PCL updation as PCL gets updated post roaming.
1179  *
1180  * Return: None
1181  */
1182 void
1183 polic_mgr_send_pcl_to_fw(struct wlan_objmgr_psoc *psoc,
1184 			 enum QDF_OPMODE mode);
1185 
1186 #ifdef WLAN_FEATURE_11BE_MLO
1187 /**
1188  * policy_mgr_mlo_sta_set_nlink() - Set link mode for MLO STA
1189  * by link id bitmap
1190  * @psoc: psoc object
1191  * @vdev_id: vdev id
1192  * @reason: reason to set
1193  * @mode: mode to set
1194  * @link_num: number of link, valid for mode:
1195  * MLO_LINK_FORCE_MODE_ACTIVE_NUM, MLO_LINK_FORCE_MODE_INACTIVE_NUM
1196  * @link_bitmap: link bitmap, valid for mode:
1197  * MLO_LINK_FORCE_MODE_ACTIVE, MLO_LINK_FORCE_MODE_INACTIVE,
1198  * MLO_LINK_FORCE_MODE_ACTIVE_NUM, MLO_LINK_FORCE_MODE_INACTIVE_NUM
1199  * MLO_LINK_FORCE_MODE_NO_FORCE.
1200  * @link_bitmap2: inactive link bitmap, only valid for mode
1201  * MLO_LINK_FORCE_MODE_ACTIVE_INACTIVE
1202  * @link_control_flags: bitmap of enum link_control_flags.
1203  *
1204  * Interface to set link mode for MLO STA
1205  *
1206  * Return: QDF_STATUS
1207  */
1208 QDF_STATUS
1209 policy_mgr_mlo_sta_set_nlink(struct wlan_objmgr_psoc *psoc,
1210 			     uint8_t vdev_id,
1211 			     enum mlo_link_force_reason reason,
1212 			     enum mlo_link_force_mode mode,
1213 			     uint8_t link_num,
1214 			     uint16_t link_bitmap,
1215 			     uint16_t link_bitmap2,
1216 			     uint32_t link_control_flags);
1217 
1218 /**
1219  * policy_mgr_mlo_sta_set_link() - Set link mode for MLO STA
1220  * @psoc: psoc object
1221  * @reason: reason to set
1222  * @mode: mode to set
1223  * @num_mlo_vdev: number of vdevs
1224  * @mlo_vdev_lst: vdev list
1225  *
1226  * Interface to set link mode for MLO STA
1227  *
1228  * Return: QDF_STATUS
1229  */
1230 QDF_STATUS
1231 policy_mgr_mlo_sta_set_link(struct wlan_objmgr_psoc *psoc,
1232 			    enum mlo_link_force_reason reason,
1233 			    enum mlo_link_force_mode mode,
1234 			    uint8_t num_mlo_vdev, uint8_t *mlo_vdev_lst);
1235 
1236 /**
1237  * policy_mgr_is_ml_vdev_id() - check if vdev id is part of ML
1238  * @psoc: PSOC object information
1239  * @vdev_id: vdev id to check
1240  *
1241  * Return: true if vdev is part of ml
1242  */
1243 bool policy_mgr_is_ml_vdev_id(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id);
1244 
1245 /**
1246  * policy_mgr_get_disabled_ml_links_count() - provides the count of
1247  * disabled ml links
1248  * @psoc: PSOC object information
1249  *
1250  * This function provides the count of disabled ml links
1251  *
1252  * Return: disabled ml links count
1253  */
1254 uint32_t policy_mgr_get_disabled_ml_links_count(struct wlan_objmgr_psoc *psoc);
1255 
1256 /**
1257  * policy_mgr_move_vdev_from_disabled_to_connection_tbl() - re-enable a ml link
1258  * and move it from disabled link table to pm_conc_connection_list
1259  * @psoc: PSOC object information
1260  * @vdev_id: vdev id
1261  *
1262  * Return: None
1263  */
1264 void policy_mgr_move_vdev_from_disabled_to_connection_tbl(
1265 						struct wlan_objmgr_psoc *psoc,
1266 						uint8_t vdev_id);
1267 
1268 /**
1269  * policy_mgr_move_vdev_from_connection_to_disabled_tbl() - Add/move the link
1270  * vdev to disable a ml link table
1271  * @psoc: PSOC object information
1272  * @vdev_id: vdev id
1273  *
1274  * Return: None
1275  */
1276 void policy_mgr_move_vdev_from_connection_to_disabled_tbl(
1277 						struct wlan_objmgr_psoc *psoc,
1278 						uint8_t vdev_id);
1279 
1280 /**
1281  * policy_mgr_ml_link_vdev_need_to_be_disabled() - check if ml link need to be
1282  * disabled during connection.
1283  * @psoc: psoc
1284  * @vdev: vdev
1285  * @peer_assoc: check peer assoc command
1286  *
1287  * Check the vdev need to be moved to disabled policy mgr table.
1288  * If peer_assoc = false, the API will check the forced inactive link bitmap
1289  * as well. Vdev will be disabled if vdev's link id is forced inactive(includes
1290  * dynamic inactive)
1291  *
1292  * Return: true if STA link is need to be disabled else false.
1293  */
1294 bool
1295 policy_mgr_ml_link_vdev_need_to_be_disabled(struct wlan_objmgr_psoc *psoc,
1296 					    struct wlan_objmgr_vdev *vdev,
1297 					    bool peer_assoc);
1298 
1299 /**
1300  * policy_mgr_is_set_link_in_progress() - Check set link in progress or not
1301  * @psoc: psoc pointer
1302  *
1303  * Return: true if set link in progress
1304  */
1305 bool policy_mgr_is_set_link_in_progress(struct wlan_objmgr_psoc *psoc);
1306 
1307 /**
1308  * policy_mgr_wait_for_set_link_update() - Wait for set/clear link response
1309  * @psoc: psoc pointer
1310  *
1311  * Return: QDF_STATUS
1312  */
1313 QDF_STATUS policy_mgr_wait_for_set_link_update(struct wlan_objmgr_psoc *psoc);
1314 
1315 /**
1316  * policy_mgr_get_active_vdev_bitmap() - to get active ML STA vdev bitmap
1317  * @psoc: PSOC object information
1318  *
1319  * This API will fetch the active ML STA vdev bitmap.
1320  *
1321  * Return: vdev bitmap value
1322  */
1323 uint32_t
1324 policy_mgr_get_active_vdev_bitmap(struct wlan_objmgr_psoc *psoc);
1325 
1326 /**
1327  * policy_mgr_is_emlsr_sta_concurrency_present() - Check whether eMLSR
1328  * concurrency is present or not.
1329  * @psoc: PSOC object information
1330  *
1331  * This API is to check if any other concurrency is present when an eMLSR
1332  * STA connection is about to complete(i.e. when first link is connected
1333  * and second link is coming up). This helps to let the eMLSR connection
1334  * happen but not let firmware enter into eMLSR hw mode by sending
1335  * mlo_force_link_inactive=1 in peer_assoc of link when other concurrency is
1336  * present.
1337  *
1338  * Host driver shall disable the one link post connection anyway if concurrency
1339  * is present. Once the concurrency is gone, policy_mgr shall evaluate and
1340  * re-enable links to let firmware go to eMLSR hw mode.
1341  *
1342  * Return: true is it's allow otherwise false
1343  */
1344 bool policy_mgr_is_emlsr_sta_concurrency_present(struct wlan_objmgr_psoc *psoc);
1345 #else
1346 static inline bool
policy_mgr_is_ml_vdev_id(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)1347 policy_mgr_is_ml_vdev_id(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)
1348 {
1349 	return false;
1350 }
1351 
1352 static inline uint32_t
policy_mgr_get_disabled_ml_links_count(struct wlan_objmgr_psoc * psoc)1353 policy_mgr_get_disabled_ml_links_count(struct wlan_objmgr_psoc *psoc)
1354 {
1355 	return 0;
1356 }
1357 
1358 static inline void
policy_mgr_move_vdev_from_disabled_to_connection_tbl(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)1359 policy_mgr_move_vdev_from_disabled_to_connection_tbl(
1360 						struct wlan_objmgr_psoc *psoc,
1361 						uint8_t vdev_id) {}
1362 
1363 static inline bool
policy_mgr_ml_link_vdev_need_to_be_disabled(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev,bool peer_assoc)1364 policy_mgr_ml_link_vdev_need_to_be_disabled(struct wlan_objmgr_psoc *psoc,
1365 					    struct wlan_objmgr_vdev *vdev,
1366 					    bool peer_assoc)
1367 {
1368 	return false;
1369 }
1370 
1371 static inline void
policy_mgr_move_vdev_from_connection_to_disabled_tbl(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)1372 policy_mgr_move_vdev_from_connection_to_disabled_tbl(
1373 						struct wlan_objmgr_psoc *psoc,
1374 						uint8_t vdev_id) {}
1375 
1376 static inline bool
policy_mgr_is_set_link_in_progress(struct wlan_objmgr_psoc * psoc)1377 policy_mgr_is_set_link_in_progress(struct wlan_objmgr_psoc *psoc)
1378 {
1379 	return false;
1380 }
1381 
1382 static inline QDF_STATUS
policy_mgr_wait_for_set_link_update(struct wlan_objmgr_psoc * psoc)1383 policy_mgr_wait_for_set_link_update(struct wlan_objmgr_psoc *psoc)
1384 {
1385 	return QDF_STATUS_E_NOSUPPORT;
1386 }
1387 
1388 static inline uint32_t
policy_mgr_get_active_vdev_bitmap(struct wlan_objmgr_psoc * psoc)1389 policy_mgr_get_active_vdev_bitmap(struct wlan_objmgr_psoc *psoc)
1390 {
1391 	return 0;
1392 }
1393 
1394 static inline bool
policy_mgr_is_emlsr_sta_concurrency_present(struct wlan_objmgr_psoc * psoc)1395 policy_mgr_is_emlsr_sta_concurrency_present(struct wlan_objmgr_psoc *psoc)
1396 {
1397 	return false;
1398 }
1399 #endif
1400 
1401 /**
1402  * policy_mgr_skip_dfs_ch() - skip dfs channel or not
1403  * @psoc: pointer to soc
1404  * @skip_dfs_channel: pointer to result
1405  *
1406  * Return: QDF_STATUS
1407  */
1408 QDF_STATUS policy_mgr_skip_dfs_ch(struct wlan_objmgr_psoc *psoc,
1409 				  bool *skip_dfs_channel);
1410 
1411 /**
1412  * policy_mgr_get_channel() - provide channel number of given mode and vdevid
1413  * @psoc: PSOC object information
1414  * @mode: given  mode
1415  * @vdev_id: pointer to vdev_id
1416  *
1417  * This API will provide channel frequency value of matching mode and vdevid.
1418  * If vdev_id is NULL then it will match only mode
1419  * If vdev_id is not NULL the it will match both mode and vdev_id
1420  *
1421  * Return: channel frequency value
1422  */
1423 uint32_t policy_mgr_get_channel(struct wlan_objmgr_psoc *psoc,
1424 				enum policy_mgr_con_mode mode,
1425 				uint32_t *vdev_id);
1426 
1427 /**
1428  * policy_mgr_get_pcl() - provides the preferred channel list for
1429  * new connection
1430  * @psoc: PSOC object information
1431  * @mode: Device mode
1432  * @pcl_channels: Preferred channel freq list
1433  * @len: length of the PCL
1434  * @pcl_weight: Weights of the PCL
1435  * @weight_len: Max length of the weights list
1436  * @vdev_id: Vdev id
1437  *
1438  * This function provides the preferred channel list on which
1439  * policy manager wants the new connection to come up. Various
1440  * connection decision making entities will using this function
1441  * to query the PCL info
1442  *
1443  * Return: QDF_STATUS
1444  */
1445 QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc,
1446 			      enum policy_mgr_con_mode mode,
1447 			      uint32_t *pcl_channels, uint32_t *len,
1448 			      uint8_t *pcl_weight, uint32_t weight_len,
1449 			      uint8_t vdev_id);
1450 
1451 /**
1452  * policy_mgr_init_chan_avoidance() - init channel avoidance in policy manager.
1453  * @psoc: PSOC object information
1454  * @chan_freq_list: channel frequency list
1455  * @chan_cnt: channel count
1456  *
1457  * Return: QDF_STATUS
1458  */
1459 QDF_STATUS policy_mgr_init_chan_avoidance(struct wlan_objmgr_psoc *psoc,
1460 					  qdf_freq_t *chan_freq_list,
1461 					  uint16_t chan_cnt);
1462 
1463 /**
1464  * policy_mgr_update_with_safe_channel_list() - provides the safe
1465  * channel list
1466  * @psoc: PSOC object information
1467  * @pcl_channels: channel freq list
1468  * @len: length of the list
1469  * @weight_list: Weights of the PCL
1470  * @weight_len: Max length of the weights list
1471  *
1472  * This function provides the safe channel list from the list
1473  * provided after consulting the channel avoidance list
1474  *
1475  * Return: None
1476  */
1477 void policy_mgr_update_with_safe_channel_list(struct wlan_objmgr_psoc *psoc,
1478 					      uint32_t *pcl_channels,
1479 					      uint32_t *len,
1480 					      uint8_t *weight_list,
1481 					      uint32_t weight_len);
1482 
1483 /**
1484  * policy_mgr_get_nondfs_preferred_channel() - to get non-dfs preferred channel
1485  *                                           for given mode
1486  * @psoc: PSOC object information
1487  * @mode: mode for which preferred non-dfs channel is requested
1488  * @for_existing_conn: flag to indicate if preferred channel is requested
1489  *                     for existing connection
1490  * @vdev_id: Vdev Id
1491  *
1492  * this routine will return non-dfs channel
1493  * 1) for getting non-dfs preferred channel, first we check if there are any
1494  *    other connection exist whose channel is non-dfs. if yes then return that
1495  *    channel so that we can accommodate upto 3 mode concurrency.
1496  * 2) if there no any other connection present then query concurrency module
1497  *    to give preferred channel list. once we get preferred channel list, loop
1498  *    through list to find first non-dfs channel from ascending order.
1499  *
1500  * Return: uint32_t non-dfs channel frequency
1501  */
1502 uint32_t
1503 policy_mgr_get_nondfs_preferred_channel(struct wlan_objmgr_psoc *psoc,
1504 					enum policy_mgr_con_mode mode,
1505 					bool for_existing_conn,
1506 					uint8_t vdev_id);
1507 
1508 /**
1509  * policy_mgr_is_any_nondfs_chnl_present() - Find any non-dfs
1510  * channel from conc table
1511  * @psoc: PSOC object information
1512  * @ch_freq: pointer to channel frequency which needs to be filled
1513  *
1514  * In-case if any connection is already present whose channel is none dfs then
1515  * return that channel
1516  *
1517  * Return: true up-on finding non-dfs channel else false
1518  */
1519 bool policy_mgr_is_any_nondfs_chnl_present(struct wlan_objmgr_psoc *psoc,
1520 					   uint32_t *ch_freq);
1521 
1522 /**
1523  * policy_mgr_get_dfs_beaconing_session_id() - to find the
1524  * first DFS session id
1525  * @psoc: PSOC object information
1526  *
1527  * Return: If any beaconing session such as SAP or GO present and it is on
1528  * DFS channel then this function will return its session id
1529  *
1530  */
1531 uint32_t policy_mgr_get_dfs_beaconing_session_id(
1532 		struct wlan_objmgr_psoc *psoc);
1533 
1534 /**
1535  * policy_mgr_is_any_dfs_beaconing_session_present() - to find
1536  * if any DFS session
1537  * @psoc: PSOC object information
1538  * @ch_freq: pointer to channel frequency that needs to filled
1539  * @ch_width: pointer to channel width for the beaconing session
1540  *
1541  * If any beaconing session such as SAP or GO present and it is on DFS channel
1542  * then this function will return true
1543  *
1544  * Return: true if session is on DFS or false if session is on non-dfs channel
1545  */
1546 bool policy_mgr_is_any_dfs_beaconing_session_present(
1547 		struct wlan_objmgr_psoc *psoc, qdf_freq_t *ch_freq,
1548 		enum hw_mode_bandwidth *ch_width);
1549 
1550 /**
1551  * policy_mgr_allow_concurrency() - Check for allowed concurrency
1552  * combination consulting the PCL
1553  * @psoc: PSOC object information
1554  * @mode:	new connection mode
1555  * @ch_freq: channel frequency on which new connection is coming up
1556  * @bw: Bandwidth requested by the connection (optional)
1557  * @ext_flags: extended flags for concurrency check (union conc_ext_flag)
1558  * @vdev_id: vdev id
1559  *
1560  * When a new connection is about to come up check if current
1561  * concurrency combination including the new connection is
1562  * allowed or not based on the HW capability
1563  *
1564  * Return: True/False based on concurrency support
1565  */
1566 bool policy_mgr_allow_concurrency(struct wlan_objmgr_psoc *psoc,
1567 				  enum policy_mgr_con_mode mode,
1568 				  uint32_t ch_freq,
1569 				  enum hw_mode_bandwidth bw,
1570 				  uint32_t ext_flags, uint8_t vdev_id);
1571 
1572 /**
1573  * policy_mgr_check_scc_channel() - Check if SAP/GO freq need to be updated
1574  * as per exiting concurrency
1575  * @psoc: PSOC object information
1576  * @intf_ch_freq: Channel frequency of existing concurrency
1577  * @sap_ch_freq: Given SAP/GO channel frequency
1578  * @vdev_id: Vdev id of the SAP/GO
1579  * @cc_mode: concurrent switch mode
1580  *
1581  * When SAP/GO is starting or re-starting, check SAP/GO freq need to be
1582  * aligned with the existing concurrencies. i.e. Forced to be on same freq as
1583  * exiting concurrency.
1584  *
1585  * Return: True/False
1586  */
1587 void policy_mgr_check_scc_channel(struct wlan_objmgr_psoc *psoc,
1588 				  qdf_freq_t *intf_ch_freq,
1589 				  qdf_freq_t sap_ch_freq,
1590 				  uint8_t vdev_id, uint8_t cc_mode);
1591 
1592 /**
1593  * policy_mgr_handle_go_sap_fav_channel() - Get preferred force SCC
1594  * channel frequency using favorite mandatory channel list for GO+SAP
1595  * concurrency
1596  * @psoc: Pointer to Psoc
1597  * @vdev_id: vdev id
1598  * @sap_ch_freq: sap/go channel starting channel frequency
1599  * @intf_ch_freq: prefer force scc frequency
1600  *
1601  * SAP should move to 2.4 GHz if P2P GO is on 5G/6G. SAP should move to user
1602  * configured channel after P2P GO is stopped
1603  *
1604  * Return: QDF_STATUS_SUCCESS if a valid favorite SAP channel is found
1605  */
1606 QDF_STATUS
1607 policy_mgr_handle_go_sap_fav_channel(struct wlan_objmgr_psoc *psoc,
1608 				     uint8_t vdev_id, qdf_freq_t sap_ch_freq,
1609 				     qdf_freq_t *intf_ch_freq);
1610 
1611 /**
1612  * policy_mgr_nan_sap_pre_enable_conc_check() - Check if NAN+SAP SCC is
1613  *                                              allowed in given ch
1614  * @psoc: PSOC object information
1615  * @mode: Connection mode
1616  * @ch_freq: channel frequency to check
1617  *
1618  * Return: True if allowed else false
1619  */
1620 bool
1621 policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc,
1622 					 enum policy_mgr_con_mode mode,
1623 					 uint32_t ch_freq);
1624 
1625 /**
1626  * policy_mgr_allow_concurrency_csa() - Check for allowed concurrency
1627  * combination when channel switch
1628  * @psoc:	PSOC object information
1629  * @mode:	connection mode
1630  * @ch_freq:	target channel frequency to switch
1631  * @bw:	target channel bandwidth
1632  * @vdev_id:	vdev id of channel switch interface
1633  * @forced:	forced to chan switch.
1634  * @reason:	request reason of CSA
1635  *
1636  * There is already existing SAP+GO combination but due to upper layer
1637  * notifying LTE-COEX event or sending command to move one of the connections
1638  * to different channel. In such cases before moving existing connection to new
1639  * channel, check if new channel can co-exist with the other existing
1640  * connection. For example, one SAP1 is on channel-6 and second SAP2 is on
1641  * channel-36 and lets say they are doing DBS, and lets say upper layer sends
1642  * LTE-COEX to move SAP1 from channel-6 to channel-149. In this case, SAP1 and
1643  * SAP2 will end up doing MCC which may not be desirable result. such cases
1644  * will be prevented with this API.
1645  *
1646  * Return: True/False
1647  */
1648 bool
1649 policy_mgr_allow_concurrency_csa(struct wlan_objmgr_psoc *psoc,
1650 				 enum policy_mgr_con_mode mode,
1651 				 uint32_t ch_freq, enum hw_mode_bandwidth bw,
1652 				 uint32_t vdev_id, bool forced,
1653 				 enum sap_csa_reason_code reason);
1654 
1655 /**
1656  * policy_mgr_get_bw() - Convert phy_ch_width to hw_mode_bandwidth.
1657  * @chan_width: phy_ch_width
1658  *
1659  * Return: hw_mode_bandwidth
1660  */
1661 enum hw_mode_bandwidth policy_mgr_get_bw(enum phy_ch_width chan_width);
1662 
1663 /**
1664  * policy_mgr_get_first_connection_pcl_table_index() - provides the
1665  * row index to firstConnectionPclTable to get to the correct
1666  * pcl
1667  * @psoc: PSOC object information
1668  *
1669  * This function provides the row index to
1670  * firstConnectionPclTable. The index is the preference config.
1671  *
1672  * Return: table index
1673  */
1674 enum policy_mgr_conc_priority_mode
1675 	policy_mgr_get_first_connection_pcl_table_index(
1676 		struct wlan_objmgr_psoc *psoc);
1677 
1678 /**
1679  * policy_mgr_get_second_connection_pcl_table_index() - provides the
1680  * row index to secondConnectionPclTable to get to the correct
1681  * pcl
1682  * @psoc: PSOC object information
1683  *
1684  * This function provides the row index to
1685  * secondConnectionPclTable. The index is derived based on
1686  * current connection, band on which it is on & chain mask it is
1687  * using, as obtained from pm_conc_connection_list.
1688  *
1689  * Return: table index
1690  */
1691 enum policy_mgr_one_connection_mode
1692 	policy_mgr_get_second_connection_pcl_table_index(
1693 		struct wlan_objmgr_psoc *psoc);
1694 
1695 /**
1696  * policy_mgr_get_third_connection_pcl_table_index() - provides the
1697  * row index to thirdConnectionPclTable to get to the correct
1698  * pcl
1699  * @psoc: PSOC object information
1700  *
1701  * This function provides the row index to
1702  * thirdConnectionPclTable. The index is derived based on
1703  * current connection, band on which it is on & chain mask it is
1704  * using, as obtained from pm_conc_connection_list.
1705  *
1706  * Return: table index
1707  */
1708 enum policy_mgr_two_connection_mode
1709 	policy_mgr_get_third_connection_pcl_table_index(
1710 		struct wlan_objmgr_psoc *psoc);
1711 
1712 #ifdef FEATURE_FOURTH_CONNECTION
1713 /**
1714  * policy_mgr_get_fourth_connection_pcl_table_index() - provides the
1715  * row index to fourthConnectionPclTable to get to the correct
1716  * pcl
1717  * @psoc: PSOC object information
1718  *
1719  * This function provides the row index to
1720  * fourthConnectionPclTable. The index is derived based on
1721  * current connection, band on which it is on & chain mask it is
1722  * using, as obtained from pm_conc_connection_list.
1723  *
1724  * Return: table index
1725  */
1726 enum policy_mgr_three_connection_mode
1727 	policy_mgr_get_fourth_connection_pcl_table_index(
1728 		struct wlan_objmgr_psoc *psoc);
1729 #endif
1730 
1731 /**
1732  * policy_mgr_incr_connection_count() - adds the new connection to
1733  * the current connections list
1734  * @psoc: PSOC object information
1735  * @vdev_id: vdev id
1736  * @mode: Operating mode
1737  *
1738  * This function adds the new connection to the current
1739  * connections list
1740  *
1741  * Return: QDF_STATUS
1742  */
1743 QDF_STATUS policy_mgr_incr_connection_count(struct wlan_objmgr_psoc *psoc,
1744 					    uint32_t vdev_id,
1745 					    enum QDF_OPMODE mode);
1746 
1747 /**
1748  * policy_mgr_update_connection_info() - updates the existing
1749  * connection in the current connections list
1750  * @psoc: PSOC object information
1751  * @vdev_id: vdev id
1752  *
1753  *
1754  * This function adds the new connection to the current
1755  * connections list
1756  *
1757  * Return: QDF_STATUS
1758  */
1759 QDF_STATUS policy_mgr_update_connection_info(struct wlan_objmgr_psoc *psoc,
1760 		uint32_t vdev_id);
1761 
1762 /**
1763  * policy_mgr_decr_connection_count() - remove the old connection
1764  * from the current connections list
1765  * @psoc: PSOC object information
1766  * @vdev_id: vdev id of the old connection
1767  *
1768  *
1769  * This function removes the old connection from the current
1770  * connections list
1771  *
1772  * Return: QDF_STATUS
1773  */
1774 QDF_STATUS policy_mgr_decr_connection_count(struct wlan_objmgr_psoc *psoc,
1775 		uint32_t vdev_id);
1776 
1777 /**
1778  * policy_mgr_current_connections_update() - initiates actions
1779  * needed on current connections once channel has been decided
1780  * for the new connection
1781  * @psoc: PSOC object information
1782  * @session_id: Session id
1783  * @ch_freq: Channel frequency on which new connection will be
1784  * @reason: Reason for which connection update is required
1785  * @request_id: Request id provided by the requester, can be used while
1786  * calling callback to the requester
1787  *
1788  * This function initiates initiates actions
1789  * needed on current connections once channel has been decided
1790  * for the new connection. Notifies UMAC & FW as well
1791  *
1792  * Return: QDF_STATUS enum
1793  */
1794 QDF_STATUS
1795 policy_mgr_current_connections_update(struct wlan_objmgr_psoc *psoc,
1796 				      uint32_t session_id, uint32_t ch_freq,
1797 				      enum policy_mgr_conn_update_reason reason,
1798 				      uint32_t request_id);
1799 
1800 /**
1801  * policy_mgr_change_hw_mode_sta_connect() - Change HW mode for STA connect
1802  * @psoc: psoc object
1803  * @scan_list: candidates for connection
1804  * @vdev_id: vdev id for STA/CLI
1805  * @connect_id: connect id of the connect request
1806  *
1807  * When a new connection is about to come up, change hw mode for STA/CLI
1808  * based upon the scan results and hw type.
1809  *
1810  * Return: status if set HW mode is fail or already taken care of.
1811  */
1812 QDF_STATUS
1813 policy_mgr_change_hw_mode_sta_connect(struct wlan_objmgr_psoc *psoc,
1814 				      qdf_list_t *scan_list, uint8_t vdev_id,
1815 				      uint32_t connect_id);
1816 
1817 /**
1818  * policy_mgr_is_dbs_allowed_for_concurrency() - If dbs is allowed for current
1819  * concurreny
1820  * @psoc: PSOC object information
1821  * @new_conn_mode: new connection mode
1822  *
1823  * When a new connection is about to come up, check if dbs is allowed for
1824  * STA+STA or STA+P2P
1825  *
1826  * Return: true if dbs is allowed for STA+STA or STA+P2P else false
1827  */
1828 bool policy_mgr_is_dbs_allowed_for_concurrency(
1829 		struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE new_conn_mode);
1830 
1831 #ifndef WLAN_FEATURE_LL_LT_SAP
1832 /**
1833  * policy_mgr_get_pcl_chlist_for_ll_sap() - Get pcl channel list for LL SAP
1834  * @psoc: PSOC object information
1835  * @len: length of the PCL
1836  * @pcl_channels: Preferred channel freq list
1837  * @pcl_weight: Weights of the PCL
1838  *
1839  * This function provides the preferred channel list on which the ll sap
1840  * can come.
1841  *
1842  * Return: QDF_STATUS
1843  */
1844 QDF_STATUS
1845 policy_mgr_get_pcl_chlist_for_ll_sap(struct wlan_objmgr_psoc *psoc,
1846 				     uint32_t *len, uint32_t *pcl_channels,
1847 				     uint8_t *pcl_weight);
1848 
1849 /**
1850  * policy_mgr_get_pcl_ch_for_sap_go_with_ll_sap_present() - Get pcl channel
1851  * list for SAP/GO when LL SAP is present
1852  * @psoc: PSOC object information
1853  * @len: length of the PCL
1854  * @pcl_channels: Preferred channel freq list
1855  * @pcl_weight: Weights of the PCL
1856  *
1857  * This function provides the preferred channel list for SAP/GO when LL SAP
1858  * is present
1859  *
1860  * Return: QDF_STATUS
1861  */
1862 
1863 QDF_STATUS
1864 policy_mgr_get_pcl_ch_for_sap_go_with_ll_sap_present(
1865 					struct wlan_objmgr_psoc *psoc,
1866 					uint32_t *len, uint32_t *pcl_channels,
1867 					uint8_t *pcl_weight);
1868 
1869 /**
1870  * policy_mgr_get_pcl_channel_for_ll_sap_concurrency() - Get pcl channel list
1871  * for LL SAP concurrency
1872  * @psoc: PSOC object information
1873  * @vdev_id: Vdev id
1874  * @pcl_channels: Preferred channel freq list
1875  * @pcl_weight: Weights of the PCL
1876  * @len: length of the PCL
1877  *
1878  * Return: QDF_STATUS
1879  */
1880 
1881 QDF_STATUS
1882 policy_mgr_get_pcl_channel_for_ll_sap_concurrency(
1883 					struct wlan_objmgr_psoc *psoc,
1884 					uint32_t vdev_id,
1885 					uint32_t *pcl_channels,
1886 					uint8_t *pcl_weight, uint32_t *len);
1887 #else
1888 static inline QDF_STATUS
policy_mgr_get_pcl_chlist_for_ll_sap(struct wlan_objmgr_psoc * psoc,uint32_t * len,uint32_t * pcl_channels,uint8_t * pcl_weight)1889 policy_mgr_get_pcl_chlist_for_ll_sap(struct wlan_objmgr_psoc *psoc,
1890 				     uint32_t *len, uint32_t *pcl_channels,
1891 				     uint8_t *pcl_weight)
1892 {
1893 	return QDF_STATUS_SUCCESS;
1894 }
1895 
1896 static inline QDF_STATUS
policy_mgr_get_pcl_ch_for_sap_go_with_ll_sap_present(struct wlan_objmgr_psoc * psoc,uint32_t * len,uint32_t * pcl_channels,uint8_t * pcl_weight)1897 policy_mgr_get_pcl_ch_for_sap_go_with_ll_sap_present(
1898 					struct wlan_objmgr_psoc *psoc,
1899 					uint32_t *len, uint32_t *pcl_channels,
1900 					uint8_t *pcl_weight)
1901 {
1902 	return QDF_STATUS_SUCCESS;
1903 }
1904 
1905 static inline QDF_STATUS
policy_mgr_get_pcl_channel_for_ll_sap_concurrency(struct wlan_objmgr_psoc * psoc,uint32_t vdev_id,uint32_t * pcl_channels,uint8_t * pcl_weight,uint32_t * len)1906 policy_mgr_get_pcl_channel_for_ll_sap_concurrency(
1907 					struct wlan_objmgr_psoc *psoc,
1908 					uint32_t vdev_id,
1909 					uint32_t *pcl_channels,
1910 					uint8_t *pcl_weight, uint32_t *len)
1911 {
1912 	return QDF_STATUS_SUCCESS;
1913 }
1914 #endif
1915 
1916 /**
1917  * policy_mgr_is_vdev_ll_sap() - Check whether given vdev is LL SAP or not
1918  * @psoc: psoc object
1919  * @vdev_id: vdev id
1920  *
1921  * Return: true if it's present otherwise false
1922  */
1923 bool
1924 policy_mgr_is_vdev_ll_sap(struct wlan_objmgr_psoc *psoc,
1925 			  uint32_t vdev_id);
1926 
1927 /**
1928  * policy_mgr_is_vdev_ll_ht_sap() - Check whether given vdev is HT LL SAP or not
1929  * @psoc: psoc object
1930  * @vdev_id: vdev id
1931  *
1932  * Based on vdev id ap profile set via vendor command is get and compared with
1933  * ll_ht_type AP type and is return true if profile set is throghput sensitive.
1934  *
1935  * Return: true if it's present otherwise false
1936  */
1937 bool
1938 policy_mgr_is_vdev_ll_ht_sap(struct wlan_objmgr_psoc *psoc,
1939 			     uint32_t vdev_id);
1940 
1941 /**
1942  * policy_mgr_is_vdev_ll_lt_sap() - Check whether given vdev is LL_LT_SAP or not
1943  * @psoc: psoc object
1944  * @vdev_id: vdev id
1945  *
1946  * Based on vdev id ap profile set via vendor command is get and compared with
1947  * lt_ll_type AP and is return true if profile set is gaming or losless audio
1948  * where latency matters.
1949  *
1950  * Return: true if it's present otherwise false
1951  */
1952 bool
1953 policy_mgr_is_vdev_ll_lt_sap(struct wlan_objmgr_psoc *psoc,
1954 			     uint32_t vdev_id);
1955 
1956 /**
1957  * policy_mgr_get_preferred_dbs_action_table() - get dbs action table type
1958  * @psoc: Pointer to psoc
1959  * @vdev_id: vdev Id
1960  * @ch_freq: channel frequency of vdev.
1961  * @reason: reason of request
1962  *
1963  * 1. Based on band preferred and vdev priority setting to choose the preferred
1964  * dbs action.
1965  * 2. This routine will be used to get DBS switching action tables.
1966  * In Genoa, two action tables for DBS1 (2x2 5G + 1x1 2G), DBS2
1967  *  (2x2 2G + 1x1 5G).
1968  * 3. It can be used in mode change case in CSA channel switching or Roaming,
1969  * opportunistic upgrade. If needs switch to DBS, we needs to query this
1970  * function to get preferred DBS mode.
1971  * 4. This is mainly used for dual dbs mode HW. For Legacy HW, there is
1972  * only single DBS mode. This function will return PM_NOP.
1973  *
1974  * return : PM_NOP, PM_DBS1, PM_DBS2
1975  */
1976 enum policy_mgr_conc_next_action
1977 policy_mgr_get_preferred_dbs_action_table(
1978 	struct wlan_objmgr_psoc *psoc,
1979 	uint32_t vdev_id,
1980 	uint32_t ch_freq,
1981 	enum policy_mgr_conn_update_reason reason);
1982 
1983 /**
1984  * policy_mgr_get_conn_info() - get the current connections list
1985  * @len: length of the list
1986  *
1987  * This function returns a pointer to the current connections
1988  * list
1989  *
1990  * Return: pointer to connection list
1991  */
1992 struct policy_mgr_conc_connection_info *policy_mgr_get_conn_info(
1993 		uint32_t *len);
1994 
1995 /**
1996  * policy_mgr_qdf_opmode_to_pm_con_mode() - provides the
1997  * type translation from QDF to policy manager type
1998  * @psoc: psoc
1999  * @device_mode: Generic connection mode type
2000  * @vdev_id: Vdev id
2001  *
2002  *
2003  * This function provides the type translation
2004  *
2005  * Return: policy_mgr_con_mode enum
2006  */
2007 enum policy_mgr_con_mode
2008 policy_mgr_qdf_opmode_to_pm_con_mode(struct wlan_objmgr_psoc *psoc,
2009 				     enum QDF_OPMODE device_mode,
2010 				     uint8_t vdev_id);
2011 
2012 /**
2013  * policy_mgr_get_qdf_mode_from_pm - provides the
2014  * type translation from policy manager type
2015  * to generic connection mode type
2016  * @device_mode: policy manager mode type
2017  *
2018  *
2019  * This function provides the type translation
2020  *
2021  * Return: QDF_OPMODE enum
2022  */
2023 enum QDF_OPMODE policy_mgr_get_qdf_mode_from_pm(
2024 			enum policy_mgr_con_mode device_mode);
2025 
2026 /**
2027  * policy_mgr_check_n_start_opportunistic_timer - check single mac upgrade
2028  * needed or not, if needed start the oppurtunistic timer.
2029  * @psoc: pointer to SOC
2030  *
2031  * This function starts the oppurtunistic timer if hw_mode change is needed
2032  *
2033  * Return: QDF_STATUS
2034  */
2035 QDF_STATUS policy_mgr_check_n_start_opportunistic_timer(
2036 		struct wlan_objmgr_psoc *psoc);
2037 
2038 /**
2039  * policy_mgr_pdev_set_hw_mode() - Set HW mode command to FW
2040  * @psoc: PSOC object information
2041  * @session_id: Session ID
2042  * @mac0_ss: MAC0 spatial stream configuration
2043  * @mac0_bw: MAC0 bandwidth configuration
2044  * @mac1_ss: MAC1 spatial stream configuration
2045  * @mac1_bw: MAC1 bandwidth configuration
2046  * @mac0_band_cap: mac0 band capability requirement
2047  *     (0: Don't care, 1: 2.4G, 2: 5G)
2048  * @dbs: HW DBS capability
2049  * @dfs: HW Agile DFS capability
2050  * @sbs: HW SBS capability
2051  * @reason: Reason for connection update
2052  * @next_action: next action to happen at policy mgr after
2053  *		HW mode change
2054  * @action: action to be applied before hw mode change
2055  *
2056  * @request_id: Request id provided by the requester, can be used while
2057  * calling callback to the requester
2058  *
2059  * Sends the set hw mode request to FW
2060  *
2061  * e.g.: To configure 2x2_80
2062  *       mac0_ss = HW_MODE_SS_2x2, mac0_bw = HW_MODE_80_MHZ
2063  *       mac1_ss = HW_MODE_SS_0x0, mac1_bw = HW_MODE_BW_NONE
2064  *       mac0_band_cap = HW_MODE_MAC_BAND_NONE,
2065  *       dbs = HW_MODE_DBS_NONE, dfs = HW_MODE_AGILE_DFS_NONE,
2066  *       sbs = HW_MODE_SBS_NONE
2067  * e.g.: To configure 1x1_80_1x1_40 (DBS)
2068  *       mac0_ss = HW_MODE_SS_1x1, mac0_bw = HW_MODE_80_MHZ
2069  *       mac1_ss = HW_MODE_SS_1x1, mac1_bw = HW_MODE_40_MHZ
2070  *       mac0_band_cap = HW_MODE_MAC_BAND_NONE,
2071  *       dbs = HW_MODE_DBS, dfs = HW_MODE_AGILE_DFS_NONE,
2072  *       sbs = HW_MODE_SBS_NONE
2073  * e.g.: To configure 1x1_80_1x1_40 (Agile DFS)
2074  *       mac0_ss = HW_MODE_SS_1x1, mac0_bw = HW_MODE_80_MHZ
2075  *       mac1_ss = HW_MODE_SS_1x1, mac1_bw = HW_MODE_40_MHZ
2076  *       mac0_band_cap = HW_MODE_MAC_BAND_NONE,
2077  *       dbs = HW_MODE_DBS, dfs = HW_MODE_AGILE_DFS,
2078  *       sbs = HW_MODE_SBS_NONE
2079  * e.g.: To configure 2x2_5g_80+1x1_2g_40
2080  *       mac0_ss = HW_MODE_SS_2x2, mac0_bw = HW_MODE_80_MHZ
2081  *       mac1_ss = HW_MODE_SS_1x1, mac1_bw = HW_MODE_40_MHZ
2082  *       mac0_band_cap = HW_MODE_MAC_BAND_5G
2083  *       dbs = HW_MODE_DBS, dfs = HW_MODE_AGILE_DFS_NONE,
2084  *       sbs = HW_MODE_SBS_NONE
2085  * e.g.: To configure 2x2_2g_40+1x1_5g_40
2086  *       mac0_ss = HW_MODE_SS_2x2, mac0_bw = HW_MODE_40_MHZ
2087  *       mac1_ss = HW_MODE_SS_1x1, mac1_bw = HW_MODE_40_MHZ
2088  *       mac0_band_cap = HW_MODE_MAC_BAND_2G
2089  *       dbs = HW_MODE_DBS, dfs = HW_MODE_AGILE_DFS_NONE,
2090  *       sbs = HW_MODE_SBS_NONE
2091  *
2092  * Return: Success if the message made it down to the next layer
2093  */
2094 QDF_STATUS policy_mgr_pdev_set_hw_mode(struct wlan_objmgr_psoc *psoc,
2095 		uint32_t session_id,
2096 		enum hw_mode_ss_config mac0_ss,
2097 		enum hw_mode_bandwidth mac0_bw,
2098 		enum hw_mode_ss_config mac1_ss,
2099 		enum hw_mode_bandwidth mac1_bw,
2100 		enum hw_mode_mac_band_cap mac0_band_cap,
2101 		enum hw_mode_dbs_capab dbs,
2102 		enum hw_mode_agile_dfs_capab dfs,
2103 		enum hw_mode_sbs_capab sbs,
2104 		enum policy_mgr_conn_update_reason reason,
2105 		uint8_t next_action, enum policy_mgr_conc_next_action action,
2106 		uint32_t request_id);
2107 
2108 /**
2109  * typedef policy_mgr_pdev_set_hw_mode_cback() - callback invoked by
2110  * other component to provide set HW mode request status
2111  * @status: status of the request
2112  * @cfgd_hw_mode_index: new HW mode index
2113  * @num_vdev_mac_entries: Number of mac entries
2114  * @vdev_mac_map: The table of vdev to mac mapping
2115  * @next_action: next action to happen at policy mgr after
2116  *		beacon update
2117  * @reason: Reason for set HW mode
2118  * @session_id: vdev id on which the request was made
2119  * @context: PSOC object information
2120  * @request_id: Request id provided by the requester, can be used while
2121  * calling callback to the requester
2122  *
2123  * This function is the callback registered with SME at set HW
2124  * mode request time
2125  *
2126  * Return: None
2127  */
2128 typedef void (*policy_mgr_pdev_set_hw_mode_cback)(uint32_t status,
2129 				uint32_t cfgd_hw_mode_index,
2130 				uint32_t num_vdev_mac_entries,
2131 				struct policy_mgr_vdev_mac_map *vdev_mac_map,
2132 				uint8_t next_action,
2133 				enum policy_mgr_conn_update_reason reason,
2134 				uint32_t session_id, void *context,
2135 				uint32_t request_id);
2136 
2137 /**
2138  * typedef policy_mgr_nss_update_cback() - callback invoked by other
2139  * component to provide nss update request status
2140  * @psoc: PSOC object information
2141  * @tx_status: tx completion status for updated beacon with new
2142  *		nss value
2143  * @vdev_id: vdev id for the specific connection
2144  * @next_action: next action to happen at policy mgr after
2145  *		beacon update
2146  * @reason: Reason for nss update
2147  * @original_vdev_id: original request hwmode change vdev id
2148  * @request_id: cm req id
2149  *
2150  * This function is the callback registered with SME at nss
2151  * update request time
2152  *
2153  * Return: None
2154  */
2155 typedef void (*policy_mgr_nss_update_cback)(struct wlan_objmgr_psoc *psoc,
2156 		uint8_t tx_status,
2157 		uint8_t vdev_id,
2158 		uint8_t next_action,
2159 		enum policy_mgr_conn_update_reason reason,
2160 		uint32_t original_vdev_id, uint32_t request_id);
2161 
2162 /**
2163  * struct policy_mgr_sme_cbacks - SME Callbacks to be invoked
2164  * from policy manager
2165  * @sme_get_nss_for_vdev: Get the allowed nss value for the vdev
2166  * @sme_soc_set_dual_mac_config: Set the dual MAC scan & FW
2167  *                             config
2168  * @sme_pdev_set_hw_mode: Set the new HW mode to FW
2169  * @sme_nss_update_request: Update NSS value to FW
2170  * @sme_change_mcc_beacon_interval: Set MCC beacon interval to FW
2171  * @sme_rso_start_cb: Enable roaming offload callback
2172  * @sme_rso_stop_cb: Disable roaming offload callback
2173  * @sme_change_sap_csa_count: Change CSA count for SAP/GO, only one
2174  *			      time, needs to set again if used once.
2175  * @sme_sap_update_ch_width: Update sap ch_width to fw to handle SAP 320MHz
2176  *                           concurrencies
2177  */
2178 struct policy_mgr_sme_cbacks {
2179 	void (*sme_get_nss_for_vdev)(enum QDF_OPMODE,
2180 				     uint8_t *nss_2g, uint8_t *nss_5g);
2181 	QDF_STATUS (*sme_soc_set_dual_mac_config)(
2182 		struct policy_mgr_dual_mac_config msg);
2183 	QDF_STATUS (*sme_pdev_set_hw_mode)(struct policy_mgr_hw_mode msg);
2184 	QDF_STATUS (*sme_nss_update_request)(uint32_t vdev_id,
2185 		uint8_t new_nss, uint8_t ch_width,
2186 		policy_mgr_nss_update_cback cback,
2187 		uint8_t next_action, struct wlan_objmgr_psoc *psoc,
2188 		enum policy_mgr_conn_update_reason reason,
2189 		uint32_t original_vdev_id, uint32_t request_id);
2190 	QDF_STATUS (*sme_change_mcc_beacon_interval)(uint8_t session_id);
2191 	QDF_STATUS (*sme_rso_start_cb)(
2192 		mac_handle_t mac_handle, uint8_t vdev_id,
2193 		uint8_t reason, enum wlan_cm_rso_control_requestor requestor);
2194 	QDF_STATUS (*sme_rso_stop_cb)(
2195 		mac_handle_t mac_handle, uint8_t vdev_id,
2196 		uint8_t reason, enum wlan_cm_rso_control_requestor requestor);
2197 	QDF_STATUS (*sme_change_sap_csa_count)(uint8_t count);
2198 	QDF_STATUS (*sme_sap_update_ch_width)(struct wlan_objmgr_psoc *psoc,
2199 			uint8_t vdev_id,
2200 			enum phy_ch_width ch_width,
2201 			enum policy_mgr_conn_update_reason reason,
2202 			uint8_t conc_vdev_id, uint32_t request_id);
2203 };
2204 
2205 /**
2206  * struct policy_mgr_hdd_cbacks - HDD Callbacks to be invoked
2207  * from policy manager
2208  * @sap_restart_chan_switch_cb: Restart SAP
2209  * @wlan_hdd_get_channel_for_sap_restart: Get channel to restart
2210  *                      SAP
2211  * @get_mode_for_non_connected_vdev: Get the mode for a non
2212  *                                 connected vdev
2213  * @hdd_get_device_mode: Get QDF_OPMODE type for session id (vdev id)
2214  * @hdd_is_chan_switch_in_progress: Check if in any adapter channel switch is in
2215  * progress
2216  * @hdd_is_cac_in_progress: Check if in any adapter CAC is in progress
2217  * @wlan_hdd_set_sap_csa_reason: Set the sap csa reason in cases like NAN.
2218  * @hdd_get_ap_6ghz_capable: get ap vdev 6ghz capable info from hdd ap adapter.
2219  * @wlan_hdd_indicate_active_ndp_cnt: indicate active ndp cnt to hdd
2220  * @wlan_get_ap_prefer_conc_ch_params: get prefer ap channel bw parameters
2221  *  based on target channel frequency and concurrent connections.
2222  * @wlan_get_sap_acs_band: get acs band from sap config
2223  * @wlan_check_cc_intf_cb: get interference frequency of input SAP/GO interface
2224  * @wlan_set_tx_rx_nss_cb: set NSS dynamically for STA
2225  */
2226 struct policy_mgr_hdd_cbacks {
2227 	QDF_STATUS (*sap_restart_chan_switch_cb)(struct wlan_objmgr_psoc *psoc,
2228 						 uint8_t vdev_id,
2229 						 uint32_t ch_freq,
2230 						 uint32_t channel_bw,
2231 						 bool forced);
2232 	QDF_STATUS (*wlan_hdd_get_channel_for_sap_restart)(
2233 				struct wlan_objmgr_psoc *psoc,
2234 				uint8_t vdev_id, uint32_t *ch_freq);
2235 	enum policy_mgr_con_mode (*get_mode_for_non_connected_vdev)(
2236 				struct wlan_objmgr_psoc *psoc,
2237 				uint8_t vdev_id);
2238 	enum QDF_OPMODE (*hdd_get_device_mode)(uint32_t session_id);
2239 	bool (*hdd_is_chan_switch_in_progress)(void);
2240 	bool (*hdd_is_cac_in_progress)(void);
2241 	void (*wlan_hdd_set_sap_csa_reason)(struct wlan_objmgr_psoc *psoc,
2242 					    uint8_t vdev_id, uint8_t reason);
2243 	uint32_t (*hdd_get_ap_6ghz_capable)(struct wlan_objmgr_psoc *psoc,
2244 					    uint8_t vdev_id);
2245 	void (*wlan_hdd_indicate_active_ndp_cnt)(struct wlan_objmgr_psoc *psoc,
2246 						 uint8_t vdev_id, uint8_t cnt);
2247 	QDF_STATUS (*wlan_get_ap_prefer_conc_ch_params)(
2248 			struct wlan_objmgr_psoc *psoc,
2249 			uint8_t vdev_id, uint32_t chan_freq,
2250 			struct ch_params *ch_params);
2251 	uint32_t (*wlan_get_sap_acs_band)(struct wlan_objmgr_psoc *psoc,
2252 					  uint8_t vdev_id, uint32_t *acs_band);
2253 	QDF_STATUS (*wlan_check_cc_intf_cb)(struct wlan_objmgr_psoc *psoc,
2254 					    uint8_t vdev_id,
2255 					    uint32_t *ch_freq);
2256 	QDF_STATUS (*wlan_set_tx_rx_nss_cb)(struct wlan_objmgr_psoc *psoc,
2257 					    uint8_t vdev_id, uint8_t tx_nss,
2258 					    uint8_t rx_nss);
2259 };
2260 
2261 /**
2262  * struct policy_mgr_conc_cbacks - lim Callbacks to be invoked
2263  * from policy manager
2264  * @connection_info_update: check and update params based on STA/SAP
2265  *                          concurrency.such as EDCA params and RTS threshold.
2266  *                          If updated, it will also send the updated parameters
2267  *                          to FW.
2268  */
2269 
2270 struct policy_mgr_conc_cbacks {
2271 	void (*connection_info_update)(void);
2272 };
2273 
2274 /**
2275  * struct policy_mgr_tdls_cbacks - TDLS Callbacks to be invoked
2276  * from policy manager
2277  * @tdls_notify_increment_session:
2278  * @tdls_notify_decrement_session:
2279  */
2280 struct policy_mgr_tdls_cbacks {
2281 	void (*tdls_notify_increment_session)(struct wlan_objmgr_psoc *psoc);
2282 	void (*tdls_notify_decrement_session)(struct wlan_objmgr_psoc *psoc);
2283 };
2284 
2285 /**
2286  * struct policy_mgr_cdp_cbacks - CDP Callbacks to be invoked
2287  * from policy manager
2288  * @cdp_update_mac_id: update mac_id for vdev
2289  */
2290 struct policy_mgr_cdp_cbacks {
2291 	void (*cdp_update_mac_id)(struct wlan_objmgr_psoc *soc,
2292 		uint8_t vdev_id, uint8_t mac_id);
2293 };
2294 
2295 /**
2296  * struct policy_mgr_dp_cbacks - CDP Callbacks to be invoked
2297  * from policy manager
2298  * @hdd_disable_rx_ol_in_concurrency: Callback to disable LRO/GRO offloads
2299  * @hdd_set_rx_mode_rps_cb: Callback to set RPS
2300  * @hdd_ipa_set_mcc_mode_cb: Callback to set mcc mode for ipa module
2301  * @hdd_v2_flow_pool_map: Callback to create vdev flow pool
2302  * @hdd_v2_flow_pool_unmap: Callback to delete vdev flow pool
2303  * @hdd_ipa_set_perf_level_bw: Callback to set ipa perf level based on BW
2304  */
2305 struct policy_mgr_dp_cbacks {
2306 	void (*hdd_disable_rx_ol_in_concurrency)(bool);
2307 	void (*hdd_set_rx_mode_rps_cb)(bool);
2308 	void (*hdd_ipa_set_mcc_mode_cb)(bool);
2309 	void (*hdd_v2_flow_pool_map)(int);
2310 	void (*hdd_v2_flow_pool_unmap)(int);
2311 	void (*hdd_ipa_set_perf_level_bw)(enum hw_mode_bandwidth bw);
2312 };
2313 
2314 /**
2315  * struct policy_mgr_wma_cbacks - WMA Callbacks to be invoked
2316  * from policy manager
2317  * @wma_get_connection_info: Get the connection related info
2318  *                         from wma table
2319  */
2320 struct policy_mgr_wma_cbacks {
2321 	QDF_STATUS (*wma_get_connection_info)(uint8_t vdev_id,
2322 		struct policy_mgr_vdev_entry_info *conn_table_entry);
2323 };
2324 
2325 /**
2326 * policy_mgr_need_opportunistic_upgrade - check whether needs to change current
2327 * HW mode to single mac 2x2 or the other DBS mode(for Dual DBS HW only).
2328 * @psoc: PSOC object information
2329 * @reason: enum policy_mgr_conn_update_reason
2330 *
2331 *  This function is to check whether needs to change to single Mac mode.
2332 *  when opportunistic timer fired.  But a special case for Dual DBS HW, this
2333 *  function will check DBS to DBS change is required or not:
2334 *  1. For Dual DBS HW, if user set vdev priority list, we may need to do
2335 *	 DBS to DBS switching.
2336 *	 eg. P2P GO (2g) < SAP (5G) < STA (2g) in DBS2.
2337 *	 If STA down, we need to switch to DBS1: P2P GO (2g) < SAP (5g).
2338 *	 So, for opportunistic checking, we need to add DBS ->DBS checking
2339 *            as well.
2340 *  2. Reason code :
2341 *	   DBS -> Single MAC : POLICY_MGR_UPDATE_REASON_OPPORTUNISTIC
2342 *	   DBS -> DBS : POLICY_MGR_UPDATE_REASON_PRI_VDEV_CHANGE
2343 *
2344 *  return: PM_NOP, upgrade is not needed, otherwise new action type
2345 *             and reason code be returned.
2346 */
2347 enum policy_mgr_conc_next_action policy_mgr_need_opportunistic_upgrade(
2348 		struct wlan_objmgr_psoc *psoc,
2349 		enum policy_mgr_conn_update_reason *reason);
2350 
2351 /**
2352  * policy_mgr_next_actions() - initiates actions needed on current
2353  * connections once channel has been decided for the new
2354  * connection
2355  * @psoc: PSOC object information
2356  * @session_id: Session id
2357  * @action: action to be executed
2358  * @reason: Reason for connection update
2359  * @request_id: Request id provided by the requester, can be used while
2360  * calling callback to the requester
2361  *
2362  * This function initiates initiates actions
2363  * needed on current connections once channel has been decided
2364  * for the new connection. Notifies UMAC & FW as well
2365  *
2366  * Return: QDF_STATUS enum
2367  */
2368 QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc,
2369 		uint32_t session_id,
2370 		enum policy_mgr_conc_next_action action,
2371 		enum policy_mgr_conn_update_reason reason,
2372 		uint32_t request_id);
2373 
2374 /**
2375  * policy_mgr_validate_dbs_switch() - Check DBS action valid or not
2376  * @psoc: Pointer to psoc
2377  * @action: action requested
2378  *
2379  * This routine will check the current hw mode with requested action.
2380  * If we are already in the mode, the caller will do nothing.
2381  * This will be called by policy_mgr_next_actions to check the action needed
2382  * or not.
2383  *
2384  * return : QDF_STATUS_SUCCESS, action is allowed.
2385  *          QDF_STATUS_E_ALREADY, action is not needed.
2386  *          QDF_STATUS_E_FAILURE, error happens.
2387  *          QDF_STATUS_E_NOSUPPORT, the requested mode not supported.
2388  */
2389 QDF_STATUS
2390 policy_mgr_validate_dbs_switch(struct wlan_objmgr_psoc *psoc,
2391 			       enum policy_mgr_conc_next_action action);
2392 
2393 /**
2394  * policy_mgr_set_dual_mac_scan_config() - Set the dual MAC scan config
2395  * @psoc: PSOC object information
2396  * @dbs_val: Value of DBS bit
2397  * @dbs_plus_agile_scan_val: Value of DBS plus agile scan bit
2398  * @single_mac_scan_with_dbs_val: Value of Single MAC scan with DBS
2399  *
2400  * Set the values of scan config. For FW mode config, the existing values
2401  * will be retained
2402  *
2403  * Return: None
2404  */
2405 void policy_mgr_set_dual_mac_scan_config(struct wlan_objmgr_psoc *psoc,
2406 		uint8_t dbs_val,
2407 		uint8_t dbs_plus_agile_scan_val,
2408 		uint8_t single_mac_scan_with_dbs_val);
2409 
2410 /**
2411  * policy_mgr_set_dual_mac_fw_mode_config() - Set the dual mac FW mode config
2412  * @psoc: PSOC object information
2413  * @dbs: DBS bit
2414  * @dfs: Agile DFS bit
2415  *
2416  * Set the values of fw mode config. For scan config, the existing values
2417  * will be retain.
2418  *
2419  * Return: None
2420  */
2421 void policy_mgr_set_dual_mac_fw_mode_config(struct wlan_objmgr_psoc *psoc,
2422 		uint8_t dbs, uint8_t dfs);
2423 
2424 /**
2425  * policy_mgr_is_scc_with_this_vdev_id() - Check if this vdev_id has SCC with
2426  * other vdev_id's
2427  * @psoc: PSOC object information
2428  * @vdev_id: vdev_id
2429  *
2430  * This function checks if the given vdev_id has SCC with any other vdev's
2431  * or not.
2432  *
2433  * Return: true if SCC exists, false otherwise
2434  */
2435 bool policy_mgr_is_scc_with_this_vdev_id(struct wlan_objmgr_psoc *psoc,
2436 					 uint8_t vdev_id);
2437 
2438 /**
2439  * policy_mgr_is_mcc_with_this_vdev_id() - Is current vdev having MCC
2440  * with any other vdev.
2441  * @psoc: Pointer to PSOC object
2442  * @vdev_id: vdev id
2443  * @mcc_vdev_id: Concurrent MCC vdev id
2444  *
2445  * Return: true if MCC exists, false otherwise
2446  */
2447 bool policy_mgr_is_mcc_with_this_vdev_id(struct wlan_objmgr_psoc *psoc,
2448 					 uint8_t vdev_id, uint8_t *mcc_vdev_id);
2449 
2450 /**
2451  * policy_mgr_is_mcc_on_any_sta_vdev() - Check if any sta vdev is in MCC
2452  * @psoc: Pointer to PSOC object
2453  *
2454  * Return: true if STA vdev is in MCC false otherwise
2455  */
2456 bool policy_mgr_is_mcc_on_any_sta_vdev(struct wlan_objmgr_psoc *psoc);
2457 
2458 /**
2459  * policy_mgr_soc_set_dual_mac_cfg_cb() - Callback for set dual mac config
2460  * @status: Status of set dual mac config
2461  * @scan_config: Current scan config whose status is the first param
2462  * @fw_mode_config: Current FW mode config whose status is the first param
2463  *
2464  * Callback on setting the dual mac configuration
2465  *
2466  * Return: None
2467  */
2468 void policy_mgr_soc_set_dual_mac_cfg_cb(enum set_hw_mode_status status,
2469 		uint32_t scan_config, uint32_t fw_mode_config);
2470 
2471 /**
2472  * policy_mgr_mode_specific_num_open_sessions() - to get number of open sessions
2473  *                                                for a specific mode
2474  * @psoc: PSOC object information
2475  * @mode: device mode
2476  * @num_sessions: to store num open sessions
2477  *
2478  * Return: QDF_STATUS
2479  */
2480 QDF_STATUS policy_mgr_mode_specific_num_open_sessions(
2481 		struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE mode,
2482 		uint8_t *num_sessions);
2483 
2484 /**
2485  * policy_mgr_mode_specific_num_active_sessions() - to get number of active
2486  *               sessions for a specific mode
2487  * @psoc: PSOC object information
2488  * @mode: device mode
2489  * @num_sessions: to store num active sessions
2490  *
2491  * Return: QDF_STATUS
2492  */
2493 QDF_STATUS policy_mgr_mode_specific_num_active_sessions(
2494 		struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE mode,
2495 		uint8_t *num_sessions);
2496 
2497 /**
2498  * policy_mgr_concurrent_open_sessions_running() - Checks for
2499  * concurrent open session
2500  * @psoc: PSOC object information
2501  *
2502  * Checks if more than one open session is running for all the allowed modes
2503  * in the driver
2504  *
2505  * Return: True if more than one open session exists, False otherwise
2506  */
2507 bool policy_mgr_concurrent_open_sessions_running(
2508 	struct wlan_objmgr_psoc *psoc);
2509 
2510 /**
2511  * policy_mgr_max_concurrent_connections_reached() - Check if
2512  * max conccurrency is reached
2513  * @psoc: PSOC object information
2514  * Checks for presence of concurrency where more than one connection exists
2515  *
2516  * Return: True if the max concurrency is reached, False otherwise
2517  *
2518  * Example:
2519  *    STA + STA (wlan0 and wlan1 are connected) - returns true
2520  *    STA + STA (wlan0 connected and wlan1 disconnected) - returns false
2521  *    DUT with P2P-GO + P2P-CLIENT connection) - returns true
2522  *
2523  */
2524 bool policy_mgr_max_concurrent_connections_reached(
2525 		struct wlan_objmgr_psoc *psoc);
2526 
2527 /**
2528  * policy_mgr_clear_concurrent_session_count() - Clear active session count
2529  * @psoc: PSOC object information
2530  * Clears the active session count for all modes
2531  *
2532  * Return: None
2533  */
2534 void policy_mgr_clear_concurrent_session_count(struct wlan_objmgr_psoc *psoc);
2535 
2536 /**
2537  * policy_mgr_is_multiple_active_sta_sessions() - Check for
2538  * multiple STA connections
2539  * @psoc: PSOC object information
2540  *
2541  * Checks if multiple active STA connection are in the driver
2542  *
2543  * Return: True if multiple STA sessions are present, False otherwise
2544  *
2545  */
2546 bool policy_mgr_is_multiple_active_sta_sessions(
2547 	struct wlan_objmgr_psoc *psoc);
2548 
2549 /**
2550  * policy_mgr_is_sta_active_connection_exists() - Check if a STA
2551  * connection is active
2552  * @psoc: PSOC object information
2553  *
2554  * Checks if there is atleast one active STA connection in the driver
2555  *
2556  * Return: True if an active STA session is present, False otherwise
2557  */
2558 bool policy_mgr_is_sta_active_connection_exists(
2559 	struct wlan_objmgr_psoc *psoc);
2560 
2561 /**
2562  * policy_mgr_concurrent_beaconing_sessions_running() - Checks
2563  * for concurrent beaconing entities
2564  * @psoc: PSOC object information
2565  *
2566  * Checks if multiple beaconing sessions are running i.e., if SAP or GO or IBSS
2567  * are beaconing together
2568  *
2569  * Return: True if multiple entities are beaconing together, False otherwise
2570  */
2571 bool policy_mgr_concurrent_beaconing_sessions_running(
2572 	struct wlan_objmgr_psoc *psoc);
2573 
2574 /**
2575  * policy_mgr_wait_for_connection_update() - Wait for hw mode
2576  * command to get processed
2577  * @psoc: PSOC object information
2578  * Waits for CONNECTION_UPDATE_TIMEOUT duration until the set hw mode
2579  * response sets the event connection_update_done_evt
2580  *
2581  * Return: QDF_STATUS
2582  */
2583 QDF_STATUS policy_mgr_wait_for_connection_update(
2584 		struct wlan_objmgr_psoc *psoc);
2585 
2586 /**
2587  * policy_mgr_reset_connection_update() - Reset connection
2588  * update event
2589  * @psoc: PSOC object information
2590  * Resets the concurrent connection update event
2591  *
2592  * Return: QDF_STATUS
2593  */
2594 QDF_STATUS policy_mgr_reset_connection_update(struct wlan_objmgr_psoc *psoc);
2595 
2596 /**
2597  * policy_mgr_reset_hw_mode_change() - Reset the hw mode change.
2598  * @psoc: Pointer to PSOC object
2599  *
2600  * Return: none
2601  */
2602 void policy_mgr_reset_hw_mode_change(struct wlan_objmgr_psoc *psoc);
2603 
2604 /**
2605  * policy_mgr_set_connection_update() - Set connection update
2606  * event
2607  * @psoc: PSOC object information
2608  * Sets the concurrent connection update event
2609  *
2610  * Return: QDF_STATUS
2611  */
2612 QDF_STATUS policy_mgr_set_connection_update(struct wlan_objmgr_psoc *psoc);
2613 
2614 /**
2615  * policy_mgr_set_chan_switch_complete_evt() - set channel
2616  * switch completion event
2617  * @psoc: PSOC object information
2618  * Sets the channel switch completion event.
2619  *
2620  * Return: QDF_STATUS
2621  */
2622 QDF_STATUS policy_mgr_set_chan_switch_complete_evt(
2623 		struct wlan_objmgr_psoc *psoc);
2624 
2625 /**
2626  * policy_mgr_reset_chan_switch_complete_evt() - reset channel
2627  * switch completion event
2628  * @psoc: PSOC object information
2629  * Resets the channel switch completion event.
2630  *
2631  * Return: QDF_STATUS
2632  */
2633 QDF_STATUS policy_mgr_reset_chan_switch_complete_evt(
2634 		struct wlan_objmgr_psoc *psoc);
2635 
2636 /**
2637  * policy_mgr_set_opportunistic_update() - Set opportunistic
2638  * update event
2639  * @psoc: PSOC object information
2640  * Sets the opportunistic update event
2641  *
2642  * Return: QDF_STATUS
2643  */
2644 QDF_STATUS policy_mgr_set_opportunistic_update(struct wlan_objmgr_psoc *psoc);
2645 
2646 /**
2647  * policy_mgr_stop_opportunistic_timer() - Stops opportunistic timer
2648  * @psoc: PSOC object information
2649  *
2650  * Return: QDF_STATUS
2651  */
2652 QDF_STATUS policy_mgr_stop_opportunistic_timer(struct wlan_objmgr_psoc *psoc);
2653 
2654 /**
2655  * policy_mgr_restart_opportunistic_timer() - Restarts opportunistic timer
2656  * @psoc: PSOC object information
2657  * @check_state: check timer state if this flag is set, else restart
2658  *               irrespective of state
2659  *
2660  * Restarts opportunistic timer for DBS_OPPORTUNISTIC_TIME seconds.
2661  * Check if current state is RUNNING if check_state is set, else
2662  * restart the timer irrespective of state.
2663  *
2664  * Return: QDF_STATUS
2665  */
2666 QDF_STATUS policy_mgr_restart_opportunistic_timer(
2667 		struct wlan_objmgr_psoc *psoc, bool check_state);
2668 
2669 /**
2670  * policy_mgr_modify_sap_pcl_based_on_mandatory_channel() -
2671  * Modify SAPs PCL based on mandatory channel list
2672  * @psoc: PSOC object information
2673  * @pcl_list_org: Pointer to the preferred channel freq list to be trimmed
2674  * @weight_list_org: Pointer to the weights of the preferred channel list
2675  * @pcl_len_org: Pointer to the length of the preferred channel list
2676  *
2677  * Modifies the preferred channel list of SAP based on the mandatory channel
2678  *
2679  * Return: QDF_STATUS
2680  */
2681 QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel(
2682 		struct wlan_objmgr_psoc *psoc, uint32_t *pcl_list_org,
2683 		uint8_t *weight_list_org, uint32_t *pcl_len_org);
2684 
2685 /**
2686  * policy_mgr_update_and_wait_for_connection_update() - Update and wait for
2687  * connection update
2688  * @psoc: PSOC object information
2689  * @session_id: Session id
2690  * @ch_freq: Channel frequency
2691  * @reason: Reason for connection update
2692  *
2693  * Update the connection to either single MAC or dual MAC and wait for the
2694  * update to complete
2695  *
2696  * Return: QDF_STATUS
2697  */
2698 QDF_STATUS policy_mgr_update_and_wait_for_connection_update(
2699 		struct wlan_objmgr_psoc *psoc, uint8_t session_id,
2700 		uint32_t ch_freq, enum policy_mgr_conn_update_reason reason);
2701 
2702 /**
2703  * policy_mgr_is_sap_mandatory_channel_set() - Checks if SAP
2704  * mandatory channel is set
2705  * @psoc: PSOC object information
2706  * Checks if any mandatory channel is set for SAP operation
2707  *
2708  * Return: True if mandatory channel is set, false otherwise
2709  */
2710 bool policy_mgr_is_sap_mandatory_channel_set(struct wlan_objmgr_psoc *psoc);
2711 
2712 /**
2713  * policy_mgr_list_has_24GHz_channel() - Check if list contains 2.4GHz channels
2714  * @ch_freq_list: Channel frequency list
2715  * @list_len: Length of the channel list
2716  *
2717  * Checks if the channel list contains atleast one 2.4GHz channel
2718  *
2719  * Return: True if 2.4GHz channel is present, false otherwise
2720  */
2721 bool policy_mgr_list_has_24GHz_channel(uint32_t *ch_freq_list,
2722 				       uint32_t list_len);
2723 
2724 /**
2725  * policy_mgr_get_valid_chans_from_range() - get valid channel from given range
2726  * @psoc: PSOC object information
2727  * @ch_list: Pointer to the channel frequency list
2728  * @ch_cnt: Pointer to the length of the channel list
2729  * @mode: Device mode
2730  *
2731  * Return: QDF_STATUS
2732  */
2733 QDF_STATUS policy_mgr_get_valid_chans_from_range(struct wlan_objmgr_psoc *psoc,
2734 						 uint32_t *ch_list,
2735 						 uint32_t *ch_cnt,
2736 						 enum policy_mgr_con_mode mode);
2737 /**
2738  * policy_mgr_get_valid_chans() - Get the valid channel list
2739  * @psoc: PSOC object information
2740  * @ch_freq_list: Pointer to the valid channel frequency list
2741  * @list_len: Pointer to the length of the valid channel list
2742  *
2743  * Gets the valid channel list filtered by band
2744  *
2745  * Return: QDF_STATUS
2746  */
2747 QDF_STATUS policy_mgr_get_valid_chans(struct wlan_objmgr_psoc *psoc,
2748 				      uint32_t *ch_freq_list,
2749 				      uint32_t *list_len);
2750 
2751 /**
2752  * policy_mgr_get_nss_for_vdev() - Get the allowed nss value for the
2753  * vdev
2754  * @psoc: PSOC object information
2755  * @mode: connection type.
2756  * @nss_2g: Pointer to the 2G Nss parameter.
2757  * @nss_5g: Pointer to the 5G Nss parameter.
2758  *
2759  * Fills the 2G and 5G Nss values based on connection type.
2760  *
2761  * Return: QDF_STATUS
2762  */
2763 QDF_STATUS policy_mgr_get_nss_for_vdev(struct wlan_objmgr_psoc *psoc,
2764 		enum policy_mgr_con_mode mode,
2765 		uint8_t *nss_2g, uint8_t *nss_5g);
2766 
2767 /**
2768  * policy_mgr_get_sap_mandatory_channel() - Get the mandatory channel for SAP
2769  * @psoc: PSOC object information
2770  * @sap_ch_freq: sap current frequency in MHz
2771  * @intf_ch_freq: input/out interference channel frequency to sap
2772  * @sap_vdev_id: SAP vdev id
2773  *
2774  * Gets the mandatory channel for SAP operation
2775  *
2776  * Return: QDF_STATUS
2777  */
2778 QDF_STATUS
2779 policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc,
2780 				     uint32_t sap_ch_freq,
2781 				     uint32_t *intf_ch_freq,
2782 				     uint8_t sap_vdev_id);
2783 
2784 /**
2785  * policy_mgr_set_sap_mandatory_channels() - Set the mandatory channel for SAP
2786  * @psoc: PSOC object information
2787  * @ch_freq_list: Channel frequency list to be set
2788  * @len: Length of the channel list
2789  *
2790  * Sets the channels for the mandatory channel list along with the length of
2791  * of the channel list.
2792  *
2793  * Return: QDF_STATUS
2794  */
2795 QDF_STATUS policy_mgr_set_sap_mandatory_channels(struct wlan_objmgr_psoc *psoc,
2796 						 uint32_t *ch_freq_list,
2797 						 uint32_t len);
2798 
2799 /**
2800  * policy_mgr_is_any_mode_active_on_band_along_with_session() -
2801  * Check if any connection mode is active on a band along with
2802  * the given session
2803  * @psoc: PSOC object information
2804  * @session_id: Session along which active sessions are looked for
2805  * @band: Operating frequency band of the connection
2806  * POLICY_MGR_BAND_24: Looks for active connection on 2.4 GHz only
2807  * POLICY_MGR_BAND_5: Looks for active connection on 5 GHz only
2808  *
2809  * Checks if any of the connection mode is active on a given frequency band
2810  *
2811  * Return: True if any connection is active on a given band, false otherwise
2812  */
2813 bool policy_mgr_is_any_mode_active_on_band_along_with_session(
2814 		struct wlan_objmgr_psoc *psoc, uint8_t session_id,
2815 		enum policy_mgr_band band);
2816 
2817 /**
2818  * policy_mgr_get_bw_by_session_id() - Get channel width for a given session ID
2819  * @psoc: PSOC object information
2820  * @session_id: Session ID
2821  *
2822  * Return: channel width of the session
2823  */
2824 enum phy_ch_width
2825 policy_mgr_get_bw_by_session_id(struct wlan_objmgr_psoc *psoc,
2826 				uint8_t session_id);
2827 
2828 /**
2829  * policy_mgr_get_chan_by_session_id() - Get channel for a given session ID
2830  * @psoc: PSOC object information
2831  * @session_id: Session ID
2832  * @ch_freq: Pointer to the channel frequency
2833  *
2834  * Gets the channel for a given session ID
2835  *
2836  * Return: QDF_STATUS
2837  */
2838 QDF_STATUS policy_mgr_get_chan_by_session_id(struct wlan_objmgr_psoc *psoc,
2839 					     uint8_t session_id,
2840 					     uint32_t *ch_freq);
2841 
2842 /**
2843  * policy_mgr_get_sap_go_count_on_mac() - Provide the count of sap and go on
2844  * given mac
2845  * @psoc: PSOC object information
2846  * @list: To provide the vdev_id of the satisfied sap and go (optional)
2847  * @mac_id: MAC ID
2848  *
2849  * This function provides the count of the matched sap and go
2850  *
2851  * Return: count of the satisfied sap and go
2852  */
2853 uint32_t policy_mgr_get_sap_go_count_on_mac(struct wlan_objmgr_psoc *psoc,
2854 					    uint32_t *list, uint8_t mac_id);
2855 
2856 /**
2857  * policy_mgr_is_sta_present_on_dfs_channel() - to find whether any DFS STA is
2858  *                                              present
2859  * @psoc: PSOC object information
2860  * @vdev_id: pointer to vdev_id. It will be filled with the vdev_id of DFS STA
2861  * @ch_freq: pointer to channel frequency on which DFS STA is present
2862  * @ch_width: pointer channel width on which DFS STA is connected
2863  * If any STA is connected on DFS channel then this function will return true
2864  *
2865  * Return: true if session is on DFS or false if session is on non-dfs channel
2866  */
2867 bool policy_mgr_is_sta_present_on_dfs_channel(struct wlan_objmgr_psoc *psoc,
2868 					      uint8_t *vdev_id,
2869 					      qdf_freq_t *ch_freq,
2870 					      enum hw_mode_bandwidth *ch_width);
2871 
2872 /**
2873  * policy_mgr_is_sta_present_on_freq() - Checks whether sta is present on the
2874  *                                       given frequency
2875  * @psoc: PSOC object information
2876  * @vdev_id: pointer to vdev_id. It will be filled with the vdev_id of DFS STA
2877  * @ch_freq: channel for which this checks is needed
2878  * @ch_width: pointer channel width on which DFS STA is connected
2879  *
2880  * Return: true if STA is found in ch_freq
2881  */
2882 bool policy_mgr_is_sta_present_on_freq(struct wlan_objmgr_psoc *psoc,
2883 				       uint8_t *vdev_id, qdf_freq_t ch_freq,
2884 				       enum hw_mode_bandwidth *ch_width);
2885 
2886 /**
2887  * policy_mgr_is_sta_gc_active_on_mac() - Is there active sta/gc for a
2888  * given mac id
2889  * @psoc: PSOC object information
2890  * @mac_id: MAC ID
2891  *
2892  * Checks if there is active sta/gc for a given mac id
2893  *
2894  * Return: true if there is active sta/gc for a given mac id, false otherwise
2895  */
2896 bool policy_mgr_is_sta_gc_active_on_mac(struct wlan_objmgr_psoc *psoc,
2897 					uint8_t mac_id);
2898 
2899 /**
2900  * policy_mgr_get_mac_id_by_session_id() - Get MAC ID for a given session ID
2901  * @psoc: PSOC object information
2902  * @session_id: Session ID
2903  * @mac_id: Pointer to the MAC ID
2904  *
2905  * Gets the MAC ID for a given session ID
2906  *
2907  * Return: QDF_STATUS
2908  */
2909 QDF_STATUS policy_mgr_get_mac_id_by_session_id(struct wlan_objmgr_psoc *psoc,
2910 		uint8_t session_id, uint8_t *mac_id);
2911 
2912 /**
2913  * policy_mgr_get_mcc_operating_channel() - Get the MCC channel
2914  * @psoc: PSOC object information
2915  * @session_id: Session ID with which MCC is being done
2916  *
2917  * Gets the MCC channel for a given session ID.
2918  *
2919  * Return: '0' (INVALID_CHANNEL_ID) or valid channel frequency
2920  */
2921 uint32_t policy_mgr_get_mcc_operating_channel(struct wlan_objmgr_psoc *psoc,
2922 					      uint8_t session_id);
2923 
2924 /**
2925  * policy_mgr_get_pcl_for_existing_conn() - Get PCL for existing connection
2926  * @psoc: PSOC object information
2927  * @mode: Connection mode of type 'policy_mgr_con_mode'
2928  * @pcl_ch: Pointer to the PCL
2929  * @len: Pointer to the length of the PCL
2930  * @pcl_weight: Pointer to the weights of the PCL
2931  * @weight_len: Max length of the weights list
2932  * @all_matching_cxn_to_del: Need remove all entries before getting pcl
2933  * @vdev_id: Vdev Id
2934  *
2935  * Get the PCL for an existing connection
2936  *
2937  * Return: None
2938  */
2939 QDF_STATUS policy_mgr_get_pcl_for_existing_conn(
2940 		struct wlan_objmgr_psoc *psoc,
2941 		enum policy_mgr_con_mode mode,
2942 		uint32_t *pcl_ch, uint32_t *len,
2943 		uint8_t *pcl_weight, uint32_t weight_len,
2944 		bool all_matching_cxn_to_del,
2945 		uint8_t vdev_id);
2946 
2947 /**
2948  * policy_mgr_get_pcl_for_vdev_id() - Get PCL for 1 vdev
2949  * @psoc: PSOC object information
2950  * @mode: Connection mode of type 'policy_mgr_con_mode'
2951  * @pcl_ch: Pointer to the PCL
2952  * @len: Pointer to the length of the PCL
2953  * @pcl_weight: Pointer to the weights of the PCL
2954  * @weight_len: Max length of the weights list
2955  * @vdev_id: vdev id to get PCL
2956  *
2957  * Get the PCL for a vdev, when vdev need move to another channel, need
2958  * get PCL after remove the vdev from connection list.
2959  *
2960  * Return: None
2961  */
2962 QDF_STATUS policy_mgr_get_pcl_for_vdev_id(struct wlan_objmgr_psoc *psoc,
2963 					  enum policy_mgr_con_mode mode,
2964 					  uint32_t *pcl_ch, uint32_t *len,
2965 					  uint8_t *pcl_weight,
2966 					  uint32_t weight_len,
2967 					  uint8_t vdev_id);
2968 
2969 /**
2970  * policy_mgr_get_pcl_for_scc_in_same_mode() - Get PCL for vdev and other
2971  * connection in same mode and same frequency
2972  * @psoc: PSOC object information
2973  * @mode: Connection mode of type 'policy_mgr_con_mode'
2974  * @pcl_ch: Pointer to the PCL
2975  * @len: Pointer to the length of the PCL
2976  * @pcl_weight: Pointer to the weights of the PCL
2977  * @weight_len: Max length of the weights list
2978  * @vdev_id: vdev id to get PCL
2979  *
2980  * If need move connections in same mode and same frequency, need get PCL
2981  * after remove them from connection list.
2982  *
2983  * Return: QDF STATUS
2984  */
2985 QDF_STATUS
2986 policy_mgr_get_pcl_for_scc_in_same_mode(struct wlan_objmgr_psoc *psoc,
2987 					enum policy_mgr_con_mode mode,
2988 					uint32_t *pcl_ch, uint32_t *len,
2989 					uint8_t *pcl_weight,
2990 					uint32_t weight_len,
2991 					uint8_t vdev_id);
2992 
2993 /**
2994  * policy_mgr_get_valid_chan_weights() - Get the weightage for
2995  * all valid channels
2996  * @psoc: PSOC object information
2997  * @weight: Pointer to the structure containing pcl, saved channel list and
2998  * weighed channel list
2999  * @mode: Policy manager connection mode
3000  * @vdev: pointer to vdev on which new connection is coming up
3001  *
3002  * Provides the weightage for all valid channels. This compares the PCL list
3003  * with the valid channel list. The channels present in the PCL get their
3004  * corresponding weightage and the non-PCL channels get the default weightage
3005  * of WEIGHT_OF_NON_PCL_CHANNELS.
3006  *
3007  * Return: QDF_STATUS
3008  */
3009 QDF_STATUS policy_mgr_get_valid_chan_weights(struct wlan_objmgr_psoc *psoc,
3010 		struct policy_mgr_pcl_chan_weights *weight,
3011 		enum policy_mgr_con_mode mode, struct wlan_objmgr_vdev *vdev);
3012 
3013 /**
3014  * policy_mgr_set_hw_mode_on_channel_switch() - Set hw mode
3015  * after channel switch
3016  * @psoc: PSOC object information
3017  * @session_id: Session ID
3018  *
3019  * Sets hw mode after doing a channel switch
3020  *
3021  * Return: QDF_STATUS
3022  */
3023 QDF_STATUS policy_mgr_set_hw_mode_on_channel_switch(
3024 		struct wlan_objmgr_psoc *psoc, uint8_t session_id);
3025 
3026 /**
3027  * policy_mgr_check_and_set_hw_mode_for_channel_switch() - check if hw mode
3028  * change is required before channel switch for STA/SAP,
3029  * this is required if DBS mode is 2x2
3030  * @psoc: PSOC object information
3031  * @vdev_id: vdev id on which channel switch is required
3032  * @ch_freq: New channel frequency to which channel switch is requested
3033  * @reason: reason for hw mode change
3034  *
3035  * Return: QDF_STATUS, success if HW mode change is required else Failure
3036  */
3037 QDF_STATUS policy_mgr_check_and_set_hw_mode_for_channel_switch(
3038 		struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
3039 		uint32_t ch_freq, enum policy_mgr_conn_update_reason reason);
3040 
3041 /**
3042  * policy_mgr_checkn_update_hw_mode_single_mac_mode() - Set hw_mode to SMM
3043  * if required
3044  * @psoc: PSOC object information
3045  * @ch_freq: channel frequency for the new STA connection
3046  *
3047  * After the STA disconnection, if the hw_mode is in DBS and the new STA
3048  * connection is coming in the band in which existing connections are
3049  * present, then this function stops the dbs opportunistic timer and sets
3050  * the hw_mode to Single MAC mode (SMM).
3051  *
3052  * Return: None
3053  */
3054 void policy_mgr_checkn_update_hw_mode_single_mac_mode(
3055 		struct wlan_objmgr_psoc *psoc, uint32_t ch_freq);
3056 
3057 /**
3058  * policy_mgr_dump_connection_status_info() - Dump the concurrency information
3059  * @psoc: PSOC object information
3060  * Prints the concurrency information such as tx/rx spatial stream, chainmask,
3061  * etc.
3062  *
3063  * Return: None
3064  */
3065 void policy_mgr_dump_connection_status_info(struct wlan_objmgr_psoc *psoc);
3066 
3067 /**
3068  * policy_mgr_mode_get_macid_by_vdev_id() - get macid from vdev_id
3069  * @psoc: PSOC object information
3070  * @vdev_id: vdev id to get PCL
3071  *
3072  * Return: mac id
3073  */
3074 uint32_t policy_mgr_mode_get_macid_by_vdev_id(struct wlan_objmgr_psoc *psoc,
3075 					      uint32_t vdev_id);
3076 
3077 /**
3078  * policy_mgr_mode_specific_vdev_id() - provides the
3079  * vdev id of the pecific mode
3080  * @psoc: PSOC object information
3081  * @mode: type of connection
3082  *
3083  * This function provides vdev id for the given mode
3084  *
3085  * Return: vdev id
3086  */
3087 uint32_t policy_mgr_mode_specific_vdev_id(struct wlan_objmgr_psoc *psoc,
3088 					  enum policy_mgr_con_mode mode);
3089 
3090 /**
3091  * policy_mgr_mode_specific_connection_count() - provides the
3092  * count of connections of specific mode
3093  * @psoc: PSOC object information
3094  * @mode: type of connection
3095  * @list: To provide the indices on pm_conc_connection_list
3096  *	(optional)
3097  *
3098  * This function provides the count of current connections
3099  *
3100  * Return: connection count of specific type
3101  */
3102 uint32_t policy_mgr_mode_specific_connection_count(
3103 		struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode,
3104 		uint32_t *list);
3105 
3106 /**
3107  * policy_mgr_check_conn_with_mode_and_vdev_id() - checks if any active
3108  * session with specific mode and vdev_id
3109  * @psoc: PSOC object information
3110  * @mode: type of connection
3111  * @vdev_id: vdev_id of the connection
3112  *
3113  * This function checks if any active session with specific mode and vdev_id
3114  * is present
3115  *
3116  * Return: QDF STATUS with success if active session is found, else failure
3117  */
3118 QDF_STATUS policy_mgr_check_conn_with_mode_and_vdev_id(
3119 		struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode,
3120 		uint32_t vdev_id);
3121 
3122 /**
3123  * policy_mgr_dump_freq_range_n_vdev_map() - Dump freq range of mac and vdev to
3124  * mac mapping
3125  * @num_vdev_mac_entries: Number of vdev-mac id mapping that follows
3126  * @vdev_mac_map: vdev-mac id map. This memory will be freed by the caller.
3127  * So, make local copy if needed.
3128  * @num_mac_freq: Number of pdev freq mapping that follows
3129  * @mac_freq_range: mac_freq_range mapping
3130  *
3131  * Return: None
3132  */
3133 void
3134 policy_mgr_dump_freq_range_n_vdev_map(uint32_t num_vdev_mac_entries,
3135 			struct policy_mgr_vdev_mac_map *vdev_mac_map,
3136 			uint32_t num_mac_freq,
3137 			struct policy_mgr_pdev_mac_freq_map *mac_freq_range);
3138 
3139 /**
3140  * policy_mgr_hw_mode_transition_cb() - Callback for HW mode
3141  * transition from FW
3142  * @old_hw_mode_index: Old HW mode index
3143  * @new_hw_mode_index: New HW mode index
3144  * @num_vdev_mac_entries: Number of vdev-mac id mapping that follows
3145  * @vdev_mac_map: vdev-mac id map. This memory will be freed by the caller.
3146  * So, make local copy if needed.
3147  * @num_mac_freq: Number of pdev freq mapping that follows
3148  * @mac_freq_range: mac_freq_range mapping
3149  * @context:
3150  *
3151  * Provides the old and new HW mode index set by the FW
3152  *
3153  * Return: None
3154  */
3155 void policy_mgr_hw_mode_transition_cb(uint32_t old_hw_mode_index,
3156 		uint32_t new_hw_mode_index,
3157 		uint32_t num_vdev_mac_entries,
3158 		struct policy_mgr_vdev_mac_map *vdev_mac_map,
3159 		uint32_t num_mac_freq,
3160 		struct policy_mgr_pdev_mac_freq_map *mac_freq_range,
3161 		struct wlan_objmgr_psoc *context);
3162 
3163 /**
3164  * policy_mgr_will_freq_lead_to_mcc() - Check if the given freq can lead to
3165  * MCC scenario with existing connection
3166  * @psoc: psoc pointer
3167  * @freq: freq to check with existing connections
3168  *
3169  * Return: true or false
3170  */
3171 bool policy_mgr_will_freq_lead_to_mcc(struct wlan_objmgr_psoc *psoc,
3172 				      qdf_freq_t freq);
3173 
3174 /**
3175  * policy_mgr_current_concurrency_is_scc() - To check the current
3176  * concurrency combination if it is doing SCC
3177  * @psoc: PSOC object information
3178  * This routine is called to check if it is doing SCC
3179  *
3180  * Return: True - SCC, False - Otherwise
3181  */
3182 bool policy_mgr_current_concurrency_is_scc(struct wlan_objmgr_psoc *psoc);
3183 
3184 /**
3185  * policy_mgr_current_concurrency_is_mcc() - To check the current
3186  * concurrency combination if it is doing MCC
3187  * @psoc: PSOC object information
3188  * This routine is called to check if it is doing MCC
3189  *
3190  * Return: True - MCC, False - Otherwise
3191  */
3192 bool policy_mgr_current_concurrency_is_mcc(struct wlan_objmgr_psoc *psoc);
3193 
3194 /**
3195  * policy_mgr_concurrent_sta_on_different_mac() - To check if
3196  * sta concurrency on different mac
3197  * @psoc: PSOC object information
3198  * This routine is called to check if sta concurrency on different mac
3199  *
3200  * Return: True - sta concurrency on different mac, False - Otherwise
3201  */
3202 bool policy_mgr_concurrent_sta_on_different_mac(struct wlan_objmgr_psoc *psoc);
3203 
3204 /**
3205  * policy_mgr_is_sap_p2pgo_on_dfs() - check if there is a P2PGO or SAP
3206  * operating in a DFS channel
3207  * @psoc: PSOC object information
3208  * This routine is called to check if there is a P2PGO/SAP on DFS channel
3209  *
3210  * Return: True  - P2PGO/SAP present on DFS Channel
3211  * False - Otherwise
3212  */
3213 
3214 bool policy_mgr_is_sap_p2pgo_on_dfs(struct wlan_objmgr_psoc *psoc);
3215 
3216 /**
3217  * policy_mgr_register_sme_cb() - register SME callbacks
3218  * @psoc: PSOC object information
3219  * @sme_cbacks: function pointers from SME
3220  *
3221  * API, allows SME to register callbacks to be invoked by policy
3222  * mgr
3223  *
3224  * Return: SUCCESS,
3225  *         Failure (if registration fails)
3226  */
3227 QDF_STATUS policy_mgr_register_sme_cb(struct wlan_objmgr_psoc *psoc,
3228 		struct policy_mgr_sme_cbacks *sme_cbacks);
3229 
3230 /**
3231  * policy_mgr_register_hdd_cb() - register HDD callbacks
3232  * @psoc: PSOC object information
3233  * @hdd_cbacks: function pointers from HDD
3234  *
3235  * API, allows HDD to register callbacks to be invoked by policy
3236  * mgr
3237  *
3238  * Return: SUCCESS,
3239  *         Failure (if registration fails)
3240  */
3241 QDF_STATUS policy_mgr_register_hdd_cb(struct wlan_objmgr_psoc *psoc,
3242 		struct policy_mgr_hdd_cbacks *hdd_cbacks);
3243 
3244 /**
3245  * policy_mgr_register_conc_cb() - register Lim callbacks
3246  * @psoc: PSOC object information
3247  * @conc_cbacks: function pointers from lim
3248  *
3249  * API, allows Lim to register callbacks to be invoked by policy
3250  * mgr
3251  *
3252  * Return: SUCCESS,
3253  *         Failure (if registration fails)
3254  */
3255 
3256 QDF_STATUS policy_mgr_register_conc_cb(struct wlan_objmgr_psoc *psoc,
3257 				struct policy_mgr_conc_cbacks *conc_cbacks);
3258 
3259 /**
3260  * policy_mgr_deregister_hdd_cb() - Deregister HDD callbacks
3261  * @psoc: PSOC object information
3262  *
3263  * API, allows HDD to deregister callbacks
3264  *
3265  * Return: SUCCESS,
3266  *         Failure (if de-registration fails)
3267  */
3268 QDF_STATUS policy_mgr_deregister_hdd_cb(struct wlan_objmgr_psoc *psoc);
3269 
3270 /**
3271  * policy_mgr_register_tdls_cb() - register TDLS callbacks
3272  * @psoc: PSOC object information
3273  * @tdls_cbacks: function pointers from TDLS
3274  *
3275  * API, allows TDLS to register callbacks to be invoked by
3276  * policy mgr
3277  *
3278  * Return: SUCCESS,
3279  *         Failure (if registration fails)
3280  */
3281 QDF_STATUS policy_mgr_register_tdls_cb(struct wlan_objmgr_psoc *psoc,
3282 		struct policy_mgr_tdls_cbacks *tdls_cbacks);
3283 
3284 /**
3285  * policy_mgr_register_cdp_cb() - register CDP callbacks
3286  * @psoc: PSOC object information
3287  * @cdp_cbacks: function pointers from CDP
3288  *
3289  * API, allows CDP to register callbacks to be invoked by
3290  * policy mgr
3291  *
3292  * Return: SUCCESS,
3293  *         Failure (if registration fails)
3294  */
3295 QDF_STATUS policy_mgr_register_cdp_cb(struct wlan_objmgr_psoc *psoc,
3296 		struct policy_mgr_cdp_cbacks *cdp_cbacks);
3297 
3298 /**
3299  * policy_mgr_register_dp_cb() - register DP callbacks
3300  * @psoc: PSOC object information
3301  * @dp_cbacks: function pointers from DP
3302  *
3303  * API, allows DP to register callbacks to be invoked by
3304  * policy mgr
3305  *
3306  * Return: SUCCESS,
3307  *         Failure (if registration fails)
3308  */
3309 QDF_STATUS policy_mgr_register_dp_cb(struct wlan_objmgr_psoc *psoc,
3310 		struct policy_mgr_dp_cbacks *dp_cbacks);
3311 
3312 /**
3313  * policy_mgr_register_wma_cb() - register WMA callbacks
3314  * @psoc: PSOC object information
3315  * @wma_cbacks: function pointers from WMA
3316  *
3317  * API, allows WMA to register callbacks to be invoked by policy
3318  * mgr
3319  *
3320  * Return: SUCCESS,
3321  *         Failure (if registration fails)
3322  */
3323 QDF_STATUS policy_mgr_register_wma_cb(struct wlan_objmgr_psoc *psoc,
3324 		struct policy_mgr_wma_cbacks *wma_cbacks);
3325 
3326 /**
3327  * policy_mgr_find_if_fw_supports_dbs() - to find if FW/HW supports DBS
3328  * @psoc: PSOC object information
3329  *
3330  * This API checks if legacy service ready event contains DBS or no.
3331  * This API doesn't check service ready extension which contains actual
3332  * hw mode list that tells if all supported HW modes' caps.
3333  *
3334  * Return: true (if service ready indication supports DBS or no) else false
3335  *
3336  */
3337 bool policy_mgr_find_if_fw_supports_dbs(struct wlan_objmgr_psoc *psoc);
3338 
3339 /**
3340  * policy_mgr_is_dbs_enable() - Check if master DBS control is enabled
3341  * @psoc: PSOC object information
3342  * Checks if the master DBS control is enabled. This will be used
3343  * to override any other DBS capability
3344  *
3345  * Return: True if master DBS control is enabled
3346  */
3347 bool policy_mgr_is_dbs_enable(struct wlan_objmgr_psoc *psoc);
3348 
3349 /**
3350  * policy_mgr_is_hw_dbs_capable() - Check if HW is DBS capable
3351  * @psoc: PSOC object information
3352  * Checks if the HW is DBS capable
3353  *
3354  * Return: true if the HW is DBS capable
3355  */
3356 bool policy_mgr_is_hw_dbs_capable(struct wlan_objmgr_psoc *psoc);
3357 
3358 /**
3359  * policy_mgr_is_interband_mcc_supported() - Checks for interband MCC support
3360  * @psoc: PSOC object information
3361  * Checks if target supports interband MCC or not
3362  *
3363  * Return: True if the target supports interband MCC else False
3364  */
3365 bool policy_mgr_is_interband_mcc_supported(struct wlan_objmgr_psoc *psoc);
3366 
3367 /**
3368  * policy_mgr_is_dbs_scan_allowed() - Check if DBS scan is allowed or not
3369  * @psoc: PSOC object information
3370  * Checks if the DBS scan can be performed or not
3371  *
3372  * Return: true if DBS scan is allowed.
3373  */
3374 bool policy_mgr_is_dbs_scan_allowed(struct wlan_objmgr_psoc *psoc);
3375 
3376 /**
3377  * policy_mgr_is_hw_sbs_capable() - Check if HW is SBS capable
3378  * @psoc: PSOC object information
3379  * Checks if the HW is SBS capable
3380  *
3381  * Return: true if the HW is SBS capable
3382  */
3383 bool policy_mgr_is_hw_sbs_capable(struct wlan_objmgr_psoc *psoc);
3384 
3385 /**
3386  * policy_mgr_is_hw_emlsr_capable() - Check if HW is EMLSR capable
3387  * @psoc: PSOC object information
3388  * Checks if the HW is EMLSR capable
3389  *
3390  * Return: true if the HW is EMLSR capable
3391  */
3392 bool policy_mgr_is_hw_emlsr_capable(struct wlan_objmgr_psoc *psoc);
3393 
3394 /**
3395  * policy_mgr_2_freq_always_on_same_mac() - Function to check whether both the
3396  * input frequencies are on same mac in all supported mode/freq range
3397  * @psoc: Pointer to Psoc
3398  * @freq_1: Frequency 1 to check
3399  * @freq_2: Frequency 2 to check
3400  *
3401  * This Function check whether both the input frequency exist in the same mac
3402  * in all supported mode/freq range
3403  *
3404  * Return:True if both the frequency exist on the same mac in all supported
3405  * mode/freq range.
3406  */
3407 bool policy_mgr_2_freq_always_on_same_mac(struct wlan_objmgr_psoc *psoc,
3408 					  qdf_freq_t freq_1, qdf_freq_t freq_2);
3409 
3410 /**
3411  * policy_mgr_are_2_freq_on_same_mac() - Function to check whether both the
3412  * input frequencies are on same mac in current freq range
3413  * @psoc: Pointer to Psoc
3414  * @freq_1: Frequency 1 to check
3415  * @freq_2: Frequency 2 to check
3416  *
3417  * This Function check whether both the input frequency exist in the same mac
3418  *
3419  * Return:True if both the frequency exist on the same mac.
3420  */
3421 bool
3422 policy_mgr_are_2_freq_on_same_mac(struct wlan_objmgr_psoc *psoc,
3423 				  qdf_freq_t freq_1,
3424 				  qdf_freq_t  freq_2);
3425 
3426 /**
3427  * policy_mgr_3_freq_always_on_same_mac() - Function to check whether all three
3428  * input frequencies will always in same mac in all supported mode/freq range
3429  * @psoc: Pointer to Psoc
3430  * @freq_1: Frequency 1 to check
3431  * @freq_2: Frequency 2 to check
3432  * @freq_3: Frequency 3 to check
3433  *
3434  * This Function check whether all three input frequencies exist in the same
3435  * mac in all supported mode/freq range.
3436  *
3437  * Return:True if all three frequency exist on the same mac in all supported
3438  * mode/freq range
3439  */
3440 bool
3441 policy_mgr_3_freq_always_on_same_mac(struct wlan_objmgr_psoc *psoc,
3442 				     qdf_freq_t freq_1, qdf_freq_t freq_2,
3443 				     qdf_freq_t freq_3);
3444 
3445 /**
3446  * policy_mgr_are_3_freq_on_same_mac() - Function to check whether all three
3447  * input frequencies are in same mac in current freq range
3448  * @psoc: Pointer to Psoc
3449  * @freq_1: Frequency 1 to check
3450  * @freq_2: Frequency 2 to check
3451  * @freq_3: Frequency 3 to check
3452  *
3453  * This Function check whether all three input frequencies exist in the same
3454  * mac.
3455  *
3456  * Return:True if all three frequency exist on the same mac
3457  */
3458 bool
3459 policy_mgr_are_3_freq_on_same_mac(struct wlan_objmgr_psoc *psoc,
3460 				  qdf_freq_t freq_1, qdf_freq_t freq_2,
3461 				  qdf_freq_t freq_3);
3462 
3463 /**
3464  * policy_mgr_allow_4th_new_freq() - Function to check whether 4th freq can
3465  * be allowed with existing 3 vifs
3466  * @psoc: Pointer to Psoc
3467  * @ch_freq: new channel frequency
3468  * @mode: new device mode
3469  * @ext_flags: extended flags for concurrency check
3470  *
3471  * Return:True if 4th freq can be allowed with existing 3 vifs
3472  */
3473 #ifdef FEATURE_FOURTH_CONNECTION
3474 bool
3475 policy_mgr_allow_4th_new_freq(struct wlan_objmgr_psoc *psoc,
3476 			      qdf_freq_t ch_freq,
3477 			      enum policy_mgr_con_mode mode,
3478 			      uint32_t ext_flags);
3479 #else
3480 static inline bool
policy_mgr_allow_4th_new_freq(struct wlan_objmgr_psoc * psoc,qdf_freq_t ch_freq,enum policy_mgr_con_mode mode,uint32_t ext_flags)3481 policy_mgr_allow_4th_new_freq(struct wlan_objmgr_psoc *psoc,
3482 			      qdf_freq_t ch_freq,
3483 			      enum policy_mgr_con_mode mode,
3484 			      uint32_t ext_flags)
3485 {
3486 	return false;
3487 }
3488 #endif
3489 
3490 /**
3491  * policy_mgr_are_sbs_chan() - Function to check whether both the
3492  * input frequency are in SBS frequency range
3493  *
3494  * @psoc: Pointer to Psoc
3495  * @freq_1: Frequency 1 to check
3496  * @freq_2: Frequency 2 to check
3497  *
3498  * This Function check whether both the input frequency exist in the SBS
3499  * frequency range.
3500  *
3501  * Return:True if both the frequency exist on the SBS frequency range.
3502  *
3503  */
3504 bool
3505 policy_mgr_are_sbs_chan(struct wlan_objmgr_psoc *psoc, qdf_freq_t freq_1,
3506 			qdf_freq_t  freq_2);
3507 
3508 /**
3509  * policy_mgr_is_current_hwmode_dbs() - Function to check if current HW mode is
3510  * DBS
3511  *
3512  * @psoc: Pointer to Psoc
3513  *
3514  * This Function checks if current HW mode is DBS
3515  *
3516  * Return:True if current HW mode is DBS.
3517  *
3518  */
3519 bool policy_mgr_is_current_hwmode_dbs(struct wlan_objmgr_psoc *psoc);
3520 
3521 /**
3522  * policy_mgr_is_current_hwmode_sbs() - Function to check if current HW mode is
3523  * SBS
3524  *
3525  * @psoc: Pointer to Psoc
3526  *
3527  * This Function checks if current HW mode is SBS
3528  *
3529  * Return:True if current HW mode is SBS.
3530  *
3531  */
3532 bool policy_mgr_is_current_hwmode_sbs(struct wlan_objmgr_psoc *psoc);
3533 
3534 /**
3535  * policy_mgr_is_curr_hwmode_emlsr() - Function to check if current HW mode is
3536  * eMLSR
3537  *
3538  * @psoc: Pointer to psoc
3539  *
3540  * This Function checks if current HW mode is eMLSR
3541  *
3542  * Return:True if current HW mode is eMLSR.
3543  *
3544  */
3545 bool policy_mgr_is_curr_hwmode_emlsr(struct wlan_objmgr_psoc *psoc);
3546 
3547 /**
3548  * policy_mgr_is_dp_hw_dbs_capable() - if hardware is capable of dbs 2x2
3549  * or 1X1 for Data Path (HW mode)
3550  * @psoc: PSOC object information
3551  * This API is for Data Path to get HW mode support dbs.
3552  *
3553  * Return: true - DBS capable, false - not
3554  */
3555 bool policy_mgr_is_dp_hw_dbs_capable(struct wlan_objmgr_psoc *psoc);
3556 
3557 /**
3558  * policy_mgr_is_hw_dbs_2x2_capable() - if hardware is capable of dbs 2x2
3559  * @psoc: PSOC object information
3560  * This function checks if hw_modes supported are always capable of
3561  * DBS and there is no need for downgrading while entering DBS.
3562  *    true: DBS 2x2 can always be supported
3563  *    false: hw_modes support DBS 1x1 as well
3564  * Genoa DBS 2x2 + 1x1 will not be included.
3565  *
3566  * Return: true - DBS2x2, false - DBS1x1
3567  */
3568 bool policy_mgr_is_hw_dbs_2x2_capable(struct wlan_objmgr_psoc *psoc);
3569 
3570 /**
3571  * policy_mgr_is_hw_dbs_required_for_band() - Check whether hardware needs DBS
3572  * mode to support the given band
3573  * @psoc: PSOC object information
3574  * @band: band
3575  *
3576  * The function checks whether DBS mode switching required or not to support
3577  * given band based on target capability.
3578  * Any HW which doesn't support given band on PHY A will need DBS HW mode when a
3579  * connection is coming up on that band.
3580  *
3581  * Return: true - DBS mode required for requested band
3582  */
3583 bool policy_mgr_is_hw_dbs_required_for_band(struct wlan_objmgr_psoc *psoc,
3584 					    enum hw_mode_mac_band_cap band);
3585 
3586 /*
3587  * policy_mgr_is_2x2_1x1_dbs_capable() - check 2x2+1x1 DBS supported or not
3588  * @psoc: PSOC object data
3589  *
3590  * This routine is called to check 2x2 5G + 1x1 2G (DBS1) or
3591  * 2x2 2G + 1x1 5G (DBS2) support or not.
3592  * Either DBS1 or DBS2 supported
3593  *
3594  * Return: true/false
3595  */
3596 bool policy_mgr_is_2x2_1x1_dbs_capable(struct wlan_objmgr_psoc *psoc);
3597 
3598 /*
3599  * policy_mgr_is_2x2_5G_1x1_2G_dbs_capable() - check Genoa DBS1 enabled or not
3600  * @psoc: PSOC object data
3601  *
3602  * This routine is called to check support DBS1 or not.
3603  * Notes: DBS1: 2x2 5G + 1x1 2G.
3604  * This function will call policy_mgr_get_hw_mode_idx_from_dbs_hw_list to match
3605  * the HW mode from hw mode list. The parameters will also be matched to
3606  * 2x2 5G +2x2 2G HW mode. But firmware will not report 2x2 5G + 2x2 2G alone
3607  * with 2x2 5G + 1x1 2G at same time. So, it is safe to find DBS1 with
3608  * policy_mgr_get_hw_mode_idx_from_dbs_hw_list.
3609  *
3610  * Return: true/false
3611  */
3612 bool policy_mgr_is_2x2_5G_1x1_2G_dbs_capable(struct wlan_objmgr_psoc *psoc);
3613 
3614 /*
3615  * policy_mgr_is_2x2_2G_1x1_5G_dbs_capable() - check Genoa DBS2 enabled or not
3616  * @psoc: PSOC object data
3617  *
3618  * This routine is called to check support DBS2 or not.
3619  * Notes: DBS2: 2x2 2G + 1x1 5G
3620  *
3621  * Return: true/false
3622  */
3623 bool policy_mgr_is_2x2_2G_1x1_5G_dbs_capable(struct wlan_objmgr_psoc *psoc);
3624 
3625 /**
3626  * policy_mgr_init() - Policy Manager component initialization
3627  *                 routine
3628  *
3629  * Return - QDF Status
3630  */
3631 QDF_STATUS policy_mgr_init(void);
3632 
3633 /**
3634  * policy_mgr_deinit() - Policy Manager component
3635  *                 de-initialization routine
3636  *
3637  * Return - QDF Status
3638  */
3639 QDF_STATUS policy_mgr_deinit(void);
3640 
3641 /**
3642  * policy_mgr_psoc_enable() - Policy Manager component
3643  *                 enable routine
3644  * @psoc: PSOC object information
3645  *
3646  * Return - QDF Status
3647  */
3648 QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc);
3649 
3650 /**
3651  * policy_mgr_psoc_disable() - Policy Manager component
3652  *                 disable routine
3653  * @psoc: PSOC object information
3654  *
3655  * Return - QDF Status
3656  */
3657 QDF_STATUS policy_mgr_psoc_disable(struct wlan_objmgr_psoc *psoc);
3658 
3659 /**
3660  * policy_mgr_psoc_open() - Policy Manager component
3661  *                 open routine
3662  * @psoc: PSOC object information
3663  *
3664  * Return - QDF Status
3665  */
3666 QDF_STATUS policy_mgr_psoc_open(struct wlan_objmgr_psoc *psoc);
3667 
3668 /**
3669  * policy_mgr_psoc_close() - Policy Manager component
3670  *                 close routine
3671  * @psoc: PSOC object information
3672  *
3673  * Return - QDF Status
3674  */
3675 QDF_STATUS policy_mgr_psoc_close(struct wlan_objmgr_psoc *psoc);
3676 
3677 /**
3678  * policy_mgr_get_num_dbs_hw_modes() - Get number of HW mode
3679  * @psoc: PSOC object information
3680  * Fetches the number of DBS HW modes returned by the FW
3681  *
3682  * Return: Negative value on error or returns the number of DBS HW modes
3683  */
3684 int8_t policy_mgr_get_num_dbs_hw_modes(struct wlan_objmgr_psoc *psoc);
3685 
3686 /**
3687  * policy_mgr_get_dbs_hw_modes() - Get the DBS HW modes for userspace
3688  * @psoc: PSOC object information
3689  * @one_by_one_dbs: 1x1 DBS capability of HW
3690  * @two_by_two_dbs: 2x2 DBS capability of HW
3691  *
3692  * Provides the DBS HW mode capability such as whether
3693  * 1x1 DBS, 2x2 DBS is supported by the HW or not.
3694  *
3695  * Return: Failure in case of error and 0 on success
3696  *         one_by_one_dbs/two_by_two_dbs will be false,
3697  *         if they are not supported.
3698  *         one_by_one_dbs/two_by_two_dbs will be true,
3699  *         if they are supported.
3700  *         false values of one_by_one_dbs/two_by_two_dbs,
3701  *         indicate DBS is disabled
3702  */
3703 QDF_STATUS policy_mgr_get_dbs_hw_modes(struct wlan_objmgr_psoc *psoc,
3704 		bool *one_by_one_dbs, bool *two_by_two_dbs);
3705 
3706 /**
3707  * policy_mgr_check_sap_restart() - Restart SAP when band/channel change
3708  * @psoc: Pointer to soc
3709  * @vdev_id: Vdev id
3710  *
3711  * Return: None
3712  */
3713 void
3714 policy_mgr_check_sap_restart(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id);
3715 
3716 /**
3717  * policy_mgr_check_sta_ap_concurrent_ch_intf() - Restart SAP in STA-AP case
3718  * @data: Pointer to STA adapter
3719  *
3720  * Restarts the SAP interface in STA-AP concurrency scenario
3721  *
3722  * Return: None
3723  */
3724 void policy_mgr_check_sta_ap_concurrent_ch_intf(void *data);
3725 
3726 /**
3727  * policy_mgr_get_current_hw_mode() - Get current HW mode params
3728  * @psoc: PSOC object information
3729  * @hw_mode: HW mode parameters
3730  *
3731  * Provides the current HW mode parameters if the HW mode is initialized
3732  * in the driver
3733  *
3734  * Return: Success if the current HW mode params are successfully populated
3735  */
3736 QDF_STATUS policy_mgr_get_current_hw_mode(struct wlan_objmgr_psoc *psoc,
3737 		struct policy_mgr_hw_mode_params *hw_mode);
3738 
3739 /**
3740  * policy_mgr_get_dbs_plus_agile_scan_config() - Get DBS plus agile scan bit
3741  * @psoc: PSOC object information
3742  * Gets the DBS plus agile scan bit of concurrent_scan_config_bits
3743  *
3744  * Return: 0 or 1 to indicate the DBS plus agile scan bit
3745  */
3746 bool policy_mgr_get_dbs_plus_agile_scan_config(struct wlan_objmgr_psoc *psoc);
3747 
3748 /**
3749  * policy_mgr_get_single_mac_scan_with_dfs_config() - Get Single
3750  * MAC scan with DFS bit
3751  * @psoc: PSOC object information
3752  * Gets the Single MAC scan with DFS bit of concurrent_scan_config_bits
3753  *
3754  * Return: 0 or 1 to indicate the Single MAC scan with DFS bit
3755  */
3756 bool policy_mgr_get_single_mac_scan_with_dfs_config(
3757 		struct wlan_objmgr_psoc *psoc);
3758 
3759 /**
3760  * policy_mgr_set_hw_mode_change_in_progress() - Set value
3761  * corresponding to policy_mgr_hw_mode_change that indicate if
3762  * HW mode change is in progress
3763  * @psoc: PSOC object information
3764  * @value: Indicate if hw mode change is in progress
3765  *
3766  * Set the value corresponding to policy_mgr_hw_mode_change that
3767  * indicated if hw mode change is in progress.
3768  *
3769  * Return: None
3770  */
3771 void policy_mgr_set_hw_mode_change_in_progress(
3772 	struct wlan_objmgr_psoc *psoc, enum policy_mgr_hw_mode_change value);
3773 
3774 /**
3775  * policy_mgr_is_hw_mode_change_in_progress() - Check if HW mode
3776  * change is in progress.
3777  * @psoc: PSOC object information
3778  *
3779  * Returns the corresponding policy_mgr_hw_mode_change value.
3780  *
3781  * Return: policy_mgr_hw_mode_change value.
3782  */
3783 enum policy_mgr_hw_mode_change policy_mgr_is_hw_mode_change_in_progress(
3784 	struct wlan_objmgr_psoc *psoc);
3785 
3786 /**
3787  * policy_mgr_get_hw_mode_change_from_hw_mode_index() - Get
3788  * matching HW mode from index
3789  * @psoc: PSOC object information
3790  * @hw_mode_index: HW mode index
3791  * Returns the corresponding policy_mgr_hw_mode_change HW mode.
3792  *
3793  * Return: policy_mgr_hw_mode_change value.
3794  */
3795 enum policy_mgr_hw_mode_change policy_mgr_get_hw_mode_change_from_hw_mode_index(
3796 	struct wlan_objmgr_psoc *psoc, uint32_t hw_mode_index);
3797 
3798 /**
3799  * policy_mgr_is_scan_simultaneous_capable() - Check if scan
3800  * parallelization is supported or not
3801  * @psoc: PSOC object information
3802  * currently scan parallelization feature support is dependent on DBS but
3803  * it can be independent in future.
3804  *
3805  * Return: True if master DBS control is enabled
3806  */
3807 bool policy_mgr_is_scan_simultaneous_capable(struct wlan_objmgr_psoc *psoc);
3808 
3809 /**
3810  * policy_mgr_set_user_cfg() - Function to set user cfg variables
3811  * required by policy manager component
3812  * @psoc: PSOC object information
3813  * @user_cfg: User config valiables structure pointer
3814  *
3815  * This function sets the user cfg variables required by policy
3816  * manager
3817  *
3818  * Return: SUCCESS or FAILURE
3819  *
3820  */
3821 QDF_STATUS policy_mgr_set_user_cfg(struct wlan_objmgr_psoc *psoc,
3822 				struct policy_mgr_user_cfg *user_cfg);
3823 
3824 /**
3825  * policy_mgr_init_dbs_config() - Function to initialize DBS
3826  * config in policy manager component
3827  * @psoc: PSOC object information
3828  * @scan_config: DBS scan config
3829  * @fw_config: DBS FW config
3830  *
3831  * This function sets the DBS configurations required by policy
3832  * manager
3833  *
3834  * Return: SUCCESS or FAILURE
3835  *
3836  */
3837 void policy_mgr_init_dbs_config(struct wlan_objmgr_psoc *psoc,
3838 		uint32_t scan_config, uint32_t fw_config);
3839 
3840 /**
3841  * policy_mgr_init_sbs_fw_config() - Function to initialize SBS
3842  * fw mode config in policy manager component
3843  * @psoc: PSOC object information
3844  * @fw_config: FW config
3845  *
3846  * This function initialize SBS fw mode config in policy manager component
3847  *
3848  * Return: void
3849  *
3850  */
3851 void policy_mgr_init_sbs_fw_config(struct wlan_objmgr_psoc *psoc,
3852 				   uint32_t fw_config);
3853 
3854 /**
3855  * policy_mgr_update_dbs_scan_config() - Function to update
3856  * DBS scan config in policy manager component
3857  * @psoc: PSOC object information
3858  *
3859  * This function updates the DBS scan configurations required by
3860  * policy manager
3861  *
3862  * Return: SUCCESS or FAILURE
3863  *
3864  */
3865 void policy_mgr_update_dbs_scan_config(struct wlan_objmgr_psoc *psoc);
3866 
3867 /**
3868  * policy_mgr_update_dbs_fw_config() - Function to update DBS FW
3869  * config in policy manager component
3870  * @psoc: PSOC object information
3871  *
3872  * This function updates the DBS FW configurations required by
3873  * policy manager
3874  *
3875  * Return: SUCCESS or FAILURE
3876  *
3877  */
3878 void policy_mgr_update_dbs_fw_config(struct wlan_objmgr_psoc *psoc);
3879 
3880 /**
3881  * policy_mgr_update_dbs_req_config() - Function to update DBS
3882  * request config in policy manager component
3883  * @psoc: PSOC object information
3884  * @scan_config: DBS scan config
3885  * @fw_mode_config: DBS FW config
3886  *
3887  * This function updates DBS request configurations required by
3888  * policy manager
3889  *
3890  * Return: SUCCESS or FAILURE
3891  *
3892  */
3893 void policy_mgr_update_dbs_req_config(struct wlan_objmgr_psoc *psoc,
3894 		uint32_t scan_config, uint32_t fw_mode_config);
3895 
3896 /**
3897  * policy_mgr_dump_dbs_hw_mode() - Function to dump DBS config
3898  * @psoc: PSOC object information
3899  *
3900  * This function dumps the DBS configurations
3901  *
3902  * Return: SUCCESS or FAILURE
3903  *
3904  */
3905 void policy_mgr_dump_dbs_hw_mode(struct wlan_objmgr_psoc *psoc);
3906 
3907 /**
3908  * policy_mgr_init_dbs_hw_mode() - Function to initialize DBS HW
3909  * modes in policy manager component
3910  * @psoc: PSOC object information
3911  * @num_dbs_hw_modes: Number of HW modes
3912  * @ev_wlan_dbs_hw_mode_list: HW list
3913  *
3914  * This function to initialize the DBS HW modes in policy
3915  * manager
3916  *
3917  * Return: SUCCESS or FAILURE
3918  *
3919  */
3920 void policy_mgr_init_dbs_hw_mode(struct wlan_objmgr_psoc *psoc,
3921 				uint32_t num_dbs_hw_modes,
3922 				uint32_t *ev_wlan_dbs_hw_mode_list);
3923 
3924 QDF_STATUS policy_mgr_update_sbs_freq(struct wlan_objmgr_psoc *psoc,
3925 				      struct target_psoc_info *tgt_hdl);
3926 
3927 /**
3928  * policy_mgr_get_sbs_cut_off_freq() - Function to get SBS 5g cut off freq
3929  *
3930  * @psoc: PSOC object information
3931  *
3932  * This function to get sbs cut off freq
3933  *
3934  * Return: cut of freq
3935  *
3936  */
3937 qdf_freq_t policy_mgr_get_sbs_cut_off_freq(struct wlan_objmgr_psoc *psoc);
3938 
3939 /**
3940  * policy_mgr_update_hw_mode_list() - Function to initialize DBS
3941  * HW modes in policy manager component
3942  * @psoc: PSOC object information
3943  * @tgt_hdl: Target psoc information
3944  *
3945  * This function to initialize the DBS HW modes in policy
3946  * manager
3947  *
3948  * Return: SUCCESS or FAILURE
3949  *
3950  */
3951 QDF_STATUS policy_mgr_update_hw_mode_list(struct wlan_objmgr_psoc *psoc,
3952 					  struct target_psoc_info *tgt_hdl);
3953 
3954 /**
3955  * policy_mgr_update_hw_mode_index() - Function to update
3956  * current HW mode in policy manager component
3957  * @psoc: PSOC object information
3958  * @new_hw_mode_index: index to new HW mode
3959  *
3960  * This function to update the current HW mode in policy manager
3961  *
3962  * Return: SUCCESS or FAILURE
3963  *
3964  */
3965 void policy_mgr_update_hw_mode_index(struct wlan_objmgr_psoc *psoc,
3966 		uint32_t new_hw_mode_index);
3967 
3968 /**
3969  * policy_mgr_update_old_hw_mode_index() - Function to update
3970  * old HW mode in policy manager component
3971  * @psoc: PSOC object information
3972  * @old_hw_mode_index: index to old HW mode
3973  *
3974  * This function to update the old HW mode in policy manager
3975  *
3976  * Return: SUCCESS or FAILURE
3977  *
3978  */
3979 void policy_mgr_update_old_hw_mode_index(struct wlan_objmgr_psoc *psoc,
3980 		uint32_t old_hw_mode_index);
3981 
3982 /**
3983  * policy_mgr_update_new_hw_mode_index() - Function to update
3984  * new HW mode in policy manager component
3985  * @psoc: PSOC object information
3986  * @new_hw_mode_index: index to new HW mode
3987  *
3988  * This function to update the new HW mode in policy manager
3989  *
3990  * Return: SUCCESS or FAILURE
3991  *
3992  */
3993 void policy_mgr_update_new_hw_mode_index(struct wlan_objmgr_psoc *psoc,
3994 		uint32_t new_hw_mode_index);
3995 
3996 /**
3997  * policy_mgr_is_chan_ok_for_dnbs() - Function to check if a channel
3998  * is OK for "Do Not Break Stream"
3999  * @psoc: PSOC object information
4000  * @ch_freq: Channel frequency to check.
4001  * @ok: Pointer to flag in which status will be stored
4002  * This function checks if a channel is OK for
4003  * "Do Not Break Stream"
4004  * Return: SUCCESS or FAILURE
4005  */
4006 QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc,
4007 					  uint32_t ch_freq, bool *ok);
4008 
4009 /**
4010  * policy_mgr_get_hw_dbs_nss() - Computes DBS NSS
4011  * @psoc: PSOC object information
4012  * @nss_dbs: NSS info of both MAC0 and MAC1
4013  * This function computes NSS info of both MAC0 and MAC1
4014  *
4015  * Return: uint32_t value signifies supported RF chains
4016  */
4017 uint32_t policy_mgr_get_hw_dbs_nss(struct wlan_objmgr_psoc *psoc,
4018 				   struct dbs_nss *nss_dbs);
4019 
4020 /**
4021  * policy_mgr_is_dnsc_set - Check if user has set
4022  * "Do_Not_Switch_Channel" for the vdev passed
4023  * @vdev: vdev pointer
4024  *
4025  * Get "Do_Not_Switch_Channel" setting for the vdev passed.
4026  *
4027  * Return: true for success, else false
4028  */
4029 bool policy_mgr_is_dnsc_set(struct wlan_objmgr_vdev *vdev);
4030 
4031 /**
4032  * policy_mgr_get_updated_scan_and_fw_mode_config() - Function
4033  * to get latest scan & fw config for DBS
4034  * @psoc: PSOC object information
4035  * @scan_config: DBS related scan config
4036  * @fw_mode_config: DBS related FW config
4037  * @dual_mac_disable_ini: DBS related ini config
4038  * @channel_select_logic_conc:
4039  *
4040  * This function returns the latest DBS configuration for
4041  * connection & scan, sent to FW
4042  *
4043  * Return: SUCCESS or FAILURE
4044  */
4045 QDF_STATUS policy_mgr_get_updated_scan_and_fw_mode_config(
4046 		struct wlan_objmgr_psoc *psoc, uint32_t *scan_config,
4047 		uint32_t *fw_mode_config, uint32_t dual_mac_disable_ini,
4048 		uint32_t channel_select_logic_conc);
4049 
4050 /**
4051  * policy_mgr_is_safe_channel - Check if the channel is in LTE
4052  * coex channel avoidance list
4053  * @psoc: PSOC object information
4054  * @ch_freq: channel frequency to be checked
4055  *
4056  * Check if the channel is in LTE coex channel avoidance list.
4057  *
4058  * Return: true for success, else false
4059  */
4060 bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc,
4061 				uint32_t ch_freq);
4062 
4063 #ifdef FEATURE_WLAN_CH_AVOID_EXT
4064 /**
4065  * policy_mgr_restrict_sap_on_unsafe_chan() - Check if need check unsafe
4066  * channel if SAP start on fixed channel.
4067  * @psoc: PSOC object information
4068  *
4069  * Return: true for success, else false
4070  */
4071 bool policy_mgr_restrict_sap_on_unsafe_chan(struct wlan_objmgr_psoc *psoc);
4072 #else
4073 static inline bool
policy_mgr_restrict_sap_on_unsafe_chan(struct wlan_objmgr_psoc * psoc)4074 policy_mgr_restrict_sap_on_unsafe_chan(struct wlan_objmgr_psoc *psoc)
4075 {
4076 	return false;
4077 }
4078 #endif
4079 
4080 /**
4081  * policy_mgr_is_sap_freq_allowed - Check if the channel is allowed for sap
4082  * @psoc: PSOC object information
4083  * @opmode: Current op_mode, helps to check whether it's P2P_GO/SAP
4084  * @sap_freq: channel frequency to be checked
4085  *
4086  * Check the factors as below to decide whether the channel is allowed or not:
4087  * If the channel is in LTE coex channel avoidance list;
4088  * If it's STA+SAP SCC;
4089  * If STA+SAP SCC on LTE coex channel is allowed.
4090  *
4091  * Return: true for allowed, else false
4092  */
4093 bool policy_mgr_is_sap_freq_allowed(struct wlan_objmgr_psoc *psoc,
4094 				    enum QDF_OPMODE opmode,
4095 				    uint32_t sap_freq);
4096 
4097 /**
4098  * policy_mgr_get_ch_width() - Convert hw_mode_bandwidth to phy_ch_width
4099  * @bw: Hardware mode band width used by WMI
4100  *
4101  * Return: phy_ch_width
4102  */
4103 enum phy_ch_width policy_mgr_get_ch_width(enum hw_mode_bandwidth bw);
4104 
4105 /**
4106  * policy_mgr_is_force_scc() - checks if SCC needs to be
4107  * mandated
4108  * @psoc: PSOC object information
4109  *
4110  * This function checks if SCC needs to be mandated or not
4111  *
4112  * Return: True if SCC to be mandated, false otherwise
4113  */
4114 bool policy_mgr_is_force_scc(struct wlan_objmgr_psoc *psoc);
4115 
4116 /**
4117  * policy_mgr_go_scc_enforced() - Get GO force SCC enabled or not
4118  * @psoc: psoc object
4119  *
4120  * This function checks if force SCC logic should be used on GO interface.
4121  *
4122  * Return: True if allow GO force SCC
4123  */
4124 bool policy_mgr_go_scc_enforced(struct wlan_objmgr_psoc *psoc);
4125 
4126 /**
4127  * policy_mgr_valid_sap_conc_channel_check() - Check and update
4128  * the SAP channel in case of STA+SAP concurrency
4129  * @psoc: PSOC object information
4130  * @con_ch_freq: pointer to the chan freq on which sap will come up
4131  * @sap_ch_freq: initial channel frequency for SAP
4132  * @sap_vdev_id: sap vdev id.
4133  * @ch_params: sap channel parameters
4134  *
4135  * This function checks & updates the channel SAP to come up on in
4136  * case of STA+SAP concurrency
4137  *
4138  * Return: Success if SAP can come up on a channel
4139  */
4140 QDF_STATUS policy_mgr_valid_sap_conc_channel_check(
4141 	struct wlan_objmgr_psoc *psoc, uint32_t *con_ch_freq,
4142 	uint32_t sap_ch_freq, uint8_t sap_vdev_id,
4143 	struct ch_params *ch_params);
4144 
4145 /**
4146  * policy_mgr_get_alternate_channel_for_sap() - Get an alternate
4147  * channel to move the SAP to
4148  * @psoc: PSOC object information
4149  * @sap_vdev_id: sap vdev id.
4150  * @sap_ch_freq: sap channel frequency.
4151  * @pref_band: Preferred band on channel is required
4152  *
4153  * This function returns an alternate channel for SAP to move to
4154  *
4155  * Return: The new channel for SAP
4156  */
4157 uint32_t policy_mgr_get_alternate_channel_for_sap(
4158 	struct wlan_objmgr_psoc *psoc, uint8_t sap_vdev_id,
4159 	uint32_t sap_ch_freq,
4160 	enum reg_wifi_band pref_band);
4161 
4162 /**
4163  * policy_mgr_con_mode_by_vdev_id() - Get policy mgr con mode from vdev id
4164  * @psoc: psoc object
4165  * @vdev_id: vdev id
4166  *
4167  * return: enum policy_mgr_con_mode for the vdev id
4168  */
4169 enum policy_mgr_con_mode
4170 policy_mgr_con_mode_by_vdev_id(struct wlan_objmgr_psoc *psoc,
4171 			       uint8_t vdev_id);
4172 
4173 /**
4174  * policy_mgr_disallow_mcc() - Check for mcc
4175  *
4176  * @psoc: PSOC object information
4177  * @ch_freq: channel frequency on which new connection is coming up
4178  *
4179  * When a new connection is about to come up check if current
4180  * concurrency combination including the new connection is
4181  * causing MCC
4182  *
4183  * Return: True if it is causing MCC
4184  */
4185 bool policy_mgr_disallow_mcc(struct wlan_objmgr_psoc *psoc,
4186 			     uint32_t ch_freq);
4187 
4188 /**
4189  * policy_mgr_mode_specific_get_channel() - Get channel for a
4190  * connection type
4191  * @psoc: PSOC object information
4192  * @mode: Connection type
4193  *
4194  * Get channel frequency for a connection type
4195  *
4196  * Return: channel frequency
4197  */
4198 uint32_t policy_mgr_mode_specific_get_channel(struct wlan_objmgr_psoc *psoc,
4199 					      enum policy_mgr_con_mode mode);
4200 
4201 /**
4202  * policy_mgr_add_sap_mandatory_chan() - Add chan to SAP mandatory channel
4203  * list
4204  * @psoc: Pointer to soc
4205  * @ch_freq: Channel frequency to be added
4206  *
4207  * Add chan to SAP mandatory channel list
4208  *
4209  * Return: None
4210  */
4211 void policy_mgr_add_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc,
4212 				       uint32_t ch_freq);
4213 
4214 /**
4215  * policy_mgr_get_sap_mandatory_chan_list_len() - Return the SAP mandatory
4216  * channel list len
4217  * @psoc: Pointer to soc
4218  *
4219  * Get the SAP mandatory channel list len
4220  *
4221  * Return: Channel list length
4222  */
4223 uint32_t policy_mgr_get_sap_mandatory_chan_list_len(
4224 		struct wlan_objmgr_psoc *psoc);
4225 
4226 /**
4227  * policy_mgr_init_sap_mandatory_chan() - Init 2.4G 5G 6G SAP mandatory channel
4228  * list
4229  * @psoc: Pointer to soc
4230  * @org_ch_freq: sap initial channel frequency MHz
4231  *
4232  * Initialize the 2.4G 5G 6G SAP mandatory channels
4233  *
4234  * Return: None
4235  */
4236 void  policy_mgr_init_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc,
4237 					 uint32_t org_ch_freq);
4238 
4239 /**
4240  * policy_mgr_remove_sap_mandatory_chan() - Remove channel from SAP mandatory
4241  * channel list
4242  * @psoc: Pointer to soc
4243  * @ch_freq: channel frequency to be removed from mandatory list
4244  *
4245  * Remove channel from SAP mandatory channel list
4246  *
4247  * Return: None
4248  */
4249 void policy_mgr_remove_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc,
4250 					  uint32_t ch_freq);
4251 
4252 /*
4253  * policy_set_cur_conc_system_pref - set current conc_system_pref
4254  * @psoc: soc pointer
4255  *
4256  * Set the current concurrency system preference.
4257  *
4258  * Return: None
4259  */
4260 void policy_mgr_set_cur_conc_system_pref(struct wlan_objmgr_psoc *psoc,
4261 		uint8_t conc_system_pref);
4262 /**
4263  * policy_mgr_get_cur_conc_system_pref - Get current conc_system_pref
4264  * @psoc: soc pointer
4265  *
4266  * Get the current concurrent system preference.
4267  *
4268  * Return: conc_system_pref
4269  */
4270 uint8_t policy_mgr_get_cur_conc_system_pref(struct wlan_objmgr_psoc *psoc);
4271 /**
4272  * policy_mgr_check_and_stop_opportunistic_timer - Get current
4273  * state of opportunistic timer, if running, stop it and take
4274  * action
4275  * @psoc: soc pointer
4276  * @id: Session/vdev id
4277  *
4278  * Get the current state of opportunistic timer, if it is
4279  * running, stop it and take action.
4280  *
4281  * Return: None
4282  */
4283 void policy_mgr_check_and_stop_opportunistic_timer(
4284 	struct wlan_objmgr_psoc *psoc, uint8_t id);
4285 
4286 /**
4287  * policy_mgr_set_weight_of_disabled_inactive_channels_to_zero() - set weight
4288  * of disabled and inactive channels to 0
4289  * @psoc: pointer to soc
4290  * @pcl: preferred channel freq list
4291  * @len: length of preferred channel list
4292  * @weight_list: preferred channel weight list
4293  * @weight_len: length of weight list
4294  * This function set the weight of disabled and inactive channels to 0
4295  *
4296  * Return: None
4297  */
4298 void policy_mgr_set_weight_of_disabled_inactive_channels_to_zero(
4299 		struct wlan_objmgr_psoc *psoc, uint32_t *pcl,
4300 		uint32_t *len, uint8_t *weight_list, uint32_t weight_len);
4301 /**
4302  * policy_mgr_is_sap_allowed_on_dfs_freq() - check if sap allowed on dfs freq
4303  * @pdev: id of objmgr pdev
4304  * @vdev_id: vdev id
4305  * @ch_freq: channel freq
4306  * This function is used to check if sta_sap_scc_on_dfs_chan ini is set,
4307  * DFS master capability is assumed disabled in the driver.
4308  *
4309  * Return: true if sap is allowed on dfs freq,
4310  * otherwise false
4311  */
4312 bool policy_mgr_is_sap_allowed_on_dfs_freq(struct wlan_objmgr_pdev *pdev,
4313 					   uint8_t vdev_id, qdf_freq_t ch_freq);
4314 /**
4315  * policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan() - check if sta+sap scc
4316  * allowed on dfs chan
4317  * @psoc: pointer to soc
4318  * This function is used to check if sta+sap scc allowed on dfs channel
4319  *
4320  * Return: true if sta+sap scc is allowed on dfs channel, otherwise false
4321  */
4322 bool policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(
4323 		struct wlan_objmgr_psoc *psoc);
4324 
4325 /**
4326  * policy_mgr_is_multi_sap_allowed_on_same_band() - check if multi sap allowed
4327  * on same band
4328  * @pdev: id of objmgr pdev
4329  * @mode: operating mode of interface to be checked
4330  * @ch_freq: channel freq
4331  * This function is used to check if multi sap can be started on the same band
4332  *
4333  * Return: true if multi sap is allowed on same band, otherwise false
4334  */
4335 bool policy_mgr_is_multi_sap_allowed_on_same_band(
4336 					struct wlan_objmgr_pdev *pdev,
4337 					enum policy_mgr_con_mode mode,
4338 					qdf_freq_t ch_freq);
4339 
4340 /**
4341  * policy_mgr_is_special_mode_active_5g() - check if given mode active in 5g
4342  * @psoc: pointer to soc
4343  * @mode: operating mode of interface to be checked
4344  *
4345  * Return: true if given mode is active in 5g
4346  */
4347 bool policy_mgr_is_special_mode_active_5g(struct wlan_objmgr_psoc *psoc,
4348 					  enum policy_mgr_con_mode mode);
4349 
4350 /**
4351  * policy_mgr_is_sta_connected_2g() - check if sta connected in 2g
4352  * @psoc: pointer to soc
4353  *
4354  * Return: true if sta is connected in 2g else false
4355  */
4356 bool policy_mgr_is_sta_connected_2g(struct wlan_objmgr_psoc *psoc);
4357 
4358 /**
4359  * policy_mgr_is_connected_sta_5g() - check if sta connected in 5 GHz
4360  * @psoc: pointer to soc
4361  * @freq: Pointer to the frequency on which sta is connected
4362  *
4363  * Return: true if sta is connected in 5 GHz else false
4364  */
4365 bool policy_mgr_is_connected_sta_5g(struct wlan_objmgr_psoc *psoc,
4366 				    qdf_freq_t *freq);
4367 
4368 /**
4369  * policy_mgr_scan_trim_5g_chnls_for_dfs_ap() - check if sta scan should skip
4370  * 5g channel when dfs ap is present.
4371  *
4372  * @psoc: pointer to soc
4373  * @freq: DFS freq of concurrent SAP/GO
4374  *
4375  * Return: true if sta scan 5g chan should be skipped
4376  */
4377 bool policy_mgr_scan_trim_5g_chnls_for_dfs_ap(struct wlan_objmgr_psoc *psoc,
4378 					      qdf_freq_t *freq);
4379 
4380 /**
4381  * policy_mgr_scan_trim_chnls_for_connected_ap() - check if sta scan
4382  * should skip 5g or 2.4g channel when AP/GO connected by clients.
4383  * STA + AP 5G (connected) + AP 2.4G		skip 5G scan
4384  * STA + AP 5G (connected)			skip 5G scan
4385  * STA + AP 2.4G (connected && 2.4G only)	skip 2.4G scan
4386  *
4387  * @pdev: pointer to pdev
4388  *
4389  * Return: trim_channel_list
4390  */
4391 uint16_t
4392 policy_mgr_scan_trim_chnls_for_connected_ap(struct wlan_objmgr_pdev *pdev);
4393 
4394 /**
4395  * policy_mgr_is_hwmode_set_for_given_chnl() - to check for given channel
4396  * if the hw mode is properly set.
4397  * @psoc: pointer to psoc
4398  * @ch_freq: given channel frequency
4399  *
4400  * If HW mode is properly set for given channel then it returns true else
4401  * it returns false.
4402  * For example, when 2x2 DBS is supported and if the first connection is
4403  * coming up on 2G band then driver expects DBS HW mode to be set first
4404  * before the connection can be established. Driver can call this API to
4405  * find-out if HW mode is set properly.
4406  *
4407  * Return: true if HW mode is set properly else false
4408  */
4409 bool policy_mgr_is_hwmode_set_for_given_chnl(struct wlan_objmgr_psoc *psoc,
4410 					     uint32_t ch_freq);
4411 
4412 /**
4413  * policy_mgr_get_connection_info() - Get info of all active connections
4414  * @psoc: pointer to soc
4415  * @info: Pointer to connection info
4416  *
4417  * Return: Connection count
4418  */
4419 uint32_t policy_mgr_get_connection_info(struct wlan_objmgr_psoc *psoc,
4420 					struct connection_info *info);
4421 /**
4422  * policy_mgr_register_mode_change_cb() - Register mode change callback with
4423  * policy manager
4424  * @psoc: pointer to soc
4425  * @mode_change_cb: HDD callback to be registered
4426  *
4427  * Return: QDF_STATUS
4428  */
4429 QDF_STATUS policy_mgr_register_mode_change_cb(struct wlan_objmgr_psoc *psoc,
4430 			send_mode_change_event_cb mode_change_cb);
4431 /**
4432  * policy_mgr_deregister_mode_change_cb() - Deregister mode change callback with
4433  * policy manager
4434  * @psoc: pointer to soc
4435  *
4436  * Return: QDF_STATUS
4437  */
4438 QDF_STATUS policy_mgr_deregister_mode_change_cb(struct wlan_objmgr_psoc *psoc);
4439 
4440 /**
4441  * policy_mgr_allow_sap_go_concurrency() - check whether SAP/GO concurrency is
4442  * allowed.
4443  * @psoc: pointer to soc
4444  * @mode: operating mode of interface to be checked
4445  * @ch_freq: new operating channel of the interface to be checked
4446  * @vdev_id: vdev id of the connection to be checked, 0xff for new connection
4447  *
4448  * Checks whether new channel SAP/GO can co-exist with the channel of existing
4449  * SAP/GO connection. This API mainly used for two purposes:
4450  *
4451  * 1) When new GO/SAP session is coming up and needs to check if this session's
4452  * channel can co-exist with existing existing GO/SAP sessions. For example,
4453  * when single radio platform comes, MCC for SAP/GO+SAP/GO is not supported, in
4454  * such case this API should prevent bringing the second connection.
4455  *
4456  * 2) There is already existing SAP+GO combination but due to upper layer
4457  * notifying LTE-COEX event or sending command to move one of the connections
4458  * to different channel. In such cases before moving existing connection to new
4459  * channel, check if new channel can co-exist with the other existing
4460  * connection. For example, one SAP1 is on channel-6 and second SAP2 is on
4461  * channel-36 and lets say they are doing DBS, and lets say upper layer sends
4462  * LTE-COEX to move SAP1 from channel-6 to channel-149. In this case, SAP1 and
4463  * SAP2 will end up doing MCC which may not be desirable result. such cases
4464  * will be prevented with this API.
4465  *
4466  * Return: true or false
4467  */
4468 bool policy_mgr_allow_sap_go_concurrency(struct wlan_objmgr_psoc *psoc,
4469 					 enum policy_mgr_con_mode mode,
4470 					 uint32_t ch_freq,
4471 					 uint32_t vdev_id);
4472 
4473 /**
4474  * policy_mgr_dual_beacon_on_single_mac_scc_capable() - get capability that
4475  * whether support dual beacon on same channel on single MAC
4476  * @psoc: pointer to soc
4477  *
4478  *  Return: bool: capable
4479  */
4480 bool policy_mgr_dual_beacon_on_single_mac_scc_capable(
4481 	struct wlan_objmgr_psoc *psoc);
4482 
4483 /**
4484  * policy_mgr_dual_beacon_on_single_mac_mcc_capable() - get capability that
4485  * whether support dual beacon on different channel on single MAC
4486  * @psoc: pointer to soc
4487  *
4488  *  Return: bool: capable
4489  */
4490 bool policy_mgr_dual_beacon_on_single_mac_mcc_capable(
4491 	struct wlan_objmgr_psoc *psoc);
4492 
4493 /**
4494  * policy_mgr_sta_sap_scc_on_lte_coex_chan() - get capability that
4495  * whether support sta sap scc on lte coex chan
4496  * @psoc: pointer to soc
4497  *
4498  *  Return: bool: capable
4499  */
4500 bool policy_mgr_sta_sap_scc_on_lte_coex_chan(
4501 	struct wlan_objmgr_psoc *psoc);
4502 
4503 /**
4504  * policy_mgr_get_user_config_sap_freq() - Get the user configured channel
4505  *
4506  * @psoc: pointer to psoc
4507  * @vdev_id: vdev id
4508  *
4509  * Return: user configured frequency
4510  */
4511 qdf_freq_t policy_mgr_get_user_config_sap_freq(struct wlan_objmgr_psoc *psoc,
4512 					       uint8_t vdev_id);
4513 
4514 /**
4515  * policy_mgr_nan_sap_post_enable_conc_check() - Do concurrency operations
4516  *                                               post nan/sap enable
4517  * @psoc: pointer to psoc
4518  *
4519  * Return: QDF_STATUS
4520  **/
4521 QDF_STATUS
4522 policy_mgr_nan_sap_post_enable_conc_check(struct wlan_objmgr_psoc *psoc);
4523 
4524 /**
4525  * policy_mgr_nan_sap_post_disable_conc_check() - Do concurrency related
4526  *                                                operation post nan/sap disable
4527  * @psoc: pointer to psoc
4528  *
4529  * Return: void
4530  **/
4531 void policy_mgr_nan_sap_post_disable_conc_check(struct wlan_objmgr_psoc *psoc);
4532 
4533 /**
4534  * policy_mgr_is_sap_restart_required_after_sta_disconnect() - is sap restart
4535  * required
4536  * after sta disconnection
4537  * @psoc: psoc object data
4538  * @sap_vdev_id: sap vdev id
4539  * @intf_ch_freq: sap channel frequency
4540  * @is_acs_mode: Indicates whether SAP is started in ACS mode or fixed channel
4541  *
4542  * Check if SAP should be moved to a non dfs channel after STA disconnection.
4543  * This API applicable only for STA+SAP SCC and ini 'sta_sap_scc_on_dfs_chan'
4544  * or 'sta_sap_scc_on_lte_coex_chan' is enabled.
4545  *
4546  * Return: true if sap restart is required, otherwise false
4547  */
4548 bool policy_mgr_is_sap_restart_required_after_sta_disconnect(
4549 			struct wlan_objmgr_psoc *psoc, uint32_t sap_vdev_id,
4550 			uint32_t *intf_ch_freq, bool is_acs_mode);
4551 
4552 /**
4553  * policy_mgr_is_sta_sap_scc() - check whether SAP is doing SCC with
4554  * STA
4555  * @psoc: pointer to psoc
4556  * @sap_ch_freq: operating channel frequency of SAP interface
4557  * This function checks whether SAP is doing SCC with STA
4558  *
4559  * Return: true or false
4560  */
4561 bool policy_mgr_is_sta_sap_scc(struct wlan_objmgr_psoc *psoc,
4562 			       uint32_t sap_ch_freq);
4563 
4564 /**
4565  * policy_mgr_nan_sap_scc_on_unsafe_ch_chk() - check whether SAP is doing SCC
4566  *                                             with NAN
4567  * @psoc: pointer to psoc
4568  * @sap_freq: operating channel frequency of SAP interface
4569  *
4570  * Return: true or false
4571  */
4572 bool policy_mgr_nan_sap_scc_on_unsafe_ch_chk(struct wlan_objmgr_psoc *psoc,
4573 					     uint32_t sap_freq);
4574 
4575 /**
4576  * policy_mgr_get_hw_mode_from_idx() - Get HW mode based on index
4577  * @psoc: psoc object
4578  * @idx: HW mode id
4579  * @hw_mode: HW mode params
4580  *
4581  * Fetches the HW mode parameters
4582  *
4583  * Return: Success if hw mode is obtained and the hw mode params
4584  */
4585 QDF_STATUS policy_mgr_get_hw_mode_from_idx(
4586 		struct wlan_objmgr_psoc *psoc,
4587 		uint32_t idx,
4588 		struct policy_mgr_hw_mode_params *hw_mode);
4589 
4590 #if defined(CONFIG_BAND_6GHZ) && defined(WLAN_FEATURE_11AX)
4591 /**
4592  * policy_mgr_is_6ghz_conc_mode_supported() - Check connection mode supported
4593  * on 6ghz or not
4594  * @psoc: Pointer to soc
4595  * @mode: new connection mode
4596  *
4597  * Current PORed 6ghz connection modes are STA, SAP, P2P.
4598  *
4599  * Return: true if supports else false.
4600  */
4601 bool policy_mgr_is_6ghz_conc_mode_supported(
4602 	struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode);
4603 
4604 /**
4605  * policy_mgr_init_ap_6ghz_capable - Init 6Ghz capable flags
4606  * @psoc: PSOC object information
4607  * @vdev_id: vdev id
4608  * @ap_6ghz_capable: vdev 6ghz capable flag
4609  *
4610  * Init 6Ghz capable flags for active connection in policy mgr conn table
4611  *
4612  * Return: void
4613  */
4614 void policy_mgr_init_ap_6ghz_capable(struct wlan_objmgr_psoc *psoc,
4615 				     uint8_t vdev_id,
4616 				     enum conn_6ghz_flag ap_6ghz_capable);
4617 
4618 /**
4619  * policy_mgr_set_ap_6ghz_capable - Set 6Ghz capable flags to connection list
4620  * @psoc: PSOC object information
4621  * @vdev_id: vdev id
4622  * @set: set or clear
4623  * @ap_6ghz_capable: vdev 6ghz capable flag
4624  *
4625  * Set/Clear 6Ghz capable flags for active connection in policy mgr conn table
4626  *
4627  * Return: void
4628  */
4629 void policy_mgr_set_ap_6ghz_capable(struct wlan_objmgr_psoc *psoc,
4630 				    uint8_t vdev_id,
4631 				    bool set,
4632 				    enum conn_6ghz_flag ap_6ghz_capable);
4633 
4634 /**
4635  * policy_mgr_get_ap_6ghz_capable - Get 6Ghz capable info for a vdev
4636  * @psoc: PSOC object information
4637  * @vdev_id: vdev id
4638  * @conn_flag: output conntion flags
4639  *
4640  * Get 6Ghz capable flag for ap vdev (SAP). When SAP on 5G, for same reason
4641  * the AP needs to be moved to 6G and this API will be called to check whether
4642  * AP is 6Ghz capable or not.
4643  * AP is allowed on 6G band only when all of below statements are true:
4644  * a. SAP config includes WPA3 security - SAE,OWE,SuiteB.
4645  * b. SAP is configured by ACS range which includes any 6G channel or
4646  *    configured by 6G Fixed channel.
4647  * c. SAP has no legacy clients (client doesn't support 6G band).
4648  *    legacy client (non 6ghz capable): association request frame has no
4649  *    6G band global operating Class.
4650  *
4651  * Return: true if AP is 6ghz capable
4652  */
4653 bool policy_mgr_get_ap_6ghz_capable(
4654 	struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, uint32_t *conn_flag);
4655 #else
policy_mgr_is_6ghz_conc_mode_supported(struct wlan_objmgr_psoc * psoc,enum policy_mgr_con_mode mode)4656 static inline bool policy_mgr_is_6ghz_conc_mode_supported(
4657 	struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode)
4658 {
4659 	return false;
4660 }
4661 
policy_mgr_init_ap_6ghz_capable(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,enum conn_6ghz_flag ap_6ghz_capable)4662 static inline void policy_mgr_init_ap_6ghz_capable(
4663 	struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
4664 	enum conn_6ghz_flag ap_6ghz_capable)
4665 {}
4666 
4667 static inline
policy_mgr_set_ap_6ghz_capable(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,bool set,enum conn_6ghz_flag ap_6ghz_capable)4668 void policy_mgr_set_ap_6ghz_capable(struct wlan_objmgr_psoc *psoc,
4669 				    uint8_t vdev_id,
4670 				    bool set,
4671 				    enum conn_6ghz_flag ap_6ghz_capable)
4672 {}
4673 
policy_mgr_get_ap_6ghz_capable(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint32_t * conn_flag)4674 static inline bool policy_mgr_get_ap_6ghz_capable(
4675 	struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, uint32_t *conn_flag)
4676 {
4677 	return false;
4678 }
4679 
4680 #endif
4681 
4682 /**
4683  * policy_mgr_update_nan_vdev_mac_info() - Update the NAN vdev id and MAC id in
4684  * policy manager
4685  * @psoc: psoc object
4686  * @nan_vdev_id: NAN Discovery pseudo vdev id
4687  * @mac_id: NAN Discovery MAC ID
4688  *
4689  * Stores NAN Discovery related vdev and MAC id in policy manager
4690  *
4691  * Return: QDF Success
4692  */
4693 QDF_STATUS policy_mgr_update_nan_vdev_mac_info(struct wlan_objmgr_psoc *psoc,
4694 					       uint8_t nan_vdev_id,
4695 					       uint8_t mac_id);
4696 
4697 /**
4698  * policy_mgr_get_mode_specific_conn_info() - Get active mode specific
4699  * channel and vdev id
4700  * @psoc: PSOC object information
4701  * @ch_freq_list: Mode specific channel freq list
4702  * @vdev_id: Mode specific vdev id (list)
4703  * @mode: Connection Mode
4704  *
4705  * Get active mode specific channel and vdev id
4706  *
4707  * Return: number of connection found as per given mode
4708  */
4709 uint32_t policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc,
4710 						uint32_t *ch_freq_list,
4711 						uint8_t *vdev_id,
4712 						enum policy_mgr_con_mode mode);
4713 
4714 /*
4715  * policy_mgr_get_ml_and_non_ml_sta_count() - get ML and non ML STA count
4716  * also fills the freq and non ML/ML list
4717  * @psoc: Objmgr psoc
4718  * @num_ml: num ML as output
4719  * @ml_idx: ML vdev index as output
4720  * @num_non_ml: num non ML as output
4721  * @non_ml_idx: non ML vdev index as output
4722  * @freq_list: freq list of each sta vdev
4723  * @vdev_id_list: vdev id list
4724  *
4725  * Return: void
4726  */
4727 void policy_mgr_get_ml_and_non_ml_sta_count(struct wlan_objmgr_psoc *psoc,
4728 					    uint8_t *num_ml, uint8_t *ml_idx,
4729 					    uint8_t *num_non_ml,
4730 					    uint8_t *non_ml_idx,
4731 					    qdf_freq_t *freq_list,
4732 					    uint8_t *vdev_id_list);
4733 
4734 /**
4735  * policy_mgr_is_sap_go_on_2g() - check if sap/go is on 2g
4736  * @psoc: PSOC object information
4737  *
4738  * Return: true or false
4739  */
4740 bool policy_mgr_is_sap_go_on_2g(struct wlan_objmgr_psoc *psoc);
4741 
4742 /**
4743  * policy_mgr_dump_channel_list() - Print channel list
4744  * @len: Length of pcl list
4745  * @pcl_channels: pcl channels list
4746  * @pcl_weight: pcl weight list
4747  *
4748  *
4749  * Return: True or false
4750  */
4751 bool policy_mgr_dump_channel_list(uint32_t len,
4752 				  uint32_t *pcl_channels,
4753 				  uint8_t *pcl_weight);
4754 
4755 /**
4756  * policy_mgr_filter_passive_ch() -filter out passive channels from the list
4757  * @pdev: Pointer to pdev
4758  * @ch_freq_list: pointer to channel frequency list
4759  * @ch_cnt: number of channels in list
4760  *
4761  * Return: QDF_STATUS
4762  */
4763 QDF_STATUS policy_mgr_filter_passive_ch(struct wlan_objmgr_pdev *pdev,
4764 					uint32_t *ch_freq_list,
4765 					uint32_t *ch_cnt);
4766 
4767 /**
4768  * policy_mgr_is_restart_sap_required() - check whether sap need restart
4769  * @psoc: psoc pointer
4770  * @vdev_id: vdev id
4771  * @freq: sap current freq
4772  * @scc_mode: mcc to scc switch mode
4773  *
4774  * If there is no STA/P2P CLI on same MAC of SAP/P2P GO,
4775  * SAP/P2P Go needn't switch channel to force scc.
4776  *
4777  * Return: True or false
4778  */
4779 bool policy_mgr_is_restart_sap_required(struct wlan_objmgr_psoc *psoc,
4780 					uint8_t vdev_id,
4781 					qdf_freq_t freq,
4782 					tQDF_MCC_TO_SCC_SWITCH_MODE scc_mode);
4783 
4784 /**
4785  * policy_mgr_get_roam_enabled_sta_session_id() - get the session id of the sta
4786  * on which roaming is enabled.
4787  * @psoc: pointer to psoc object
4788  * @vdev_id: vdev id of the requestor
4789  *
4790  * The function checks if any sta(other than the provided vdev_id) is present
4791  * and has roaming enabled and return the session id of the sta with roaming
4792  * enabled else if roaming is not enabled on any STA return
4793  * WLAN_UMAC_VDEV_ID_MAX.
4794  *
4795  * Return: session id of STA on which roaming is enabled
4796  */
4797 uint8_t policy_mgr_get_roam_enabled_sta_session_id(
4798 						struct wlan_objmgr_psoc *psoc,
4799 						uint8_t vdev_id);
4800 
4801 /**
4802  * policy_mgr_is_sta_mon_concurrency() - check if MONITOR and STA concurrency
4803  * is UP.
4804  * @psoc: pointer to psoc object
4805  *
4806  * Return: True - if STA and monitor concurrency is there, else False
4807  *
4808  */
4809 bool policy_mgr_is_sta_mon_concurrency(struct wlan_objmgr_psoc *psoc);
4810 
4811 /**
4812  * policy_mgr_check_mon_concurrency() - Checks if monitor intf can be added.
4813  * @psoc: pointer to psoc object
4814  *
4815  * Return: QDF_STATUS_SUCCESS if allowed, else send failure
4816  *
4817  */
4818 QDF_STATUS policy_mgr_check_mon_concurrency(struct wlan_objmgr_psoc *psoc);
4819 
4820 /**
4821  * policy_mgr_get_hw_dbs_max_bw() - Computes DBS BW
4822  * @psoc: PSOC object information
4823  * @bw_dbs: BW info of both MAC0 and MAC1
4824  * This function computes BW info of both MAC0 and MAC1
4825  *
4826  * Return: void
4827  */
4828 void policy_mgr_get_hw_dbs_max_bw(struct wlan_objmgr_psoc *psoc,
4829 				  struct dbs_bw *bw_dbs);
4830 
4831 /**
4832  * policy_mgr_get_radio_combinations() - Query the supported radio combinations
4833  * @psoc: soc object
4834  * @comb: combination buffer
4835  * @comb_max: max combination number can be saved to comb buffer
4836  * @comb_num: returned combination number
4837  *
4838  * This function returns the radio combination information supported by target.
4839  *
4840  * Return: QDF_STATUS_SUCCESS if query successfully
4841  */
4842 QDF_STATUS policy_mgr_get_radio_combinations(struct wlan_objmgr_psoc *psoc,
4843 					     struct radio_combination *comb,
4844 					     uint32_t comb_max,
4845 					     uint32_t *comb_num);
4846 
4847 /**
4848  * policy_mgr_is_mlo_sta_disconnected() - Check all STA in mlo are disconnected
4849  * @psoc: PSOC object information
4850  * @vdev_id: vdev id for sta
4851  *
4852  * if any link is associated the API will return false.
4853  *
4854  * Return: True if all sta links are disconnected
4855  */
4856 bool policy_mgr_is_mlo_sta_disconnected(struct wlan_objmgr_psoc *psoc,
4857 					uint8_t vdev_id);
4858 
4859 #ifdef WLAN_FEATURE_11BE_MLO
4860 /**
4861  * policy_mgr_is_ml_sta_links_in_mcc() - Check ML links are in MCC or not
4862  * @psoc: psoc ctx
4863  * @ml_freq_lst: ML STA freq list
4864  * @ml_vdev_lst: ML STA vdev id list
4865  * @ml_linkid_lst: ML STA link id list
4866  * @num_ml_sta: Number of total ML STA links
4867  * @affected_linkid_bitmap: link id bitmap which home channels are in MCC
4868  * with each other
4869  *
4870  * Return: true if ML link in MCC else false
4871  */
4872 bool
4873 policy_mgr_is_ml_sta_links_in_mcc(struct wlan_objmgr_psoc *psoc,
4874 				  qdf_freq_t *ml_freq_lst,
4875 				  uint8_t *ml_vdev_lst,
4876 				  uint8_t *ml_linkid_lst,
4877 				  uint8_t num_ml_sta,
4878 				  uint32_t *affected_linkid_bitmap);
4879 
4880 /**
4881  * policy_mgr_is_ml_links_in_mcc_allowed() - Check ML links are in MCC or not
4882  * @psoc: psoc ctx
4883  * @vdev: Pointer to vdev object
4884  * @ml_sta_vdev_lst: ML STA vdev id list
4885  * @num_ml_sta: Number of total ML STA links
4886  *
4887  * Return: QDF_STATUS_SUCCESS if ML link in MCC is allowed
4888  */
4889 QDF_STATUS
4890 policy_mgr_is_ml_links_in_mcc_allowed(struct wlan_objmgr_psoc *psoc,
4891 				      struct wlan_objmgr_vdev *vdev,
4892 				      uint8_t *ml_sta_vdev_lst,
4893 				      uint8_t *num_ml_sta);
4894 
4895 /**
4896  * policy_mgr_is_vdev_high_tput_or_low_latency() - Check vdev has
4897  * high througput or low latency flag
4898  * @psoc: PSOC object information
4899  * @vdev_id: vdev id
4900  *
4901  * Return: true if vdev has high throughput or low latency flag
4902  */
4903 bool
4904 policy_mgr_is_vdev_high_tput_or_low_latency(struct wlan_objmgr_psoc *psoc,
4905 					    uint8_t vdev_id);
4906 
4907 /**
4908  * policy_mgr_check_2ghz_only_sap_affected_link() - Check force inactive
4909  * link is needed for 2.4 GHz only sap
4910  * @psoc: PSOC object information
4911  * @sap_vdev_id: sap vdev id
4912  * @sap_ch_freq: sap channel frequency
4913  * @ml_ch_freq_num: ML STA link num
4914  * @ml_freq_lst: ML STA link frequency list
4915  *
4916  * Return: true if 2.4 GHz only sap present and need to force inactive
4917  * ML link
4918  */
4919 bool
4920 policy_mgr_check_2ghz_only_sap_affected_link(
4921 			struct wlan_objmgr_psoc *psoc,
4922 			uint8_t sap_vdev_id,
4923 			qdf_freq_t sap_ch_freq,
4924 			uint8_t ml_ch_freq_num,
4925 			qdf_freq_t *ml_freq_lst);
4926 
4927 /**
4928  * policy_mgr_vdev_is_force_inactive() - Check force inactive or not
4929  * for the vdev id
4930  * @psoc: PSOC object information
4931  * @vdev_id: vdev id
4932  *
4933  * Return: true if the vdev is in force inactive
4934  */
4935 bool policy_mgr_vdev_is_force_inactive(struct wlan_objmgr_psoc *psoc,
4936 				       uint8_t vdev_id);
4937 
4938 /**
4939  * policy_mgr_get_legacy_conn_info() - Get legacy connection info
4940  * @psoc: PSOC object information
4941  * @vdev_lst: vdev id list
4942  * @freq_lst: channel frequency list
4943  * @mode_lst: vdev mode list
4944  * @lst_sz: array size of above parameters
4945  *
4946  * This API will return the legacy STA/SAP/P2P connection info.
4947  * If a connection want to avoid MCC with ML STA, that connection
4948  * will be put in head of array list. And in 3 Port concurrency
4949  * case (ML STA + 2 legacy Connections), usually we can only meet
4950  * the high priority connection's MCC avoidance, so this API will
4951  * return sorted lists based on the priority. Right now we don't
4952  * clear requirement on which legacy interface has higher priority,
4953  * here we follow this order: STA, SAP, P2P.
4954  *
4955  * Return: number of legacy connection count
4956  */
4957 uint8_t
4958 policy_mgr_get_legacy_conn_info(struct wlan_objmgr_psoc *psoc,
4959 				uint8_t *vdev_lst,
4960 				qdf_freq_t *freq_lst,
4961 				enum policy_mgr_con_mode *mode_lst,
4962 				uint8_t lst_sz);
4963 
4964 /*
4965  * policy_mgr_get_ml_sta_info_psoc() - Get number of ML STA vdev ids and
4966  * freq list
4967  * @pm_ctx: pm_ctx ctx
4968  * @num_ml_sta: Return number of ML STA present
4969  * @num_disabled_ml_sta: Return number of disabled ML STA links
4970  * @ml_vdev_lst: Return ML STA vdev id list
4971  * @ml_freq_lst: Return ML STA freq list
4972  * @num_non_ml: Return number of non-ML STA present
4973  * @non_ml_vdev_lst: Return non-ML STA vdev id list
4974  * @non_ml_freq_lst: Return non-ML STA freq list
4975  *
4976  * Return: void
4977  */
4978 void
4979 policy_mgr_get_ml_sta_info_psoc(struct wlan_objmgr_psoc *psoc,
4980 				uint8_t *num_ml_sta,
4981 				uint8_t *num_disabled_ml_sta,
4982 				uint8_t *ml_vdev_lst,
4983 				qdf_freq_t *ml_freq_lst,
4984 				uint8_t *num_non_ml,
4985 				uint8_t *non_ml_vdev_lst,
4986 				qdf_freq_t *non_ml_freq_lst);
4987 
4988 /**
4989  * policy_mgr_handle_link_removal_on_vdev() - Handle AP link removal for
4990  * MLO STA
4991  * @vdev: objmgr vdev
4992  *
4993  * Handle link removal for STA vdev:
4994  * Send force link command to target if MLO STA link number > 1.
4995  * Select other inactive link to active if possible.
4996  *
4997  * Return: void
4998  */
4999 void policy_mgr_handle_link_removal_on_vdev(struct wlan_objmgr_vdev *vdev);
5000 
5001 /**
5002  * policy_mgr_handle_link_removal_on_standby() - Handle AP link removal for
5003  * MLO STA standby links
5004  * @vdev: objmgr vdev
5005  * @reconfig_info: link reconfig info
5006  *
5007  * Handle link removal for ML STA standby links:
5008  * Send force link command to target with link removal reason code
5009  *
5010  * Return: QDF_STATUS
5011  */
5012 QDF_STATUS
5013 policy_mgr_handle_link_removal_on_standby(struct wlan_objmgr_vdev *vdev,
5014 					  struct ml_rv_info *reconfig_info);
5015 
5016 /**
5017  * policy_mgr_is_mlo_sap_concurrency_allowed() - Check for mlo sap allowed
5018  *                                               concurrency combination
5019  * @psoc: PSOC object information
5020  * @is_new_vdev_mlo: Is new vdev a mlo device or not
5021  * @new_vdev_id: new vdev id which need concurrency check
5022  *
5023  * When a new connection is about to come up check if current
5024  * concurrency combination including the new connection is
5025  * allowed or not. Currently no concurrency support for mlo sap
5026  *
5027  * Return: True if concurrency is supported, otherwise false.
5028  */
5029 bool policy_mgr_is_mlo_sap_concurrency_allowed(struct wlan_objmgr_psoc *psoc,
5030 					       bool is_new_vdev_mlo,
5031 					       uint8_t new_vdev_id);
5032 
5033 /**
5034  * policy_mgr_get_conc_ext_flags() - get extended flags for concurrency check
5035  * @vdev: pointer to vdev on which new connection is coming up
5036  * @force_mlo: true means it's a MLO connection, false means uncertain
5037  *
5038  * In some scenario the flag WLAN_VDEV_FEXT2_MLO may not set for vdev when
5039  * checking concurrency, then caller can set force_mlo accordingly to get
5040  * proper extended flags.
5041  *
5042  * Return: extended flags for concurrency check
5043  */
5044 uint32_t
5045 policy_mgr_get_conc_ext_flags(struct wlan_objmgr_vdev *vdev, bool force_mlo);
5046 
5047 /**
5048  * policy_mgr_is_non_ml_sta_present() - Check whether Non-ML STA is present
5049  * @psoc: PSOC object information
5050  *
5051  * Return: True if non-ML STA is present, otherwise false.
5052  */
5053 bool policy_mgr_is_non_ml_sta_present(struct wlan_objmgr_psoc *psoc);
5054 
5055 /**
5056  * policy_mgr_is_mlo_sta_present() - Check whether MLO STA is present
5057  * @psoc: PSOC object information
5058  *
5059  * Return: True if MLO STA is present, otherwise false.
5060  */
5061 bool policy_mgr_is_mlo_sta_present(struct wlan_objmgr_psoc *psoc);
5062 
5063 /**
5064  * policy_mgr_is_mlo_in_mode_sbs() - Check whether MLO present is SBS (with both
5065  * links on 5/6 ghz band)
5066  * @psoc: PSOC object information
5067  * @mode: mlo mode to check
5068  * @mlo_vdev_lst: Pointer to mlo vdev list, this function will fill this with
5069  *                list of mlo vdev
5070  * @num_mlo: Pointer to number of mlo link, this function will fill this with
5071  *           number of mlo links
5072  *
5073  * Return: True if MLO is present with both links on 5 and 6ghz band
5074  */
5075 bool policy_mgr_is_mlo_in_mode_sbs(struct wlan_objmgr_psoc *psoc,
5076 				   enum policy_mgr_con_mode mode,
5077 				   uint8_t *mlo_vdev_lst, uint8_t *num_mlo);
5078 
5079 /**
5080  * policy_mgr_is_mlo_in_mode_dbs() - Check whether MLO present is DBS
5081  * @psoc: PSOC object information
5082  * @mode: mlo mode to check
5083  * @mlo_vdev_lst: Pointer to mlo vdev list, this function will fill this with
5084  *                list of mlo vdev
5085  * @num_mlo: Pointer to number of mlo link, this function will fill this with
5086  *           number of mlo links
5087  *
5088  * Return: True if MLO one link is on 2 GHz band and other links on
5089  * 5/6 GHz band
5090  */
5091 bool policy_mgr_is_mlo_in_mode_dbs(struct wlan_objmgr_psoc *psoc,
5092 				   enum policy_mgr_con_mode mode,
5093 				   uint8_t *mlo_vdev_lst, uint8_t *num_mlo);
5094 
5095 /**
5096  * policy_mgr_is_mlo_in_mode_emlsr() - Check whether current connection is eMLSR
5097  * @psoc: PSOC object information
5098  * @mlo_vdev_lst: Pointer to mlo vdev list, this function will fill this with
5099  *                list of mlo vdev
5100  * @num_mlo: Pointer to number of mlo link, this function will fill this with
5101  *           number of mlo links
5102  *
5103  * Return: True if current connection is in eMLSR mode i.e. Both STA and AP
5104  *         support eMLSR connection along with vendor command selection
5105  */
5106 bool policy_mgr_is_mlo_in_mode_emlsr(struct wlan_objmgr_psoc *psoc,
5107 				     uint8_t *mlo_vdev_lst, uint8_t *num_mlo);
5108 
5109 /**
5110  * policy_mgr_handle_ml_sta_links_on_vdev_up_csa() - Handle enable/disable
5111  * link on vdev UP and channel change
5112  * @psoc: objmgr psoc
5113  * @mode: mode of vdev that went UP or changed channel
5114  * @vdev_id: vdev_id which went UP or changed channel
5115  *
5116  * Return: void
5117  */
5118 void
5119 policy_mgr_handle_ml_sta_links_on_vdev_up_csa(struct wlan_objmgr_psoc *psoc,
5120 					      enum QDF_OPMODE mode,
5121 					      uint8_t vdev_id);
5122 
5123 /**
5124  * policy_mgr_handle_ml_sta_link_on_traffic_type_change() - Handle
5125  * enable/disable link on vdev traffic type change on SAP/P2P vdev
5126  * @psoc: objmgr psoc
5127  * @vdev: vdev on which traffic type change
5128  *
5129  * Context: Should be called only from north bound context and never from
5130  * schedular thread as it has wait for completed.
5131  *
5132  * Return: void
5133  */
5134 void policy_mgr_handle_ml_sta_link_on_traffic_type_change(
5135 						struct wlan_objmgr_psoc *psoc,
5136 						struct wlan_objmgr_vdev *vdev);
5137 
5138 /**
5139  * policy_mgr_handle_ml_sta_links_on_vdev_down() - Handle enable
5140  * link on any vdev down
5141  * @psoc: objmgr psoc
5142  * @mode: mode of vdev that went down
5143  * @vdev_id: vdev_id which went down
5144  *
5145  * Return: void
5146  */
5147 void policy_mgr_handle_ml_sta_links_on_vdev_down(struct wlan_objmgr_psoc *psoc,
5148 						 enum QDF_OPMODE mode,
5149 						 uint8_t vdev_id);
5150 
5151 /**
5152  * policy_mgr_handle_emlsr_sta_concurrency() - Handle concurrency scenarios with
5153  * EMLSR STA.
5154  * @psoc: objmgr psoc
5155  * @conc_con_coming_up: Indicates if any concurrent connection is coming up
5156  * @emlsr_sta_coming_up: Carries true when eMLSR STA is coming up.
5157  *			 Carries true when an unsupported concurrency is
5158  *			 gone, so that host can let firmware go to eMLSR mode.
5159  *
5160  * The API handles concurrency scenarios with existing EMLSR connection when a
5161  * new connection request is received OR with an existing legacy connection when
5162  * an EMLSR sta comes up.
5163  *
5164  * Return: none
5165  */
5166 void policy_mgr_handle_emlsr_sta_concurrency(struct wlan_objmgr_psoc *psoc,
5167 					     bool conc_con_coming_up,
5168 					     bool emlsr_sta_coming_up);
5169 
5170 /**
5171  * policy_mgr_clear_ml_links_settings_in_fw() - Process
5172  * QCA_WLAN_VENDOR_ATTR_LINK_STATE_CONTROL_MODE in default mode
5173  * @psoc: objmgr psoc
5174  * @vdev_id: vdev_id
5175  *
5176  * Return: QDF_STATUS
5177  */
5178 QDF_STATUS
5179 policy_mgr_clear_ml_links_settings_in_fw(struct wlan_objmgr_psoc *psoc,
5180 					 uint8_t vdev_id);
5181 
5182 /**
5183  * policy_mgr_activate_mlo_links_nlink() - Force active ML links based on user
5184  * requested link mac address with link bitmap
5185  * @psoc: objmgr psoc
5186  * @session_id: session id
5187  * @num_links: number of links to be forced active
5188  * @active_link_addr: link mac address of links to be forced active
5189  *
5190  * Return: void
5191  */
5192 void policy_mgr_activate_mlo_links_nlink(struct wlan_objmgr_psoc *psoc,
5193 					 uint8_t session_id, uint8_t num_links,
5194 					 struct qdf_mac_addr *active_link_addr);
5195 
5196 /**
5197  * policy_mgr_activate_mlo_links() - Force active ML links based on user
5198  * requested link mac address with vdev bitmap
5199  * @psoc: objmgr psoc
5200  * @session_id: session id
5201  * @num_links: number of links to be forced active
5202  * @active_link_addr: link mac address of links to be forced active
5203  *
5204  * Return: void
5205  */
5206 void policy_mgr_activate_mlo_links(struct wlan_objmgr_psoc *psoc,
5207 				   uint8_t session_id, uint8_t num_links,
5208 				   struct qdf_mac_addr *active_link_addr);
5209 
5210 /**
5211  * policy_mgr_update_mlo_links_based_on_linkid() - Force active ML links based
5212  * on user requested coming via QCA_NL80211_VENDOR_SUBCMD_MLO_LINK_STATE
5213  * @psoc: objmgr psoc
5214  * @vdev_id: vdev id
5215  * @num_links: number of links to be forced active
5216  * @link_id_list: link id(s) list coming from user space
5217  * @config_state_list: config state list coming from user space
5218  *
5219  * Return: success if the command gets processed successfully
5220  */
5221 QDF_STATUS
5222 policy_mgr_update_mlo_links_based_on_linkid(struct wlan_objmgr_psoc *psoc,
5223 					    uint8_t vdev_id,
5224 					    uint8_t num_links,
5225 					    uint8_t *link_id_list,
5226 					    uint32_t *config_state_list);
5227 
5228 /**
5229  * policy_mgr_update_active_mlo_num_links() - Force active ML links based
5230  * on user requested coming via LINK_STATE_MIXED_MODE_ACTIVE_NUM_LINKS
5231  * @psoc: objmgr psoc
5232  * @vdev_id: vdev id
5233  * @num_links: number of links to be forced active
5234  *
5235  * Return: success if the command gets processed successfully
5236  */
5237 QDF_STATUS policy_mgr_update_active_mlo_num_links(struct wlan_objmgr_psoc *psoc,
5238 						  uint8_t vdev_id,
5239 						  uint8_t num_links);
5240 #else
5241 static inline bool
policy_mgr_vdev_is_force_inactive(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)5242 policy_mgr_vdev_is_force_inactive(struct wlan_objmgr_psoc *psoc,
5243 				  uint8_t vdev_id)
5244 {
5245 	return false;
5246 }
5247 
policy_mgr_is_mlo_sap_concurrency_allowed(struct wlan_objmgr_psoc * psoc,bool is_new_vdev_mlo,uint8_t new_vdev_id)5248 static inline bool policy_mgr_is_mlo_sap_concurrency_allowed(
5249 			struct wlan_objmgr_psoc *psoc,
5250 			bool is_new_vdev_mlo,
5251 			uint8_t new_vdev_id)
5252 {
5253 	return true;
5254 }
5255 
5256 static inline uint32_t
policy_mgr_get_conc_ext_flags(struct wlan_objmgr_vdev * vdev,bool force_mlo)5257 policy_mgr_get_conc_ext_flags(struct wlan_objmgr_vdev *vdev, bool force_mlo)
5258 {
5259 	return 0;
5260 }
5261 
5262 static inline bool
policy_mgr_is_non_ml_sta_present(struct wlan_objmgr_psoc * psoc)5263 policy_mgr_is_non_ml_sta_present(struct wlan_objmgr_psoc *psoc)
5264 {
5265 	return true;
5266 }
5267 
policy_mgr_is_mlo_sta_present(struct wlan_objmgr_psoc * psoc)5268 static inline bool policy_mgr_is_mlo_sta_present(struct wlan_objmgr_psoc *psoc)
5269 {
5270 	return false;
5271 }
5272 
5273 static inline
policy_mgr_is_mlo_in_mode_sbs(struct wlan_objmgr_psoc * psoc,enum policy_mgr_con_mode mode,uint8_t * mlo_vdev_lst,uint8_t * num_mlo)5274 bool policy_mgr_is_mlo_in_mode_sbs(struct wlan_objmgr_psoc *psoc,
5275 				   enum policy_mgr_con_mode mode,
5276 				   uint8_t *mlo_vdev_lst, uint8_t *num_mlo)
5277 {
5278 	return false;
5279 }
5280 
5281 static inline
policy_mgr_is_mlo_in_mode_dbs(struct wlan_objmgr_psoc * psoc,enum policy_mgr_con_mode mode,uint8_t * mlo_vdev_lst,uint8_t * num_mlo)5282 bool policy_mgr_is_mlo_in_mode_dbs(struct wlan_objmgr_psoc *psoc,
5283 				   enum policy_mgr_con_mode mode,
5284 				   uint8_t *mlo_vdev_lst, uint8_t *num_mlo)
5285 {
5286 	return false;
5287 }
5288 
5289 static inline void
policy_mgr_handle_ml_sta_links_on_vdev_up_csa(struct wlan_objmgr_psoc * psoc,enum QDF_OPMODE mode,uint8_t vdev_id)5290 policy_mgr_handle_ml_sta_links_on_vdev_up_csa(struct wlan_objmgr_psoc *psoc,
5291 					      enum QDF_OPMODE mode,
5292 					      uint8_t vdev_id)
5293 {
5294 }
5295 
5296 static inline void
policy_mgr_handle_ml_sta_link_on_traffic_type_change(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev)5297 policy_mgr_handle_ml_sta_link_on_traffic_type_change(
5298 						struct wlan_objmgr_psoc *psoc,
5299 						struct wlan_objmgr_vdev *vdev)
5300 {
5301 }
5302 
5303 static inline
policy_mgr_is_mlo_in_mode_emlsr(struct wlan_objmgr_psoc * psoc,uint8_t * mlo_vdev_lst,uint8_t * num_mlo)5304 bool policy_mgr_is_mlo_in_mode_emlsr(struct wlan_objmgr_psoc *psoc,
5305 				     uint8_t *mlo_vdev_lst, uint8_t *num_mlo)
5306 {
5307 	return false;
5308 }
5309 
5310 static inline
policy_mgr_handle_ml_sta_links_on_vdev_down(struct wlan_objmgr_psoc * psoc,enum QDF_OPMODE mode,uint8_t vdev_id)5311 void policy_mgr_handle_ml_sta_links_on_vdev_down(struct wlan_objmgr_psoc *psoc,
5312 						 enum QDF_OPMODE mode,
5313 						 uint8_t vdev_id)
5314 {
5315 }
5316 #endif
5317 
5318 /**
5319  * policy_mgr_is_hwmode_offload_enabled() - Check for HW mode selection offload
5320  *  support
5321  * @psoc: PSOC object information
5322  *
5323  * Check if target supports HW mode selection offload or not
5324  *
5325  * Return: True if the target supports HW mode selection offload,
5326  *         False otherwise.
5327  */
5328 bool policy_mgr_is_hwmode_offload_enabled(struct wlan_objmgr_psoc *psoc);
5329 /**
5330  * policy_mgr_is_3rd_conn_on_same_band_allowed() - Check the third connection
5331  * on same band allowed or not
5332  * list for third connection
5333  * @psoc: PSOC object information
5334  * @mode: Device mode
5335  * @ch_freq: 3rd channel frequency
5336  *
5337  * This function checks whether to allow third connection on same band or not
5338  * based on pcl table
5339  *
5340  * Return: TRUE/FALSE
5341  */
5342 bool policy_mgr_is_3rd_conn_on_same_band_allowed(struct wlan_objmgr_psoc *psoc,
5343 						 enum policy_mgr_con_mode mode,
5344 						 qdf_freq_t ch_freq);
5345 
5346 /**
5347  * policy_mgr_get_connected_roaming_vdev_band_mask() - get connected vdev
5348  * band mask
5349  * @psoc: PSOC object
5350  * @vdev_id: Vdev id
5351  *
5352  * Return: reg wifi band mask
5353  */
5354 uint32_t
5355 policy_mgr_get_connected_roaming_vdev_band_mask(struct wlan_objmgr_psoc *psoc,
5356 						uint8_t vdev_id);
5357 
5358 /**
5359  * policy_mgr_is_sta_chan_valid_for_connect_and_roam  - Check if given
5360  * channel is valid for STA connection/roam pcl channels
5361  * @pdev: pdev
5362  * @freq: frequency
5363  *
5364  * Return: true if channel is valid else false
5365  */
5366 bool policy_mgr_is_sta_chan_valid_for_connect_and_roam(
5367 					struct wlan_objmgr_pdev *pdev,
5368 					qdf_freq_t freq);
5369 
5370 /**
5371  * policy_mgr_is_ap_ap_mcc_allow() - Check AP AP MCC allow or not
5372  * @psoc: psoc object
5373  * @pdev: pdev object
5374  * @vdev: vdev object of new SAP or P2P GO
5375  * @ch_freq: channel frequency of up coming vdev
5376  * @ch_width: channel width
5377  * @con_vdev_id: concurrent SAP/GO vdev id
5378  * @con_freq: concurrent SAP/GO home channel.
5379  *
5380  * Check if AP AP MCC allow or not when new SAP or P2P GO creating.
5381  * If not allowed, the concurrency SAP/GO vdev and channel will
5382  * be returned.
5383  *
5384  * Return: True if the target allow AP AP MCC,
5385  *         False otherwise.
5386  */
5387 bool policy_mgr_is_ap_ap_mcc_allow(struct wlan_objmgr_psoc *psoc,
5388 				   struct wlan_objmgr_pdev *pdev,
5389 				   struct wlan_objmgr_vdev *vdev,
5390 				   uint32_t ch_freq,
5391 				   enum phy_ch_width ch_width,
5392 				   uint8_t *con_vdev_id,
5393 				   uint32_t *con_freq);
5394 
5395 /**
5396  * policy_mgr_any_other_vdev_on_same_mac_as_freq() - Function to check
5397  * whether more than one vdev are present on same mac or not
5398  * @psoc: PSOC object
5399  * @freq: Channel frequency
5400  * @vdev_id: Vdev id
5401  *
5402  * Return: True if more than one vdev are present on same mac
5403  *
5404  */
5405 bool policy_mgr_any_other_vdev_on_same_mac_as_freq(
5406 				struct wlan_objmgr_psoc *psoc,
5407 				uint32_t freq, uint8_t vdev_id);
5408 
5409 /**
5410  * policy_mgr_get_sbs_cfg() - Get SBS INI value
5411  * @psoc: PSOC object
5412  * @sbs: output sbs cfg value
5413  *
5414  */
5415 QDF_STATUS policy_mgr_get_sbs_cfg(struct wlan_objmgr_psoc *psoc, bool *sbs);
5416 
5417 /**
5418  * policy_mgr_get_ll_sap_freq()- Function to get ll sap freq if it's present
5419  * @psoc: PSOC object
5420  *
5421  * Based on vdev id ap profile set via vendor command is get and compared with
5422  * ll_type_any AP type and return freq for that SAP if profile set is latency
5423  * sensitive or throghput sensitive.
5424  *
5425  * Return: freq if it's LL SAP otherwise 0
5426  *
5427  */
5428 qdf_freq_t policy_mgr_get_ll_sap_freq(struct wlan_objmgr_psoc *psoc);
5429 
5430 /**
5431  * policy_mgr_get_ll_lt_sap_freq()- Function to get LT LL sap freq if it's
5432  * present
5433  * @psoc: PSOC object
5434  *
5435  * Based on vdev id ap profile set via vendor command is get and compared with
5436  * lt_ll_type AP type and return freq for that SAP if profile set is latency
5437  * sensitive example gaming or losless audio.
5438  *
5439  * Return: freq if it's LT LL SAP otherwise 0
5440  *
5441  */
5442 qdf_freq_t policy_mgr_get_ll_lt_sap_freq(struct wlan_objmgr_psoc *psoc);
5443 
5444 /**
5445  * policy_mgr_get_ll_ht_sap_freq()- Function to get LL HT sap freq if it's
5446  * present
5447  * @psoc: PSOC object
5448  *
5449  * Based on vdev id ap profile set via vendor command is get and compared with
5450  * ll_ht_type AP type and return freq for that SAP if profile set is throghput
5451  * sensitive.
5452  *
5453  * Return: freq if it's HT LL SAP otherwise 0
5454  *
5455  */
5456 qdf_freq_t policy_mgr_get_ll_ht_sap_freq(struct wlan_objmgr_psoc *psoc);
5457 
5458 #ifndef WLAN_FEATURE_LL_LT_SAP
5459 /**
5460  * policy_mgr_is_ll_sap_concurrency_valid() - Function to check whether
5461  * low latency SAP + STA/SAP/GC/GO concurrency allowed or not
5462  * @psoc: PSOC object
5463  * @freq: Channel frequency
5464  * @mode: Device mode
5465  *
5466  * Return: True if concurrency are allowed otherwise false
5467  *
5468  */
5469 bool policy_mgr_is_ll_sap_concurrency_valid(struct wlan_objmgr_psoc *psoc,
5470 					    qdf_freq_t freq,
5471 					    enum policy_mgr_con_mode mode);
5472 #else
5473 static inline
policy_mgr_is_ll_sap_concurrency_valid(struct wlan_objmgr_psoc * psoc,qdf_freq_t freq,enum policy_mgr_con_mode mode)5474 bool policy_mgr_is_ll_sap_concurrency_valid(struct wlan_objmgr_psoc *psoc,
5475 					    qdf_freq_t freq,
5476 					    enum policy_mgr_con_mode mode)
5477 {
5478 	return true;
5479 }
5480 #endif
5481 /**
5482  * policy_mgr_update_indoor_concurrency() - Function to update the indoor
5483  * concurrency related regulatory changes
5484  *
5485  * @psoc: pointer to psoc
5486  * @vdev_id: vdev id
5487  * @discon_freq: disconnect frequency
5488  * @type: enum indoor_conc_update_type
5489  *
5490  * Return: True if need to compute pdev current channel list
5491  */
5492 bool
5493 policy_mgr_update_indoor_concurrency(struct wlan_objmgr_psoc *psoc,
5494 				     uint8_t vdev_id,
5495 				     uint32_t discon_freq,
5496 				     enum indoor_conc_update_type type);
5497 /**
5498  * policy_mgr_is_conc_sap_present_on_sta_freq() - Function to check if
5499  * SAP or GO exists on the STA frequency
5500  *
5501  * @psoc: pointer to psoc
5502  * @mode: interface mode
5503  * @ch_freq: channel frequency
5504  *
5505  * Return: AP mode exists
5506  */
5507 bool
5508 policy_mgr_is_conc_sap_present_on_sta_freq(struct wlan_objmgr_psoc *psoc,
5509 					   enum policy_mgr_con_mode mode,
5510 					   uint32_t ch_freq);
5511 
5512 /**
5513  * policy_mgr_get_connection_count_with_ch_freq() - Get number of active
5514  * connections on the channel frequecy
5515  * @ch_freq: channel frequency
5516  *
5517  * Return: number of active connection on the specific frequency
5518  */
5519 uint32_t policy_mgr_get_connection_count_with_ch_freq(uint32_t ch_freq);
5520 
5521 /**
5522  * policy_mgr_is_sap_go_interface_allowed_on_indoor() - Check if SAP or GO
5523  * interface is allowed on the indoor channel
5524  *
5525  * @pdev: pointer to pdev
5526  * @vdev_id: vdev id
5527  * @ch_freq: SAP frequency
5528  *
5529  * Return: is SAP allowed
5530  */
5531 bool
5532 policy_mgr_is_sap_go_interface_allowed_on_indoor(struct wlan_objmgr_pdev *pdev,
5533 						 uint8_t vdev_id,
5534 						 qdf_freq_t ch_freq);
5535 
5536 #ifdef WLAN_FEATURE_TDLS_CONCURRENCIES
5537 /**
5538  * policy_mgr_get_allowed_tdls_offchannel_freq() - Check if TDLS off-channel is
5539  * allowed during concurrency. When off-channel is allowed, update the provided
5540  * input channel frequency with concurrent vdev frequency in DBS case.
5541  * Fill the provided channel frequency as 0 if all 5GHz/6GHz channels are
5542  * allowed for off-channel operation in SCC case.
5543  * Don't allow off channel operation in any MCC case.
5544  * @psoc: psoc pointer
5545  * @vdev: vdev pointer
5546  * @ch_freq: Frequency pointer
5547  *
5548  * Return: true or false based on current concurrency combination
5549  */
5550 bool
5551 policy_mgr_get_allowed_tdls_offchannel_freq(struct wlan_objmgr_psoc *psoc,
5552 					    struct wlan_objmgr_vdev *vdev,
5553 					    qdf_freq_t *ch_freq);
5554 #endif /* WLAN_FEATURE_TDLS_CONCURRENCIES */
5555 
5556 /**
5557  * policy_mgr_is_sap_mode() - Check if mode is SAP mode
5558  * @mode: Policy manager concurrency mode
5559  *
5560  * Return: true if mode is SAP mode else false
5561  */
5562 bool policy_mgr_is_sap_mode(enum policy_mgr_con_mode mode);
5563 
5564 /**
5565  * policy_mgr_is_beaconing_mode() - Check if mode represents beaconing entity
5566  * @mode: Policy manager concurrency mode
5567  *
5568  * Return: true if mode represents beaconing entity else false
5569  */
5570 bool policy_mgr_is_beaconing_mode(enum policy_mgr_con_mode mode);
5571 
5572 /**
5573  * policy_mgr_get_nan_sap_scc_on_lte_coex_chnl() -Get if NAN + SAP SCC on
5574  * lte coex channel is allowed on lte coex channel or not
5575  * @psoc: psoc pointer
5576  *
5577  * Return: cfg value of nan sap scc is allowed or not on lte coex channel
5578  */
5579 
5580 bool policy_mgr_get_nan_sap_scc_on_lte_coex_chnl(struct wlan_objmgr_psoc *psoc);
5581 
5582 /**
5583  * policy_mgr_reset_sap_mandatory_channels() - Reset the SAP mandatory channels
5584  * @psoc: psoc object
5585  *
5586  * Resets the SAP mandatory channel list and the length of the list
5587  *
5588  * Return: QDF_STATUS
5589  */
5590 QDF_STATUS
5591 policy_mgr_reset_sap_mandatory_channels(struct wlan_objmgr_psoc *psoc);
5592 
5593 /**
5594  * policy_mgr_get_sap_mode_count() - Get SAP interface counts
5595  * @psoc: psoc object
5596  * @list: To provide the indices on pm_conc_connection_list
5597  *	(optional)
5598  *
5599  * Return: No of SAP interface counts
5600  */
5601 uint32_t policy_mgr_get_sap_mode_count(struct wlan_objmgr_psoc *psoc,
5602 				       uint32_t *list);
5603 
5604 /**
5605  * policy_mgr_get_beaconing_mode_count() - Get Beaconing interface counts
5606  * @psoc: psoc object
5607  * @list: To provide the indices on pm_conc_connection_list
5608  *	(optional)
5609  *
5610  * Return: No of Beaconing interface counts
5611  */
5612 uint32_t policy_mgr_get_beaconing_mode_count(struct wlan_objmgr_psoc *psoc,
5613 					     uint32_t *list);
5614 
5615 /**
5616  * policy_mgr_get_sap_mode_info() - Get active SAP channels and vdev ids
5617  * @psoc: PSOC object information
5618  * @ch_freq_list: Mode specific channel freq list
5619  * @vdev_id: Mode specific vdev id (list)
5620  *
5621  * Get active SAP channel and vdev id
5622  *
5623  * Return: number of SAP connections found
5624  */
5625 uint32_t policy_mgr_get_sap_mode_info(struct wlan_objmgr_psoc *psoc,
5626 				      uint32_t *ch_freq_list, uint8_t *vdev_id);
5627 
5628 /**
5629  * policy_mgr_get_beaconing_mode_info() - Get active beaconing entity
5630  * channels and vdev ids
5631  * @psoc: PSOC object information
5632  * @ch_freq_list: Mode specific channel freq list
5633  * @vdev_id: Mode specific vdev id (list)
5634  *
5635  * Get active beaconing entity channels and vdev ids
5636  *
5637  * Return: number of beaconing entities found
5638  */
5639 uint32_t policy_mgr_get_beaconing_mode_info(struct wlan_objmgr_psoc *psoc,
5640 					    uint32_t *ch_freq_list,
5641 					    uint8_t *vdev_id);
5642 
5643 /**
5644  * policy_mgr_is_freq_on_mac_id() - Check if given freq belongs to given mac id
5645  * @freq_range: Frequency range pointer
5646  * @freq: Frequency which needs to be checked
5647  * @mac_id: MAC id on which this frequency needs to be checked
5648  *
5649  * Return: True if given frequency belongs to the given MAC id
5650  */
5651 bool policy_mgr_is_freq_on_mac_id(struct policy_mgr_freq_range *freq_range,
5652 				  qdf_freq_t freq, uint8_t mac_id);
5653 
5654 /**
5655  * policy_mgr_is_conn_lead_to_dbs_sbs() - New freq leads to DBS/SBS
5656  * @psoc: PSOC object information
5657  * @vdev_id: vdev id of the caller
5658  * @freq: New connection frequency
5659  *
5660  * This API loops through existing connections from policy_mgr connection table
5661  *
5662  * Return: True if new frequency causes DBS/SBS with existing connections
5663  */
5664 bool
5665 policy_mgr_is_conn_lead_to_dbs_sbs(struct wlan_objmgr_psoc *psoc,
5666 				   uint8_t vdev_id, qdf_freq_t freq);
5667 
5668 /**
5669  * policy_mgr_sap_ch_width_update() - Update SAP ch_width
5670  * @psoc: PSOC object information
5671  * @next_action: next action to happen in order to update bandwidth
5672  * @reason: reason for ch_width update
5673  * @conc_vdev_id: Concurrent connection vdev_id that is causing ch_width update
5674  * @request_id: request id for connection manager
5675  *
5676  * Update ch_width as per next_action
5677  *
5678  * Return: QDF_STATUS
5679  */
5680 QDF_STATUS
5681 policy_mgr_sap_ch_width_update(struct wlan_objmgr_psoc *psoc,
5682 			       enum policy_mgr_conc_next_action next_action,
5683 			       enum policy_mgr_conn_update_reason reason,
5684 			       uint8_t conc_vdev_id, uint32_t request_id);
5685 
5686 /*
5687  * policy_mgr_get_vdev_same_freq_new_conn() - Get vdev_id of the first
5688  *					      connection that has same
5689  *					      channel frequency as new_freq
5690  * @psoc: psoc object pointer
5691  * @new_freq: channel frequency for the new connection
5692  * @vdev_id: Output parameter to return vdev id of the first existing connection
5693  *	     that has same channel frequency as @new_freq
5694  *
5695  * This function is to return the first connection that has same
5696  * channel frequency as @new_freq.
5697  *
5698  * Return: true if connection that has same channel frequency as
5699  *	   @new_freq exists. Otherwise false.
5700  */
5701 bool policy_mgr_get_vdev_same_freq_new_conn(struct wlan_objmgr_psoc *psoc,
5702 					    uint32_t new_freq,
5703 					    uint8_t *vdev_id);
5704 
5705 /*
5706  * policy_mgr_get_vdev_diff_freq_new_conn() - Get vdev id of the first
5707  *					      connection that has different
5708  *					      channel freq from new_freq
5709  * @psoc: psoc object pointer
5710  * @new_freq: channel frequency for the new connection
5711  * @vdev_id: Output parameter to return vdev id of the first existing connection
5712  *	     that has different channel frequency from @new_freq
5713  *
5714  * This function is to return the first connection that has different
5715  * channel frequency from @new_freq.
5716  *
5717  * Return: true if connection that has different channel frequency from
5718  *	   @new_freq exists. Otherwise false.
5719  */
5720 bool policy_mgr_get_vdev_diff_freq_new_conn(struct wlan_objmgr_psoc *psoc,
5721 					    uint32_t new_freq,
5722 					    uint8_t *vdev_id);
5723 
5724 /**
5725  * policy_mgr_sap_on_non_psc_channel() - Check if STA operates in PSC or Non-PSC
5726  *					 channel to restart SAP on Non-PSC
5727  *					 channel
5728  * @psoc: PSOC object information
5729  * @intf_ch_freq: input/out interference channel frequency to sap
5730  * @sap_vdev_id: SAP vdev id
5731  *
5732  * This function is to check if STA operates in PSC or Non-PSC channel
5733  * to restart SAP on Non-PSC channel.
5734  *
5735  * Return: None
5736  */
5737 void
5738 policy_mgr_sap_on_non_psc_channel(struct wlan_objmgr_psoc *psoc,
5739 				  qdf_freq_t *intf_ch_freq,
5740 				  uint8_t sap_vdev_id);
5741 
5742 #ifdef WLAN_FEATURE_LL_LT_SAP
5743 /**
5744  * policy_mgr_get_pcl_ch_list_for_ll_sap() - Get PCL channel list for LL_LT_SAP
5745  * @psoc: psoc object
5746  * @pcl: pcl list
5747  * @vdev_id: vdev id
5748  * @info: pointer to connection_info structure
5749  * @connection_count: total number of existing connection present
5750  *
5751  * Return: QDF_STATUS
5752  */
5753 QDF_STATUS policy_mgr_get_pcl_ch_list_for_ll_sap(
5754 					struct wlan_objmgr_psoc *psoc,
5755 					struct policy_mgr_pcl_list *pcl,
5756 					uint8_t vdev_id,
5757 					struct connection_info *info,
5758 					uint8_t *connection_count);
5759 #endif
5760 
5761 /**
5762  * policy_mgr_is_given_freq_5g_low() - API to check whether given freq
5763  * is 5GHz low or not
5764  * @psoc: psoc object
5765  * @given_freq: given freq
5766  *
5767  * Return: True if it 5GHz low otherwise false
5768  */
5769 bool policy_mgr_is_given_freq_5g_low(struct wlan_objmgr_psoc *psoc,
5770 				     qdf_freq_t given_freq);
5771 #endif /* __WLAN_POLICY_MGR_API_H */
5772