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