xref: /wlan-driver/qcacld-3.0/components/pmo/dispatcher/inc/wlan_pmo_tgt_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
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 public API for pmo to interact with target/WMI
21  */
22 
23 #ifndef _WLAN_PMO_TGT_API_H_
24 #define _WLAN_PMO_TGT_API_H_
25 
26 #include "wlan_pmo_common_public_struct.h"
27 #include "wlan_pmo_arp_public_struct.h"
28 #include "wlan_pmo_ns_public_struct.h"
29 #include "wlan_pmo_gtk_public_struct.h"
30 #include "wlan_pmo_wow_public_struct.h"
31 #include "wlan_pmo_mc_addr_filtering_public_struct.h"
32 #include "wlan_pmo_hw_filter_public_struct.h"
33 #include "wlan_pmo_pkt_filter_public_struct.h"
34 
35 #define GET_PMO_TX_OPS_FROM_PSOC(psoc) \
36 	(pmo_psoc_get_priv(psoc)->pmo_tx_ops)
37 
38 /**
39  * pmo_tgt_conf_hw_filter() - configure hardware filter mode in firmware
40  * @psoc: the psoc to use to communicate with firmware
41  * @req: the configuration request
42  *
43  * Return: QDF_STATUS
44  */
45 QDF_STATUS pmo_tgt_conf_hw_filter(struct wlan_objmgr_psoc *psoc,
46 				  struct pmo_hw_filter_params *req);
47 
48 /**
49  * pmo_tgt_set_pkt_filter() - Set packet filter
50  * @vdev: objmgr vdev
51  * @pmo_set_pkt_fltr_req:
52  * @vdev_id: vdev id
53  *
54  * API to set packet filter
55  *
56  * Return: QDF_STATUS_SUCCESS in case of success else return error
57  */
58 QDF_STATUS pmo_tgt_set_pkt_filter(struct wlan_objmgr_vdev *vdev,
59 		struct pmo_rcv_pkt_fltr_cfg *pmo_set_pkt_fltr_req,
60 		uint8_t vdev_id);
61 
62 /**
63  * pmo_tgt_clear_pkt_filter() - Clear packet filter
64  * @vdev: objmgr vdev
65  * @pmo_clr_pkt_fltr_param:
66  * @vdev_id: vdev id
67  *
68  * API to clear packet filter
69  *
70  * Return: QDF_STATUS_SUCCESS in case of success else return error
71  */
72 QDF_STATUS pmo_tgt_clear_pkt_filter(struct wlan_objmgr_vdev *vdev,
73 		struct pmo_rcv_pkt_fltr_clear_param *pmo_clr_pkt_fltr_param,
74 		uint8_t vdev_id);
75 
76 /**
77  * pmo_tgt_enable_arp_offload_req() - Enable arp offload req to target
78  * @vdev: objmgr vdev
79  * @vdev_id: vdev id
80  *
81  * Return: QDF status
82  */
83 QDF_STATUS pmo_tgt_enable_arp_offload_req(struct wlan_objmgr_vdev *vdev,
84 		uint8_t vdev_id);
85 
86 /**
87  * pmo_tgt_disable_arp_offload_req() - Disable arp offload req to target
88  * @vdev: objmgr vdev
89  * @vdev_id: vdev id
90  *
91  * Return: QDF status
92  */
93 QDF_STATUS pmo_tgt_disable_arp_offload_req(struct wlan_objmgr_vdev *vdev,
94 		uint8_t vdev_id);
95 
96 #ifdef WLAN_NS_OFFLOAD
97 /**
98  * pmo_tgt_enable_ns_offload_req() -  Send ns offload req to targe
99  * @vdev: objmgr vdev
100  * @vdev_id: vdev id
101  *
102  * Return: QDF status
103  */
104 QDF_STATUS pmo_tgt_enable_ns_offload_req(struct wlan_objmgr_vdev *vdev,
105 		uint8_t vdev_id);
106 
107 /**
108  * pmo_tgt_disable_ns_offload_req() - Disable arp offload req to target
109  * @vdev: objmgr vdev
110  * @vdev_id: vdev id
111  *
112  * Return: QDF status
113  */
114 QDF_STATUS pmo_tgt_disable_ns_offload_req(struct wlan_objmgr_vdev *vdev,
115 		uint8_t vdev_id);
116 #endif /* WLAN_NS_OFFLOAD */
117 
118 /**
119  * pmo_tgt_enable_wow_wakeup_event() - Send Enable wow wakeup events req to fwr
120  * @vdev: objmgr vdev handle
121  * @bitmap: Event bitmap
122  *
123  * Return: QDF status
124  */
125 QDF_STATUS pmo_tgt_enable_wow_wakeup_event(struct wlan_objmgr_vdev *vdev,
126 		uint32_t *bitmap);
127 
128 /**
129  * pmo_tgt_disable_wow_wakeup_event() - Send Disable wow wakeup events to fwr
130  * @vdev: objmgr vdev handle
131  * @bitmap: Event bitmap
132  *
133  * Return: QDF status
134  */
135 QDF_STATUS pmo_tgt_disable_wow_wakeup_event(struct wlan_objmgr_vdev *vdev,
136 		uint32_t *bitmap);
137 
138 /**
139  * pmo_tgt_send_wow_patterns_to_fw() - Sends WOW patterns to FW.
140  * @vdev: objmgr vdev
141  * @ptrn_id: pattern id
142  * @ptrn: pattern
143  * @ptrn_len: pattern length
144  * @ptrn_offset: pattern offset
145  * @mask: mask
146  * @mask_len: mask length
147  * @user: true for user configured pattern and false for default pattern
148  *
149  * Return: QDF status
150  */
151 QDF_STATUS pmo_tgt_send_wow_patterns_to_fw(struct wlan_objmgr_vdev *vdev,
152 		uint8_t ptrn_id, const uint8_t *ptrn, uint8_t ptrn_len,
153 		uint8_t ptrn_offset, const uint8_t *mask,
154 		uint8_t mask_len, bool user);
155 
156 QDF_STATUS pmo_tgt_del_wow_pattern(
157 		struct wlan_objmgr_vdev *vdev, uint8_t ptrn_id,
158 		bool user);
159 
160 /**
161  * pmo_tgt_set_mc_filter_req() - Set mcast filter command to fw
162  * @vdev: objmgr vdev
163  * @multicast_addr: mcast address
164  *
165  * Return: QDF_STATUS_SUCCESS for success or error code
166  */
167 QDF_STATUS pmo_tgt_set_mc_filter_req(struct wlan_objmgr_vdev *vdev,
168 		struct qdf_mac_addr multicast_addr);
169 
170 /**
171  * pmo_tgt_clear_mc_filter_req() - Clear mcast filter command to fw
172  * @vdev: objmgr vdev
173  * @multicast_addr: mcast address
174  *
175  * Return: QDF_STATUS_SUCCESS for success or error code
176  */
177 QDF_STATUS pmo_tgt_clear_mc_filter_req(struct wlan_objmgr_vdev *vdev,
178 		struct qdf_mac_addr multicast_addr);
179 
180 /**
181  * pmo_tgt_get_multiple_mc_filter_support() - get multiple mcast filter support
182  * @vdev: objmgr vdev
183  *
184  * Return: true if FW supports else false
185  */
186 bool pmo_tgt_get_multiple_mc_filter_support(struct wlan_objmgr_vdev *vdev);
187 
188 /**
189  * pmo_tgt_set_multiple_mc_filter_req() - Set multiple mcast filter cmd to fw
190  * @vdev: objmgr vdev
191  * @mc_list: mcast address list
192  *
193  * Return: QDF_STATUS_SUCCESS for success or error code
194  */
195 QDF_STATUS pmo_tgt_set_multiple_mc_filter_req(struct wlan_objmgr_vdev *vdev,
196 		struct pmo_mc_addr_list *mc_list);
197 
198 /**
199  * pmo_tgt_clear_multiple_mc_filter_req() - clear multiple mcast filter
200  *					    to fw
201  * @vdev: objmgr vdev
202  * @mc_list: mcast address list
203  *
204  * Return: QDF_STATUS_SUCCESS for success or error code
205  */
206 QDF_STATUS pmo_tgt_clear_multiple_mc_filter_req(struct wlan_objmgr_vdev *vdev,
207 		struct pmo_mc_addr_list *mc_list);
208 
209 /**
210  * pmo_tgt_send_enhance_multicast_offload_req() - send enhance mc offload req
211  * @vdev: the vdev to configure
212  * @action: enable or disable enhance multicast offload
213  *
214  * Return: QDF_STATUS_SUCCESS on success else error code
215  */
216 QDF_STATUS pmo_tgt_send_enhance_multicast_offload_req(
217 		struct wlan_objmgr_vdev *vdev,
218 		uint8_t action);
219 
220 /**
221  * pmo_tgt_send_ra_filter_req() - send ra filter request to target
222  * @vdev: objmgr vdev handle
223  *
224  * Return: QDF_STATUS_SUCCESS on success else error code
225  */
226 QDF_STATUS pmo_tgt_send_ra_filter_req(struct wlan_objmgr_vdev *vdev);
227 
228 /**
229  * pmo_tgt_send_action_frame_pattern_req - send wow action frame patterns req
230  * @vdev: objmgr vdev handle
231  * @cmd: action frame pattern cmd
232  *
233  * Return: QDF_STATUS_SUCCESS on success else error code
234  */
235 QDF_STATUS pmo_tgt_send_action_frame_pattern_req(
236 		struct wlan_objmgr_vdev *vdev,
237 		struct pmo_action_wakeup_set_params *cmd);
238 
239 /**
240  * pmo_tgt_send_gtk_offload_req() - send GTK offload command to fw
241  * @vdev: objmgr vdev
242  * @gtk_req: pmo gtk req
243  *
244  * Return: QDF status
245  */
246 QDF_STATUS pmo_tgt_send_gtk_offload_req(struct wlan_objmgr_vdev *vdev,
247 		struct pmo_gtk_req *gtk_req);
248 
249 /**
250  * pmo_tgt_get_gtk_rsp() - send get gtk rsp command to fw
251  * @vdev: objmgr vdev
252  *
253  * Return: QDF status
254  */
255 QDF_STATUS pmo_tgt_get_gtk_rsp(struct wlan_objmgr_vdev *vdev);
256 
257 /**
258  * pmo_tgt_gtk_rsp_evt() - receive gtk rsp event from fwr
259  * @psoc: objmgr psoc
260  * @rsp_param: gtk response parameters
261  *
262  * Return: QDF status
263  */
264 QDF_STATUS pmo_tgt_gtk_rsp_evt(struct wlan_objmgr_psoc *psoc,
265 		struct pmo_gtk_rsp_params *rsp_param);
266 
267 /**
268  * pmo_tgt_send_lphb_enable() - enable command of LPHB configuration requests
269  * @psoc: objmgr psoc handle
270  * @ts_lphb_enable: lphb enable request which needs to configure in fwr
271  *
272  * Return: QDF status
273  */
274 QDF_STATUS pmo_tgt_send_lphb_enable(struct wlan_objmgr_psoc *psoc,
275 			struct pmo_lphb_enable_req *ts_lphb_enable);
276 
277 /**
278  * pmo_tgt_send_lphb_tcp_params() - set tcp params of LPHB configuration req
279  * @psoc: objmgr psoc handle
280  * @ts_lphb_tcp_param: lphb tcp params which needs to configure in fwr
281  *
282  * Return: QDF status
283  */
284 QDF_STATUS pmo_tgt_send_lphb_tcp_params(struct wlan_objmgr_psoc *psoc,
285 			struct pmo_lphb_tcp_params *ts_lphb_tcp_param);
286 
287 /**
288  * pmo_tgt_send_lphb_tcp_pkt_filter() - send tcp packet filter command of LPHB
289  * @psoc: objmgr psoc handle
290  * @ts_lphb_tcp_filter: lphb tcp filter request which needs to configure in fwr
291  *
292  * Return: QDF status
293  */
294 QDF_STATUS pmo_tgt_send_lphb_tcp_pkt_filter(struct wlan_objmgr_psoc *psoc,
295 			struct pmo_lphb_tcp_filter_req *ts_lphb_tcp_filter);
296 
297 /**
298  * pmo_tgt_send_lphb_udp_params() - Send udp param command of LPHB
299  * @psoc: objmgr psoc handle
300  * @ts_lphb_udp_param: lphb udp params which needs to configure in fwr
301  *
302  * Return: QDF status
303  */
304 QDF_STATUS pmo_tgt_send_lphb_udp_params(struct wlan_objmgr_psoc *psoc,
305 			struct pmo_lphb_udp_params *ts_lphb_udp_param);
306 
307 /**
308  * pmo_tgt_send_lphb_udp_pkt_filter() - Send udp pkt filter command of LPHB
309  * @psoc: objmgr psoc handle
310  * @ts_lphb_udp_filter: lphb udp filter request which needs to configure in fwr
311  *
312  * Return: QDF status
313  */
314 QDF_STATUS pmo_tgt_send_lphb_udp_pkt_filter(struct wlan_objmgr_psoc *psoc,
315 			struct pmo_lphb_udp_filter_req *ts_lphb_udp_filter);
316 
317 
318 /**
319  * pmo_tgt_lphb_rsp_evt() - receive lphb rsp event from fwr
320  * @psoc: objmgr psoc
321  * @rsp_param: lphb response parameters
322  *
323  * Return: QDF_STATUS
324  */
325 QDF_STATUS pmo_tgt_lphb_rsp_evt(struct wlan_objmgr_psoc *psoc,
326 			struct pmo_lphb_rsp *rsp_param);
327 
328 /**
329  * pmo_tgt_vdev_update_param_req() - Update vdev param value to fwr
330  * @vdev: objmgr vdev
331  * @param_id: tell vdev param id which needs to be updated in fwr
332  * @param_value: vdev parameter value
333  *
334  * Return: QDF status
335  */
336 QDF_STATUS pmo_tgt_vdev_update_param_req(struct wlan_objmgr_vdev *vdev,
337 		enum pmo_vdev_param_id param_id, uint32_t param_value);
338 
339 /**
340  * pmo_tgt_send_vdev_sta_ps_param() - Send vdev sta power save param to fwr
341  * @vdev: objmgr vdev
342  * @ps_param: sta mode ps power save params type
343  * @param_value: power save parameter value
344  *
345  * Return: QDF status
346  */
347 QDF_STATUS pmo_tgt_send_vdev_sta_ps_param(struct wlan_objmgr_vdev *vdev,
348 		enum pmo_sta_powersave_param ps_param, uint32_t param_value);
349 
350 #ifdef WLAN_FEATURE_IGMP_OFFLOAD
351 /**
352  * pmo_tgt_send_igmp_offload_req() - Send igmp offload request to fw
353  * @vdev: objmgr vdev
354  * @pmo_igmp_req: igmp offload params
355  *
356  * Return: QDF status
357  */
358 QDF_STATUS
359 pmo_tgt_send_igmp_offload_req(struct wlan_objmgr_vdev *vdev,
360 			      struct pmo_igmp_offload_req *pmo_igmp_req);
361 #else
362 static inline QDF_STATUS
pmo_tgt_send_igmp_offload_req(struct wlan_objmgr_vdev * vdev,struct pmo_igmp_offload_req * pmo_igmp_req)363 pmo_tgt_send_igmp_offload_req(struct wlan_objmgr_vdev *vdev,
364 			      struct pmo_igmp_offload_req *pmo_igmp_req)
365 {
366 	return QDF_STATUS_SUCCESS;
367 }
368 #endif
369 
370 /**
371  * pmo_tgt_psoc_update_wow_bus_suspend_state() - update wow bus suspend state
372  *                                               flag
373  * @psoc: objmgr psoc
374  * @val: true for setting wow suspend flag to set else false
375  *
376  * Return: None
377  */
378 void pmo_tgt_psoc_update_wow_bus_suspend_state(struct wlan_objmgr_psoc *psoc,
379 		uint8_t val);
380 
381 /**
382  * pmo_tgt_psoc_get_host_credits() - Get host credits
383  * @psoc: objmgr psoc
384  *
385  * Return: Pending WMI commands on success else EAGAIN on error
386  */
387 int pmo_tgt_psoc_get_host_credits(struct wlan_objmgr_psoc *psoc);
388 
389 /**
390  * pmo_tgt_psoc_get_pending_cmnds() - Get pending commands
391  * @psoc: objmgr psoc
392  *
393  * Return: Pending WMI commands on success else EAGAIN on error
394  */
395 int pmo_tgt_psoc_get_pending_cmnds(struct wlan_objmgr_psoc *psoc);
396 
397 /**
398  * pmo_tgt_update_target_suspend_flag() - Set WMI target Suspend flag
399  * @psoc: objmgr psoc
400  * @val: true on suspend false for resume
401  *
402  * Return: None
403  */
404 void pmo_tgt_update_target_suspend_flag(struct wlan_objmgr_psoc *psoc,
405 					uint8_t val);
406 
407 /**
408  * pmo_tgt_update_target_suspend_acked_flag() - Set WMI target Suspend acked
409  *                                              flag
410  * @psoc: objmgr psoc
411  * @val: true on suspend false for resume
412  *
413  * Return: None
414  */
415 void pmo_tgt_update_target_suspend_acked_flag(struct wlan_objmgr_psoc *psoc,
416 					      uint8_t val);
417 
418 /**
419  * pmo_tgt_is_target_suspended() - Get WMI target Suspend flag
420  * @psoc: objmgr psoc
421  *
422  * Return: true if target suspended, false otherwise.
423  */
424 bool pmo_tgt_is_target_suspended(struct wlan_objmgr_psoc *psoc);
425 
426 /**
427  * pmo_tgt_psoc_send_wow_enable_req() -Send wow enable request
428  * @psoc: objmgr psoc
429  * @param: WOW enable request buffer
430  *
431  * Return: QDF_STATUS_SUCCESS on success else error code
432  */
433 QDF_STATUS pmo_tgt_psoc_send_wow_enable_req(struct wlan_objmgr_psoc *psoc,
434 	struct pmo_wow_cmd_params *param);
435 
436 /**
437  * pmo_tgt_psoc_send_supend_req() -Send target suspend request to fwr
438  * @psoc: objmgr psoc
439  * @param: suspend request buffer
440  *
441  * Return: QDF_STATUS_SUCCESS on success else error code
442  */
443 QDF_STATUS pmo_tgt_psoc_send_supend_req(struct wlan_objmgr_psoc *psoc,
444 		struct pmo_suspend_params *param);
445 
446 /**
447  * pmo_tgt_psoc_set_runtime_pm_inprogress() -set runtime status
448  * @psoc: objmgr psoc
449  * @value: set runtime pm in progress true or false
450  *
451  * Return: none
452  */
453 QDF_STATUS pmo_tgt_psoc_set_runtime_pm_inprogress(struct wlan_objmgr_psoc *psoc,
454 						  bool value);
455 
456 /**
457  * pmo_tgt_psoc_get_runtime_pm_in_progress() -get runtime status
458  * @psoc: objmgr psoc
459  *
460  * Return: true if runtime pm is in progress else false
461  */
462 bool pmo_tgt_psoc_get_runtime_pm_in_progress(struct wlan_objmgr_psoc *psoc);
463 
464 /**
465  * pmo_tgt_psoc_send_host_wakeup_ind() -Send host wake up indication to fwr
466  * @psoc: objmgr psoc
467  *
468  * Return: QDF_STATUS_SUCCESS on success else error code
469  */
470 QDF_STATUS pmo_tgt_psoc_send_host_wakeup_ind(struct wlan_objmgr_psoc *psoc);
471 
472 /**
473  * pmo_tgt_psoc_send_target_resume_req() -Send target resume request
474  * @psoc: objmgr psoc
475  *
476  * Return: QDF_STATUS_SUCCESS on success else error code
477  */
478 QDF_STATUS pmo_tgt_psoc_send_target_resume_req(struct wlan_objmgr_psoc *psoc);
479 
480 /**
481  * pmo_tgt_psoc_send_idle_roam_monitor() - Send idle roam set suspend mode
482  * command to firmware
483  * @psoc: objmgr psoc
484  * @val: Set suspend mode value
485  *
486  * Return: QDF_STATUS_SUCCESS on success else error code
487  */
488 QDF_STATUS pmo_tgt_psoc_send_idle_roam_monitor(struct wlan_objmgr_psoc *psoc,
489 					       uint8_t val);
490 
491 #ifdef WLAN_FEATURE_ICMP_OFFLOAD
492 /**
493  * pmo_tgt_config_icmp_offload_req() - Configure icmp offload req to target
494  * @psoc: objmgr psoc
495  * @pmo_icmp_req: ICMP offload parameters
496  *
497  * Return: QDF status
498  */
499 QDF_STATUS
500 pmo_tgt_config_icmp_offload_req(struct wlan_objmgr_psoc *psoc,
501 				struct pmo_icmp_offload *pmo_icmp_req);
502 #endif
503 
504 /**
505  * pmo_tgt_psoc_set_wow_enable_ack_failed() -set wow enable ack failure status
506  * @psoc: objmgr psoc
507  *
508  * Return: none
509  */
510 QDF_STATUS
511 pmo_tgt_psoc_set_wow_enable_ack_failed(struct wlan_objmgr_psoc *psoc);
512 
513 #endif /* end  of _WLAN_PMO_TGT_API_H_ */
514