xref: /wlan-driver/qca-wifi-host-cmn/wmi/src/wmi_unified_p2p_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name /**
20*5113495bSYour Name  * DOC: Implement API's specific to P2P component.
21*5113495bSYour Name  */
22*5113495bSYour Name 
23*5113495bSYour Name #include <wmi_unified_priv.h>
24*5113495bSYour Name #include <wmi_unified_p2p_api.h>
25*5113495bSYour Name 
wmi_unified_set_p2pgo_oppps_req(wmi_unified_t wmi_handle,struct p2p_ps_params * oppps)26*5113495bSYour Name QDF_STATUS wmi_unified_set_p2pgo_oppps_req(wmi_unified_t wmi_handle,
27*5113495bSYour Name 					   struct p2p_ps_params *oppps)
28*5113495bSYour Name {
29*5113495bSYour Name 	if (wmi_handle->ops->send_set_p2pgo_oppps_req_cmd)
30*5113495bSYour Name 		return wmi_handle->ops->send_set_p2pgo_oppps_req_cmd(wmi_handle,
31*5113495bSYour Name 								     oppps);
32*5113495bSYour Name 
33*5113495bSYour Name 	return QDF_STATUS_E_FAILURE;
34*5113495bSYour Name }
35*5113495bSYour Name 
wmi_unified_set_p2pgo_noa_req_cmd(wmi_unified_t wmi_handle,struct p2p_ps_params * noa)36*5113495bSYour Name QDF_STATUS wmi_unified_set_p2pgo_noa_req_cmd(wmi_unified_t wmi_handle,
37*5113495bSYour Name 					     struct p2p_ps_params *noa)
38*5113495bSYour Name {
39*5113495bSYour Name 	if (wmi_handle->ops->send_set_p2pgo_noa_req_cmd)
40*5113495bSYour Name 		return wmi_handle->ops->send_set_p2pgo_noa_req_cmd(wmi_handle,
41*5113495bSYour Name 								   noa);
42*5113495bSYour Name 
43*5113495bSYour Name 	return QDF_STATUS_E_FAILURE;
44*5113495bSYour Name }
45*5113495bSYour Name 
wmi_extract_p2p_noa_ev_param(wmi_unified_t wmi_handle,void * evt_buf,struct p2p_noa_info * param)46*5113495bSYour Name QDF_STATUS wmi_extract_p2p_noa_ev_param(wmi_unified_t wmi_handle,
47*5113495bSYour Name 					void *evt_buf,
48*5113495bSYour Name 					struct p2p_noa_info *param)
49*5113495bSYour Name {
50*5113495bSYour Name 	if (!wmi_handle) {
51*5113495bSYour Name 		wmi_err("wmi handle is null");
52*5113495bSYour Name 		return QDF_STATUS_E_INVAL;
53*5113495bSYour Name 	}
54*5113495bSYour Name 
55*5113495bSYour Name 	if (wmi_handle->ops->extract_p2p_noa_ev_param)
56*5113495bSYour Name 		return wmi_handle->ops->extract_p2p_noa_ev_param(
57*5113495bSYour Name 				wmi_handle, evt_buf, param);
58*5113495bSYour Name 
59*5113495bSYour Name 	return QDF_STATUS_E_FAILURE;
60*5113495bSYour Name }
61*5113495bSYour Name 
62*5113495bSYour Name QDF_STATUS
wmi_extract_mac_addr_rx_filter_evt_param(wmi_unified_t wmi_handle,void * evt_buf,struct p2p_set_mac_filter_evt * param)63*5113495bSYour Name wmi_extract_mac_addr_rx_filter_evt_param(wmi_unified_t wmi_handle,
64*5113495bSYour Name 					 void *evt_buf,
65*5113495bSYour Name 					 struct p2p_set_mac_filter_evt *param)
66*5113495bSYour Name {
67*5113495bSYour Name 	if (!wmi_handle) {
68*5113495bSYour Name 		wmi_err("wmi handle is null");
69*5113495bSYour Name 		return QDF_STATUS_E_INVAL;
70*5113495bSYour Name 	}
71*5113495bSYour Name 
72*5113495bSYour Name 	if (wmi_handle->ops->extract_mac_addr_rx_filter_evt_param)
73*5113495bSYour Name 		return wmi_handle->ops->extract_mac_addr_rx_filter_evt_param(
74*5113495bSYour Name 				wmi_handle, evt_buf, param);
75*5113495bSYour Name 
76*5113495bSYour Name 	return QDF_STATUS_E_FAILURE;
77*5113495bSYour Name }
78*5113495bSYour Name 
79*5113495bSYour Name #ifdef FEATURE_P2P_LISTEN_OFFLOAD
wmi_unified_p2p_lo_start_cmd(wmi_unified_t wmi_handle,struct p2p_lo_start * param)80*5113495bSYour Name QDF_STATUS wmi_unified_p2p_lo_start_cmd(wmi_unified_t wmi_handle,
81*5113495bSYour Name 					struct p2p_lo_start *param)
82*5113495bSYour Name {
83*5113495bSYour Name 	if (!wmi_handle) {
84*5113495bSYour Name 		wmi_err("wmi handle is null");
85*5113495bSYour Name 		return QDF_STATUS_E_INVAL;
86*5113495bSYour Name 	}
87*5113495bSYour Name 
88*5113495bSYour Name 	if (wmi_handle->ops->send_p2p_lo_start_cmd)
89*5113495bSYour Name 		return wmi_handle->ops->send_p2p_lo_start_cmd(wmi_handle,
90*5113495bSYour Name 							      param);
91*5113495bSYour Name 
92*5113495bSYour Name 	return QDF_STATUS_E_FAILURE;
93*5113495bSYour Name }
94*5113495bSYour Name 
wmi_unified_p2p_lo_stop_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id)95*5113495bSYour Name QDF_STATUS wmi_unified_p2p_lo_stop_cmd(wmi_unified_t wmi_handle,
96*5113495bSYour Name 				       uint8_t vdev_id)
97*5113495bSYour Name {
98*5113495bSYour Name 	if (!wmi_handle) {
99*5113495bSYour Name 		wmi_err("wmi handle is null");
100*5113495bSYour Name 		return QDF_STATUS_E_INVAL;
101*5113495bSYour Name 	}
102*5113495bSYour Name 
103*5113495bSYour Name 	if (wmi_handle->ops->send_p2p_lo_stop_cmd)
104*5113495bSYour Name 		return wmi_handle->ops->send_p2p_lo_stop_cmd(wmi_handle,
105*5113495bSYour Name 							     vdev_id);
106*5113495bSYour Name 
107*5113495bSYour Name 	return QDF_STATUS_E_FAILURE;
108*5113495bSYour Name }
109*5113495bSYour Name 
wmi_extract_p2p_lo_stop_ev_param(wmi_unified_t wmi_handle,void * evt_buf,struct p2p_lo_event * param)110*5113495bSYour Name QDF_STATUS wmi_extract_p2p_lo_stop_ev_param(wmi_unified_t wmi_handle,
111*5113495bSYour Name 					    void *evt_buf,
112*5113495bSYour Name 					    struct p2p_lo_event *param)
113*5113495bSYour Name {
114*5113495bSYour Name 	if (!wmi_handle) {
115*5113495bSYour Name 		wmi_err("wmi handle is null");
116*5113495bSYour Name 		return QDF_STATUS_E_INVAL;
117*5113495bSYour Name 	}
118*5113495bSYour Name 
119*5113495bSYour Name 	if (wmi_handle->ops->extract_p2p_lo_stop_ev_param)
120*5113495bSYour Name 		return wmi_handle->ops->extract_p2p_lo_stop_ev_param(
121*5113495bSYour Name 				wmi_handle, evt_buf, param);
122*5113495bSYour Name 
123*5113495bSYour Name 	return QDF_STATUS_E_FAILURE;
124*5113495bSYour Name }
125*5113495bSYour Name #endif /* End of FEATURE_P2P_LISTEN_OFFLOAD*/
126*5113495bSYour Name 
127