1 /* 2 * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-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 #ifndef _WLAN_IPA_CORE_H_ 21 #define _WLAN_IPA_CORE_H_ 22 23 #ifdef IPA_OFFLOAD 24 25 #include "wlan_ipa_priv.h" 26 #include "wlan_ipa_public_struct.h" 27 28 /** 29 * wlan_ipa_is_enabled() - Is IPA enabled? 30 * @ipa_cfg: IPA config 31 * 32 * Return: true if IPA is enabled, false otherwise 33 */ 34 static inline bool wlan_ipa_is_enabled(struct wlan_ipa_config *ipa_cfg) 35 { 36 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_ENABLE_MASK); 37 } 38 39 /** 40 * wlan_ipa_uc_is_enabled() - Is IPA UC enabled? 41 * @ipa_cfg: IPA config 42 * 43 * Return: true if IPA UC is enabled, false otherwise 44 */ 45 static inline bool wlan_ipa_uc_is_enabled(struct wlan_ipa_config *ipa_cfg) 46 { 47 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_UC_ENABLE_MASK); 48 } 49 50 /** 51 * wlan_ipa_is_rt_debugging_enabled() - Is IPA RT debugging enabled? 52 * @ipa_cfg: IPA config 53 * 54 * Return: true if IPA RT debugging is enabled, false otherwise 55 */ 56 static inline 57 bool wlan_ipa_is_rt_debugging_enabled(struct wlan_ipa_config *ipa_cfg) 58 { 59 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, 60 WLAN_IPA_REAL_TIME_DEBUGGING); 61 } 62 63 /** 64 * wlan_ipa_setup - IPA initialize and setup 65 * @ipa_ctx: IPA priv obj 66 * @ipa_cfg: IPA config 67 * 68 * Return: QDF_STATUS 69 */ 70 QDF_STATUS wlan_ipa_setup(struct wlan_ipa_priv *ipa_ctx, 71 struct wlan_ipa_config *ipa_cfg); 72 73 /** 74 * wlan_ipa_get_obj_context - Get IPA OBJ context 75 * 76 * Return: IPA context 77 */ 78 struct wlan_ipa_priv *wlan_ipa_get_obj_context(void); 79 80 /** 81 * wlan_ipa_cleanup - IPA cleanup 82 * @ipa_ctx: IPA priv obj 83 * 84 * Return: QDF_STATUS 85 */ 86 QDF_STATUS wlan_ipa_cleanup(struct wlan_ipa_priv *ipa_ctx); 87 88 /** 89 * wlan_ipa_uc_enable_pipes() - Enable IPA uC pipes 90 * @ipa_ctx: IPA context 91 * 92 * Return: QDF_STATUS 93 */ 94 QDF_STATUS wlan_ipa_uc_enable_pipes(struct wlan_ipa_priv *ipa_ctx); 95 96 /** 97 * wlan_ipa_uc_disable_pipes() - Disable IPA uC pipes 98 * @ipa_ctx: IPA context 99 * @force_disable: If true, immediately disable IPA pipes. If false, wait for 100 * pending IPA WLAN TX completions 101 * 102 * Return: QDF_STATUS 103 */ 104 QDF_STATUS wlan_ipa_uc_disable_pipes(struct wlan_ipa_priv *ipa_ctx, 105 bool force_disable); 106 107 /** 108 * wlan_ipa_is_tx_pending() - Check if IPA TX Completions are pending 109 * @ipa_ctx: IPA context 110 * 111 * Return: bool 112 */ 113 bool wlan_ipa_is_tx_pending(struct wlan_ipa_priv *ipa_ctx); 114 115 /** 116 * wlan_ipa_set_perf_level() - Set IPA performance level 117 * @ipa_ctx: IPA context 118 * @tx_packets: Number of packets transmitted in the last sample period 119 * @rx_packets: Number of packets received in the last sample period 120 * 121 * Return: QDF STATUS 122 */ 123 QDF_STATUS wlan_ipa_set_perf_level(struct wlan_ipa_priv *ipa_ctx, 124 uint64_t tx_packets, uint64_t rx_packets); 125 126 /** 127 * wlan_ipa_init_perf_level() - Initialize IPA performance level 128 * @ipa_ctx: IPA context 129 * 130 * If IPA clock scaling is disabled, initialize perf level to maximum. 131 * Else set the lowest level to start with. 132 * 133 * Return: QDF STATUS 134 */ 135 QDF_STATUS wlan_ipa_init_perf_level(struct wlan_ipa_priv *ipa_ctx); 136 137 /** 138 * wlan_ipa_get_iface() - Get IPA interface 139 * @ipa_ctx: IPA context 140 * @mode: Interface device mode 141 * 142 * Return: IPA interface address 143 */ 144 struct wlan_ipa_iface_context 145 *wlan_ipa_get_iface(struct wlan_ipa_priv *ipa_ctx, uint8_t mode); 146 147 /** 148 * wlan_ipa_get_iface_by_mode_netdev() - Get IPA interface 149 * @ipa_ctx: IPA context 150 * @ndev: Interface netdev pointer 151 * @mode: Interface device mode 152 * 153 * Return: IPA interface address 154 */ 155 struct wlan_ipa_iface_context * 156 wlan_ipa_get_iface_by_mode_netdev(struct wlan_ipa_priv *ipa_ctx, 157 qdf_netdev_t ndev, uint8_t mode); 158 159 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) && \ 160 !defined(CONFIG_IPA_WDI_UNIFIED_API) 161 162 /** 163 * wlan_ipa_is_rm_enabled() - Is IPA RM enabled? 164 * @ipa_cfg: IPA config 165 * 166 * Return: true if IPA RM is enabled, false otherwise 167 */ 168 static inline bool wlan_ipa_is_rm_enabled(struct wlan_ipa_config *ipa_cfg) 169 { 170 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_RM_ENABLE_MASK); 171 } 172 173 /** 174 * wlan_ipa_is_clk_scaling_enabled() - Is IPA clock scaling enabled? 175 * @ipa_cfg: IPA config 176 * 177 * Return: true if IPA clock scaling is enabled, false otherwise 178 */ 179 static inline 180 bool wlan_ipa_is_clk_scaling_enabled(struct wlan_ipa_config *ipa_cfg) 181 { 182 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, 183 WLAN_IPA_CLK_SCALING_ENABLE_MASK | 184 WLAN_IPA_RM_ENABLE_MASK); 185 } 186 187 /** 188 * wlan_ipa_wdi_rm_request_resource() - IPA WDI request resource 189 * @ipa_ctx: IPA context 190 * @res_name: IPA RM resource name 191 * 192 * Return: 0 on success, negative errno on error 193 */ 194 static inline 195 int wlan_ipa_wdi_rm_request_resource(struct wlan_ipa_priv *ipa_ctx, 196 qdf_ipa_rm_resource_name_t res_name) 197 { 198 return qdf_ipa_rm_request_resource(res_name); 199 } 200 201 /** 202 * wlan_ipa_wdi_rm_release_resource() - IPA WDI release resource 203 * @ipa_ctx: IPA context 204 * @res_name: IPA RM resource name 205 * 206 * Return: 0 on success, negative errno on error 207 */ 208 static inline 209 int wlan_ipa_wdi_rm_release_resource(struct wlan_ipa_priv *ipa_ctx, 210 qdf_ipa_rm_resource_name_t res_name) 211 { 212 return qdf_ipa_rm_release_resource(res_name); 213 } 214 215 /** 216 * wlan_ipa_wdi_rm_request() - Request resource from IPA 217 * @ipa_ctx: IPA context 218 * 219 * Return: QDF_STATUS 220 */ 221 QDF_STATUS wlan_ipa_wdi_rm_request(struct wlan_ipa_priv *ipa_ctx); 222 223 /** 224 * wlan_ipa_wdi_rm_try_release() - Attempt to release IPA resource 225 * @ipa_ctx: IPA context 226 * 227 * Return: QDF_STATUS 228 */ 229 QDF_STATUS wlan_ipa_wdi_rm_try_release(struct wlan_ipa_priv *ipa_ctx); 230 231 /** 232 * wlan_ipa_wdi_setup_rm() - Setup IPA resource management 233 * @ipa_ctx: IPA context 234 * 235 * Return: QDF_STATUS 236 */ 237 QDF_STATUS wlan_ipa_wdi_setup_rm(struct wlan_ipa_priv *ipa_ctx); 238 239 /** 240 * wlan_ipa_wdi_destroy_rm() - Destroy IPA resources 241 * @ipa_ctx: IPA context 242 * 243 * Destroys all resources associated with the IPA resource manager 244 * 245 * Return: None 246 */ 247 void wlan_ipa_wdi_destroy_rm(struct wlan_ipa_priv *ipa_ctx); 248 249 static inline 250 int wlan_ipa_wdi_rm_notify_completion(qdf_ipa_rm_event_t event, 251 qdf_ipa_rm_resource_name_t res_name) 252 { 253 return qdf_ipa_rm_notify_completion(event, res_name); 254 } 255 256 static inline 257 int wlan_ipa_wdi_rm_inactivity_timer_destroy( 258 qdf_ipa_rm_resource_name_t res_name) 259 { 260 return qdf_ipa_rm_inactivity_timer_destroy(res_name); 261 } 262 263 bool wlan_ipa_is_rm_released(struct wlan_ipa_priv *ipa_ctx); 264 265 #else /* CONFIG_IPA_WDI_UNIFIED_API */ 266 267 /** 268 * wlan_ipa_is_rm_enabled() - Is IPA RM enabled? 269 * @ipa_cfg: IPA config 270 * 271 * IPA RM is deprecated and IPA PM is involved. WLAN driver 272 * has no control over IPA PM and thus we could regard IPA 273 * RM as always enabled for power efficiency. 274 * 275 * Return: true 276 */ 277 static inline bool wlan_ipa_is_rm_enabled(struct wlan_ipa_config *ipa_cfg) 278 { 279 return true; 280 } 281 282 /** 283 * wlan_ipa_is_clk_scaling_enabled() - Is IPA clock scaling enabled? 284 * @ipa_cfg: IPA config 285 * 286 * Return: true if IPA clock scaling is enabled, false otherwise 287 */ 288 static inline 289 bool wlan_ipa_is_clk_scaling_enabled(struct wlan_ipa_config *ipa_cfg) 290 { 291 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, 292 WLAN_IPA_CLK_SCALING_ENABLE_MASK); 293 } 294 295 static inline int wlan_ipa_wdi_rm_request_resource( 296 struct wlan_ipa_priv *ipa_ctx, 297 qdf_ipa_rm_resource_name_t res_name) 298 { 299 return 0; 300 } 301 302 static inline int wlan_ipa_wdi_rm_release_resource( 303 struct wlan_ipa_priv *ipa_ctx, 304 qdf_ipa_rm_resource_name_t res_name) 305 { 306 return 0; 307 } 308 309 static inline QDF_STATUS wlan_ipa_wdi_setup_rm(struct wlan_ipa_priv *ipa_ctx) 310 { 311 return 0; 312 } 313 314 static inline int wlan_ipa_wdi_destroy_rm(struct wlan_ipa_priv *ipa_ctx) 315 { 316 return 0; 317 } 318 319 static inline QDF_STATUS wlan_ipa_wdi_rm_request(struct wlan_ipa_priv *ipa_ctx) 320 { 321 return QDF_STATUS_SUCCESS; 322 } 323 324 static inline QDF_STATUS wlan_ipa_wdi_rm_try_release(struct wlan_ipa_priv 325 *ipa_ctx) 326 { 327 return QDF_STATUS_SUCCESS; 328 } 329 330 static inline 331 int wlan_ipa_wdi_rm_notify_completion(qdf_ipa_rm_event_t event, 332 qdf_ipa_rm_resource_name_t res_name) 333 { 334 return 0; 335 } 336 337 static inline 338 int wlan_ipa_wdi_rm_inactivity_timer_destroy( 339 qdf_ipa_rm_resource_name_t res_name) 340 { 341 return 0; 342 } 343 344 static inline 345 bool wlan_ipa_is_rm_released(struct wlan_ipa_priv *ipa_ctx) 346 { 347 return true; 348 } 349 350 #endif /* CONFIG_IPA_WDI_UNIFIED_API */ 351 352 #ifdef FEATURE_METERING 353 354 #ifndef WDI3_STATS_UPDATE 355 /** 356 * wlan_ipa_uc_op_metering() - IPA uC operation for stats and quota limit 357 * @ipa_ctx: IPA context 358 * @op_msg: operation message received from firmware 359 * 360 * Return: QDF_STATUS enumeration 361 */ 362 QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx, 363 struct op_msg_type *op_msg); 364 #else 365 static inline 366 QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx, 367 struct op_msg_type *op_msg) 368 { 369 return QDF_STATUS_SUCCESS; 370 } 371 #endif 372 373 /** 374 * wlan_ipa_wdi_meter_notifier_cb() - SSR wrapper for 375 * __wlan_ipa_wdi_meter_notifier_cb 376 * @priv: pointer to private data registered with IPA (we register a 377 * pointer to the global IPA context) 378 * @evt: the IPA event which triggered the callback 379 * @data: data associated with the event 380 * 381 * Return: None 382 */ 383 void wlan_ipa_wdi_meter_notifier_cb(qdf_ipa_wdi_meter_evt_type_t evt, 384 void *data); 385 386 /** 387 * wlan_ipa_init_metering() - IPA metering stats completion event reset 388 * @ipa_ctx: IPA context 389 * 390 * Return: QDF_STATUS enumeration 391 */ 392 void wlan_ipa_init_metering(struct wlan_ipa_priv *ipa_ctx); 393 394 #ifdef WDI3_STATS_UPDATE 395 /** 396 * wlan_ipa_update_tx_stats() - send embedded tx traffic in bytes to IPA 397 * @ipa_ctx: IPA context 398 * @sta_tx: tx in bytes on sta interface 399 * @sap_tx: tx in bytes on sap interface 400 * 401 * Return: void 402 */ 403 void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx, uint64_t sta_tx, 404 uint64_t sap_tx); 405 #else 406 static inline void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx, 407 uint64_t sta_tx, uint64_t sap_tx) 408 { 409 } 410 #endif /* WDI3_STATS_UPDATE */ 411 412 #else 413 414 static inline 415 QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx, 416 struct op_msg_type *op_msg) 417 { 418 return QDF_STATUS_SUCCESS; 419 } 420 421 static inline void wlan_ipa_wdi_meter_notifier_cb(void) 422 { 423 } 424 425 static inline void wlan_ipa_init_metering(struct wlan_ipa_priv *ipa_ctx) 426 { 427 } 428 429 static inline void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx, 430 uint64_t sta_tx, uint64_t sap_tx) 431 { 432 } 433 #endif /* FEATURE_METERING */ 434 435 /** 436 * wlan_ipa_uc_stat() - Print IPA uC stats 437 * @ipa_ctx: IPA context 438 * 439 * Return: None 440 */ 441 void wlan_ipa_uc_stat(struct wlan_ipa_priv *ipa_ctx); 442 443 /** 444 * wlan_ipa_uc_info() - Print IPA uC resource and session information 445 * @ipa_ctx: IPA context 446 * 447 * Return: None 448 */ 449 void wlan_ipa_uc_info(struct wlan_ipa_priv *ipa_ctx); 450 451 /** 452 * wlan_ipa_print_fw_wdi_stats() - Print FW IPA WDI stats 453 * @ipa_ctx: IPA context 454 * 455 * Return: None 456 */ 457 void wlan_ipa_print_fw_wdi_stats(struct wlan_ipa_priv *ipa_ctx, 458 struct ipa_uc_fw_stats *uc_fw_stat); 459 460 /** 461 * wlan_ipa_uc_stat_request() - Get IPA stats from IPA 462 * @ipa_ctx: IPA context 463 * @reason: STAT REQ Reason 464 * 465 * Return: None 466 */ 467 void wlan_ipa_uc_stat_request(struct wlan_ipa_priv *ipa_ctx, uint8_t reason); 468 469 /** 470 * wlan_ipa_uc_stat_query() - Query the IPA stats 471 * @ipa_ctx: IPA context 472 * @ipa_tx_diff: tx packet count diff from previous tx packet count 473 * @ipa_rx_diff: rx packet count diff from previous rx packet count 474 * 475 * Return: None 476 */ 477 void wlan_ipa_uc_stat_query(struct wlan_ipa_priv *ipa_ctx, 478 uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff); 479 480 /** 481 * wlan_ipa_dump_info() - dump IPA IPA struct 482 * @ipa_ctx: IPA context 483 * 484 * Dump entire struct ipa_ctx 485 * 486 * Return: none 487 */ 488 void wlan_ipa_dump_info(struct wlan_ipa_priv *ipa_ctx); 489 490 /** 491 * wlan_ipa_uc_rt_debug_host_dump - dump rt debug buffer 492 * @ipa_ctx: IPA context 493 * 494 * If rt debug enabled, dump debug buffer contents based on requirement 495 * 496 * Return: none 497 */ 498 void wlan_ipa_uc_rt_debug_host_dump(struct wlan_ipa_priv *ipa_ctx); 499 500 /** 501 * wlan_ipa_uc_rt_debug_destructor() - called by data packet free 502 * @nbuff: packet pinter 503 * 504 * when free data packet, will be invoked by wlan client and will increase 505 * free counter 506 * 507 * Return: none 508 */ 509 void wlan_ipa_uc_rt_debug_destructor(qdf_nbuf_t nbuff); 510 511 /** 512 * wlan_ipa_uc_rt_debug_deinit() - remove resources to handle rt debugging 513 * @ipa_ctx: IPA context 514 * 515 * free all rt debugging resources 516 * 517 * Return: none 518 */ 519 void wlan_ipa_uc_rt_debug_deinit(struct wlan_ipa_priv *ipa_ctx); 520 521 /** 522 * wlan_ipa_uc_rt_debug_init() - initialize resources to handle rt debugging 523 * @ipa_ctx: IPA context 524 * 525 * alloc and initialize all rt debugging resources 526 * 527 * Return: none 528 */ 529 void wlan_ipa_uc_rt_debug_init(struct wlan_ipa_priv *ipa_ctx); 530 531 /** 532 * wlan_ipa_reg_sap_xmit_cb() - Register upper layer SAP cb to transmit 533 * @ipa_ctx: IPA context 534 * @cb: callback 535 * 536 * Return: None 537 */ 538 static inline 539 void wlan_ipa_reg_sap_xmit_cb(struct wlan_ipa_priv *ipa_ctx, 540 wlan_ipa_softap_xmit cb) 541 { 542 ipa_ctx->softap_xmit = cb; 543 } 544 545 /** 546 * wlan_ipa_reg_is_driver_unloading_cb() - Register cb to check if driver 547 * is unloading 548 * @ipa_ctx: IPA context 549 * @cb: callback 550 * 551 * Return: None 552 */ 553 static inline 554 void wlan_ipa_reg_is_driver_unloading_cb(struct wlan_ipa_priv *ipa_ctx, 555 wlan_ipa_driver_unloading cb) 556 { 557 ipa_ctx->driver_is_unloading = cb; 558 } 559 560 /** 561 * wlan_ipa_reg_send_to_nw_cb() - Register cb to send IPA Rx packet to network 562 * @ipa_ctx: IPA context 563 * @cb: callback 564 * 565 * Return: None 566 */ 567 static inline 568 void wlan_ipa_reg_send_to_nw_cb(struct wlan_ipa_priv *ipa_ctx, 569 wlan_ipa_send_to_nw cb) 570 { 571 ipa_ctx->send_to_nw = cb; 572 } 573 574 #ifdef QCA_CONFIG_RPS 575 /** 576 * wlan_ipa_reg_rps_enable_cb() - Register callback to enable RPS 577 * @ipa_ctx: IPA context 578 * @cb: callback 579 * 580 * Return: None 581 */ 582 static inline 583 void wlan_ipa_reg_rps_enable_cb(struct wlan_ipa_priv *ipa_ctx, 584 wlan_ipa_rps_enable cb) 585 { 586 ipa_ctx->rps_enable = cb; 587 } 588 589 /** 590 * ipa_set_rps_enable(): Enable/disable RPS for all interfaces of specific mode 591 * @ipa_ctx: IPA context 592 * @mode: mode of interface for which RPS needs to be enabled 593 * @enable: Set true to enable RPS 594 * 595 * Return: None 596 */ 597 void ipa_set_rps(struct wlan_ipa_priv *ipa_ctx, enum QDF_OPMODE mode, 598 bool enable); 599 600 /** 601 * ipa_set_rps_per_vdev(): Enable/disable RPS for a specific vdev 602 * @ipa_ctx: IPA context 603 * @vdev_id: vdev id for which RPS needs to be enabled 604 * @enable: Set true to enable RPS 605 * 606 * Return: None 607 */ 608 static inline 609 void ipa_set_rps_per_vdev(struct wlan_ipa_priv *ipa_ctx, uint8_t vdev_id, 610 bool enable) 611 { 612 if (ipa_ctx->rps_enable) 613 ipa_ctx->rps_enable(vdev_id, enable); 614 } 615 616 /** 617 * wlan_ipa_handle_multiple_sap_evt() - Handle multiple SAP connect/disconnect 618 * @ipa_ctx: IPA global context 619 * @type: IPA event type. 620 * 621 * This function is used to disable pipes when multiple SAP are connected and 622 * enable pipes back when only one SAP is connected. 623 * 624 * Return: None 625 */ 626 void wlan_ipa_handle_multiple_sap_evt(struct wlan_ipa_priv *ipa_ctx, 627 qdf_ipa_wlan_event type); 628 629 #else 630 static inline 631 void ipa_set_rps(struct wlan_ipa_priv *ipa_ctx, enum QDF_OPMODE mode, 632 bool enable) 633 { 634 } 635 636 static inline 637 void ipa_set_rps_per_vdev(struct wlan_ipa_priv *ipa_ctx, uint8_t vdev_id, 638 bool enable) 639 { 640 } 641 642 static inline 643 void wlan_ipa_handle_multiple_sap_evt(struct wlan_ipa_priv *ipa_ctx, 644 qdf_ipa_wlan_event type) 645 { 646 } 647 648 #endif 649 650 /** 651 * wlan_ipa_set_mcc_mode() - Set MCC mode 652 * @ipa_ctx: IPA context 653 * @mcc_mode: 1=MCC/0=SCC 654 * 655 * Return: void 656 */ 657 void wlan_ipa_set_mcc_mode(struct wlan_ipa_priv *ipa_ctx, bool mcc_mode); 658 659 /** 660 * wlan_ipa_set_dfs_cac_tx() - Set DFS cac tx block 661 * @ipa_ctx: IPA context 662 * @tx_block: dfs cac tx block 663 * 664 * Return: void 665 */ 666 static inline 667 void wlan_ipa_set_dfs_cac_tx(struct wlan_ipa_priv *ipa_ctx, bool tx_block) 668 { 669 ipa_ctx->dfs_cac_block_tx = tx_block; 670 } 671 672 /** 673 * wlan_ipa_set_ap_ibss_fwd() - Set AP intra bss forward 674 * @ipa_ctx: IPA context 675 * @session_id: vdev id 676 * @intra_bss: 1 to disable ap intra bss forward and 0 to enable ap intra bss 677 * forward 678 * 679 * Return: void 680 */ 681 static inline 682 void wlan_ipa_set_ap_ibss_fwd(struct wlan_ipa_priv *ipa_ctx, uint8_t session_id, 683 bool intra_bss) 684 { 685 if (session_id >= WLAN_IPA_MAX_SESSION) 686 return; 687 688 ipa_ctx->disable_intrabss_fwd[session_id] = intra_bss; 689 } 690 691 /** 692 * wlan_ipa_uc_ol_init() - Initialize IPA uC offload 693 * @ipa_ctx: IPA context 694 * @osdev: Parent device instance 695 * 696 * This function is called to update IPA pipe configuration with resources 697 * allocated by wlan driver (cds_pre_enable) before enabling it in FW 698 * 699 * Return: QDF_STATUS 700 */ 701 QDF_STATUS wlan_ipa_uc_ol_init(struct wlan_ipa_priv *ipa_ctx, 702 qdf_device_t osdev); 703 704 /** 705 * wlan_ipa_uc_ol_deinit() - Disconnect IPA TX and RX pipes 706 * @ipa_ctx: IPA context 707 * 708 * Return: QDF_STATUS 709 */ 710 QDF_STATUS wlan_ipa_uc_ol_deinit(struct wlan_ipa_priv *ipa_ctx); 711 712 /** 713 * wlan_ipa_flush() - flush IPA exception path SKB's 714 * @ipa_ctx: IPA context 715 * 716 * Return: None 717 */ 718 void wlan_ipa_flush(struct wlan_ipa_priv *ipa_ctx); 719 720 /** 721 * wlan_ipa_suspend() - Suspend IPA 722 * @ipa_ctx: IPA context 723 * 724 * Return: QDF STATUS 725 */ 726 QDF_STATUS wlan_ipa_suspend(struct wlan_ipa_priv *ipa_ctx); 727 728 /** 729 * wlan_ipa_resume() - Resume IPA 730 * @ipa_ctx: IPA context 731 * 732 * Return: QDF STATUS 733 */ 734 QDF_STATUS wlan_ipa_resume(struct wlan_ipa_priv *ipa_ctx); 735 736 #if !defined(QCA_LL_TX_FLOW_CONTROL_V2) && !defined(QCA_IPA_LL_TX_FLOW_CONTROL) 737 /** 738 * wlan_ipa_send_mcc_scc_msg() - Send IPA WLAN_SWITCH_TO_MCC/SCC message 739 * @ipa_ctx: IPA context 740 * @mcc_mode: 0=MCC/1=SCC 741 * 742 * Return: QDF STATUS 743 */ 744 QDF_STATUS wlan_ipa_send_mcc_scc_msg(struct wlan_ipa_priv *ipa_ctx, 745 bool mcc_mode); 746 #else 747 static inline 748 QDF_STATUS wlan_ipa_send_mcc_scc_msg(struct wlan_ipa_priv *ipa_ctx, 749 bool mcc_mode) 750 { 751 return QDF_STATUS_SUCCESS; 752 } 753 754 static inline void wlan_ipa_mcc_work_handler(void *data) 755 { 756 } 757 #endif 758 759 /** 760 * wlan_ipa_wlan_evt() - IPA event handler 761 * @net_dev: Interface net device 762 * @device_mode: Net interface device mode 763 * @session_id: session id for the event 764 * @type: event enum of type ipa_wlan_event 765 * @mac_address: MAC address associated with the event 766 * @is_2g_iface: true if interface is operating on 2G band, otherwise false 767 * 768 * Return: QDF_STATUS 769 */ 770 QDF_STATUS wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, 771 uint8_t session_id, 772 enum wlan_ipa_wlan_event ipa_event_type, 773 const uint8_t *mac_addr, bool is_2g_iface, 774 struct wlan_ipa_priv *ipa_obj); 775 776 /** 777 * wlan_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC 778 * @map: Map / unmap operation 779 * @num_buf: Number of buffers in array 780 * @buf_arr: Buffer array of DMA mem mapping info 781 * 782 * This API maps/unmaps WLAN-IPA buffers if SMMU S1 translation 783 * is enabled. 784 * 785 * Return: Status of map operation 786 */ 787 int wlan_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr); 788 789 /** 790 * wlan_ipa_is_fw_wdi_activated() - Is FW WDI actived? 791 * @ipa_ctx: IPA contex 792 * 793 * Return: true if FW WDI actived, false otherwise 794 */ 795 bool wlan_ipa_is_fw_wdi_activated(struct wlan_ipa_priv *ipa_ctx); 796 797 /** 798 * wlan_ipa_uc_cleanup_sta - disconnect and cleanup sta iface 799 * @ipa_ctx: IPA context 800 * @net_dev: Interface net device 801 * 802 * Send disconnect sta event to IPA driver and cleanup IPA iface 803 * if not yet done 804 * 805 * Return: void 806 */ 807 void wlan_ipa_uc_cleanup_sta(struct wlan_ipa_priv *ipa_ctx, 808 qdf_netdev_t net_dev); 809 810 /** 811 * wlan_ipa_uc_disconnect_ap() - send ap disconnect event 812 * @ipa_ctx: IPA context 813 * @net_dev: Interface net device 814 * 815 * Send disconnect ap event to IPA driver 816 * 817 * Return: QDF_STATUS 818 */ 819 QDF_STATUS wlan_ipa_uc_disconnect_ap(struct wlan_ipa_priv *ipa_ctx, 820 qdf_netdev_t net_dev); 821 822 /** 823 * wlan_ipa_cleanup_dev_iface() - Clean up net dev IPA interface 824 * @ipa_ctx: IPA context 825 * @net_dev: Interface net device 826 * 827 * Return: None 828 */ 829 void wlan_ipa_cleanup_dev_iface(struct wlan_ipa_priv *ipa_ctx, 830 qdf_netdev_t net_dev); 831 832 /** 833 * wlan_ipa_uc_ssr_cleanup() - handle IPA UC clean up during SSR 834 * @ipa_ctx: IPA context 835 * 836 * Return: None 837 */ 838 void wlan_ipa_uc_ssr_cleanup(struct wlan_ipa_priv *ipa_ctx); 839 840 /** 841 * wlan_ipa_fw_rejuvenate_send_msg() - send fw rejuvenate message to IPA driver 842 * @ipa_ctx: IPA context 843 * 844 * Return: void 845 */ 846 void wlan_ipa_fw_rejuvenate_send_msg(struct wlan_ipa_priv *ipa_ctx); 847 848 /** 849 * wlan_ipa_flush_pending_vdev_events() - flush pending vdev ipa events 850 * @ipa_ctx: IPA context 851 * vdev_id: vdev id 852 * 853 * This function is to flush vdev wlan ipa pending events 854 * 855 * Return: None 856 */ 857 void wlan_ipa_flush_pending_vdev_events(struct wlan_ipa_priv *ipa_ctx, 858 uint8_t vdev_id); 859 #endif /* IPA_OFFLOAD */ 860 #endif /* _WLAN_IPA_CORE_H_ */ 861