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 #ifndef _WMI_UNIFIED_NAN_API_H_
24 #define _WMI_UNIFIED_NAN_API_H_
25 
26 #include <nan_public_structs.h>
27 
28 /**
29  * wmi_unified_nan_req_cmd() - to send nan request to target
30  * @wmi_handle: wmi handle
31  * @nan_req: request data which will be non-null
32  *
33  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
34  */
35 QDF_STATUS wmi_unified_nan_req_cmd(wmi_unified_t wmi_handle,
36 				   struct nan_msg_params *nan_req);
37 
38 /**
39  * wmi_unified_nan_disable_req_cmd() - to send nan disable request to target
40  * @wmi_handle: wmi handle
41  * @nan_req: pointer to NAN Disable request structure
42  *
43  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
44  */
45 QDF_STATUS wmi_unified_nan_disable_req_cmd(wmi_unified_t wmi_handle,
46 					   struct nan_disable_req *nan_req);
47 
48 /**
49  * wmi_unified_ndp_initiator_req_cmd_send - api to send initiator request to FW
50  * @wmi_handle: wmi handle
51  * @req: pointer to request buffer
52  *
53  * Return: status of operation
54  */
55 QDF_STATUS
56 wmi_unified_ndp_initiator_req_cmd_send(wmi_unified_t wmi_handle,
57 				       struct nan_datapath_initiator_req *req);
58 
59 /**
60  * wmi_unified_ndp_responder_req_cmd_send - api to send responder request to FW
61  * @wmi_handle: wmi handle
62  * @req: pointer to request buffer
63  *
64  * Return: status of operation
65  */
66 QDF_STATUS
67 wmi_unified_ndp_responder_req_cmd_send(wmi_unified_t wmi_handle,
68 				       struct nan_datapath_responder_req *req);
69 
70 /**
71  * wmi_unified_ndp_end_req_cmd_send - api to send end request to FW
72  * @wmi_handle: wmi handle
73  * @req: pointer to request buffer
74  *
75  * Return: status of operation
76  */
77 QDF_STATUS wmi_unified_ndp_end_req_cmd_send(wmi_unified_t wmi_handle,
78 					    struct nan_datapath_end_req *req);
79 
80 /**
81  * wmi_unified_terminate_all_ndps_req_cmd - api to request Firmware for
82  * termination of all NDP's associated with the given vdev id.
83  * @wmi_handle: wmi handle
84  * @vdev_id: vdev id
85  *
86  * Return: status of operation
87  */
88 QDF_STATUS wmi_unified_terminate_all_ndps_req_cmd(wmi_unified_t wmi_handle,
89 						  uint32_t vdev_id);
90 
91 /**
92  * wmi_extract_ndp_initiator_rsp - api to extract initiator rsp from even buffer
93  * @wmi_handle: wmi handle
94  * @data: event buffer
95  * @rsp: buffer to populate
96  *
97  * Return: status of operation
98  */
99 QDF_STATUS
100 wmi_extract_ndp_initiator_rsp(wmi_unified_t wmi_handle, uint8_t *data,
101 			      struct nan_datapath_initiator_rsp *rsp);
102 
103 /**
104  * wmi_extract_ndp_ind - api to extract ndp indication struct from even buffer
105  * @wmi_handle: wmi handle
106  * @data: event buffer
107  * @ind: buffer to populate
108  *
109  * Return: status of operation
110  */
111 QDF_STATUS wmi_extract_ndp_ind(wmi_unified_t wmi_handle, uint8_t *data,
112 			       struct nan_datapath_indication_event *ind);
113 
114 /**
115  * wmi_extract_nan_msg - api to extract ndp dmesg buffer to print logs
116  * @wmi_handle: wmi handle
117  * @data: event buffer
118  * @msg: buffer to populate
119  *
120  * Return: status of operation
121  */
122 QDF_STATUS wmi_extract_nan_msg(wmi_unified_t wmi_handle, uint8_t *data,
123 			       struct nan_dump_msg *msg);
124 
125 /**
126  * wmi_extract_ndp_confirm - api to extract ndp confim struct from even buffer
127  * @wmi_handle: wmi handle
128  * @data: event buffer
129  * @ev: buffer to populate
130  *
131  * Return: status of operation
132  */
133 QDF_STATUS wmi_extract_ndp_confirm(wmi_unified_t wmi_handle, uint8_t *data,
134 				   struct nan_datapath_confirm_event *ev);
135 
136 /**
137  * wmi_extract_ndp_responder_rsp - api to extract responder rsp from even buffer
138  * @wmi_handle: wmi handle
139  * @data: event buffer
140  * @rsp: buffer to populate
141  *
142  * Return: status of operation
143  */
144 QDF_STATUS
145 wmi_extract_ndp_responder_rsp(wmi_unified_t wmi_handle, uint8_t *data,
146 			      struct nan_datapath_responder_rsp *rsp);
147 
148 /**
149  * wmi_extract_ndp_end_rsp - api to extract ndp end rsp from even buffer
150  * @wmi_handle: wmi handle
151  * @data: event buffer
152  * @rsp: buffer to populate
153  *
154  * Return: status of operation
155  */
156 QDF_STATUS wmi_extract_ndp_end_rsp(wmi_unified_t wmi_handle, uint8_t *data,
157 				   struct nan_datapath_end_rsp_event *rsp);
158 
159 /**
160  * wmi_extract_ndp_end_ind - api to extract ndp end indication from even buffer
161  * @wmi_handle: wmi handle
162  * @data: event buffer
163  * @ind: buffer to populate
164  *
165  * Return: status of operation
166  */
167 QDF_STATUS
168 wmi_extract_ndp_end_ind(wmi_unified_t wmi_handle, uint8_t *data,
169 			struct nan_datapath_end_indication_event **ind);
170 
171 /**
172  * wmi_extract_ndp_sch_update - api to extract ndp sch update from event buffer
173  * @wmi_handle: wmi handle
174  * @data: event buffer
175  * @ind: buffer to populate
176  *
177  * Return: status of operation
178  */
179 QDF_STATUS
180 wmi_extract_ndp_sch_update(wmi_unified_t wmi_handle, uint8_t *data,
181 			   struct nan_datapath_sch_update_event *ind);
182 
183 /**
184  * wmi_extract_nan_event_rsp - api to extract nan event into event parameters
185  * @wmi_handle: wmi handle
186  * @evt_buf: pointer to the event buffer
187  * @temp_evt_params: Pointer to a temporary parameters structure to populate
188  * @nan_msg_buf: Pointer to the NAN Message buffer encapsulated in the event
189  *
190  * Return: status of operation
191  */
192 QDF_STATUS wmi_extract_nan_event_rsp(wmi_unified_t wmi_handle, void *evt_buf,
193 				     struct nan_event_params *temp_evt_params,
194 				     uint8_t **nan_msg_buf);
195 
196 /**
197  * wmi_extract_ndp_host_event - api to extract ndp event from event buffer
198  * @wmi_handle: wmi handle
199  * @data: event buffer
200  * @evt: event buffer to populate
201  *
202  * Return: status of operation
203  */
204 QDF_STATUS wmi_extract_ndp_host_event(wmi_unified_t wmi_handle, uint8_t *data,
205 				      struct nan_datapath_host_event *evt);
206 #endif /* _WMI_UNIFIED_NAN_API_H_ */
207