1 /*
2 * Copyright (c) 2013-2020 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: Implement API's specific to NAN component.
21 */
22
23 #include <wmi_unified_priv.h>
24 #include <wmi_unified_nan_api.h>
25
wmi_unified_nan_req_cmd(wmi_unified_t wmi_handle,struct nan_msg_params * nan_msg)26 QDF_STATUS wmi_unified_nan_req_cmd(wmi_unified_t wmi_handle,
27 struct nan_msg_params *nan_msg)
28 {
29 if (wmi_handle->ops->send_nan_req_cmd)
30 return wmi_handle->ops->send_nan_req_cmd(wmi_handle,
31 nan_msg);
32
33 return QDF_STATUS_E_FAILURE;
34 }
35
wmi_unified_nan_disable_req_cmd(wmi_unified_t wmi_handle,struct nan_disable_req * nan_msg)36 QDF_STATUS wmi_unified_nan_disable_req_cmd(wmi_unified_t wmi_handle,
37 struct nan_disable_req *nan_msg)
38 {
39 if (wmi_handle->ops->send_nan_disable_req_cmd)
40 return wmi_handle->ops->send_nan_disable_req_cmd(wmi_handle,
41 nan_msg);
42
43 return QDF_STATUS_E_FAILURE;
44 }
45
wmi_extract_nan_event_rsp(wmi_unified_t wmi_handle,void * evt_buf,struct nan_event_params * nan_evt_params,uint8_t ** nan_msg_buf)46 QDF_STATUS wmi_extract_nan_event_rsp(wmi_unified_t wmi_handle, void *evt_buf,
47 struct nan_event_params *nan_evt_params,
48 uint8_t **nan_msg_buf)
49 {
50 if (wmi_handle->ops->extract_nan_event_rsp)
51 return wmi_handle->ops->extract_nan_event_rsp(wmi_handle,
52 evt_buf,
53 nan_evt_params,
54 nan_msg_buf);
55
56 return QDF_STATUS_E_FAILURE;
57 }
58
59 QDF_STATUS
wmi_unified_ndp_initiator_req_cmd_send(wmi_unified_t wmi_handle,struct nan_datapath_initiator_req * req)60 wmi_unified_ndp_initiator_req_cmd_send(wmi_unified_t wmi_handle,
61 struct nan_datapath_initiator_req *req)
62 {
63 if (wmi_handle->ops->send_ndp_initiator_req_cmd)
64 return wmi_handle->ops->send_ndp_initiator_req_cmd(wmi_handle,
65 req);
66
67 return QDF_STATUS_E_FAILURE;
68 }
69
70 QDF_STATUS
wmi_unified_ndp_responder_req_cmd_send(wmi_unified_t wmi_handle,struct nan_datapath_responder_req * req)71 wmi_unified_ndp_responder_req_cmd_send(wmi_unified_t wmi_handle,
72 struct nan_datapath_responder_req *req)
73 {
74 if (wmi_handle->ops->send_ndp_responder_req_cmd)
75 return wmi_handle->ops->send_ndp_responder_req_cmd(wmi_handle,
76 req);
77
78 return QDF_STATUS_E_FAILURE;
79 }
80
wmi_unified_terminate_all_ndps_req_cmd(wmi_unified_t wmi_handle,uint32_t vdev_id)81 QDF_STATUS wmi_unified_terminate_all_ndps_req_cmd(wmi_unified_t wmi_handle,
82 uint32_t vdev_id)
83 {
84 if (wmi_handle->ops->send_terminate_all_ndps_req_cmd)
85 return wmi_handle->ops->send_terminate_all_ndps_req_cmd(
86 wmi_handle,
87 vdev_id);
88
89 return QDF_STATUS_E_FAILURE;
90 }
91
wmi_unified_ndp_end_req_cmd_send(wmi_unified_t wmi_handle,struct nan_datapath_end_req * req)92 QDF_STATUS wmi_unified_ndp_end_req_cmd_send(wmi_unified_t wmi_handle,
93 struct nan_datapath_end_req *req)
94 {
95 if (wmi_handle->ops->send_ndp_end_req_cmd)
96 return wmi_handle->ops->send_ndp_end_req_cmd(wmi_handle,
97 req);
98
99 return QDF_STATUS_E_FAILURE;
100 }
101
wmi_extract_nan_msg(wmi_unified_t wmi_handle,uint8_t * data,struct nan_dump_msg * msg)102 QDF_STATUS wmi_extract_nan_msg(wmi_unified_t wmi_handle,
103 uint8_t *data,
104 struct nan_dump_msg *msg)
105 {
106 if (wmi_handle->ops->extract_nan_msg)
107 return wmi_handle->ops->extract_nan_msg(data, msg);
108
109 return QDF_STATUS_E_FAILURE;
110 }
111
wmi_extract_ndp_initiator_rsp(wmi_unified_t wmi_handle,uint8_t * data,struct nan_datapath_initiator_rsp * rsp)112 QDF_STATUS wmi_extract_ndp_initiator_rsp(wmi_unified_t wmi_handle,
113 uint8_t *data, struct nan_datapath_initiator_rsp *rsp)
114 {
115 if (wmi_handle->ops->extract_ndp_initiator_rsp)
116 return wmi_handle->ops->extract_ndp_initiator_rsp(wmi_handle,
117 data, rsp);
118
119 return QDF_STATUS_E_FAILURE;
120 }
121
wmi_extract_ndp_ind(wmi_unified_t wmi_handle,uint8_t * data,struct nan_datapath_indication_event * ind)122 QDF_STATUS wmi_extract_ndp_ind(wmi_unified_t wmi_handle, uint8_t *data,
123 struct nan_datapath_indication_event *ind)
124 {
125 if (wmi_handle->ops->extract_ndp_ind)
126 return wmi_handle->ops->extract_ndp_ind(wmi_handle,
127 data, ind);
128
129 return QDF_STATUS_E_FAILURE;
130 }
131
wmi_extract_ndp_confirm(wmi_unified_t wmi_handle,uint8_t * data,struct nan_datapath_confirm_event * ev)132 QDF_STATUS wmi_extract_ndp_confirm(wmi_unified_t wmi_handle, uint8_t *data,
133 struct nan_datapath_confirm_event *ev)
134 {
135 if (wmi_handle->ops->extract_ndp_confirm)
136 return wmi_handle->ops->extract_ndp_confirm(wmi_handle,
137 data, ev);
138
139 return QDF_STATUS_E_FAILURE;
140 }
141
wmi_extract_ndp_responder_rsp(wmi_unified_t wmi_handle,uint8_t * data,struct nan_datapath_responder_rsp * rsp)142 QDF_STATUS wmi_extract_ndp_responder_rsp(wmi_unified_t wmi_handle,
143 uint8_t *data,
144 struct nan_datapath_responder_rsp *rsp)
145 {
146 if (wmi_handle->ops->extract_ndp_responder_rsp)
147 return wmi_handle->ops->extract_ndp_responder_rsp(wmi_handle,
148 data, rsp);
149
150 return QDF_STATUS_E_FAILURE;
151 }
152
wmi_extract_ndp_end_rsp(wmi_unified_t wmi_handle,uint8_t * data,struct nan_datapath_end_rsp_event * rsp)153 QDF_STATUS wmi_extract_ndp_end_rsp(wmi_unified_t wmi_handle, uint8_t *data,
154 struct nan_datapath_end_rsp_event *rsp)
155 {
156 if (wmi_handle->ops->extract_ndp_end_rsp)
157 return wmi_handle->ops->extract_ndp_end_rsp(wmi_handle,
158 data, rsp);
159
160 return QDF_STATUS_E_FAILURE;
161 }
162
wmi_extract_ndp_end_ind(wmi_unified_t wmi_handle,uint8_t * data,struct nan_datapath_end_indication_event ** ind)163 QDF_STATUS wmi_extract_ndp_end_ind(wmi_unified_t wmi_handle, uint8_t *data,
164 struct nan_datapath_end_indication_event **ind)
165 {
166 if (wmi_handle->ops->extract_ndp_end_ind)
167 return wmi_handle->ops->extract_ndp_end_ind(wmi_handle,
168 data, ind);
169
170 return QDF_STATUS_E_FAILURE;
171 }
172
wmi_extract_ndp_sch_update(wmi_unified_t wmi_handle,uint8_t * data,struct nan_datapath_sch_update_event * ind)173 QDF_STATUS wmi_extract_ndp_sch_update(wmi_unified_t wmi_handle, uint8_t *data,
174 struct nan_datapath_sch_update_event *ind)
175 {
176 if (wmi_handle->ops->extract_ndp_sch_update)
177 return wmi_handle->ops->extract_ndp_sch_update(wmi_handle,
178 data, ind);
179
180 return QDF_STATUS_E_FAILURE;
181 }
182
wmi_extract_ndp_host_event(wmi_unified_t wmi_handle,uint8_t * data,struct nan_datapath_host_event * evt)183 QDF_STATUS wmi_extract_ndp_host_event(wmi_unified_t wmi_handle, uint8_t *data,
184 struct nan_datapath_host_event *evt)
185 {
186 if (wmi_handle->ops->extract_ndp_host_event)
187 return wmi_handle->ops->extract_ndp_host_event(wmi_handle,
188 data, evt);
189
190 return QDF_STATUS_E_FAILURE;
191 }
192