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