1 /* 2 * Copyright (c) 2016-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 /** 21 * @file cdp_txrx_ipa.h 22 * @brief Define the host data path IP Acceleraor API functions 23 */ 24 #ifndef _CDP_TXRX_IPA_H_ 25 #define _CDP_TXRX_IPA_H_ 26 27 #ifdef IPA_OFFLOAD 28 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \ 29 defined(CONFIG_IPA_WDI_UNIFIED_API) 30 #include <qdf_ipa_wdi3.h> 31 #else 32 #include <qdf_ipa.h> 33 #endif 34 #include <cdp_txrx_cmn.h> 35 #include "cdp_txrx_handle.h" 36 37 /** 38 * cdp_ipa_get_resource() - Get allocated WLAN resources for IPA data path 39 * @soc - data path soc handle 40 * @pdev_id - device instance id 41 * 42 * Get allocated WLAN resources for IPA data path 43 * 44 * return QDF_STATUS_SUCCESS 45 */ 46 static inline QDF_STATUS 47 cdp_ipa_get_resource(ol_txrx_soc_handle soc, uint8_t pdev_id) 48 { 49 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 50 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 51 "%s invalid instance", __func__); 52 return QDF_STATUS_E_FAILURE; 53 } 54 55 if (soc->ops->ipa_ops->ipa_get_resource) 56 return soc->ops->ipa_ops->ipa_get_resource(soc, pdev_id); 57 58 return QDF_STATUS_SUCCESS; 59 } 60 61 /** 62 * cdp_ipa_set_doorbell_paddr() - give IPA db paddr to FW 63 * @soc - data path soc handle 64 * @pdev_id - device instance id 65 * 66 * give IPA db paddr to FW 67 * 68 * return QDF_STATUS_SUCCESS 69 */ 70 static inline QDF_STATUS 71 cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc, uint8_t pdev_id) 72 { 73 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 74 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 75 "%s invalid instance", __func__); 76 return QDF_STATUS_E_FAILURE; 77 } 78 79 if (soc->ops->ipa_ops->ipa_set_doorbell_paddr) 80 return soc->ops->ipa_ops->ipa_set_doorbell_paddr(soc, pdev_id); 81 82 return QDF_STATUS_SUCCESS; 83 } 84 85 /** 86 * cdp_ipa_iounmap_doorbell_vaddr() - unmap IPA RX db vaddr 87 * @soc - data path soc handle 88 * @pdev_id - device instance id 89 * 90 * Unmap IPA RX db vaddr 91 * 92 * return QDF_STATUS_SUCCESS 93 */ 94 static inline QDF_STATUS 95 cdp_ipa_iounmap_doorbell_vaddr(ol_txrx_soc_handle soc, uint8_t pdev_id) 96 { 97 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 98 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 99 "%s invalid instance", __func__); 100 return QDF_STATUS_E_FAILURE; 101 } 102 103 if (soc->ops->ipa_ops->ipa_iounmap_doorbell_vaddr) 104 return soc->ops->ipa_ops->ipa_iounmap_doorbell_vaddr( 105 soc, pdev_id); 106 107 return QDF_STATUS_SUCCESS; 108 } 109 110 /** 111 * cdp_ipa_set_active() - activate/de-ctivate IPA offload path 112 * @soc - data path soc handle 113 * @pdev_id - device instance id 114 * @uc_active - activate or de-activate 115 * @is_tx - toggle tx or rx data path 116 * 117 * activate/de-ctivate IPA offload path 118 * 119 * return QDF_STATUS_SUCCESS 120 */ 121 static inline QDF_STATUS 122 cdp_ipa_set_active(ol_txrx_soc_handle soc, uint8_t pdev_id, bool uc_active, 123 bool is_tx) 124 { 125 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 126 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 127 "%s invalid instance", __func__); 128 return QDF_STATUS_E_FAILURE; 129 } 130 131 if (soc->ops->ipa_ops->ipa_set_active) 132 return soc->ops->ipa_ops->ipa_set_active(soc, pdev_id, 133 uc_active, is_tx); 134 135 return QDF_STATUS_SUCCESS; 136 } 137 138 /** 139 * cdp_ipa_op_response() - event handler from FW 140 * @soc - data path soc handle 141 * @pdev_id - device instance id 142 * @op_msg - event contents from firmware 143 * 144 * event handler from FW 145 * 146 * return QDF_STATUS_SUCCESS 147 */ 148 static inline QDF_STATUS 149 cdp_ipa_op_response(ol_txrx_soc_handle soc, uint8_t pdev_id, uint8_t *op_msg) 150 { 151 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 152 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 153 "%s invalid instance", __func__); 154 return QDF_STATUS_E_FAILURE; 155 } 156 157 if (soc->ops->ipa_ops->ipa_op_response) 158 return soc->ops->ipa_ops->ipa_op_response(soc, pdev_id, op_msg); 159 160 return QDF_STATUS_SUCCESS; 161 } 162 163 /** 164 * cdp_ipa_register_op_cb() - register event handler function pointer 165 * @soc - data path soc handle 166 * @pdev_id - device instance id 167 * @op_cb - event handler callback function pointer 168 * @usr_ctxt - user context to registered 169 * 170 * register event handler function pointer 171 * 172 * return QDF_STATUS_SUCCESS 173 */ 174 static inline QDF_STATUS 175 cdp_ipa_register_op_cb(ol_txrx_soc_handle soc, uint8_t pdev_id, 176 ipa_uc_op_cb_type op_cb, void *usr_ctxt) 177 { 178 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 179 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 180 "%s invalid instance", __func__); 181 return QDF_STATUS_E_FAILURE; 182 } 183 184 if (soc->ops->ipa_ops->ipa_register_op_cb) 185 return soc->ops->ipa_ops->ipa_register_op_cb(soc, pdev_id, 186 op_cb, usr_ctxt); 187 188 return QDF_STATUS_SUCCESS; 189 } 190 191 /** 192 * cdp_ipa_deregister_op_cb() - deregister event handler function pointer 193 * @soc - data path soc handle 194 * @pdev_id - device instance id 195 * 196 * Deregister event handler function pointer from pdev 197 * 198 * return QDF_STATUS_SUCCESS 199 */ 200 static inline 201 void cdp_ipa_deregister_op_cb(ol_txrx_soc_handle soc, uint8_t pdev_id) 202 { 203 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 204 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 205 "%s invalid instance", __func__); 206 return; 207 } 208 209 if (soc->ops->ipa_ops->ipa_deregister_op_cb) 210 soc->ops->ipa_ops->ipa_deregister_op_cb(soc, pdev_id); 211 } 212 213 /** 214 * cdp_ipa_get_stat() - get IPA data path stats from FW 215 * @soc - data path soc handle 216 * @pdev_id - device instance id 217 * 218 * get IPA data path stats from FW async 219 * 220 * return QDF_STATUS_SUCCESS 221 */ 222 static inline QDF_STATUS 223 cdp_ipa_get_stat(ol_txrx_soc_handle soc, uint8_t pdev_id) 224 { 225 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 226 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 227 "%s invalid instance", __func__); 228 return QDF_STATUS_E_FAILURE; 229 } 230 231 if (soc->ops->ipa_ops->ipa_get_stat) 232 return soc->ops->ipa_ops->ipa_get_stat(soc, pdev_id); 233 234 return QDF_STATUS_SUCCESS; 235 } 236 237 /** 238 * cdp_tx_send_ipa_data_frame() - send IPA data frame 239 * @soc - data path soc handle 240 * @vdev_id: vdev id 241 * @skb: skb 242 * 243 * Return: skb/ NULL is for success 244 */ 245 static inline qdf_nbuf_t cdp_ipa_tx_send_data_frame(ol_txrx_soc_handle soc, 246 uint8_t vdev_id, 247 qdf_nbuf_t skb) 248 { 249 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 250 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 251 "%s invalid instance", __func__); 252 return skb; 253 } 254 255 if (soc->ops->ipa_ops->ipa_tx_data_frame) 256 return soc->ops->ipa_ops->ipa_tx_data_frame(soc, vdev_id, skb); 257 258 return skb; 259 } 260 261 /** 262 * cdp_ipa_set_uc_tx_partition_base() - set tx packet partition base 263 * @soc - data path soc handle 264 * @cfg_pdev: physical device instance config 265 * @value: partition base value 266 * 267 * Return: QDF_STATUS 268 */ 269 static inline QDF_STATUS 270 cdp_ipa_set_uc_tx_partition_base(ol_txrx_soc_handle soc, 271 struct cdp_cfg *cfg_pdev, uint32_t value) 272 { 273 if (!soc || !soc->ops || !soc->ops->ipa_ops || !cfg_pdev) { 274 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 275 "%s invalid instance", __func__); 276 return QDF_STATUS_E_FAILURE; 277 } 278 279 if (soc->ops->ipa_ops->ipa_set_uc_tx_partition_base) 280 soc->ops->ipa_ops->ipa_set_uc_tx_partition_base(cfg_pdev, 281 value); 282 283 return QDF_STATUS_SUCCESS; 284 } 285 286 #ifdef FEATURE_METERING 287 /** 288 * cdp_ipa_uc_get_share_stats() - get Tx/Rx byte stats from FW 289 * @soc - data path soc handle 290 * @pdev_id: physical device instance number 291 * @value: reset stats 292 * 293 * Return: QDF_STATUS 294 */ 295 static inline QDF_STATUS 296 cdp_ipa_uc_get_share_stats(ol_txrx_soc_handle soc, uint8_t pdev_id, 297 uint8_t value) 298 { 299 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 300 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 301 "%s invalid instance", __func__); 302 return QDF_STATUS_E_FAILURE; 303 } 304 305 if (soc->ops->ipa_ops->ipa_uc_get_share_stats) 306 return soc->ops->ipa_ops->ipa_uc_get_share_stats(soc, pdev_id, 307 value); 308 309 return QDF_STATUS_SUCCESS; 310 } 311 312 /** 313 * cdp_ipa_uc_set_quota() - set quota limit to FW 314 * @soc - data path soc handle 315 * @pdev_id: physical device instance number 316 * @value: quota limit bytes 317 * 318 * Return: QDF_STATUS 319 */ 320 static inline QDF_STATUS 321 cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc, uint8_t pdev_id, uint64_t value) 322 { 323 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 324 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 325 "%s invalid instance", __func__); 326 return QDF_STATUS_E_FAILURE; 327 } 328 329 if (soc->ops->ipa_ops->ipa_uc_set_quota) 330 return soc->ops->ipa_ops->ipa_uc_set_quota(soc, pdev_id, value); 331 332 return QDF_STATUS_SUCCESS; 333 } 334 #endif 335 336 /** 337 * cdp_ipa_enable_autonomy() - Enable autonomy RX data path 338 * @soc: data path soc handle 339 * @pdev_id: physical device instance number 340 * 341 * IPA Data path is enabled and resumed. 342 * All autonomy data path elements are ready to deliver packet 343 * All RX packet should routed to IPA_REO ring, then IPA can receive packet 344 * from WLAN 345 * 346 * Return: QDF_STATUS 347 */ 348 static inline QDF_STATUS 349 cdp_ipa_enable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id) 350 { 351 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 352 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 353 "%s invalid instance", __func__); 354 return QDF_STATUS_E_FAILURE; 355 } 356 357 if (soc->ops->ipa_ops->ipa_enable_autonomy) 358 return soc->ops->ipa_ops->ipa_enable_autonomy(soc, pdev_id); 359 360 return QDF_STATUS_SUCCESS; 361 } 362 363 /** 364 * cdp_ipa_disable_autonomy() - Disable autonomy RX data path 365 * @soc: data path soc handle 366 * @pdev_id: physical device instance number 367 * 368 * IPA Data path is enabled and resumed. 369 * All autonomy datapath elements are ready to deliver packet 370 * All RX packet should routed to IPA_REO ring, then IPA can receive packet 371 * from WLAN 372 * 373 * Return: QDF_STATUS 374 */ 375 static inline QDF_STATUS 376 cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id) 377 { 378 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 379 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 380 "%s invalid instance", __func__); 381 return QDF_STATUS_E_FAILURE; 382 } 383 if (soc->ops->ipa_ops->ipa_disable_autonomy) 384 return soc->ops->ipa_ops->ipa_disable_autonomy(soc, pdev_id); 385 386 return QDF_STATUS_SUCCESS; 387 } 388 389 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \ 390 defined(CONFIG_IPA_WDI_UNIFIED_API) 391 392 /** 393 * cdp_ipa_setup() - Setup and connect IPA pipes 394 * @soc: data path soc handle 395 * @pdev_id: handle to the device instance number 396 * @ipa_i2w_cb: IPA to WLAN callback 397 * @ipa_w2i_cb: WLAN to IPA callback 398 * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback 399 * @ipa_desc_size: IPA descriptor size 400 * @ipa_priv: handle to the HTT instance 401 * @is_rm_enabled: Is IPA RM enabled or not 402 * @tx_pipe_handle: pointer to Tx pipe handle 403 * @rx_pipe_handle: pointer to Rx pipe handle 404 * @is_smmu_enabled: Is SMMU enabled or not 405 * @sys_in: parameters to setup sys pipe in mcc mode 406 * @over_gsi: Is IPA using GSI 407 * @hdl: IPA handle 408 * @id: IPA instance id 409 * @ipa_ast_notify_cb: IPA to WLAN callback for ast create 410 * 411 * Return: QDF_STATUS 412 */ 413 static inline QDF_STATUS 414 cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb, 415 void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb, 416 uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled, 417 uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle, 418 bool is_smmu_enabled, qdf_ipa_sys_connect_params_t *sys_in, 419 bool over_gsi, qdf_ipa_wdi_hdl_t hdl, qdf_ipa_wdi_hdl_t id, 420 void *ipa_ast_notify_cb) 421 { 422 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 423 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 424 "%s invalid instance", __func__); 425 return QDF_STATUS_E_FAILURE; 426 } 427 428 if (soc->ops->ipa_ops->ipa_setup) 429 return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb, 430 ipa_w2i_cb, 431 ipa_wdi_meter_notifier_cb, 432 ipa_desc_size, ipa_priv, 433 is_rm_enabled, 434 tx_pipe_handle, 435 rx_pipe_handle, 436 is_smmu_enabled, 437 sys_in, over_gsi, hdl, id, 438 ipa_ast_notify_cb); 439 440 return QDF_STATUS_SUCCESS; 441 } 442 #else /* CONFIG_IPA_WDI_UNIFIED_API */ 443 /** 444 * cdp_ipa_setup() - Setup and connect IPA pipes 445 * @soc: data path soc handle 446 * @pdev_id: handle to the device instance number 447 * @ipa_i2w_cb: IPA to WLAN callback 448 * @ipa_w2i_cb: WLAN to IPA callback 449 * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback 450 * @ipa_desc_size: IPA descriptor size 451 * @ipa_priv: handle to the HTT instance 452 * @is_rm_enabled: Is IPA RM enabled or not 453 * @tx_pipe_handle: pointer to Tx pipe handle 454 * @rx_pipe_handle: pointer to Rx pipe handle 455 * 456 * Return: QDF_STATUS 457 */ 458 static inline QDF_STATUS 459 cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb, 460 void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb, 461 uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled, 462 uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle) 463 { 464 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 465 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 466 "%s invalid instance", __func__); 467 return QDF_STATUS_E_FAILURE; 468 } 469 470 if (soc->ops->ipa_ops->ipa_setup) 471 return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb, 472 ipa_w2i_cb, 473 ipa_wdi_meter_notifier_cb, 474 ipa_desc_size, ipa_priv, 475 is_rm_enabled, 476 tx_pipe_handle, 477 rx_pipe_handle); 478 479 return QDF_STATUS_SUCCESS; 480 } 481 #endif /* CONFIG_IPA_WDI_UNIFIED_API */ 482 483 /** 484 * cdp_ipa_cleanup() - Disconnect IPA pipes 485 * @soc: data path soc handle 486 * @pdev_id: handle to the device instance number 487 * @tx_pipe_handle: Tx pipe handle 488 * @rx_pipe_handle: Rx pipe handle 489 * @hdl: IPA handle 490 * 491 * Return: QDF_STATUS 492 */ 493 static inline QDF_STATUS 494 cdp_ipa_cleanup(ol_txrx_soc_handle soc, uint8_t pdev_id, 495 uint32_t tx_pipe_handle, uint32_t rx_pipe_handle, 496 qdf_ipa_wdi_hdl_t hdl) 497 { 498 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 499 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 500 "%s invalid instance", __func__); 501 return QDF_STATUS_E_FAILURE; 502 } 503 504 if (soc->ops->ipa_ops->ipa_cleanup) 505 return soc->ops->ipa_ops->ipa_cleanup(soc, pdev_id, 506 tx_pipe_handle, 507 rx_pipe_handle, hdl); 508 509 return QDF_STATUS_SUCCESS; 510 } 511 512 /** 513 * cdp_ipa_setup_iface() - Setup IPA header and register interface 514 * @soc: data path soc handle 515 * @ifname: Interface name 516 * @mac_addr: Interface MAC address 517 * @prod_client: IPA prod client type 518 * @cons_client: IPA cons client type 519 * @session_id: Session ID 520 * @is_ipv6_enabled: Is IPV6 enabled or not 521 * @hdl: IPA handle 522 * 523 * Return: QDF_STATUS 524 */ 525 static inline QDF_STATUS 526 cdp_ipa_setup_iface(ol_txrx_soc_handle soc, char *ifname, uint8_t *mac_addr, 527 qdf_ipa_client_type_t prod_client, 528 qdf_ipa_client_type_t cons_client, 529 uint8_t session_id, bool is_ipv6_enabled, 530 qdf_ipa_wdi_hdl_t hdl) 531 { 532 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 533 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 534 "%s invalid instance", __func__); 535 return QDF_STATUS_E_FAILURE; 536 } 537 538 if (soc->ops->ipa_ops->ipa_setup_iface) 539 return soc->ops->ipa_ops->ipa_setup_iface(ifname, mac_addr, 540 prod_client, 541 cons_client, 542 session_id, 543 is_ipv6_enabled, 544 hdl); 545 546 return QDF_STATUS_SUCCESS; 547 } 548 549 /** 550 * cdp_ipa_cleanup_iface() - Cleanup IPA header and deregister interface 551 * @soc: data path soc handle 552 * @ifname: Interface name 553 * @is_ipv6_enabled: Is IPV6 enabled or not 554 * @hdl: IPA handle 555 * 556 * Return: QDF_STATUS 557 */ 558 static inline QDF_STATUS 559 cdp_ipa_cleanup_iface(ol_txrx_soc_handle soc, char *ifname, 560 bool is_ipv6_enabled, qdf_ipa_wdi_hdl_t hdl) 561 { 562 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 563 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 564 "%s invalid instance", __func__); 565 return QDF_STATUS_E_FAILURE; 566 } 567 568 if (soc->ops->ipa_ops->ipa_cleanup_iface) 569 return soc->ops->ipa_ops->ipa_cleanup_iface(ifname, 570 is_ipv6_enabled, 571 hdl); 572 573 return QDF_STATUS_SUCCESS; 574 } 575 576 /** 577 * cdp_ipa_uc_enable_pipes() - Enable and resume traffic on Tx/Rx pipes 578 * @soc - data path soc handle 579 * @pdev_id - device instance id 580 * @hdl: IPA handle 581 * 582 * Return: QDF_STATUS 583 */ 584 static inline QDF_STATUS 585 cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id, 586 qdf_ipa_wdi_hdl_t hdl) 587 { 588 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 589 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 590 "%s invalid instance", __func__); 591 return QDF_STATUS_E_FAILURE; 592 } 593 594 if (soc->ops->ipa_ops->ipa_enable_pipes) 595 return soc->ops->ipa_ops->ipa_enable_pipes(soc, pdev_id, hdl); 596 597 return QDF_STATUS_SUCCESS; 598 } 599 600 /** 601 * cdp_ipa_uc_disable_pipes() - Suspend traffic and disable Tx/Rx pipes 602 * @soc: data path soc handle 603 * @pdev_id - device instance id 604 * @hdl: IPA handle 605 * 606 * Return: QDF_STATUS 607 */ 608 static inline QDF_STATUS 609 cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id, 610 qdf_ipa_wdi_hdl_t hdl) 611 { 612 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 613 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 614 "%s invalid instance", __func__); 615 return QDF_STATUS_E_FAILURE; 616 } 617 618 if (soc->ops->ipa_ops->ipa_disable_pipes) 619 return soc->ops->ipa_ops->ipa_disable_pipes(soc, pdev_id, hdl); 620 621 return QDF_STATUS_SUCCESS; 622 } 623 624 /** 625 * cdp_ipa_set_perf_level() - Set IPA clock bandwidth based on data rates 626 * @soc: data path soc handle 627 * @client: WLAN Client ID 628 * @max_supported_bw_mbps: Maximum bandwidth needed (in Mbps) 629 * @hdl: IPA handle 630 * 631 * Return: 0 on success, negative errno on error 632 */ 633 static inline QDF_STATUS 634 cdp_ipa_set_perf_level(ol_txrx_soc_handle soc, int client, 635 uint32_t max_supported_bw_mbps, qdf_ipa_wdi_hdl_t hdl) 636 { 637 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 638 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 639 "%s invalid instance", __func__); 640 return QDF_STATUS_E_FAILURE; 641 } 642 643 if (soc->ops->ipa_ops->ipa_set_perf_level) 644 return soc->ops->ipa_ops->ipa_set_perf_level(client, 645 max_supported_bw_mbps, hdl); 646 647 return QDF_STATUS_SUCCESS; 648 } 649 650 /** 651 * cdp_ipa_rx_intrabss_fwd() - Perform intra-bss fwd for IPA RX path 652 * 653 * @soc: data path soc handle 654 * @vdev_id: vdev id 655 * @nbuf: pointer to skb of ethernet packet received from IPA RX path 656 * @fwd_success: pointer to indicate if skb succeeded in intra-bss TX 657 * 658 * This function performs intra-bss forwarding for WDI 3.0 IPA RX path. 659 * 660 * Return: true if packet is intra-bss fwd-ed and no need to pass to 661 * network stack. false if packet needs to be passed to network stack. 662 */ 663 static inline bool 664 cdp_ipa_rx_intrabss_fwd(ol_txrx_soc_handle soc, uint8_t vdev_id, 665 qdf_nbuf_t nbuf, bool *fwd_success) 666 { 667 if (!soc || !soc->ops || !soc->ops->ipa_ops || !fwd_success) { 668 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 669 "%s invalid instance", __func__); 670 return QDF_STATUS_E_FAILURE; 671 } 672 673 if (soc->ops->ipa_ops->ipa_rx_intrabss_fwd) 674 return soc->ops->ipa_ops->ipa_rx_intrabss_fwd(soc, vdev_id, 675 nbuf, 676 fwd_success); 677 678 /* Fall back to pass up to stack */ 679 return false; 680 } 681 682 /** 683 * cdp_ipa_tx_buf_smmu_mapping() - Create SMMU mappings for Tx 684 * buffers allocated to IPA 685 * @soc: data path soc handle 686 * @pdev_id: device instance id 687 * @line: line number 688 * @func: function name 689 * 690 * Create SMMU mappings for Tx buffers allocated to IPA 691 * 692 * return QDF_STATUS_SUCCESS 693 */ 694 static inline QDF_STATUS 695 cdp_ipa_tx_buf_smmu_mapping(ol_txrx_soc_handle soc, uint8_t pdev_id, 696 const char *func, uint32_t line) 697 { 698 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 699 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 700 "%s invalid instance", __func__); 701 return QDF_STATUS_E_FAILURE; 702 } 703 704 if (soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping) 705 return soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping(soc, pdev_id, 706 func, 707 line); 708 709 return QDF_STATUS_SUCCESS; 710 } 711 712 /** 713 * cdp_ipa_tx_buf_smmu_unmapping() - Release SMMU mappings for Tx 714 * buffers allocated to IPA 715 * @soc: data path soc handle 716 * @pdev_id: device instance id 717 * @line: line number 718 * @func: function name 719 * 720 * Release SMMU mappings for Tx buffers allocated to IPA 721 * 722 * return QDF_STATUS_SUCCESS 723 */ 724 static inline QDF_STATUS 725 cdp_ipa_tx_buf_smmu_unmapping(ol_txrx_soc_handle soc, uint8_t pdev_id, 726 const char *func, uint32_t line) 727 { 728 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 729 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 730 "%s invalid instance", __func__); 731 return QDF_STATUS_E_FAILURE; 732 } 733 734 if (soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping) 735 return soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping(soc, 736 pdev_id, 737 func, 738 line); 739 740 return QDF_STATUS_SUCCESS; 741 } 742 743 #ifdef IPA_WDS_EASYMESH_FEATURE 744 /** 745 * cdp_ipa_ast_create() - Create/update AST entry in AST table 746 * for learning/roaming packets from IPA 747 * @soc: data path soc handle 748 * @data: Structure used for updating the AST table 749 * 750 * Create/update AST entry in AST table for learning/roaming packets from IPA 751 * 752 * Return: QDF_STATUS 753 */ 754 static inline QDF_STATUS 755 cdp_ipa_ast_create(ol_txrx_soc_handle soc, qdf_ipa_ast_info_type_t *data) 756 { 757 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 758 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 759 "%s invalid instance", __func__); 760 return QDF_STATUS_E_FAILURE; 761 } 762 763 if (soc->ops->ipa_ops->ipa_ast_create) 764 return soc->ops->ipa_ops->ipa_ast_create(soc, data); 765 766 return QDF_STATUS_SUCCESS; 767 } 768 #endif 769 770 /** 771 * cdp_ipa_update_peer_rx_stats - update peer rx stats 772 * @soc: data path soc handle 773 * @vdev_id: vdev id 774 * @peer_mac: Peer Mac Address 775 * @nbuf: pointer to data packet 776 * 777 * Return: QDF_STATUS 778 */ 779 static inline QDF_STATUS 780 cdp_ipa_update_peer_rx_stats(ol_txrx_soc_handle soc, uint8_t vdev_id, 781 uint8_t *peer_mac, qdf_nbuf_t nbuf) 782 { 783 if (!soc || !soc->ops || !soc->ops->ipa_ops) { 784 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 785 "%s invalid instance", __func__); 786 return QDF_STATUS_E_FAILURE; 787 } 788 789 if (soc->ops->ipa_ops->ipa_update_peer_rx_stats) 790 return soc->ops->ipa_ops->ipa_update_peer_rx_stats(soc, 791 vdev_id, 792 peer_mac, 793 nbuf); 794 795 return QDF_STATUS_SUCCESS; 796 } 797 #endif /* IPA_OFFLOAD */ 798 799 #endif /* _CDP_TXRX_IPA_H_ */ 800