xref: /wlan-dirver/qcacld-3.0/core/hdd/inc/wlan_hdd_power.h (revision be9a0ab9410bb65f899b9fceac3229cd023a706e)
1 /*
2  * Copyright (c) 2012, 2014-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 #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
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
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
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 bool wlan_hdd_is_cpu_pm_qos_in_progress(struct hdd_context *hdd_ctx);
491 #else
492 static inline bool
493 wlan_hdd_is_cpu_pm_qos_in_progress(struct hdd_context *hdd_ctx)
494 {
495 	return false;
496 }
497 #endif
498 #endif
499 /**
500  * wlan_hdd_ipv6_changed() - IPv6 change notifier callback
501  * @nb: pointer to notifier block
502  * @data: data
503  * @arg: arg
504  *
505  * This is the IPv6 notifier callback function gets invoked
506  * if any change in IP and then invoke the function @__wlan_hdd_ipv6_changed
507  * to reconfigure the offload parameters.
508  *
509  * Return: 0 on success, error number otherwise.
510  */
511 int wlan_hdd_ipv6_changed(struct notifier_block *nb,
512 			  unsigned long data, void *arg);
513 
514 /**
515  * hdd_set_power_config() - set power config to firmware
516  * @hddctx: HDD context
517  * @adapter: HDD adapter
518  * @opm_mode: pointer to vendor opm_mode
519  *
520  * Return: 0 on success; Errno on failure
521  */
522 int hdd_set_power_config(struct hdd_context *hddctx,
523 			 struct hdd_adapter *adapter,
524 			 enum qca_wlan_vendor_opm_mode *opm_mode);
525 
526 /**
527  * hdd_set_power_config_params() - set power config parameters
528  * @hddctx: HDD context
529  * @adapter: HDD adapter
530  * @ps_ito: power save inactivitiy duration in ms
531  * @spec_wake: power save speculative wake duration in ms
532  *
533  * Return: 0 on success; Errno on failure
534  */
535 int hdd_set_power_config_params(struct hdd_context *hddctx,
536 				struct hdd_adapter *adapter,
537 				uint16_t ps_ito, uint16_t spec_wake);
538 #ifdef FEATURE_WLAN_DIAG_SUPPORT
539 /**
540  * hdd_wlan_suspend_resume_event()- send suspend/resume state
541  * @state: suspend/resume state
542  *
543  * This Function sends suspend resume state diag event
544  *
545  * Return: void.
546  */
547 void hdd_wlan_suspend_resume_event(uint8_t state);
548 
549 #else
550 static inline
551 void hdd_wlan_suspend_resume_event(uint8_t state) {}
552 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
553 
554 /**
555  * wlan_hdd_set_powersave() - Set powersave mode
556  * @link_info: Link inof pointer in HDD adapter
557  * @allow_power_save: is wlan allowed to go into power save mode
558  * @timeout: timeout period in ms
559  *
560  * Return: 0 on success, non-zero on any error
561  */
562 int wlan_hdd_set_powersave(struct wlan_hdd_link_info *link_info,
563 			   bool allow_power_save, uint32_t timeout);
564 
565 /**
566  * wlan_hdd_inc_suspend_stats() - Prints, then increments, then prints suspend
567  *	failed statistics.
568  * @hdd_ctx:	The HDD context to operate on
569  * @reason:	The suspend failed reason to increment
570  *
571  * This function prints all of the suspend failed statistics, increments the
572  * specified suspend fail reason statistic, and prints the them all again. This
573  * is for easily keeping track of the most common reasons suspend fails.
574  *
575  * Return: none
576  */
577 void wlan_hdd_inc_suspend_stats(struct hdd_context *hdd_ctx,
578 				enum suspend_fail_reason reason);
579 
580 /*
581  * Unit-test suspend/resume is a testing feature that allows putting firmware
582  * into WoW suspend irrespective of Apps suspend status. It emulates the chain
583  * of events that occur during normal system-level suspend/resume, such as
584  * initiating all of the suspend/resume stages in the correct order, and
585  * enabling/disabling appropriate copy engine irqs.
586  */
587 #ifdef WLAN_SUSPEND_RESUME_TEST
588 /**
589  * wlan_hdd_unit_test_bus_suspend() - suspend the wlan bus
590  * @wow_params: collection of wow enable override parameters
591  *
592  * This function does the same as wlan_hdd_bus_suspend, but additionally passes
593  * the appropriate flags to FW, indicating this is a unit-test suspend and it
594  * should use an HTC wakeup method to resume.
595  *
596  * Return: 0 for success or error code
597  */
598 int wlan_hdd_unit_test_bus_suspend(struct wow_enable_params wow_params);
599 
600 /**
601  * hdd_wlan_fake_apps_resume() - Resume from unit-test triggered suspend
602  * @wiphy: the kernel wiphy struct for the device being resumed
603  * @dev: the kernel net_device struct for the device being resumed
604  *
605  * Return: Zero on success, calls QDF_BUG() on failure
606  */
607 int hdd_wlan_fake_apps_resume(struct wiphy *wiphy, struct net_device *dev);
608 
609 /**
610  * hdd_wlan_fake_apps_suspend() - Initiate a unit-test triggered suspend
611  * @wiphy: the kernel wiphy struct for the device being suspended
612  * @dev: the kernel net_device struct for the device being suspended
613  * @pause_setting: interface pause override setting
614  * @resume_setting: resume trigger override setting
615  *
616  * Return: Zero on success, suspend related non-zero error code on failure
617  */
618 int hdd_wlan_fake_apps_suspend(struct wiphy *wiphy, struct net_device *dev,
619 			       enum wow_interface_pause pause_setting,
620 			       enum wow_resume_trigger resume_setting);
621 #else
622 static inline int
623 hdd_wlan_fake_apps_resume(struct wiphy *wiphy, struct net_device *dev)
624 {
625 	return 0;
626 }
627 
628 static inline int
629 hdd_wlan_fake_apps_suspend(struct wiphy *wiphy, struct net_device *dev,
630 			   enum wow_interface_pause pause_setting,
631 			   enum wow_resume_trigger resume_setting)
632 {
633 	return 0;
634 }
635 #endif /* WLAN_SUSPEND_RESUME_TEST */
636 
637 #ifdef WLAN_DP_LEGACY_OL_RX_THREAD
638 /**
639  * wlan_hdd_rx_thread_resume() - Resume RX thread
640  * @hdd_ctx: HDD context
641  *
642  * Check if RX thread suspended, and resume if yes.
643  *
644  * Return: None
645  */
646 void wlan_hdd_rx_thread_resume(struct hdd_context *hdd_ctx);
647 
648 /**
649  * wlan_hdd_rx_thread_suspend() - Suspend RX thread
650  * @hdd_ctx: HDD context
651  *
652  * To suspend RX thread
653  *
654  * Return: 0 for success
655  */
656 int wlan_hdd_rx_thread_suspend(struct hdd_context *hdd_ctx);
657 
658 #else
659 static inline void wlan_hdd_rx_thread_resume(struct hdd_context *hdd_ctx) {}
660 static inline int wlan_hdd_rx_thread_suspend(struct hdd_context *hdd_ctx)
661 {
662 	return 0;
663 }
664 #endif
665 
666 #ifdef FEATURE_ANI_LEVEL_REQUEST
667 /**
668  * wlan_hdd_get_ani_level() - Wrapper to call API to fetch ani level
669  * @adapter: pointer to HDD adapter
670  * @ani: pointer to structure storing ani level for channels
671  * @parsed_freqs: parsed freqs from the get ani command
672  * @num_freqs: number of parsed channels
673  *
674  * Return: QDF_STATUS
675  */
676 QDF_STATUS wlan_hdd_get_ani_level(struct hdd_adapter *adapter,
677 				  struct wmi_host_ani_level_event *ani,
678 				  uint32_t *parsed_freqs,
679 				  uint8_t num_freqs);
680 #endif /* FEATURE_ANI_LEVEL_REQUEST */
681 
682 #ifdef WLAN_FEATURE_ICMP_OFFLOAD
683 /**
684  * hdd_enable_icmp_offload() - API to enable ICMP offload
685  * @adapter: Adapter context for which ICMP offload is to be configured
686  * @vdev: VDEV ojgmgr pointer
687  * @trigger: trigger reason for request
688  *
689  * Return: None
690  */
691 void hdd_enable_icmp_offload(struct hdd_adapter *adapter,
692 			     struct wlan_objmgr_vdev *vdev,
693 			     enum pmo_offload_trigger trigger);
694 #else
695 static inline
696 void hdd_enable_icmp_offload(struct hdd_adapter *adapter,
697 			     struct wlan_objmgr_vdev *vdev,
698 			     enum pmo_offload_trigger trigger)
699 {}
700 #endif /* FEATURE_ICMP_OFFLOAD */
701 
702 #if defined(WLAN_FEATURE_11BE_MLO) && defined(CFG80211_11BE_BASIC)
703 int wlan_hdd_set_mlo_ps(struct hdd_adapter *adapter,
704 			bool allow_power_save, int timeout,
705 			int link_id);
706 #else
707 static inline
708 int wlan_hdd_set_mlo_ps(struct hdd_adapter *adapter,
709 			bool allow_power_save, int timeout,
710 			int link_id)
711 {
712         return 0;
713 }
714 #endif
715 #endif /* __WLAN_HDD_POWER_H */
716