1 /*
2  * Copyright (c) 2017-2019, 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: This file contains the API definitions for the Unified Wireless Module
21  * Interface (WMI) which are specific to Power management offloads (PMO).
22  */
23 
24 #ifndef _WMI_UNIFIED_PMO_API_H_
25 #define _WMI_UNIFIED_PMO_API_H_
26 
27 #include "wlan_pmo_tgt_api.h"
28 #include "wlan_pmo_arp_public_struct.h"
29 #include "wlan_pmo_ns_public_struct.h"
30 #include "wlan_pmo_gtk_public_struct.h"
31 #include "wlan_pmo_wow_public_struct.h"
32 #include "wlan_pmo_pkt_filter_public_struct.h"
33 
34 #ifdef FEATURE_WLAN_D0WOW
35 /**
36  *  wmi_unified_d0wow_enable_send() - WMI d0 wow enable function
37  *  @wmi_handle: handle to WMI.
38  *  @mac_id: radio context
39  *
40  *  Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
41  */
42 QDF_STATUS wmi_unified_d0wow_enable_send(wmi_unified_t wmi_handle,
43 					 uint8_t mac_id);
44 
45 /**
46  *  wmi_unified_d0wow_disable_send() - WMI d0 wow disable function
47  *  @wmi_handle: handle to WMI.
48  *  @mac_id: radio context
49  *
50  *  Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
51  */
52 QDF_STATUS wmi_unified_d0wow_disable_send(wmi_unified_t wmi_handle,
53 					  uint8_t mac_id);
54 #endif /* FEATURE_WLAN_D0WOW */
55 
56 /**
57  * wmi_unified_add_wow_wakeup_event_cmd() -  Configures wow wakeup events.
58  * @wmi_handle: wmi handle
59  * @vdev_id: vdev id
60  * @bitmap: Event bitmap
61  * @enable: enable/disable
62  *
63  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
64  */
65 QDF_STATUS wmi_unified_add_wow_wakeup_event_cmd(wmi_unified_t wmi_handle,
66 						uint32_t vdev_id,
67 						uint32_t *bitmap,
68 						bool enable);
69 
70 /**
71  * wmi_unified_wow_patterns_to_fw_cmd() - Sends WOW patterns to FW.
72  * @wmi_handle: wmi handle
73  * @vdev_id: vdev id
74  * @ptrn_id: pattern id
75  * @ptrn: pattern
76  * @ptrn_len: pattern length
77  * @ptrn_offset: pattern offset
78  * @mask: mask
79  * @mask_len: mask length
80  * @user: true for user configured pattern and false for default pattern
81  * @default_patterns: default patterns
82  *
83  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
84  */
85 QDF_STATUS wmi_unified_wow_patterns_to_fw_cmd(
86 				wmi_unified_t wmi_handle,
87 				uint8_t vdev_id, uint8_t ptrn_id,
88 				const uint8_t *ptrn, uint8_t ptrn_len,
89 				uint8_t ptrn_offset, const uint8_t *mask,
90 				uint8_t mask_len, bool user,
91 				uint8_t default_patterns);
92 
93 /**
94  * wmi_unified_add_clear_mcbc_filter_cmd() - set mcast filter command to fw
95  * @wmi_handle: wmi handle
96  * @vdev_id: vdev id
97  * @multicast_addr: mcast address
98  * @clear_list: clear list flag
99  *
100  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
101  */
102 QDF_STATUS wmi_unified_add_clear_mcbc_filter_cmd(
103 					wmi_unified_t wmi_handle,
104 					uint8_t vdev_id,
105 					struct qdf_mac_addr multicast_addr,
106 					bool clear_list);
107 
108 /**
109  * wmi_unified_multiple_add_clear_mcbc_filter_cmd() - send multiple mcast
110  *						      filter command to fw
111  * @wmi_handle: wmi handle
112  * @vdev_id: vdev id
113  * @filter_param: mcast filter params
114  *
115  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
116  */
117 QDF_STATUS wmi_unified_multiple_add_clear_mcbc_filter_cmd(
118 				wmi_unified_t wmi_handle,
119 				uint8_t vdev_id,
120 				struct pmo_mcast_filter_params *filter_param);
121 
122 #ifdef FEATURE_WLAN_RA_FILTERING
123 /**
124  * wmi_unified_wow_sta_ra_filter_cmd() - set RA filter pattern in fw
125  * @wmi_handle: wmi handle
126  * @vdev_id: vdev id
127  * @default_pattern: default pattern id
128  * @rate_limit_interval: rate limit interval
129  *
130  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
131  */
132 QDF_STATUS wmi_unified_wow_sta_ra_filter_cmd(wmi_unified_t wmi_handle,
133 					     uint8_t vdev_id,
134 					     uint8_t default_pattern,
135 					     uint16_t rate_limit_interval);
136 #endif
137 
138 /**
139  * wmi_unified_enable_enhance_multicast_offload_cmd() - enhance multicast
140  *                                                      offload
141  * @wmi_handle: wmi handle
142  * @vdev_id: vdev id
143  * @action: true for enable else false
144  *
145  * To configure enhance multicast offload in to firmware
146  *
147  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
148  */
149 QDF_STATUS wmi_unified_enable_enhance_multicast_offload_cmd(
150 		wmi_unified_t wmi_handle, uint8_t vdev_id, bool action);
151 
152 /**
153  * wmi_extract_gtk_rsp_event() - extract gtk rsp params from event
154  * @wmi_handle: wmi handle
155  * @evt_buf: pointer to event buffer
156  * @gtk_rsp_param: Pointer to gtk rsp parameters
157  * @len: len of gtk rsp event
158  *
159  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
160  */
161 QDF_STATUS wmi_extract_gtk_rsp_event(
162 	wmi_unified_t wmi_handle, void *evt_buf,
163 	struct pmo_gtk_rsp_params *gtk_rsp_param, uint32_t len);
164 
165 /**
166  * wmi_unified_process_gtk_offload_getinfo_cmd() - send GTK offload cmd to fw
167  * @wmi_handle: wmi handle
168  * @vdev_id: vdev id
169  * @offload_req_opcode: gtk offload flag
170  *
171  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
172  */
173 QDF_STATUS wmi_unified_process_gtk_offload_getinfo_cmd(
174 				wmi_unified_t wmi_handle,
175 				uint8_t vdev_id,
176 				uint64_t offload_req_opcode);
177 
178 /**
179  * wmi_unified_action_frame_patterns_cmd() - send action filter wmi cmd
180  * @wmi_handle: wmi handler
181  * @action_params: pointer to action_params
182  *
183  * Return: 0 for success, otherwise appropriate error code
184  */
185 QDF_STATUS wmi_unified_action_frame_patterns_cmd(
186 			wmi_unified_t wmi_handle,
187 			struct pmo_action_wakeup_set_params *action_params);
188 
189 /**
190  * wmi_unified_send_gtk_offload_cmd() - send GTK offload command to fw
191  * @wmi_handle: wmi handle
192  * @vdev_id: vdev id
193  * @params: GTK offload parameters
194  * @enable_offload: flag to enable offload
195  * @gtk_offload_opcode: gtk offload flag
196  *
197  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
198  */
199 QDF_STATUS wmi_unified_send_gtk_offload_cmd(wmi_unified_t wmi_handle,
200 					    uint8_t vdev_id,
201 					    struct pmo_gtk_req *params,
202 					    bool enable_offload,
203 					    uint32_t gtk_offload_opcode);
204 
205 /**
206  * wmi_unified_enable_arp_ns_offload_cmd() - enable ARP NS offload
207  * @wmi_handle: wmi handle
208  * @arp_offload_req: arp offload request
209  * @ns_offload_req: ns offload request
210  * @vdev_id: vdev id
211  *
212  * To configure ARP NS off load data to firmware
213  * when target goes to wow mode.
214  *
215  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
216  */
217 QDF_STATUS wmi_unified_enable_arp_ns_offload_cmd(
218 			wmi_unified_t wmi_handle,
219 			struct pmo_arp_offload_params *arp_offload_req,
220 			struct pmo_ns_offload_params *ns_offload_req,
221 			uint8_t vdev_id);
222 
223 /**
224  * wmi_unified_conf_hw_filter_cmd() - Configure hardware filter in DTIM mode
225  * @wmi_handle: wmi handle
226  * @req: request parameters to configure to firmware
227  *
228  * Return: QDF_STATUS
229  */
230 QDF_STATUS wmi_unified_conf_hw_filter_cmd(wmi_unified_t wmi_handle,
231 					  struct pmo_hw_filter_params *req);
232 
233 #ifdef FEATURE_WLAN_LPHB
234 /**
235  * wmi_unified_lphb_config_hbenable_cmd() - enable command of LPHB configuration
236  * @wmi_handle: wmi handle
237  * @params: configuration info
238  *
239  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
240  */
241 QDF_STATUS wmi_unified_lphb_config_hbenable_cmd(
242 		wmi_unified_t wmi_handle,
243 		wmi_hb_set_enable_cmd_fixed_param *params);
244 
245 /**
246  * wmi_unified_lphb_config_tcp_params_cmd() - set tcp params of LPHB config req
247  * @wmi_handle: wmi handle
248  * @lphb_conf_req: lphb config request
249  *
250  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
251  */
252 QDF_STATUS wmi_unified_lphb_config_tcp_params_cmd(
253 		wmi_unified_t wmi_handle,
254 		wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req);
255 
256 /**
257  * wmi_unified_lphb_config_tcp_pkt_filter_cmd() - config LPHB tcp packet filter
258  * @wmi_handle: wmi handle
259  * @g_hb_tcp_filter_fp: lphb config request
260  *
261  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
262  */
263 QDF_STATUS wmi_unified_lphb_config_tcp_pkt_filter_cmd(
264 		wmi_unified_t wmi_handle,
265 		wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp);
266 
267 /**
268  * wmi_unified_lphb_config_udp_params_cmd() - configure LPHB udp param command
269  * @wmi_handle: wmi handle
270  * @lphb_conf_req: lphb config request
271  *
272  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
273  */
274 QDF_STATUS wmi_unified_lphb_config_udp_params_cmd(
275 		wmi_unified_t wmi_handle,
276 		wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req);
277 
278 /**
279  * wmi_unified_lphb_config_udp_pkt_filter_cmd() - configure LPHB udp pkt filter
280  * @wmi_handle: wmi handle
281  * @lphb_conf_req: lphb config request
282  *
283  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
284  */
285 QDF_STATUS wmi_unified_lphb_config_udp_pkt_filter_cmd(
286 		wmi_unified_t wmi_handle,
287 		wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req);
288 #endif /* FEATURE_WLAN_LPHB */
289 
290 #ifdef WLAN_FEATURE_PACKET_FILTERING
291 /**
292  * wmi_unified_enable_disable_packet_filter_cmd() - enable/disable packet filter
293  * @wmi_handle: wmi handle
294  * @vdev_id: vdev id
295  * @enable: Flag to enable/disable packet filter
296  *
297  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
298  */
299 QDF_STATUS
300 wmi_unified_enable_disable_packet_filter_cmd(wmi_unified_t wmi_handle,
301 					     uint8_t vdev_id,
302 					     bool enable);
303 
304 /**
305  * wmi_unified_config_packet_filter_cmd() - configure packet filter in target
306  * @wmi_handle: wmi handle
307  * @vdev_id: vdev id
308  * @rcv_filter_param: Packet filter parameters
309  * @filter_id: Filter id
310  * @enable: Flag to add/delete packet filter configuration
311  *
312  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
313  */
314 QDF_STATUS wmi_unified_config_packet_filter_cmd(
315 		wmi_unified_t wmi_handle,
316 		uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param,
317 		uint8_t filter_id, bool enable);
318 #endif /* WLAN_FEATURE_PACKET_FILTERING */
319 
320 /**
321  * wmi_unified_wow_delete_pattern_cmd() - delete wow pattern in target
322  * @wmi_handle: wmi handle
323  * @ptrn_id: pattern id
324  * @vdev_id: vdev id
325  *
326  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
327  */
328 QDF_STATUS wmi_unified_wow_delete_pattern_cmd(wmi_unified_t wmi_handle,
329 					      uint8_t ptrn_id,
330 					      uint8_t vdev_id);
331 
332 /**
333  * wmi_unified_host_wakeup_ind_to_fw_cmd() - send wakeup ind to fw
334  * @wmi_handle: wmi handle
335  * @tx_pending_ind: flag of TX has pending frames
336  *
337  * Sends host wakeup indication to FW. On receiving this indication,
338  * FW will come out of WOW.
339  *
340  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
341  */
342 QDF_STATUS wmi_unified_host_wakeup_ind_to_fw_cmd(wmi_unified_t wmi_handle,
343 						 bool tx_pending_ind);
344 
345 /**
346  * wmi_unified_wow_timer_pattern_cmd() - set timer pattern tlv, so that
347  *					 firmware will wake up host after
348  *					 specified time is elapsed
349  * @wmi_handle: wmi handle
350  * @vdev_id: vdev id
351  * @cookie: value to identify reason why host set up wake call.
352  * @time: time in ms
353  *
354  * Return: QDF status
355  */
356 QDF_STATUS wmi_unified_wow_timer_pattern_cmd(wmi_unified_t wmi_handle,
357 					     uint8_t vdev_id,
358 					     uint32_t cookie, uint32_t time);
359 
360 #ifdef WLAN_FEATURE_EXTWOW_SUPPORT
361 /**
362  * wmi_unified_enable_ext_wow_cmd() - enable ext wow in fw
363  * @wmi_handle: wmi handle
364  * @params: ext wow params
365  *
366  * Return:QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
367  */
368 QDF_STATUS wmi_unified_enable_ext_wow_cmd(wmi_unified_t wmi_handle,
369 					  struct ext_wow_params *params);
370 
371 /**
372  * wmi_unified_set_app_type2_params_in_fw_cmd() - set app type2 params in fw
373  * @wmi_handle: wmi handle
374  * @appType2Params: app type2 params
375  *
376  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
377  */
378 QDF_STATUS wmi_unified_set_app_type2_params_in_fw_cmd(
379 				wmi_unified_t wmi_handle,
380 				struct app_type2_params *appType2Params);
381 
382 /**
383  * wmi_unified_app_type1_params_in_fw_cmd() - set app type1 params in fw
384  * @wmi_handle: wmi handle
385  * @app_type1_params: app type1 params
386  *
387  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
388  */
389 QDF_STATUS wmi_unified_app_type1_params_in_fw_cmd(
390 				wmi_unified_t wmi_handle,
391 				struct app_type1_params *app_type1_params);
392 #endif /* WLAN_FEATURE_EXTWOW_SUPPORT */
393 
394 #ifdef WLAN_FEATURE_IGMP_OFFLOAD
395 /**
396  * wmi_unified_send_igmp_offload_cmd() - send igmp offload cmd to fw
397  * @wmi_handle: wmi handle
398  * @pmo_igmp_req: igmp params
399  *
400  * Return: Success or failure
401  */
402 QDF_STATUS
403 wmi_unified_send_igmp_offload_cmd(wmi_unified_t wmi_handle,
404 				  struct pmo_igmp_offload_req *pmo_igmp_req);
405 #endif
406 
407 #ifdef WLAN_FEATURE_ICMP_OFFLOAD
408 /**
409  * wmi_unified_config_icmp_offload_cmd() - enable ICMP offload
410  * @wmi_handle: wmi handle
411  * @pmo_icmp_req: icmp offload request
412  *
413  * To configure ICMP offload data to firmware
414  * when target goes to wow mode.
415  *
416  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
417  */
418 QDF_STATUS wmi_unified_config_icmp_offload_cmd(wmi_unified_t wmi_handle,
419 			struct pmo_icmp_offload *pmo_icmp_req);
420 #endif
421 #endif /* _WMI_UNIFIED_PMO_API_H_ */
422