1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2023 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 * DOC: cdp_txrx_ctrl.h 22 * Define the host data path control API functions 23 * called by the host control SW and the OS interface module 24 */ 25 26 #ifndef _CDP_TXRX_CTRL_H_ 27 #define _CDP_TXRX_CTRL_H_ 28 #include "cdp_txrx_handle.h" 29 #include "cdp_txrx_cmn_struct.h" 30 #include "cdp_txrx_cmn.h" 31 #include "cdp_txrx_ops.h" 32 33 static inline int cdp_is_target_ar900b 34 (ol_txrx_soc_handle soc) 35 { 36 if (!soc || !soc->ops) { 37 dp_cdp_debug("Invalid Instance:"); 38 QDF_BUG(0); 39 return 0; 40 } 41 42 if (!soc->ops->ctrl_ops || 43 !soc->ops->ctrl_ops->txrx_is_target_ar900b) 44 return 0; 45 46 return soc->ops->ctrl_ops->txrx_is_target_ar900b(soc); 47 } 48 49 50 /* WIN */ 51 static inline int 52 cdp_mempools_attach(ol_txrx_soc_handle soc) 53 { 54 if (!soc || !soc->ops) { 55 dp_cdp_debug("Invalid Instance:"); 56 QDF_BUG(0); 57 return 0; 58 } 59 60 if (!soc->ops->ctrl_ops || 61 !soc->ops->ctrl_ops->txrx_mempools_attach) 62 return 0; 63 64 return soc->ops->ctrl_ops->txrx_mempools_attach(soc); 65 } 66 67 68 #if defined(ATH_SUPPORT_NAC) || defined(ATH_SUPPORT_NAC_RSSI) 69 /** 70 * cdp_update_filter_neighbour_peers() - update the neighbour peer addresses 71 * @soc: the pointer to soc object 72 * @vdev_id: id of the pointer to vdev 73 * @cmd: add/del entry into peer table 74 * @macaddr: the address of neighbour peer 75 * 76 * This defines interface function to update neighbour peers addresses 77 * which needs to be filtered 78 * 79 * Return: int 80 */ 81 static inline int 82 cdp_update_filter_neighbour_peers(ol_txrx_soc_handle soc, 83 uint8_t vdev_id, uint32_t cmd, uint8_t *macaddr) 84 { 85 if (!soc || !soc->ops) { 86 dp_cdp_debug("Invalid Instance:"); 87 QDF_BUG(0); 88 return 0; 89 } 90 91 if (!soc->ops->mon_ops || 92 !soc->ops->mon_ops->txrx_update_filter_neighbour_peers) 93 return 0; 94 95 return soc->ops->mon_ops->txrx_update_filter_neighbour_peers 96 (soc, vdev_id, cmd, macaddr); 97 } 98 #endif /* ATH_SUPPORT_NAC || ATH_SUPPORT_NAC_RSSI*/ 99 100 /** 101 * cdp_update_mon_mac_filter() - update the monitor buffer and status filter 102 * @soc: the pointer to soc object 103 * @vdev_id: id of the pointer to vdev 104 * @cmd: add/del entry into peer table 105 * 106 * This defines interface function to set/reset monitor filter 107 * in case of special vap (scan radio) 108 * 109 * Return: QDF_STATUS 110 */ 111 static inline QDF_STATUS 112 cdp_update_mon_mac_filter(ol_txrx_soc_handle soc, 113 uint8_t vdev_id, uint32_t cmd) 114 { 115 if (!soc || !soc->ops) { 116 dp_cdp_debug("Invalid Instance:"); 117 QDF_BUG(0); 118 return QDF_STATUS_E_FAILURE; 119 } 120 121 if (!soc->ops->mon_ops || 122 !soc->ops->mon_ops->txrx_update_mon_mac_filter) 123 return QDF_STATUS_E_FAILURE; 124 125 return soc->ops->mon_ops->txrx_update_mon_mac_filter 126 (soc, vdev_id, cmd); 127 } 128 129 #ifdef WLAN_SUPPORT_MSCS 130 /** 131 * cdp_record_vdev_mscs_params() - record the MSCS data and send it to the 132 * Data path 133 * @soc: the pointer to soc object 134 * @vdev_id: id of the pointer to vdev 135 * @macaddr: the address of neighbour peer 136 * @mscs_params: Structure having MSCS params obtained from handshake 137 * @active: Flag to set MSCS active/inactive 138 * 139 * This defines interface function to record the MSCS procedure 140 * based data parameters so that the data path layer can access it 141 * 142 * Return: QDF_STATUS 143 */ 144 static inline QDF_STATUS 145 cdp_record_vdev_mscs_params(ol_txrx_soc_handle soc, uint8_t 146 *macaddr, uint8_t vdev_id, struct cdp_mscs_params *mscs_params, 147 bool active) 148 { 149 if (!soc || !soc->ops) { 150 dp_cdp_debug("Invalid Instance:"); 151 QDF_BUG(0); 152 return QDF_STATUS_E_FAILURE; 153 } 154 155 if (!soc->ops->ctrl_ops || 156 !soc->ops->ctrl_ops->txrx_record_mscs_params) 157 return QDF_STATUS_E_FAILURE; 158 return soc->ops->ctrl_ops->txrx_record_mscs_params 159 (soc, macaddr, vdev_id, mscs_params, active); 160 } 161 #endif 162 163 /** 164 * cdp_set_pdev_reo_dest() - set the Reo Destination ring for the pdev 165 * @soc: pointer to the soc 166 * @pdev_id: id of the data physical device object 167 * @val: the Reo destination ring index (1 to 4) 168 * 169 * This will be used to configure the Reo Destination ring for this pdev. 170 * 171 * Return: QDF_STATUS 172 */ 173 static inline QDF_STATUS 174 cdp_set_pdev_reo_dest(ol_txrx_soc_handle soc, 175 uint8_t pdev_id, enum cdp_host_reo_dest_ring val) 176 { 177 if (!soc || !soc->ops) { 178 dp_cdp_debug("Invalid Instance:"); 179 QDF_BUG(0); 180 return QDF_STATUS_E_FAILURE; 181 } 182 183 if (!soc->ops->ctrl_ops || 184 !soc->ops->ctrl_ops->txrx_set_pdev_reo_dest) 185 return QDF_STATUS_E_FAILURE; 186 187 return soc->ops->ctrl_ops->txrx_set_pdev_reo_dest 188 (soc, pdev_id, val); 189 } 190 191 /** 192 * cdp_get_pdev_reo_dest() - get the Reo Destination ring for the pdev 193 * @soc: pointer to the soc 194 * @pdev_id: id of physical device object 195 * 196 * Return: the Reo destination ring index (1 to 4), 0 if not supported. 197 */ 198 static inline enum cdp_host_reo_dest_ring 199 cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, uint8_t pdev_id) 200 { 201 if (!soc || !soc->ops) { 202 dp_cdp_debug("Invalid Instance:"); 203 QDF_BUG(0); 204 return cdp_host_reo_dest_ring_unknown; 205 } 206 207 if (!soc->ops->ctrl_ops || 208 !soc->ops->ctrl_ops->txrx_get_pdev_reo_dest) 209 return cdp_host_reo_dest_ring_unknown; 210 211 return soc->ops->ctrl_ops->txrx_get_pdev_reo_dest(soc, pdev_id); 212 } 213 214 /* Is this similar to ol_txrx_peer_state_update() in MCL */ 215 216 /** 217 * cdp_peer_authorize() - Update the authorize peer object at association time 218 * @soc: pointer to the soc 219 * @vdev_id: id of the pointer to vdev 220 * @peer_mac: mac address of the node's object 221 * @authorize: either to authorize or unauthorize peer 222 * 223 * For the host-based implementation of rate-control, it 224 * updates the peer/node-related parameters within rate-control 225 * context of the peer at association. 226 * 227 * Return: QDF_STATUS 228 */ 229 static inline QDF_STATUS 230 cdp_peer_authorize(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac, 231 u_int32_t authorize) 232 { 233 if (!soc || !soc->ops) { 234 dp_cdp_debug("Invalid Instance:"); 235 QDF_BUG(0); 236 return QDF_STATUS_E_FAILURE; 237 } 238 239 if (!soc->ops->ctrl_ops || 240 !soc->ops->ctrl_ops->txrx_peer_authorize) 241 return QDF_STATUS_E_FAILURE; 242 243 return soc->ops->ctrl_ops->txrx_peer_authorize 244 (soc, vdev_id, peer_mac, authorize); 245 } 246 247 /** 248 * cdp_peer_get_authorize() - Get per authorize status 249 * @soc: pointer to the soc 250 * @vdev_id: id of the pointer to vdev 251 * @peer_mac: mac address of the node's object 252 * 253 * Return: true is peer is authorized, false otherwise 254 */ 255 static inline bool 256 cdp_peer_get_authorize(ol_txrx_soc_handle soc, uint8_t vdev_id, 257 uint8_t *peer_mac) 258 { 259 if (!soc || !soc->ops) { 260 dp_cdp_debug("Invalid Instance:"); 261 QDF_BUG(0); 262 return false; 263 } 264 265 if (!soc->ops->ctrl_ops || 266 !soc->ops->ctrl_ops->txrx_peer_get_authorize) 267 return false; 268 269 return soc->ops->ctrl_ops->txrx_peer_get_authorize 270 (soc, vdev_id, peer_mac); 271 } 272 273 static inline void cdp_tx_flush_buffers 274 (ol_txrx_soc_handle soc, uint8_t vdev_id) 275 { 276 if (!soc || !soc->ops) { 277 dp_cdp_debug("Invalid Instance:"); 278 QDF_BUG(0); 279 return; 280 } 281 282 if (!soc->ops->ctrl_ops || 283 !soc->ops->ctrl_ops->tx_flush_buffers) 284 return; 285 286 soc->ops->ctrl_ops->tx_flush_buffers(soc, vdev_id); 287 } 288 289 static inline QDF_STATUS cdp_txrx_get_vdev_param(ol_txrx_soc_handle soc, 290 uint8_t vdev_id, 291 enum cdp_vdev_param_type type, 292 cdp_config_param_type *val) 293 { 294 if (!soc || !soc->ops) { 295 dp_cdp_debug("Invalid Instance:"); 296 QDF_BUG(0); 297 return QDF_STATUS_E_FAILURE; 298 } 299 300 if (!soc->ops->ctrl_ops || 301 !soc->ops->ctrl_ops->txrx_get_vdev_param) { 302 dp_cdp_debug("callback not registered:"); 303 return QDF_STATUS_E_FAILURE; 304 } 305 306 return soc->ops->ctrl_ops->txrx_get_vdev_param(soc, vdev_id, 307 type, val); 308 } 309 310 static inline QDF_STATUS 311 cdp_txrx_set_vdev_param(ol_txrx_soc_handle soc, 312 uint8_t vdev_id, enum cdp_vdev_param_type type, 313 cdp_config_param_type val) 314 { 315 if (!soc || !soc->ops) { 316 dp_cdp_debug("Invalid Instance:"); 317 QDF_BUG(0); 318 return QDF_STATUS_E_FAILURE; 319 } 320 321 if (!soc->ops->ctrl_ops || 322 !soc->ops->ctrl_ops->txrx_set_vdev_param) { 323 dp_cdp_nofl_debug("NULL vdev params callback"); 324 return QDF_STATUS_E_FAILURE; 325 } 326 327 return soc->ops->ctrl_ops->txrx_set_vdev_param(soc, vdev_id, 328 type, val); 329 } 330 331 static inline QDF_STATUS 332 cdp_txrx_set_psoc_param(ol_txrx_soc_handle soc, 333 enum cdp_psoc_param_type type, 334 cdp_config_param_type val) 335 { 336 if (!soc || !soc->ops) { 337 dp_cdp_debug("Invalid Instance:"); 338 QDF_BUG(0); 339 return QDF_STATUS_E_FAILURE; 340 } 341 342 if (!soc->ops->ctrl_ops || 343 !soc->ops->ctrl_ops->txrx_set_psoc_param) 344 return QDF_STATUS_E_FAILURE; 345 346 return soc->ops->ctrl_ops->txrx_set_psoc_param(soc, type, val); 347 } 348 349 static inline QDF_STATUS 350 cdp_txrx_get_psoc_param(ol_txrx_soc_handle soc, 351 enum cdp_psoc_param_type type, 352 cdp_config_param_type *val) 353 { 354 if (!soc || !soc->ops) { 355 dp_cdp_debug("Invalid Instance:"); 356 QDF_BUG(0); 357 return QDF_STATUS_E_FAILURE; 358 } 359 360 if (!soc->ops->ctrl_ops || 361 !soc->ops->ctrl_ops->txrx_get_psoc_param) 362 return QDF_STATUS_E_FAILURE; 363 364 return soc->ops->ctrl_ops->txrx_get_psoc_param(soc, type, val); 365 } 366 367 static inline 368 QDF_STATUS cdp_vdev_alloc_vdev_stats_id(ol_txrx_soc_handle soc, 369 uint8_t *vdev_stats_id) 370 { 371 if (!soc || !soc->ops) { 372 dp_cdp_debug("Invalid Instance:"); 373 QDF_BUG(0); 374 return QDF_STATUS_E_FAILURE; 375 } 376 377 if (!soc->ops->host_stats_ops || 378 !soc->ops->host_stats_ops->txrx_alloc_vdev_stats_id) 379 return QDF_STATUS_E_FAILURE; 380 381 return soc->ops->host_stats_ops->txrx_alloc_vdev_stats_id 382 (soc, vdev_stats_id); 383 } 384 385 static inline 386 void cdp_vdev_reset_vdev_stats_id(ol_txrx_soc_handle soc, 387 uint8_t vdev_stats_id) 388 { 389 if (!soc || !soc->ops) { 390 dp_cdp_debug("Invalid Instance:"); 391 QDF_BUG(0); 392 return; 393 } 394 395 if (!soc->ops->host_stats_ops || 396 !soc->ops->host_stats_ops->txrx_reset_vdev_stats_id) 397 return; 398 399 soc->ops->host_stats_ops->txrx_reset_vdev_stats_id(soc, vdev_stats_id); 400 } 401 402 #ifdef VDEV_PEER_PROTOCOL_COUNT 403 /** 404 * cdp_set_vdev_peer_protocol_count() - set per-peer protocol count tracking 405 * @soc: pointer to the soc 406 * @vdev_id: the data virtual device object 407 * @enable: enable per-peer protocol count 408 * 409 * Set per-peer protocol count feature enable 410 * 411 * Return: void 412 */ 413 static inline 414 void cdp_set_vdev_peer_protocol_count(ol_txrx_soc_handle soc, int8_t vdev_id, 415 bool enable) 416 { 417 if (!soc || !soc->ops) { 418 dp_cdp_debug("Invalid Instance:"); 419 QDF_BUG(0); 420 return; 421 } 422 423 if (!soc->ops->ctrl_ops || 424 !soc->ops->ctrl_ops->txrx_enable_peer_protocol_count) 425 return; 426 427 soc->ops->ctrl_ops->txrx_enable_peer_protocol_count(soc, vdev_id, 428 enable); 429 } 430 431 /** 432 * cdp_set_vdev_peer_protocol_drop_mask() - set per-peer protocol drop mask 433 * @soc: pointer to the soc 434 * @vdev_id: ID of the data virtual device object 435 * @drop_mask: drop_mask 436 * 437 * Set per-peer protocol drop_mask 438 * 439 * Return: void 440 */ 441 static inline 442 void cdp_set_vdev_peer_protocol_drop_mask(ol_txrx_soc_handle soc, 443 int8_t vdev_id, int drop_mask) 444 { 445 if (!soc || !soc->ops) { 446 dp_cdp_debug("Invalid Instance:"); 447 QDF_BUG(0); 448 return; 449 } 450 451 if (!soc->ops->ctrl_ops || 452 !soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask) 453 return; 454 455 soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask(soc, vdev_id, 456 drop_mask); 457 } 458 459 /** 460 * cdp_is_vdev_peer_protocol_count_enabled() - whether peer-protocol tracking 461 * enabled 462 * @soc: pointer to the soc 463 * @vdev_id: ID of the data virtual device object 464 * 465 * Get whether peer protocol count feature enabled or not 466 * 467 * Return: whether feature enabled or not 468 */ 469 static inline 470 int cdp_is_vdev_peer_protocol_count_enabled(ol_txrx_soc_handle soc, 471 int8_t vdev_id) 472 { 473 if (!soc || !soc->ops) { 474 dp_cdp_debug("Invalid Instance:"); 475 QDF_BUG(0); 476 return 0; 477 } 478 479 if (!soc->ops->ctrl_ops || 480 !soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled) 481 return 0; 482 483 return soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled(soc, 484 vdev_id); 485 } 486 487 /** 488 * cdp_get_peer_protocol_drop_mask() - get per-peer protocol count drop-mask 489 * @soc: pointer to the soc 490 * @vdev_id: ID of the data virtual device object 491 * 492 * Get peer-protocol-count drop-mask 493 * 494 * Return: peer-protocol-count drop-mask 495 */ 496 static inline 497 int cdp_get_peer_protocol_drop_mask(ol_txrx_soc_handle soc, int8_t vdev_id) 498 { 499 if (!soc || !soc->ops) { 500 dp_cdp_debug("Invalid Instance:"); 501 QDF_BUG(0); 502 return 0; 503 } 504 505 if (!soc->ops->ctrl_ops || 506 !soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask) 507 return 0; 508 509 return soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask(soc, 510 vdev_id); 511 } 512 513 /* 514 * Rx-Ingress and Tx-Egress are in the lower level DP layer 515 * Rx-Egress and Tx-ingress are handled in osif layer for DP 516 * So 517 * Rx-Ingress and Tx-Egress definitions are in DP layer 518 * Rx-Egress and Tx-ingress mask definitions are here below 519 */ 520 #define VDEV_PEER_PROTOCOL_RX_INGRESS_MASK 1 521 #define VDEV_PEER_PROTOCOL_TX_INGRESS_MASK 2 522 #define VDEV_PEER_PROTOCOL_RX_EGRESS_MASK 4 523 #define VDEV_PEER_PROTOCOL_TX_EGRESS_MASK 8 524 525 #else 526 #define cdp_set_vdev_peer_protocol_count(soc, vdev_id, enable) 527 #define cdp_set_vdev_peer_protocol_drop_mask(soc, vdev_id, drop_mask) 528 #define cdp_is_vdev_peer_protocol_count_enabled(soc, vdev_id) 0 529 #define cdp_get_peer_protocol_drop_mask(soc, vdev_id) 0 530 #endif 531 532 /** 533 * cdp_txrx_set_pdev_param() - set pdev parameter 534 * @soc: opaque soc handle 535 * @pdev_id: id of data path pdev handle 536 * @type: param type 537 * @val: value 538 * 539 * Return: status: 0 - Success, non-zero: Failure 540 */ 541 static inline QDF_STATUS cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc, 542 uint8_t pdev_id, 543 enum cdp_pdev_param_type type, 544 cdp_config_param_type val) 545 { 546 if (!soc || !soc->ops) { 547 dp_cdp_debug("Invalid Instance:"); 548 QDF_BUG(0); 549 return QDF_STATUS_E_FAILURE; 550 } 551 552 if (!soc->ops->ctrl_ops || 553 !soc->ops->ctrl_ops->txrx_set_pdev_param) 554 return QDF_STATUS_E_FAILURE; 555 556 return soc->ops->ctrl_ops->txrx_set_pdev_param 557 (soc, pdev_id, type, val); 558 } 559 560 /** 561 * cdp_txrx_set_peer_param() - set pdev parameter 562 * @soc: opaque soc handle 563 * @vdev_id: id of data path vdev handle 564 * @peer_mac: peer mac address 565 * @type: param type 566 * @val: value 567 * 568 * Return: status: 0 - Success, non-zero: Failure 569 */ 570 static inline QDF_STATUS cdp_txrx_set_peer_param(ol_txrx_soc_handle soc, 571 uint8_t vdev_id, 572 uint8_t *peer_mac, 573 enum cdp_peer_param_type type, 574 cdp_config_param_type val) 575 { 576 if (!soc || !soc->ops) { 577 dp_cdp_debug("Invalid Instance:"); 578 QDF_BUG(0); 579 return QDF_STATUS_E_FAILURE; 580 } 581 582 if (!soc->ops->ctrl_ops || 583 !soc->ops->ctrl_ops->txrx_set_peer_param) 584 return QDF_STATUS_E_FAILURE; 585 586 return soc->ops->ctrl_ops->txrx_set_peer_param 587 (soc, vdev_id, peer_mac, type, val); 588 } 589 590 /** 591 * cdp_txrx_get_peer_param() - set pdev parameter 592 * @soc: opaque soc handle 593 * @vdev_id: id of data path vdev handle 594 * @peer_mac: peer mac address 595 * @type: param type 596 * @val: address of buffer 597 * 598 * Return: status 599 */ 600 static inline QDF_STATUS cdp_txrx_get_peer_param(ol_txrx_soc_handle soc, 601 uint8_t vdev_id, 602 uint8_t *peer_mac, 603 enum cdp_peer_param_type type, 604 cdp_config_param_type *val) 605 { 606 if (!soc || !soc->ops) { 607 dp_cdp_debug("Invalid Instance:"); 608 QDF_BUG(0); 609 return QDF_STATUS_E_FAILURE; 610 } 611 612 if (!soc->ops->ctrl_ops || 613 !soc->ops->ctrl_ops->txrx_get_peer_param) 614 return QDF_STATUS_E_FAILURE; 615 616 return soc->ops->ctrl_ops->txrx_get_peer_param 617 (soc, vdev_id, peer_mac, type, val); 618 } 619 620 #ifdef QCA_MULTIPASS_SUPPORT 621 static inline void 622 cdp_peer_set_vlan_id(ol_txrx_soc_handle soc, uint8_t vdev_id, 623 uint8_t *peer_mac, uint16_t vlan_id) 624 { 625 if (!soc || !soc->ops) { 626 dp_cdp_debug("Invalid Instance:"); 627 QDF_BUG(0); 628 return; 629 } 630 631 if (!soc->ops->ctrl_ops || 632 !soc->ops->ctrl_ops->txrx_peer_set_vlan_id) 633 return; 634 635 soc->ops->ctrl_ops->txrx_peer_set_vlan_id(soc, vdev_id, peer_mac, 636 vlan_id); 637 } 638 #endif 639 640 /** 641 * cdp_txrx_get_pdev_param() - get pdev parameter 642 * @soc: opaque soc handle 643 * @pdev_id: id of data path pdev handle 644 * @type: param type 645 * @value: address of value buffer 646 * 647 * Return: status 648 */ 649 static inline QDF_STATUS cdp_txrx_get_pdev_param(ol_txrx_soc_handle soc, 650 uint8_t pdev_id, 651 enum cdp_pdev_param_type type, 652 cdp_config_param_type *value) 653 { 654 if (!soc || !soc->ops) { 655 dp_cdp_debug("Invalid Instance:"); 656 QDF_BUG(0); 657 return QDF_STATUS_E_FAILURE; 658 } 659 660 if (!soc->ops->ctrl_ops || 661 !soc->ops->ctrl_ops->txrx_get_pdev_param) 662 return QDF_STATUS_E_FAILURE; 663 664 return soc->ops->ctrl_ops->txrx_get_pdev_param 665 (soc, pdev_id, type, value); 666 } 667 668 /** 669 * cdp_txrx_peer_protocol_cnt() - set peer protocol count 670 * @soc: opaque soc handle 671 * @vdev_id: vdev id 672 * @nbuf: data packet 673 * @is_egress: whether egress or ingress 674 * @is_rx: whether tx or rx 675 * 676 * Return: void 677 */ 678 #ifdef VDEV_PEER_PROTOCOL_COUNT 679 static inline void 680 cdp_txrx_peer_protocol_cnt(ol_txrx_soc_handle soc, 681 int8_t vdev_id, 682 qdf_nbuf_t nbuf, 683 enum vdev_peer_protocol_enter_exit is_egress, 684 enum vdev_peer_protocol_tx_rx is_rx) 685 { 686 if (!soc || !soc->ops) { 687 dp_cdp_debug("Invalid Instance:"); 688 QDF_BUG(0); 689 return; 690 } 691 692 if (!soc->ops->ctrl_ops || 693 !soc->ops->ctrl_ops->txrx_peer_protocol_cnt) 694 return; 695 696 soc->ops->ctrl_ops->txrx_peer_protocol_cnt(soc, vdev_id, nbuf, 697 is_egress, is_rx); 698 } 699 #else 700 #define cdp_txrx_peer_protocol_cnt(soc, vdev_id, nbuf, is_egress, is_rx) 701 #endif 702 703 /** 704 * cdp_enable_peer_based_pktlog()- Set flag in peer structure 705 * @soc: pointer to the soc 706 * @pdev_id: id of the data physical device object 707 * @enable: enable or disable peer based filter based pktlog 708 * @peer_macaddr: Mac address of peer which needs to be 709 * filtered 710 * 711 * This function will set flag in peer structure if peer based filtering 712 * is enabled for pktlog 713 * 714 * Return: int 715 */ 716 static inline int 717 cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc, uint8_t pdev_id, 718 char *peer_macaddr, 719 uint8_t enable) 720 { 721 if (!soc || !soc->ops) { 722 QDF_TRACE_ERROR(QDF_MODULE_ID_DP, 723 "%s invalid instance", __func__); 724 QDF_BUG(0); 725 return 0; 726 } 727 728 if (!soc->ops->ctrl_ops || 729 !soc->ops->ctrl_ops->enable_peer_based_pktlog) 730 return 0; 731 732 return soc->ops->ctrl_ops->enable_peer_based_pktlog 733 (soc, pdev_id, peer_macaddr, enable); 734 } 735 736 /** 737 * cdp_calculate_delay_stats()- get rx delay stats 738 * @soc: pointer to the soc 739 * @vdev_id: id of vdev handle 740 * @nbuf: nbuf which is passed 741 * 742 * This function will calculate rx delay statistics. 743 */ 744 static inline QDF_STATUS 745 cdp_calculate_delay_stats(ol_txrx_soc_handle soc, uint8_t vdev_id, 746 qdf_nbuf_t nbuf) 747 { 748 if (!soc || !soc->ops) { 749 dp_cdp_debug("Invalid Instance:"); 750 QDF_BUG(0); 751 return QDF_STATUS_E_FAILURE; 752 } 753 754 if (!soc->ops->ctrl_ops || 755 !soc->ops->ctrl_ops->calculate_delay_stats) { 756 dp_cdp_debug("callback not registered:"); 757 return QDF_STATUS_E_FAILURE; 758 } 759 760 return soc->ops->ctrl_ops->calculate_delay_stats(soc, vdev_id, nbuf); 761 } 762 763 /** 764 * cdp_wdi_event_sub() - Subscribe to a specified WDI event. 765 * @soc: pointer to the soc 766 * @pdev_id: id of the data physical device object 767 * @event_cb_sub: the callback and context for the event subscriber 768 * @event: which event's notifications are being subscribed to 769 * 770 * This function adds the provided wdi_event_subscribe object to a list of 771 * subscribers for the specified WDI event. 772 * When the event in question happens, each subscriber for the event will 773 * have their callback function invoked. 774 * The order in which callback functions from multiple subscribers are 775 * invoked is unspecified. 776 * 777 * Return: int 778 */ 779 static inline int 780 cdp_wdi_event_sub(ol_txrx_soc_handle soc, uint8_t pdev_id, 781 wdi_event_subscribe *event_cb_sub, uint32_t event) 782 { 783 784 if (!soc || !soc->ops) { 785 dp_cdp_debug("invalid instance"); 786 QDF_BUG(0); 787 return 0; 788 } 789 790 if (!soc->ops->ctrl_ops || 791 !soc->ops->ctrl_ops->txrx_wdi_event_sub) 792 return 0; 793 794 return soc->ops->ctrl_ops->txrx_wdi_event_sub 795 (soc, pdev_id, event_cb_sub, event); 796 } 797 798 /** 799 * cdp_wdi_event_unsub() - Unsubscribe from a specified WDI event. 800 * @soc: pointer to the soc 801 * @pdev_id: id of the data physical device object 802 * @event_cb_sub: the callback and context for the event subscriber 803 * @event: which event's notifications are being subscribed to 804 * 805 * This function removes the provided event subscription object from the 806 * list of subscribers for its event. 807 * This function shall only be called if there was a successful prior call 808 * to cdp_wdi_event_sub() on the same wdi_event_subscribe object. 809 * 810 * Return: int 811 */ 812 static inline int 813 cdp_wdi_event_unsub(ol_txrx_soc_handle soc, 814 uint8_t pdev_id, wdi_event_subscribe *event_cb_sub, 815 uint32_t event) 816 { 817 818 if (!soc || !soc->ops) { 819 dp_cdp_debug("invalid instance"); 820 QDF_BUG(0); 821 return 0; 822 } 823 824 if (!soc->ops->ctrl_ops || 825 !soc->ops->ctrl_ops->txrx_wdi_event_unsub) 826 return 0; 827 828 return soc->ops->ctrl_ops->txrx_wdi_event_unsub 829 (soc, pdev_id, event_cb_sub, event); 830 } 831 832 /** 833 * cdp_get_sec_type() - Get security type from the from peer. 834 * @soc: pointer to the soc 835 * @vdev_id: id of vdev handle 836 * @peer_mac: peer mac address 837 * @sec_idx: mcast or ucast frame type. 838 * 839 * This function gets the Security information from the peer handler. 840 * The security information is got from the rx descriptor and filled in 841 * to the peer handler. 842 * 843 * Return: int 844 */ 845 static inline int 846 cdp_get_sec_type(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac, 847 uint8_t sec_idx) 848 { 849 if (!soc || !soc->ops) { 850 dp_cdp_debug("invalid instance"); 851 QDF_BUG(0); 852 return A_ERROR; 853 } 854 855 if (!soc->ops->ctrl_ops || 856 !soc->ops->ctrl_ops->txrx_get_sec_type) 857 return A_ERROR; 858 859 return soc->ops->ctrl_ops->txrx_get_sec_type 860 (soc, vdev_id, peer_mac, sec_idx); 861 } 862 863 /** 864 * cdp_set_mgmt_tx_power() - function to set tx power for mgmt frames 865 * @soc: pointer to the soc 866 * @vdev_id : id of vdev handle 867 * @subtype: subtype 868 * @tx_power: Tx power 869 * 870 * Return: QDF_STATUS 871 */ 872 static inline QDF_STATUS 873 cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc, 874 uint8_t vdev_id, uint8_t subtype, uint8_t tx_power) 875 { 876 if (!soc || !soc->ops) { 877 dp_cdp_debug("Invalid Instance:"); 878 QDF_BUG(0); 879 return QDF_STATUS_E_FAILURE; 880 } 881 882 if (!soc->ops->ctrl_ops || 883 !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev) 884 return QDF_STATUS_E_FAILURE; 885 886 return soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(soc, vdev_id, 887 subtype, tx_power); 888 } 889 890 /** 891 * cdp_get_pldev() - function to get pktlog device handle 892 * @soc: datapath soc handle 893 * @pdev_id: physical device id 894 * 895 * Return: pktlog device handle or NULL 896 */ 897 static inline void * 898 cdp_get_pldev(ol_txrx_soc_handle soc, uint8_t pdev_id) 899 { 900 if (!soc || !soc->ops) { 901 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 902 "%s invalid instance", __func__); 903 QDF_BUG(0); 904 return NULL; 905 } 906 907 if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_get_pldev) 908 return NULL; 909 910 return soc->ops->ctrl_ops->txrx_get_pldev(soc, pdev_id); 911 } 912 913 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE) 914 /** 915 * cdp_cfr_filter() - Configure Host RX monitor status ring for CFR 916 * @soc: SOC TXRX handle 917 * @pdev_id: ID of the physical device object 918 * @enable: Enable or disable CFR 919 * @filter_val: Flag to select filter for monitor mode 920 * @cfr_enable_monitor_mode: Flag to be enabled when scan radio is brought up 921 * in special vap mode 922 */ 923 static inline void 924 cdp_cfr_filter(ol_txrx_soc_handle soc, 925 uint8_t pdev_id, 926 bool enable, struct cdp_monitor_filter *filter_val, 927 bool cfr_enable_monitor_mode) 928 { 929 if (!soc || !soc->ops) { 930 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 931 "%s invalid instance", __func__); 932 QDF_BUG(0); 933 return; 934 } 935 936 if (!soc->ops->mon_ops || !soc->ops->mon_ops->txrx_cfr_filter) 937 return; 938 939 soc->ops->mon_ops->txrx_cfr_filter(soc, pdev_id, enable, filter_val, 940 cfr_enable_monitor_mode); 941 } 942 943 /** 944 * cdp_get_cfr_rcc() - get cfr rcc config 945 * @soc: Datapath soc handle 946 * @pdev_id: id of objmgr pdev 947 * 948 * Return: true/false based on cfr mode setting 949 */ 950 static inline 951 bool cdp_get_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id) 952 { 953 if (!soc || !soc->ops) { 954 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 955 "%s invalid instance", __func__); 956 QDF_BUG(0); 957 return 0; 958 } 959 960 if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_rcc) 961 return 0; 962 963 return soc->ops->cfr_ops->txrx_get_cfr_rcc(soc, pdev_id); 964 } 965 966 /** 967 * cdp_set_cfr_rcc() - enable/disable cfr rcc config 968 * @soc: Datapath soc handle 969 * @pdev_id: id of objmgr pdev 970 * @enable: Enable/Disable cfr rcc mode 971 * 972 * Return: none 973 */ 974 static inline 975 void cdp_set_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id, bool enable) 976 { 977 if (!soc || !soc->ops) { 978 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 979 "%s invalid instance", __func__); 980 QDF_BUG(0); 981 return; 982 } 983 984 if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_set_cfr_rcc) 985 return; 986 987 return soc->ops->cfr_ops->txrx_set_cfr_rcc(soc, pdev_id, enable); 988 } 989 990 /** 991 * cdp_get_cfr_dbg_stats() - Get debug statistics for CFR 992 * @soc: SOC TXRX handle 993 * @pdev_id: ID of the physical device object 994 * @buf: CFR RCC debug statistics buffer 995 * 996 * Return: None 997 */ 998 static inline void 999 cdp_get_cfr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id, 1000 struct cdp_cfr_rcc_stats *buf) 1001 { 1002 if (!soc || !soc->ops) { 1003 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 1004 "%s invalid instance", __func__); 1005 QDF_BUG(0); 1006 return; 1007 } 1008 1009 if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_dbg_stats) 1010 return; 1011 1012 soc->ops->cfr_ops->txrx_get_cfr_dbg_stats(soc, pdev_id, buf); 1013 } 1014 1015 /** 1016 * cdp_cfr_clr_dbg_stats() - Clear debug statistics for CFR 1017 * @soc: SOC TXRX handle 1018 * @pdev_id: ID of the physical device object 1019 */ 1020 static inline void 1021 cdp_cfr_clr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id) 1022 { 1023 if (!soc || !soc->ops) { 1024 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 1025 "%s invalid instance", __func__); 1026 QDF_BUG(0); 1027 return; 1028 } 1029 1030 if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats) 1031 return; 1032 1033 soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats(soc, pdev_id); 1034 } 1035 #endif 1036 1037 #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_RX_PKT_CAPTURE_ENH) 1038 /** 1039 * cdp_update_peer_pkt_capture_params() - Sets Rx & Tx Capture params for a peer 1040 * @soc: SOC TXRX handle 1041 * @pdev_id: id of CDP pdev pointer 1042 * @is_rx_pkt_cap_enable: enable/disable rx pkt capture for this peer 1043 * @is_tx_pkt_cap_enable: enable/disable tx pkt capture for this peer 1044 * @peer_mac: MAC address of peer for which pkt_cap is to be enabled/disabled 1045 * 1046 * Return: Success when matching peer is found & flags are set, error otherwise 1047 */ 1048 static inline QDF_STATUS 1049 cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc, 1050 uint8_t pdev_id, 1051 bool is_rx_pkt_cap_enable, 1052 uint8_t is_tx_pkt_cap_enable, 1053 uint8_t *peer_mac) 1054 { 1055 if (!soc || !soc->ops) { 1056 dp_err("Invalid SOC instance"); 1057 QDF_BUG(0); 1058 return QDF_STATUS_E_FAILURE; 1059 } 1060 1061 if (!soc->ops->ctrl_ops || 1062 !soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params) 1063 return QDF_STATUS_E_FAILURE; 1064 1065 return soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params 1066 (soc, pdev_id, is_rx_pkt_cap_enable, 1067 is_tx_pkt_cap_enable, peer_mac); 1068 } 1069 #endif /* WLAN_TX_PKT_CAPTURE_ENH || WLAN_RX_PKT_CAPTURE_ENH */ 1070 1071 #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG 1072 /** 1073 * cdp_update_pdev_rx_protocol_tag() - wrapper function to set the protocol 1074 * tag in CDP layer from cfg layer 1075 * @soc: SOC TXRX handle 1076 * @pdev_id: id of CDP pdev pointer 1077 * @protocol_mask: Bitmap for protocol for which tagging is enabled 1078 * @protocol_type: Protocol type for which the tag should be update 1079 * @tag: Actual tag value for the given prototype 1080 * Return: Returns QDF_STATUS_SUCCESS/FAILURE 1081 */ 1082 static inline QDF_STATUS 1083 cdp_update_pdev_rx_protocol_tag(ol_txrx_soc_handle soc, 1084 uint8_t pdev_id, uint32_t protocol_mask, 1085 uint16_t protocol_type, uint16_t tag) 1086 { 1087 if (!soc || !soc->ops) { 1088 dp_err("Invalid SOC instance"); 1089 QDF_BUG(0); 1090 return QDF_STATUS_E_FAILURE; 1091 } 1092 1093 if (!soc->ops->ctrl_ops || 1094 !soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag) 1095 return QDF_STATUS_E_FAILURE; 1096 1097 return soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag 1098 (soc, pdev_id, protocol_mask, protocol_type, tag); 1099 } 1100 1101 #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS 1102 /** 1103 * cdp_dump_pdev_rx_protocol_tag_stats() - wrapper function to dump the protocol 1104 * tag statistics for given or all protocols 1105 * @soc: SOC TXRX handle 1106 * @pdev_id: id of CDP pdev pointer 1107 * @protocol_type: Protocol type for which the tag should be update 1108 * 1109 * Return: Returns QDF_STATUS_SUCCESS/FAILURE 1110 */ 1111 static inline QDF_STATUS 1112 cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc, 1113 uint8_t pdev_id, 1114 uint16_t protocol_type) 1115 { 1116 if (!soc || !soc->ops) { 1117 dp_err("Invalid SOC instance"); 1118 QDF_BUG(0); 1119 return QDF_STATUS_E_FAILURE; 1120 } 1121 1122 if (!soc->ops->ctrl_ops || 1123 !soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats) 1124 return QDF_STATUS_E_FAILURE; 1125 1126 soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats(soc, pdev_id, 1127 protocol_type); 1128 return QDF_STATUS_SUCCESS; 1129 } 1130 #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */ 1131 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */ 1132 1133 #ifdef ATH_SUPPORT_NAC_RSSI 1134 /** 1135 * cdp_vdev_config_for_nac_rssi() - To invoke dp callback for nac rssi config 1136 * @soc: soc pointer 1137 * @vdev_id: id of vdev 1138 * @nac_cmd: specifies nac_rss config action add, del, list 1139 * @bssid: Neighbour bssid 1140 * @client_macaddr: Non-Associated client MAC 1141 * @chan_num: channel number to scan 1142 * 1143 * Return: QDF_STATUS 1144 */ 1145 static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc, 1146 uint8_t vdev_id, enum cdp_nac_param_cmd nac_cmd, 1147 char *bssid, char *client_macaddr, uint8_t chan_num) 1148 { 1149 if (!soc || !soc->ops) { 1150 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 1151 "%s invalid instance", __func__); 1152 QDF_BUG(0); 1153 return QDF_STATUS_E_FAILURE; 1154 } 1155 1156 if (!soc->ops->mon_ops || 1157 !soc->ops->mon_ops->txrx_vdev_config_for_nac_rssi) 1158 return QDF_STATUS_E_FAILURE; 1159 1160 return soc->ops->mon_ops->txrx_vdev_config_for_nac_rssi(soc, vdev_id, 1161 nac_cmd, bssid, client_macaddr, chan_num); 1162 } 1163 1164 /** 1165 * cdp_vdev_get_neighbour_rssi() - invoke dp callback to get rssi value of nac 1166 * @soc: soc pointer 1167 * @vdev_id: id of vdev 1168 * @macaddr: Non-Associated client MAC 1169 * @rssi: rssi 1170 * 1171 * Return: QDF_STATUS 1172 */ 1173 static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc, 1174 uint8_t vdev_id, 1175 char *macaddr, 1176 uint8_t *rssi) 1177 { 1178 if (!soc || !soc->ops) { 1179 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 1180 "%s invalid instance", __func__); 1181 QDF_BUG(0); 1182 return QDF_STATUS_E_FAILURE; 1183 } 1184 1185 if (!soc->ops->mon_ops || 1186 !soc->ops->mon_ops->txrx_vdev_get_neighbour_rssi) 1187 return QDF_STATUS_E_FAILURE; 1188 1189 return soc->ops->mon_ops->txrx_vdev_get_neighbour_rssi(soc, vdev_id, 1190 macaddr, 1191 rssi); 1192 } 1193 #endif 1194 1195 #ifdef WLAN_SUPPORT_RX_FLOW_TAG 1196 /** 1197 * cdp_set_rx_flow_tag() - wrapper function to set the flow 1198 * tag in CDP layer from cfg layer 1199 * @soc: SOC TXRX handle 1200 * @pdev_id: id of CDP pdev pointer 1201 * @flow_info: Flow 5-tuple, along with tag, if any, that needs to added/deleted 1202 * 1203 * Return: Success when add/del operation is successful, error otherwise 1204 */ 1205 static inline QDF_STATUS 1206 cdp_set_rx_flow_tag(ol_txrx_soc_handle soc, uint8_t pdev_id, 1207 struct cdp_rx_flow_info *flow_info) 1208 { 1209 if (!soc || !soc->ops) { 1210 dp_err("Invalid SOC instance"); 1211 QDF_BUG(0); 1212 return QDF_STATUS_E_FAILURE; 1213 } 1214 1215 if (!soc->ops->ctrl_ops || 1216 !soc->ops->ctrl_ops->txrx_set_rx_flow_tag) 1217 return QDF_STATUS_E_FAILURE; 1218 1219 return soc->ops->ctrl_ops->txrx_set_rx_flow_tag(soc, pdev_id, 1220 flow_info); 1221 } 1222 1223 /** 1224 * cdp_dump_rx_flow_tag_stats() - wrapper function to dump the flow 1225 * tag statistics for given flow 1226 * @soc: SOC TXRX handle 1227 * @pdev_id: id of CDP pdev 1228 * @flow_info: Flow tuple for which we want to print the statistics 1229 * 1230 * Return: Success when flow is found and stats are printed, error otherwise 1231 */ 1232 static inline QDF_STATUS 1233 cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, uint8_t pdev_id, 1234 struct cdp_rx_flow_info *flow_info) 1235 { 1236 if (!soc || !soc->ops) { 1237 dp_err("Invalid SOC instance"); 1238 QDF_BUG(0); 1239 return QDF_STATUS_E_FAILURE; 1240 } 1241 1242 if (!soc->ops->ctrl_ops || 1243 !soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats) 1244 return QDF_STATUS_E_FAILURE; 1245 1246 return soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats(soc, 1247 pdev_id, 1248 flow_info); 1249 } 1250 #endif /* WLAN_SUPPORT_RX_FLOW_TAG */ 1251 1252 /** 1253 * cdp_txrx_peer_flush_frags() - flush frags for peer 1254 * @soc: pointer to the soc 1255 * @vdev_id: vdev id 1256 * @peer_mac: peer MAC address 1257 * 1258 * Get peer-protocol-count drop-mask 1259 * 1260 * Return: peer-protocol-count drop-mask 1261 */ 1262 static inline 1263 void cdp_txrx_peer_flush_frags(ol_txrx_soc_handle soc, uint8_t vdev_id, 1264 uint8_t *peer_mac) 1265 { 1266 if (!soc || !soc->ops) { 1267 dp_cdp_err("Invalid Instance:"); 1268 QDF_BUG(0); 1269 return; 1270 } 1271 1272 if (!soc->ops->ctrl_ops || 1273 !soc->ops->ctrl_ops->txrx_peer_flush_frags) 1274 return; 1275 1276 return soc->ops->ctrl_ops->txrx_peer_flush_frags(soc, vdev_id, 1277 peer_mac); 1278 } 1279 1280 #if defined(WLAN_FEATURE_TSF_AUTO_REPORT) || defined(WLAN_CONFIG_TX_DELAY) 1281 /** 1282 * cdp_set_delta_tsf() - wrapper function to set delta_tsf 1283 * @soc: SOC TXRX handle 1284 * @vdev_id: vdev id 1285 * @delta_tsf: difference between TSF clock and qtimer 1286 * 1287 * Return: None 1288 */ 1289 static inline void cdp_set_delta_tsf(ol_txrx_soc_handle soc, uint8_t vdev_id, 1290 uint32_t delta_tsf) 1291 { 1292 if (!soc || !soc->ops) { 1293 dp_cdp_err("Invalid instance"); 1294 QDF_BUG(0); 1295 return; 1296 } 1297 1298 if (!soc->ops->ctrl_ops || 1299 !soc->ops->ctrl_ops->txrx_set_delta_tsf) 1300 return; 1301 1302 soc->ops->ctrl_ops->txrx_set_delta_tsf(soc, vdev_id, delta_tsf); 1303 } 1304 #endif 1305 #ifdef WLAN_FEATURE_TSF_UPLINK_DELAY 1306 /** 1307 * cdp_set_tsf_ul_delay_report() - Enable or disable reporting uplink delay 1308 * @soc: SOC TXRX handle 1309 * @vdev_id: vdev id 1310 * @enable: true to enable and false to disable 1311 * 1312 * Return: QDF_STATUS 1313 */ 1314 static inline QDF_STATUS cdp_set_tsf_ul_delay_report(ol_txrx_soc_handle soc, 1315 uint8_t vdev_id, 1316 bool enable) 1317 { 1318 if (!soc || !soc->ops) { 1319 dp_cdp_err("Invalid SOC instance"); 1320 QDF_BUG(0); 1321 return QDF_STATUS_E_FAILURE; 1322 } 1323 1324 if (!soc->ops->ctrl_ops || 1325 !soc->ops->ctrl_ops->txrx_set_tsf_ul_delay_report) 1326 return QDF_STATUS_E_FAILURE; 1327 1328 return soc->ops->ctrl_ops->txrx_set_tsf_ul_delay_report(soc, vdev_id, 1329 enable); 1330 } 1331 1332 /** 1333 * cdp_get_uplink_delay() - Get uplink delay value 1334 * @soc: SOC TXRX handle 1335 * @vdev_id: vdev id 1336 * @val: pointer to save uplink delay value 1337 * 1338 * Return: QDF_STATUS 1339 */ 1340 static inline QDF_STATUS cdp_get_uplink_delay(ol_txrx_soc_handle soc, 1341 uint32_t vdev_id, uint32_t *val) 1342 { 1343 if (!soc || !soc->ops) { 1344 dp_cdp_err("Invalid SOC instance"); 1345 QDF_BUG(0); 1346 return QDF_STATUS_E_FAILURE; 1347 } 1348 1349 if (!val) { 1350 dp_cdp_err("Invalid params val"); 1351 return QDF_STATUS_E_FAILURE; 1352 } 1353 1354 if (!soc->ops->ctrl_ops || 1355 !soc->ops->ctrl_ops->txrx_get_uplink_delay) 1356 return QDF_STATUS_E_FAILURE; 1357 1358 return soc->ops->ctrl_ops->txrx_get_uplink_delay(soc, vdev_id, val); 1359 } 1360 #endif /* WLAN_FEATURE_TSF_UPLINK_DELAY */ 1361 1362 #ifdef QCA_UNDECODED_METADATA_SUPPORT 1363 /** 1364 * cdp_txrx_set_pdev_phyrx_error_mask() - set phyrx error mask 1365 * @soc: opaque soc handle 1366 * @pdev_id: id of data path pdev handle 1367 * @mask: mask to configure 0 to 31 phy error 1368 * @mask_cont: mask to configure 32 to 63 phy error 1369 * 1370 * Return: status: 0 - Success, non-zero: Failure 1371 */ 1372 static inline 1373 QDF_STATUS cdp_txrx_set_pdev_phyrx_error_mask(ol_txrx_soc_handle soc, 1374 uint8_t pdev_id, uint32_t mask, 1375 uint32_t mask_cont) 1376 { 1377 if (!soc || !soc->ops) { 1378 dp_cdp_debug("Invalid Instance:"); 1379 QDF_BUG(0); 1380 return QDF_STATUS_E_FAILURE; 1381 } 1382 1383 if (!soc->ops->ctrl_ops || 1384 !soc->ops->ctrl_ops->txrx_set_pdev_phyrx_error_mask) 1385 return QDF_STATUS_E_FAILURE; 1386 1387 return soc->ops->ctrl_ops->txrx_set_pdev_phyrx_error_mask 1388 (soc, pdev_id, mask, mask_cont); 1389 } 1390 1391 static inline 1392 QDF_STATUS cdp_txrx_get_pdev_phyrx_error_mask(ol_txrx_soc_handle soc, 1393 uint8_t pdev_id, uint32_t *mask, 1394 uint32_t *mask_cont) 1395 { 1396 if (!soc || !soc->ops) { 1397 dp_cdp_debug("Invalid Instance:"); 1398 QDF_BUG(0); 1399 return QDF_STATUS_E_FAILURE; 1400 } 1401 1402 if (!soc->ops->ctrl_ops || 1403 !soc->ops->ctrl_ops->txrx_get_pdev_phyrx_error_mask) 1404 return QDF_STATUS_E_FAILURE; 1405 1406 return soc->ops->ctrl_ops->txrx_get_pdev_phyrx_error_mask 1407 (soc, pdev_id, mask, mask_cont); 1408 } 1409 #endif 1410 1411 #ifdef DP_UMAC_HW_RESET_SUPPORT 1412 /** 1413 * cdp_get_umac_reset_in_progress_state() - API to get the umac reset in 1414 * progress state 1415 * @soc: opaque soc handle 1416 * 1417 * Return: Umac reset in progress state 1418 */ 1419 static inline enum cdp_umac_reset_state 1420 cdp_get_umac_reset_in_progress_state(ol_txrx_soc_handle soc) 1421 { 1422 if (!soc || !soc->ops) { 1423 dp_cdp_debug("Invalid soc or soc->ops:"); 1424 return CDP_UMAC_RESET_INVALID_STATE; 1425 } 1426 1427 if (!soc->ops->ctrl_ops || 1428 !soc->ops->ctrl_ops->get_umac_reset_in_progress_state) 1429 return CDP_UMAC_RESET_INVALID_STATE; 1430 1431 return soc->ops->ctrl_ops->get_umac_reset_in_progress_state(soc); 1432 } 1433 1434 /** 1435 * cdp_umac_reset_is_inprogress() - API to check if umac reset is in progress 1436 * @soc: opaque soc handle 1437 * 1438 * Return: true if umac reset is in progress, else false. 1439 */ 1440 static inline bool 1441 cdp_umac_reset_is_inprogress(ol_txrx_soc_handle soc) 1442 { 1443 enum cdp_umac_reset_state state; 1444 1445 state = cdp_get_umac_reset_in_progress_state(soc); 1446 1447 if (state == CDP_UMAC_RESET_IN_PROGRESS || 1448 state == CDP_UMAC_RESET_IN_PROGRESS_DURING_BUFFER_WINDOW) 1449 return true; 1450 else 1451 return false; 1452 } 1453 #else 1454 static inline bool 1455 cdp_umac_reset_is_inprogress(ol_txrx_soc_handle soc) 1456 { 1457 return false; 1458 } 1459 #endif 1460 1461 #ifdef WLAN_SUPPORT_RX_FISA 1462 static inline 1463 QDF_STATUS cdp_txrx_fisa_config(struct cdp_soc_t *soc, uint8_t pdev_id, 1464 enum cdp_fisa_config_id config_id, 1465 union cdp_fisa_config *cfg) 1466 { 1467 if (!soc || !soc->ops) { 1468 dp_cdp_debug("Invalid Instance:"); 1469 QDF_BUG(0); 1470 return QDF_STATUS_E_FAILURE; 1471 } 1472 1473 if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_fisa_config) 1474 return QDF_STATUS_E_FAILURE; 1475 1476 return soc->ops->ctrl_ops->txrx_fisa_config(soc, pdev_id, config_id, 1477 cfg); 1478 } 1479 #endif 1480 #endif /* _CDP_TXRX_CTRL_H_ */ 1481