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 "cds_api.h"
25 #include "wma.h"
26 #include "wlan_fwol_tgt_api.h"
27 
fwol_get_psoc_obj(struct wlan_objmgr_psoc * psoc)28 struct wlan_fwol_psoc_obj *fwol_get_psoc_obj(struct wlan_objmgr_psoc *psoc)
29 {
30 	return wlan_objmgr_psoc_get_comp_private_obj(psoc,
31 						     WLAN_UMAC_COMP_FWOL);
32 }
33 
34 /**
35  * fwol_mpta_helper_config_get() - Populate btc_mpta_helper_enable from cfg
36  * @psoc: The global psoc handler
37  * @coex_config: The cfg structure
38  *
39  * Return: none
40  */
41 #ifdef FEATURE_MPTA_HELPER
42 static void
fwol_mpta_helper_config_get(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_coex_config * coex_config)43 fwol_mpta_helper_config_get(struct wlan_objmgr_psoc *psoc,
44 			    struct wlan_fwol_coex_config *coex_config)
45 {
46 	coex_config->btc_mpta_helper_enable =
47 				cfg_get(psoc, CFG_COEX_MPTA_HELPER);
48 }
49 #else
50 static void
fwol_mpta_helper_config_get(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_coex_config * coex_config)51 fwol_mpta_helper_config_get(struct wlan_objmgr_psoc *psoc,
52 			    struct wlan_fwol_coex_config *coex_config)
53 {
54 }
55 #endif
56 
57 /**
58  * fwol_three_way_coex_config_legacy_config_get() - Populate
59  * btc_three_way_coex_config_legacy_enable from cfg
60  * @psoc: The global psoc handler
61  * @coex_config: The cfg structure
62  *
63  * Return: none
64  */
65 #ifdef FEATURE_COEX_CONFIG
66 static void
fwol_three_way_coex_config_legacy_config_get(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_coex_config * coex_config)67 fwol_three_way_coex_config_legacy_config_get(
68 			struct wlan_objmgr_psoc *psoc,
69 			struct wlan_fwol_coex_config *coex_config)
70 {
71 	coex_config->btc_three_way_coex_config_legacy_enable =
72 			cfg_get(psoc, CFG_THREE_WAY_COEX_CONFIG_LEGACY);
73 }
74 #else
75 static void
fwol_three_way_coex_config_legacy_config_get(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_coex_config * coex_config)76 fwol_three_way_coex_config_legacy_config_get(
77 			struct wlan_objmgr_psoc *psoc,
78 			struct wlan_fwol_coex_config *coex_config)
79 {
80 }
81 #endif
82 
83 static void
fwol_init_coex_config_in_cfg(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_coex_config * coex_config)84 fwol_init_coex_config_in_cfg(struct wlan_objmgr_psoc *psoc,
85 			     struct wlan_fwol_coex_config *coex_config)
86 {
87 	coex_config->btc_mode = cfg_get(psoc, CFG_BTC_MODE);
88 	coex_config->antenna_isolation = cfg_get(psoc, CFG_ANTENNA_ISOLATION);
89 	coex_config->max_tx_power_for_btc =
90 				cfg_get(psoc, CFG_MAX_TX_POWER_FOR_BTC);
91 	coex_config->wlan_low_rssi_threshold =
92 				cfg_get(psoc, CFG_WLAN_LOW_RSSI_THRESHOLD);
93 	coex_config->bt_low_rssi_threshold =
94 				cfg_get(psoc, CFG_BT_LOW_RSSI_THRESHOLD);
95 	coex_config->bt_interference_low_ll =
96 				cfg_get(psoc, CFG_BT_INTERFERENCE_LOW_LL);
97 	coex_config->bt_interference_low_ul =
98 				cfg_get(psoc, CFG_BT_INTERFERENCE_LOW_UL);
99 	coex_config->bt_interference_medium_ll =
100 				cfg_get(psoc, CFG_BT_INTERFERENCE_MEDIUM_LL);
101 	coex_config->bt_interference_medium_ul =
102 				cfg_get(psoc, CFG_BT_INTERFERENCE_MEDIUM_UL);
103 	coex_config->bt_interference_high_ll =
104 				cfg_get(psoc, CFG_BT_INTERFERENCE_HIGH_LL);
105 	coex_config->bt_interference_high_ul =
106 				cfg_get(psoc, CFG_BT_INTERFERENCE_HIGH_UL);
107 	fwol_mpta_helper_config_get(psoc, coex_config);
108 	coex_config->bt_sco_allow_wlan_2g_scan =
109 				cfg_get(psoc, CFG_BT_SCO_ALLOW_WLAN_2G_SCAN);
110 	fwol_three_way_coex_config_legacy_config_get(psoc, coex_config);
111 	coex_config->ble_scan_coex_policy = cfg_get(psoc,
112 						    CFG_BLE_SCAN_COEX_POLICY);
113 #ifdef FEATURE_COEX_TPUT_SHAPING_CONFIG
114 	coex_config->coex_tput_shaping_enable =
115 				cfg_get(psoc, CFG_TPUT_SHAPING_ENABLE);
116 #endif
117 }
118 
119 #ifdef THERMAL_STATS_SUPPORT
120 static void
fwol_init_thermal_stats_in_cfg(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_thermal_temp * thermal_temp)121 fwol_init_thermal_stats_in_cfg(struct wlan_objmgr_psoc *psoc,
122 			       struct wlan_fwol_thermal_temp *thermal_temp)
123 {
124 	thermal_temp->therm_stats_offset =
125 				cfg_get(psoc, CFG_THERMAL_STATS_TEMP_OFFSET);
126 }
127 #else
128 static void
fwol_init_thermal_stats_in_cfg(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_thermal_temp * thermal_temp)129 fwol_init_thermal_stats_in_cfg(struct wlan_objmgr_psoc *psoc,
130 			       struct wlan_fwol_thermal_temp *thermal_temp)
131 {
132 }
133 #endif
134 
135 static void
fwol_init_thermal_temp_in_cfg(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_thermal_temp * thermal_temp)136 fwol_init_thermal_temp_in_cfg(struct wlan_objmgr_psoc *psoc,
137 			      struct wlan_fwol_thermal_temp *thermal_temp)
138 {
139 	thermal_temp->thermal_temp_min_level[0] =
140 				cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL0);
141 	thermal_temp->thermal_temp_max_level[0] =
142 				cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL0);
143 	thermal_temp->thermal_temp_min_level[1] =
144 				cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL1);
145 	thermal_temp->thermal_temp_max_level[1] =
146 				cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL1);
147 	thermal_temp->thermal_temp_min_level[2] =
148 				cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL2);
149 	thermal_temp->thermal_temp_max_level[2] =
150 				cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL2);
151 	thermal_temp->thermal_temp_min_level[3] =
152 				cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL3);
153 	thermal_temp->thermal_temp_max_level[3] =
154 				cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL3);
155 	thermal_temp->thermal_temp_min_level[4] =
156 				cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL4);
157 	thermal_temp->thermal_temp_max_level[4] =
158 				cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL4);
159 	thermal_temp->thermal_temp_min_level[5] =
160 				cfg_get(psoc, CFG_THERMAL_TEMP_MIN_LEVEL5);
161 	thermal_temp->thermal_temp_max_level[5] =
162 				cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL5);
163 
164 	thermal_temp->thermal_mitigation_enable =
165 				cfg_get(psoc, CFG_THERMAL_MITIGATION_ENABLE);
166 	thermal_temp->throttle_period = cfg_get(psoc, CFG_THROTTLE_PERIOD);
167 	thermal_temp->thermal_sampling_time =
168 				cfg_get(psoc, CFG_THERMAL_SAMPLING_TIME);
169 	thermal_temp->throttle_dutycycle_level[0] =
170 				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL0);
171 	thermal_temp->throttle_dutycycle_level[1] =
172 				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL1);
173 	thermal_temp->throttle_dutycycle_level[2] =
174 				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL2);
175 	thermal_temp->throttle_dutycycle_level[3] =
176 				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL3);
177 	thermal_temp->throttle_dutycycle_level[4] =
178 				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL4);
179 	thermal_temp->throttle_dutycycle_level[5] =
180 				cfg_get(psoc, CFG_THROTTLE_DUTY_CYCLE_LEVEL5);
181 	thermal_temp->priority_apps =
182 				cfg_get(psoc, CFG_THERMAL_APPS_PRIORITY);
183 	thermal_temp->priority_wpps =
184 				cfg_get(psoc, CFG_THERMAL_WPPS_PRIOITY);
185 	thermal_temp->thermal_action =
186 				cfg_get(psoc, CFG_THERMAL_MGMT_ACTION);
187 	fwol_init_thermal_stats_in_cfg(psoc, thermal_temp);
188 }
189 
190 /**
191  * fwol_set_neighbor_report_offload_params() - set neighbor report parameters
192  *                                             for rso user config
193  * @psoc: The global psoc handler
194  * @fwol_neighbor_report_cfg: neighbor report config params
195  *
196  * Return: none
197  */
198 static void
fwol_set_neighbor_report_offload_params(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_neighbor_report_cfg * fwol_neighbor_report_cfg)199 fwol_set_neighbor_report_offload_params(
200 		struct wlan_objmgr_psoc *psoc,
201 		struct wlan_fwol_neighbor_report_cfg *fwol_neighbor_report_cfg)
202 {
203 	struct cm_roam_neighbor_report_offload_params *neighbor_report_offload;
204 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
205 
206 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
207 	if (!mlme_obj) {
208 		fwol_err("Failed to get MLME Obj");
209 		return;
210 	}
211 
212 	neighbor_report_offload = &mlme_obj->cfg.lfr.rso_user_config
213 						.neighbor_report_offload;
214 
215 	neighbor_report_offload->offload_11k_enable_bitmask =
216 				fwol_neighbor_report_cfg->enable_bitmask;
217 	neighbor_report_offload->params_bitmask =
218 				fwol_neighbor_report_cfg->params_bitmask;
219 	neighbor_report_offload->time_offset =
220 				fwol_neighbor_report_cfg->time_offset;
221 	neighbor_report_offload->low_rssi_offset =
222 				fwol_neighbor_report_cfg->low_rssi_offset;
223 	neighbor_report_offload->bmiss_count_trigger =
224 				fwol_neighbor_report_cfg->bmiss_count_trigger;
225 	neighbor_report_offload->per_threshold_offset =
226 				fwol_neighbor_report_cfg->per_threshold_offset;
227 	neighbor_report_offload->neighbor_report_cache_timeout =
228 				fwol_neighbor_report_cfg->cache_timeout;
229 	neighbor_report_offload->max_neighbor_report_req_cap =
230 				fwol_neighbor_report_cfg->max_req_cap;
231 }
232 
fwol_init_neighbor_report_cfg(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_neighbor_report_cfg * fwol_neighbor_report_cfg)233 QDF_STATUS fwol_init_neighbor_report_cfg(struct wlan_objmgr_psoc *psoc,
234 					 struct wlan_fwol_neighbor_report_cfg
235 					 *fwol_neighbor_report_cfg)
236 {
237 	if (!fwol_neighbor_report_cfg) {
238 		fwol_err("Neighbor report config pointer null");
239 		return QDF_STATUS_E_FAILURE;
240 	}
241 
242 	fwol_neighbor_report_cfg->enable_bitmask =
243 		cfg_get(psoc, CFG_OFFLOAD_11K_ENABLE_BITMASK);
244 	fwol_neighbor_report_cfg->params_bitmask =
245 		cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_PARAMS_BITMASK);
246 	fwol_neighbor_report_cfg->time_offset =
247 		cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_TIME_OFFSET);
248 	fwol_neighbor_report_cfg->low_rssi_offset =
249 		cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_LOW_RSSI_OFFSET);
250 	fwol_neighbor_report_cfg->bmiss_count_trigger =
251 		cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_BMISS_COUNT_TRIGGER);
252 	fwol_neighbor_report_cfg->per_threshold_offset =
253 		cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_PER_THRESHOLD_OFFSET);
254 	fwol_neighbor_report_cfg->cache_timeout =
255 		cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_CACHE_TIMEOUT);
256 	fwol_neighbor_report_cfg->max_req_cap =
257 		cfg_get(psoc, CFG_OFFLOAD_NEIGHBOR_REPORT_MAX_REQ_CAP);
258 
259 	fwol_set_neighbor_report_offload_params(psoc, fwol_neighbor_report_cfg);
260 
261 	return QDF_STATUS_SUCCESS;
262 }
263 
264 QDF_STATUS
fwol_init_adapt_dwelltime_in_cfg(struct wlan_objmgr_psoc * psoc,struct adaptive_dwelltime_params * dwelltime_params)265 fwol_init_adapt_dwelltime_in_cfg(
266 			struct wlan_objmgr_psoc *psoc,
267 			struct adaptive_dwelltime_params *dwelltime_params)
268 {
269 	if (!dwelltime_params) {
270 		fwol_err("dwelltime params config pointer null");
271 		return QDF_STATUS_E_FAILURE;
272 	}
273 	dwelltime_params->is_enabled =
274 			cfg_get(psoc, CFG_ADAPTIVE_DWELL_MODE_ENABLED);
275 	dwelltime_params->dwelltime_mode =
276 			cfg_get(psoc, CFG_GLOBAL_ADAPTIVE_DWELL_MODE);
277 	dwelltime_params->lpf_weight =
278 			cfg_get(psoc, CFG_ADAPT_DWELL_LPF_WEIGHT);
279 	dwelltime_params->passive_mon_intval =
280 			cfg_get(psoc, CFG_ADAPT_DWELL_PASMON_INTVAL);
281 	dwelltime_params->wifi_act_threshold =
282 			cfg_get(psoc, CFG_ADAPT_DWELL_WIFI_THRESH);
283 
284 	return QDF_STATUS_SUCCESS;
285 }
286 
287 QDF_STATUS
fwol_set_adaptive_dwelltime_config(struct adaptive_dwelltime_params * dwelltime_params)288 fwol_set_adaptive_dwelltime_config(
289 			struct adaptive_dwelltime_params *dwelltime_params)
290 {
291 	tp_wma_handle wma_handle;
292 	QDF_STATUS status;
293 
294 	wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
295 	if (!wma_handle)
296 		return QDF_STATUS_E_FAILURE;
297 
298 	status = wma_send_adapt_dwelltime_params(wma_handle,
299 						 dwelltime_params);
300 	return status;
301 }
302 /**
303  * fwol_parse_probe_req_ouis() - form ouis from ini gProbeReqOUIs
304  * @psoc: Pointer to struct wlan_objmgr_psoc context
305  * @allowlist: Pointer to struct wlan_fwol_ie_allowlist
306  *
307  * This function parses the ini string gProbeReqOUIs which needs be to in the
308  * following format:
309  * "<8 characters of [0-9] or [A-F]>space<8 characters from [0-9] etc.,"
310  * example: "AABBCCDD 1122EEFF"
311  * and the logic counts the number of OUIS and allocates the memory
312  * for every valid OUI and is stored in struct hdd_context
313  *
314  * Return: None
315  */
fwol_parse_probe_req_ouis(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_ie_allowlist * allowlist)316 static void fwol_parse_probe_req_ouis(struct wlan_objmgr_psoc *psoc,
317 				      struct wlan_fwol_ie_allowlist *allowlist)
318 {
319 	uint8_t probe_req_ouis[MAX_PRB_REQ_VENDOR_OUI_INI_LEN] = {0};
320 	uint32_t *voui = allowlist->probe_req_voui;
321 	char *str;
322 	uint8_t *token;
323 	uint32_t oui_indx = 0;
324 	int ret;
325 	uint32_t hex_value;
326 
327 	qdf_str_lcopy(probe_req_ouis, cfg_get(psoc, CFG_PROBE_REQ_OUI),
328 		      MAX_PRB_REQ_VENDOR_OUI_INI_LEN);
329 	str = probe_req_ouis;
330 	allowlist->no_of_probe_req_ouis = 0;
331 
332 	if (!qdf_str_len(str)) {
333 		fwol_debug("NO OUIs to parse");
334 		return;
335 	}
336 
337 	token = strsep(&str, " ");
338 	while (token) {
339 		if (qdf_str_len(token) != 8)
340 			goto next_token;
341 
342 		ret = qdf_kstrtouint(token, 16, &hex_value);
343 		if (ret)
344 			goto next_token;
345 
346 		voui[oui_indx++] = cpu_to_be32(hex_value);
347 		if (oui_indx >= MAX_PROBE_REQ_OUIS)
348 			break;
349 next_token:
350 		token = strsep(&str, " ");
351 	}
352 
353 	if (!oui_indx) {
354 		allowlist->ie_allowlist = false;
355 		return;
356 	}
357 
358 	allowlist->no_of_probe_req_ouis = oui_indx;
359 }
360 
361 /**
362  * fwol_validate_ie_bitmaps() - Validate all IE allowlist bitmap param values
363  * @psoc: Pointer to struct wlan_objmgr_psoc
364  * @allowlist: Pointer to struct wlan_fwol_ie_allowlist
365  *
366  * Return: True if all bitmap values are valid, else false
367  */
fwol_validate_ie_bitmaps(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_ie_allowlist * allowlist)368 static bool fwol_validate_ie_bitmaps(struct wlan_objmgr_psoc *psoc,
369 				     struct wlan_fwol_ie_allowlist *allowlist)
370 {
371 	if (!(allowlist->ie_bitmap_0 || allowlist->ie_bitmap_1 ||
372 	      allowlist->ie_bitmap_2 || allowlist->ie_bitmap_3 ||
373 	      allowlist->ie_bitmap_4 || allowlist->ie_bitmap_5 ||
374 	      allowlist->ie_bitmap_6 || allowlist->ie_bitmap_7))
375 		return false;
376 
377 	/*
378 	 * check whether vendor oui IE is set and OUIs are present, each OUI
379 	 * is entered in the form of string of 8 characters from ini, therefore,
380 	 * for atleast one OUI, minimum length is 8 and hence this string length
381 	 * is checked for minimum of 8
382 	 */
383 	if ((allowlist->ie_bitmap_6 & VENDOR_SPECIFIC_IE_BITMAP) &&
384 	    (qdf_str_len(cfg_get(psoc, CFG_PROBE_REQ_OUI)) < 8))
385 		return false;
386 
387 	/* check whether vendor oui IE is not set but OUIs are present */
388 	if (!(allowlist->ie_bitmap_6 & VENDOR_SPECIFIC_IE_BITMAP) &&
389 	    (qdf_str_len(cfg_get(psoc, CFG_PROBE_REQ_OUI)) > 0))
390 		return false;
391 
392 	return true;
393 }
394 
395 static void
fwol_init_ie_whiltelist_in_cfg(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_ie_allowlist * allowlist)396 fwol_init_ie_whiltelist_in_cfg(struct wlan_objmgr_psoc *psoc,
397 			       struct wlan_fwol_ie_allowlist *allowlist)
398 {
399 	allowlist->ie_allowlist = cfg_get(psoc, CFG_PROBE_REQ_IE_ALLOWLIST);
400 	allowlist->ie_bitmap_0 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP0);
401 	allowlist->ie_bitmap_1 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP1);
402 	allowlist->ie_bitmap_2 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP2);
403 	allowlist->ie_bitmap_3 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP3);
404 	allowlist->ie_bitmap_4 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP4);
405 	allowlist->ie_bitmap_5 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP5);
406 	allowlist->ie_bitmap_6 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP6);
407 	allowlist->ie_bitmap_7 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP7);
408 	if (!fwol_validate_ie_bitmaps(psoc, allowlist))
409 		allowlist->ie_allowlist = false;
410 	fwol_parse_probe_req_ouis(psoc, allowlist);
411 }
412 
413 /**
414  * ucfg_fwol_fetch_dhcp_server_settings() - Populate the DHCP server settings
415  *                                          from cfg
416  * @psoc: The global psoc handler
417  * @fwol_cfg: The cfg structure
418  *
419  * Return: none
420  */
421 #ifdef DHCP_SERVER_OFFLOAD
ucfg_fwol_fetch_dhcp_server_settings(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)422 static void ucfg_fwol_fetch_dhcp_server_settings(struct wlan_objmgr_psoc *psoc,
423 						 struct wlan_fwol_cfg *fwol_cfg)
424 {
425 	fwol_cfg->enable_dhcp_server_offload =
426 			cfg_get(psoc, CFG_DHCP_SERVER_OFFLOAD_SUPPORT);
427 	fwol_cfg->dhcp_max_num_clients =
428 			cfg_get(psoc, CFG_DHCP_SERVER_OFFLOAD_NUM_CLIENT);
429 }
430 #else
ucfg_fwol_fetch_dhcp_server_settings(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)431 static void ucfg_fwol_fetch_dhcp_server_settings(struct wlan_objmgr_psoc *psoc,
432 						 struct wlan_fwol_cfg *fwol_cfg)
433 {
434 }
435 #endif
436 
437 /**
438  * ucfg_fwol_fetch_tsf_gpio_pin() - Populate the tsf_gpio_pin from cfg
439  * @psoc: The global psoc handler
440  * @fwol_cfg: The cfg structure
441  *
442  * Return: none
443  */
444 #ifdef WLAN_FEATURE_TSF
ucfg_fwol_fetch_tsf_gpio_pin(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)445 static void ucfg_fwol_fetch_tsf_gpio_pin(struct wlan_objmgr_psoc *psoc,
446 					 struct wlan_fwol_cfg *fwol_cfg)
447 {
448 	fwol_cfg->tsf_gpio_pin = cfg_get(psoc, CFG_SET_TSF_GPIO_PIN);
449 }
450 #else
ucfg_fwol_fetch_tsf_gpio_pin(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)451 static void ucfg_fwol_fetch_tsf_gpio_pin(struct wlan_objmgr_psoc *psoc,
452 					 struct wlan_fwol_cfg *fwol_cfg)
453 {
454 }
455 #endif
456 
457 #if defined(WLAN_FEATURE_TSF) && defined(WLAN_FEATURE_TSF_PLUS)
458 #ifdef WLAN_FEATURE_TSF_ACCURACY
459 /**
460  * fwol_init_tsf_accuracy_configs() - Populate the TSF Accuracy configs from cfg
461  * @psoc: The global psoc handler
462  * @fwol_cfg: The cfg structure
463  *
464  * Return: none
465  */
fwol_init_tsf_accuracy_configs(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)466 static void fwol_init_tsf_accuracy_configs(struct wlan_objmgr_psoc *psoc,
467 					   struct wlan_fwol_cfg *fwol_cfg)
468 {
469 	int32_t configs[CFG_TSF_ACCURACY_CONFIG_LEN] = { 0 };
470 	int status;
471 	qdf_size_t len;
472 
473 	status = qdf_int32_array_parse(cfg_get(psoc, CFG_TSF_ACCURACY_CONFIGS),
474 				       configs,
475 				       CFG_TSF_ACCURACY_CONFIG_LEN,
476 				       &len);
477 
478 	if (status != QDF_STATUS_SUCCESS || len != CFG_TSF_ACCURACY_CONFIG_LEN) {
479 		fwol_cfg->tsf_accuracy_configs.enable = 0;
480 		fwol_err("Invalid parameters from INI");
481 		return;
482 	}
483 
484 	fwol_cfg->tsf_accuracy_configs.enable = configs[0];
485 	fwol_cfg->tsf_accuracy_configs.sync_gpio = configs[1];
486 	fwol_cfg->tsf_accuracy_configs.periodic_pulse_gpio = configs[2];
487 	fwol_cfg->tsf_accuracy_configs.pulse_interval_ms = configs[3];
488 }
489 #else
fwol_init_tsf_accuracy_configs(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)490 static void fwol_init_tsf_accuracy_configs(struct wlan_objmgr_psoc *psoc,
491 					   struct wlan_fwol_cfg *fwol_cfg)
492 {
493 }
494 #endif
495 
496 /**
497  * ucfg_fwol_init_tsf_ptp_options() - Populate the tsf_ptp_options from cfg
498  * @psoc: The global psoc handler
499  * @fwol_cfg: The cfg structure
500  *
501  * Return: none
502  */
ucfg_fwol_init_tsf_ptp_options(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)503 static void ucfg_fwol_init_tsf_ptp_options(struct wlan_objmgr_psoc *psoc,
504 					   struct wlan_fwol_cfg *fwol_cfg)
505 {
506 	fwol_cfg->tsf_ptp_options = cfg_get(psoc, CFG_SET_TSF_PTP_OPT);
507 	fwol_cfg->tsf_sync_enable = cfg_get(psoc, CFG_TSF_SYNC_ENABLE);
508 	fwol_init_tsf_accuracy_configs(psoc, fwol_cfg);
509 }
510 #else
ucfg_fwol_init_tsf_ptp_options(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)511 static void ucfg_fwol_init_tsf_ptp_options(struct wlan_objmgr_psoc *psoc,
512 					   struct wlan_fwol_cfg *fwol_cfg)
513 {
514 }
515 #endif
516 
517 #ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_IRQ
518 /**
519  * ucfg_fwol_fetch_tsf_irq_host_gpio_pin() - Populate the tsf_irq_host_gpio_pin
520  *                                           from cfg
521  * @psoc: The global psoc handler
522  * @fwol_cfg: The cfg structure
523  *
524  * This function is used to populate the cfg value of host platform
525  * gpio pin configured to receive tsf interrupt from fw.
526  *
527  * Return: none
528  */
529 static void
ucfg_fwol_fetch_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)530 ucfg_fwol_fetch_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
531 				      struct wlan_fwol_cfg *fwol_cfg)
532 {
533 	fwol_cfg->tsf_irq_host_gpio_pin =
534 		cfg_get(psoc, CFG_SET_TSF_IRQ_HOST_GPIO_PIN);
535 }
536 #else
537 static void
ucfg_fwol_fetch_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)538 ucfg_fwol_fetch_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
539 				      struct wlan_fwol_cfg *fwol_cfg)
540 {
541 }
542 #endif
543 
544 #ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC
545 /**
546  * ucfg_fwol_fetch_tsf_sync_host_gpio_pin() - Populate the
547  *                                            tsf_sync_host_gpio_pin from cfg
548  * @psoc: The global psoc handler
549  * @fwol_cfg: The cfg structure
550  *
551  * This function is used to populate the cfg value of host platform
552  * gpio pin configured to drive tsf sync interrupt pin on wlan chip.
553  *
554  * Return: none
555  */
556 static void
ucfg_fwol_fetch_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)557 ucfg_fwol_fetch_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
558 				       struct wlan_fwol_cfg *fwol_cfg)
559 {
560 	fwol_cfg->tsf_sync_host_gpio_pin =
561 		cfg_get(psoc, CFG_SET_TSF_SYNC_HOST_GPIO_PIN);
562 }
563 #else
564 static void
ucfg_fwol_fetch_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)565 ucfg_fwol_fetch_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
566 				       struct wlan_fwol_cfg *fwol_cfg)
567 {
568 }
569 #endif
570 /**
571  * ucfg_fwol_init_sae_cfg() - Populate the sae control config from cfg
572  * @psoc: The global psoc handler
573  * @fwol_cfg: The cfg structure
574  *
575  * Return: none
576  */
577 #ifdef WLAN_FEATURE_SAE
ucfg_fwol_init_sae_cfg(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)578 static void ucfg_fwol_init_sae_cfg(struct wlan_objmgr_psoc *psoc,
579 				   struct wlan_fwol_cfg *fwol_cfg)
580 {
581 	fwol_cfg->sae_enable = cfg_get(psoc, CFG_IS_SAE_ENABLED);
582 }
583 #else
ucfg_fwol_init_sae_cfg(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)584 static void ucfg_fwol_init_sae_cfg(struct wlan_objmgr_psoc *psoc,
585 				   struct wlan_fwol_cfg *fwol_cfg)
586 {
587 }
588 #endif
589 
590 /**
591  * ucfg_fwol_fetch_ra_filter() - Populate the RA filter enabled or not from cfg
592  * @psoc: The global psoc handler
593  * @fwol_cfg: The cfg structure
594  *
595  * Return: none
596  */
597 #ifdef FEATURE_WLAN_RA_FILTERING
ucfg_fwol_fetch_ra_filter(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)598 static void ucfg_fwol_fetch_ra_filter(struct wlan_objmgr_psoc *psoc,
599 				      struct wlan_fwol_cfg *fwol_cfg)
600 {
601 	fwol_cfg->is_rate_limit_enabled = cfg_get(psoc, CFG_RA_FILTER_ENABLE);
602 }
603 #else
ucfg_fwol_fetch_ra_filter(struct wlan_objmgr_psoc * psoc,struct wlan_fwol_cfg * fwol_cfg)604 static void ucfg_fwol_fetch_ra_filter(struct wlan_objmgr_psoc *psoc,
605 				      struct wlan_fwol_cfg *fwol_cfg)
606 {
607 }
608 #endif
609 
610 #ifdef FW_THERMAL_THROTTLE_SUPPORT
fwol_thermal_init(struct wlan_fwol_psoc_obj * fwol_obj)611 static void fwol_thermal_init(struct wlan_fwol_psoc_obj *fwol_obj)
612 {
613 	fwol_obj->thermal_throttle.level = THERMAL_FULLPERF;
614 	fwol_obj->thermal_throttle.pdev_id = WLAN_INVALID_PDEV_ID;
615 }
616 #else
fwol_thermal_init(struct wlan_fwol_psoc_obj * fwol_obj)617 static void fwol_thermal_init(struct wlan_fwol_psoc_obj *fwol_obj)
618 {
619 }
620 #endif
621 
622 #ifdef WLAN_FEATURE_OFDM_SCRAMBLER_SEED
fwol_ofdm_scrambler_init(struct wlan_fwol_cfg * fwol_cfg,struct wlan_objmgr_psoc * psoc)623 static inline void fwol_ofdm_scrambler_init(struct wlan_fwol_cfg *fwol_cfg,
624 					    struct wlan_objmgr_psoc *psoc)
625 {
626 	fwol_cfg->enable_ofdm_scrambler_seed =
627 				cfg_get(psoc, CFG_ENABLE_OFDM_SCRAMBLER_SEED);
628 }
629 #else
fwol_ofdm_scrambler_init(struct wlan_fwol_cfg * fwol_cfg,struct wlan_objmgr_psoc * psoc)630 static inline void fwol_ofdm_scrambler_init(struct wlan_fwol_cfg *fwol_cfg,
631 					    struct wlan_objmgr_psoc *psoc)
632 {
633 }
634 #endif
635 
fwol_cfg_on_psoc_enable(struct wlan_objmgr_psoc * psoc)636 QDF_STATUS fwol_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
637 {
638 	QDF_STATUS status = QDF_STATUS_SUCCESS;
639 	struct wlan_fwol_psoc_obj *fwol_obj;
640 	struct wlan_fwol_cfg *fwol_cfg;
641 	qdf_size_t enable_fw_module_log_level_num;
642 	qdf_size_t enable_fw_wow_mod_log_level_num;
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_cfg = &fwol_obj->cfg;
651 
652 	fwol_init_coex_config_in_cfg(psoc, &fwol_cfg->coex_config);
653 	fwol_init_thermal_temp_in_cfg(psoc, &fwol_cfg->thermal_temp_cfg);
654 	fwol_init_ie_whiltelist_in_cfg(psoc, &fwol_cfg->ie_allowlist_cfg);
655 	fwol_init_neighbor_report_cfg(psoc, &fwol_cfg->neighbor_report_cfg);
656 	fwol_cfg->ani_enabled = cfg_get(psoc, CFG_ENABLE_ANI);
657 	fwol_cfg->pcie_config = cfg_get(psoc, CFG_PCIE_CONFIG);
658 	fwol_cfg->enable_rts_sifsbursting =
659 				cfg_get(psoc, CFG_SET_RTS_FOR_SIFS_BURSTING);
660 	fwol_cfg->enable_sifs_burst = cfg_get(psoc, CFG_SET_SIFS_BURST);
661 	fwol_cfg->max_mpdus_inampdu = cfg_get(psoc, CFG_MAX_MPDUS_IN_AMPDU);
662 	fwol_cfg->enable_phy_reg_retention = cfg_get(psoc, CFG_ENABLE_PHY_REG);
663 	fwol_cfg->upper_brssi_thresh = cfg_get(psoc, CFG_UPPER_BRSSI_THRESH);
664 	fwol_cfg->lower_brssi_thresh = cfg_get(psoc, CFG_LOWER_BRSSI_THRESH);
665 	fwol_cfg->enable_dtim_1chrx = cfg_get(psoc, CFG_DTIM_1CHRX_ENABLE);
666 	fwol_cfg->alternative_chainmask_enabled =
667 				cfg_get(psoc, CFG_ENABLE_COEX_ALT_CHAINMASK);
668 	fwol_cfg->smart_chainmask_enabled =
669 				cfg_get(psoc, CFG_ENABLE_SMART_CHAINMASK);
670 	fwol_cfg->get_rts_profile = cfg_get(psoc, CFG_ENABLE_FW_RTS_PROFILE);
671 	fwol_cfg->enable_fw_log_level =
672 				cfg_get(psoc, CFG_ENABLE_FW_DEBUG_LOG_LEVEL);
673 	fwol_cfg->enable_fw_log_type = cfg_get(psoc, CFG_ENABLE_FW_LOG_TYPE);
674 	qdf_uint8_array_parse(cfg_get(psoc, CFG_ENABLE_FW_MODULE_LOG_LEVEL),
675 			      fwol_cfg->enable_fw_module_log_level,
676 			      FW_MODULE_LOG_LEVEL_STRING_LENGTH,
677 			      &enable_fw_module_log_level_num);
678 	fwol_cfg->enable_fw_module_log_level_num =
679 				(uint8_t)enable_fw_module_log_level_num;
680 	qdf_uint8_array_parse(cfg_get(psoc, CFG_ENABLE_FW_WOW_MODULE_LOG_LEVEL),
681 			      fwol_cfg->enable_fw_mod_wow_log_level,
682 			      FW_MODULE_LOG_LEVEL_STRING_LENGTH,
683 			      &enable_fw_wow_mod_log_level_num);
684 	fwol_cfg->enable_fw_mod_wow_log_level_num =
685 				(uint8_t)enable_fw_wow_mod_log_level_num;
686 	ucfg_fwol_init_tsf_ptp_options(psoc, fwol_cfg);
687 	ucfg_fwol_init_sae_cfg(psoc, fwol_cfg);
688 	fwol_cfg->gcmp_enable = cfg_get(psoc, CFG_ENABLE_GCMP);
689 	fwol_cfg->enable_tx_sch_delay = cfg_get(psoc, CFG_TX_SCH_DELAY);
690 	fwol_cfg->enable_secondary_rate = cfg_get(psoc,
691 						  CFG_ENABLE_SECONDARY_RATE);
692 	fwol_init_adapt_dwelltime_in_cfg(psoc, &fwol_cfg->dwelltime_params);
693 	ucfg_fwol_fetch_ra_filter(psoc, fwol_cfg);
694 	ucfg_fwol_fetch_tsf_gpio_pin(psoc, fwol_cfg);
695 	ucfg_fwol_fetch_tsf_irq_host_gpio_pin(psoc, fwol_cfg);
696 	ucfg_fwol_fetch_tsf_sync_host_gpio_pin(psoc, fwol_cfg);
697 	ucfg_fwol_fetch_dhcp_server_settings(psoc, fwol_cfg);
698 	fwol_cfg->sap_xlna_bypass = cfg_get(psoc, CFG_SET_SAP_XLNA_BYPASS);
699 	fwol_cfg->enable_ilp = cfg_get(psoc, CFG_SET_ENABLE_ILP);
700 	fwol_cfg->sap_sho = cfg_get(psoc, CFG_SAP_SHO_CONFIG);
701 	fwol_cfg->disable_hw_assist = cfg_get(psoc, CFG_DISABLE_HW_ASSIST);
702 	fwol_thermal_init(fwol_obj);
703 	fwol_ofdm_scrambler_init(fwol_cfg, psoc);
704 
705 	return status;
706 }
707 
fwol_cfg_on_psoc_disable(struct wlan_objmgr_psoc * psoc)708 QDF_STATUS fwol_cfg_on_psoc_disable(struct wlan_objmgr_psoc *psoc)
709 {
710 	/* Clear the CFG structure */
711 	return QDF_STATUS_SUCCESS;
712 }
713 
714 #ifdef WLAN_FEATURE_ELNA
715 /**
716  * fwol_process_get_elna_bypass_resp() - Process get eLNA bypass response
717  * @event: response event
718  *
719  * Return: QDF_STATUS_SUCCESS on success
720  */
721 static QDF_STATUS
fwol_process_get_elna_bypass_resp(struct wlan_fwol_rx_event * event)722 fwol_process_get_elna_bypass_resp(struct wlan_fwol_rx_event *event)
723 {
724 	QDF_STATUS status = QDF_STATUS_SUCCESS;
725 	struct wlan_objmgr_psoc *psoc;
726 	struct wlan_fwol_psoc_obj *fwol_obj;
727 	struct wlan_fwol_callbacks *cbs;
728 	struct get_elna_bypass_response *resp;
729 
730 	if (!event) {
731 		fwol_err("Event buffer is NULL");
732 		return QDF_STATUS_E_FAILURE;
733 	}
734 
735 	psoc = event->psoc;
736 	if (!psoc) {
737 		fwol_err("psoc is NULL");
738 		return QDF_STATUS_E_INVAL;
739 	}
740 
741 	fwol_obj = fwol_get_psoc_obj(psoc);
742 	if (!fwol_obj) {
743 		fwol_err("Failed to get FWOL Obj");
744 		return QDF_STATUS_E_INVAL;
745 	}
746 
747 	cbs = &fwol_obj->cbs;
748 	if (cbs->get_elna_bypass_callback) {
749 		resp = &event->get_elna_bypass_response;
750 		cbs->get_elna_bypass_callback(cbs->get_elna_bypass_context,
751 					      resp);
752 	} else {
753 		fwol_err("NULL pointer for callback");
754 		status = QDF_STATUS_E_IO;
755 	}
756 
757 	return status;
758 }
759 #else
760 static QDF_STATUS
fwol_process_get_elna_bypass_resp(struct wlan_fwol_rx_event * event)761 fwol_process_get_elna_bypass_resp(struct wlan_fwol_rx_event *event)
762 {
763 	return QDF_STATUS_SUCCESS;
764 }
765 #endif /* WLAN_FEATURE_ELNA */
766 
767 #ifdef THERMAL_STATS_SUPPORT
768 /**
769  * fwol_process_get_thermal_stats_resp() - Process get thermal stats response
770  * @event: response event
771  *
772  * Return: QDF_STATUS_SUCCESS on success
773  */
774 static QDF_STATUS
fwol_process_get_thermal_stats_resp(struct wlan_fwol_rx_event * event)775 fwol_process_get_thermal_stats_resp(struct wlan_fwol_rx_event *event)
776 {
777 	QDF_STATUS status = QDF_STATUS_SUCCESS;
778 	struct wlan_objmgr_psoc *psoc;
779 	struct wlan_fwol_psoc_obj *fwol_obj;
780 	struct wlan_fwol_callbacks *cbs;
781 	struct thermal_throttle_info *resp;
782 
783 	if (!event) {
784 		fwol_err("Event buffer is NULL");
785 		return QDF_STATUS_E_FAILURE;
786 	}
787 
788 	psoc = event->psoc;
789 	if (!psoc) {
790 		fwol_err("psoc is NULL");
791 		return QDF_STATUS_E_INVAL;
792 	}
793 
794 	fwol_obj = fwol_get_psoc_obj(psoc);
795 	if (!fwol_obj) {
796 		fwol_err("Failed to get FWOL Obj");
797 		return QDF_STATUS_E_INVAL;
798 	}
799 
800 	cbs = &fwol_obj->cbs;
801 	if (cbs && cbs->get_thermal_stats_callback) {
802 		resp = &event->get_thermal_stats_response;
803 		cbs->get_thermal_stats_callback(cbs->get_thermal_stats_context,
804 						resp);
805 	} else {
806 		fwol_err("NULL pointer for callback");
807 		status = QDF_STATUS_E_IO;
808 	}
809 
810 	return status;
811 }
812 #else
813 static QDF_STATUS
fwol_process_get_thermal_stats_resp(struct wlan_fwol_rx_event * event)814 fwol_process_get_thermal_stats_resp(struct wlan_fwol_rx_event *event)
815 {
816 	return QDF_STATUS_E_NOSUPPORT;
817 }
818 #endif /* THERMAL_STATS_SUPPORT */
819 
fwol_process_event(struct scheduler_msg * msg)820 QDF_STATUS fwol_process_event(struct scheduler_msg *msg)
821 {
822 	QDF_STATUS status;
823 	struct wlan_fwol_rx_event *event;
824 
825 	fwol_debug("msg type %d", msg->type);
826 
827 	if (!(msg->bodyptr)) {
828 		fwol_err("Invalid message body");
829 		return QDF_STATUS_E_INVAL;
830 	}
831 
832 	event = msg->bodyptr;
833 	msg->bodyptr = NULL;
834 
835 	switch (msg->type) {
836 	case WLAN_FWOL_EVT_GET_ELNA_BYPASS_RESPONSE:
837 		status = fwol_process_get_elna_bypass_resp(event);
838 		break;
839 	case WLAN_FWOL_EVT_GET_THERMAL_STATS_RESPONSE:
840 		status = fwol_process_get_thermal_stats_resp(event);
841 		break;
842 	default:
843 		status = QDF_STATUS_E_INVAL;
844 		break;
845 	}
846 
847 	fwol_release_rx_event(event);
848 
849 	return status;
850 }
851 
fwol_release_rx_event(struct wlan_fwol_rx_event * event)852 void fwol_release_rx_event(struct wlan_fwol_rx_event *event)
853 {
854 	if (!event) {
855 		fwol_err("event is NULL");
856 		return;
857 	}
858 
859 	if (event->psoc)
860 		wlan_objmgr_psoc_release_ref(event->psoc, WLAN_FWOL_SB_ID);
861 	qdf_mem_free(event);
862 }
863 
fwol_set_ilp_config(struct wlan_objmgr_pdev * pdev,uint32_t enable_ilp)864 QDF_STATUS fwol_set_ilp_config(struct wlan_objmgr_pdev *pdev,
865 			       uint32_t enable_ilp)
866 {
867 	QDF_STATUS status;
868 	struct pdev_params pdev_param = {};
869 
870 	pdev_param.param_id = wmi_pdev_param_pcie_hw_ilp;
871 	pdev_param.param_value = enable_ilp;
872 
873 	status = tgt_fwol_pdev_param_send(pdev, pdev_param);
874 	if (QDF_IS_STATUS_ERROR(status))
875 		fwol_err("wmi_pdev_param_pcie_hw_ilp failed %d", status);
876 
877 	return status;
878 }
879 
fwol_set_sap_sho(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint32_t sap_sho)880 QDF_STATUS fwol_set_sap_sho(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
881 			    uint32_t sap_sho)
882 {
883 	QDF_STATUS status;
884 	struct vdev_set_params vdev_param;
885 
886 	vdev_param.vdev_id = vdev_id;
887 	vdev_param.param_id = wmi_vdev_param_sho_config;
888 	vdev_param.param_value = sap_sho;
889 
890 	status = tgt_fwol_vdev_param_send(psoc, vdev_param);
891 	if (QDF_IS_STATUS_ERROR(status))
892 		fwol_err("wmi_vdev_param_sho_config failed %d", status);
893 
894 	return status;
895 }
896 
fwol_configure_hw_assist(struct wlan_objmgr_pdev * pdev,bool disable_hw_assist)897 QDF_STATUS fwol_configure_hw_assist(struct wlan_objmgr_pdev *pdev,
898 				    bool disable_hw_assist)
899 {
900 	QDF_STATUS status;
901 	struct pdev_params pdev_param = {};
902 
903 	pdev_param.param_id = wmi_pdev_param_disable_hw_assist;
904 	pdev_param.param_value = disable_hw_assist;
905 
906 	status = tgt_fwol_pdev_param_send(pdev, pdev_param);
907 	if (QDF_IS_STATUS_ERROR(status))
908 		fwol_err("wmi_pdev_param_disable_hw_assist failed %d", status);
909 
910 	return status;
911 }
912 
913 #ifdef FEATURE_WDS
914 QDF_STATUS
fwol_set_sap_wds_config(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)915 fwol_set_sap_wds_config(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)
916 {
917 	QDF_STATUS status;
918 	struct vdev_set_params vdev_param;
919 
920 	if (!wlan_mlme_get_wds_mode(psoc))
921 		return QDF_STATUS_SUCCESS;
922 
923 	vdev_param.vdev_id = vdev_id;
924 	vdev_param.param_id = wmi_vdev_param_wds;
925 	vdev_param.param_value = true;
926 
927 	status = tgt_fwol_vdev_param_send(psoc, vdev_param);
928 	if (QDF_IS_STATUS_ERROR(status))
929 		fwol_err("wmi_vdev_param_wds failed %d", status);
930 
931 	return status;
932 }
933 #endif
934