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