1 /*
2  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 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  * DOC: Contains OCB north bound interface definitions
22  */
23 
24 #ifndef _WLAN_OCB_UCFG_API_H_
25 #define _WLAN_OCB_UCFG_API_H_
26 #include <qdf_types.h>
27 #include "wlan_ocb_public_structs.h"
28 
29 #ifdef WLAN_FEATURE_DSRC
30 /**
31  * ucfg_ocb_set_channel_config() - send OCB config request
32  * @vdev: vdev handle
33  * @config: config parameters
34  * @set_config_cb: callback for set channel config
35  * @arg: arguments for the callback
36  *
37  * Return: QDF_STATUS_SUCCESS on success
38  */
39 QDF_STATUS ucfg_ocb_set_channel_config(struct wlan_objmgr_vdev *vdev,
40 				       struct ocb_config *config,
41 				       ocb_sync_callback set_config_cb,
42 				       void *arg);
43 
44 /**
45  * ucfg_ocb_set_utc_time() - UCFG API to set UTC time
46  * @vdev: vdev handle
47  * @utc: UTC time
48  *
49  * Return: QDF_STATUS_SUCCESS on success
50  */
51 QDF_STATUS ucfg_ocb_set_utc_time(struct wlan_objmgr_vdev *vdev,
52 				 struct ocb_utc_param *utc);
53 
54 /**
55  * ucfg_ocb_start_timing_advert() - ucfg API to start TA
56  * @vdev: vdev handle
57  * @ta: timing advertisement parameters
58  *
59  * Return: QDF_STATUS_SUCCESS on success
60  */
61 QDF_STATUS ucfg_ocb_start_timing_advert(struct wlan_objmgr_vdev *vdev,
62 					struct ocb_timing_advert_param *ta);
63 
64 /**
65  * ucfg_ocb_stop_timing_advert() - ucfg API to stop TA
66  * @vdev: vdev handle
67  * @ta: timing advertisement parameters
68  *
69  * Return: QDF_STATUS_SUCCESS on success
70  */
71 QDF_STATUS ucfg_ocb_stop_timing_advert(struct wlan_objmgr_vdev *vdev,
72 				       struct ocb_timing_advert_param *ta);
73 
74 /**
75  * ucfg_ocb_get_tsf_timer() - ucfg API to get tsf timer
76  * @vdev: vdev handle
77  * @request: request for TSF timer
78  * @get_tsf_cb: callback for TSF timer response
79  * @arg: argument for the ccallback
80  *
81  * Return: QDF_STATUS_SUCCESS on success
82  */
83 QDF_STATUS ucfg_ocb_get_tsf_timer(struct wlan_objmgr_vdev *vdev,
84 				  struct ocb_get_tsf_timer_param *request,
85 				  ocb_sync_callback get_tsf_cb,
86 				  void *arg);
87 
88 /**
89  * ucfg_ocb_dcc_get_stats() - get DCC stats
90  * @vdev: vdev handle
91  * @request: request for dcc stats
92  * @dcc_get_stats_cb: callback for get dcc stats response
93  * @arg: argument for the ccallback
94  *
95  * Return: QDF_STATUS_SUCCESS on success
96  */
97 QDF_STATUS ucfg_ocb_dcc_get_stats(struct wlan_objmgr_vdev *vdev,
98 				  struct ocb_dcc_get_stats_param *request,
99 				  ocb_sync_callback dcc_get_stats_cb,
100 				  void *arg);
101 
102 /**
103  * ucfg_ocb_dcc_clear_stats() - Clear DCC stats
104  * @vdev: vdev handle
105  * @vdev_id: vdev ID
106  * @bitmap: bitmap for stats to be cleared
107  *
108  * Return: QDF_STATUS_SUCCESS on success
109  */
110 QDF_STATUS ucfg_ocb_dcc_clear_stats(struct wlan_objmgr_vdev *vdev,
111 				    uint16_t vdev_id,
112 				    uint32_t bitmap);
113 
114 /**
115  * ucfg_ocb_dcc_update_ndl() - ucfg API to update NDL
116  * @vdev: vdev handle
117  * @request: request parameters
118  * @dcc_update_ndl_cb: callback for update response
119  * @arg: argument for the callback
120  *
121  * Return: QDF_STATUS_SUCCESS on success
122  */
123 QDF_STATUS ucfg_ocb_dcc_update_ndl(struct wlan_objmgr_vdev *vdev,
124 				   struct ocb_dcc_update_ndl_param *request,
125 				   ocb_sync_callback dcc_update_ndl_cb,
126 				   void *arg);
127 
128 /**
129  * ucfg_ocb_register_for_dcc_stats_event() - register dcc stats
130  * events callback
131  * @pdev: pdev handle
132  * @ctx: argument for the callback
133  * @dcc_stats_cb: callback for dcc stats event
134  *
135  * Return: QDF_STATUS_SUCCESS on success
136  */
137 QDF_STATUS ucfg_ocb_register_for_dcc_stats_event(struct wlan_objmgr_pdev *pdev,
138 				void *ctx, ocb_sync_callback dcc_stats_cb);
139 
140 /**
141  * ucfg_ocb_init() - OCB module initialization
142  *
143  * Return: QDF_STATUS_SUCCESS on success
144  */
145 QDF_STATUS ucfg_ocb_init(void);
146 
147 /**
148  * ucfg_ocb_deinit() - OCB module deinitialization
149  *
150  * Return: QDF_STATUS_SUCCESS on success
151  */
152 QDF_STATUS ucfg_ocb_deinit(void);
153 
154 /**
155  * ucfg_ocb_config_channel() - Set channel config using after OCB started
156  * @pdev: pdev handle
157  *
158  * Return: QDF_STATUS_SUCCESS on success
159  */
160 QDF_STATUS ucfg_ocb_config_channel(struct wlan_objmgr_pdev *pdev);
161 
162 /**
163  * ucfg_ocb_register_vdev_start() - register callback to start ocb vdev
164  * @pdev: pdev handle
165  * @ocb_start: legacy callback to start ocb vdev
166  *
167  * Return: QDF_STATUS_SUCCESS on success
168  */
169 QDF_STATUS ucfg_ocb_register_vdev_start(struct wlan_objmgr_pdev *pdev,
170 				QDF_STATUS (*ocb_start)(struct ocb_config *));
171 
172 /**
173  * ocb_psoc_enable() - Trigger psoc enable for ocb
174  * @psoc: objmgr psoc object
175  *
176  * Return: QDF status success or failure
177  */
178 QDF_STATUS ocb_psoc_enable(struct wlan_objmgr_psoc *psoc);
179 
180 /**
181  * ocb_psoc_disable() - Trigger psoc disable for ocb
182  * @psoc: objmgr psoc object
183  *
184  * Return: QDF status success or failure
185  */
186 QDF_STATUS ocb_psoc_disable(struct wlan_objmgr_psoc *psoc);
187 
188 /**
189  * ucfg_ocb_update_dp_handle() - register DP handle
190  * @soc: soc handle
191  * @dp_soc: data path soc handle
192  *
193  * Return: QDF_STATUS_SUCCESS on success
194  */
195 QDF_STATUS ucfg_ocb_update_dp_handle(struct wlan_objmgr_psoc *soc,
196 				     void *dp_soc);
197 
198 /**
199  * ucfg_ocb_set_txrx_pdev_id() - register txrx pdev id
200  * @psoc: soc handle
201  * @pdev_id: data path pdev ID
202  *
203  * Return: QDF_STATUS_SUCCESS on success
204  */
205 QDF_STATUS ucfg_ocb_set_txrx_pdev_id(struct wlan_objmgr_psoc *psoc,
206 				     uint8_t pdev_id);
207 #else
208 /**
209  * ucfg_ocb_init() - OCB module initialization
210  *
211  * Return: QDF_STATUS_SUCCESS on success
212  */
ucfg_ocb_init(void)213 static inline QDF_STATUS ucfg_ocb_init(void)
214 {
215 	return QDF_STATUS_SUCCESS;
216 }
217 
218 /**
219  * ucfg_ocb_deinit() - OCB module deinitialization
220  *
221  * Return: QDF_STATUS_SUCCESS on success
222  */
ucfg_ocb_deinit(void)223 static inline QDF_STATUS ucfg_ocb_deinit(void)
224 {
225 	return QDF_STATUS_SUCCESS;
226 }
227 
228 /**
229  * ucfg_ocb_config_channel() - Set channel config using after OCB started
230  * @pdev: pdev handle
231  *
232  * Return: QDF_STATUS_SUCCESS on success
233  */
234 static inline QDF_STATUS
ucfg_ocb_config_channel(struct wlan_objmgr_pdev * pdev)235 ucfg_ocb_config_channel(struct wlan_objmgr_pdev *pdev)
236 {
237 	return QDF_STATUS_SUCCESS;
238 }
239 
240 /**
241  * ocb_psoc_enable() - Trigger psoc enable for ocb
242  * @psoc: objmgr psoc object
243  *
244  * Return: QDF status success or failure
245  */
246 static inline
ocb_psoc_enable(struct wlan_objmgr_psoc * psoc)247 QDF_STATUS ocb_psoc_enable(struct wlan_objmgr_psoc *psoc)
248 {
249 	return QDF_STATUS_SUCCESS;
250 }
251 
252 /**
253  * ocb_psoc_disable() - Trigger psoc disable for ocb
254  * @psoc: objmgr psoc object
255  *
256  * Return: QDF status success or failure
257  */
258 static inline
ocb_psoc_disable(struct wlan_objmgr_psoc * psoc)259 QDF_STATUS ocb_psoc_disable(struct wlan_objmgr_psoc *psoc)
260 {
261 	return QDF_STATUS_SUCCESS;
262 }
263 
264 /**
265  * ucfg_ocb_update_dp_handle() - register DP handle
266  * @soc: soc handle
267  * @dp_soc: data path soc handle
268  *
269  * Return: QDF_STATUS_SUCCESS on success
270  */
271 static inline
ucfg_ocb_update_dp_handle(struct wlan_objmgr_psoc * soc,void * dp_soc)272 QDF_STATUS ucfg_ocb_update_dp_handle(struct wlan_objmgr_psoc *soc,
273 				     void *dp_soc)
274 {
275 	return QDF_STATUS_SUCCESS;
276 }
277 
278 /**
279  * ucfg_ocb_set_txrx_pdev_id() - register txrx pdev id
280  * @psoc: soc handle
281  * @pdev_id: data path pdev ID
282  *
283  * Return: QDF_STATUS_SUCCESS on success
284  */
285 static inline
ucfg_ocb_set_txrx_pdev_id(struct wlan_objmgr_psoc * psoc,uint8_t pdev_id)286 QDF_STATUS ucfg_ocb_set_txrx_pdev_id(struct wlan_objmgr_psoc *psoc,
287 				     uint8_t pdev_id)
288 {
289 	return QDF_STATUS_SUCCESS;
290 }
291 #endif
292 #endif
293