xref: /wlan-driver/qcacld-3.0/components/target_if/pmo/inc/target_if_pmo.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 various api/struct which shall be used
21  * by pmo component for wmi cmd (tx path) and
22  * event (rx) handling.
23  */
24 
25 #ifndef _TARGET_IF_PMO_H_
26 #define _TARGET_IF_PMO_H_
27 
28 #include "target_if.h"
29 #include "wlan_pmo_tgt_api.h"
30 #include "wlan_pmo_obj_mgmt_public_struct.h"
31 
32 /**
33  * target_if_pmo_enable_wow_wakeup_event() - Enable wow wakeup events.
34  * @vdev:objmgr vdev handle
35  * @bitmap: Event bitmap
36  *
37  * Return: QDF status
38  */
39 QDF_STATUS target_if_pmo_enable_wow_wakeup_event(struct wlan_objmgr_vdev *vdev,
40 		uint32_t *bitmap);
41 
42 /**
43  * target_if_pmo_disable_wow_wakeup_event() -  Disable wow wakeup events.
44  * @vdev:objmgr vdev handle
45  * @bitmap: Event bitmap
46  *
47  * Return: QDF status
48  */
49 QDF_STATUS target_if_pmo_disable_wow_wakeup_event(
50 		struct wlan_objmgr_vdev *vdev, uint32_t *bitmap);
51 
52 /**
53  * target_if_pmo_send_wow_patterns_to_fw() - Sends WOW patterns to FW.
54  * @vdev: objmgr vdev handle
55  * @ptrn_id: pattern id
56  * @ptrn: pattern
57  * @ptrn_len: pattern length
58  * @ptrn_offset: pattern offset
59  * @mask: mask
60  * @mask_len: mask length
61  * @user: true for user configured pattern and false for default pattern
62  *
63  * Return: QDF status
64  */
65 QDF_STATUS target_if_pmo_send_wow_patterns_to_fw(struct wlan_objmgr_vdev *vdev,
66 		uint8_t ptrn_id,
67 		const uint8_t *ptrn, uint8_t ptrn_len,
68 		uint8_t ptrn_offset, const uint8_t *mask,
69 		uint8_t mask_len, bool user);
70 
71 QDF_STATUS target_if_pmo_del_wow_patterns_to_fw(struct wlan_objmgr_vdev *vdev,
72 		uint8_t ptrn_id);
73 
74 /**
75  * target_if_pmo_send_enhance_mc_offload_req() - send enhance mc offload req
76  * @vdev: objmgr vdev
77  * @enable: enable or disable enhance multicast offload
78  *
79  * Return: QDF_STATUS_SUCCESS on success else error code
80  */
81 QDF_STATUS target_if_pmo_send_enhance_mc_offload_req(
82 		struct wlan_objmgr_vdev *vdev,
83 		bool enable);
84 
85 /**
86  * target_if_pmo_set_mc_filter_req() - set mcast filter command to fw
87  * @vdev: objmgr vdev handle
88  * @multicast_addr: mcast address
89  *
90  * Return: 0 for success or error code
91  */
92 QDF_STATUS target_if_pmo_set_mc_filter_req(struct wlan_objmgr_vdev *vdev,
93 		struct qdf_mac_addr multicast_addr);
94 
95 /**
96  * target_if_pmo_clear_mc_filter_req() - clear mcast filter command to fw
97  * @vdev: objmgr vdev handle
98  * @multicast_addr: mcast address
99  *
100  * Return: 0 for success or error code
101  */
102 QDF_STATUS target_if_pmo_clear_mc_filter_req(struct wlan_objmgr_vdev *vdev,
103 		struct qdf_mac_addr multicast_addr);
104 
105 /**
106  * target_if_pmo_get_multiple_mc_filter_support() - get multiple mc filter
107  *						    request fw support
108  * @psoc: the psoc containing the vdev to configure
109  *
110  * Return: true if fw supports else false
111  */
112 bool target_if_pmo_get_multiple_mc_filter_support(
113 		struct wlan_objmgr_psoc *psoc);
114 
115 /**
116  * target_if_pmo_set_multiple_mc_filter_req() - set multiple mcast filter
117  *						command to fw
118  * @vdev: objmgr vdev handle
119  * @mc_list: mcast address list
120  *
121  * Return: 0 for success or error code
122  */
123 QDF_STATUS target_if_pmo_set_multiple_mc_filter_req(
124 		struct wlan_objmgr_vdev *vdev,
125 		struct pmo_mc_addr_list *mc_list);
126 
127 /**
128  * target_if_pmo_clear_multiple_mc_filter_req() - clear multiple mcast
129  *						  filter command to fw
130  * @vdev: objmgr vdev handle
131  * @mc_list: mcast address list
132  *
133  * Return: 0 for success or error code
134  */
135 QDF_STATUS target_if_pmo_clear_multiple_mc_filter_req(
136 		struct wlan_objmgr_vdev *vdev,
137 		struct pmo_mc_addr_list *mc_list);
138 
139 /**
140  * target_if_pmo_send_ra_filter_req() - set RA filter pattern in fw
141  * @vdev: objmgr vdev handle
142  * @default_pattern: default pattern id
143  * @rate_limit_interval: ra rate limit interval
144  *
145  * Return: QDF status
146  */
147 QDF_STATUS target_if_pmo_send_ra_filter_req(struct wlan_objmgr_vdev *vdev,
148 		uint8_t default_pattern, uint16_t rate_limit_interval);
149 
150 /**
151  * target_if_pmo_send_action_frame_patterns() - register action frame map to fw
152  * @vdev: objmgr vdev handle
153  * @ip_cmd: Action frame wakeup params
154  *
155  * This is called to push action frames wow patterns from local
156  * cache to firmware.
157  *
158  * Return: QDF_STATUS
159  */
160 QDF_STATUS target_if_pmo_send_action_frame_patterns(
161 		struct wlan_objmgr_vdev *vdev,
162 		struct pmo_action_wakeup_set_params *ip_cmd);
163 
164 /**
165  * target_if_pmo_conf_hw_filter() - configure hardware filter in DTIM mode
166  * @psoc: the psoc containing the vdev to configure
167  * @req: the request parameters
168  *
169  * Return: QDF_STATUS
170  */
171 QDF_STATUS target_if_pmo_conf_hw_filter(struct wlan_objmgr_psoc *psoc,
172 					struct pmo_hw_filter_params *req);
173 
174 #ifdef WLAN_FEATURE_PACKET_FILTERING
175 /**
176  * target_if_pmo_send_pkt_filter_req() - enable packet filter
177  * @vdev: objmgr vdev
178  * @rcv_filter_param: filter params
179  *
180  * This function enable packet filter
181  *
182  *  Return: QDF_STATUS_SUCCESS for success or error code
183  */
184 QDF_STATUS target_if_pmo_send_pkt_filter_req(struct wlan_objmgr_vdev *vdev,
185 			struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param);
186 
187 /**
188  * target_if_pmo_clear_pkt_filter_req() - disable packet filter
189  * @vdev: objmgr vdev
190  * @rcv_clear_param: filter params
191  *
192  * This function disable packet filter
193  *
194  *  Return: QDF_STATUS_SUCCESS for success or error code
195  */
196 QDF_STATUS target_if_pmo_clear_pkt_filter_req(struct wlan_objmgr_vdev *vdev,
197 			struct pmo_rcv_pkt_fltr_clear_param *rcv_clear_param);
198 #endif
199 
200 /**
201  * target_if_pmo_send_arp_offload_req() - sends arp request to fwr
202  * @vdev: objmgr vdev
203  * @arp_offload_req: arp offload req
204  * @ns_offload_req: ns offload request
205  *
206  * This functions sends arp request to fwr.
207  *
208  * Return: QDF_STATUS_SUCCESS for success or error code
209  */
210 QDF_STATUS target_if_pmo_send_arp_offload_req(
211 		struct wlan_objmgr_vdev *vdev,
212 		struct pmo_arp_offload_params *arp_offload_req,
213 		struct pmo_ns_offload_params *ns_offload_req);
214 
215 #ifdef WLAN_NS_OFFLOAD
216 /**
217  * target_if_pmo_send_ns_offload_req() - sends ns request to fwr
218  * @vdev: objmgr vdev
219  * @arp_offload_req: arp offload req
220  * @ns_offload_req: ns offload request
221  *
222  * This functions sends ns request to fwr.
223  *
224  * Return: QDF_STATUS_SUCCESS for success or error code
225  */
226 QDF_STATUS target_if_pmo_send_ns_offload_req(
227 		struct wlan_objmgr_vdev *vdev,
228 		struct pmo_arp_offload_params *arp_offload_req,
229 		struct pmo_ns_offload_params *ns_offload_req);
230 #else /* WLAN_NS_OFFLOAD */
231 static inline QDF_STATUS
target_if_pmo_send_ns_offload_req(struct wlan_objmgr_vdev * vdev,struct pmo_arp_offload_params * arp_offload_req,struct pmo_ns_offload_params * ns_offload_req)232 target_if_pmo_send_ns_offload_req(struct wlan_objmgr_vdev *vdev,
233 		struct pmo_arp_offload_params *arp_offload_req,
234 		struct pmo_ns_offload_params *ns_offload_req)
235 {
236 	return QDF_STATUS_SUCCESS;
237 }
238 #endif /* WLAN_NS_OFFLOAD */
239 /**
240  * target_if_pmo_send_gtk_offload_req() - send gtk offload request in fwr
241  * @vdev: objmgr vdev handle
242  * @gtk_offload_req: gtk offload request
243  *
244  * Return: QDF status
245  */
246 QDF_STATUS target_if_pmo_send_gtk_offload_req(struct wlan_objmgr_vdev *vdev,
247 		struct pmo_gtk_req *gtk_offload_req);
248 
249 /**
250  * target_if_pmo_send_gtk_response_req() - send gtk response request in fwr
251  * @vdev: objmgr vdev handle
252  *
253  * Return: QDF status
254  */
255 QDF_STATUS target_if_pmo_send_gtk_response_req(struct wlan_objmgr_vdev *vdev);
256 
257 /**
258  * target_if_pmo_gtk_offload_status_event() - GTK offload status event handler
259  * @scn_handle: scn handle
260  * @event: event buffer
261  * @len: buffer length
262  *
263  * Return: 0 for success or error code
264  */
265 int target_if_pmo_gtk_offload_status_event(void *scn_handle,
266 	uint8_t *event, uint32_t len);
267 
268 /**
269  * target_if_pmo_send_lphb_enable() - enable command of LPHB config req
270  * @psoc: objmgr psoc handle
271  * @ts_lphb_enable: lphb enable request which needs to configure in fwr
272  *
273  * Return: QDF status
274  */
275 QDF_STATUS target_if_pmo_send_lphb_enable(struct wlan_objmgr_psoc *psoc,
276 			struct pmo_lphb_enable_req *ts_lphb_enable);
277 
278 /**
279  * target_if_pmo_send_lphb_tcp_params() - set lphb tcp params config request
280  * @psoc: objmgr psoc handle
281  * @ts_lphb_tcp_param: lphb tcp params which needs to configure in fwr
282  *
283  * Return: QDF status
284  */
285 QDF_STATUS target_if_pmo_send_lphb_tcp_params(struct wlan_objmgr_psoc *psoc,
286 			struct pmo_lphb_tcp_params *ts_lphb_tcp_param);
287 
288 /**
289  * target_if_pmo_send_lphb_tcp_pkt_filter() - send lphb tcp packet filter req
290  * @psoc: objmgr psoc handle
291  * @ts_lphb_tcp_filter: lphb tcp filter request which needs to configure in fwr
292  *
293  * Return: QDF status
294  */
295 QDF_STATUS target_if_pmo_send_lphb_tcp_pkt_filter(struct wlan_objmgr_psoc *psoc,
296 			struct pmo_lphb_tcp_filter_req *ts_lphb_tcp_filter);
297 
298 /**
299  * target_if_pmo_send_lphb_udp_params() - Send udp param command of LPHB
300  * @psoc: objmgr psoc handle
301  * @ts_lphb_udp_param: lphb udp params which needs to configure in fwr
302  *
303  * Return: QDF status
304  */
305 QDF_STATUS target_if_pmo_send_lphb_udp_params(struct wlan_objmgr_psoc *psoc,
306 			struct pmo_lphb_udp_params *ts_lphb_udp_param);
307 
308 /**
309  * target_if_pmo_send_lphb_udp_pkt_filter() - Send lphb udp pkt filter cmd req
310  * @psoc: objmgr psoc handle
311  * @ts_lphb_udp_filter: lphb udp filter request which needs to configure in fwr
312  *
313  * Return: QDF status
314  */
315 QDF_STATUS target_if_pmo_send_lphb_udp_pkt_filter(struct wlan_objmgr_psoc *psoc,
316 			struct pmo_lphb_udp_filter_req *ts_lphb_udp_filter);
317 
318 /**
319  * target_if_pmo_lphb_evt_handler() - send LPHB indication to os if /HDD
320  * @psoc: objmgr psoc handle
321  * @event: lphb event buffer
322  *
323  * Return: QDF_STATUS_SUCCESS for success else error code
324  */
325 QDF_STATUS target_if_pmo_lphb_evt_handler(struct wlan_objmgr_psoc *psoc,
326 		uint8_t *event);
327 
328 /**
329  * target_if_pmo_send_vdev_update_param_req() - Send 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 target_if_pmo_send_vdev_update_param_req(
337 		struct wlan_objmgr_vdev *vdev,
338 		uint32_t param_id, uint32_t param_value);
339 
340 /**
341  * target_if_pmo_send_vdev_ps_param_req() - Send vdev ps param value to fwr
342  * @vdev: objmgr vdev
343  * @param_id: tell vdev param id which needs to be updated in fwr
344  * @param_value: vdev parameter value
345  *
346  * Return: QDF status
347  */
348 QDF_STATUS target_if_pmo_send_vdev_ps_param_req(
349 		struct wlan_objmgr_vdev *vdev,
350 		uint32_t param_id,
351 		uint32_t param_value);
352 
353 #ifdef WLAN_FEATURE_IGMP_OFFLOAD
354 /**
355  * target_if_pmo_send_igmp_offload_req() - Send igmp offload req to fw
356  * @vdev: objmgr vdev
357  * @pmo_igmp_req: igmp req
358  *
359  * Return: QDF status
360  */
361 QDF_STATUS
362 target_if_pmo_send_igmp_offload_req(
363 		struct wlan_objmgr_vdev *vdev,
364 		struct pmo_igmp_offload_req *pmo_igmp_req);
365 #else
366 static inline QDF_STATUS
target_if_pmo_send_igmp_offload_req(struct wlan_objmgr_vdev * vdev,struct pmo_igmp_offload_req * pmo_igmp_req)367 target_if_pmo_send_igmp_offload_req(
368 		struct wlan_objmgr_vdev *vdev,
369 		struct pmo_igmp_offload_req *pmo_igmp_req)
370 {
371 	return QDF_STATUS_SUCCESS;
372 }
373 #endif
374 
375 /**
376  * target_if_pmo_psoc_update_bus_suspend() - update wmi bus suspend flag
377  * @psoc: objmgr psoc
378  * @value: bus suspend value
379  *
380  * Return: None
381  */
382 void target_if_pmo_psoc_update_bus_suspend(struct wlan_objmgr_psoc *psoc,
383 		uint8_t value);
384 
385 /**
386  * target_if_pmo_psoc_get_host_credits() - get available host credits
387  * @psoc: objmgr psoc
388  *
389  * Return: return host credits
390  */
391 int target_if_pmo_psoc_get_host_credits(struct wlan_objmgr_psoc *psoc);
392 
393 /**
394  * target_if_pmo_psoc_get_pending_cmnds() - get wmi pending commands
395  * @psoc: objmgr psoc
396  *
397  * Return: return wmi pending commands
398  */
399 int target_if_pmo_psoc_get_pending_cmnds(struct wlan_objmgr_psoc *psoc);
400 
401 /**
402  * target_if_pmo_update_target_suspend_flag() - set wmi target suspend flag
403  * @psoc: objmgr psoc
404  * @value: value
405  *
406  * Return: None
407  */
408 void target_if_pmo_update_target_suspend_flag(struct wlan_objmgr_psoc *psoc,
409 		uint8_t value);
410 
411 /**
412  * target_if_pmo_update_target_suspend_acked_flag() - set wmi target suspend
413  *                                                    acked flag
414  * @psoc: objmgr psoc
415  * @value: value
416  *
417  * Return: None
418  */
419 void target_if_pmo_update_target_suspend_acked_flag(
420 						struct wlan_objmgr_psoc *psoc,
421 						uint8_t value);
422 
423 /**
424  * target_if_pmo_is_target_suspended() - get wmi target suspend flag
425  * @psoc: objmgr psoc
426  *
427  * Return: true if target suspended, false otherwise
428  */
429 bool target_if_pmo_is_target_suspended(struct wlan_objmgr_psoc *psoc);
430 
431 /**
432  * target_if_pmo_psoc_send_wow_enable_req() -send wow enable request
433  * @psoc: objmgr psoc
434  * @param: wow command params
435  *
436  * Return: return QDF_STATUS_SUCCESS on success else error code
437  */
438 QDF_STATUS target_if_pmo_psoc_send_wow_enable_req(struct wlan_objmgr_psoc *psoc,
439 		struct pmo_wow_cmd_params *param);
440 
441 /**
442  * target_if_pmo_psoc_send_suspend_req() - fp to send suspend request
443  * @psoc: objmgr psoc
444  * @param: target suspend params
445  *
446  * Return: return QDF_STATUS_SUCCESS on success else error code
447  */
448 QDF_STATUS target_if_pmo_psoc_send_suspend_req(struct wlan_objmgr_psoc *psoc,
449 		struct pmo_suspend_params *param);
450 
451 /**
452  * target_if_pmo_set_runtime_pm_in_progress() - set runtime pm status
453  * @psoc: objmgr psoc
454  * @value: set runtime pm status
455  *
456  * Return: none
457  */
458 void target_if_pmo_set_runtime_pm_in_progress(struct wlan_objmgr_psoc *psoc,
459 					      bool value);
460 
461 /**
462  * target_if_pmo_get_runtime_pm_in_progress() - fp to get runtime pm status
463  * @psoc: objmgr psoc
464  *
465  * Return: true if runtime pm in progress else false
466  */
467 bool target_if_pmo_get_runtime_pm_in_progress(struct wlan_objmgr_psoc *psoc);
468 
469 /**
470  * target_if_pmo_psoc_send_host_wakeup_ind() - send host wake ind to fwr
471  * @psoc: objmgr psoc
472  *
473  * Return: return QDF_STATUS_SUCCESS on success else error code
474  */
475 QDF_STATUS target_if_pmo_psoc_send_host_wakeup_ind(
476 		struct wlan_objmgr_psoc *psoc);
477 
478 /**
479  * target_if_pmo_psoc_send_target_resume_req() -send target resume request
480  * @psoc: objmgr psoc
481  *
482  * Return: return QDF_STATUS_SUCCESS on success else error code
483  */
484 QDF_STATUS target_if_pmo_psoc_send_target_resume_req(
485 		struct wlan_objmgr_psoc *psoc);
486 
487 /**
488  * target_if_pmo_psoc_send_d0wow_enable_req() - send d0 wow enable request
489  * @psoc: objmgr psoc
490  *
491  * Return: return QDF_STATUS_SUCCESS on success else error code
492  */
493 QDF_STATUS target_if_pmo_psoc_send_d0wow_enable_req(
494 		struct wlan_objmgr_psoc *psoc);
495 
496 /**
497  * target_if_pmo_psoc_send_d0wow_disable_req() - send d0 wow disable request
498  * @psoc: objmgr psoc
499  *
500  * Return: return QDF_STATUS_SUCCESS on success else error code
501  */
502 QDF_STATUS target_if_pmo_psoc_send_d0wow_disable_req(
503 		struct wlan_objmgr_psoc *psoc);
504 
505 /**
506  * target_if_pmo_psoc_send_idle_monitor_cmd() - send screen status to firmware
507  * @psoc: objmgr psoc
508  * @val: Idle monitor value
509  *
510  * Return: QDF_STATUS_SUCCESS on success else error code
511  */
512 QDF_STATUS
513 target_if_pmo_psoc_send_idle_monitor_cmd(struct wlan_objmgr_psoc *psoc,
514 					 uint8_t val);
515 
516 /**
517  * target_if_pmo_register_tx_ops() - Register PMO component TX OPS
518  * @tx_ops: PMO if transmit ops
519  *
520  * Return: None
521  */
522 void target_if_pmo_register_tx_ops(struct wlan_pmo_tx_ops *tx_ops);
523 
524 #ifdef WLAN_FEATURE_ICMP_OFFLOAD
525 /**
526  * target_if_pmo_send_icmp_offload_req() - sends icmp request to fwr
527  * @psoc: objmgr psoc
528  * @pmo_icmp_req: icmp offload request
529  *
530  * This functions sends icmp request to fwr.
531  *
532  * Return: QDF_STATUS_SUCCESS for success or error code
533  */
534 QDF_STATUS
535 target_if_pmo_send_icmp_offload_req(struct wlan_objmgr_psoc *psoc,
536 				    struct pmo_icmp_offload *pmo_icmp_req);
537 #endif
538 
539 /**
540  * target_if_pmo_set_wow_enable_ack_failed() - set wow enable ack failure status
541  * @psoc: objmgr psoc
542  *
543  * Return: none
544  */
545 void target_if_pmo_set_wow_enable_ack_failed(struct wlan_objmgr_psoc *psoc);
546 #endif
547