1 /*
2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022-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 /*
21 * This file contains the API definitions for the Unified Wireless Module
22 * Interface (WMI).
23 */
24 #include <htc_api.h>
25 #include <htc_api.h>
26 #include <wmi_unified_priv.h>
27 #include <wmi_unified_api.h>
28 #include <qdf_module.h>
29 #include <qdf_list.h>
30 #include <qdf_platform.h>
31 #ifdef WMI_EXT_DBG
32 #include <qdf_list.h>
33 #endif
34
35 #include <linux/debugfs.h>
36 #include <wmi_unified_param.h>
37 #include <cdp_txrx_cmn_struct.h>
38 #include <wmi_unified_vdev_api.h>
39
40 QDF_STATUS
wmi_extract_tbttoffset_num_vdevs(struct wmi_unified * wmi_handle,void * evt_buf,uint32_t * num_vdevs)41 wmi_extract_tbttoffset_num_vdevs(struct wmi_unified *wmi_handle, void *evt_buf,
42 uint32_t *num_vdevs)
43 {
44 if (wmi_handle->ops->extract_tbttoffset_num_vdevs)
45 return wmi_handle->ops->extract_tbttoffset_num_vdevs(wmi_handle,
46 evt_buf,
47 num_vdevs);
48
49 return QDF_STATUS_E_FAILURE;
50 }
51
wmi_unified_send_multiple_vdev_restart_req_cmd(struct wmi_unified * wmi_handle,struct multiple_vdev_restart_params * param)52 QDF_STATUS wmi_unified_send_multiple_vdev_restart_req_cmd(
53 struct wmi_unified *wmi_handle,
54 struct multiple_vdev_restart_params *param)
55 {
56 if (wmi_handle->ops->send_multiple_vdev_restart_req_cmd)
57 return wmi_handle->ops->send_multiple_vdev_restart_req_cmd(
58 wmi_handle, param);
59
60 return QDF_STATUS_E_FAILURE;
61 }
62
wmi_unified_send_multiple_vdev_set_param_cmd(struct wmi_unified * wmi_handle,struct multiple_vdev_set_param * param)63 QDF_STATUS wmi_unified_send_multiple_vdev_set_param_cmd(
64 struct wmi_unified *wmi_handle,
65 struct multiple_vdev_set_param *param)
66 {
67 if (wmi_handle->ops->send_multiple_vdev_set_param_cmd)
68 return wmi_handle->ops->send_multiple_vdev_set_param_cmd(
69 wmi_handle, param);
70
71 return QDF_STATUS_E_FAILURE;
72 }
73
wmi_unified_beacon_send_cmd(struct wmi_unified * wmi_handle,struct beacon_params * param)74 QDF_STATUS wmi_unified_beacon_send_cmd(struct wmi_unified *wmi_handle,
75 struct beacon_params *param)
76 {
77 if (wmi_handle->ops->send_beacon_send_cmd)
78 return wmi_handle->ops->send_beacon_send_cmd(wmi_handle,
79 param);
80
81 return QDF_STATUS_E_FAILURE;
82 }
83
84 QDF_STATUS
wmi_extract_vdev_start_resp(struct wmi_unified * wmi_handle,void * evt_buf,struct vdev_start_response * vdev_rsp)85 wmi_extract_vdev_start_resp(struct wmi_unified *wmi_handle, void *evt_buf,
86 struct vdev_start_response *vdev_rsp)
87 {
88 if (wmi_handle->ops->extract_vdev_start_resp)
89 return wmi_handle->ops->extract_vdev_start_resp(wmi_handle,
90 evt_buf,
91 vdev_rsp);
92
93 return QDF_STATUS_E_FAILURE;
94 }
95
96 QDF_STATUS
wmi_extract_vdev_delete_resp(struct wmi_unified * wmi_handle,void * evt_buf,struct vdev_delete_response * delete_rsp)97 wmi_extract_vdev_delete_resp(struct wmi_unified *wmi_handle, void *evt_buf,
98 struct vdev_delete_response *delete_rsp)
99 {
100 if (wmi_handle->ops->extract_vdev_delete_resp)
101 return wmi_handle->ops->extract_vdev_delete_resp(wmi_handle,
102 evt_buf,
103 delete_rsp);
104
105 return QDF_STATUS_E_FAILURE;
106 }
107
wmi_extract_vdev_peer_delete_all_response_event(struct wmi_unified * wmi_handle,void * evt_buf,struct peer_delete_all_response * delete_rsp)108 QDF_STATUS wmi_extract_vdev_peer_delete_all_response_event(
109 struct wmi_unified *wmi_handle,
110 void *evt_buf,
111 struct peer_delete_all_response *delete_rsp)
112 {
113 if (wmi_handle->ops->extract_vdev_peer_delete_all_response_event)
114 return
115 wmi_handle->ops->extract_vdev_peer_delete_all_response_event(
116 wmi_handle,
117 evt_buf,
118 delete_rsp);
119
120 return QDF_STATUS_E_FAILURE;
121 }
122
123 QDF_STATUS
wmi_extract_vdev_stopped_param(struct wmi_unified * wmi_handle,void * evt_buf,uint32_t * vdev_id)124 wmi_extract_vdev_stopped_param(struct wmi_unified *wmi_handle, void *evt_buf,
125 uint32_t *vdev_id)
126 {
127 if (wmi_handle->ops->extract_vdev_stopped_param)
128 return wmi_handle->ops->extract_vdev_stopped_param(wmi_handle,
129 evt_buf,
130 vdev_id);
131
132 return QDF_STATUS_E_FAILURE;
133 }
134
135 QDF_STATUS
wmi_extract_ext_tbttoffset_num_vdevs(struct wmi_unified * wmi_handle,void * evt_buf,uint32_t * num_vdevs)136 wmi_extract_ext_tbttoffset_num_vdevs(struct wmi_unified *wmi_handle,
137 void *evt_buf, uint32_t *num_vdevs)
138 {
139 if (wmi_handle->ops->extract_ext_tbttoffset_num_vdevs)
140 return wmi_handle->ops->extract_ext_tbttoffset_num_vdevs(
141 wmi_handle,
142 evt_buf, num_vdevs);
143
144 return QDF_STATUS_E_FAILURE;
145 }
146
147 QDF_STATUS
wmi_unified_vdev_config_ratemask_cmd_send(struct wmi_unified * wmi_handle,struct config_ratemask_params * param)148 wmi_unified_vdev_config_ratemask_cmd_send(struct wmi_unified *wmi_handle,
149 struct config_ratemask_params *param)
150 {
151 if (wmi_handle->ops->send_vdev_config_ratemask_cmd)
152 return wmi_handle->ops->send_vdev_config_ratemask_cmd(
153 wmi_handle, param);
154
155 return QDF_STATUS_E_FAILURE;
156 }
157
158 QDF_STATUS
wmi_unified_peer_filter_set_tx_cmd_send(struct wmi_unified * wmi_handle,uint8_t macaddr[],struct set_tx_peer_filter * param)159 wmi_unified_peer_filter_set_tx_cmd_send(struct wmi_unified *wmi_handle,
160 uint8_t macaddr[],
161 struct set_tx_peer_filter *param)
162 {
163 struct wmi_ops *ops = wmi_handle->ops;
164
165 if (ops->send_peer_filter_set_tx_cmd)
166 return ops->send_peer_filter_set_tx_cmd(wmi_handle, macaddr,
167 param);
168
169 return QDF_STATUS_E_FAILURE;
170 }
171
wmi_unified_vdev_set_neighbour_rx_cmd_send(struct wmi_unified * wmi_handle,uint8_t macaddr[QDF_MAC_ADDR_SIZE],struct set_neighbour_rx_params * param)172 QDF_STATUS wmi_unified_vdev_set_neighbour_rx_cmd_send(
173 struct wmi_unified *wmi_handle,
174 uint8_t macaddr[QDF_MAC_ADDR_SIZE],
175 struct set_neighbour_rx_params *param)
176 {
177 if (wmi_handle->ops->send_vdev_set_neighbour_rx_cmd)
178 return wmi_handle->ops->send_vdev_set_neighbour_rx_cmd(
179 wmi_handle,
180 macaddr, param);
181
182 return QDF_STATUS_E_FAILURE;
183 }
184
185 qdf_export_symbol(wmi_unified_vdev_set_neighbour_rx_cmd_send);
186
187 QDF_STATUS
wmi_send_peer_vlan_config(struct wmi_unified * wmi_handle,uint8_t * macaddr,struct peer_vlan_config_param param)188 wmi_send_peer_vlan_config(struct wmi_unified *wmi_handle,
189 uint8_t *macaddr,
190 struct peer_vlan_config_param param)
191 {
192 char peer_mac[QDF_MAC_ADDR_SIZE];
193
194 qdf_mem_copy(peer_mac, macaddr, QDF_MAC_ADDR_SIZE);
195
196 if (wmi_handle->ops->send_peer_vlan_config_cmd)
197 return wmi_handle->ops->send_peer_vlan_config_cmd(wmi_handle,
198 peer_mac,
199 ¶m);
200
201 return QDF_STATUS_E_FAILURE;
202 }
203
wmi_extract_multi_vdev_restart_resp_event(struct wmi_unified * wmi_handle,void * evt_buf,struct multi_vdev_restart_resp * restart_rsp)204 QDF_STATUS wmi_extract_multi_vdev_restart_resp_event(
205 struct wmi_unified *wmi_handle,
206 void *evt_buf,
207 struct multi_vdev_restart_resp *restart_rsp)
208 {
209 if (wmi_handle->ops->extract_multi_vdev_restart_resp_event)
210 return wmi_handle->ops->extract_multi_vdev_restart_resp_event(
211 wmi_handle, evt_buf, restart_rsp);
212
213 return QDF_STATUS_E_FAILURE;
214 }
215
wmi_unified_multisoc_tbtt_sync_cmd(wmi_unified_t wmi_handle,struct rnr_tbtt_multisoc_sync_param * param)216 QDF_STATUS wmi_unified_multisoc_tbtt_sync_cmd(wmi_unified_t wmi_handle,
217 struct rnr_tbtt_multisoc_sync_param *param)
218 {
219 if (wmi_handle->ops->multisoc_tbtt_sync_cmd)
220 return wmi_handle->ops->multisoc_tbtt_sync_cmd(wmi_handle,
221 param);
222
223 return QDF_STATUS_E_FAILURE;
224 }
225
226 #ifdef WLAN_FEATURE_SR
227 QDF_STATUS
wmi_unified_vdev_param_sr_prohibit_send(wmi_unified_t wmi_hdl,struct sr_prohibit_param * srp_param)228 wmi_unified_vdev_param_sr_prohibit_send(wmi_unified_t wmi_hdl,
229 struct sr_prohibit_param *srp_param)
230 {
231 if (wmi_hdl->ops->vdev_param_sr_prohibit_send)
232 return wmi_hdl->ops->vdev_param_sr_prohibit_send(wmi_hdl,
233 srp_param);
234
235 return QDF_STATUS_E_FAILURE;
236 }
237 #endif
238