1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 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 object mgmt in pmo.
21  *
22  * Note: This file shall not contain public API's prototype/declarations.
23  *
24  */
25 
26 #ifndef _WLAN_PMO_OBJ_MGMT_PUBLIC_STRUCT_H_
27 #define _WLAN_PMO_OBJ_MGMT_PUBLIC_STRUCT_H_
28 
29 #include "wlan_pmo_common_public_struct.h"
30 #include "wlan_pmo_arp_public_struct.h"
31 #include "wlan_pmo_ns_public_struct.h"
32 #include "wlan_pmo_gtk_public_struct.h"
33 #include "wlan_pmo_wow_public_struct.h"
34 #include "wlan_pmo_mc_addr_filtering_public_struct.h"
35 #include "wlan_pmo_hw_filter_public_struct.h"
36 #include "wlan_pmo_pkt_filter_public_struct.h"
37 #include "wlan_pmo_lphb_public_struct.h"
38 
39 /**
40  * typedef pmo_notify_pause_bitmap() - function for vdev notifying the vdev
41  *                                     pause bitmap new value to mlme
42  * @vdev_id: ID of objmgr vdev object
43  * @value: new pause bitmap value
44  */
45 typedef void (*pmo_notify_pause_bitmap)(uint8_t vdev_id, uint16_t value);
46 
47 /**
48  * typedef pmo_get_cfg_int() - function that gets cfg integer from mlme
49  * @cfg_id: configuration item to retrieve
50  * @value: location to store the configuration item's value
51  *
52  * Return: QDF_STATUS_SUCCESS on success, otherwise QDF_STATUS_E_*
53  */
54 typedef QDF_STATUS (*pmo_get_cfg_int)(int cfg_id, int *value);
55 
56 /**
57  * typedef pmo_get_dtim_period() - function that gets dtim period from mlme
58  * @vdev_id: ID of objmgr vdev object
59  * @value: location to store the DTIM period
60  *
61  * Return: QDF_STATUS_SUCCESS on success, otherwise QDF_STATUS_E_*
62  */
63 typedef QDF_STATUS (*pmo_get_dtim_period)(uint8_t vdev_id, uint8_t *value);
64 
65 /**
66  * typedef pmo_get_beacon_interval() - function that gets beacon interval
67  *                                     from mlme
68  * @vdev_id: ID of objmgr vdev object
69  * @value: location to store the beacon interval
70  *
71  * Return: QDF_STATUS_SUCCESS on success, otherwise QDF_STATUS_E_*
72  */
73 typedef QDF_STATUS (*pmo_get_beacon_interval)(uint8_t vdev_id, uint16_t *value);
74 
75 /**
76  * typedef pmo_get_pause_bitmap() - function for getting vdev pause bitmap
77  * @vdev_id: ID of objmgr vdev object
78  *
79  * Return: vdev pause bitmap
80  */
81 typedef  uint16_t(*pmo_get_pause_bitmap)(uint8_t vdev_id);
82 
83 /**
84  * typedef pmo_get_vdev_dp_handle() - for getting vdev datapath handle
85  * @vdev_id: ID of objmgr vdev object
86  *
87  * Return: datapath handle of the associated vdev if found, or NULL
88  */
89 typedef struct cdp_vdev *(*pmo_get_vdev_dp_handle)(uint8_t vdev_id);
90 
91 /**
92  * typedef pmo_is_device_in_low_pwr_mode() - to know is device is in power
93  *                                           save mode
94  * @vdev_id: ID of objmgr vdev object
95  *
96  * Return: true if associated devicce is in power save
97  */
98 typedef  bool (*pmo_is_device_in_low_pwr_mode)(uint8_t vdev_id);
99 
100 /**
101  * typedef pmo_pld_auto_suspend_cb() - pld auto suspend callback during runtime
102  *                                     suspend
103  *
104  * Return: 0 on success, negative errno on failure
105  */
106 typedef int (*pmo_pld_auto_suspend_cb)(void);
107 
108 /**
109  * typedef pmo_pld_auto_resume_cb() - pld auto resume callback during runtime
110  *                                    resume
111  *
112  * Return: 0 on success, negative errno on failure
113  */
114 typedef int (*pmo_pld_auto_resume_cb)(void);
115 
116 /**
117  * struct wlan_pmo_tx_ops - structure of tx function
118  *					pointers for pmo component
119  * @send_arp_offload_req: fp to send arp offload request
120  * @send_conf_hw_filter_req: fp to configure hardware filter in DTIM mode
121  * @send_ns_offload_req: fp to send ns offload request
122  * @send_non_arp_bcast_filter_req: for enable/disable  broadcast filter
123  * @send_set_pkt_filter: send set packet filter
124  * @send_clear_pkt_filter: send clear packet filter
125  * @send_enable_wow_wakeup_event_req: fp to send enable wow wakeup events req
126  * @send_disable_wow_wakeup_event_req: fp to send disable wow wakeup events req
127  * @send_add_wow_pattern: fp to send wow pattern request
128  * @del_wow_pattern: fp to delete wow pattern from firmware
129  * @send_enhance_mc_offload_req: fp to send enhanced multicast offload request
130  * @send_set_mc_filter_req: fp to send set mc filter request
131  * @send_clear_mc_filter_req: fp to send clear mc filter request
132  * @get_multiple_mc_filter_support: fp to get mc filter support
133  * @send_set_multiple_mc_filter_req: fp to send set multiple mc filter request
134  * @send_clear_multiple_mc_filter_req: fp to send clear multiple mc filter req
135  * @send_ra_filter_req: fp to send ra filter request
136  * @send_gtk_offload_req: fp to send gtk offload request command
137  * @send_get_gtk_rsp_cmd: fp to send get gtk response request cmd to firmware
138  * @send_action_frame_pattern_req: fp to send wow action frame patterns request
139  * @send_lphb_enable: fp to send lphb enable request command
140  * @send_lphb_tcp_params: fp to send lphb tcp params request command
141  * @send_lphb_tcp_filter_req: fp to send lphb tcp packet filter request command
142  * @send_lphb_upd_params: fp to send lphb udp params request command
143  * @send_lphb_udp_filter_req: fp to send lphb udp packet filter request command
144  * @send_vdev_param_update_req: fp to send vdev param request
145  * @send_vdev_sta_ps_param_req: fp to send sta vdev ps power set req
146  * @send_igmp_offload_req: fp to send IGMP offload request
147  * @psoc_update_wow_bus_suspend: fp to update bus suspend req flag at wmi
148  * @psoc_get_host_credits: fp to get the host credits
149  * @psoc_get_pending_cmnds: fp to get the host pending wmi commands
150  * @update_target_suspend_flag: fp to update target suspend flag at wmi
151  * @update_target_suspend_acked_flag: fp to update target suspend acked flag
152  *                                    at wmi
153  * @is_target_suspended: fp to test if target is suspended
154  * @psoc_send_wow_enable_req: fp to send wow enable request
155  * @psoc_send_supend_req: fp to send target suspend request
156  * @psoc_set_runtime_pm_in_progress: fp to set runtime pm is in progress status
157  * @psoc_get_runtime_pm_in_progress: fp to get runtime pm is in progress status
158  * @psoc_send_host_wakeup_ind: fp tp send host wake indication to fwr
159  * @psoc_send_target_resume_req: fp to send target resume request
160  * @psoc_send_d0wow_enable_req: fp to send D0 WOW enable request
161  * @psoc_send_d0wow_disable_req: fp to send D0 WOW disable request
162  * @psoc_send_idle_roam_suspend_mode: fp to send suspend mode for
163  * idle roam  trigger to firmware.
164  * @send_icmp_offload_req: fp to send icmp offload request
165  * @psoc_set_wow_enable_ack_failed: fp to set wow enable ack failure status
166  */
167 struct wlan_pmo_tx_ops {
168 	QDF_STATUS (*send_arp_offload_req)(struct wlan_objmgr_vdev *vdev,
169 			struct pmo_arp_offload_params *arp_offload_req,
170 			struct pmo_ns_offload_params *ns_offload_req);
171 	QDF_STATUS (*send_conf_hw_filter_req)(
172 			struct wlan_objmgr_psoc *psoc,
173 			struct pmo_hw_filter_params *req);
174 	QDF_STATUS (*send_ns_offload_req)(struct wlan_objmgr_vdev *vdev,
175 			struct pmo_arp_offload_params *arp_offload_req,
176 			struct pmo_ns_offload_params *ns_offload_req);
177 #ifdef WLAN_FEATURE_PACKET_FILTERING
178 	QDF_STATUS(*send_set_pkt_filter)(struct wlan_objmgr_vdev *vdev,
179 			struct pmo_rcv_pkt_fltr_cfg *pmo_set_pkt_fltr_req);
180 	QDF_STATUS(*send_clear_pkt_filter)(struct wlan_objmgr_vdev *vdev,
181 			struct pmo_rcv_pkt_fltr_clear_param
182 						*pmo_clr_pkt_fltr_param);
183 #endif
184 	QDF_STATUS (*send_enable_wow_wakeup_event_req)(
185 			struct wlan_objmgr_vdev *vdev,
186 			uint32_t *bitmap);
187 	QDF_STATUS (*send_disable_wow_wakeup_event_req)(
188 			struct wlan_objmgr_vdev *vdev,
189 			uint32_t *bitmap);
190 	QDF_STATUS (*send_add_wow_pattern)(
191 			struct wlan_objmgr_vdev *vdev,
192 			uint8_t ptrn_id, const uint8_t *ptrn, uint8_t ptrn_len,
193 			uint8_t ptrn_offset, const uint8_t *mask,
194 			uint8_t mask_len, bool user);
195 	QDF_STATUS (*del_wow_pattern)(
196 			struct wlan_objmgr_vdev *vdev, uint8_t ptrn_id);
197 	QDF_STATUS (*send_enhance_mc_offload_req)(
198 			struct wlan_objmgr_vdev *vdev, bool enable);
199 	QDF_STATUS (*send_set_mc_filter_req)(
200 			struct wlan_objmgr_vdev *vdev,
201 			struct qdf_mac_addr multicast_addr);
202 	QDF_STATUS (*send_clear_mc_filter_req)(
203 			struct wlan_objmgr_vdev *vdev,
204 			struct qdf_mac_addr multicast_addr);
205 	bool (*get_multiple_mc_filter_support)(
206 			struct wlan_objmgr_psoc *psoc);
207 	QDF_STATUS(*send_set_multiple_mc_filter_req)(
208 			struct wlan_objmgr_vdev *vdev,
209 			struct pmo_mc_addr_list *mc_list);
210 	QDF_STATUS(*send_clear_multiple_mc_filter_req)(
211 			struct wlan_objmgr_vdev *vdev,
212 			struct pmo_mc_addr_list *mc_list);
213 	QDF_STATUS (*send_ra_filter_req)(
214 			struct wlan_objmgr_vdev *vdev,
215 			uint8_t default_pattern, uint16_t rate_limit_interval);
216 	QDF_STATUS (*send_gtk_offload_req)(
217 			struct wlan_objmgr_vdev *vdev,
218 			struct pmo_gtk_req *gtk_offload_req);
219 	QDF_STATUS (*send_get_gtk_rsp_cmd)(struct wlan_objmgr_vdev *vdev);
220 	QDF_STATUS (*send_action_frame_pattern_req)(
221 			struct wlan_objmgr_vdev *vdev,
222 			struct pmo_action_wakeup_set_params *ip_cmd);
223 	QDF_STATUS (*send_lphb_enable)(
224 			struct wlan_objmgr_psoc *psoc,
225 			struct pmo_lphb_enable_req *ts_lphb_enable);
226 	QDF_STATUS (*send_lphb_tcp_params)(
227 			struct wlan_objmgr_psoc *psoc,
228 			struct pmo_lphb_tcp_params *ts_lphb_tcp_param);
229 	QDF_STATUS (*send_lphb_tcp_filter_req)(
230 			struct wlan_objmgr_psoc *psoc,
231 			struct pmo_lphb_tcp_filter_req *ts_lphb_tcp_filter);
232 	QDF_STATUS (*send_lphb_upd_params)(
233 			struct wlan_objmgr_psoc *psoc,
234 			struct pmo_lphb_udp_params *ts_lphb_udp_param);
235 	QDF_STATUS (*send_lphb_udp_filter_req)(
236 			struct wlan_objmgr_psoc *psoc,
237 			struct pmo_lphb_udp_filter_req *ts_lphb_udp_filter);
238 	QDF_STATUS (*send_vdev_param_update_req)(
239 			struct wlan_objmgr_vdev *vdev,
240 			uint32_t param_id, uint32_t param_value);
241 	QDF_STATUS (*send_vdev_sta_ps_param_req)(
242 			struct wlan_objmgr_vdev *vdev,
243 			uint32_t ps_mode, uint32_t value);
244 #ifdef WLAN_FEATURE_IGMP_OFFLOAD
245 	QDF_STATUS (*send_igmp_offload_req)(
246 			struct wlan_objmgr_vdev *vdev,
247 			struct pmo_igmp_offload_req *pmo_igmp_req);
248 #endif
249 	void (*psoc_update_wow_bus_suspend)(
250 			struct wlan_objmgr_psoc *psoc, uint8_t value);
251 	int (*psoc_get_host_credits)(
252 			struct wlan_objmgr_psoc *psoc);
253 	int (*psoc_get_pending_cmnds)(
254 			struct wlan_objmgr_psoc *psoc);
255 	void (*update_target_suspend_flag)(
256 		struct wlan_objmgr_psoc *psoc, uint8_t value);
257 	void (*update_target_suspend_acked_flag)(
258 		struct wlan_objmgr_psoc *psoc, uint8_t value);
259 	bool (*is_target_suspended)(struct wlan_objmgr_psoc *psoc);
260 	QDF_STATUS (*psoc_send_wow_enable_req)(struct wlan_objmgr_psoc *psoc,
261 		struct pmo_wow_cmd_params *param);
262 	QDF_STATUS (*psoc_send_supend_req)(struct wlan_objmgr_psoc *psoc,
263 		struct pmo_suspend_params *param);
264 	void (*psoc_set_runtime_pm_in_progress)(struct wlan_objmgr_psoc *psoc,
265 						bool value);
266 	bool (*psoc_get_runtime_pm_in_progress)(struct wlan_objmgr_psoc *psoc);
267 	QDF_STATUS (*psoc_send_host_wakeup_ind)(struct wlan_objmgr_psoc *psoc);
268 	QDF_STATUS (*psoc_send_target_resume_req)(
269 			struct wlan_objmgr_psoc *psoc);
270 	QDF_STATUS (*psoc_send_d0wow_enable_req)(
271 			struct wlan_objmgr_psoc *psoc);
272 	QDF_STATUS (*psoc_send_d0wow_disable_req)(
273 			struct wlan_objmgr_psoc *psoc);
274 	QDF_STATUS (*psoc_send_idle_roam_suspend_mode)(
275 			struct wlan_objmgr_psoc *psoc, uint8_t val);
276 #ifdef WLAN_FEATURE_ICMP_OFFLOAD
277 	QDF_STATUS (*send_icmp_offload_req)(
278 			struct wlan_objmgr_psoc *psoc,
279 			struct pmo_icmp_offload *pmo_icmp_req);
280 #endif
281 	void (*psoc_set_wow_enable_ack_failed)(struct wlan_objmgr_psoc *psoc);
282 };
283 
284 #endif /* end  of _WLAN_PMO_OBJ_MGMT_PUBLIC_STRUCT_H_ */
285