1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * @file cdp_txrx_ctrl.h 22 * @brief 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 * @brief update the neighbour peer addresses 71 * @details 72 * This defines interface function to update neighbour peers addresses 73 * which needs to be filtered 74 * 75 * @param soc - the pointer to soc object 76 * @param vdev_id - id of the pointer to vdev 77 * @param cmd - add/del entry into peer table 78 * @param macaddr - the address of neighbour peer 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->ctrl_ops || 92 !soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers) 93 return 0; 94 95 return soc->ops->ctrl_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 * @brief update the monitor buffer and status filter 102 * @details 103 * This defines interface function to set/reset monitor filter 104 * in case of special vap (scan radio) 105 * 106 * @param soc - the pointer to soc object 107 * @param vdev_id - id of the pointer to vdev 108 * @param cmd - add/del entry into peer table 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->ctrl_ops || 122 !soc->ops->ctrl_ops->txrx_update_mon_mac_filter) 123 return QDF_STATUS_E_FAILURE; 124 125 return soc->ops->ctrl_ops->txrx_update_mon_mac_filter 126 (soc, vdev_id, cmd); 127 } 128 129 #ifdef WLAN_SUPPORT_MSCS 130 /** 131 * @brief record the MSCS data and send it to the Data path 132 * @details 133 * This defines interface function to record the MSCS procedure 134 * based data parameters so that the data path layer can access it 135 * 136 * @param soc - the pointer to soc object 137 * @param vdev_id - id of the pointer to vdev 138 * @param macaddr - the address of neighbour peer 139 * @param mscs_params - Structure having MSCS params 140 * obtained from handshake 141 * @return - QDF_STATUS 142 */ 143 static inline QDF_STATUS 144 cdp_record_vdev_mscs_params(ol_txrx_soc_handle soc, uint8_t 145 *macaddr, uint8_t vdev_id, struct cdp_mscs_params *mscs_params, 146 bool active) 147 { 148 if (!soc || !soc->ops) { 149 dp_cdp_debug("Invalid Instance:"); 150 QDF_BUG(0); 151 return QDF_STATUS_E_FAILURE; 152 } 153 154 if (!soc->ops->ctrl_ops || 155 !soc->ops->ctrl_ops->txrx_record_mscs_params) 156 return QDF_STATUS_E_FAILURE; 157 return soc->ops->ctrl_ops->txrx_record_mscs_params 158 (soc, macaddr, vdev_id, mscs_params, active); 159 } 160 #endif 161 162 /** 163 * @brief set the Reo Destination ring for the pdev 164 * @details 165 * This will be used to configure the Reo Destination ring for this pdev. 166 * 167 * @param soc - pointer to the soc 168 * @param pdev_id - id of the data physical device object 169 * @param val - the Reo destination ring index (1 to 4) 170 * @return - QDF_STATUS 171 */ 172 static inline QDF_STATUS 173 cdp_set_pdev_reo_dest(ol_txrx_soc_handle soc, 174 uint8_t pdev_id, enum cdp_host_reo_dest_ring val) 175 { 176 if (!soc || !soc->ops) { 177 dp_cdp_debug("Invalid Instance:"); 178 QDF_BUG(0); 179 return QDF_STATUS_E_FAILURE; 180 } 181 182 if (!soc->ops->ctrl_ops || 183 !soc->ops->ctrl_ops->txrx_set_pdev_reo_dest) 184 return QDF_STATUS_E_FAILURE; 185 186 return soc->ops->ctrl_ops->txrx_set_pdev_reo_dest 187 (soc, pdev_id, val); 188 } 189 190 /** 191 * @brief get the Reo Destination ring for the pdev 192 * 193 * @param soc - pointer to the soc 194 * @param pdev_id - id of physical device object 195 * @return - the Reo destination ring index (1 to 4), 0 if not supported. 196 */ 197 static inline enum cdp_host_reo_dest_ring 198 cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, uint8_t pdev_id) 199 { 200 if (!soc || !soc->ops) { 201 dp_cdp_debug("Invalid Instance:"); 202 QDF_BUG(0); 203 return cdp_host_reo_dest_ring_unknown; 204 } 205 206 if (!soc->ops->ctrl_ops || 207 !soc->ops->ctrl_ops->txrx_get_pdev_reo_dest) 208 return cdp_host_reo_dest_ring_unknown; 209 210 return soc->ops->ctrl_ops->txrx_get_pdev_reo_dest(soc, pdev_id); 211 } 212 213 /* Is this similar to ol_txrx_peer_state_update() in MCL */ 214 /** 215 * @brief Update the authorize peer object at association time 216 * @details 217 * For the host-based implementation of rate-control, it 218 * updates the peer/node-related parameters within rate-control 219 * context of the peer at association. 220 * 221 * @param soc - pointer to the soc 222 * @param vdev_id - id of the pointer to vdev 223 * @param peer_mac - mac address of the node's object 224 * @authorize - either to authorize or unauthorize peer 225 * 226 * @return QDF_STATUS 227 */ 228 static inline QDF_STATUS 229 cdp_peer_authorize(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac, 230 u_int32_t authorize) 231 { 232 if (!soc || !soc->ops) { 233 dp_cdp_debug("Invalid Instance:"); 234 QDF_BUG(0); 235 return QDF_STATUS_E_FAILURE; 236 } 237 238 if (!soc->ops->ctrl_ops || 239 !soc->ops->ctrl_ops->txrx_peer_authorize) 240 return QDF_STATUS_E_FAILURE; 241 242 return soc->ops->ctrl_ops->txrx_peer_authorize 243 (soc, vdev_id, peer_mac, authorize); 244 } 245 246 /** 247 * cdp_peer_get_authorize Get per authorize status 248 * 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 * 406 * @soc - pointer to the soc 407 * @vdev - the data virtual device object 408 * @enable - enable per-peer protocol count 409 * 410 * Set per-peer protocol count feature enable 411 * 412 * Return: void 413 */ 414 static inline 415 void cdp_set_vdev_peer_protocol_count(ol_txrx_soc_handle soc, int8_t vdev_id, 416 bool enable) 417 { 418 if (!soc || !soc->ops) { 419 dp_cdp_debug("Invalid Instance:"); 420 QDF_BUG(0); 421 return; 422 } 423 424 if (!soc->ops->ctrl_ops || 425 !soc->ops->ctrl_ops->txrx_enable_peer_protocol_count) 426 return; 427 428 soc->ops->ctrl_ops->txrx_enable_peer_protocol_count(soc, vdev_id, 429 enable); 430 } 431 432 /** 433 * cdp_set_vdev_peer_protocol_drop_mask() - set per-peer protocol drop mask 434 * 435 * @soc - pointer to the soc 436 * @vdev - the data virtual device object 437 * @drop_mask - drop_mask 438 * 439 * Set per-peer protocol drop_mask 440 * 441 * Return - void 442 */ 443 static inline 444 void cdp_set_vdev_peer_protocol_drop_mask(ol_txrx_soc_handle soc, 445 int8_t vdev_id, int drop_mask) 446 { 447 if (!soc || !soc->ops) { 448 dp_cdp_debug("Invalid Instance:"); 449 QDF_BUG(0); 450 return; 451 } 452 453 if (!soc->ops->ctrl_ops || 454 !soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask) 455 return; 456 457 soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask(soc, vdev_id, 458 drop_mask); 459 } 460 461 /** 462 * cdp_is_vdev_peer_protocol_count_enabled() - whether peer-protocol tracking 463 * enabled 464 * 465 * @soc - pointer to the soc 466 * @vdev - the data virtual device object 467 * 468 * Get whether peer protocol count feature enabled or not 469 * 470 * Return: whether feature enabled or not 471 */ 472 static inline 473 int cdp_is_vdev_peer_protocol_count_enabled(ol_txrx_soc_handle soc, 474 int8_t vdev_id) 475 { 476 if (!soc || !soc->ops) { 477 dp_cdp_debug("Invalid Instance:"); 478 QDF_BUG(0); 479 return 0; 480 } 481 482 if (!soc->ops->ctrl_ops || 483 !soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled) 484 return 0; 485 486 return soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled(soc, 487 vdev_id); 488 } 489 490 /** 491 * cdp_get_peer_protocol_drop_mask() - get per-peer protocol count drop-mask 492 * 493 * @soc - pointer to the soc 494 * @vdev - the data virtual device object 495 * 496 * Get peer-protocol-count drop-mask 497 * 498 * Return: peer-protocol-count drop-mask 499 */ 500 static inline 501 int cdp_get_peer_protocol_drop_mask(ol_txrx_soc_handle soc, int8_t vdev_id) 502 { 503 if (!soc || !soc->ops) { 504 dp_cdp_debug("Invalid Instance:"); 505 QDF_BUG(0); 506 return 0; 507 } 508 509 if (!soc->ops->ctrl_ops || 510 !soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask) 511 return 0; 512 513 return soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask(soc, 514 vdev_id); 515 } 516 517 /* 518 * Rx-Ingress and Tx-Egress are in the lower level DP layer 519 * Rx-Egress and Tx-ingress are handled in osif layer for DP 520 * So 521 * Rx-Ingress and Tx-Egress definitions are in DP layer 522 * Rx-Egress and Tx-ingress mask definitions are here below 523 */ 524 #define VDEV_PEER_PROTOCOL_RX_INGRESS_MASK 1 525 #define VDEV_PEER_PROTOCOL_TX_INGRESS_MASK 2 526 #define VDEV_PEER_PROTOCOL_RX_EGRESS_MASK 4 527 #define VDEV_PEER_PROTOCOL_TX_EGRESS_MASK 8 528 529 #else 530 #define cdp_set_vdev_peer_protocol_count(soc, vdev_id, enable) 531 #define cdp_set_vdev_peer_protocol_drop_mask(soc, vdev_id, drop_mask) 532 #define cdp_is_vdev_peer_protocol_count_enabled(soc, vdev_id) 0 533 #define cdp_get_peer_protocol_drop_mask(soc, vdev_id) 0 534 #endif 535 536 /** 537 * cdp_txrx_set_pdev_param() - set pdev parameter 538 * @soc: opaque soc handle 539 * @pdev_id: id of data path pdev handle 540 * @type: param type 541 * @val: value 542 * 543 * Return: status: 0 - Success, non-zero: Failure 544 */ 545 static inline QDF_STATUS cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc, 546 uint8_t pdev_id, 547 enum cdp_pdev_param_type type, 548 cdp_config_param_type val) 549 { 550 if (!soc || !soc->ops) { 551 dp_cdp_debug("Invalid Instance:"); 552 QDF_BUG(0); 553 return QDF_STATUS_E_FAILURE; 554 } 555 556 if (!soc->ops->ctrl_ops || 557 !soc->ops->ctrl_ops->txrx_set_pdev_param) 558 return QDF_STATUS_E_FAILURE; 559 560 return soc->ops->ctrl_ops->txrx_set_pdev_param 561 (soc, pdev_id, type, val); 562 } 563 564 /** 565 * cdp_txrx_set_peer_param() - set pdev parameter 566 * @soc: opaque soc handle 567 * @vdev_id: id of data path vdev handle 568 * @peer_mac: peer mac address 569 * @type: param type 570 * @val: value 571 * 572 * Return: status: 0 - Success, non-zero: Failure 573 */ 574 static inline QDF_STATUS cdp_txrx_set_peer_param(ol_txrx_soc_handle soc, 575 uint8_t vdev_id, 576 uint8_t *peer_mac, 577 enum cdp_peer_param_type type, 578 cdp_config_param_type val) 579 { 580 if (!soc || !soc->ops) { 581 dp_cdp_debug("Invalid Instance:"); 582 QDF_BUG(0); 583 return QDF_STATUS_E_FAILURE; 584 } 585 586 if (!soc->ops->ctrl_ops || 587 !soc->ops->ctrl_ops->txrx_set_peer_param) 588 return QDF_STATUS_E_FAILURE; 589 590 return soc->ops->ctrl_ops->txrx_set_peer_param 591 (soc, vdev_id, peer_mac, type, val); 592 } 593 594 /** 595 * cdp_txrx_get_peer_param() - set pdev parameter 596 * @soc: opaque soc handle 597 * @vdev_id: id of data path vdev handle 598 * @peer_mac: peer mac address 599 * @type: param type 600 * @val: address of buffer 601 * 602 * Return: status 603 */ 604 static inline QDF_STATUS cdp_txrx_get_peer_param(ol_txrx_soc_handle soc, 605 uint8_t vdev_id, 606 uint8_t *peer_mac, 607 enum cdp_peer_param_type type, 608 cdp_config_param_type *val) 609 { 610 if (!soc || !soc->ops) { 611 dp_cdp_debug("Invalid Instance:"); 612 QDF_BUG(0); 613 return QDF_STATUS_E_FAILURE; 614 } 615 616 if (!soc->ops->ctrl_ops || 617 !soc->ops->ctrl_ops->txrx_get_peer_param) 618 return QDF_STATUS_E_FAILURE; 619 620 return soc->ops->ctrl_ops->txrx_get_peer_param 621 (soc, vdev_id, peer_mac, type, val); 622 } 623 624 #ifdef QCA_MULTIPASS_SUPPORT 625 static inline void 626 cdp_peer_set_vlan_id(ol_txrx_soc_handle soc, uint8_t vdev_id, 627 uint8_t *peer_mac, uint16_t vlan_id) 628 { 629 if (!soc || !soc->ops) { 630 dp_cdp_debug("Invalid Instance:"); 631 QDF_BUG(0); 632 return; 633 } 634 635 if (!soc->ops->ctrl_ops || 636 !soc->ops->ctrl_ops->txrx_peer_set_vlan_id) 637 return; 638 639 soc->ops->ctrl_ops->txrx_peer_set_vlan_id(soc, vdev_id, peer_mac, 640 vlan_id); 641 } 642 #endif 643 644 /** 645 * cdp_txrx_get_pdev_param() - get pdev parameter 646 * @soc: opaque soc handle 647 * @pdev_id: id of data path pdev handle 648 * @type: param type 649 * @value: address of value buffer 650 * 651 * Return: status 652 */ 653 static inline QDF_STATUS cdp_txrx_get_pdev_param(ol_txrx_soc_handle soc, 654 uint8_t pdev_id, 655 enum cdp_pdev_param_type type, 656 cdp_config_param_type *value) 657 { 658 if (!soc || !soc->ops) { 659 dp_cdp_debug("Invalid Instance:"); 660 QDF_BUG(0); 661 return QDF_STATUS_E_FAILURE; 662 } 663 664 if (!soc->ops->ctrl_ops || 665 !soc->ops->ctrl_ops->txrx_get_pdev_param) 666 return QDF_STATUS_E_FAILURE; 667 668 return soc->ops->ctrl_ops->txrx_get_pdev_param 669 (soc, pdev_id, type, value); 670 } 671 672 /** 673 * cdp_txrx_peer_protocol_cnt() - set peer protocol count 674 * @soc: opaque soc handle 675 * @vdev: opaque vdev handle 676 * @nbuf: data packet 677 * @is_egress: whether egress or ingress 678 * @is_rx: whether tx or rx 679 * 680 * Return: void 681 */ 682 #ifdef VDEV_PEER_PROTOCOL_COUNT 683 static inline void 684 cdp_txrx_peer_protocol_cnt(ol_txrx_soc_handle soc, 685 int8_t vdev_id, 686 qdf_nbuf_t nbuf, 687 enum vdev_peer_protocol_enter_exit is_egress, 688 enum vdev_peer_protocol_tx_rx is_rx) 689 { 690 if (!soc || !soc->ops) { 691 dp_cdp_debug("Invalid Instance:"); 692 QDF_BUG(0); 693 return; 694 } 695 696 if (!soc->ops->ctrl_ops || 697 !soc->ops->ctrl_ops->txrx_peer_protocol_cnt) 698 return; 699 700 soc->ops->ctrl_ops->txrx_peer_protocol_cnt(soc, vdev_id, nbuf, 701 is_egress, is_rx); 702 } 703 #else 704 #define cdp_txrx_peer_protocol_cnt(soc, vdev_id, nbuf, is_egress, is_rx) 705 #endif 706 707 /** 708 * cdp_enable_peer_based_pktlog()- Set flag in peer structure 709 * 710 * @soc: pointer to the soc 711 * @pdev_id: id of the data physical device object 712 * @enable: enable or disable peer based filter based pktlog 713 * @peer_macaddr: Mac address of peer which needs to be 714 * filtered 715 * 716 * This function will set flag in peer structure if peer based filtering 717 * is enabled for pktlog 718 * 719 * Return: int 720 */ 721 static inline int 722 cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc, uint8_t pdev_id, 723 char *peer_macaddr, 724 uint8_t enable) 725 { 726 if (!soc || !soc->ops) { 727 QDF_TRACE_ERROR(QDF_MODULE_ID_DP, 728 "%s invalid instance", __func__); 729 QDF_BUG(0); 730 return 0; 731 } 732 733 if (!soc->ops->ctrl_ops || 734 !soc->ops->ctrl_ops->enable_peer_based_pktlog) 735 return 0; 736 737 return soc->ops->ctrl_ops->enable_peer_based_pktlog 738 (soc, pdev_id, peer_macaddr, enable); 739 } 740 741 /** 742 * cdp_calculate_delay_stats()- get rx delay stats 743 * 744 * @soc: pointer to the soc 745 * @vdev_id: id of vdev handle 746 * @nbuf: nbuf which is passed 747 * 748 * This function will calculate rx delay statistics. 749 */ 750 static inline QDF_STATUS 751 cdp_calculate_delay_stats(ol_txrx_soc_handle soc, uint8_t vdev_id, 752 qdf_nbuf_t nbuf) 753 { 754 if (!soc || !soc->ops) { 755 dp_cdp_debug("Invalid Instance:"); 756 QDF_BUG(0); 757 return QDF_STATUS_E_FAILURE; 758 } 759 760 if (!soc->ops->ctrl_ops || 761 !soc->ops->ctrl_ops->calculate_delay_stats) { 762 dp_cdp_debug("callback not registered:"); 763 return QDF_STATUS_E_FAILURE; 764 } 765 766 return soc->ops->ctrl_ops->calculate_delay_stats(soc, vdev_id, nbuf); 767 } 768 769 /** 770 * @brief Subscribe to a specified WDI event. 771 * @details 772 * This function adds the provided wdi_event_subscribe object to a list of 773 * subscribers for the specified WDI event. 774 * When the event in question happens, each subscriber for the event will 775 * have their callback function invoked. 776 * The order in which callback functions from multiple subscribers are 777 * invoked is unspecified. 778 * 779 * @param soc - pointer to the soc 780 * @param pdev_id - id of the data physical device object 781 * @param event_cb_sub - the callback and context for the event subscriber 782 * @param event - which event's notifications are being subscribed to 783 * @return - int 784 */ 785 static inline int 786 cdp_wdi_event_sub(ol_txrx_soc_handle soc, uint8_t pdev_id, 787 wdi_event_subscribe *event_cb_sub, uint32_t event) 788 { 789 790 if (!soc || !soc->ops) { 791 dp_cdp_debug("invalid instance"); 792 QDF_BUG(0); 793 return 0; 794 } 795 796 if (!soc->ops->ctrl_ops || 797 !soc->ops->ctrl_ops->txrx_wdi_event_sub) 798 return 0; 799 800 return soc->ops->ctrl_ops->txrx_wdi_event_sub 801 (soc, pdev_id, event_cb_sub, event); 802 } 803 804 /** 805 * @brief Unsubscribe from a specified WDI event. 806 * @details 807 * This function removes the provided event subscription object from the 808 * list of subscribers for its event. 809 * This function shall only be called if there was a successful prior call 810 * to event_sub() on the same wdi_event_subscribe object. 811 * 812 * @param soc - pointer to the soc 813 * @param pdev_id - id of the data physical device object 814 * @param event_cb_sub - the callback and context for the event subscriber 815 * @param event - which event's notifications are being subscribed to 816 * @return - int 817 */ 818 static inline int 819 cdp_wdi_event_unsub(ol_txrx_soc_handle soc, 820 uint8_t pdev_id, wdi_event_subscribe *event_cb_sub, 821 uint32_t event) 822 { 823 824 if (!soc || !soc->ops) { 825 dp_cdp_debug("invalid instance"); 826 QDF_BUG(0); 827 return 0; 828 } 829 830 if (!soc->ops->ctrl_ops || 831 !soc->ops->ctrl_ops->txrx_wdi_event_unsub) 832 return 0; 833 834 return soc->ops->ctrl_ops->txrx_wdi_event_unsub 835 (soc, pdev_id, event_cb_sub, event); 836 } 837 838 /** 839 * @brief Get security type from the from peer. 840 * @details 841 * This function gets the Security information from the peer handler. 842 * The security information is got from the rx descriptor and filled in 843 * to the peer handler. 844 * 845 * @param soc - pointer to the soc 846 * @param vdev_id - id of vdev handle 847 * @param peer mac - peer mac address 848 * @param sec_idx - mcast or ucast frame type. 849 * @return - int 850 */ 851 static inline int 852 cdp_get_sec_type(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac, 853 uint8_t sec_idx) 854 { 855 if (!soc || !soc->ops) { 856 dp_cdp_debug("invalid instance"); 857 QDF_BUG(0); 858 return A_ERROR; 859 } 860 861 if (!soc->ops->ctrl_ops || 862 !soc->ops->ctrl_ops->txrx_get_sec_type) 863 return A_ERROR; 864 865 return soc->ops->ctrl_ops->txrx_get_sec_type 866 (soc, vdev_id, peer_mac, sec_idx); 867 } 868 869 /** 870 * cdp_set_mgmt_tx_power(): function to set tx power for mgmt frames 871 * @param soc - pointer to the soc 872 * @vdev_id : id of vdev handle 873 * @subtype_index: subtype 874 * @tx_power: Tx power 875 * Return: QDF_STATUS 876 */ 877 static inline QDF_STATUS 878 cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc, 879 uint8_t vdev_id, uint8_t subtype, uint8_t tx_power) 880 { 881 if (!soc || !soc->ops) { 882 dp_cdp_debug("Invalid Instance:"); 883 QDF_BUG(0); 884 return QDF_STATUS_E_FAILURE; 885 } 886 887 if (!soc->ops->ctrl_ops || 888 !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev) 889 return QDF_STATUS_E_FAILURE; 890 891 return soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(soc, vdev_id, 892 subtype, tx_power); 893 } 894 895 /** 896 * cdp_get_pldev() - function to get pktlog device handle 897 * @soc: datapath soc handle 898 * @pdev_id: physical device id 899 * 900 * Return: pktlog device handle or NULL 901 */ 902 static inline void * 903 cdp_get_pldev(ol_txrx_soc_handle soc, uint8_t pdev_id) 904 { 905 if (!soc || !soc->ops) { 906 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 907 "%s invalid instance", __func__); 908 QDF_BUG(0); 909 return NULL; 910 } 911 912 if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_get_pldev) 913 return NULL; 914 915 return soc->ops->ctrl_ops->txrx_get_pldev(soc, pdev_id); 916 } 917 918 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE) 919 /** 920 * cdp_cfr_filter() - Configure Host RX monitor status ring for CFR 921 * @soc: SOC TXRX handle 922 * @pdev_id: ID of the physical device object 923 * @enable: Enable or disable CFR 924 * @filter_val: Flag to select filter for monitor mode 925 * @cfr_enable_monitor_mode: Flag to be enabled when scan radio is brought up 926 * in special vap mode 927 */ 928 static inline void 929 cdp_cfr_filter(ol_txrx_soc_handle soc, 930 uint8_t pdev_id, 931 bool enable, struct cdp_monitor_filter *filter_val, 932 bool cfr_enable_monitor_mode) 933 { 934 if (!soc || !soc->ops) { 935 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 936 "%s invalid instance", __func__); 937 QDF_BUG(0); 938 return; 939 } 940 941 if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_cfr_filter) 942 return; 943 944 soc->ops->cfr_ops->txrx_cfr_filter(soc, pdev_id, enable, filter_val, 945 cfr_enable_monitor_mode); 946 } 947 948 /** 949 * cdp_get_cfr_rcc() - get cfr rcc config 950 * @soc: Datapath soc handle 951 * @pdev_id: id of objmgr pdev 952 * 953 * Return: true/false based on cfr mode setting 954 */ 955 static inline 956 bool cdp_get_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id) 957 { 958 if (!soc || !soc->ops) { 959 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 960 "%s invalid instance", __func__); 961 QDF_BUG(0); 962 return 0; 963 } 964 965 if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_rcc) 966 return 0; 967 968 return soc->ops->cfr_ops->txrx_get_cfr_rcc(soc, pdev_id); 969 } 970 971 /** 972 * cdp_set_cfr_rcc() - enable/disable cfr rcc config 973 * @soc: Datapath soc handle 974 * @pdev_id: id of objmgr pdev 975 * @enable: Enable/Disable cfr rcc mode 976 * 977 * Return: none 978 */ 979 static inline 980 void cdp_set_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id, bool enable) 981 { 982 if (!soc || !soc->ops) { 983 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 984 "%s invalid instance", __func__); 985 QDF_BUG(0); 986 return; 987 } 988 989 if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_set_cfr_rcc) 990 return; 991 992 return soc->ops->cfr_ops->txrx_set_cfr_rcc(soc, pdev_id, enable); 993 } 994 995 /** 996 * cdp_get_cfr_dbg_stats() - Get debug statistics for CFR 997 * 998 * @soc: SOC TXRX handle 999 * @pdev_id: ID of the physical device object 1000 * @buf: CFR RCC debug statistics buffer 1001 * 1002 * Return: None 1003 */ 1004 static inline void 1005 cdp_get_cfr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id, 1006 struct cdp_cfr_rcc_stats *buf) 1007 { 1008 if (!soc || !soc->ops) { 1009 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 1010 "%s invalid instance", __func__); 1011 QDF_BUG(0); 1012 return; 1013 } 1014 1015 if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_dbg_stats) 1016 return; 1017 1018 soc->ops->cfr_ops->txrx_get_cfr_dbg_stats(soc, pdev_id, buf); 1019 } 1020 1021 /** 1022 * cdp_cfr_clr_dbg_stats() - Clear debug statistics for CFR 1023 * 1024 * @soc: SOC TXRX handle 1025 * @pdev_id: ID of the physical device object 1026 */ 1027 static inline void 1028 cdp_cfr_clr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id) 1029 { 1030 if (!soc || !soc->ops) { 1031 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 1032 "%s invalid instance", __func__); 1033 QDF_BUG(0); 1034 return; 1035 } 1036 1037 if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats) 1038 return; 1039 1040 soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats(soc, pdev_id); 1041 } 1042 #endif 1043 1044 #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_RX_PKT_CAPTURE_ENH) 1045 /** 1046 * cdp_update_peer_pkt_capture_params() - Sets Rx & Tx Capture params for a peer 1047 * @soc: SOC TXRX handle 1048 * @pdev_id: id of CDP pdev pointer 1049 * @is_rx_pkt_cap_enable: enable/disable rx pkt capture for this peer 1050 * @is_tx_pkt_cap_enable: enable/disable tx pkt capture for this peer 1051 * @peer_mac: MAC address of peer for which pkt_cap is to be enabled/disabled 1052 * 1053 * Return: Success when matching peer is found & flags are set, error otherwise 1054 */ 1055 static inline QDF_STATUS 1056 cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc, 1057 uint8_t pdev_id, 1058 bool is_rx_pkt_cap_enable, 1059 uint8_t is_tx_pkt_cap_enable, 1060 uint8_t *peer_mac) 1061 { 1062 if (!soc || !soc->ops) { 1063 dp_err("Invalid SOC instance"); 1064 QDF_BUG(0); 1065 return QDF_STATUS_E_FAILURE; 1066 } 1067 1068 if (!soc->ops->ctrl_ops || 1069 !soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params) 1070 return QDF_STATUS_E_FAILURE; 1071 1072 return soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params 1073 (soc, pdev_id, is_rx_pkt_cap_enable, 1074 is_tx_pkt_cap_enable, peer_mac); 1075 } 1076 #endif /* WLAN_TX_PKT_CAPTURE_ENH || WLAN_RX_PKT_CAPTURE_ENH */ 1077 1078 #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG 1079 /** 1080 * cdp_update_pdev_rx_protocol_tag() - wrapper function to set the protocol 1081 * tag in CDP layer from cfg layer 1082 * @soc: SOC TXRX handle 1083 * @pdev_id: id of CDP pdev pointer 1084 * @protocol_mask: Bitmap for protocol for which tagging is enabled 1085 * @protocol_type: Protocol type for which the tag should be update 1086 * @tag: Actual tag value for the given prototype 1087 * Return: Returns QDF_STATUS_SUCCESS/FAILURE 1088 */ 1089 static inline QDF_STATUS 1090 cdp_update_pdev_rx_protocol_tag(ol_txrx_soc_handle soc, 1091 uint8_t pdev_id, uint32_t protocol_mask, 1092 uint16_t protocol_type, uint16_t tag) 1093 { 1094 if (!soc || !soc->ops) { 1095 dp_err("Invalid SOC instance"); 1096 QDF_BUG(0); 1097 return QDF_STATUS_E_FAILURE; 1098 } 1099 1100 if (!soc->ops->ctrl_ops || 1101 !soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag) 1102 return QDF_STATUS_E_FAILURE; 1103 1104 return soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag 1105 (soc, pdev_id, protocol_mask, protocol_type, tag); 1106 } 1107 1108 #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS 1109 /** 1110 * cdp_dump_pdev_rx_protocol_tag_stats() - wrapper function to dump the protocol 1111 tag statistics for given or all protocols 1112 * @soc: SOC TXRX handle 1113 * @pdev_id: id of CDP pdev pointer 1114 * @protocol_type: Protocol type for which the tag should be update 1115 * Return: Returns QDF_STATUS_SUCCESS/FAILURE 1116 */ 1117 static inline QDF_STATUS 1118 cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc, 1119 uint8_t pdev_id, 1120 uint16_t protocol_type) 1121 { 1122 if (!soc || !soc->ops) { 1123 dp_err("Invalid SOC instance"); 1124 QDF_BUG(0); 1125 return QDF_STATUS_E_FAILURE; 1126 } 1127 1128 if (!soc->ops->ctrl_ops || 1129 !soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats) 1130 return QDF_STATUS_E_FAILURE; 1131 1132 soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats(soc, pdev_id, 1133 protocol_type); 1134 return QDF_STATUS_SUCCESS; 1135 } 1136 #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */ 1137 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */ 1138 1139 #ifdef ATH_SUPPORT_NAC_RSSI 1140 /** 1141 * cdp_vdev_config_for_nac_rssi(): To invoke dp callback for nac rssi config 1142 * @soc: soc pointer 1143 * @vdev_id: id of vdev 1144 * @nac_cmd: specifies nac_rss config action add, del, list 1145 * @bssid: Neighbour bssid 1146 * @client_macaddr: Non-Associated client MAC 1147 * @chan_num: channel number to scan 1148 * 1149 * Return: QDF_STATUS 1150 */ 1151 static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc, 1152 uint8_t vdev_id, enum cdp_nac_param_cmd nac_cmd, 1153 char *bssid, char *client_macaddr, uint8_t chan_num) 1154 { 1155 if (!soc || !soc->ops) { 1156 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 1157 "%s invalid instance", __func__); 1158 QDF_BUG(0); 1159 return QDF_STATUS_E_FAILURE; 1160 } 1161 1162 if (!soc->ops->ctrl_ops || 1163 !soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi) 1164 return QDF_STATUS_E_FAILURE; 1165 1166 return soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi(soc, vdev_id, 1167 nac_cmd, bssid, client_macaddr, chan_num); 1168 } 1169 1170 /* 1171 * cdp_vdev_get_neighbour_rssi(): To invoke dp callback to get rssi value of nac 1172 * @soc: soc pointer 1173 * @vdev_id: id of vdev 1174 * @macaddr: Non-Associated client MAC 1175 * @rssi: rssi 1176 * 1177 * Return: QDF_STATUS 1178 */ 1179 static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc, 1180 uint8_t vdev_id, 1181 char *macaddr, 1182 uint8_t *rssi) 1183 { 1184 if (!soc || !soc->ops) { 1185 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 1186 "%s invalid instance", __func__); 1187 QDF_BUG(0); 1188 return QDF_STATUS_E_FAILURE; 1189 } 1190 1191 if (!soc->ops->ctrl_ops || 1192 !soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi) 1193 return QDF_STATUS_E_FAILURE; 1194 1195 return soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi(soc, vdev_id, 1196 macaddr, 1197 rssi); 1198 } 1199 #endif 1200 1201 #ifdef WLAN_SUPPORT_RX_FLOW_TAG 1202 /** 1203 * cdp_set_rx_flow_tag() - wrapper function to set the flow 1204 * tag in CDP layer from cfg layer 1205 * @soc: SOC TXRX handle 1206 * @pdev_id: id of CDP pdev pointer 1207 * @flow_info: Flow 5-tuple, along with tag, if any, that needs to added/deleted 1208 * 1209 * Return: Success when add/del operation is successful, error otherwise 1210 */ 1211 static inline QDF_STATUS 1212 cdp_set_rx_flow_tag(ol_txrx_soc_handle soc, uint8_t pdev_id, 1213 struct cdp_rx_flow_info *flow_info) 1214 { 1215 if (!soc || !soc->ops) { 1216 dp_err("Invalid SOC instance"); 1217 QDF_BUG(0); 1218 return QDF_STATUS_E_FAILURE; 1219 } 1220 1221 if (!soc->ops->ctrl_ops || 1222 !soc->ops->ctrl_ops->txrx_set_rx_flow_tag) 1223 return QDF_STATUS_E_FAILURE; 1224 1225 return soc->ops->ctrl_ops->txrx_set_rx_flow_tag(soc, pdev_id, 1226 flow_info); 1227 } 1228 1229 /** 1230 * cdp_dump_rx_flow_tag_stats() - wrapper function to dump the flow 1231 * tag statistics for given flow 1232 * @soc: SOC TXRX handle 1233 * @pdev_id: id of CDP pdev 1234 * @flow_info: Flow tuple for which we want to print the statistics 1235 * 1236 * Return: Success when flow is found and stats are printed, error otherwise 1237 */ 1238 static inline QDF_STATUS 1239 cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, uint8_t pdev_id, 1240 struct cdp_rx_flow_info *flow_info) 1241 { 1242 if (!soc || !soc->ops) { 1243 dp_err("Invalid SOC instance"); 1244 QDF_BUG(0); 1245 return QDF_STATUS_E_FAILURE; 1246 } 1247 1248 if (!soc->ops->ctrl_ops || 1249 !soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats) 1250 return QDF_STATUS_E_FAILURE; 1251 1252 return soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats(soc, 1253 pdev_id, 1254 flow_info); 1255 } 1256 #endif /* WLAN_SUPPORT_RX_FLOW_TAG */ 1257 1258 /** 1259 * cdp_txrx_peer_flush_frags() - flush frags for peer 1260 * 1261 * @soc - pointer to the soc 1262 * @vdev - the data virtual device object 1263 * 1264 * Get peer-protocol-count drop-mask 1265 * 1266 * Return: peer-protocol-count drop-mask 1267 */ 1268 static inline 1269 void cdp_txrx_peer_flush_frags(ol_txrx_soc_handle soc, uint8_t vdev_id, 1270 uint8_t *peer_mac) 1271 { 1272 if (!soc || !soc->ops) { 1273 dp_cdp_err("Invalid Instance:"); 1274 QDF_BUG(0); 1275 return; 1276 } 1277 1278 if (!soc->ops->ctrl_ops || 1279 !soc->ops->ctrl_ops->txrx_peer_flush_frags) 1280 return; 1281 1282 return soc->ops->ctrl_ops->txrx_peer_flush_frags(soc, vdev_id, 1283 peer_mac); 1284 } 1285 1286 #if defined(WLAN_FEATURE_TSF_UPLINK_DELAY) || defined(WLAN_CONFIG_TX_DELAY) 1287 /** 1288 * cdp_set_delta_tsf() - wrapper function to set delta_tsf 1289 * @soc: SOC TXRX handle 1290 * @vdev_id: vdev id 1291 * @delta_tsf: difference between TSF clock and qtimer 1292 * 1293 * Return: None 1294 */ 1295 static inline void cdp_set_delta_tsf(ol_txrx_soc_handle soc, uint8_t vdev_id, 1296 uint32_t delta_tsf) 1297 { 1298 if (!soc || !soc->ops) { 1299 dp_cdp_err("Invalid instance"); 1300 QDF_BUG(0); 1301 return; 1302 } 1303 1304 if (!soc->ops->ctrl_ops || 1305 !soc->ops->ctrl_ops->txrx_set_delta_tsf) 1306 return; 1307 1308 soc->ops->ctrl_ops->txrx_set_delta_tsf(soc, vdev_id, delta_tsf); 1309 } 1310 #endif 1311 #ifdef WLAN_FEATURE_TSF_UPLINK_DELAY 1312 /** 1313 * cdp_set_tsf_ul_delay_report() - Enable or disable reporting uplink delay 1314 * @soc: SOC TXRX handle 1315 * @vdev_id: vdev id 1316 * @enable: true to enable and false to disable 1317 * 1318 * Return: QDF_STATUS 1319 */ 1320 static inline QDF_STATUS cdp_set_tsf_ul_delay_report(ol_txrx_soc_handle soc, 1321 uint8_t vdev_id, 1322 bool enable) 1323 { 1324 if (!soc || !soc->ops) { 1325 dp_cdp_err("Invalid SOC instance"); 1326 QDF_BUG(0); 1327 return QDF_STATUS_E_FAILURE; 1328 } 1329 1330 if (!soc->ops->ctrl_ops || 1331 !soc->ops->ctrl_ops->txrx_set_tsf_ul_delay_report) 1332 return QDF_STATUS_E_FAILURE; 1333 1334 return soc->ops->ctrl_ops->txrx_set_tsf_ul_delay_report(soc, vdev_id, 1335 enable); 1336 } 1337 1338 /** 1339 * cdp_get_uplink_delay() - Get uplink delay value 1340 * @soc: SOC TXRX handle 1341 * @vdev_id: vdev id 1342 * @val: pointer to save uplink delay value 1343 * 1344 * Return: QDF_STATUS 1345 */ 1346 static inline QDF_STATUS cdp_get_uplink_delay(ol_txrx_soc_handle soc, 1347 uint32_t vdev_id, uint32_t *val) 1348 { 1349 if (!soc || !soc->ops) { 1350 dp_cdp_err("Invalid SOC instance"); 1351 QDF_BUG(0); 1352 return QDF_STATUS_E_FAILURE; 1353 } 1354 1355 if (!val) { 1356 dp_cdp_err("Invalid params val"); 1357 return QDF_STATUS_E_FAILURE; 1358 } 1359 1360 if (!soc->ops->ctrl_ops || 1361 !soc->ops->ctrl_ops->txrx_get_uplink_delay) 1362 return QDF_STATUS_E_FAILURE; 1363 1364 return soc->ops->ctrl_ops->txrx_get_uplink_delay(soc, vdev_id, val); 1365 } 1366 #endif /* WLAN_FEATURE_TSF_UPLINK_DELAY */ 1367 1368 #ifdef QCA_UNDECODED_METADATA_SUPPORT 1369 /** 1370 * cdp_txrx_set_pdev_phyrx_error_mask() - set phyrx error mask 1371 * @soc: opaque soc handle 1372 * @pdev_id: id of data path pdev handle 1373 * @mask1: mask to configure 0 to 31 phy error 1374 * @mask2: mask to configure 32 to 63 phy error 1375 * 1376 * Return: status: 0 - Success, non-zero: Failure 1377 */ 1378 static inline 1379 QDF_STATUS cdp_txrx_set_pdev_phyrx_error_mask(ol_txrx_soc_handle soc, 1380 uint8_t pdev_id, uint32_t mask, 1381 uint32_t mask_cont) 1382 { 1383 if (!soc || !soc->ops) { 1384 dp_cdp_debug("Invalid Instance:"); 1385 QDF_BUG(0); 1386 return QDF_STATUS_E_FAILURE; 1387 } 1388 1389 if (!soc->ops->ctrl_ops || 1390 !soc->ops->ctrl_ops->txrx_set_pdev_phyrx_error_mask) 1391 return QDF_STATUS_E_FAILURE; 1392 1393 return soc->ops->ctrl_ops->txrx_set_pdev_phyrx_error_mask 1394 (soc, pdev_id, mask, mask_cont); 1395 } 1396 1397 static inline 1398 QDF_STATUS cdp_txrx_get_pdev_phyrx_error_mask(ol_txrx_soc_handle soc, 1399 uint8_t pdev_id, uint32_t *mask, 1400 uint32_t *mask_cont) 1401 { 1402 if (!soc || !soc->ops) { 1403 dp_cdp_debug("Invalid Instance:"); 1404 QDF_BUG(0); 1405 return QDF_STATUS_E_FAILURE; 1406 } 1407 1408 if (!soc->ops->ctrl_ops || 1409 !soc->ops->ctrl_ops->txrx_get_pdev_phyrx_error_mask) 1410 return QDF_STATUS_E_FAILURE; 1411 1412 return soc->ops->ctrl_ops->txrx_get_pdev_phyrx_error_mask 1413 (soc, pdev_id, mask, mask_cont); 1414 } 1415 #endif 1416 1417 #endif /* _CDP_TXRX_CTRL_H_ */ 1418