1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * @file cdp_txrx_misc.h 21 * @brief Define the host data path miscellaneous API functions 22 * called by the host control SW and the OS interface module 23 */ 24 #ifndef _CDP_TXRX_MISC_H_ 25 #define _CDP_TXRX_MISC_H_ 26 27 #include "cdp_txrx_handle.h" 28 #include <cdp_txrx_cmn.h> 29 30 /** 31 * cdp_tx_non_std() - Allow the control-path SW to send data frames 32 * @soc: data path soc handle 33 * @vdev_id: id of vdev 34 * @tx_spec: what non-standard handling to apply to the tx data frames 35 * @msdu_list: NULL-terminated list of tx MSDUs 36 * 37 * Generally, all tx data frames come from the OS shim into the txrx layer. 38 * However, there are rare cases such as TDLS messaging where the UMAC 39 * control-path SW creates tx data frames. 40 * This UMAC SW can call this function to provide the tx data frames to 41 * the txrx layer. 42 * The UMAC SW can request a callback for these data frames after their 43 * transmission completes, by using the ol_txrx_data_tx_cb_set function 44 * to register a tx completion callback, and by specifying 45 * ol_tx_spec_no_free as the tx_spec arg when giving the frames to 46 * ol_tx_non_std. 47 * The MSDUs need to have the appropriate L2 header type (802.3 vs. 802.11), 48 * as specified by ol_cfg_frame_type(). 49 * 50 * Return: null - success, skb - failure 51 */ 52 static inline qdf_nbuf_t 53 cdp_tx_non_std(ol_txrx_soc_handle soc, uint8_t vdev_id, 54 enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list) 55 { 56 if (!soc || !soc->ops || !soc->ops->misc_ops) { 57 dp_cdp_debug("invalid instance"); 58 return NULL; 59 } 60 61 if (soc->ops->misc_ops->tx_non_std) 62 return soc->ops->misc_ops->tx_non_std(soc, vdev_id, tx_spec, 63 msdu_list); 64 return NULL; 65 } 66 67 /** 68 * cdp_set_ibss_vdev_heart_beat_timer() - Update ibss vdev heart 69 * beat timer 70 * @soc: data path soc handle 71 * @vdev_id: id of vdev 72 * @timer_value_sec: new heart beat timer value 73 * 74 * Return: Old timer value set in vdev. 75 */ 76 static inline uint16_t 77 cdp_set_ibss_vdev_heart_beat_timer(ol_txrx_soc_handle soc, 78 uint8_t vdev_id, uint16_t timer_value_sec) 79 { 80 if (!soc || !soc->ops || !soc->ops->misc_ops) { 81 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 82 "%s invalid instance", __func__); 83 return 0; 84 } 85 86 if (soc->ops->misc_ops->set_ibss_vdev_heart_beat_timer) 87 return soc->ops->misc_ops->set_ibss_vdev_heart_beat_timer( 88 soc, vdev_id, timer_value_sec); 89 90 return 0; 91 } 92 93 /** 94 * cdp_set_wisa_mode() - set wisa mode 95 * @soc: data path soc handle 96 * @vdev_id: vdev_id 97 * @enable: enable or disable 98 * 99 * Return: QDF_STATUS_SUCCESS mode enable success 100 */ 101 static inline QDF_STATUS 102 cdp_set_wisa_mode(ol_txrx_soc_handle soc, uint8_t vdev_id, bool enable) 103 { 104 if (!soc || !soc->ops || !soc->ops->misc_ops) { 105 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 106 "%s invalid instance", __func__); 107 return QDF_STATUS_E_INVAL; 108 } 109 110 if (soc->ops->misc_ops->set_wisa_mode) 111 return soc->ops->misc_ops->set_wisa_mode(soc, vdev_id, enable); 112 return QDF_STATUS_SUCCESS; 113 } 114 115 /** 116 * cdp_data_stall_cb_register() - register data stall callback 117 * @soc: data path soc handle 118 * @pdev_id: id of data path pdev handle 119 * @cb: callback function 120 * 121 * Return: QDF_STATUS_SUCCESS register success 122 */ 123 static inline QDF_STATUS cdp_data_stall_cb_register(ol_txrx_soc_handle soc, 124 uint8_t pdev_id, 125 data_stall_detect_cb cb) 126 { 127 if (!soc || !soc->ops || !soc->ops->misc_ops) { 128 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 129 "%s invalid instance", __func__); 130 return QDF_STATUS_E_INVAL; 131 } 132 133 if (soc->ops->misc_ops->txrx_data_stall_cb_register) 134 return soc->ops->misc_ops->txrx_data_stall_cb_register( 135 soc, pdev_id, cb); 136 return QDF_STATUS_SUCCESS; 137 } 138 139 /** 140 * cdp_data_stall_cb_deregister() - de-register data stall callback 141 * @soc: data path soc handle 142 * @pdev_id: id of data path pdev handle 143 * @cb - callback function 144 * 145 * Return: QDF_STATUS_SUCCESS de-register success 146 */ 147 static inline QDF_STATUS cdp_data_stall_cb_deregister(ol_txrx_soc_handle soc, 148 uint8_t pdev_id, 149 data_stall_detect_cb cb) 150 { 151 if (!soc || !soc->ops || !soc->ops->misc_ops) { 152 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 153 "%s invalid instance", __func__); 154 return QDF_STATUS_E_INVAL; 155 } 156 157 if (soc->ops->misc_ops->txrx_data_stall_cb_deregister) 158 return soc->ops->misc_ops->txrx_data_stall_cb_deregister( 159 soc, pdev_id, cb); 160 return QDF_STATUS_SUCCESS; 161 } 162 163 /** 164 * cdp_post_data_stall_event() - post data stall event 165 * @soc: data path soc handle 166 * @indicator: Module triggering data stall 167 * @data_stall_type: data stall event type 168 * @pdev_id: pdev id 169 * @vdev_id_bitmap: vdev id bitmap 170 * @recovery_type: data stall recovery type 171 * 172 * Return: None 173 */ 174 static inline void 175 cdp_post_data_stall_event(ol_txrx_soc_handle soc, 176 enum data_stall_log_event_indicator indicator, 177 enum data_stall_log_event_type data_stall_type, 178 uint32_t pdev_id, uint32_t vdev_id_bitmap, 179 enum data_stall_log_recovery_type recovery_type) 180 { 181 if (!soc || !soc->ops) { 182 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 183 "%s invalid instance", __func__); 184 QDF_BUG(0); 185 return; 186 } 187 188 if (!soc->ops->misc_ops || 189 !soc->ops->misc_ops->txrx_post_data_stall_event) 190 return; 191 192 soc->ops->misc_ops->txrx_post_data_stall_event( 193 soc, indicator, data_stall_type, pdev_id, 194 vdev_id_bitmap, recovery_type); 195 } 196 197 /** 198 * cdp_set_wmm_param() - set wmm parameter 199 * @soc: data path soc handle 200 * @pdev_id: id of data path pdev handle 201 * @wmm_param: wmm parameter 202 * 203 * Return: none 204 */ 205 static inline void 206 cdp_set_wmm_param(ol_txrx_soc_handle soc, uint8_t pdev_id, 207 struct ol_tx_wmm_param_t wmm_param) 208 { 209 if (!soc || !soc->ops || !soc->ops->misc_ops) { 210 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 211 "%s invalid instance", __func__); 212 return; 213 } 214 215 if (soc->ops->misc_ops->set_wmm_param) 216 return soc->ops->misc_ops->set_wmm_param(soc, pdev_id, 217 wmm_param); 218 219 return; 220 } 221 222 /** 223 * cdp_runtime_suspend() - suspend 224 * @soc: data path soc handle 225 * @pdev_id: id of data path pdev handle 226 * 227 * Return: QDF_STATUS_SUCCESS suspend success 228 */ 229 static inline QDF_STATUS cdp_runtime_suspend(ol_txrx_soc_handle soc, 230 uint8_t pdev_id) 231 { 232 if (!soc || !soc->ops || !soc->ops->misc_ops) { 233 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 234 "%s invalid instance", __func__); 235 return QDF_STATUS_E_INVAL; 236 } 237 238 if (soc->ops->misc_ops->runtime_suspend) 239 return soc->ops->misc_ops->runtime_suspend(soc, pdev_id); 240 241 return QDF_STATUS_SUCCESS; 242 } 243 244 /** 245 * cdp_runtime_resume() - resume 246 * @soc: data path soc handle 247 * @pdev_id: id of data path pdev handle 248 * 249 * Return: QDF_STATUS_SUCCESS suspend success 250 */ 251 static inline QDF_STATUS cdp_runtime_resume(ol_txrx_soc_handle soc, 252 uint8_t pdev_id) 253 { 254 if (!soc || !soc->ops || !soc->ops->misc_ops) { 255 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 256 "%s invalid instance", __func__); 257 return QDF_STATUS_E_INVAL; 258 } 259 260 if (soc->ops->misc_ops->runtime_resume) 261 return soc->ops->misc_ops->runtime_resume(soc, pdev_id); 262 263 return QDF_STATUS_SUCCESS; 264 } 265 266 /** 267 * cdp_hl_tdls_flag_reset() - tdls flag reset 268 * @soc: data path soc handle 269 * @vdev_id: id of vdev 270 * @flag: flag indicating to set/reset tdls 271 * 272 * Return: none 273 */ 274 static inline void 275 cdp_hl_tdls_flag_reset(ol_txrx_soc_handle soc, uint8_t vdev_id, bool flag) 276 { 277 if (!soc || !soc->ops || !soc->ops->misc_ops) { 278 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 279 "%s invalid instance", __func__); 280 return; 281 } 282 283 if (soc->ops->misc_ops->hl_tdls_flag_reset) 284 return soc->ops->misc_ops->hl_tdls_flag_reset(soc, vdev_id, 285 flag); 286 287 return; 288 } 289 290 /** 291 * cdp_get_opmode() - get vdev operation mode 292 * @soc: data path soc handle 293 * @vdev_id: id of vdev 294 * 295 * Return virtual device operational mode 296 * op_mode_ap, 297 * op_mode_ibss, 298 * op_mode_sta, 299 * op_mode_monitor, 300 * op_mode_ocb, 301 * 302 * return interface id 303 * 0 unknown interface 304 */ 305 static inline int 306 cdp_get_opmode(ol_txrx_soc_handle soc, uint8_t vdev_id) 307 { 308 if (!soc || !soc->ops || !soc->ops->misc_ops) { 309 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 310 "%s invalid instance", __func__); 311 return 0; 312 } 313 314 if (soc->ops->misc_ops->get_opmode) 315 return soc->ops->misc_ops->get_opmode(soc, vdev_id); 316 317 return 0; 318 } 319 320 /** 321 * cdp_get_vdev_id() - get vdev id 322 * @soc - data path soc handle 323 * @vdev - virtual interface instance 324 * 325 * get virtual interface id 326 * 327 * return interface id 328 * 0 unknown interface 329 */ 330 static inline uint16_t 331 cdp_get_vdev_id(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) 332 { 333 if (!soc || !soc->ops || !soc->ops->misc_ops) { 334 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 335 "%s invalid instance", __func__); 336 return 0; 337 } 338 339 if (soc->ops->misc_ops->get_vdev_id) 340 return soc->ops->misc_ops->get_vdev_id(vdev); 341 return 0; 342 } 343 344 /** 345 * cdp_get_tx_ack_stats() - get tx ack count for vdev 346 * @soc - data path soc handle 347 * @vdev_id - vdev id 348 * 349 * return tx ack count 350 * 0 invalid count 351 */ 352 static inline uint32_t 353 cdp_get_tx_ack_stats(ol_txrx_soc_handle soc, uint8_t vdev_id) 354 { 355 if (!soc || !soc->ops || !soc->ops->misc_ops) { 356 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 357 "%s invalid instance", __func__); 358 return 0; 359 } 360 361 if (soc->ops->misc_ops->get_tx_ack_stats) 362 return soc->ops->misc_ops->get_tx_ack_stats(soc, vdev_id); 363 364 return 0; 365 } 366 367 /** 368 * cdp_bad_peer_txctl_set_setting() - Set peer timer balance parameters 369 * @soc: data path soc handle 370 * @pdev_id: id of datapath pdev handle 371 * @enable: enable/disable peer balance state 372 * @period: balance timer period for peer 373 * @txq_limit: txp limit for peer 374 * 375 * Return: none 376 */ 377 static inline void 378 cdp_bad_peer_txctl_set_setting(ol_txrx_soc_handle soc, uint8_t pdev_id, 379 int enable, int period, int txq_limit) 380 { 381 if (!soc || !soc->ops || !soc->ops->misc_ops) { 382 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 383 "%s invalid instance", __func__); 384 return; 385 } 386 387 if (soc->ops->misc_ops->bad_peer_txctl_set_setting) 388 return soc->ops->misc_ops->bad_peer_txctl_set_setting( 389 soc, pdev_id, enable, period, 390 txq_limit); 391 return; 392 } 393 394 /** 395 * cdp_bad_peer_txctl_update_threshold() - TBD 396 * @soc: data path soc handle 397 * @pdev_id: id of data path pdev handle 398 * @level: index of the threshold configuration 399 * @tput_thresh: peer balance throughput threshold 400 * @tx_limit: peer balance tx limit threshold 401 * 402 * TBD 403 * 404 * Return: none 405 */ 406 static inline void 407 cdp_bad_peer_txctl_update_threshold(ol_txrx_soc_handle soc, 408 uint8_t pdev_id, int level, 409 int tput_thresh, int tx_limit) 410 { 411 if (!soc || !soc->ops || !soc->ops->misc_ops) { 412 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 413 "%s invalid instance", __func__); 414 return; 415 } 416 417 if (soc->ops->misc_ops->bad_peer_txctl_update_threshold) 418 return soc->ops->misc_ops->bad_peer_txctl_update_threshold( 419 soc, pdev_id, level, tput_thresh, tx_limit); 420 return; 421 } 422 423 /** 424 * cdp_mark_first_wakeup_packet() - set flag to indicate that 425 * fw is compatible for marking first packet after wow wakeup 426 * @soc: data path soc handle 427 * @pdev_id: id of data path pdev handle 428 * @value: 1 for enabled/ 0 for disabled 429 * 430 * Return: None 431 */ 432 static inline void cdp_mark_first_wakeup_packet(ol_txrx_soc_handle soc, 433 uint8_t pdev_id, uint8_t value) 434 { 435 if (!soc || !soc->ops || !soc->ops->misc_ops) { 436 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 437 "%s invalid instance", __func__); 438 return; 439 } 440 441 if (soc->ops->misc_ops->mark_first_wakeup_packet) 442 return soc->ops->misc_ops->mark_first_wakeup_packet( 443 soc, pdev_id, value); 444 return; 445 } 446 447 448 /** 449 * cds_update_mac_id() - update mac_id for vdev 450 * @psoc: data path soc handle 451 * @vdev_id: vdev id 452 * @mac_id: mac id 453 * 454 * Return: none 455 */ 456 static inline void cdp_update_mac_id(void *psoc, uint8_t vdev_id, 457 uint8_t mac_id) 458 { 459 ol_txrx_soc_handle soc = psoc; 460 461 if (!soc || !soc->ops || !soc->ops->misc_ops) { 462 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 463 "%s invalid instance", __func__); 464 return; 465 } 466 467 if (soc->ops->misc_ops->update_mac_id) 468 return soc->ops->misc_ops->update_mac_id(soc, vdev_id, mac_id); 469 return; 470 } 471 472 /** 473 * cdp_flush_rx_frames() - flush cached rx frames 474 * @soc: data path soc handle 475 * @pdev_id: datapath pdev identifier 476 * @peer_mac: peer mac address 477 * @drop: set flag to drop frames 478 * 479 * Return: None 480 */ 481 static inline void cdp_flush_rx_frames(ol_txrx_soc_handle soc, uint8_t pdev_id, 482 uint8_t *peer_mac, bool drop) 483 { 484 if (!soc || !soc->ops || !soc->ops->misc_ops) { 485 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 486 "%s invalid instance", __func__); 487 return; 488 } 489 490 if (soc->ops->misc_ops->flush_rx_frames) 491 return soc->ops->misc_ops->flush_rx_frames(soc, pdev_id, 492 peer_mac, drop); 493 return; 494 } 495 496 /* 497 * cdp_get_intra_bss_fwd_pkts_count() - to get the total tx and rx packets 498 * that has been forwarded from txrx layer without going to upper layers. 499 * @soc: Datapath soc handle 500 * @vdev_id: vdev id 501 * @fwd_tx_packets: pointer to forwarded tx packets count parameter 502 * @fwd_rx_packets: pointer to forwarded rx packets count parameter 503 * 504 * Return: status -> A_OK - success, A_ERROR - failure 505 */ 506 static inline A_STATUS cdp_get_intra_bss_fwd_pkts_count( 507 ol_txrx_soc_handle soc, uint8_t vdev_id, 508 uint64_t *fwd_tx_packets, uint64_t *fwd_rx_packets) 509 { 510 if (!soc || !soc->ops || !soc->ops->misc_ops) { 511 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 512 "%s invalid instance", __func__); 513 return 0; 514 } 515 516 if (soc->ops->misc_ops->get_intra_bss_fwd_pkts_count) 517 return soc->ops->misc_ops->get_intra_bss_fwd_pkts_count( 518 soc, vdev_id, fwd_tx_packets, fwd_rx_packets); 519 520 return 0; 521 } 522 523 /** 524 * cdp_pkt_log_init() - API to initialize packet log 525 * @soc: data path soc handle 526 * @pdev_id: id of data path pdev handle 527 * @scn: HIF context 528 * 529 * Return: void 530 */ 531 static inline void cdp_pkt_log_init(ol_txrx_soc_handle soc, 532 uint8_t pdev_id, void *scn) 533 { 534 if (!soc || !soc->ops || !soc->ops->misc_ops) { 535 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 536 "%s invalid instance", __func__); 537 return; 538 } 539 540 if (soc->ops->misc_ops->pkt_log_init) 541 return soc->ops->misc_ops->pkt_log_init(soc, pdev_id, scn); 542 543 return; 544 } 545 546 /** 547 * cdp_pkt_log_con_service() - API to connect packet log service 548 * @soc: data path soc handle 549 * @pdev_id: id of data path pdev handle 550 * @scn: HIF context 551 * 552 * Return: void 553 */ 554 static inline void cdp_pkt_log_con_service(ol_txrx_soc_handle soc, 555 uint8_t pdev_id, void *scn) 556 { 557 if (!soc || !soc->ops || !soc->ops->misc_ops) { 558 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 559 "%s invalid instance", __func__); 560 return; 561 } 562 563 if (soc->ops->misc_ops->pkt_log_con_service) 564 return soc->ops->misc_ops->pkt_log_con_service( 565 soc, pdev_id, scn); 566 567 return; 568 } 569 570 /** 571 * cdp_pkt_log_exit() - API to cleanup packet log info 572 * @soc: data path soc handle 573 * @pdev_id: id of data path pdev handle 574 * 575 * Return: void 576 */ 577 static inline void cdp_pkt_log_exit(ol_txrx_soc_handle soc, uint8_t pdev_id) 578 { 579 if (!soc || !soc->ops || !soc->ops->misc_ops) { 580 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 581 "%s invalid instance", __func__); 582 return; 583 } 584 585 if (soc->ops->misc_ops->pkt_log_exit) 586 return soc->ops->misc_ops->pkt_log_exit(soc, pdev_id); 587 588 return; 589 } 590 591 /** 592 * cdp_get_num_rx_contexts() - API to get the number of RX contexts 593 * @soc: soc handle 594 * 595 * Return: number of RX contexts 596 */ 597 static inline int cdp_get_num_rx_contexts(ol_txrx_soc_handle soc) 598 { 599 if (!soc || !soc->ops || !soc->ops->misc_ops) { 600 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 601 "%s invalid instance", __func__); 602 return 0; 603 } 604 605 if (soc->ops->misc_ops->get_num_rx_contexts) 606 return soc->ops->misc_ops->get_num_rx_contexts(soc); 607 608 return 0; 609 } 610 611 /** 612 * cdp_register_packetdump_cb() - API to register packetdump callback 613 * 614 * Register TX/RX callback for data packets, during connection. And per packet 615 * stats will be passed to user-space by @tx_cb/@rx_cb. 616 * 617 * @soc: soc handle 618 * @pdev_id: id of data path pdev handle 619 * @tx_cb: tx packet callback 620 * @rx_cb: rx packet callback 621 * 622 * Return: void 623 */ 624 static inline void cdp_register_packetdump_cb(ol_txrx_soc_handle soc, 625 uint8_t pdev_id, 626 ol_txrx_pktdump_cb tx_cb, 627 ol_txrx_pktdump_cb rx_cb) 628 { 629 if (!soc || !soc->ops || !soc->ops->misc_ops) { 630 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 631 "%s invalid instance", __func__); 632 return; 633 } 634 635 if (soc->ops->misc_ops->register_pktdump_cb) 636 return soc->ops->misc_ops->register_pktdump_cb( 637 soc, pdev_id, tx_cb, rx_cb); 638 } 639 640 /** 641 * cdp_deregister_packetdump_cb() - API to unregister packetdump callback 642 * 643 * Deregister callback for TX/RX data packets. 644 * 645 * @soc: soc handle 646 * @pdev_id: id of data path pdev handle 647 * 648 * Return: void 649 */ 650 static inline void cdp_deregister_packetdump_cb(ol_txrx_soc_handle soc, 651 uint8_t pdev_id) 652 { 653 if (!soc || !soc->ops || !soc->ops->misc_ops) { 654 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 655 "%s invalid instance", __func__); 656 return; 657 } 658 659 if (soc->ops->misc_ops->unregister_pktdump_cb) 660 return soc->ops->misc_ops->unregister_pktdump_cb(soc, pdev_id); 661 } 662 663 typedef void (*rx_mic_error_callback)(struct cdp_ctrl_objmgr_psoc *psoc, 664 uint8_t pdev_id, 665 struct cdp_rx_mic_err_info *info); 666 667 /** 668 * cdp_register_rx_mic_error_ind_handler() - API to register mic error 669 * indication handler 670 * 671 * @soc: soc handle 672 * @rx_mic_cb: rx mic error indication callback 673 * 674 * Return: void 675 */ 676 static inline void 677 cdp_register_rx_mic_error_ind_handler(ol_txrx_soc_handle soc, 678 rx_mic_error_callback rx_mic_cb) 679 { 680 if (!soc || !soc->ol_ops) { 681 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 682 "%s invalid instance", __func__); 683 return; 684 } 685 686 soc->ol_ops->rx_mic_error = rx_mic_cb; 687 } 688 689 typedef void (*rx_refill_thread_sched_cb)(ol_txrx_soc_handle soc); 690 691 /** 692 * cdp_register_rx_refill_thread_sched_handler() - API to register RX refill 693 * thread schedule handler 694 * 695 * @soc: soc handle 696 * 697 * Return: void 698 */ 699 static inline void 700 cdp_register_rx_refill_thread_sched_handler(ol_txrx_soc_handle soc, 701 rx_refill_thread_sched_cb rx_sched_cb) 702 { 703 if (!soc || !soc->ol_ops) { 704 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 705 "%s invalid instance", __func__); 706 return; 707 } 708 709 soc->ol_ops->dp_rx_sched_refill_thread = rx_sched_cb; 710 } 711 712 /** 713 * cdp_pdev_reset_driver_del_ack() - reset driver TCP delayed ack flag 714 * @soc: data path soc handle 715 * @pdev_id: pdev id 716 * 717 * Return: none 718 */ 719 static inline void cdp_pdev_reset_driver_del_ack(void *psoc, 720 uint8_t pdev_id) 721 { 722 ol_txrx_soc_handle soc = psoc; 723 724 if (!soc || !soc->ops || !soc->ops->misc_ops) { 725 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 726 "%s invalid instance", __func__); 727 return; 728 } 729 730 if (soc->ops->misc_ops->pdev_reset_driver_del_ack) 731 return soc->ops->misc_ops->pdev_reset_driver_del_ack(soc, 732 pdev_id); 733 } 734 735 /* 736 * cdp_vdev_set_driver_del_ack_enable() - set driver delayed ack enabled flag 737 * @soc: data path soc handle 738 * @vdev_id: vdev id 739 * @rx_packets: number of rx packets 740 * @time_in_ms: time in ms 741 * @high_th: high threshold 742 * @low_th: low threshold 743 * 744 * Return: none 745 */ 746 static inline void cdp_vdev_set_driver_del_ack_enable(ol_txrx_soc_handle soc, 747 uint8_t vdev_id, 748 unsigned long rx_packets, 749 uint32_t time_in_ms, 750 uint32_t high_th, 751 uint32_t low_th) 752 { 753 if (!soc || !soc->ops || !soc->ops->misc_ops) { 754 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 755 "%s invalid instance", __func__); 756 return; 757 } 758 759 if (soc->ops->misc_ops->vdev_set_driver_del_ack_enable) 760 return soc->ops->misc_ops->vdev_set_driver_del_ack_enable( 761 soc, vdev_id, rx_packets, time_in_ms, high_th, low_th); 762 } 763 764 static inline void cdp_vdev_set_bundle_require_flag(ol_txrx_soc_handle soc, 765 uint8_t vdev_id, 766 unsigned long tx_bytes, 767 uint32_t time_in_ms, 768 uint32_t high_th, 769 uint32_t low_th) 770 { 771 if (!soc || !soc->ops || !soc->ops->misc_ops) { 772 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 773 "%s invalid instance", __func__); 774 return; 775 } 776 777 if (soc->ops->misc_ops->vdev_set_bundle_require_flag) 778 return soc->ops->misc_ops->vdev_set_bundle_require_flag( 779 vdev_id, tx_bytes, time_in_ms, high_th, low_th); 780 } 781 782 static inline void cdp_pdev_reset_bundle_require_flag(ol_txrx_soc_handle soc, 783 uint8_t pdev_id) 784 { 785 if (!soc || !soc->ops || !soc->ops->misc_ops) { 786 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 787 "%s invalid instance", __func__); 788 return; 789 } 790 791 if (soc->ops->misc_ops->pdev_reset_bundle_require_flag) 792 return soc->ops->misc_ops->pdev_reset_bundle_require_flag( 793 soc, pdev_id); 794 } 795 796 /** 797 * cdp_txrx_ext_stats_request(): request dp tx and rx extended stats 798 * @soc: soc handle 799 * @pdev_id: pdev id 800 * @req: stats request structure to fill 801 * 802 * return: status 803 */ 804 static inline QDF_STATUS 805 cdp_txrx_ext_stats_request(ol_txrx_soc_handle soc, uint8_t pdev_id, 806 struct cdp_txrx_ext_stats *req) 807 { 808 if (!soc || !soc->ops || !soc->ops->misc_ops || !req) { 809 dp_cdp_debug("Invalid Instance:"); 810 return QDF_STATUS_E_INVAL; 811 } 812 813 if (soc->ops->misc_ops->txrx_ext_stats_request) 814 return soc->ops->misc_ops->txrx_ext_stats_request(soc, pdev_id, 815 req); 816 817 return QDF_STATUS_SUCCESS; 818 } 819 820 /** 821 * cdp_request_rx_hw_stats(): request rx hw stats 822 * @soc: soc handle 823 * @vdev_id: vdev id 824 * 825 * return: none 826 */ 827 static inline QDF_STATUS 828 cdp_request_rx_hw_stats(ol_txrx_soc_handle soc, uint8_t vdev_id) 829 { 830 if (!soc || !soc->ops || !soc->ops->misc_ops) { 831 dp_cdp_debug("Invalid Instance:"); 832 return QDF_STATUS_E_INVAL; 833 } 834 835 if (soc->ops->misc_ops->request_rx_hw_stats) 836 return soc->ops->misc_ops->request_rx_hw_stats(soc, vdev_id); 837 838 return QDF_STATUS_SUCCESS; 839 } 840 841 /** 842 * cdp_reset_rx_hw_ext_stats(): reset rx hw ext stats 843 * @soc: soc handle 844 * 845 * Return: none 846 */ 847 static inline void 848 cdp_reset_rx_hw_ext_stats(ol_txrx_soc_handle soc) 849 { 850 if (!soc || !soc->ops || !soc->ops->misc_ops) { 851 dp_cdp_debug("Invalid Instance"); 852 return; 853 } 854 855 if (soc->ops->misc_ops->reset_rx_hw_ext_stats) 856 soc->ops->misc_ops->reset_rx_hw_ext_stats(soc); 857 } 858 859 /** 860 * cdp_vdev_inform_ll_conn() - Inform DP about the low latency connection 861 * @soc: soc handle 862 * @vdev_id: vdev id 863 * @action: Action to be performed (Add/Delete) 864 * 865 * Returns: QDF_STATUS 866 */ 867 static inline QDF_STATUS 868 cdp_vdev_inform_ll_conn(ol_txrx_soc_handle soc, uint8_t vdev_id, 869 enum vdev_ll_conn_actions action) 870 { 871 if (!soc || !soc->ops || !soc->ops->misc_ops) { 872 dp_cdp_debug("Invalid Instance:"); 873 return QDF_STATUS_E_INVAL; 874 } 875 876 if (soc->ops->misc_ops->vdev_inform_ll_conn) 877 return soc->ops->misc_ops->vdev_inform_ll_conn(soc, vdev_id, 878 action); 879 880 return QDF_STATUS_SUCCESS; 881 } 882 883 /** 884 * cdp_soc_set_swlm_enable() - Enable or disable software latency manager 885 * @soc: soc handle 886 * @value: value (enable/disable) 887 * 888 * Returns: QDF_STATUS 889 */ 890 static inline QDF_STATUS 891 cdp_soc_set_swlm_enable(ol_txrx_soc_handle soc, uint8_t value) 892 { 893 if (!soc || !soc->ops || !soc->ops->misc_ops) { 894 dp_cdp_debug("Invalid Instance:"); 895 return QDF_STATUS_E_INVAL; 896 } 897 898 if (soc->ops->misc_ops->set_swlm_enable) 899 return soc->ops->misc_ops->set_swlm_enable(soc, value); 900 901 return QDF_STATUS_SUCCESS; 902 } 903 904 /** 905 * cdp_soc_is_swlm_enabled() - Check if the software latency manager is 906 * enabled or not 907 * @soc: soc handle 908 * 909 * Returns: 1 if enabled, 0 if disabled 910 */ 911 static inline uint8_t 912 cdp_soc_is_swlm_enabled(ol_txrx_soc_handle soc) 913 { 914 if (!soc || !soc->ops || !soc->ops->misc_ops) { 915 dp_cdp_debug("Invalid Instance:"); 916 return 0; 917 } 918 919 if (soc->ops->misc_ops->is_swlm_enabled) 920 return soc->ops->misc_ops->is_swlm_enabled(soc); 921 922 return 0; 923 } 924 925 /** 926 * cdp_display_txrx_hw_info() - Dump the DP rings info 927 * @soc: soc handle 928 * 929 * Return: none 930 */ 931 static inline void 932 cdp_display_txrx_hw_info(ol_txrx_soc_handle soc) 933 { 934 if (!soc || !soc->ops || !soc->ops->misc_ops) { 935 dp_cdp_debug("Invalid Instance:"); 936 return; 937 } 938 939 if (soc->ops->misc_ops->display_txrx_hw_info) 940 return soc->ops->misc_ops->display_txrx_hw_info(soc); 941 } 942 #endif /* _CDP_TXRX_MISC_H_ */ 943