xref: /wlan-driver/qcacld-3.0/components/pmo/core/inc/wlan_pmo_priv.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2019, 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: Declare various struct, macros which are used for private to PMO.
21   *
22   * Note: This file shall not contain public API's prototype/declarations.
23   *
24   */
25 
26 #ifndef _WLAN_PMO_PRIV_STRUCT_H_
27 #define _WLAN_PMO_PRIV_STRUCT_H_
28 
29 #ifdef WLAN_POWER_MANAGEMENT_OFFLOAD
30 
31 #include "wlan_pmo_common_public_struct.h"
32 #include "wlan_pmo_arp_public_struct.h"
33 #include "wlan_pmo_ns_public_struct.h"
34 #include "wlan_pmo_gtk_public_struct.h"
35 #include "wlan_pmo_wow_public_struct.h"
36 #include "wlan_pmo_mc_addr_filtering_public_struct.h"
37 
38 #define PMO_PS_DATA_INACTIVITY_TIMEOUT (200)
39 #define PMO_PS_DATA_SPEC_WAKE (0)
40 
41 /**
42  * struct pmo_psoc_priv_obj - psoc related data require for pmo
43  * @psoc_cfg: place holder for psoc configuration
44  * @pmo_tx_ops: transmit ops for PMO
45  * @wow: wow configuration
46  * @caps: PMO specific device capability bits
47  * @dp_hdl: psoc data path handle
48  * @htc_hdl: htc layer handle
49  * @hif_hdl: hif layer handle
50  * @txrx_pdev_id: txrx pdev identifier
51  * @pause_bitmap_notifier: registered callback to update pause bitmap value
52  * @get_pause_bitmap: registered callback to get pause bitmap value
53  * @get_vdev_dp_handle: registered callback to get vdev's DP handle
54  * @is_device_in_low_pwr_mode: registered callback to determine if the
55  *                             device is in low power mode
56  * @get_dtim_period: register callback to get dtim period from mlme
57  * @get_beacon_interval: register callback to get beacon interval from mlme
58  * @lock: spin lock for pmo psoc
59  */
60 struct pmo_psoc_priv_obj {
61 	struct pmo_psoc_cfg psoc_cfg;
62 	struct wlan_pmo_tx_ops pmo_tx_ops;
63 	struct pmo_wow wow;
64 	struct pmo_device_caps caps;
65 	void *dp_hdl;
66 	void *htc_hdl;
67 	void *hif_hdl;
68 	uint8_t txrx_pdev_id;
69 	pmo_notify_pause_bitmap pause_bitmap_notifier;
70 	pmo_get_pause_bitmap get_pause_bitmap;
71 	pmo_get_vdev_dp_handle get_vdev_dp_handle;
72 	pmo_is_device_in_low_pwr_mode is_device_in_low_pwr_mode;
73 	pmo_get_dtim_period get_dtim_period;
74 	pmo_get_beacon_interval get_beacon_interval;
75 	qdf_spinlock_t lock;
76 };
77 
78 /**
79  * struct wlan_pmo_ctx -offload mgr context
80  * @psoc_context:     psoc context
81  * @pmo_suspend_handler: suspend handler table for all components
82  * @pmo_suspend_handler_arg: suspend handler argument sfor all components
83  * @pmo_resume_handler: resume handler table for all components
84  * @pmo_resume_handler_arg: resume handler argument for all components
85  * @lock: lock for global pmo ctx
86  */
87 struct wlan_pmo_ctx {
88 	pmo_psoc_suspend_handler
89 		pmo_suspend_handler[WLAN_UMAC_MAX_COMPONENTS];
90 	void *pmo_suspend_handler_arg[WLAN_UMAC_MAX_COMPONENTS];
91 	pmo_psoc_resume_handler
92 		pmo_resume_handler[WLAN_UMAC_MAX_COMPONENTS];
93 	void *pmo_resume_handler_arg[WLAN_UMAC_MAX_COMPONENTS];
94 	qdf_spinlock_t lock;
95 };
96 
97 /**
98  * struct pmo_vdev_priv_obj -vdev specific user configuration required for pmo
99  * @pmo_psoc_ctx: pmo psoc ctx
100  * @vdev_arp_req: place holder for arp request for vdev
101  * @vdev_ns_req: place holder for ns request for vdev
102  * @vdev_mc_list_req: place holder for mc addr list for vdev
103  * @addr_filter_pattern: addr filter pattern for vdev
104  * @vdev_gtk_req: place holder for gtk request for vdev
105  * @vdev_gtk_rsp_req: place holder for gtk response request for vdev
106  * @ps_params: OPM params
107  * @gtk_err_enable: gtk error is enabled or not
108  * @vdev_bpf_req: place holder for apf/bpf for vdev
109  * @vdev_pkt_filter: place holder for vdev packet filter
110  * @magic_ptrn_enable: true when magic pattern is enabled else false
111  * @ptrn_match_enable: true when pattern match is enabled else false
112  * @num_wow_default_patterns: number of wow default patterns for vdev
113  * @num_wow_user_patterns: number of user wow patterns for vdev
114  * @extscan_in_progress: true when extscan in progress else false
115  * @p2plo_in_progress: true when p2plo_in_progress in progress else false
116  * @dtim_period: dtim period for vdev
117  * @beacon_interval: vdev beacon interval
118  * @dyn_modulated_dtim: dynamically configured modulated dtim value
119  * @dyn_modulated_dtim_enabled: if dynamically modulated dtim is set or not
120  * @is_dyn_modulated_dtim_activated: if dynamically modulated dtim is sent to fw
121  * @dyn_listen_interval: dynamically user configured listen interval
122  * @restore_dtim_setting: DTIM settings restore flag
123  * @pmo_vdev_lock: spin lock for pmo vdev priv ctx
124  * @dyn_arp_ns_offload_disable: true when arp/ns offload is disable
125  * @dyn_arp_ns_offload_rt_lock: wake lock which prevent runtime pm happen if
126  *                              arp/ns offload is disable
127  * @bridgeaddr: Bridge MAC address
128  */
129 struct pmo_vdev_priv_obj {
130 	struct pmo_psoc_priv_obj *pmo_psoc_ctx;
131 	struct pmo_arp_offload_params vdev_arp_req;
132 	struct pmo_ns_offload_params vdev_ns_req;
133 	struct pmo_mc_addr_list vdev_mc_list_req;
134 	uint8_t addr_filter_pattern;
135 	struct pmo_gtk_req vdev_gtk_req;
136 	struct pmo_gtk_rsp_req vdev_gtk_rsp_req;
137 	struct pmo_ps_params ps_params;
138 	qdf_atomic_t gtk_err_enable;
139 	bool magic_ptrn_enable;
140 	bool ptrn_match_enable;
141 	uint8_t num_wow_default_patterns;
142 	uint8_t num_wow_user_patterns;
143 	bool extscan_in_progress;
144 	bool p2plo_in_progress;
145 	uint8_t dtim_period;
146 	uint8_t beacon_interval;
147 	uint32_t dyn_modulated_dtim;
148 	bool dyn_modulated_dtim_enabled;
149 	bool is_dyn_modulated_dtim_activated;
150 	uint32_t dyn_listen_interval;
151 	bool restore_dtim_setting;
152 	qdf_spinlock_t pmo_vdev_lock;
153 #ifdef FEATURE_WLAN_DYNAMIC_ARP_NS_OFFLOAD
154 	bool dyn_arp_ns_offload_disable;
155 	qdf_runtime_lock_t dyn_arp_ns_offload_rt_lock;
156 #endif
157 	uint8_t bridgeaddr[QDF_MAC_ADDR_SIZE];
158 };
159 
160 #endif /* WLAN_POWER_MANAGEMENT_OFFLOAD */
161 #endif /* end  of _WLAN_PMO_PRIV_STRUCT_H_ */
162