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