xref: /wlan-dirver/qca-wifi-host-cmn/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c (revision 97f44cd39e4ff816eaa1710279d28cf6b9e65ad9)
1 /*
2  * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
3  *
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 #include "qdf_mem.h"
21 #include <qdf_module.h>
22 #include "wlan_lmac_if_def.h"
23 #include "wlan_lmac_if_api.h"
24 #include "wlan_mgmt_txrx_tgt_api.h"
25 #include "wlan_scan_tgt_api.h"
26 #include <wlan_reg_services_api.h>
27 #include <wlan_reg_ucfg_api.h>
28 #ifdef WLAN_ATF_ENABLE
29 #include "wlan_atf_tgt_api.h"
30 #endif
31 #ifdef WLAN_SA_API_ENABLE
32 #include "wlan_sa_api_tgt_api.h"
33 #endif
34 #ifdef WIFI_POS_CONVERGED
35 #include "target_if_wifi_pos.h"
36 #endif /* WIFI_POS_CONVERGED */
37 #include "wlan_reg_tgt_api.h"
38 #ifdef CONVERGED_P2P_ENABLE
39 #include "wlan_p2p_tgt_api.h"
40 #endif
41 #ifdef FEATURE_WLAN_TDLS
42 #include "wlan_tdls_tgt_api.h"
43 #endif
44 
45 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
46 #include "wlan_crypto_global_api.h"
47 #endif
48 #ifdef DFS_COMPONENT_ENABLE
49 #include <wlan_dfs_tgt_api.h>
50 #include <wlan_objmgr_vdev_obj.h>
51 #include <wlan_dfs_utils_api.h>
52 #endif
53 
54 #ifdef WLAN_SUPPORT_GREEN_AP
55 #include <wlan_green_ap_api.h>
56 #include <wlan_green_ap_ucfg_api.h>
57 #endif
58 #include <wlan_ftm_ucfg_api.h>
59 
60 #ifdef WLAN_SUPPORT_FILS
61 #include <wlan_fd_tgt_api.h>
62 #endif
63 
64 #ifdef QCA_SUPPORT_CP_STATS
65 #include <wlan_cp_stats_tgt_api.h>
66 #endif /* QCA_SUPPORT_CP_STATS */
67 #include <wlan_vdev_mgr_tgt_if_rx_api.h>
68 
69 #ifdef WLAN_CFR_ENABLE
70 #include "wlan_cfr_tgt_api.h"
71 #endif
72 
73 #ifdef WIFI_POS_CONVERGED
74 #include "wifi_pos_api.h"
75 #endif
76 
77 /* Function pointer for OL/WMA specific UMAC tx_ops
78  * registration.
79  */
80 QDF_STATUS (*wlan_lmac_if_umac_tx_ops_register)
81 				(struct wlan_lmac_if_tx_ops *tx_ops);
82 qdf_export_symbol(wlan_lmac_if_umac_tx_ops_register);
83 
84 static void
85 tgt_vdev_mgr_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
86 {
87 	tgt_vdev_mgr_register_rx_ops(rx_ops);
88 }
89 
90 #ifdef QCA_SUPPORT_CP_STATS
91 /**
92  * wlan_lmac_if_cp_stats_rx_ops_register() - API to register cp stats Rx Ops
93  * @rx_ops:	pointer to lmac rx ops
94  *
95  * This API will be used to register function pointers for FW events
96  *
97  * Return: void
98  */
99 static void
100 wlan_lmac_if_cp_stats_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
101 {
102 	tgt_cp_stats_register_rx_ops(rx_ops);
103 }
104 #else
105 static void
106 wlan_lmac_if_cp_stats_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
107 {
108 }
109 #endif /* QCA_SUPPORT_CP_STATS */
110 
111 #ifdef DCS_INTERFERENCE_DETECTION
112 /**
113  * wlan_target_if_dcs_rx_ops_register() - API to register dcs Rx Ops
114  * @rx_ops:	pointer to lmac rx ops
115  *
116  * This API will be used to register function pointers for FW events
117  *
118  * Return: void
119  */
120 static void
121 wlan_target_if_dcs_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
122 {
123 	rx_ops->dcs_rx_ops.process_dcs_event = tgt_dcs_process_event;
124 }
125 #else
126 static void
127 wlan_target_if_dcs_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
128 {
129 }
130 #endif /* DCS_INTERFERENCE_DETECTION */
131 
132 #ifdef WLAN_ATF_ENABLE
133 /**
134  * wlan_lmac_if_atf_rx_ops_register() - Function to register ATF RX ops.
135  */
136 static void
137 wlan_lmac_if_atf_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
138 {
139 	struct wlan_lmac_if_atf_rx_ops *atf_rx_ops = &rx_ops->atf_rx_ops;
140 
141 	/* ATF rx ops */
142 	atf_rx_ops->atf_get_fmcap = tgt_atf_get_fmcap;
143 	atf_rx_ops->atf_get_mode = tgt_atf_get_mode;
144 	atf_rx_ops->atf_get_msdu_desc = tgt_atf_get_msdu_desc;
145 	atf_rx_ops->atf_get_max_vdevs = tgt_atf_get_max_vdevs;
146 	atf_rx_ops->atf_get_peers = tgt_atf_get_peers;
147 	atf_rx_ops->atf_get_tput_based = tgt_atf_get_tput_based;
148 	atf_rx_ops->atf_get_logging = tgt_atf_get_logging;
149 	atf_rx_ops->atf_get_ssidgroup = tgt_atf_get_ssidgroup;
150 	atf_rx_ops->atf_get_vdev_ac_blk_cnt = tgt_atf_get_vdev_ac_blk_cnt;
151 	atf_rx_ops->atf_get_peer_blk_txbitmap = tgt_atf_get_peer_blk_txbitmap;
152 	atf_rx_ops->atf_get_vdev_blk_txtraffic = tgt_atf_get_vdev_blk_txtraffic;
153 	atf_rx_ops->atf_get_sched = tgt_atf_get_sched;
154 	atf_rx_ops->atf_get_peer_stats = tgt_atf_get_peer_stats;
155 	atf_rx_ops->atf_get_token_allocated = tgt_atf_get_token_allocated;
156 	atf_rx_ops->atf_get_token_utilized = tgt_atf_get_token_utilized;
157 
158 	atf_rx_ops->atf_set_sched = tgt_atf_set_sched;
159 	atf_rx_ops->atf_set_fmcap = tgt_atf_set_fmcap;
160 	atf_rx_ops->atf_set_msdu_desc = tgt_atf_set_msdu_desc;
161 	atf_rx_ops->atf_set_max_vdevs = tgt_atf_set_max_vdevs;
162 	atf_rx_ops->atf_set_peers = tgt_atf_set_peers;
163 	atf_rx_ops->atf_set_peer_stats = tgt_atf_set_peer_stats;
164 	atf_rx_ops->atf_set_vdev_blk_txtraffic = tgt_atf_set_vdev_blk_txtraffic;
165 	atf_rx_ops->atf_peer_blk_txtraffic = tgt_atf_peer_blk_txtraffic;
166 	atf_rx_ops->atf_peer_unblk_txtraffic = tgt_atf_peer_unblk_txtraffic;
167 	atf_rx_ops->atf_set_token_allocated = tgt_atf_set_token_allocated;
168 	atf_rx_ops->atf_set_token_utilized = tgt_atf_set_token_utilized;
169 	atf_rx_ops->atf_process_ppdu_stats = tgt_atf_process_ppdu_stats;
170 	atf_rx_ops->atf_is_stats_enabled = tgt_atf_is_stats_enabled;
171 }
172 #else
173 static void
174 wlan_lmac_if_atf_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
175 {
176 }
177 #endif
178 
179 #ifdef WLAN_SUPPORT_FILS
180 static void
181 wlan_lmac_if_fd_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
182 {
183 	struct wlan_lmac_if_fd_rx_ops *fd_rx_ops = &rx_ops->fd_rx_ops;
184 
185 	fd_rx_ops->fd_is_fils_enable = tgt_fd_is_fils_enable;
186 	fd_rx_ops->fd_alloc = tgt_fd_alloc;
187 	fd_rx_ops->fd_stop = tgt_fd_stop;
188 	fd_rx_ops->fd_free = tgt_fd_free;
189 	fd_rx_ops->fd_get_valid_fd_period = tgt_fd_get_valid_fd_period;
190 	fd_rx_ops->fd_swfda_handler = tgt_fd_swfda_handler;
191 	fd_rx_ops->fd_offload = tgt_fd_offload;
192 	fd_rx_ops->fd_tmpl_update = tgt_fd_tmpl_update;
193 }
194 #else
195 static void
196 wlan_lmac_if_fd_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
197 {
198 }
199 #endif
200 
201 #ifdef WLAN_SA_API_ENABLE
202 /**
203  * wlan_lmac_if_sa_api_rx_ops_register() - Function to register SA_API RX ops.
204  */
205 static void
206 wlan_lmac_if_sa_api_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
207 {
208 	struct wlan_lmac_if_sa_api_rx_ops *sa_api_rx_ops = &rx_ops->sa_api_rx_ops;
209 
210 	/* SA API rx ops */
211 	sa_api_rx_ops->sa_api_get_sa_supported = tgt_sa_api_get_sa_supported;
212 	sa_api_rx_ops->sa_api_get_validate_sw  = tgt_sa_api_get_validate_sw;
213 	sa_api_rx_ops->sa_api_enable_sa        = tgt_sa_api_enable_sa;
214 	sa_api_rx_ops->sa_api_get_sa_enable    = tgt_sa_api_get_sa_enable;
215 
216 	sa_api_rx_ops->sa_api_peer_assoc_hanldler = tgt_sa_api_peer_assoc_hanldler;
217 	sa_api_rx_ops->sa_api_update_tx_feedback = tgt_sa_api_update_tx_feedback;
218 	sa_api_rx_ops->sa_api_update_rx_feedback = tgt_sa_api_update_rx_feedback;
219 
220 	sa_api_rx_ops->sa_api_ucfg_set_param = tgt_sa_api_ucfg_set_param;
221 	sa_api_rx_ops->sa_api_ucfg_get_param = tgt_sa_api_ucfg_get_param;
222 
223 	sa_api_rx_ops->sa_api_is_tx_feedback_enabled = tgt_sa_api_is_tx_feedback_enabled;
224 	sa_api_rx_ops->sa_api_is_rx_feedback_enabled = tgt_sa_api_is_rx_feedback_enabled;
225 
226 	sa_api_rx_ops->sa_api_convert_rate_2g = tgt_sa_api_convert_rate_2g;
227 	sa_api_rx_ops->sa_api_convert_rate_5g = tgt_sa_api_convert_rate_5g;
228 	sa_api_rx_ops->sa_api_get_sa_mode = tgt_sa_api_get_sa_mode;
229 
230 	sa_api_rx_ops->sa_api_get_beacon_txantenna = tgt_sa_api_get_beacon_txantenna;
231 	sa_api_rx_ops->sa_api_cwm_action = tgt_sa_api_cwm_action;
232 }
233 #else
234 static void
235 wlan_lmac_if_sa_api_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
236 {
237 }
238 #endif
239 
240 #ifdef WLAN_CFR_ENABLE
241 /**
242  * wlan_lmac_if_cfr_rx_ops_register() - Function to register CFR RX ops
243  */
244 static void
245 wlan_lmac_if_cfr_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
246 {
247 	struct wlan_lmac_if_cfr_rx_ops *cfr_rx_ops = &rx_ops->cfr_rx_ops;
248 
249 	/* CFR rx ops */
250 	cfr_rx_ops->cfr_support_set = tgt_cfr_support_set;
251 	cfr_rx_ops->cfr_info_send  = tgt_cfr_info_send;
252 	cfr_rx_ops->cfr_capture_count_support_set =
253 		tgt_cfr_capture_count_support_set;
254 	cfr_rx_ops->cfr_mo_marking_support_set = tgt_cfr_mo_marking_support_set;
255 }
256 #else
257 static void
258 wlan_lmac_if_cfr_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
259 {
260 }
261 #endif
262 
263 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
264 static void
265 wlan_lmac_if_crypto_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
266 {
267 	wlan_crypto_register_crypto_rx_ops(&rx_ops->crypto_rx_ops);
268 }
269 #else
270 static void
271 wlan_lmac_if_crypto_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
272 {
273 }
274 #endif
275 
276 #ifdef WIFI_POS_CONVERGED
277 static void wlan_lmac_if_umac_rx_ops_register_wifi_pos(
278 				struct wlan_lmac_if_rx_ops *rx_ops)
279 {
280 	wifi_pos_register_rx_ops(rx_ops);
281 }
282 #else
283 static void wlan_lmac_if_umac_rx_ops_register_wifi_pos(
284 				struct wlan_lmac_if_rx_ops *rx_ops)
285 {
286 }
287 #endif /* WIFI_POS_CONVERGED */
288 
289 static void wlan_lmac_if_umac_reg_rx_ops_register(
290 	struct wlan_lmac_if_rx_ops *rx_ops)
291 {
292 	rx_ops->reg_rx_ops.master_list_handler =
293 		tgt_reg_process_master_chan_list;
294 
295 	rx_ops->reg_rx_ops.reg_11d_new_cc_handler =
296 		tgt_reg_process_11d_new_country;
297 
298 	rx_ops->reg_rx_ops.reg_set_regdb_offloaded =
299 		tgt_reg_set_regdb_offloaded;
300 
301 	rx_ops->reg_rx_ops.reg_set_11d_offloaded =
302 		tgt_reg_set_11d_offloaded;
303 
304 	rx_ops->reg_rx_ops.reg_set_6ghz_supported =
305 		tgt_reg_set_6ghz_supported;
306 
307 	rx_ops->reg_rx_ops.reg_set_5dot9_ghz_supported =
308 		tgt_reg_set_5dot9_ghz_supported;
309 
310 	rx_ops->reg_rx_ops.get_dfs_region =
311 		wlan_reg_get_dfs_region;
312 
313 	rx_ops->reg_rx_ops.reg_ch_avoid_event_handler =
314 		tgt_reg_process_ch_avoid_event;
315 
316 	rx_ops->reg_rx_ops.reg_freq_to_chan =
317 		wlan_reg_freq_to_chan;
318 
319 	rx_ops->reg_rx_ops.reg_set_chan_144 =
320 		ucfg_reg_modify_chan_144;
321 
322 	rx_ops->reg_rx_ops.reg_get_chan_144 =
323 		ucfg_reg_get_en_chan_144;
324 
325 	rx_ops->reg_rx_ops.reg_program_default_cc =
326 		ucfg_reg_program_default_cc;
327 
328 	rx_ops->reg_rx_ops.reg_get_current_regdomain =
329 		wlan_reg_get_curr_regdomain;
330 
331 	rx_ops->reg_rx_ops.reg_enable_dfs_channels =
332 		ucfg_reg_enable_dfs_channels;
333 
334 	rx_ops->reg_rx_ops.reg_modify_pdev_chan_range =
335 		wlan_reg_modify_pdev_chan_range;
336 
337 	rx_ops->reg_rx_ops.reg_update_pdev_wireless_modes =
338 		wlan_reg_update_pdev_wireless_modes;
339 
340 	rx_ops->reg_rx_ops.reg_is_range_only6g =
341 		wlan_reg_is_range_only6g;
342 
343 	rx_ops->reg_rx_ops.reg_is_range_overlap_6g =
344 		wlan_reg_is_range_overlap_6g;
345 
346 	rx_ops->reg_rx_ops.reg_ignore_fw_reg_offload_ind =
347 		tgt_reg_ignore_fw_reg_offload_ind;
348 
349 	rx_ops->reg_rx_ops.reg_disable_chan_coex =
350 		wlan_reg_disable_chan_coex;
351 
352 	rx_ops->reg_rx_ops.reg_get_unii_5g_bitmap =
353 		ucfg_reg_get_unii_5g_bitmap;
354 }
355 
356 #ifdef CONVERGED_P2P_ENABLE
357 #ifdef FEATURE_P2P_LISTEN_OFFLOAD
358 static void wlan_lmac_if_umac_rx_ops_register_p2p(
359 				struct wlan_lmac_if_rx_ops *rx_ops)
360 {
361 	rx_ops->p2p.lo_ev_handler = tgt_p2p_lo_event_cb;
362 	rx_ops->p2p.noa_ev_handler = tgt_p2p_noa_event_cb;
363 	rx_ops->p2p.add_mac_addr_filter_evt_handler =
364 		tgt_p2p_add_mac_addr_status_event_cb;
365 }
366 #else
367 static void wlan_lmac_if_umac_rx_ops_register_p2p(
368 				struct wlan_lmac_if_rx_ops *rx_ops)
369 {
370 	rx_ops->p2p.noa_ev_handler = tgt_p2p_noa_event_cb;
371 	rx_ops->p2p.add_mac_addr_filter_evt_handler =
372 		tgt_p2p_add_mac_addr_status_event_cb;
373 }
374 #endif
375 #else
376 static void wlan_lmac_if_umac_rx_ops_register_p2p(
377 				struct wlan_lmac_if_rx_ops *rx_ops)
378 {
379 }
380 #endif
381 
382 /*
383  * register_precac_auto_chan_rx_ops_ieee() - Register auto chan switch rx ops
384  * for IEEE channel based APIs.
385  * rx_ops: Pointer to wlan_lmac_if_dfs_rx_ops
386  */
387 #ifdef DFS_COMPONENT_ENABLE
388 #if defined(WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT) && defined(CONFIG_CHAN_NUM_API)
389 static inline void
390 register_precac_auto_chan_rx_ops_ieee(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
391 {
392 	if (!rx_ops)
393 		return;
394 	rx_ops->dfs_get_precac_chan_state = ucfg_dfs_get_precac_chan_state;
395 }
396 #else
397 static inline void
398 register_precac_auto_chan_rx_ops_ieee(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
399 {
400 }
401 #endif
402 #endif
403 
404 /*
405  * register_precac_auto_chan_rx_ops_freq() - Register auto chan switch rx ops
406  * for frequency based channel APIs.
407  * rx_ops: Pointer to wlan_lmac_if_dfs_rx_ops
408  */
409 #ifdef DFS_COMPONENT_ENABLE
410 #if defined(WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT) && defined(CONFIG_CHAN_FREQ_API)
411 static inline void
412 register_precac_auto_chan_rx_ops_freq(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
413 {
414 	if (!rx_ops)
415 		return;
416 	rx_ops->dfs_get_precac_chan_state_for_freq =
417 		ucfg_dfs_get_precac_chan_state_for_freq;
418 }
419 #else
420 static inline void
421 register_precac_auto_chan_rx_ops_freq(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
422 {
423 }
424 #endif
425 #endif
426 
427 #ifdef DFS_COMPONENT_ENABLE
428 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
429 static inline void
430 register_precac_auto_chan_rx_ops(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
431 {
432 	if (!rx_ops)
433 		return;
434 	rx_ops->dfs_set_precac_intermediate_chan =
435 		ucfg_dfs_set_precac_intermediate_chan;
436 	rx_ops->dfs_get_precac_intermediate_chan =
437 		ucfg_dfs_get_precac_intermediate_chan;
438 }
439 #else
440 static inline void
441 register_precac_auto_chan_rx_ops(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
442 {
443 }
444 #endif
445 
446 /*
447  * register_dfs_rx_ops_for_freq() - Register DFS rx ops for frequency based
448  * channel APIs.
449  * rx_ops: Pointer to wlan_lmac_if_dfs_rx_ops.
450  */
451 #ifdef CONFIG_CHAN_FREQ_API
452 static void register_dfs_rx_ops_for_freq(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
453 {
454 	if (!rx_ops)
455 		return;
456 	rx_ops->dfs_find_vht80_chan_for_precac_for_freq =
457 		tgt_dfs_find_vht80_precac_chan_freq;
458 	rx_ops->dfs_set_current_channel_for_freq =
459 		tgt_dfs_set_current_channel_for_freq;
460 }
461 #endif
462 
463 /*
464  * register_rcac_dfs_rx_ops() - Register DFS RX-Ops for RCAC specific
465  * APIs.
466  * @rx_ops: Pointer to wlan_lmac_if_dfs_rx_ops.
467  */
468 #ifdef QCA_SUPPORT_ADFS_RCAC
469 static void register_rcac_dfs_rx_ops(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
470 {
471 	if (!rx_ops)
472 		return;
473 	rx_ops->dfs_set_rcac_enable = ucfg_dfs_set_rcac_enable;
474 	rx_ops->dfs_get_rcac_enable = ucfg_dfs_get_rcac_enable;
475 	rx_ops->dfs_set_rcac_freq = ucfg_dfs_set_rcac_freq;
476 	rx_ops->dfs_get_rcac_freq = ucfg_dfs_get_rcac_freq;
477 	rx_ops->dfs_is_agile_rcac_enabled = ucfg_dfs_is_agile_rcac_enabled;
478 }
479 #else
480 static inline void
481 register_rcac_dfs_rx_ops(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
482 {
483 }
484 #endif
485 
486 /*
487  * register_agile_dfs_rx_ops() - Register Rx-Ops for Agile Specific APIs
488  * @rx_ops: Pointer to wlan_lmac_if_dfs_rx_ops.
489  */
490 #ifdef QCA_SUPPORT_AGILE_DFS
491 static void register_agile_dfs_rx_ops(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
492 {
493 	if (!rx_ops)
494 		return;
495 	rx_ops->dfs_agile_sm_deliver_evt = utils_dfs_agile_sm_deliver_evt;
496 }
497 #else
498 static inline void
499 register_agile_dfs_rx_ops(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
500 {
501 }
502 #endif
503 
504 #ifdef QCA_SUPPORT_DFS_CHAN_POSTNOL
505 /* register_dfs_chan_postnol_rx_ops() - Register DFS Rx-Ops for postNOL
506  * channel change APIs.
507  * @rx_ops: Pointer to wlan_lmac_if_dfs_rx_ops.
508  */
509 static void
510 register_dfs_chan_postnol_rx_ops(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
511 {
512 	if (!rx_ops)
513 		return;
514 
515 	rx_ops->dfs_set_postnol_freq = ucfg_dfs_set_postnol_freq;
516 	rx_ops->dfs_set_postnol_mode = ucfg_dfs_set_postnol_mode;
517 	rx_ops->dfs_set_postnol_cfreq2 = ucfg_dfs_set_postnol_cfreq2;
518 	rx_ops->dfs_get_postnol_freq = ucfg_dfs_get_postnol_freq;
519 	rx_ops->dfs_get_postnol_mode = ucfg_dfs_get_postnol_mode;
520 	rx_ops->dfs_get_postnol_cfreq2 = ucfg_dfs_get_postnol_cfreq2;
521 }
522 #else
523 static inline void
524 register_dfs_chan_postnol_rx_ops(struct wlan_lmac_if_dfs_rx_ops *rx_ops)
525 {
526 }
527 #endif
528 
529 static QDF_STATUS
530 wlan_lmac_if_umac_dfs_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
531 {
532 	struct wlan_lmac_if_dfs_rx_ops *dfs_rx_ops;
533 
534 	dfs_rx_ops = &rx_ops->dfs_rx_ops;
535 
536 	dfs_rx_ops->dfs_get_radars = tgt_dfs_get_radars;
537 	dfs_rx_ops->dfs_process_phyerr = tgt_dfs_process_phyerr;
538 	dfs_rx_ops->dfs_destroy_object = tgt_dfs_destroy_object;
539 	dfs_rx_ops->dfs_radar_enable = tgt_dfs_radar_enable;
540 	dfs_rx_ops->dfs_is_radar_enabled = tgt_dfs_is_radar_enabled;
541 	dfs_rx_ops->dfs_control = tgt_dfs_control;
542 	dfs_rx_ops->dfs_is_precac_timer_running =
543 		tgt_dfs_is_precac_timer_running;
544 	dfs_rx_ops->dfs_agile_precac_start =
545 		tgt_dfs_agile_precac_start;
546 	dfs_rx_ops->dfs_set_agile_precac_state =
547 		tgt_dfs_set_agile_precac_state;
548 	dfs_rx_ops->dfs_start_precac_timer = utils_dfs_start_precac_timer;
549 	dfs_rx_ops->dfs_cancel_precac_timer = utils_dfs_cancel_precac_timer;
550 	dfs_rx_ops->dfs_reset_adfs_config = ucfg_dfs_reset_agile_config;
551 	dfs_rx_ops->dfs_override_precac_timeout =
552 		ucfg_dfs_override_precac_timeout;
553 	dfs_rx_ops->dfs_set_precac_enable = ucfg_dfs_set_precac_enable;
554 	dfs_rx_ops->dfs_get_legacy_precac_enable =
555 		ucfg_dfs_get_legacy_precac_enable;
556 	dfs_rx_ops->dfs_get_agile_precac_enable =
557 		ucfg_dfs_get_agile_precac_enable;
558 	dfs_rx_ops->dfs_get_override_precac_timeout =
559 		ucfg_dfs_get_override_precac_timeout;
560 	dfs_rx_ops->dfs_process_radar_ind = tgt_dfs_process_radar_ind;
561 	dfs_rx_ops->dfs_dfs_cac_complete_ind = tgt_dfs_cac_complete;
562 	dfs_rx_ops->dfs_dfs_ocac_complete_ind = tgt_dfs_ocac_complete;
563 	dfs_rx_ops->dfs_stop = tgt_dfs_stop;
564 	dfs_rx_ops->dfs_reinit_timers = ucfg_dfs_reinit_timers;
565 	dfs_rx_ops->dfs_enable_stadfs = tgt_dfs_enable_stadfs;
566 	dfs_rx_ops->dfs_is_stadfs_enabled = tgt_dfs_is_stadfs_enabled;
567 	dfs_rx_ops->dfs_process_phyerr_filter_offload =
568 		tgt_dfs_process_phyerr_filter_offload;
569 	dfs_rx_ops->dfs_is_phyerr_filter_offload =
570 		tgt_dfs_is_phyerr_filter_offload;
571 	dfs_rx_ops->dfs_action_on_status = tgt_dfs_action_on_status_from_fw;
572 	dfs_rx_ops->dfs_override_status_timeout =
573 		ucfg_dfs_set_override_status_timeout;
574 	dfs_rx_ops->dfs_get_override_status_timeout =
575 		ucfg_dfs_get_override_status_timeout;
576 	dfs_rx_ops->dfs_reset_spoof_test =
577 		tgt_dfs_reset_spoof_test;
578 	dfs_rx_ops->dfs_is_disable_radar_marking_set =
579 		utils_dfs_get_disable_radar_marking;
580 	dfs_rx_ops->dfs_set_nol_subchannel_marking =
581 		ucfg_dfs_set_nol_subchannel_marking;
582 	dfs_rx_ops->dfs_get_nol_subchannel_marking =
583 		ucfg_dfs_get_nol_subchannel_marking;
584 	dfs_rx_ops->dfs_set_bw_reduction =
585 		utils_dfs_bw_reduce;
586 	dfs_rx_ops->dfs_is_bw_reduction_needed =
587 		utils_dfs_is_bw_reduce;
588 	dfs_rx_ops->dfs_allow_hw_pulses =
589 		ucfg_dfs_allow_hw_pulses;
590 	dfs_rx_ops->dfs_is_hw_pulses_allowed =
591 		ucfg_dfs_is_hw_pulses_allowed;
592 	dfs_rx_ops->dfs_set_fw_adfs_support =
593 		tgt_dfs_set_fw_adfs_support;
594 	dfs_rx_ops->dfs_reset_dfs_prevchan =
595 		utils_dfs_reset_dfs_prevchan;
596 	dfs_rx_ops->dfs_init_tmp_psoc_nol =
597 		tgt_dfs_init_tmp_psoc_nol;
598 	dfs_rx_ops->dfs_deinit_tmp_psoc_nol =
599 		tgt_dfs_deinit_tmp_psoc_nol;
600 	dfs_rx_ops->dfs_save_dfs_nol_in_psoc =
601 		tgt_dfs_save_dfs_nol_in_psoc;
602 	dfs_rx_ops->dfs_reinit_nol_from_psoc_copy =
603 		tgt_dfs_reinit_nol_from_psoc_copy;
604 	dfs_rx_ops->dfs_reinit_precac_lists =
605 		tgt_dfs_reinit_precac_lists;
606 	dfs_rx_ops->dfs_complete_deferred_tasks =
607 		tgt_dfs_complete_deferred_tasks;
608 	register_precac_auto_chan_rx_ops(dfs_rx_ops);
609 	register_precac_auto_chan_rx_ops_ieee(dfs_rx_ops);
610 	register_precac_auto_chan_rx_ops_freq(dfs_rx_ops);
611 	register_dfs_rx_ops_for_freq(dfs_rx_ops);
612 	register_rcac_dfs_rx_ops(dfs_rx_ops);
613 	register_agile_dfs_rx_ops(dfs_rx_ops);
614 	register_dfs_chan_postnol_rx_ops(dfs_rx_ops);
615 
616 	return QDF_STATUS_SUCCESS;
617 }
618 #else
619 static QDF_STATUS
620 wlan_lmac_if_umac_dfs_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
621 {
622 	return QDF_STATUS_SUCCESS;
623 }
624 #endif
625 
626 #ifdef FEATURE_WLAN_TDLS
627 static QDF_STATUS
628 wlan_lmac_if_umac_tdls_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
629 {
630 	rx_ops->tdls_rx_ops.tdls_ev_handler = tgt_tdls_event_handler;
631 
632 	return QDF_STATUS_SUCCESS;
633 }
634 #else
635 static QDF_STATUS
636 wlan_lmac_if_umac_tdls_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
637 {
638 	return QDF_STATUS_SUCCESS;
639 }
640 #endif
641 
642 #ifdef WLAN_SUPPORT_GREEN_AP
643 static QDF_STATUS
644 wlan_lmac_if_umac_green_ap_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
645 {
646 	rx_ops->green_ap_rx_ops.is_ps_enabled = wlan_green_ap_is_ps_enabled;
647 	rx_ops->green_ap_rx_ops.is_dbg_print_enabled =
648 					ucfg_green_ap_get_debug_prints;
649 	rx_ops->green_ap_rx_ops.ps_set = ucfg_green_ap_set_ps_config;
650 	rx_ops->green_ap_rx_ops.ps_get = ucfg_green_ap_get_ps_config;
651 	rx_ops->green_ap_rx_ops.suspend_handle = wlan_green_ap_suspend_handle;
652 
653 	return QDF_STATUS_SUCCESS;
654 }
655 #else
656 static QDF_STATUS
657 wlan_lmac_if_umac_green_ap_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
658 {
659 	return QDF_STATUS_SUCCESS;
660 }
661 #endif
662 
663 #ifdef QCA_WIFI_FTM
664 static QDF_STATUS
665 wlan_lmac_if_umac_ftm_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
666 {
667 	struct wlan_lmac_if_ftm_rx_ops *ftm_rx_ops;
668 
669 	ftm_rx_ops = &rx_ops->ftm_rx_ops;
670 
671 	ftm_rx_ops->ftm_ev_handler = wlan_ftm_process_utf_event;
672 
673 	return QDF_STATUS_SUCCESS;
674 }
675 #else
676 static QDF_STATUS
677 wlan_lmac_if_umac_ftm_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
678 {
679 	return QDF_STATUS_SUCCESS;
680 }
681 #endif
682 /**
683  * wlan_lmac_if_umac_rx_ops_register() - UMAC rx handler register
684  * @rx_ops: Pointer to rx_ops structure to be populated
685  *
686  * Register umac RX callabacks which will be called by DA/OL/WMA/WMI
687  *
688  * Return: QDF_STATUS_SUCCESS - in case of success
689  */
690 QDF_STATUS
691 wlan_lmac_if_umac_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
692 {
693 	/* Component specific public api's to be called to register
694 	 * respective callbacks
695 	 * Ex: rx_ops->fp = function;
696 	 */
697 	struct wlan_lmac_if_mgmt_txrx_rx_ops *mgmt_txrx_rx_ops;
698 
699 	if (!rx_ops) {
700 		qdf_print("lmac if rx ops pointer is NULL");
701 		return QDF_STATUS_E_INVAL;
702 	}
703 
704 	/* mgmt txrx rx ops */
705 	mgmt_txrx_rx_ops = &rx_ops->mgmt_txrx_rx_ops;
706 
707 	mgmt_txrx_rx_ops->mgmt_tx_completion_handler =
708 			tgt_mgmt_txrx_tx_completion_handler;
709 	mgmt_txrx_rx_ops->mgmt_rx_frame_handler =
710 			tgt_mgmt_txrx_rx_frame_handler;
711 	mgmt_txrx_rx_ops->mgmt_txrx_get_nbuf_from_desc_id =
712 			tgt_mgmt_txrx_get_nbuf_from_desc_id;
713 	mgmt_txrx_rx_ops->mgmt_txrx_get_peer_from_desc_id =
714 			tgt_mgmt_txrx_get_peer_from_desc_id;
715 	mgmt_txrx_rx_ops->mgmt_txrx_get_vdev_id_from_desc_id =
716 			tgt_mgmt_txrx_get_vdev_id_from_desc_id;
717 	mgmt_txrx_rx_ops->mgmt_txrx_get_free_desc_pool_count =
718 			tgt_mgmt_txrx_get_free_desc_pool_count;
719 
720 	/* scan rx ops */
721 	rx_ops->scan.scan_ev_handler = tgt_scan_event_handler;
722 	rx_ops->scan.scan_set_max_active_scans = tgt_scan_set_max_active_scans;
723 
724 	wlan_lmac_if_atf_rx_ops_register(rx_ops);
725 
726 	wlan_lmac_if_cp_stats_rx_ops_register(rx_ops);
727 
728 	wlan_target_if_dcs_rx_ops_register(rx_ops);
729 
730 	wlan_lmac_if_sa_api_rx_ops_register(rx_ops);
731 
732 	wlan_lmac_if_cfr_rx_ops_register(rx_ops);
733 
734 	wlan_lmac_if_crypto_rx_ops_register(rx_ops);
735 	/* wifi_pos rx ops */
736 	wlan_lmac_if_umac_rx_ops_register_wifi_pos(rx_ops);
737 
738 	/* tdls rx ops */
739 	wlan_lmac_if_umac_tdls_rx_ops_register(rx_ops);
740 
741 	wlan_lmac_if_umac_reg_rx_ops_register(rx_ops);
742 
743 	/* p2p rx ops */
744 	wlan_lmac_if_umac_rx_ops_register_p2p(rx_ops);
745 
746 	/* DFS rx_ops */
747 	wlan_lmac_if_umac_dfs_rx_ops_register(rx_ops);
748 
749 	wlan_lmac_if_umac_green_ap_rx_ops_register(rx_ops);
750 
751 	/* FTM rx_ops */
752 	wlan_lmac_if_umac_ftm_rx_ops_register(rx_ops);
753 
754 	/* FILS Discovery */
755 	wlan_lmac_if_fd_rx_ops_register(rx_ops);
756 
757 	/* MLME rx_ops */
758 	tgt_vdev_mgr_rx_ops_register(rx_ops);
759 
760 	return QDF_STATUS_SUCCESS;
761 }
762 
763 /**
764  * wlan_lmac_if_set_umac_txops_registration_cb() - tx registration
765  * callback assignment
766  * @dev_type: Dev type can be either Direct attach or Offload
767  * @handler: handler to be called for LMAC tx ops registration
768  *
769  * API to assign appropriate tx registration callback handler based on the
770  * device type(Offload or Direct attach)
771  *
772  * Return: QDF_STATUS_SUCCESS - in case of success
773  */
774 QDF_STATUS wlan_lmac_if_set_umac_txops_registration_cb(QDF_STATUS (*handler)
775 				(struct wlan_lmac_if_tx_ops *))
776 {
777 	wlan_lmac_if_umac_tx_ops_register = handler;
778 	return QDF_STATUS_SUCCESS;
779 }
780 qdf_export_symbol(wlan_lmac_if_set_umac_txops_registration_cb);
781 
782