xref: /wlan-driver/qcacld-3.0/components/fw_offload/dispatcher/src/wlan_fwol_ucfg_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc) !
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 /**
20  * DOC: define internal APIs related to the fwol component
21  */
22 
23 #include "wlan_fw_offload_main.h"
24 #include "wlan_fwol_public_structs.h"
25 #include "wlan_fwol_ucfg_api.h"
26 #include "wlan_fwol_tgt_api.h"
27 #include "target_if_fwol.h"
28 #include "wlan_objmgr_vdev_obj.h"
29 
ucfg_fwol_psoc_open(struct wlan_objmgr_psoc * psoc)30 QDF_STATUS ucfg_fwol_psoc_open(struct wlan_objmgr_psoc *psoc)
31 {
32 	QDF_STATUS status;
33 
34 	status = fwol_cfg_on_psoc_enable(psoc);
35 	if (QDF_IS_STATUS_ERROR(status))
36 		fwol_err("Failed to initialize FWOL CFG");
37 
38 	return status;
39 }
40 
ucfg_fwol_psoc_close(struct wlan_objmgr_psoc * psoc)41 void ucfg_fwol_psoc_close(struct wlan_objmgr_psoc *psoc)
42 {
43 	/* Clear the FWOL CFG Structure */
44 }
45 
ucfg_fwol_psoc_enable(struct wlan_objmgr_psoc * psoc)46 QDF_STATUS ucfg_fwol_psoc_enable(struct wlan_objmgr_psoc *psoc)
47 {
48 	tgt_fwol_register_ev_handler(psoc);
49 
50 	return QDF_STATUS_SUCCESS;
51 }
52 
ucfg_fwol_psoc_disable(struct wlan_objmgr_psoc * psoc)53 void ucfg_fwol_psoc_disable(struct wlan_objmgr_psoc *psoc)
54 {
55 	tgt_fwol_unregister_ev_handler(psoc);
56 }
57 
58 /**
59  * fwol_psoc_object_created_notification(): fwol psoc create handler
60  * @psoc: psoc which is going to created by objmgr
61  * @arg: argument for vdev create handler
62  *
63  * Register this api with objmgr to detect psoc is created
64  *
65  * Return QDF_STATUS status in case of success else return error
66  */
67 static QDF_STATUS
fwol_psoc_object_created_notification(struct wlan_objmgr_psoc * psoc,void * arg)68 fwol_psoc_object_created_notification(struct wlan_objmgr_psoc *psoc, void *arg)
69 {
70 	QDF_STATUS status;
71 	struct wlan_fwol_psoc_obj *fwol_obj;
72 
73 	fwol_obj = qdf_mem_malloc(sizeof(*fwol_obj));
74 	if (!fwol_obj)
75 		return QDF_STATUS_E_NOMEM;
76 
77 	status = wlan_objmgr_psoc_component_obj_attach(psoc,
78 						       WLAN_UMAC_COMP_FWOL,
79 						       fwol_obj,
80 						       QDF_STATUS_SUCCESS);
81 	if (QDF_IS_STATUS_ERROR(status)) {
82 		fwol_err("Failed to attach psoc_ctx with psoc");
83 		qdf_mem_free(fwol_obj);
84 		return status;
85 	}
86 
87 	tgt_fwol_register_rx_ops(&fwol_obj->rx_ops);
88 	target_if_fwol_register_tx_ops(&fwol_obj->tx_ops);
89 
90 	return status;
91 }
92 
93 /**
94  * fwol_psoc_object_destroyed_notification(): fwol psoc delete handler
95  * @psoc: psoc which is going to delete by objmgr
96  * @arg: argument for vdev delete handler
97  *
98  * Register this api with objmgr to detect psoc is deleted
99  *
100  * Return QDF_STATUS status in case of success else return error
101  */
fwol_psoc_object_destroyed_notification(struct wlan_objmgr_psoc * psoc,void * arg)102 static QDF_STATUS fwol_psoc_object_destroyed_notification(
103 		struct wlan_objmgr_psoc *psoc, void *arg)
104 {
105 	struct wlan_fwol_psoc_obj *fwol_obj;
106 	QDF_STATUS status;
107 
108 	fwol_obj = fwol_get_psoc_obj(psoc);
109 	if (!fwol_obj)
110 		return QDF_STATUS_E_NOMEM;
111 
112 	status = wlan_objmgr_psoc_component_obj_detach(psoc,
113 						       WLAN_UMAC_COMP_FWOL,
114 						       fwol_obj);
115 	if (QDF_IS_STATUS_ERROR(status)) {
116 		fwol_err("Failed to detach psoc_ctx from psoc");
117 		return status;
118 	}
119 
120 	qdf_mem_free(fwol_obj);
121 
122 	return status;
123 }
124 
ucfg_fwol_init(void)125 QDF_STATUS ucfg_fwol_init(void)
126 {
127 	QDF_STATUS status;
128 
129 	status = wlan_objmgr_register_psoc_create_handler(
130 			WLAN_UMAC_COMP_FWOL,
131 			fwol_psoc_object_created_notification,
132 			NULL);
133 	if (QDF_IS_STATUS_ERROR(status)) {
134 		fwol_err("unable to register psoc create handle");
135 		return status;
136 	}
137 
138 	status = wlan_objmgr_register_psoc_destroy_handler(
139 			WLAN_UMAC_COMP_FWOL,
140 			fwol_psoc_object_destroyed_notification,
141 			NULL);
142 	if (QDF_IS_STATUS_ERROR(status)) {
143 		fwol_err("unable to register psoc create handle");
144 		wlan_objmgr_unregister_psoc_create_handler(
145 			WLAN_UMAC_COMP_FWOL,
146 			fwol_psoc_object_created_notification,
147 			NULL);
148 	}
149 
150 	return status;
151 }
152 
ucfg_fwol_deinit(void)153 void ucfg_fwol_deinit(void)
154 {
155 	QDF_STATUS status;
156 
157 	status = wlan_objmgr_unregister_psoc_destroy_handler(
158 			WLAN_UMAC_COMP_FWOL,
159 			fwol_psoc_object_destroyed_notification,
160 			NULL);
161 	if (QDF_IS_STATUS_ERROR(status))
162 		fwol_err("unable to unregister psoc destroy handle");
163 
164 	status = wlan_objmgr_unregister_psoc_create_handler(
165 			WLAN_UMAC_COMP_FWOL,
166 			fwol_psoc_object_created_notification,
167 			NULL);
168 	if (QDF_IS_STATUS_ERROR(status))
169 		fwol_err("unable to unregister psoc create handle");
170 }
171 
172 #ifdef FW_THERMAL_THROTTLE_SUPPORT
ucfg_fwol_thermal_register_callbacks(struct wlan_objmgr_psoc * psoc,struct fwol_thermal_callbacks * cb)173 QDF_STATUS ucfg_fwol_thermal_register_callbacks(
174 				struct wlan_objmgr_psoc *psoc,
175 				struct fwol_thermal_callbacks *cb)
176 {
177 	struct wlan_fwol_psoc_obj *fwol_obj;
178 
179 	fwol_obj = fwol_get_psoc_obj(psoc);
180 	if (!fwol_obj) {
181 		fwol_err("Failed to get fwol obj");
182 		return QDF_STATUS_E_FAILURE;
183 	}
184 	fwol_obj->thermal_cbs = *cb;
185 
186 	return QDF_STATUS_SUCCESS;
187 }
188 
ucfg_fwol_thermal_unregister_callbacks(struct wlan_objmgr_psoc * psoc)189 QDF_STATUS ucfg_fwol_thermal_unregister_callbacks(
190 				struct wlan_objmgr_psoc *psoc)
191 {
192 	struct wlan_fwol_psoc_obj *fwol_obj;
193 
194 	fwol_obj = fwol_get_psoc_obj(psoc);
195 	if (!fwol_obj) {
196 		fwol_err("Failed to get fwol obj");
197 		return QDF_STATUS_E_FAILURE;
198 	}
199 	qdf_mem_zero(&fwol_obj->thermal_cbs, sizeof(fwol_obj->thermal_cbs));
200 
201 	return QDF_STATUS_SUCCESS;
202 }
203 
204 QDF_STATUS
ucfg_fwol_thermal_get_target_level(struct wlan_objmgr_psoc * psoc,enum thermal_throttle_level * level)205 ucfg_fwol_thermal_get_target_level(struct wlan_objmgr_psoc *psoc,
206 				   enum thermal_throttle_level *level)
207 {
208 	struct wlan_fwol_psoc_obj *fwol_obj;
209 
210 	fwol_obj = fwol_get_psoc_obj(psoc);
211 	if (!fwol_obj) {
212 		fwol_err("Failed to get fwol obj");
213 		return QDF_STATUS_E_FAILURE;
214 	}
215 	*level = fwol_obj->thermal_throttle.level;
216 
217 	return QDF_STATUS_SUCCESS;
218 }
219 #endif
220 
221 QDF_STATUS
ucfg_fwol_get_coex_config_params(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_coex_config * coex_config)222 ucfg_fwol_get_coex_config_params(struct wlan_objmgr_psoc *psoc,
223 				 struct wlan_fwol_coex_config *coex_config)
224 {
225 	struct wlan_fwol_psoc_obj *fwol_obj;
226 
227 	fwol_obj = fwol_get_psoc_obj(psoc);
228 	if (!fwol_obj) {
229 		fwol_err("Failed to get fwol obj");
230 		return QDF_STATUS_E_FAILURE;
231 	}
232 
233 	*coex_config = fwol_obj->cfg.coex_config;
234 
235 	return QDF_STATUS_SUCCESS;
236 }
237 
238 QDF_STATUS
ucfg_fwol_get_thermal_temp(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_thermal_temp * thermal_info)239 ucfg_fwol_get_thermal_temp(struct wlan_objmgr_psoc *psoc,
240 			   struct wlan_fwol_thermal_temp *thermal_info)
241 {
242 	struct wlan_fwol_psoc_obj *fwol_obj;
243 
244 	fwol_obj = fwol_get_psoc_obj(psoc);
245 	if (!fwol_obj) {
246 		fwol_err("Failed to get fwol obj");
247 		return QDF_STATUS_E_FAILURE;
248 	}
249 
250 	*thermal_info = fwol_obj->cfg.thermal_temp_cfg;
251 
252 	return QDF_STATUS_SUCCESS;
253 }
254 
255 QDF_STATUS
ucfg_fwol_is_neighbor_report_req_supported(struct wlan_objmgr_psoc * psoc,bool * neighbor_report_req)256 ucfg_fwol_is_neighbor_report_req_supported(struct wlan_objmgr_psoc *psoc,
257 					   bool *neighbor_report_req)
258 {
259 	struct wlan_fwol_psoc_obj *fwol_obj;
260 
261 	fwol_obj = fwol_get_psoc_obj(psoc);
262 	if (!fwol_obj) {
263 		fwol_err("Failed to get fwol obj");
264 		*neighbor_report_req =
265 			 !!(cfg_get(psoc,
266 			    CFG_OFFLOAD_11K_ENABLE_BITMASK) &
267 			    OFFLOAD_11K_BITMASK_NEIGHBOR_REPORT_REQUEST);
268 		return QDF_STATUS_E_FAILURE;
269 	}
270 
271 	*neighbor_report_req =
272 		!!(fwol_obj->cfg.neighbor_report_cfg.enable_bitmask &
273 		   OFFLOAD_11K_BITMASK_NEIGHBOR_REPORT_REQUEST);
274 
275 	return QDF_STATUS_SUCCESS;
276 }
277 
278 QDF_STATUS
ucfg_fwol_get_ie_allowlist(struct wlan_objmgr_psoc * psoc,bool * ie_allowlist)279 ucfg_fwol_get_ie_allowlist(struct wlan_objmgr_psoc *psoc, bool *ie_allowlist)
280 {
281 	struct wlan_fwol_psoc_obj *fwol_obj;
282 
283 	fwol_obj = fwol_get_psoc_obj(psoc);
284 	if (!fwol_obj) {
285 		fwol_err("Failed to get fwol obj");
286 		return QDF_STATUS_E_FAILURE;
287 	}
288 
289 	*ie_allowlist = fwol_obj->cfg.ie_allowlist_cfg.ie_allowlist;
290 
291 	return QDF_STATUS_SUCCESS;
292 }
293 
294 QDF_STATUS
ucfg_fwol_set_ie_allowlist(struct wlan_objmgr_psoc * psoc,bool ie_allowlist)295 ucfg_fwol_set_ie_allowlist(struct wlan_objmgr_psoc *psoc, bool ie_allowlist)
296 {
297 	struct wlan_fwol_psoc_obj *fwol_obj;
298 
299 	fwol_obj = fwol_get_psoc_obj(psoc);
300 	if (!fwol_obj) {
301 		fwol_err("Failed to get fwol obj");
302 		return QDF_STATUS_E_FAILURE;
303 	}
304 
305 	fwol_obj->cfg.ie_allowlist_cfg.ie_allowlist = ie_allowlist;
306 
307 	return QDF_STATUS_SUCCESS;
308 }
309 
ucfg_fwol_get_ani_enabled(struct wlan_objmgr_psoc * psoc,bool * ani_enabled)310 QDF_STATUS ucfg_fwol_get_ani_enabled(struct wlan_objmgr_psoc *psoc,
311 				     bool *ani_enabled)
312 {
313 	struct wlan_fwol_psoc_obj *fwol_obj;
314 
315 	fwol_obj = fwol_get_psoc_obj(psoc);
316 	if (!fwol_obj) {
317 		fwol_err("Failed to get FWOL obj");
318 		return QDF_STATUS_E_FAILURE;
319 	}
320 
321 	*ani_enabled = fwol_obj->cfg.ani_enabled;
322 	return QDF_STATUS_SUCCESS;
323 }
324 
ucfg_fwol_get_pcie_config(struct wlan_objmgr_psoc * psoc,uint8_t * pcie_config)325 QDF_STATUS ucfg_fwol_get_pcie_config(struct wlan_objmgr_psoc *psoc,
326 				     uint8_t *pcie_config)
327 {
328 	struct wlan_fwol_psoc_obj *fwol_obj;
329 
330 	fwol_obj = fwol_get_psoc_obj(psoc);
331 	if (!fwol_obj) {
332 		fwol_err("Failed to get FWOL obj");
333 		return QDF_STATUS_E_FAILURE;
334 	}
335 
336 	*pcie_config = fwol_obj->cfg.pcie_config;
337 	return QDF_STATUS_SUCCESS;
338 }
339 
ucfg_fwol_get_ilp_config(struct wlan_objmgr_psoc * psoc,uint32_t * enable_ilp)340 static QDF_STATUS ucfg_fwol_get_ilp_config(struct wlan_objmgr_psoc *psoc,
341 					   uint32_t *enable_ilp)
342 {
343 	struct wlan_fwol_psoc_obj *fwol_obj;
344 
345 	fwol_obj = fwol_get_psoc_obj(psoc);
346 	if (!fwol_obj) {
347 		fwol_err("Failed to get FWOL obj");
348 		return QDF_STATUS_E_FAILURE;
349 	}
350 
351 	*enable_ilp = fwol_obj->cfg.enable_ilp;
352 	return QDF_STATUS_SUCCESS;
353 }
354 
ucfg_fwol_get_sap_sho(struct wlan_objmgr_psoc * psoc,uint32_t * sap_sho)355 static QDF_STATUS ucfg_fwol_get_sap_sho(struct wlan_objmgr_psoc *psoc,
356 					uint32_t *sap_sho)
357 {
358 	struct wlan_fwol_psoc_obj *fwol_obj;
359 
360 	fwol_obj = fwol_get_psoc_obj(psoc);
361 	if (!fwol_obj) {
362 		fwol_err("Failed to get FWOL obj");
363 		return QDF_STATUS_E_FAILURE;
364 	}
365 
366 	*sap_sho = fwol_obj->cfg.sap_sho;
367 	return QDF_STATUS_SUCCESS;
368 }
369 
ucfg_fwol_get_hw_assist_config(struct wlan_objmgr_psoc * psoc,bool * disable_hw_assist)370 static QDF_STATUS ucfg_fwol_get_hw_assist_config(struct wlan_objmgr_psoc *psoc,
371 						 bool *disable_hw_assist)
372 {
373 	struct wlan_fwol_psoc_obj *fwol_obj;
374 
375 	fwol_obj = fwol_get_psoc_obj(psoc);
376 	if (!fwol_obj) {
377 		fwol_err("Failed to get FWOL obj");
378 		return QDF_STATUS_E_FAILURE;
379 	}
380 
381 	*disable_hw_assist = fwol_obj->cfg.disable_hw_assist;
382 	return QDF_STATUS_SUCCESS;
383 }
384 
ucfg_get_enable_rts_sifsbursting(struct wlan_objmgr_psoc * psoc,bool * enable_rts_sifsbursting)385 QDF_STATUS ucfg_get_enable_rts_sifsbursting(struct wlan_objmgr_psoc *psoc,
386 					    bool *enable_rts_sifsbursting)
387 {
388 	struct wlan_fwol_psoc_obj *fwol_obj;
389 
390 	fwol_obj = fwol_get_psoc_obj(psoc);
391 	if (!fwol_obj) {
392 		fwol_err("Failed to get FWOL obj");
393 		return QDF_STATUS_E_FAILURE;
394 	}
395 
396 	*enable_rts_sifsbursting = fwol_obj->cfg.enable_rts_sifsbursting;
397 	return QDF_STATUS_SUCCESS;
398 }
399 
ucfg_get_enable_sifs_burst(struct wlan_objmgr_psoc * psoc,uint8_t * enable_sifs_burst)400 QDF_STATUS ucfg_get_enable_sifs_burst(struct wlan_objmgr_psoc *psoc,
401 				      uint8_t *enable_sifs_burst)
402 {
403 	struct wlan_fwol_psoc_obj *fwol_obj;
404 
405 	fwol_obj = fwol_get_psoc_obj(psoc);
406 	if (!fwol_obj) {
407 		fwol_err("Failed to get FWOL obj");
408 		return QDF_STATUS_E_FAILURE;
409 	}
410 
411 	*enable_sifs_burst = fwol_obj->cfg.enable_sifs_burst;
412 	return QDF_STATUS_SUCCESS;
413 }
414 
ucfg_get_max_mpdus_inampdu(struct wlan_objmgr_psoc * psoc,uint8_t * max_mpdus_inampdu)415 QDF_STATUS ucfg_get_max_mpdus_inampdu(struct wlan_objmgr_psoc *psoc,
416 				      uint8_t *max_mpdus_inampdu)
417 {
418 	struct wlan_fwol_psoc_obj *fwol_obj;
419 
420 	fwol_obj = fwol_get_psoc_obj(psoc);
421 	if (!fwol_obj) {
422 		fwol_err("Failed to get FWOL obj");
423 		return QDF_STATUS_E_FAILURE;
424 	}
425 
426 	*max_mpdus_inampdu = fwol_obj->cfg.max_mpdus_inampdu;
427 	return QDF_STATUS_SUCCESS;
428 }
429 
ucfg_get_enable_phy_reg_retention(struct wlan_objmgr_psoc * psoc,uint8_t * enable_phy_reg_retention)430 QDF_STATUS ucfg_get_enable_phy_reg_retention(struct wlan_objmgr_psoc *psoc,
431 					     uint8_t *enable_phy_reg_retention)
432 {
433 	struct wlan_fwol_psoc_obj *fwol_obj;
434 
435 	fwol_obj = fwol_get_psoc_obj(psoc);
436 	if (!fwol_obj) {
437 		fwol_err("Failed to get FWOL obj");
438 		return QDF_STATUS_E_FAILURE;
439 	}
440 
441 	*enable_phy_reg_retention = fwol_obj->cfg.enable_phy_reg_retention;
442 	return QDF_STATUS_SUCCESS;
443 }
444 
445 QDF_STATUS
ucfg_fwol_get_all_allowlist_params(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_ie_allowlist * allowlist)446 ucfg_fwol_get_all_allowlist_params(struct wlan_objmgr_psoc *psoc,
447 				   struct wlan_fwol_ie_allowlist *allowlist)
448 {
449 	struct wlan_fwol_psoc_obj *fwol_obj;
450 
451 	fwol_obj = fwol_get_psoc_obj(psoc);
452 	if (!fwol_obj) {
453 		fwol_err("Failed to get fwol obj");
454 		return QDF_STATUS_E_FAILURE;
455 	}
456 
457 	*allowlist = fwol_obj->cfg.ie_allowlist_cfg;
458 	return QDF_STATUS_SUCCESS;
459 }
460 
ucfg_get_upper_brssi_thresh(struct wlan_objmgr_psoc * psoc,uint16_t * upper_brssi_thresh)461 QDF_STATUS ucfg_get_upper_brssi_thresh(struct wlan_objmgr_psoc *psoc,
462 				       uint16_t *upper_brssi_thresh)
463 {
464 	struct wlan_fwol_psoc_obj *fwol_obj;
465 
466 	fwol_obj = fwol_get_psoc_obj(psoc);
467 	if (!fwol_obj) {
468 		fwol_err("Failed to get FWOL obj");
469 		return QDF_STATUS_E_FAILURE;
470 	}
471 
472 	*upper_brssi_thresh = fwol_obj->cfg.upper_brssi_thresh;
473 	return QDF_STATUS_SUCCESS;
474 }
475 
ucfg_get_lower_brssi_thresh(struct wlan_objmgr_psoc * psoc,uint16_t * lower_brssi_thresh)476 QDF_STATUS ucfg_get_lower_brssi_thresh(struct wlan_objmgr_psoc *psoc,
477 				       uint16_t *lower_brssi_thresh)
478 {
479 	struct wlan_fwol_psoc_obj *fwol_obj;
480 
481 	fwol_obj = fwol_get_psoc_obj(psoc);
482 	if (!fwol_obj) {
483 		fwol_err("Failed to get FWOL obj");
484 		return QDF_STATUS_E_FAILURE;
485 	}
486 
487 	*lower_brssi_thresh = fwol_obj->cfg.lower_brssi_thresh;
488 	return QDF_STATUS_SUCCESS;
489 }
490 
ucfg_get_enable_dtim_1chrx(struct wlan_objmgr_psoc * psoc,bool * enable_dtim_1chrx)491 QDF_STATUS ucfg_get_enable_dtim_1chrx(struct wlan_objmgr_psoc *psoc,
492 				      bool *enable_dtim_1chrx)
493 {
494 	struct wlan_fwol_psoc_obj *fwol_obj;
495 
496 	fwol_obj = fwol_get_psoc_obj(psoc);
497 	if (!fwol_obj) {
498 		fwol_err("Failed to get FWOL obj");
499 		return QDF_STATUS_E_FAILURE;
500 	}
501 
502 	*enable_dtim_1chrx = fwol_obj->cfg.enable_dtim_1chrx;
503 	return QDF_STATUS_SUCCESS;
504 }
505 
506 QDF_STATUS
ucfg_get_alternative_chainmask_enabled(struct wlan_objmgr_psoc * psoc,bool * alternative_chainmask_enabled)507 ucfg_get_alternative_chainmask_enabled(struct wlan_objmgr_psoc *psoc,
508 				       bool *alternative_chainmask_enabled)
509 {
510 	struct wlan_fwol_psoc_obj *fwol_obj;
511 
512 	fwol_obj = fwol_get_psoc_obj(psoc);
513 	if (!fwol_obj) {
514 		fwol_err("Failed to get fwol obj");
515 		return QDF_STATUS_E_FAILURE;
516 	}
517 
518 	*alternative_chainmask_enabled =
519 				fwol_obj->cfg.alternative_chainmask_enabled;
520 	return QDF_STATUS_SUCCESS;
521 }
522 
ucfg_get_smart_chainmask_enabled(struct wlan_objmgr_psoc * psoc,bool * smart_chainmask_enabled)523 QDF_STATUS ucfg_get_smart_chainmask_enabled(struct wlan_objmgr_psoc *psoc,
524 					    bool *smart_chainmask_enabled)
525 {
526 	struct wlan_fwol_psoc_obj *fwol_obj;
527 
528 	fwol_obj = fwol_get_psoc_obj(psoc);
529 	if (!fwol_obj) {
530 		fwol_err("Failed to get FWOL obj");
531 		return QDF_STATUS_E_FAILURE;
532 	}
533 
534 	*smart_chainmask_enabled =
535 				fwol_obj->cfg.smart_chainmask_enabled;
536 	return QDF_STATUS_SUCCESS;
537 }
538 
ucfg_fwol_get_rts_profile(struct wlan_objmgr_psoc * psoc,uint16_t * get_rts_profile)539 QDF_STATUS ucfg_fwol_get_rts_profile(struct wlan_objmgr_psoc *psoc,
540 				     uint16_t *get_rts_profile)
541 {
542 	struct wlan_fwol_psoc_obj *fwol_obj;
543 
544 	fwol_obj = fwol_get_psoc_obj(psoc);
545 	if (!fwol_obj) {
546 		fwol_err("Failed to get FWOL obj");
547 		return QDF_STATUS_E_FAILURE;
548 	}
549 
550 	*get_rts_profile = fwol_obj->cfg.get_rts_profile;
551 	return QDF_STATUS_SUCCESS;
552 }
553 
ucfg_fwol_get_enable_fw_log_level(struct wlan_objmgr_psoc * psoc,uint16_t * enable_fw_log_level)554 QDF_STATUS ucfg_fwol_get_enable_fw_log_level(struct wlan_objmgr_psoc *psoc,
555 					     uint16_t *enable_fw_log_level)
556 {
557 	struct wlan_fwol_psoc_obj *fwol_obj;
558 
559 	fwol_obj = fwol_get_psoc_obj(psoc);
560 	if (!fwol_obj) {
561 		fwol_err("Failed to get FWOL obj");
562 		return QDF_STATUS_E_FAILURE;
563 	}
564 
565 	*enable_fw_log_level = fwol_obj->cfg.enable_fw_log_level;
566 	return QDF_STATUS_SUCCESS;
567 }
568 
ucfg_fwol_get_enable_fw_log_type(struct wlan_objmgr_psoc * psoc,uint16_t * enable_fw_log_type)569 QDF_STATUS ucfg_fwol_get_enable_fw_log_type(struct wlan_objmgr_psoc *psoc,
570 					    uint16_t *enable_fw_log_type)
571 {
572 	struct wlan_fwol_psoc_obj *fwol_obj;
573 
574 	fwol_obj = fwol_get_psoc_obj(psoc);
575 	if (!fwol_obj) {
576 		fwol_err("Failed to get FWOL obj");
577 		return QDF_STATUS_E_FAILURE;
578 	}
579 
580 	*enable_fw_log_type = fwol_obj->cfg.enable_fw_log_type;
581 	return QDF_STATUS_SUCCESS;
582 }
583 
ucfg_fwol_get_enable_fw_module_log_level(struct wlan_objmgr_psoc * psoc,uint8_t ** enable_fw_module_log_level,uint8_t * enable_fw_module_log_level_num)584 QDF_STATUS ucfg_fwol_get_enable_fw_module_log_level(
585 				struct wlan_objmgr_psoc *psoc,
586 				uint8_t **enable_fw_module_log_level,
587 				uint8_t *enable_fw_module_log_level_num)
588 {
589 	struct wlan_fwol_psoc_obj *fwol_obj;
590 
591 	fwol_obj = fwol_get_psoc_obj(psoc);
592 	if (!fwol_obj) {
593 		fwol_err("Failed to get FWOL obj");
594 		return QDF_STATUS_E_FAILURE;
595 	}
596 
597 	*enable_fw_module_log_level = fwol_obj->cfg.enable_fw_module_log_level;
598 	*enable_fw_module_log_level_num =
599 				fwol_obj->cfg.enable_fw_module_log_level_num;
600 	return QDF_STATUS_SUCCESS;
601 }
602 
ucfg_fwol_wow_get_enable_fw_module_log_level(struct wlan_objmgr_psoc * psoc,uint8_t ** enable_fw_wow_module_log_level,uint8_t * enable_fw_wow_module_log_level_num)603 QDF_STATUS ucfg_fwol_wow_get_enable_fw_module_log_level(
604 				struct wlan_objmgr_psoc *psoc,
605 				uint8_t **enable_fw_wow_module_log_level,
606 				uint8_t *enable_fw_wow_module_log_level_num)
607 {
608 	struct wlan_fwol_psoc_obj *fwol_obj;
609 
610 	fwol_obj = fwol_get_psoc_obj(psoc);
611 	if (!fwol_obj) {
612 		fwol_err("Failed to get FWOL obj");
613 		return QDF_STATUS_E_FAILURE;
614 	}
615 
616 	*enable_fw_wow_module_log_level =
617 				fwol_obj->cfg.enable_fw_mod_wow_log_level;
618 	*enable_fw_wow_module_log_level_num =
619 				fwol_obj->cfg.enable_fw_mod_wow_log_level_num;
620 	return QDF_STATUS_SUCCESS;
621 }
622 
ucfg_fwol_get_sap_xlna_bypass(struct wlan_objmgr_psoc * psoc,bool * sap_xlna_bypass)623 QDF_STATUS ucfg_fwol_get_sap_xlna_bypass(struct wlan_objmgr_psoc *psoc,
624 					 bool *sap_xlna_bypass)
625 {
626 	struct wlan_fwol_psoc_obj *fwol_obj;
627 
628 	fwol_obj = fwol_get_psoc_obj(psoc);
629 	if (!fwol_obj) {
630 		fwol_err("Failed to get FWOL obj");
631 		return QDF_STATUS_E_FAILURE;
632 	}
633 
634 	*sap_xlna_bypass = fwol_obj->cfg.sap_xlna_bypass;
635 	return QDF_STATUS_SUCCESS;
636 }
637 
638 #ifdef FEATURE_WLAN_RA_FILTERING
ucfg_fwol_set_is_rate_limit_enabled(struct wlan_objmgr_psoc * psoc,bool is_rate_limit_enabled)639 QDF_STATUS ucfg_fwol_set_is_rate_limit_enabled(struct wlan_objmgr_psoc *psoc,
640 					       bool is_rate_limit_enabled)
641 {
642 	struct wlan_fwol_psoc_obj *fwol_obj;
643 
644 	fwol_obj = fwol_get_psoc_obj(psoc);
645 	if (!fwol_obj) {
646 		fwol_err("Failed to get FWOL obj");
647 		return QDF_STATUS_E_FAILURE;
648 	}
649 
650 	fwol_obj->cfg.is_rate_limit_enabled = is_rate_limit_enabled;
651 	return QDF_STATUS_SUCCESS;
652 }
653 
ucfg_fwol_get_is_rate_limit_enabled(struct wlan_objmgr_psoc * psoc,bool * is_rate_limit_enabled)654 QDF_STATUS ucfg_fwol_get_is_rate_limit_enabled(struct wlan_objmgr_psoc *psoc,
655 					       bool *is_rate_limit_enabled)
656 {
657 	struct wlan_fwol_psoc_obj *fwol_obj;
658 
659 	fwol_obj = fwol_get_psoc_obj(psoc);
660 	if (!fwol_obj) {
661 		fwol_err("Failed to get FWOL obj");
662 		return QDF_STATUS_E_FAILURE;
663 	}
664 
665 	*is_rate_limit_enabled = fwol_obj->cfg.is_rate_limit_enabled;
666 	return QDF_STATUS_SUCCESS;
667 }
668 #endif
669 
670 #ifdef WLAN_FEATURE_TSF
ucfg_fwol_get_tsf_gpio_pin(struct wlan_objmgr_psoc * psoc,uint32_t * tsf_gpio_pin)671 QDF_STATUS ucfg_fwol_get_tsf_gpio_pin(struct wlan_objmgr_psoc *psoc,
672 				      uint32_t *tsf_gpio_pin)
673 {
674 	struct wlan_fwol_psoc_obj *fwol_obj;
675 
676 	fwol_obj = fwol_get_psoc_obj(psoc);
677 	if (!fwol_obj) {
678 		fwol_err("Failed to get FWOL obj");
679 		*tsf_gpio_pin = cfg_default(CFG_SET_TSF_GPIO_PIN);
680 		return QDF_STATUS_E_FAILURE;
681 	}
682 
683 	*tsf_gpio_pin = fwol_obj->cfg.tsf_gpio_pin;
684 	return QDF_STATUS_SUCCESS;
685 }
686 
687 #ifdef WLAN_FEATURE_TSF_PLUS
ucfg_fwol_get_tsf_ptp_options(struct wlan_objmgr_psoc * psoc,uint32_t * tsf_ptp_options)688 QDF_STATUS ucfg_fwol_get_tsf_ptp_options(struct wlan_objmgr_psoc *psoc,
689 					 uint32_t *tsf_ptp_options)
690 {
691 	struct wlan_fwol_psoc_obj *fwol_obj;
692 
693 	fwol_obj = fwol_get_psoc_obj(psoc);
694 	if (!fwol_obj) {
695 		fwol_err("Failed to get FWOL obj");
696 		*tsf_ptp_options = cfg_default(CFG_SET_TSF_PTP_OPT);
697 		return QDF_STATUS_E_FAILURE;
698 	}
699 
700 	*tsf_ptp_options = fwol_obj->cfg.tsf_ptp_options;
701 	return QDF_STATUS_SUCCESS;
702 }
703 
ucfg_fwol_get_tsf_sync_enable(struct wlan_objmgr_psoc * psoc,bool * tsf_sync_enable)704 QDF_STATUS ucfg_fwol_get_tsf_sync_enable(struct wlan_objmgr_psoc *psoc,
705 					 bool *tsf_sync_enable)
706 {
707 	struct wlan_fwol_psoc_obj *fwol_obj;
708 
709 	fwol_obj = fwol_get_psoc_obj(psoc);
710 	if (!fwol_obj) {
711 		fwol_err("Failed to get FWOL obj");
712 		*tsf_sync_enable = cfg_default(CFG_TSF_SYNC_ENABLE);
713 		return QDF_STATUS_E_FAILURE;
714 	}
715 
716 	*tsf_sync_enable = fwol_obj->cfg.tsf_sync_enable;
717 	return QDF_STATUS_SUCCESS;
718 }
719 
720 #ifdef WLAN_FEATURE_TSF_ACCURACY
ucfg_fwol_get_tsf_accuracy_configs(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_tsf_accuracy_configs ** config)721 QDF_STATUS ucfg_fwol_get_tsf_accuracy_configs(struct wlan_objmgr_psoc *psoc,
722 					      struct wlan_fwol_tsf_accuracy_configs **config)
723 {
724 	struct wlan_fwol_psoc_obj *fwol_obj;
725 
726 	fwol_obj = fwol_get_psoc_obj(psoc);
727 	if (!fwol_obj) {
728 		fwol_err("Failed to get FWOL obj");
729 		return QDF_STATUS_E_FAILURE;
730 	}
731 
732 	*config = &fwol_obj->cfg.tsf_accuracy_configs;
733 	return QDF_STATUS_SUCCESS;
734 }
735 #endif
736 
737 #ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_IRQ
738 QDF_STATUS
ucfg_fwol_get_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc * psoc,uint32_t * tsf_irq_host_gpio_pin)739 ucfg_fwol_get_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
740 				    uint32_t *tsf_irq_host_gpio_pin)
741 {
742 	struct wlan_fwol_psoc_obj *fwol_obj;
743 
744 	fwol_obj = fwol_get_psoc_obj(psoc);
745 	if (!fwol_obj) {
746 		fwol_err("Failed to get FWOL obj");
747 		*tsf_irq_host_gpio_pin =
748 			cfg_default(CFG_SET_TSF_IRQ_HOST_GPIO_PIN);
749 		return QDF_STATUS_E_FAILURE;
750 	}
751 
752 	*tsf_irq_host_gpio_pin = fwol_obj->cfg.tsf_irq_host_gpio_pin;
753 	return QDF_STATUS_SUCCESS;
754 }
755 
756 #endif
757 
758 #ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC
759 QDF_STATUS
ucfg_fwol_get_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc * psoc,uint32_t * tsf_sync_host_gpio_pin)760 ucfg_fwol_get_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
761 				     uint32_t *tsf_sync_host_gpio_pin)
762 {
763 	struct wlan_fwol_psoc_obj *fwol_obj;
764 
765 	fwol_obj = fwol_get_psoc_obj(psoc);
766 	if (!fwol_obj) {
767 		fwol_err("Failed to get FWOL obj");
768 		*tsf_sync_host_gpio_pin =
769 			cfg_default(CFG_SET_TSF_SYNC_HOST_GPIO_PIN);
770 		return QDF_STATUS_E_FAILURE;
771 	}
772 
773 	*tsf_sync_host_gpio_pin = fwol_obj->cfg.tsf_sync_host_gpio_pin;
774 	return QDF_STATUS_SUCCESS;
775 }
776 
777 #endif
778 #endif
779 #else
ucfg_fwol_get_tsf_gpio_pin(struct wlan_objmgr_psoc * psoc,uint32_t * tsf_gpio_pin)780 QDF_STATUS ucfg_fwol_get_tsf_gpio_pin(struct wlan_objmgr_psoc *psoc,
781 				      uint32_t *tsf_gpio_pin)
782 {
783 	return QDF_STATUS_SUCCESS;
784 }
785 
ucfg_fwol_get_tsf_ptp_options(struct wlan_objmgr_psoc * psoc,uint32_t * tsf_ptp_options)786 QDF_STATUS ucfg_fwol_get_tsf_ptp_options(struct wlan_objmgr_psoc *psoc,
787 					 uint32_t *tsf_ptp_options)
788 {
789 	return QDF_STATUS_E_NOSUPPORT;
790 }
791 
792 #endif
793 
794 #ifdef WLAN_FEATURE_SAE
ucfg_fwol_get_sae_enable(struct wlan_objmgr_psoc * psoc)795 bool ucfg_fwol_get_sae_enable(struct wlan_objmgr_psoc *psoc)
796 {
797 	return cfg_get(psoc, CFG_IS_SAE_ENABLED);
798 }
799 
800 #else
ucfg_fwol_get_sae_enable(struct wlan_objmgr_psoc * psoc)801 bool ucfg_fwol_get_sae_enable(struct wlan_objmgr_psoc *psoc)
802 {
803 	return false;
804 }
805 #endif
806 
ucfg_fwol_get_gcmp_enable(struct wlan_objmgr_psoc * psoc)807 bool ucfg_fwol_get_gcmp_enable(struct wlan_objmgr_psoc *psoc)
808 {
809 	return cfg_get(psoc, CFG_ENABLE_GCMP);
810 }
811 
ucfg_fwol_get_enable_tx_sch_delay(struct wlan_objmgr_psoc * psoc,uint8_t * enable_tx_sch_delay)812 QDF_STATUS ucfg_fwol_get_enable_tx_sch_delay(struct wlan_objmgr_psoc *psoc,
813 					     uint8_t *enable_tx_sch_delay)
814 {
815 	struct wlan_fwol_psoc_obj *fwol_obj;
816 
817 	fwol_obj = fwol_get_psoc_obj(psoc);
818 	if (!fwol_obj) {
819 		fwol_err("Failed to get FWOL obj");
820 		*enable_tx_sch_delay = cfg_default(CFG_TX_SCH_DELAY);
821 		return QDF_STATUS_E_FAILURE;
822 	}
823 
824 	*enable_tx_sch_delay = fwol_obj->cfg.enable_tx_sch_delay;
825 	return QDF_STATUS_SUCCESS;
826 }
827 
828 #ifdef WLAN_FEATURE_OFDM_SCRAMBLER_SEED
ucfg_fwol_get_ofdm_scrambler_seed(struct wlan_objmgr_psoc * psoc,bool * enable_ofdm_scrambler_seed)829 QDF_STATUS ucfg_fwol_get_ofdm_scrambler_seed(struct wlan_objmgr_psoc *psoc,
830 					     bool *enable_ofdm_scrambler_seed)
831 {
832 	struct wlan_fwol_psoc_obj *fwol_obj;
833 
834 	fwol_obj = fwol_get_psoc_obj(psoc);
835 	if (!fwol_obj) {
836 		*enable_ofdm_scrambler_seed =
837 				cfg_default(CFG_ENABLE_OFDM_SCRAMBLER_SEED);
838 		return QDF_STATUS_E_FAILURE;
839 	}
840 
841 	*enable_ofdm_scrambler_seed =
842 				fwol_obj->cfg.enable_ofdm_scrambler_seed;
843 
844 	return QDF_STATUS_SUCCESS;
845 }
846 #endif
847 
ucfg_fwol_get_enable_secondary_rate(struct wlan_objmgr_psoc * psoc,uint32_t * enable_secondary_rate)848 QDF_STATUS ucfg_fwol_get_enable_secondary_rate(struct wlan_objmgr_psoc *psoc,
849 					       uint32_t *enable_secondary_rate)
850 {
851 	struct wlan_fwol_psoc_obj *fwol_obj;
852 
853 	fwol_obj = fwol_get_psoc_obj(psoc);
854 	if (!fwol_obj) {
855 		fwol_err("Failed to get FWOL obj");
856 		*enable_secondary_rate = cfg_default(CFG_ENABLE_SECONDARY_RATE);
857 		return QDF_STATUS_E_FAILURE;
858 	}
859 
860 	*enable_secondary_rate = fwol_obj->cfg.enable_secondary_rate;
861 	return QDF_STATUS_SUCCESS;
862 }
863 
864 #ifdef DHCP_SERVER_OFFLOAD
865 QDF_STATUS
ucfg_fwol_get_enable_dhcp_server_offload(struct wlan_objmgr_psoc * psoc,bool * enable_dhcp_server_offload)866 ucfg_fwol_get_enable_dhcp_server_offload(struct wlan_objmgr_psoc *psoc,
867 					 bool *enable_dhcp_server_offload)
868 {
869 	struct wlan_fwol_psoc_obj *fwol_obj;
870 
871 	fwol_obj = fwol_get_psoc_obj(psoc);
872 	if (!fwol_obj) {
873 		fwol_err("Failed to get FWOL obj");
874 		return QDF_STATUS_E_FAILURE;
875 	}
876 
877 	*enable_dhcp_server_offload = fwol_obj->cfg.enable_dhcp_server_offload;
878 	return QDF_STATUS_SUCCESS;
879 }
880 
ucfg_fwol_get_dhcp_max_num_clients(struct wlan_objmgr_psoc * psoc,uint32_t * dhcp_max_num_clients)881 QDF_STATUS ucfg_fwol_get_dhcp_max_num_clients(struct wlan_objmgr_psoc *psoc,
882 					      uint32_t *dhcp_max_num_clients)
883 {
884 	struct wlan_fwol_psoc_obj *fwol_obj;
885 
886 	fwol_obj = fwol_get_psoc_obj(psoc);
887 	if (!fwol_obj) {
888 		fwol_err("Failed to get FWOL obj");
889 		return QDF_STATUS_E_FAILURE;
890 	}
891 
892 	*dhcp_max_num_clients = fwol_obj->cfg.dhcp_max_num_clients;
893 	return QDF_STATUS_SUCCESS;
894 }
895 
896 #endif
897 
898 QDF_STATUS
ucfg_fwol_get_all_adaptive_dwelltime_params(struct wlan_objmgr_psoc * psoc,struct adaptive_dwelltime_params * dwelltime_params)899 ucfg_fwol_get_all_adaptive_dwelltime_params(
900 			struct wlan_objmgr_psoc *psoc,
901 			struct adaptive_dwelltime_params *dwelltime_params)
902 {
903 	struct wlan_fwol_psoc_obj *fwol_obj;
904 
905 	fwol_obj = fwol_get_psoc_obj(psoc);
906 	if (!fwol_obj) {
907 		fwol_err("Failed to get fwol obj");
908 		return QDF_STATUS_E_FAILURE;
909 	}
910 
911 	*dwelltime_params = fwol_obj->cfg.dwelltime_params;
912 	return QDF_STATUS_SUCCESS;
913 }
914 
915 QDF_STATUS
ucfg_fwol_get_adaptive_dwell_mode_enabled(struct wlan_objmgr_psoc * psoc,bool * adaptive_dwell_mode_enabled)916 ucfg_fwol_get_adaptive_dwell_mode_enabled(
917 				struct wlan_objmgr_psoc *psoc,
918 				bool *adaptive_dwell_mode_enabled)
919 {
920 	struct wlan_fwol_psoc_obj *fwol_obj;
921 
922 	fwol_obj = fwol_get_psoc_obj(psoc);
923 	if (!fwol_obj) {
924 		fwol_err("Failed to get FWOL obj");
925 		return QDF_STATUS_E_FAILURE;
926 	}
927 
928 	*adaptive_dwell_mode_enabled =
929 			fwol_obj->cfg.dwelltime_params.is_enabled;
930 	return QDF_STATUS_SUCCESS;
931 }
932 
933 QDF_STATUS
ucfg_fwol_get_global_adapt_dwelltime_mode(struct wlan_objmgr_psoc * psoc,uint8_t * global_adapt_dwelltime_mode)934 ucfg_fwol_get_global_adapt_dwelltime_mode(struct wlan_objmgr_psoc *psoc,
935 					  uint8_t *global_adapt_dwelltime_mode)
936 {
937 	struct wlan_fwol_psoc_obj *fwol_obj;
938 
939 	fwol_obj = fwol_get_psoc_obj(psoc);
940 	if (!fwol_obj) {
941 		fwol_err("Failed to get FWOL obj");
942 		return QDF_STATUS_E_FAILURE;
943 	}
944 
945 	*global_adapt_dwelltime_mode =
946 			fwol_obj->cfg.dwelltime_params.dwelltime_mode;
947 	return QDF_STATUS_SUCCESS;
948 }
949 
950 QDF_STATUS
ucfg_fwol_get_adapt_dwell_lpf_weight(struct wlan_objmgr_psoc * psoc,uint8_t * adapt_dwell_lpf_weight)951 ucfg_fwol_get_adapt_dwell_lpf_weight(struct wlan_objmgr_psoc *psoc,
952 				     uint8_t *adapt_dwell_lpf_weight)
953 {
954 	struct wlan_fwol_psoc_obj *fwol_obj;
955 
956 	fwol_obj = fwol_get_psoc_obj(psoc);
957 	if (!fwol_obj) {
958 		fwol_err("Failed to get FWOL obj");
959 		return QDF_STATUS_E_FAILURE;
960 	}
961 
962 	*adapt_dwell_lpf_weight = fwol_obj->cfg.dwelltime_params.lpf_weight;
963 	return QDF_STATUS_SUCCESS;
964 }
965 
ucfg_fwol_get_adapt_dwell_passive_mon_intval(struct wlan_objmgr_psoc * psoc,uint8_t * adapt_dwell_passive_mon_intval)966 QDF_STATUS ucfg_fwol_get_adapt_dwell_passive_mon_intval(
967 				struct wlan_objmgr_psoc *psoc,
968 				uint8_t *adapt_dwell_passive_mon_intval)
969 {
970 	struct wlan_fwol_psoc_obj *fwol_obj;
971 
972 	fwol_obj = fwol_get_psoc_obj(psoc);
973 	if (!fwol_obj) {
974 		fwol_err("Failed to get FWOL obj");
975 		return QDF_STATUS_E_FAILURE;
976 	}
977 
978 	*adapt_dwell_passive_mon_intval =
979 			fwol_obj->cfg.dwelltime_params.passive_mon_intval;
980 	return QDF_STATUS_SUCCESS;
981 }
982 
ucfg_fwol_get_adapt_dwell_wifi_act_threshold(struct wlan_objmgr_psoc * psoc,uint8_t * adapt_dwell_wifi_act_threshold)983 QDF_STATUS ucfg_fwol_get_adapt_dwell_wifi_act_threshold(
984 				struct wlan_objmgr_psoc *psoc,
985 				uint8_t *adapt_dwell_wifi_act_threshold)
986 {
987 	struct wlan_fwol_psoc_obj *fwol_obj;
988 
989 	fwol_obj = fwol_get_psoc_obj(psoc);
990 	if (!fwol_obj) {
991 		fwol_err("Failed to get FWOL obj");
992 		return QDF_STATUS_E_FAILURE;
993 	}
994 
995 	*adapt_dwell_wifi_act_threshold =
996 			fwol_obj->cfg.dwelltime_params.wifi_act_threshold;
997 	return QDF_STATUS_SUCCESS;
998 }
999 
1000 #ifdef WLAN_FEATURE_ELNA
ucfg_fwol_set_elna_bypass(struct wlan_objmgr_vdev * vdev,struct set_elna_bypass_request * req)1001 QDF_STATUS ucfg_fwol_set_elna_bypass(struct wlan_objmgr_vdev *vdev,
1002 				     struct set_elna_bypass_request *req)
1003 {
1004 	QDF_STATUS status;
1005 	struct wlan_objmgr_psoc *psoc;
1006 	struct wlan_fwol_psoc_obj *fwol_obj;
1007 	struct wlan_fwol_tx_ops *tx_ops;
1008 
1009 	psoc = wlan_vdev_get_psoc(vdev);
1010 	if (!psoc) {
1011 		fwol_err("NULL pointer for psoc");
1012 		return QDF_STATUS_E_INVAL;
1013 	}
1014 
1015 	fwol_obj = fwol_get_psoc_obj(psoc);
1016 	if (!fwol_obj) {
1017 		fwol_err("Failed to get FWOL Obj");
1018 		return QDF_STATUS_E_INVAL;
1019 	}
1020 
1021 	tx_ops = &fwol_obj->tx_ops;
1022 	if (tx_ops->set_elna_bypass)
1023 		status = tx_ops->set_elna_bypass(psoc, req);
1024 	else
1025 		status = QDF_STATUS_E_IO;
1026 
1027 	return status;
1028 }
1029 
ucfg_fwol_get_elna_bypass(struct wlan_objmgr_vdev * vdev,struct get_elna_bypass_request * req,void (* callback)(void * context,struct get_elna_bypass_response * response),void * context)1030 QDF_STATUS ucfg_fwol_get_elna_bypass(struct wlan_objmgr_vdev *vdev,
1031 				     struct get_elna_bypass_request *req,
1032 				     void (*callback)(void *context,
1033 				     struct get_elna_bypass_response *response),
1034 				     void *context)
1035 {
1036 	QDF_STATUS status;
1037 	struct wlan_objmgr_psoc *psoc;
1038 	struct wlan_fwol_psoc_obj *fwol_obj;
1039 	struct wlan_fwol_tx_ops *tx_ops;
1040 	struct wlan_fwol_callbacks *cbs;
1041 
1042 	psoc = wlan_vdev_get_psoc(vdev);
1043 	if (!psoc) {
1044 		fwol_err("NULL pointer for psoc");
1045 		return QDF_STATUS_E_INVAL;
1046 	}
1047 
1048 	fwol_obj = fwol_get_psoc_obj(psoc);
1049 	if (!fwol_obj) {
1050 		fwol_err("Failed to get FWOL Obj");
1051 		return QDF_STATUS_E_INVAL;
1052 	}
1053 
1054 	cbs = &fwol_obj->cbs;
1055 	cbs->get_elna_bypass_callback = callback;
1056 	cbs->get_elna_bypass_context = context;
1057 
1058 	tx_ops = &fwol_obj->tx_ops;
1059 	if (tx_ops->get_elna_bypass)
1060 		status = tx_ops->get_elna_bypass(psoc, req);
1061 	else
1062 		status = QDF_STATUS_E_IO;
1063 
1064 	return status;
1065 }
1066 #endif /* WLAN_FEATURE_ELNA */
1067 
1068 #ifdef WLAN_SEND_DSCP_UP_MAP_TO_FW
ucfg_fwol_send_dscp_up_map_to_fw(struct wlan_objmgr_vdev * vdev,uint32_t * dscp_to_up_map)1069 QDF_STATUS ucfg_fwol_send_dscp_up_map_to_fw(struct wlan_objmgr_vdev *vdev,
1070 					   uint32_t *dscp_to_up_map)
1071 {
1072 	QDF_STATUS status;
1073 	struct wlan_objmgr_psoc *psoc;
1074 	struct wlan_fwol_psoc_obj *fwol_obj;
1075 	struct wlan_fwol_tx_ops *tx_ops;
1076 
1077 	psoc = wlan_vdev_get_psoc(vdev);
1078 	if (!psoc) {
1079 		fwol_err("NULL pointer for psoc");
1080 		return QDF_STATUS_E_INVAL;
1081 	}
1082 
1083 	fwol_obj = fwol_get_psoc_obj(psoc);
1084 	if (!fwol_obj) {
1085 		fwol_err("Failed to get FWOL Obj");
1086 		return QDF_STATUS_E_INVAL;
1087 	}
1088 
1089 	tx_ops = &fwol_obj->tx_ops;
1090 	if (tx_ops && tx_ops->send_dscp_up_map_to_fw)
1091 		status = tx_ops->send_dscp_up_map_to_fw(psoc, dscp_to_up_map);
1092 	else
1093 		status = QDF_STATUS_E_IO;
1094 
1095 	return status;
1096 }
1097 #endif /* WLAN_SEND_DSCP_UP_MAP_TO_FW */
1098 
1099 #ifdef WLAN_FEATURE_MDNS_OFFLOAD
ucfg_fwol_set_mdns_config(struct wlan_objmgr_psoc * psoc,struct mdns_config_info * mdns_info)1100 QDF_STATUS ucfg_fwol_set_mdns_config(struct wlan_objmgr_psoc *psoc,
1101 				     struct mdns_config_info *mdns_info)
1102 {
1103 	QDF_STATUS status;
1104 	struct wlan_fwol_psoc_obj *fwol_obj;
1105 	struct wlan_fwol_tx_ops *tx_ops;
1106 
1107 	if (!psoc) {
1108 		fwol_err("NULL pointer for psoc");
1109 		return QDF_STATUS_E_INVAL;
1110 	}
1111 
1112 	fwol_obj = fwol_get_psoc_obj(psoc);
1113 	if (!fwol_obj) {
1114 		fwol_err("Failed to get FWOL Obj");
1115 		return QDF_STATUS_E_INVAL;
1116 	}
1117 
1118 	tx_ops = &fwol_obj->tx_ops;
1119 	if (tx_ops->set_mdns_config)
1120 		status = tx_ops->set_mdns_config(psoc, mdns_info);
1121 	else
1122 		status = QDF_STATUS_E_IO;
1123 
1124 	return status;
1125 }
1126 #endif /* WLAN_FEATURE_MDNS_OFFLOAD */
1127 
ucfg_fwol_update_fw_cap_info(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_capability_info * caps)1128 void ucfg_fwol_update_fw_cap_info(struct wlan_objmgr_psoc *psoc,
1129 				  struct wlan_fwol_capability_info *caps)
1130 {
1131 	struct wlan_fwol_psoc_obj *fwol_obj;
1132 
1133 	fwol_obj = fwol_get_psoc_obj(psoc);
1134 	if (!fwol_obj) {
1135 		fwol_err("Failed to get fwol obj");
1136 		return;
1137 	}
1138 
1139 	qdf_mem_copy(&fwol_obj->capability_info, caps,
1140 		     sizeof(fwol_obj->capability_info));
1141 }
1142 
1143 #ifdef THERMAL_STATS_SUPPORT
1144 static QDF_STATUS
ucfg_fwol_get_cap(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_capability_info * cap_info)1145 ucfg_fwol_get_cap(struct wlan_objmgr_psoc *psoc,
1146 		  struct wlan_fwol_capability_info *cap_info)
1147 {
1148 	struct wlan_fwol_psoc_obj *fwol_obj;
1149 
1150 	fwol_obj = fwol_get_psoc_obj(psoc);
1151 	if (!fwol_obj) {
1152 		fwol_err("Failed to get fwol obj");
1153 		return QDF_STATUS_E_FAILURE;
1154 	}
1155 
1156 	if (!cap_info) {
1157 		fwol_err("Failed to get fwol obj");
1158 		return QDF_STATUS_E_FAILURE;
1159 	}
1160 	*cap_info = fwol_obj->capability_info;
1161 
1162 	return QDF_STATUS_SUCCESS;
1163 }
1164 
ucfg_fwol_send_get_thermal_stats_cmd(struct wlan_objmgr_psoc * psoc,enum thermal_stats_request_type req_type,void (* callback)(void * context,struct thermal_throttle_info * response),void * context)1165 QDF_STATUS ucfg_fwol_send_get_thermal_stats_cmd(struct wlan_objmgr_psoc *psoc,
1166 				       enum thermal_stats_request_type req_type,
1167 				       void (*callback)(void *context,
1168 				       struct thermal_throttle_info *response),
1169 				       void *context)
1170 {
1171 	QDF_STATUS status;
1172 	struct wlan_fwol_psoc_obj *fwol_obj;
1173 	struct wlan_fwol_tx_ops *tx_ops;
1174 	struct wlan_fwol_thermal_temp thermal_temp = {0};
1175 	struct wlan_fwol_capability_info cap_info;
1176 	struct wlan_fwol_callbacks *cbs;
1177 
1178 	fwol_obj = fwol_get_psoc_obj(psoc);
1179 	if (!fwol_obj) {
1180 		fwol_err("Failed to get FWOL Obj");
1181 		return QDF_STATUS_E_INVAL;
1182 	}
1183 
1184 	status = ucfg_fwol_get_thermal_temp(psoc, &thermal_temp);
1185 	if (QDF_IS_STATUS_ERROR(status))
1186 		return QDF_STATUS_E_INVAL;
1187 
1188 	status = ucfg_fwol_get_cap(psoc, &cap_info);
1189 	if (QDF_IS_STATUS_ERROR(status))
1190 		return QDF_STATUS_E_INVAL;
1191 
1192 	if (!thermal_temp.therm_stats_offset ||
1193 	    !cap_info.fw_thermal_stats_cap) {
1194 		fwol_err("Command Disabled in Ini gThermalStatsTempOffset %d or not enabled in FW %d",
1195 			 thermal_temp.therm_stats_offset,
1196 			 cap_info.fw_thermal_stats_cap);
1197 		return QDF_STATUS_E_INVAL;
1198 	}
1199 
1200 	/* Registering Callback for the Request command */
1201 	if (callback && context) {
1202 		cbs = &fwol_obj->cbs;
1203 		cbs->get_thermal_stats_callback = callback;
1204 		cbs->get_thermal_stats_context = context;
1205 	}
1206 
1207 	tx_ops = &fwol_obj->tx_ops;
1208 	if (tx_ops && tx_ops->get_thermal_stats)
1209 		status = tx_ops->get_thermal_stats(psoc, req_type,
1210 					thermal_temp.therm_stats_offset);
1211 	else
1212 		status = QDF_STATUS_E_INVAL;
1213 
1214 	return status;
1215 }
1216 #endif /* THERMAL_STATS_SUPPORT */
1217 
ucfg_fwol_configure_global_params(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_pdev * pdev)1218 QDF_STATUS ucfg_fwol_configure_global_params(struct wlan_objmgr_psoc *psoc,
1219 					     struct wlan_objmgr_pdev *pdev)
1220 {
1221 	QDF_STATUS status;
1222 	uint32_t enable_ilp;
1223 	bool value;
1224 
1225 	/* Configure ILP feature in FW */
1226 	status = ucfg_fwol_get_ilp_config(psoc, &enable_ilp);
1227 	if (QDF_IS_STATUS_ERROR(status))
1228 		return status;
1229 	status = fwol_set_ilp_config(pdev, enable_ilp);
1230 	if (QDF_IS_STATUS_ERROR(status))
1231 		return status;
1232 
1233 	/* Configure HW assist feature in FW */
1234 	status = ucfg_fwol_get_hw_assist_config(psoc, &value);
1235 	if (QDF_IS_STATUS_ERROR(status))
1236 		return status;
1237 	status = fwol_configure_hw_assist(pdev, value);
1238 	if (QDF_IS_STATUS_ERROR(status))
1239 		return status;
1240 
1241 	return status;
1242 }
1243 
ucfg_fwol_set_ilp_config(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_pdev * pdev,uint32_t enable_ilp)1244 QDF_STATUS ucfg_fwol_set_ilp_config(struct wlan_objmgr_psoc *psoc,
1245 				    struct wlan_objmgr_pdev *pdev,
1246 				    uint32_t enable_ilp)
1247 {
1248 	return fwol_set_ilp_config(pdev, enable_ilp);
1249 }
1250 
ucfg_fwol_configure_vdev_params(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev)1251 QDF_STATUS ucfg_fwol_configure_vdev_params(struct wlan_objmgr_psoc *psoc,
1252 					   struct wlan_objmgr_vdev *vdev)
1253 {
1254 	uint32_t value;
1255 	QDF_STATUS status;
1256 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
1257 
1258 	switch (wlan_vdev_mlme_get_opmode(vdev)) {
1259 	case QDF_SAP_MODE:
1260 		status = ucfg_fwol_get_sap_sho(psoc, &value);
1261 		if (QDF_IS_STATUS_ERROR(status))
1262 			break;
1263 
1264 		status = fwol_set_sap_sho(psoc, vdev_id, value);
1265 		if (QDF_IS_STATUS_ERROR(status))
1266 			break;
1267 
1268 		status = fwol_set_sap_wds_config(psoc, vdev_id);
1269 		break;
1270 	default:
1271 		status = QDF_STATUS_SUCCESS;
1272 		break;
1273 	}
1274 
1275 	return status;
1276 }
1277