xref: /wlan-dirver/qca-wifi-host-cmn/wmi/src/wmi_unified_p2p_api.c (revision 1397a33f48ea6455be40871470b286e535820eb8)
1 /*
2  * Copyright (c) 2013-2018 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 P2P component.
20  */
21 
22 #include <wmi_unified_priv.h>
23 #include <wmi_unified_p2p_api.h>
24 
25 QDF_STATUS wmi_unified_set_p2pgo_oppps_req(void *wmi_hdl,
26 					   struct p2p_ps_params *oppps)
27 {
28 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
29 
30 	if (wmi_handle->ops->send_set_p2pgo_oppps_req_cmd)
31 		return wmi_handle->ops->send_set_p2pgo_oppps_req_cmd(wmi_handle,
32 								     oppps);
33 
34 	return QDF_STATUS_E_FAILURE;
35 }
36 
37 QDF_STATUS wmi_unified_set_p2pgo_noa_req_cmd(void *wmi_hdl,
38 					     struct p2p_ps_params *noa)
39 {
40 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
41 
42 	if (wmi_handle->ops->send_set_p2pgo_noa_req_cmd)
43 		return wmi_handle->ops->send_set_p2pgo_noa_req_cmd(wmi_handle,
44 								   noa);
45 
46 	return QDF_STATUS_E_FAILURE;
47 }
48 
49 QDF_STATUS wmi_extract_p2p_noa_ev_param(void *wmi_hdl, void *evt_buf,
50 					struct p2p_noa_info *param)
51 {
52 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
53 
54 	if (!wmi_handle) {
55 		WMI_LOGE("wmi handle is null");
56 		return QDF_STATUS_E_INVAL;
57 	}
58 
59 	if (wmi_handle->ops->extract_p2p_noa_ev_param)
60 		return wmi_handle->ops->extract_p2p_noa_ev_param(
61 				wmi_handle, evt_buf, param);
62 
63 	return QDF_STATUS_E_FAILURE;
64 }
65 
66 QDF_STATUS
67 wmi_send_set_mac_addr_rx_filter_cmd(void *wmi_hdl,
68 				    struct p2p_set_mac_filter *param)
69 {
70 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
71 
72 	if (!wmi_handle) {
73 		WMI_LOGE("wmi handle is null");
74 		return QDF_STATUS_E_INVAL;
75 	}
76 
77 	if (wmi_handle->ops->set_mac_addr_rx_filter)
78 		return wmi_handle->ops->set_mac_addr_rx_filter(
79 				wmi_handle, param);
80 
81 	return QDF_STATUS_E_FAILURE;
82 }
83 
84 QDF_STATUS
85 wmi_extract_mac_addr_rx_filter_evt_param(void *wmi_hdl, void *evt_buf,
86 					 struct p2p_set_mac_filter_evt *param)
87 {
88 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
89 
90 	if (!wmi_handle) {
91 		WMI_LOGE("wmi handle is null");
92 		return QDF_STATUS_E_INVAL;
93 	}
94 
95 	if (wmi_handle->ops->extract_mac_addr_rx_filter_evt_param)
96 		return wmi_handle->ops->extract_mac_addr_rx_filter_evt_param(
97 				wmi_handle, evt_buf, param);
98 
99 	return QDF_STATUS_E_FAILURE;
100 }
101 
102 #ifdef FEATURE_P2P_LISTEN_OFFLOAD
103 QDF_STATUS wmi_unified_p2p_lo_start_cmd(void *wmi_hdl,
104 					struct p2p_lo_start *param)
105 {
106 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
107 
108 	if (!wmi_handle) {
109 		WMI_LOGE("wmi handle is null");
110 		return QDF_STATUS_E_INVAL;
111 	}
112 
113 	if (wmi_handle->ops->send_p2p_lo_start_cmd)
114 		return wmi_handle->ops->send_p2p_lo_start_cmd(wmi_handle,
115 							      param);
116 
117 	return QDF_STATUS_E_FAILURE;
118 }
119 
120 QDF_STATUS wmi_unified_p2p_lo_stop_cmd(void *wmi_hdl, uint8_t vdev_id)
121 {
122 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
123 
124 	if (!wmi_handle) {
125 		WMI_LOGE("wmi handle is null");
126 		return QDF_STATUS_E_INVAL;
127 	}
128 
129 	if (wmi_handle->ops->send_p2p_lo_stop_cmd)
130 		return wmi_handle->ops->send_p2p_lo_stop_cmd(wmi_handle,
131 							     vdev_id);
132 
133 	return QDF_STATUS_E_FAILURE;
134 }
135 
136 QDF_STATUS wmi_extract_p2p_lo_stop_ev_param(void *wmi_hdl, void *evt_buf,
137 					    struct p2p_lo_event *param)
138 {
139 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
140 
141 	if (!wmi_handle) {
142 		WMI_LOGE("wmi handle is null");
143 		return QDF_STATUS_E_INVAL;
144 	}
145 
146 	if (wmi_handle->ops->extract_p2p_lo_stop_ev_param)
147 		return wmi_handle->ops->extract_p2p_lo_stop_ev_param(
148 				wmi_handle, evt_buf, param);
149 
150 	return QDF_STATUS_E_FAILURE;
151 }
152 #endif /* End of FEATURE_P2P_LISTEN_OFFLOAD*/
153 
154