1 /*
2 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19 #ifndef __WLAN_POLICY_MGR_UCFG
20 #define __WLAN_POLICY_MGR_UCFG
21 #include "wlan_objmgr_psoc_obj.h"
22 #include "wlan_objmgr_global_obj.h"
23 #include "qdf_status.h"
24 #include "wlan_policy_mgr_public_struct.h"
25
26 /**
27 * ucfg_policy_mgr_psoc_open() - This API sets CFGs to policy manager context
28 * @psoc: pointer to psoc
29 *
30 * This API pulls policy manager's context from PSOC and initialize the CFG
31 * structure of policy manager.
32 *
33 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
34 */
35 QDF_STATUS ucfg_policy_mgr_psoc_open(struct wlan_objmgr_psoc *psoc);
36
37 /**
38 * ucfg_policy_mgr_psoc_close() - This API resets CFGs for policy manager ctx
39 * @psoc: pointer to psoc
40 *
41 * This API pulls policy manager's context from PSOC and resets the CFG
42 * structure of policy manager.
43 *
44 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
45 */
46 void ucfg_policy_mgr_psoc_close(struct wlan_objmgr_psoc *psoc);
47 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
48 /**
49 * ucfg_policy_mgr_get_mcc_scc_switch() - To mcc to scc switch setting from INI
50 * @psoc: pointer to psoc
51 * @mcc_scc_switch: value to be filled
52 *
53 * This API pulls mcc to scc switch setting which is given as part of INI and
54 * stored in policy manager's CFGs.
55 *
56 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
57 */
58 QDF_STATUS ucfg_policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
59 uint8_t *mcc_scc_switch);
60 #else
61 static inline
ucfg_policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc * psoc,uint8_t * mcc_scc_switch)62 QDF_STATUS ucfg_policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
63 uint8_t *mcc_scc_switch)
64 {
65 return QDF_STATUS_SUCCESS;
66 }
67 #endif //FEATURE_WLAN_MCC_TO_SCC_SWITCH
68
69 /**
70 * ucfg_policy_mgr_get_radio_combinations() - Query the supported radio
71 * combinations
72 * @psoc: soc object
73 * @comb: combination buffer
74 * @comb_max: max combination number can be saved to comb buffer
75 * @comb_num: returned combination number
76 *
77 * This function returns the radio combination information supported by target.
78 *
79 * Return: QDF_STATUS_SUCCESS if query successfully
80 */
81 QDF_STATUS
82 ucfg_policy_mgr_get_radio_combinations(struct wlan_objmgr_psoc *psoc,
83 struct radio_combination *comb,
84 uint32_t comb_max,
85 uint32_t *comb_num);
86
87 /**
88 * ucfg_policy_mgr_get_sys_pref() - to get system preference
89 * @psoc: pointer to psoc
90 * @sys_pref: value to be filled
91 *
92 * This API pulls the system preference for policy manager to provide
93 * PCL
94 *
95 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
96 */
97 QDF_STATUS ucfg_policy_mgr_get_sys_pref(struct wlan_objmgr_psoc *psoc,
98 uint8_t *sys_pref);
99 /**
100 * ucfg_policy_mgr_set_sys_pref() - to set system preference
101 * @psoc: pointer to psoc
102 * @sys_pref: value to be applied as new INI setting
103 *
104 * This API is meant to override original INI setting for system pref
105 * with new value which is used by policy manager to provide PCL
106 *
107 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
108 */
109 QDF_STATUS ucfg_policy_mgr_set_sys_pref(struct wlan_objmgr_psoc *psoc,
110 uint8_t sys_pref);
111
112 /**
113 * ucfg_policy_mgr_get_conc_rule1() - to find out if conc rule1 is enabled
114 * @psoc: pointer to psoc
115 * @conc_rule1: value to be filled
116 *
117 * This API is used to find out if conc rule-1 is enabled by user
118 *
119 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
120 */
121 QDF_STATUS ucfg_policy_mgr_get_conc_rule1(struct wlan_objmgr_psoc *psoc,
122 uint8_t *conc_rule1);
123 /**
124 * ucfg_policy_mgr_get_conc_rule2() - to find out if conc rule2 is enabled
125 * @psoc: pointer to psoc
126 * @conc_rule2: value to be filled
127 *
128 * This API is used to find out if conc rule-2 is enabled by user
129 *
130 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
131 */
132 QDF_STATUS ucfg_policy_mgr_get_conc_rule2(struct wlan_objmgr_psoc *psoc,
133 uint8_t *conc_rule2);
134
135 /**
136 * ucfg_policy_mgr_get_chnl_select_plcy() - to get channel selection policy
137 * @psoc: pointer to psoc
138 * @chnl_select_plcy: value to be filled
139 *
140 * This API is used to find out which channel selection policy has been
141 * configured
142 *
143 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
144 */
145 QDF_STATUS ucfg_policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc,
146 uint32_t *chnl_select_plcy);
147 /**
148 * ucfg_policy_mgr_get_mcc_adaptive_sch() - to get mcc adaptive scheduler
149 * @psoc: pointer to psoc
150 * @enable_mcc_adaptive_sch: value to be filled
151 *
152 * This API is used to find out if mcc adaptive scheduler enabled or disabled
153 *
154 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
155 */
156 QDF_STATUS
157 ucfg_policy_mgr_get_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
158 bool *enable_mcc_adaptive_sch);
159
160 /**
161 * ucfg_policy_mgr_get_dynamic_mcc_adaptive_sch() - to get dynamic mcc adaptive
162 * scheduler
163 * @psoc: pointer to psoc
164 * @dynamic_mcc_adaptive_sch: value to be filled
165 *
166 * This API is used to get dynamic mcc adaptive scheduler
167 *
168 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
169 */
170 QDF_STATUS
171 ucfg_policy_mgr_get_dynamic_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
172 bool *dynamic_mcc_adaptive_sch);
173
174 /**
175 * ucfg_policy_mgr_set_dynamic_mcc_adaptive_sch() - to set dynamic mcc adaptive
176 * scheduler
177 * @psoc: pointer to psoc
178 * @dynamic_mcc_adaptive_sch: value to be set
179 *
180 * This API is used to set dynamic mcc adaptive scheduler
181 *
182 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
183 */
184 QDF_STATUS
185 ucfg_policy_mgr_set_dynamic_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
186 bool dynamic_mcc_adaptive_sch);
187
188 /**
189 * ucfg_policy_mgr_get_sta_cxn_5g_band() - to get STA's connection in 5G config
190 *
191 * @psoc: pointer to psoc
192 * @enable_sta_cxn_5g_band: value to be filled
193 *
194 * This API is used to find out if STA connection in 5G band is allowed or
195 * disallowed.
196 *
197 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
198 */
199 QDF_STATUS ucfg_policy_mgr_get_sta_cxn_5g_band(struct wlan_objmgr_psoc *psoc,
200 uint8_t *enable_sta_cxn_5g_band);
201 /**
202 * ucfg_policy_mgr_get_allow_mcc_go_diff_bi() - to get information on whether GO
203 * can have diff BI than STA in MCC
204 * @psoc: pointer to psoc
205 * @allow_mcc_go_diff_bi: value to be filled
206 *
207 * This API is used to find out whether GO's BI can different than STA in MCC
208 * scenario
209 *
210 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
211 */
212 QDF_STATUS
213 ucfg_policy_mgr_get_allow_mcc_go_diff_bi(struct wlan_objmgr_psoc *psoc,
214 uint8_t *allow_mcc_go_diff_bi);
215 /**
216 * ucfg_policy_mgr_get_dual_mac_feature() - to find out if DUAL MAC feature is
217 * enabled
218 * @psoc: pointer to psoc
219 * @dual_mac_feature: value to be filled
220 *
221 * This API is used to find out whether dual mac (dual radio) specific feature
222 * is enabled or not
223 *
224 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
225 */
226 QDF_STATUS ucfg_policy_mgr_get_dual_mac_feature(struct wlan_objmgr_psoc *psoc,
227 uint8_t *dual_mac_feature);
228
229 /**
230 * ucfg_policy_mgr_get_dual_sta_feature() - to find out if DUAL STA feature is
231 * enabled
232 * @psoc: pointer to psoc
233 *
234 * This API is used to find out whether dual sta specific feature is enabled
235 * or not.
236 *
237 * Return: true if feature is enabled, otherwise false.
238 */
239 bool ucfg_policy_mgr_get_dual_sta_feature(struct wlan_objmgr_psoc *psoc);
240
241 /**
242 * ucfg_policy_mgr_get_force_1x1() - to find out if 1x1 connection is enforced
243 *
244 * @psoc: pointer to psoc
245 * @force_1x1: value to be filled
246 *
247 * This API is used to find out if 1x1 connection is enforced.
248 *
249 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
250 */
251 QDF_STATUS ucfg_policy_mgr_get_force_1x1(struct wlan_objmgr_psoc *psoc,
252 uint8_t *force_1x1);
253
254 /**
255 * ucfg_policy_mgr_get_max_conc_cxns() - to get configured max concurrent active
256 * connection count
257 *
258 * @psoc: pointer to psoc
259 *
260 * This API is used to query the configured max concurrent active connection
261 * count.
262 *
263 * Return: max active connection count
264 */
265 uint32_t ucfg_policy_mgr_get_max_conc_cxns(struct wlan_objmgr_psoc *psoc);
266
267 /**
268 * ucfg_policy_mgr_set_max_conc_cxns() - to set supported max concurrent active
269 * connection count to policy mgr
270 *
271 * @psoc: pointer to psoc
272 * @max_conc_cxns: max active connection count
273 *
274 * This API is used to update the max concurrent active connection
275 * count to policy mgr
276 *
277 * Return: QDF_STATUS_SUCCESS if set successfully
278 */
279 QDF_STATUS ucfg_policy_mgr_set_max_conc_cxns(struct wlan_objmgr_psoc *psoc,
280 uint32_t max_conc_cxns);
281
282 /**
283 * ucfg_policy_mgr_get_sta_sap_scc_on_dfs_chnl() - to find out if STA and SAP
284 * SCC is allowed on DFS channel
285 * @psoc: pointer to psoc
286 * @sta_sap_scc_on_dfs_chnl: value to be filled
287 *
288 * This API is used to find out whether STA and SAP SCC is allowed on
289 * DFS channels
290 *
291 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
292 */
293 QDF_STATUS
294 ucfg_policy_mgr_get_sta_sap_scc_on_dfs_chnl(struct wlan_objmgr_psoc *psoc,
295 uint8_t *sta_sap_scc_on_dfs_chnl);
296 /**
297 * ucfg_policy_mgr_get_sta_sap_scc_lte_coex_chnl() - to find out if STA & SAP
298 * SCC is allowed on LTE COEX
299 * @psoc: pointer to psoc
300 * @sta_sap_scc_lte_coex: value to be filled
301 *
302 * This API is used to find out whether STA and SAP scc is allowed on LTE COEX
303 * channel
304 *
305 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
306 */
307 QDF_STATUS
308 ucfg_policy_mgr_get_sta_sap_scc_lte_coex_chnl(struct wlan_objmgr_psoc *psoc,
309 uint8_t *sta_sap_scc_lte_coex);
310
311 /**
312 * ucfg_policy_mgr_get_dfs_master_dynamic_enabled() - support dfs master or not
313 * AP interface when STA+SAP(GO) concurrency
314 * @psoc: pointer to psoc
315 * @vdev_id: sap vdev id
316 *
317 * This API is used to check SAP (GO) dfs master functionality enabled or not
318 * when STA+SAP(GO) concurrency.
319 * If g_sta_sap_scc_on_dfs_chan is non-zero, the STA+SAP(GO) is allowed on DFS
320 * channel SCC and the SAP's DFS master functionality should be enable/disable
321 * according to:
322 * 1. g_sta_sap_scc_on_dfs_chan is 0: function return true - dfs master
323 * capability enabled.
324 * 2. g_sta_sap_scc_on_dfs_chan is 1: function return false - dfs master
325 * capability disabled.
326 * 3. g_sta_sap_scc_on_dfs_chan is 2: dfs master capability based on STA on
327 * 5G or not:
328 * a. 5G STA active - return false
329 * b. no 5G STA active -return true
330 *
331 * Return: true if dfs master functionality should be enabled.
332 */
333 bool
334 ucfg_policy_mgr_get_dfs_master_dynamic_enabled(struct wlan_objmgr_psoc *psoc,
335 uint8_t vdev_id);
336
337 /**
338 * ucfg_policy_mgr_init_chan_avoidance() - init channel avoidance in policy
339 * manager
340 * @psoc: pointer to psoc
341 * @chan_freq_list: channel frequency list
342 * @chan_cnt: channel count
343 *
344 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
345 */
346 QDF_STATUS
347 ucfg_policy_mgr_init_chan_avoidance(struct wlan_objmgr_psoc *psoc,
348 qdf_freq_t *chan_freq_list,
349 uint16_t chan_cnt);
350
351 /**
352 * ucfg_policy_mgr_get_sap_mandt_chnl() - to find out if SAP mandatory channel
353 * support is enabled
354 * @psoc: pointer to psoc
355 * @sap_mandt_chnl: value to be filled
356 *
357 * This API is used to find out whether SAP's mandatory channel support
358 * is enabled
359 *
360 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
361 */
362 QDF_STATUS ucfg_policy_mgr_get_sap_mandt_chnl(struct wlan_objmgr_psoc *psoc,
363 uint8_t *sap_mandt_chnl);
364 /**
365 * ucfg_policy_mgr_get_indoor_chnl_marking() - to get if indoor channel can be
366 * marked as disabled
367 * @psoc: pointer to psoc
368 * @indoor_chnl_marking: value to be filled
369 *
370 * This API is used to find out whether indoor channel can be marked as disabled
371 *
372 * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
373 */
374 QDF_STATUS
375 ucfg_policy_mgr_get_indoor_chnl_marking(struct wlan_objmgr_psoc *psoc,
376 uint8_t *indoor_chnl_marking);
377
378 /**
379 * ucfg_policy_mgr_get_sta_sap_scc_on_indoor_chnl() - to get if
380 * sta sap scc on indoor channel is allowed
381 * @psoc: pointer to psoc
382 *
383 * This API is used to get the value of sta+sap scc on indoor channel
384 *
385 * Return: TRUE or FALSE
386 */
387
388 bool
389 ucfg_policy_mgr_get_sta_sap_scc_on_indoor_chnl(struct wlan_objmgr_psoc *psoc);
390
391 /**
392 * ucfg_policy_mgr_is_fw_supports_dbs() - to check whether FW supports DBS or
393 * not
394 * @psoc: pointer to psoc
395 *
396 * Return: true if DBS is supported else false
397 */
398 bool ucfg_policy_mgr_is_fw_supports_dbs(struct wlan_objmgr_psoc *psoc);
399
400 /**
401 * ucfg_policy_mgr_get_connection_count() - Get number of connections
402 * @psoc: pointer to psoc
403 *
404 * This API is used to get the count of current connections.
405 *
406 * Return: connection count
407 */
408 uint32_t ucfg_policy_mgr_get_connection_count(struct wlan_objmgr_psoc *psoc);
409
410 /**
411 * ucfg_policy_mgr_is_hw_sbs_capable() - Check if HW is SBS capable
412 * @psoc: pointer to psoc
413 *
414 * This API is to check if the HW is SBS capable.
415 *
416 * Return: true if the HW is SBS capable
417 */
418 bool ucfg_policy_mgr_is_hw_sbs_capable(struct wlan_objmgr_psoc *psoc);
419
420 /*
421 * ucfg_policy_mgr_get_vdev_same_freq_new_conn() - Get vdev_id of the first
422 * connection that has same
423 * channel frequency as new_freq
424 * @psoc: psoc object pointer
425 * @new_freq: channel frequency for the new connection
426 * @vdev_id: Output parameter to return vdev id of the first existing connection
427 * that has same channel frequency as @new_freq
428 *
429 * This function is to return the first connection that has same
430 * channel frequency as @new_freq.
431 *
432 * Return: true if connection that has same channel frequency as
433 * @new_freq exists. Otherwise false.
434 */
435 bool ucfg_policy_mgr_get_vdev_same_freq_new_conn(struct wlan_objmgr_psoc *psoc,
436 uint32_t new_freq,
437 uint8_t *vdev_id);
438 /*
439 * ucfg_policy_mgr_get_vdev_diff_freq_new_conn() - Get vdev id of the first
440 * connection that has different
441 * channel freq from new_freq
442 * @psoc: psoc object pointer
443 * @new_freq: channel frequency for the new connection
444 * @vdev_id: Output parameter to return vdev id of the first existing connection
445 * that has different channel frequency from @new_freq
446 *
447 * This function is to return the first connection that has different
448 * channel frequency from @new_freq.
449 *
450 * Return: true if connection that has different channel frequency from
451 * @new_freq exists. Otherwise false.
452 */
453 bool ucfg_policy_mgr_get_vdev_diff_freq_new_conn(struct wlan_objmgr_psoc *psoc,
454 uint32_t new_freq,
455 uint8_t *vdev_id);
456
457 /**
458 * ucfg_policy_mgr_get_dbs_hw_modes() - to get the DBS HW modes
459 *
460 * @psoc: pointer to psoc
461 * @one_by_one_dbs: 1x1 DBS capability of HW
462 * @two_by_two_dbs: 2x2 DBS capability of HW
463 *
464 * Return: Failure in case of error otherwise success
465 */
466 QDF_STATUS ucfg_policy_mgr_get_dbs_hw_modes(struct wlan_objmgr_psoc *psoc,
467 bool *one_by_one_dbs,
468 bool *two_by_two_dbs);
469
470 #endif //__WLAN_POLICY_MGR_UCFG
471