xref: /wlan-driver/qca-wifi-host-cmn/wmi/src/wmi_unified_pmo_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 /**
19  * DOC: Implement API's specific to PMO component.
20  */
21 
22 #include "ol_if_athvar.h"
23 #include "ol_defines.h"
24 #include "wmi_unified_priv.h"
25 #include "wmi_unified_pmo_api.h"
26 #include "wlan_pmo_hw_filter_public_struct.h"
27 
28 #ifdef FEATURE_WLAN_D0WOW
wmi_unified_d0wow_enable_send(wmi_unified_t wmi_handle,uint8_t mac_id)29 QDF_STATUS wmi_unified_d0wow_enable_send(wmi_unified_t wmi_handle,
30 					 uint8_t mac_id)
31 {
32 	if (wmi_handle->ops->send_d0wow_enable_cmd)
33 		return wmi_handle->ops->send_d0wow_enable_cmd(wmi_handle,
34 							      mac_id);
35 
36 	return QDF_STATUS_E_FAILURE;
37 }
38 
wmi_unified_d0wow_disable_send(wmi_unified_t wmi_handle,uint8_t mac_id)39 QDF_STATUS wmi_unified_d0wow_disable_send(wmi_unified_t wmi_handle,
40 					  uint8_t mac_id)
41 {
42 	if (wmi_handle->ops->send_d0wow_disable_cmd)
43 		return wmi_handle->ops->send_d0wow_disable_cmd(wmi_handle,
44 							       mac_id);
45 
46 	return QDF_STATUS_E_FAILURE;
47 }
48 #endif /* FEATURE_WLAN_D0WOW */
49 
wmi_unified_add_wow_wakeup_event_cmd(wmi_unified_t wmi_handle,uint32_t vdev_id,uint32_t * bitmap,bool enable)50 QDF_STATUS wmi_unified_add_wow_wakeup_event_cmd(wmi_unified_t wmi_handle,
51 						uint32_t vdev_id,
52 						uint32_t *bitmap,
53 						bool enable)
54 {
55 	if (wmi_handle->ops->send_add_wow_wakeup_event_cmd)
56 		return wmi_handle->ops->send_add_wow_wakeup_event_cmd(
57 				wmi_handle, vdev_id, bitmap, enable);
58 
59 	return QDF_STATUS_E_FAILURE;
60 }
61 
wmi_unified_wow_patterns_to_fw_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,uint8_t ptrn_id,const uint8_t * ptrn,uint8_t ptrn_len,uint8_t ptrn_offset,const uint8_t * mask,uint8_t mask_len,bool user,uint8_t default_patterns)62 QDF_STATUS wmi_unified_wow_patterns_to_fw_cmd(
63 				wmi_unified_t wmi_handle,
64 				uint8_t vdev_id, uint8_t ptrn_id,
65 				const uint8_t *ptrn, uint8_t ptrn_len,
66 				uint8_t ptrn_offset, const uint8_t *mask,
67 				uint8_t mask_len, bool user,
68 				uint8_t default_patterns)
69 {
70 	if (wmi_handle->ops->send_wow_patterns_to_fw_cmd)
71 		return wmi_handle->ops->send_wow_patterns_to_fw_cmd(wmi_handle,
72 				vdev_id, ptrn_id, ptrn,
73 				ptrn_len, ptrn_offset, mask,
74 				mask_len, user, default_patterns);
75 
76 	return QDF_STATUS_E_FAILURE;
77 }
78 
wmi_unified_enable_arp_ns_offload_cmd(wmi_unified_t wmi_handle,struct pmo_arp_offload_params * arp_offload_req,struct pmo_ns_offload_params * ns_offload_req,uint8_t vdev_id)79 QDF_STATUS wmi_unified_enable_arp_ns_offload_cmd(
80 			wmi_unified_t wmi_handle,
81 			struct pmo_arp_offload_params *arp_offload_req,
82 			struct pmo_ns_offload_params *ns_offload_req,
83 			uint8_t vdev_id)
84 {
85 	if (wmi_handle->ops->send_enable_arp_ns_offload_cmd)
86 		return wmi_handle->ops->send_enable_arp_ns_offload_cmd(
87 				wmi_handle,
88 				arp_offload_req, ns_offload_req, vdev_id);
89 
90 	return QDF_STATUS_E_FAILURE;
91 }
92 
wmi_unified_add_clear_mcbc_filter_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,struct qdf_mac_addr multicast_addr,bool clear_list)93 QDF_STATUS wmi_unified_add_clear_mcbc_filter_cmd(
94 				wmi_unified_t wmi_handle,
95 				uint8_t vdev_id,
96 				struct qdf_mac_addr multicast_addr,
97 				bool clear_list)
98 {
99 	if (wmi_handle->ops->send_add_clear_mcbc_filter_cmd)
100 		return wmi_handle->ops->send_add_clear_mcbc_filter_cmd(
101 			wmi_handle, vdev_id, multicast_addr, clear_list);
102 
103 	return QDF_STATUS_E_FAILURE;
104 }
105 
wmi_unified_multiple_add_clear_mcbc_filter_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,struct pmo_mcast_filter_params * filter_param)106 QDF_STATUS wmi_unified_multiple_add_clear_mcbc_filter_cmd(
107 				wmi_unified_t wmi_handle,
108 				uint8_t vdev_id,
109 				struct pmo_mcast_filter_params *filter_param)
110 {
111 	if (wmi_handle->ops->send_multiple_add_clear_mcbc_filter_cmd)
112 		return wmi_handle->ops->send_multiple_add_clear_mcbc_filter_cmd(
113 				wmi_handle, vdev_id, filter_param);
114 
115 	return QDF_STATUS_E_FAILURE;
116 }
117 
wmi_unified_conf_hw_filter_cmd(wmi_unified_t wmi_handle,struct pmo_hw_filter_params * req)118 QDF_STATUS wmi_unified_conf_hw_filter_cmd(wmi_unified_t wmi_handle,
119 					  struct pmo_hw_filter_params *req)
120 {
121 	if (!wmi_handle->ops->send_conf_hw_filter_cmd)
122 		return QDF_STATUS_E_NOSUPPORT;
123 
124 	return wmi_handle->ops->send_conf_hw_filter_cmd(wmi_handle, req);
125 }
126 
wmi_unified_send_gtk_offload_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,struct pmo_gtk_req * params,bool enable_offload,uint32_t gtk_offload_opcode)127 QDF_STATUS wmi_unified_send_gtk_offload_cmd(wmi_unified_t wmi_handle,
128 					    uint8_t vdev_id,
129 					    struct pmo_gtk_req  *params,
130 					    bool enable_offload,
131 					    uint32_t gtk_offload_opcode)
132 {
133 	if (wmi_handle->ops->send_gtk_offload_cmd)
134 		return wmi_handle->ops->send_gtk_offload_cmd(wmi_handle,
135 				vdev_id, params, enable_offload,
136 				gtk_offload_opcode);
137 
138 	return QDF_STATUS_E_FAILURE;
139 }
140 
141 #ifdef WLAN_FEATURE_IGMP_OFFLOAD
142 QDF_STATUS
wmi_unified_send_igmp_offload_cmd(wmi_unified_t wmi_handle,struct pmo_igmp_offload_req * pmo_igmp_req)143 wmi_unified_send_igmp_offload_cmd(wmi_unified_t wmi_handle,
144 				  struct pmo_igmp_offload_req *pmo_igmp_req)
145 {
146 	if (wmi_handle->ops->send_igmp_offload_cmd)
147 		return wmi_handle->ops->send_igmp_offload_cmd(wmi_handle,
148 				pmo_igmp_req);
149 
150 	return QDF_STATUS_E_FAILURE;
151 }
152 #endif
153 
wmi_unified_process_gtk_offload_getinfo_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,uint64_t offload_req_opcode)154 QDF_STATUS wmi_unified_process_gtk_offload_getinfo_cmd(
155 				wmi_unified_t wmi_handle,
156 				uint8_t vdev_id,
157 				uint64_t offload_req_opcode)
158 {
159 	if (wmi_handle->ops->send_process_gtk_offload_getinfo_cmd)
160 		return wmi_handle->ops->send_process_gtk_offload_getinfo_cmd(
161 				wmi_handle, vdev_id, offload_req_opcode);
162 
163 	return QDF_STATUS_E_FAILURE;
164 }
165 
wmi_unified_enable_enhance_multicast_offload_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,bool action)166 QDF_STATUS wmi_unified_enable_enhance_multicast_offload_cmd(
167 		wmi_unified_t wmi_handle, uint8_t vdev_id, bool action)
168 {
169 	struct wmi_ops *ops;
170 
171 	ops = wmi_handle->ops;
172 	if (ops && ops->send_enable_enhance_multicast_offload_cmd)
173 		return ops->send_enable_enhance_multicast_offload_cmd(
174 			wmi_handle, vdev_id, action);
175 
176 	return QDF_STATUS_E_FAILURE;
177 }
178 
wmi_extract_gtk_rsp_event(wmi_unified_t wmi_handle,void * evt_buf,struct pmo_gtk_rsp_params * gtk_rsp_param,uint32_t len)179 QDF_STATUS wmi_extract_gtk_rsp_event(
180 	wmi_unified_t wmi_handle, void *evt_buf,
181 	struct pmo_gtk_rsp_params *gtk_rsp_param, uint32_t len)
182 {
183 	if (wmi_handle->ops->extract_gtk_rsp_event)
184 		return wmi_handle->ops->extract_gtk_rsp_event(wmi_handle,
185 				evt_buf, gtk_rsp_param, len);
186 
187 	return QDF_STATUS_E_FAILURE;
188 }
189 
190 #ifdef FEATURE_WLAN_RA_FILTERING
wmi_unified_wow_sta_ra_filter_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,uint8_t default_pattern,uint16_t rate_limit_interval)191 QDF_STATUS wmi_unified_wow_sta_ra_filter_cmd(wmi_unified_t wmi_handle,
192 					     uint8_t vdev_id,
193 					     uint8_t default_pattern,
194 					     uint16_t rate_limit_interval)
195 {
196 
197 	if (wmi_handle->ops->send_wow_sta_ra_filter_cmd)
198 		return wmi_handle->ops->send_wow_sta_ra_filter_cmd(wmi_handle,
199 			    vdev_id, default_pattern, rate_limit_interval);
200 
201 	return QDF_STATUS_E_FAILURE;
202 
203 }
204 #endif /* FEATURE_WLAN_RA_FILTERING */
205 
wmi_unified_action_frame_patterns_cmd(wmi_unified_t wmi_handle,struct pmo_action_wakeup_set_params * action_params)206 QDF_STATUS wmi_unified_action_frame_patterns_cmd(
207 		wmi_unified_t wmi_handle,
208 		struct pmo_action_wakeup_set_params *action_params)
209 {
210 	if (wmi_handle->ops->send_action_frame_patterns_cmd)
211 		return wmi_handle->ops->send_action_frame_patterns_cmd(
212 				wmi_handle, action_params);
213 
214 	return QDF_STATUS_E_FAILURE;
215 }
216 
217 #ifdef FEATURE_WLAN_LPHB
wmi_unified_lphb_config_hbenable_cmd(wmi_unified_t wmi_handle,wmi_hb_set_enable_cmd_fixed_param * params)218 QDF_STATUS wmi_unified_lphb_config_hbenable_cmd(
219 		wmi_unified_t wmi_handle,
220 		wmi_hb_set_enable_cmd_fixed_param *params)
221 {
222 	if (wmi_handle->ops->send_lphb_config_hbenable_cmd)
223 		return wmi_handle->ops->send_lphb_config_hbenable_cmd(
224 				wmi_handle, params);
225 
226 	return QDF_STATUS_E_FAILURE;
227 }
228 
wmi_unified_lphb_config_tcp_params_cmd(wmi_unified_t wmi_handle,wmi_hb_set_tcp_params_cmd_fixed_param * lphb_conf_req)229 QDF_STATUS wmi_unified_lphb_config_tcp_params_cmd(
230 		wmi_unified_t wmi_handle,
231 		wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req)
232 {
233 	if (wmi_handle->ops->send_lphb_config_tcp_params_cmd)
234 		return wmi_handle->ops->send_lphb_config_tcp_params_cmd(
235 				wmi_handle, lphb_conf_req);
236 
237 	return QDF_STATUS_E_FAILURE;
238 }
239 
wmi_unified_lphb_config_tcp_pkt_filter_cmd(wmi_unified_t wmi_handle,wmi_hb_set_tcp_pkt_filter_cmd_fixed_param * g_hb_tcp_filter_fp)240 QDF_STATUS wmi_unified_lphb_config_tcp_pkt_filter_cmd(
241 		wmi_unified_t wmi_handle,
242 		wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp)
243 {
244 	if (wmi_handle->ops->send_lphb_config_tcp_pkt_filter_cmd)
245 		return wmi_handle->ops->send_lphb_config_tcp_pkt_filter_cmd(
246 				wmi_handle, g_hb_tcp_filter_fp);
247 
248 	return QDF_STATUS_E_FAILURE;
249 }
250 
wmi_unified_lphb_config_udp_params_cmd(wmi_unified_t wmi_handle,wmi_hb_set_udp_params_cmd_fixed_param * lphb_conf_req)251 QDF_STATUS wmi_unified_lphb_config_udp_params_cmd(
252 			wmi_unified_t wmi_handle,
253 			wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req)
254 {
255 	if (wmi_handle->ops->send_lphb_config_udp_params_cmd)
256 		return wmi_handle->ops->send_lphb_config_udp_params_cmd(
257 				wmi_handle, lphb_conf_req);
258 
259 	return QDF_STATUS_E_FAILURE;
260 }
261 
wmi_unified_lphb_config_udp_pkt_filter_cmd(wmi_unified_t wmi_handle,wmi_hb_set_udp_pkt_filter_cmd_fixed_param * lphb_conf_req)262 QDF_STATUS wmi_unified_lphb_config_udp_pkt_filter_cmd(
263 		wmi_unified_t wmi_handle,
264 		wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req)
265 {
266 	if (wmi_handle->ops->send_lphb_config_udp_pkt_filter_cmd)
267 		return wmi_handle->ops->send_lphb_config_udp_pkt_filter_cmd(
268 				wmi_handle, lphb_conf_req);
269 
270 	return QDF_STATUS_E_FAILURE;
271 }
272 #endif /* FEATURE_WLAN_LPHB */
273 
274 #ifdef WLAN_FEATURE_PACKET_FILTERING
275 QDF_STATUS
wmi_unified_enable_disable_packet_filter_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,bool enable)276 wmi_unified_enable_disable_packet_filter_cmd(wmi_unified_t wmi_handle,
277 					     uint8_t vdev_id, bool enable)
278 {
279 	if (wmi_handle->ops->send_enable_disable_packet_filter_cmd)
280 		return wmi_handle->ops->send_enable_disable_packet_filter_cmd(
281 				wmi_handle, vdev_id, enable);
282 
283 	return QDF_STATUS_E_FAILURE;
284 }
285 
wmi_unified_config_packet_filter_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,struct pmo_rcv_pkt_fltr_cfg * rcv_filter_param,uint8_t filter_id,bool enable)286 QDF_STATUS wmi_unified_config_packet_filter_cmd(
287 		wmi_unified_t wmi_handle,
288 		uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param,
289 		uint8_t filter_id, bool enable)
290 {
291 	if (wmi_handle->ops->send_config_packet_filter_cmd)
292 		return wmi_handle->ops->send_config_packet_filter_cmd(
293 		wmi_handle, vdev_id, rcv_filter_param, filter_id, enable);
294 
295 	return QDF_STATUS_E_FAILURE;
296 }
297 #endif /* WLAN_FEATURE_PACKET_FILTERING */
298 
wmi_unified_wow_delete_pattern_cmd(wmi_unified_t wmi_handle,uint8_t ptrn_id,uint8_t vdev_id)299 QDF_STATUS wmi_unified_wow_delete_pattern_cmd(wmi_unified_t wmi_handle,
300 					      uint8_t ptrn_id,
301 					      uint8_t vdev_id)
302 {
303 	if (wmi_handle->ops->send_wow_delete_pattern_cmd)
304 		return wmi_handle->ops->send_wow_delete_pattern_cmd(wmi_handle,
305 								    ptrn_id,
306 								    vdev_id);
307 
308 	return QDF_STATUS_E_FAILURE;
309 }
310 
wmi_unified_host_wakeup_ind_to_fw_cmd(wmi_unified_t wmi_handle,bool tx_pending_ind)311 QDF_STATUS wmi_unified_host_wakeup_ind_to_fw_cmd(wmi_unified_t wmi_handle,
312 						 bool tx_pending_ind)
313 {
314 	if (wmi_handle->ops->send_host_wakeup_ind_to_fw_cmd)
315 		return wmi_handle->ops->send_host_wakeup_ind_to_fw_cmd
316 						(wmi_handle,
317 						 tx_pending_ind);
318 
319 	return QDF_STATUS_E_FAILURE;
320 }
321 
wmi_unified_wow_timer_pattern_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,uint32_t cookie,uint32_t time)322 QDF_STATUS wmi_unified_wow_timer_pattern_cmd(wmi_unified_t wmi_handle,
323 					     uint8_t vdev_id,
324 					     uint32_t cookie, uint32_t time)
325 {
326 	if (wmi_handle->ops->send_wow_timer_pattern_cmd)
327 		return wmi_handle->ops->send_wow_timer_pattern_cmd(wmi_handle,
328 							vdev_id, cookie, time);
329 
330 	return QDF_STATUS_E_FAILURE;
331 }
332 
333 #ifdef WLAN_FEATURE_EXTWOW_SUPPORT
wmi_unified_enable_ext_wow_cmd(wmi_unified_t wmi_handle,struct ext_wow_params * params)334 QDF_STATUS wmi_unified_enable_ext_wow_cmd(wmi_unified_t wmi_handle,
335 					  struct ext_wow_params *params)
336 {
337 	if (wmi_handle->ops->send_enable_ext_wow_cmd)
338 		return wmi_handle->ops->send_enable_ext_wow_cmd(wmi_handle,
339 								params);
340 
341 	return QDF_STATUS_E_FAILURE;
342 }
343 
wmi_unified_set_app_type2_params_in_fw_cmd(wmi_unified_t wmi_handle,struct app_type2_params * appType2Params)344 QDF_STATUS wmi_unified_set_app_type2_params_in_fw_cmd(
345 				wmi_unified_t wmi_handle,
346 				struct app_type2_params *appType2Params)
347 {
348 	if (wmi_handle->ops->send_set_app_type2_params_in_fw_cmd)
349 		return wmi_handle->ops->send_set_app_type2_params_in_fw_cmd(
350 				wmi_handle, appType2Params);
351 
352 	return QDF_STATUS_E_FAILURE;
353 }
354 
wmi_unified_app_type1_params_in_fw_cmd(wmi_unified_t wmi_handle,struct app_type1_params * app_type1_params)355 QDF_STATUS wmi_unified_app_type1_params_in_fw_cmd(
356 				wmi_unified_t wmi_handle,
357 				struct app_type1_params *app_type1_params)
358 {
359 	if (wmi_handle->ops->send_app_type1_params_in_fw_cmd)
360 		return wmi_handle->ops->send_app_type1_params_in_fw_cmd(
361 				wmi_handle, app_type1_params);
362 
363 	return QDF_STATUS_E_FAILURE;
364 }
365 #endif /* WLAN_FEATURE_EXTWOW_SUPPORT */
366 
367 #ifdef WLAN_FEATURE_ICMP_OFFLOAD
wmi_unified_config_icmp_offload_cmd(wmi_unified_t wmi_handle,struct pmo_icmp_offload * pmo_icmp_req)368 QDF_STATUS wmi_unified_config_icmp_offload_cmd(wmi_unified_t wmi_handle,
369 			struct pmo_icmp_offload *pmo_icmp_req)
370 {
371 	if (wmi_handle->ops->send_icmp_offload_config_cmd)
372 		return wmi_handle->ops->send_icmp_offload_config_cmd(
373 				wmi_handle, pmo_icmp_req);
374 
375 	return QDF_STATUS_E_FAILURE;
376 }
377 #endif
378