1 /*
2  * Copyright (c) 2012, 2014-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef __WLAN_HDD_POWER_H
21 #define __WLAN_HDD_POWER_H
22 
23 /**
24  * DOC: wlan_hdd_power.h
25  *
26  * HDD Power Management API
27  */
28 
29 #include "wlan_hdd_main.h"
30 #include <linux/pm_qos.h>
31 #include <linux/pm_runtime.h>
32 
33 #define HDD_WAKELOCK_TIMEOUT_CONNECT 1000
34 #define HDD_WAKELOCK_TIMEOUT_RESUME 1000
35 #define DISABLE_KRAIT_IDLE_PS_VAL      1
36 
37 /*
38  * HDD_WAKELOCK_CONNECT_COMPLETE = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT (3000) +
39  *                      WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STADEF (1000) +
40  *                      WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STADEF  (2000)
41  */
42 #define HDD_WAKELOCK_CONNECT_COMPLETE 6000
43 
44 #ifdef WLAN_FEATURE_PACKET_FILTERING
45 
46 #define HDD_MAX_CMP_PER_PACKET_FILTER	5
47 
48 /**
49  * enum pkt_filter_protocol_layer - packet filter protocol layer
50  * @HDD_FILTER_PROTO_TYPE_INVALID: Invalid initial value
51  * @HDD_FILTER_PROTO_TYPE_MAC: MAC protocol
52  * @HDD_FILTER_PROTO_TYPE_ARP: ARP protocol
53  * @HDD_FILTER_PROTO_TYPE_IPV4: IP V4 protocol
54  * @HDD_FILTER_PROTO_TYPE_IPV6: IP V6 protocol
55  * @HDD_FILTER_PROTO_TYPE_UDP: UDP protocol
56  * @HDD_FILTER_PROTO_TYPE_MAX: Max place holder value
57  */
58 enum pkt_filter_protocol_layer {
59 	HDD_FILTER_PROTO_TYPE_INVALID = 0,
60 	HDD_FILTER_PROTO_TYPE_MAC = 1,
61 	HDD_FILTER_PROTO_TYPE_ARP = 2,
62 	HDD_FILTER_PROTO_TYPE_IPV4 = 3,
63 	HDD_FILTER_PROTO_TYPE_IPV6 = 4,
64 	HDD_FILTER_PROTO_TYPE_UDP = 5,
65 	HDD_FILTER_PROTO_TYPE_MAX
66 };
67 
68 /**
69  * enum pkt_filter_action - packet filter action
70  * @HDD_RCV_FILTER_INVALID: Invalid initial value
71  * @HDD_RCV_FILTER_SET: Packet filter set
72  * @HDD_RCV_FILTER_CLEAR: Packet filter clear
73  * @HDD_RCV_FILTER_MAX: Max place holder value
74  */
75 enum pkt_filter_action {
76 	HDD_RCV_FILTER_INVALID = 0,
77 	HDD_RCV_FILTER_SET = 1,
78 	HDD_RCV_FILTER_CLEAR = 2,
79 	HDD_RCV_FILTER_MAX
80 };
81 
82 /**
83  * enum pkt_filter_compare_flag - packet filter compare flag
84  * @HDD_FILTER_CMP_TYPE_INVALID: Invalid initial value
85  * @HDD_FILTER_CMP_TYPE_EQUAL: Compare if filter is equal
86  * @HDD_FILTER_CMP_TYPE_MASK_EQUAL: Compare if filter mask is equal
87  * @HDD_FILTER_CMP_TYPE_NOT_EQUAL: Compare if filter is not equal
88  * @HDD_FILTER_CMP_TYPE_MASK_NOT_EQUAL: Compare if filter mask is not equal
89  * @HDD_FILTER_CMP_TYPE_MAX: Max place holder value
90  */
91 enum pkt_filter_compare_flag {
92 	HDD_FILTER_CMP_TYPE_INVALID = 0,
93 	HDD_FILTER_CMP_TYPE_EQUAL = 1,
94 	HDD_FILTER_CMP_TYPE_MASK_EQUAL = 2,
95 	HDD_FILTER_CMP_TYPE_NOT_EQUAL = 3,
96 	HDD_FILTER_CMP_TYPE_MASK_NOT_EQUAL = 4,
97 	HDD_FILTER_CMP_TYPE_MAX
98 };
99 
100 /**
101  * struct pkt_filter_param_cfg - packet filter parameter config
102  * @protocol_layer: Protocol layer
103  * @compare_flag: Compare flag
104  * @data_offset: Data offset
105  * @data_length: Data length
106  * @compare_data: Compare data
107  * @data_mask: Data mask
108  */
109 struct pkt_filter_param_cfg {
110 	uint8_t protocol_layer;
111 	uint8_t compare_flag;
112 	uint8_t data_offset;
113 	uint8_t data_length;
114 	uint8_t compare_data[SIR_MAX_FILTER_TEST_DATA_LEN];
115 	uint8_t data_mask[SIR_MAX_FILTER_TEST_DATA_LEN];
116 };
117 
118 /**
119  * struct pkt_filter_cfg - packet filter config received from user space
120  * @filter_action: Filter action
121  * @filter_id: Filter id
122  * @num_params: Number of parameters
123  * @params_data: Packet filter parameters detail
124  */
125 struct pkt_filter_cfg {
126 	uint8_t filter_action;
127 	uint8_t filter_id;
128 	uint8_t num_params;
129 	struct pkt_filter_param_cfg params_data[HDD_MAX_CMP_PER_PACKET_FILTER];
130 };
131 
132 #endif
133 
134 #ifdef FEATURE_ANI_LEVEL_REQUEST
135 /**
136  * struct ani_priv - structure to store the priv data for get ani request
137  * @num_freq: number of freq received from the FW
138  * @ani: data received from the FW
139  */
140 struct ani_priv {
141 	uint32_t num_freq;
142 	struct wmi_host_ani_level_event *ani;
143 };
144 #endif
145 
146 /**
147  * enum suspend_resume_state - Suspend resume state
148  * @HDD_WLAN_EARLY_SUSPEND: Early suspend state.
149  * @HDD_WLAN_SUSPEND: Suspend state.
150  * @HDD_WLAN_EARLY_RESUME: Early resume state.
151  * @HDD_WLAN_RESUME: Resume state.
152  *
153  * Suspend state to indicate in diag event of suspend resume.
154  */
155 enum suspend_resume_state {
156 	 HDD_WLAN_EARLY_SUSPEND,
157 	 HDD_WLAN_SUSPEND,
158 	 HDD_WLAN_EARLY_RESUME,
159 	 HDD_WLAN_RESUME
160 };
161 
162 /**
163  * hdd_svc_fw_shutdown_ind() - API to send FW SHUTDOWN IND to Userspace
164  * @dev: Device Pointer
165  *
166  * Return: None
167  */
168 void hdd_svc_fw_shutdown_ind(struct device *dev);
169 
170 /**
171  * hdd_wlan_shutdown() - HDD SSR shutdown function
172  *
173  * This function is called by the HIF to shutdown the driver during SSR.
174  *
175  * Return: QDF_STATUS_SUCCESS if the driver was shut down,
176  *	or an error status otherwise
177  */
178 QDF_STATUS hdd_wlan_shutdown(void);
179 
180 /**
181  * hdd_wlan_re_init() - HDD SSR re-init function
182  *
183  * This function is called by the HIF to re-initialize the driver after SSR.
184  *
185  * Return: QDF_STATUS_SUCCESS if the driver was re-initialized,
186  *	or an error status otherwise
187  */
188 QDF_STATUS hdd_wlan_re_init(void);
189 
190 /**
191  * hdd_handle_cached_commands() - Handle north bound commands during SSR
192  *
193  * This api will be invoked afte SSR re-initialization to execute the north
194  * bound commands received during SSR.
195  *
196  * Return: None
197  */
198 void hdd_handle_cached_commands(void);
199 
200 /**
201  * hdd_enable_arp_offload() - API to enable ARP offload
202  * @adapter: Adapter context for which ARP offload is to be configured
203  * @vdev: VDEV objmgr pointer
204  * @trigger: trigger reason for request
205  *
206  * Return: None
207  */
208 void hdd_enable_arp_offload(struct hdd_adapter *adapter,
209 			    struct wlan_objmgr_vdev *vdev,
210 			    enum pmo_offload_trigger trigger);
211 
212 /**
213  * hdd_disable_arp_offload() - API to disable ARP offload
214  * @adapter: Adapter context for which ARP offload is to be configured
215  * @vdev: VDEV objmgr pointer
216  * @trigger: trigger reason for request
217  *
218  * Return: None
219  */
220 void hdd_disable_arp_offload(struct hdd_adapter *adapter,
221 			     struct wlan_objmgr_vdev *vdev,
222 			     enum pmo_offload_trigger trigger);
223 
224 /**
225  * hdd_enable_host_offloads() - Central API to enable the supported offloads
226  * @adapter:   pointer to the adapter
227  * @trigger: trigger reason for request
228  *
229  * Central function to enable the supported offloads
230  *
231  * Return: nothing
232  */
233 void hdd_enable_host_offloads(struct hdd_adapter *adapter,
234 			      enum pmo_offload_trigger trigger);
235 
236 /**
237  * hdd_disable_host_offloads() - Central API to disable the supported offloads
238  * @adapter:   pointer to the adapter
239  * @trigger: trigger reason for request
240  *
241  * Central function to disable the supported offloads
242  *
243  * Return: nothing
244  */
245 void hdd_disable_host_offloads(struct hdd_adapter *adapter,
246 			       enum pmo_offload_trigger trigger);
247 
248 /**
249  * hdd_set_grat_arp_keepalive() - Enable gratuitous ARP keepalive
250  * @adapter: the HDD adapter to configure
251  *
252  * This configures gratuitous ARP keepalive based on the adapter's current
253  * connection information, specifically IPv4 address and BSSID
254  *
255  * return: zero for success, non-zero for failure
256  */
257 int hdd_set_grat_arp_keepalive(struct hdd_adapter *adapter);
258 
259 /**
260  * hdd_enable_mc_addr_filtering() - enable MC address list in FW
261  * @adapter: adapter whose MC list is being set
262  * @trigger: trigger reason for request
263  *
264  * Return: nothing
265  */
266 void hdd_enable_mc_addr_filtering(struct hdd_adapter *adapter,
267 				  enum pmo_offload_trigger trigger);
268 
269 /**
270  * hdd_disable_mc_addr_filtering() - disable MC address list in FW
271  * @adapter: adapter whose MC list is being set
272  * @trigger: trigger reason for request
273  *
274  * Return: nothing
275  */
276 void hdd_disable_mc_addr_filtering(struct hdd_adapter *adapter,
277 				   enum pmo_offload_trigger trigger);
278 
279 /**
280  * hdd_cache_mc_addr_list() - API to cache MC address list
281  * @mc_list_config: set of mc address list configurations
282  *
283  * Return: 0 on success else error code
284  */
285 int hdd_cache_mc_addr_list(struct pmo_mc_addr_list_params *mc_list_config);
286 
287 /**
288  * hdd_disable_and_flush_mc_addr_list() - API to Disable & Flush cached MC list
289  * @adapter: adapter whose MC list is being set
290  * @trigger: trigger reason for request
291  *
292  * Return: nothing
293  */
294 void hdd_disable_and_flush_mc_addr_list(struct hdd_adapter *adapter,
295 					enum pmo_offload_trigger trigger);
296 
297 /**
298  * wlan_hdd_cfg80211_update_replay_counter_cb() - replay counter callback
299  * @cb_ctx: Callback context as void* as PMO do not about HDD adapter type
300  * @gtk_rsp_param: Pointer to gtk offload response parameter
301  *
302  * Callback routine called upon receiving of gtk offload rsp from fwr
303  *
304  * Return: none
305  */
306 void wlan_hdd_cfg80211_update_replay_counter_cb(
307 	void *cb_ctx,
308 	struct pmo_gtk_rsp_params *gtk_rsp_param);
309 
310 /**
311  * wlan_hdd_cfg80211_suspend_wlan() - cfg80211 suspend callback
312  * @wiphy: Pointer to wiphy
313  * @wow: Pointer to wow
314  *
315  * This API is called when cfg80211 driver suspends
316  *
317  * Return: integer status
318  */
319 int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
320 				   struct cfg80211_wowlan *wow);
321 
322 /**
323  * wlan_hdd_cfg80211_resume_wlan() - cfg80211 resume callback
324  * @wiphy: Pointer to wiphy
325  *
326  * This API is called when cfg80211 driver resumes driver updates
327  * latest sched_scan scan result(if any) to cfg80211 database
328  *
329  * Return: integer status
330  */
331 int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy);
332 
333 /**
334  * hdd_ipv4_notifier_work_queue() - IP V4 change notifier work handler
335  * @work: Pointer to work context
336  *
337  * Return: none
338  */
339 void hdd_ipv4_notifier_work_queue(struct work_struct *work);
340 
341 #ifdef WLAN_NS_OFFLOAD
342 /**
343  * hdd_enable_ns_offload() - enable NS offload
344  * @adapter: pointer to the adapter
345  * @vdev: VDEV objmgr pointer
346  * @trigger: trigger reason to enable ns offload
347  *
348  * Return: nothing
349  */
350 void hdd_enable_ns_offload(struct hdd_adapter *adapter,
351 			   struct wlan_objmgr_vdev *vdev,
352 			   enum pmo_offload_trigger trigger);
353 
354 /**
355  * hdd_disable_ns_offload() - disable NS offload
356  * @adapter: pointer to the adapter
357  * @vdev: VDEV objmgr pointer
358  * @trigger: trigger reason to enable ns offload
359  *
360  * Return: nothing
361  */
362 void hdd_disable_ns_offload(struct hdd_adapter *adapter,
363 			    struct wlan_objmgr_vdev *vdev,
364 			    enum pmo_offload_trigger trigger);
365 
366 /**
367  * hdd_send_ps_config_to_fw() - Check user pwr save config set/reset PS
368  * @adapter: pointer to hdd adapter
369  *
370  * This function checks the power save configuration saved in MAC context
371  * and sends power save config to FW.
372  *
373  * Return: None
374  */
375 void hdd_send_ps_config_to_fw(struct hdd_adapter *adapter);
376 #else /* WLAN_NS_OFFLOAD */
377 static inline
hdd_enable_ns_offload(struct hdd_adapter * adapter,struct wlan_objmgr_vdev * vdev,enum pmo_offload_trigger trigger)378 void hdd_enable_ns_offload(struct hdd_adapter *adapter,
379 			   struct wlan_objmgr_vdev *vdev,
380 			   enum pmo_offload_trigger trigger)
381 {
382 }
383 
384 static inline
hdd_disable_ns_offload(struct hdd_adapter * adapter,struct wlan_objmgr_vdev * vdev,enum pmo_offload_trigger trigger)385 void hdd_disable_ns_offload(struct hdd_adapter *adapter,
386 			    struct wlan_objmgr_vdev *vdev,
387 			    enum pmo_offload_trigger trigger)
388 {
389 }
390 
391 static inline
hdd_send_ps_config_to_fw(struct hdd_adapter * adapter)392 void hdd_send_ps_config_to_fw(struct hdd_adapter *adapter)
393 {
394 }
395 #endif /* WLAN_NS_OFFLOAD */
396 
397 /**
398  * hdd_ipv6_notifier_work_queue() - IP V6 change notifier work handler
399  * @work: Pointer to work context
400  *
401  * Return: none
402  */
403 void hdd_ipv6_notifier_work_queue(struct work_struct *work);
404 
405 /**
406  * wlan_hdd_cfg80211_get_txpower() - cfg80211 get power handler function
407  * @wiphy: Pointer to wiphy structure.
408  * @wdev: Pointer to wireless_dev structure.
409  * @dbm: dbm
410  *
411  * This is the cfg80211 get txpower handler function which invokes
412  * the internal function @__wlan_hdd_cfg80211_get_txpower with
413  * SSR protection.
414  *
415  * Return: 0 for success, error number on failure.
416  */
417 int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
418 				  struct wireless_dev *wdev,
419 				  int *dbm);
420 
421 /**
422  * wlan_hdd_cfg80211_set_txpower() - set TX power
423  * @wiphy: Pointer to wiphy
424  * @wdev: Pointer to network device
425  * @type: TX power setting type
426  * @dbm: TX power in dbm
427  *
428  * Return: 0 for success, non-zero for failure
429  */
430 int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy,
431 				  struct wireless_dev *wdev,
432 				  enum nl80211_tx_power_setting type,
433 				  int dbm);
434 
435 /**
436  * wlan_hdd_cfg80211_set_power_mgmt() - set cfg80211 power management config
437  * @wiphy: Pointer to wiphy
438  * @dev: Pointer to network device
439  * @allow_power_save: is wlan allowed to go into power save mode
440  * @timeout: Timeout value
441  *
442  * Return: 0 for success, non-zero for failure
443  */
444 int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
445 				     struct net_device *dev,
446 				     bool allow_power_save,
447 				     int timeout);
448 
449 /**
450  * wlan_hdd_ipv4_changed() - IPv4 change notifier callback
451  * @nb: pointer to notifier block
452  * @data: data
453  * @arg: arg
454  *
455  * This is the IPv4 notifier callback function gets invoked
456  * if any change in IP and then invoke the function @__wlan_hdd_ipv4_changed
457  * to reconfigure the offload parameters.
458  *
459  * Return: 0 on success, error number otherwise.
460  */
461 int wlan_hdd_ipv4_changed(struct notifier_block *nb,
462 			  unsigned long data, void *arg);
463 
464 #ifdef FEATURE_RUNTIME_PM
465 /**
466  * wlan_hdd_pm_qos_notify() - PM QOS notifier call back function
467  * @nb: Pointer to notifier block kernel structure
468  * @curr_val: PM QOS current value
469  * @context: call back context
470  *
471  * This callback function for PM QOS change notification is used to setup
472  * dynamic runtime PM.
473  *
474  * Return: NOTIFY_DONE for success
475  */
476 int wlan_hdd_pm_qos_notify(struct notifier_block *nb, unsigned long curr_val,
477 			   void *context);
478 
479 /**
480  * wlan_hdd_is_cpu_pm_qos_in_progress() - WLAN HDD PM QoS Status Function
481  *
482  * This function check for PM QoS global vote.
483  *
484  * @hdd_ctx: hdd_context pointer
485  *
486  * Return: true if there is PM QoS global vote,
487  *	   or an false otherwise
488  */
489 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) && \
490 	defined(__ANDROID_COMMON_KERNEL__))
491 bool wlan_hdd_is_cpu_pm_qos_in_progress(struct hdd_context *hdd_ctx);
492 #else
493 static inline bool
wlan_hdd_is_cpu_pm_qos_in_progress(struct hdd_context * hdd_ctx)494 wlan_hdd_is_cpu_pm_qos_in_progress(struct hdd_context *hdd_ctx)
495 {
496 	return false;
497 }
498 #endif
499 #endif
500 /**
501  * wlan_hdd_ipv6_changed() - IPv6 change notifier callback
502  * @nb: pointer to notifier block
503  * @data: data
504  * @arg: arg
505  *
506  * This is the IPv6 notifier callback function gets invoked
507  * if any change in IP and then invoke the function @__wlan_hdd_ipv6_changed
508  * to reconfigure the offload parameters.
509  *
510  * Return: 0 on success, error number otherwise.
511  */
512 int wlan_hdd_ipv6_changed(struct notifier_block *nb,
513 			  unsigned long data, void *arg);
514 
515 /**
516  * hdd_set_power_config() - set power config to firmware
517  * @hddctx: HDD context
518  * @adapter: HDD adapter
519  * @opm_mode: pointer to vendor opm_mode
520  *
521  * Return: 0 on success; Errno on failure
522  */
523 int hdd_set_power_config(struct hdd_context *hddctx,
524 			 struct hdd_adapter *adapter,
525 			 enum qca_wlan_vendor_opm_mode *opm_mode);
526 
527 /**
528  * hdd_set_power_config_params() - set power config parameters
529  * @hddctx: HDD context
530  * @adapter: HDD adapter
531  * @ps_ito: power save inactivitiy duration in ms
532  * @spec_wake: power save speculative wake duration in ms
533  *
534  * Return: 0 on success; Errno on failure
535  */
536 int hdd_set_power_config_params(struct hdd_context *hddctx,
537 				struct hdd_adapter *adapter,
538 				uint16_t ps_ito, uint16_t spec_wake);
539 #ifdef FEATURE_WLAN_DIAG_SUPPORT
540 /**
541  * hdd_wlan_suspend_resume_event()- send suspend/resume state
542  * @state: suspend/resume state
543  *
544  * This Function sends suspend resume state diag event
545  *
546  * Return: void.
547  */
548 void hdd_wlan_suspend_resume_event(uint8_t state);
549 
550 #else
551 static inline
hdd_wlan_suspend_resume_event(uint8_t state)552 void hdd_wlan_suspend_resume_event(uint8_t state) {}
553 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
554 
555 /**
556  * wlan_hdd_set_powersave() - Set powersave mode
557  * @link_info: Link inof pointer in HDD adapter
558  * @allow_power_save: is wlan allowed to go into power save mode
559  * @timeout: timeout period in ms
560  *
561  * Return: 0 on success, non-zero on any error
562  */
563 int wlan_hdd_set_powersave(struct wlan_hdd_link_info *link_info,
564 			   bool allow_power_save, uint32_t timeout);
565 
566 /**
567  * wlan_hdd_inc_suspend_stats() - Prints, then increments, then prints suspend
568  *	failed statistics.
569  * @hdd_ctx:	The HDD context to operate on
570  * @reason:	The suspend failed reason to increment
571  *
572  * This function prints all of the suspend failed statistics, increments the
573  * specified suspend fail reason statistic, and prints the them all again. This
574  * is for easily keeping track of the most common reasons suspend fails.
575  *
576  * Return: none
577  */
578 void wlan_hdd_inc_suspend_stats(struct hdd_context *hdd_ctx,
579 				enum suspend_fail_reason reason);
580 
581 /*
582  * Unit-test suspend/resume is a testing feature that allows putting firmware
583  * into WoW suspend irrespective of Apps suspend status. It emulates the chain
584  * of events that occur during normal system-level suspend/resume, such as
585  * initiating all of the suspend/resume stages in the correct order, and
586  * enabling/disabling appropriate copy engine irqs.
587  */
588 #ifdef WLAN_SUSPEND_RESUME_TEST
589 /**
590  * wlan_hdd_unit_test_bus_suspend() - suspend the wlan bus
591  * @wow_params: collection of wow enable override parameters
592  *
593  * This function does the same as wlan_hdd_bus_suspend, but additionally passes
594  * the appropriate flags to FW, indicating this is a unit-test suspend and it
595  * should use an HTC wakeup method to resume.
596  *
597  * Return: 0 for success or error code
598  */
599 int wlan_hdd_unit_test_bus_suspend(struct wow_enable_params wow_params);
600 
601 /**
602  * hdd_wlan_fake_apps_resume() - Resume from unit-test triggered suspend
603  * @wiphy: the kernel wiphy struct for the device being resumed
604  * @dev: the kernel net_device struct for the device being resumed
605  *
606  * Return: Zero on success, calls QDF_BUG() on failure
607  */
608 int hdd_wlan_fake_apps_resume(struct wiphy *wiphy, struct net_device *dev);
609 
610 /**
611  * hdd_wlan_fake_apps_suspend() - Initiate a unit-test triggered suspend
612  * @wiphy: the kernel wiphy struct for the device being suspended
613  * @dev: the kernel net_device struct for the device being suspended
614  * @pause_setting: interface pause override setting
615  * @resume_setting: resume trigger override setting
616  *
617  * Return: Zero on success, suspend related non-zero error code on failure
618  */
619 int hdd_wlan_fake_apps_suspend(struct wiphy *wiphy, struct net_device *dev,
620 			       enum wow_interface_pause pause_setting,
621 			       enum wow_resume_trigger resume_setting);
622 #else
623 static inline int
hdd_wlan_fake_apps_resume(struct wiphy * wiphy,struct net_device * dev)624 hdd_wlan_fake_apps_resume(struct wiphy *wiphy, struct net_device *dev)
625 {
626 	return 0;
627 }
628 
629 static inline int
hdd_wlan_fake_apps_suspend(struct wiphy * wiphy,struct net_device * dev,enum wow_interface_pause pause_setting,enum wow_resume_trigger resume_setting)630 hdd_wlan_fake_apps_suspend(struct wiphy *wiphy, struct net_device *dev,
631 			   enum wow_interface_pause pause_setting,
632 			   enum wow_resume_trigger resume_setting)
633 {
634 	return 0;
635 }
636 #endif /* WLAN_SUSPEND_RESUME_TEST */
637 
638 #ifdef WLAN_DP_LEGACY_OL_RX_THREAD
639 /**
640  * wlan_hdd_rx_thread_resume() - Resume RX thread
641  * @hdd_ctx: HDD context
642  *
643  * Check if RX thread suspended, and resume if yes.
644  *
645  * Return: None
646  */
647 void wlan_hdd_rx_thread_resume(struct hdd_context *hdd_ctx);
648 
649 /**
650  * wlan_hdd_rx_thread_suspend() - Suspend RX thread
651  * @hdd_ctx: HDD context
652  *
653  * To suspend RX thread
654  *
655  * Return: 0 for success
656  */
657 int wlan_hdd_rx_thread_suspend(struct hdd_context *hdd_ctx);
658 
659 #else
wlan_hdd_rx_thread_resume(struct hdd_context * hdd_ctx)660 static inline void wlan_hdd_rx_thread_resume(struct hdd_context *hdd_ctx) {}
wlan_hdd_rx_thread_suspend(struct hdd_context * hdd_ctx)661 static inline int wlan_hdd_rx_thread_suspend(struct hdd_context *hdd_ctx)
662 {
663 	return 0;
664 }
665 #endif
666 
667 #ifdef FEATURE_ANI_LEVEL_REQUEST
668 /**
669  * wlan_hdd_get_ani_level() - Wrapper to call API to fetch ani level
670  * @adapter: pointer to HDD adapter
671  * @ani: pointer to structure storing ani level for channels
672  * @parsed_freqs: parsed freqs from the get ani command
673  * @num_freqs: number of parsed channels
674  *
675  * Return: QDF_STATUS
676  */
677 QDF_STATUS wlan_hdd_get_ani_level(struct hdd_adapter *adapter,
678 				  struct wmi_host_ani_level_event *ani,
679 				  uint32_t *parsed_freqs,
680 				  uint8_t num_freqs);
681 #endif /* FEATURE_ANI_LEVEL_REQUEST */
682 
683 #ifdef WLAN_FEATURE_ICMP_OFFLOAD
684 /**
685  * hdd_enable_icmp_offload() - API to enable ICMP offload
686  * @adapter: Adapter context for which ICMP offload is to be configured
687  * @vdev: VDEV ojgmgr pointer
688  * @trigger: trigger reason for request
689  *
690  * Return: None
691  */
692 void hdd_enable_icmp_offload(struct hdd_adapter *adapter,
693 			     struct wlan_objmgr_vdev *vdev,
694 			     enum pmo_offload_trigger trigger);
695 #else
696 static inline
hdd_enable_icmp_offload(struct hdd_adapter * adapter,struct wlan_objmgr_vdev * vdev,enum pmo_offload_trigger trigger)697 void hdd_enable_icmp_offload(struct hdd_adapter *adapter,
698 			     struct wlan_objmgr_vdev *vdev,
699 			     enum pmo_offload_trigger trigger)
700 {}
701 #endif /* FEATURE_ICMP_OFFLOAD */
702 
703 #if defined(WLAN_FEATURE_11BE_MLO) && defined(CFG80211_11BE_BASIC)
704 int wlan_hdd_set_mlo_ps(struct hdd_adapter *adapter,
705 			bool allow_power_save, int timeout,
706 			int link_id);
707 #else
708 static inline
wlan_hdd_set_mlo_ps(struct hdd_adapter * adapter,bool allow_power_save,int timeout,int link_id)709 int wlan_hdd_set_mlo_ps(struct hdd_adapter *adapter,
710 			bool allow_power_save, int timeout,
711 			int link_id)
712 {
713         return 0;
714 }
715 #endif
716 #endif /* __WLAN_HDD_POWER_H */
717