1 /* 2 * Copyright (c) 2011-2019 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_cmn.h 21 * @brief Define the host data path converged API functions 22 * called by the host control SW and the OS interface module 23 */ 24 #ifndef _CDP_TXRX_CMN_H_ 25 #define _CDP_TXRX_CMN_H_ 26 27 #include "qdf_types.h" 28 #include "qdf_nbuf.h" 29 #include "cdp_txrx_ops.h" 30 #include "cdp_txrx_handle.h" 31 #include "cdp_txrx_cmn_struct.h" 32 33 #ifdef ENABLE_VERBOSE_DEBUG 34 extern bool is_dp_verbose_debug_enabled; 35 #endif 36 37 /****************************************************************************** 38 * 39 * Common Data Path Header File 40 * 41 *****************************************************************************/ 42 #define dp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP, params) 43 #define dp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params) 44 #define dp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP, params) 45 #define dp_info(params...) \ 46 __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params) 47 #define dp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params) 48 49 #ifdef DP_PRINT_NO_CONSOLE 50 #define dp_err_log(params...) \ 51 __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params) 52 #define dp_info_rl(params...) \ 53 __QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params) 54 #else 55 #define dp_err_log(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params) 56 #define dp_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_DP, params) 57 #endif /* DP_PRINT_NO_CONSOLE */ 58 59 #ifdef ENABLE_VERBOSE_DEBUG 60 /** 61 * @enum verbose_debug_module: 62 * if INI "enable_verbose_debug" has to set following bit positions to enable 63 * respective module's excessive logging, 64 * 65 * @hif_verbose_debug_mask: 1st bit [0th index] is for HIF module 66 * @hal_verbose_debug_mask: 2nd bit [1st index] is for HAL module 67 * @dp_verbose_debug_mask: 3rd bit [2nd index] is for DP module 68 */ 69 enum verbose_debug_module { 70 hif_vebose_debug_mask = 1 << 0, 71 hal_verbose_debug_mask = 1 << 1, 72 dp_verbose_debug_mask = 1 << 2, 73 }; 74 75 #define dp_verbose_debug(params...) \ 76 if (unlikely(is_dp_verbose_debug_enabled)) \ 77 do {\ 78 QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params); \ 79 } while (0) 80 #else 81 #define dp_verbose_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params) 82 #endif 83 84 #define dp_nofl_alert(params...) \ 85 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_DP, params) 86 #define dp_nofl_err(params...) \ 87 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_DP, params) 88 #define dp_nofl_warn(params...) \ 89 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_DP, params) 90 #define dp_nofl_info(params...) \ 91 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP, params) 92 #define dp_nofl_debug(params...) \ 93 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP, params) 94 95 #define dp_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_DP, params) 96 #define dp_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP, params) 97 #define dp_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_DP, params) 98 #define dp_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_DP, params) 99 100 /** 101 * @enum vdev_host_stats_id: 102 * host stats update from CDP have to set one of the following stats ID 103 * 104 * @DP_VDEV_STATS_PKT_CNT_ONLY: update Tx packet count only 105 * @DP_VDEV_STATS_TX_ME: update Tx ingress stats 106 */ 107 enum { 108 DP_VDEV_STATS_PKT_CNT_ONLY, 109 DP_VDEV_STATS_TX_ME, 110 }; 111 112 static inline QDF_STATUS 113 cdp_soc_attach_target(ol_txrx_soc_handle soc) 114 { 115 if (!soc || !soc->ops) { 116 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 117 "%s: Invalid Instance:", __func__); 118 QDF_BUG(0); 119 return QDF_STATUS_E_INVAL; 120 } 121 122 if (!soc->ops->cmn_drv_ops || 123 !soc->ops->cmn_drv_ops->txrx_soc_attach_target) 124 return QDF_STATUS_SUCCESS; 125 126 return soc->ops->cmn_drv_ops->txrx_soc_attach_target(soc); 127 128 } 129 130 static inline int 131 cdp_soc_get_nss_cfg(ol_txrx_soc_handle soc) 132 { 133 if (!soc || !soc->ops) { 134 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 135 "%s: Invalid Instance:", __func__); 136 QDF_BUG(0); 137 return 0; 138 } 139 140 if (!soc->ops->cmn_drv_ops || 141 !soc->ops->cmn_drv_ops->txrx_soc_get_nss_cfg) 142 return 0; 143 144 return soc->ops->cmn_drv_ops->txrx_soc_get_nss_cfg(soc); 145 } 146 147 static inline void 148 cdp_soc_set_nss_cfg(ol_txrx_soc_handle soc, uint32_t config) 149 { 150 if (!soc || !soc->ops) { 151 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 152 "%s: Invalid Instance:", __func__); 153 QDF_BUG(0); 154 return; 155 } 156 157 if (!soc->ops->cmn_drv_ops || 158 !soc->ops->cmn_drv_ops->txrx_soc_set_nss_cfg) 159 return; 160 161 soc->ops->cmn_drv_ops->txrx_soc_set_nss_cfg(soc, config); 162 } 163 164 static inline struct cdp_vdev * 165 cdp_vdev_attach(ol_txrx_soc_handle soc, uint8_t pdev_id, 166 uint8_t *vdev_mac_addr, uint8_t vdev_id, 167 enum wlan_op_mode op_mode, enum wlan_op_subtype subtype) 168 { 169 if (!soc || !soc->ops) { 170 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 171 "%s: Invalid Instance:", __func__); 172 QDF_BUG(0); 173 return NULL; 174 } 175 176 if (!soc->ops->cmn_drv_ops || 177 !soc->ops->cmn_drv_ops->txrx_vdev_attach) 178 return NULL; 179 180 return soc->ops->cmn_drv_ops->txrx_vdev_attach(soc, pdev_id, 181 vdev_mac_addr, vdev_id, 182 op_mode, subtype); 183 } 184 185 #ifdef DP_FLOW_CTL 186 /** 187 * cdp_flow_pool_map() - Create flow pool for vdev 188 * @soc: data path soc handle 189 * @pdev_id: id of dp pdev handle 190 * @vdev_id: vdev_id corresponding to vdev start 191 * 192 * Create per vdev flow pool. 193 * 194 * return none 195 */ 196 static inline QDF_STATUS cdp_flow_pool_map(ol_txrx_soc_handle soc, 197 uint8_t pdev_id, uint8_t vdev_id) 198 { 199 if (!soc || !soc->ops) { 200 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 201 "%s: Invalid Instance:", __func__); 202 QDF_BUG(0); 203 return QDF_STATUS_E_INVAL; 204 } 205 206 if (!soc->ops->flowctl_ops || 207 !soc->ops->flowctl_ops->flow_pool_map_handler) 208 return QDF_STATUS_E_INVAL; 209 210 return soc->ops->flowctl_ops->flow_pool_map_handler(soc, pdev_id, 211 vdev_id); 212 } 213 214 /** 215 * cdp_flow_pool_unmap() - Delete flow pool 216 * @soc: data path soc handle 217 * @pdev_id: id of dp pdev handle 218 * @vdev_id: vdev_id corresponding to vdev start 219 * 220 * Delete flow pool 221 * 222 * return none 223 */ 224 static inline void cdp_flow_pool_unmap(ol_txrx_soc_handle soc, 225 uint8_t pdev_id, uint8_t vdev_id) 226 { 227 if (!soc || !soc->ops) { 228 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 229 "%s: Invalid Instance:", __func__); 230 QDF_BUG(0); 231 return; 232 } 233 234 if (!soc->ops->flowctl_ops || 235 !soc->ops->flowctl_ops->flow_pool_unmap_handler) 236 return; 237 238 return soc->ops->flowctl_ops->flow_pool_unmap_handler(soc, pdev_id, 239 vdev_id); 240 } 241 #endif 242 243 static inline QDF_STATUS 244 cdp_vdev_detach(ol_txrx_soc_handle soc, uint8_t vdev_id, 245 ol_txrx_vdev_delete_cb callback, void *cb_context) 246 { 247 if (!soc || !soc->ops) { 248 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 249 "%s: Invalid Instance:", __func__); 250 QDF_BUG(0); 251 return QDF_STATUS_E_FAILURE; 252 } 253 254 if (!soc->ops->cmn_drv_ops || 255 !soc->ops->cmn_drv_ops->txrx_vdev_detach) 256 return QDF_STATUS_E_FAILURE; 257 258 return soc->ops->cmn_drv_ops->txrx_vdev_detach(soc, vdev_id, 259 callback, cb_context); 260 } 261 262 static inline int 263 cdp_pdev_attach_target(ol_txrx_soc_handle soc, uint8_t pdev_id) 264 { 265 if (!soc || !soc->ops) { 266 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 267 "%s: Invalid Instance:", __func__); 268 QDF_BUG(0); 269 return 0; 270 } 271 272 if (!soc->ops->cmn_drv_ops || 273 !soc->ops->cmn_drv_ops->txrx_pdev_attach_target) 274 return 0; 275 276 return soc->ops->cmn_drv_ops->txrx_pdev_attach_target(soc, pdev_id); 277 } 278 279 static inline struct cdp_pdev *cdp_pdev_attach 280 (ol_txrx_soc_handle soc, HTC_HANDLE htc_pdev, qdf_device_t osdev, 281 uint8_t pdev_id) 282 { 283 if (!soc || !soc->ops) { 284 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 285 "%s: Invalid Instance:", __func__); 286 QDF_BUG(0); 287 return NULL; 288 } 289 290 if (!soc->ops->cmn_drv_ops || 291 !soc->ops->cmn_drv_ops->txrx_pdev_attach) 292 return NULL; 293 294 return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, htc_pdev, osdev, 295 pdev_id); 296 } 297 298 /** 299 * cdp_pdev_post_attach() - attach the data SW state 300 * @soc: datapath soc handle 301 * @pdev_id: the data physical device id being removed 302 * 303 * This function is used when the WLAN driver is being loaded to 304 * attach the host data component within the driver. 305 * 306 * Return: 0 for success or error code 307 */ 308 static inline int cdp_pdev_post_attach(ol_txrx_soc_handle soc, uint8_t pdev_id) 309 { 310 if (!soc || !soc->ops) { 311 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 312 "%s: Invalid Instance:", __func__); 313 QDF_BUG(0); 314 return 0; 315 } 316 317 if (!soc->ops->cmn_drv_ops || 318 !soc->ops->cmn_drv_ops->txrx_pdev_post_attach) 319 return 0; 320 321 return soc->ops->cmn_drv_ops->txrx_pdev_post_attach(soc, pdev_id); 322 } 323 324 /** 325 * cdp_pdev_pre_detach() - detach the data SW state 326 * @soc: datapath soc handle 327 * @pdev_id: the data physical device id being removed 328 * @force: delete the pdev (and its vdevs and peers) even if 329 * there are outstanding references by the target to the vdevs 330 * and peers within the pdev 331 * 332 * This function is used when the WLAN driver is being removed to 333 * detach the host data component within the driver. 334 * 335 * Return: None 336 */ 337 static inline void 338 cdp_pdev_pre_detach(ol_txrx_soc_handle soc, uint8_t pdev_id, int force) 339 { 340 if (!soc || !soc->ops) { 341 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 342 "%s: Invalid Instance:", __func__); 343 QDF_BUG(0); 344 return; 345 } 346 347 if (!soc->ops->cmn_drv_ops || 348 !soc->ops->cmn_drv_ops->txrx_pdev_pre_detach) 349 return; 350 351 soc->ops->cmn_drv_ops->txrx_pdev_pre_detach(soc, pdev_id, force); 352 } 353 354 static inline QDF_STATUS 355 cdp_pdev_detach(ol_txrx_soc_handle soc, uint8_t pdev_id, int force) 356 { 357 if (!soc || !soc->ops) { 358 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 359 "%s: Invalid Instance:", __func__); 360 QDF_BUG(0); 361 return QDF_STATUS_E_FAILURE; 362 } 363 364 if (!soc->ops->cmn_drv_ops || 365 !soc->ops->cmn_drv_ops->txrx_pdev_detach) 366 return QDF_STATUS_E_FAILURE; 367 368 return soc->ops->cmn_drv_ops->txrx_pdev_detach(soc, pdev_id, force); 369 } 370 371 static inline void 372 cdp_pdev_deinit(ol_txrx_soc_handle soc, uint8_t pdev_id, int force) 373 { 374 if (!soc || !soc->ops) { 375 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 376 "%s: Invalid Instance:", __func__); 377 QDF_BUG(0); 378 return; 379 } 380 381 if (!soc->ops->cmn_drv_ops || 382 !soc->ops->cmn_drv_ops->txrx_pdev_deinit) 383 return; 384 385 soc->ops->cmn_drv_ops->txrx_pdev_deinit(soc, pdev_id, force); 386 } 387 388 static inline void *cdp_peer_create 389 (ol_txrx_soc_handle soc, uint8_t vdev_id, 390 uint8_t *peer_mac_addr) 391 { 392 if (!soc || !soc->ops) { 393 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 394 "%s: Invalid Instance:", __func__); 395 QDF_BUG(0); 396 return NULL; 397 } 398 399 if (!soc->ops->cmn_drv_ops || 400 !soc->ops->cmn_drv_ops->txrx_peer_create) 401 return NULL; 402 403 return soc->ops->cmn_drv_ops->txrx_peer_create(soc, vdev_id, 404 peer_mac_addr); 405 } 406 407 static inline void cdp_peer_setup 408 (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac) 409 { 410 if (!soc || !soc->ops) { 411 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 412 "%s: Invalid Instance:", __func__); 413 QDF_BUG(0); 414 return; 415 } 416 417 if (!soc->ops->cmn_drv_ops || 418 !soc->ops->cmn_drv_ops->txrx_peer_setup) 419 return; 420 421 soc->ops->cmn_drv_ops->txrx_peer_setup(soc, vdev_id, 422 peer_mac); 423 } 424 425 /* 426 * cdp_cp_peer_del_response - Call the peer delete response handler 427 * @soc: Datapath SOC handle 428 * @vdev_id: id of virtual device object 429 * @peer_mac_addr: Mac address of the peer 430 * 431 * Return: void 432 */ 433 static inline QDF_STATUS cdp_cp_peer_del_response 434 (ol_txrx_soc_handle soc, 435 uint8_t vdev_id, 436 uint8_t *peer_mac_addr) 437 { 438 if (!soc || !soc->ops) { 439 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 440 "%s: Invalid Instance:", __func__); 441 QDF_BUG(0); 442 return QDF_STATUS_E_FAILURE; 443 } 444 445 if (!soc->ops->cmn_drv_ops || 446 !soc->ops->cmn_drv_ops->txrx_cp_peer_del_response) 447 return QDF_STATUS_E_FAILURE; 448 449 return soc->ops->cmn_drv_ops->txrx_cp_peer_del_response(soc, 450 vdev_id, 451 peer_mac_addr); 452 } 453 /** 454 * cdp_peer_get_ast_info_by_soc() - search the soc AST hash table 455 * and return ast entry information 456 * of first ast entry found in the 457 * table with given mac address 458 * 459 * @soc - data path soc handle 460 * @ast_mac_addr - AST entry mac address 461 * @ast_entry_info - ast entry information 462 * 463 * return - true if ast entry found with ast_mac_addr 464 * false if ast entry not found 465 */ 466 static inline bool cdp_peer_get_ast_info_by_soc 467 (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr, 468 struct cdp_ast_entry_info *ast_entry_info) 469 { 470 if (!soc || !soc->ops) { 471 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 472 "%s: Invalid Instance:", __func__); 473 QDF_BUG(0); 474 return false; 475 } 476 477 if (!soc->ops->cmn_drv_ops || 478 !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc) 479 return false; 480 481 return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc 482 (soc, ast_mac_addr, 483 ast_entry_info); 484 } 485 486 /** 487 * cdp_peer_get_ast_info_by_pdev() - search the soc AST hash table 488 * and return ast entry information 489 * if mac address and pdev_id matches 490 * 491 * @soc - data path soc handle 492 * @ast_mac_addr - AST entry mac address 493 * @pdev_id - pdev_id 494 * @ast_entry_info - ast entry information 495 * 496 * return - true if ast entry found with ast_mac_addr 497 * false if ast entry not found 498 */ 499 static inline bool cdp_peer_get_ast_info_by_pdev 500 (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr, 501 uint8_t pdev_id, 502 struct cdp_ast_entry_info *ast_entry_info) 503 { 504 if (!soc || !soc->ops) { 505 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 506 "%s: Invalid Instance:", __func__); 507 QDF_BUG(0); 508 return false; 509 } 510 511 if (!soc->ops->cmn_drv_ops || 512 !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev) 513 return false; 514 515 return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev 516 (soc, 517 ast_mac_addr, 518 pdev_id, 519 ast_entry_info); 520 } 521 522 /** 523 * cdp_peer_ast_delete_by_soc() - delete the ast entry from soc AST hash table 524 * with given mac address 525 * 526 * @soc - data path soc handle 527 * @ast_mac_addr - AST entry mac address 528 * @callback - callback function to called on ast delete response from FW 529 * @cookie - argument to be passed to callback 530 * 531 * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete 532 * is sent 533 * QDF_STATUS_E_INVAL false if ast entry not found 534 */ 535 static inline QDF_STATUS cdp_peer_ast_delete_by_soc 536 (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr, 537 txrx_ast_free_cb callback, 538 void *cookie) 539 { 540 if (!soc || !soc->ops) { 541 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 542 "%s: Invalid Instance:", __func__); 543 QDF_BUG(0); 544 return QDF_STATUS_E_INVAL; 545 } 546 547 if (!soc->ops->cmn_drv_ops || 548 !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc) 549 return QDF_STATUS_E_INVAL; 550 551 return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc 552 (soc, 553 ast_mac_addr, 554 callback, 555 cookie); 556 } 557 558 /** 559 * cdp_peer_ast_delete_by_pdev() - delete the ast entry from soc AST hash table 560 * if mac address and pdev_id matches 561 * 562 * @soc - data path soc handle 563 * @ast_mac_addr - AST entry mac address 564 * @pdev_id - pdev id 565 * @callback - callback function to called on ast delete response from FW 566 * @cookie - argument to be passed to callback 567 * 568 * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete 569 * is sent 570 * QDF_STATUS_E_INVAL false if ast entry not found 571 */ 572 static inline QDF_STATUS cdp_peer_ast_delete_by_pdev 573 (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr, 574 uint8_t pdev_id, txrx_ast_free_cb callback, 575 void *cookie) 576 { 577 if (!soc || !soc->ops) { 578 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 579 "%s: Invalid Instance:", __func__); 580 QDF_BUG(0); 581 return QDF_STATUS_E_INVAL; 582 } 583 584 if (!soc->ops->cmn_drv_ops || 585 !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev) 586 return QDF_STATUS_E_INVAL; 587 588 return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev 589 (soc, 590 ast_mac_addr, 591 pdev_id, 592 callback, 593 cookie); 594 } 595 596 static inline int cdp_peer_add_ast 597 (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac, 598 uint8_t *mac_addr, 599 enum cdp_txrx_ast_entry_type type, uint32_t flags) 600 { 601 if (!soc || !soc->ops) { 602 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 603 "%s: Invalid Instance:", __func__); 604 QDF_BUG(0); 605 return 0; 606 } 607 608 if (!soc->ops->cmn_drv_ops || 609 !soc->ops->cmn_drv_ops->txrx_peer_add_ast) 610 return 0; 611 612 return soc->ops->cmn_drv_ops->txrx_peer_add_ast(soc, 613 vdev_id, 614 peer_mac, 615 mac_addr, 616 type, 617 flags); 618 } 619 620 static inline QDF_STATUS cdp_peer_reset_ast 621 (ol_txrx_soc_handle soc, uint8_t *wds_macaddr, uint8_t *peer_macaddr, 622 uint8_t vdev_id) 623 { 624 625 if (!soc || !soc->ops) { 626 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 627 "%s: Invalid Instance:", __func__); 628 QDF_BUG(0); 629 return QDF_STATUS_E_FAILURE; 630 } 631 if (!soc->ops->cmn_drv_ops || 632 !soc->ops->cmn_drv_ops->txrx_peer_reset_ast) 633 return QDF_STATUS_E_FAILURE; 634 635 return soc->ops->cmn_drv_ops->txrx_peer_reset_ast(soc, wds_macaddr, 636 peer_macaddr, vdev_id); 637 } 638 639 static inline QDF_STATUS cdp_peer_reset_ast_table 640 (ol_txrx_soc_handle soc, uint8_t vdev_id) 641 { 642 if (!soc || !soc->ops) { 643 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 644 "%s: Invalid Instance:", __func__); 645 QDF_BUG(0); 646 return QDF_STATUS_E_FAILURE; 647 } 648 649 if (!soc->ops->cmn_drv_ops || 650 !soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table) 651 return QDF_STATUS_E_FAILURE; 652 653 return soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table(soc, vdev_id); 654 } 655 656 static inline void cdp_peer_flush_ast_table 657 (ol_txrx_soc_handle soc) 658 { 659 if (!soc || !soc->ops) { 660 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 661 "%s: Invalid Instance:", __func__); 662 QDF_BUG(0); 663 return; 664 } 665 666 if (!soc->ops->cmn_drv_ops || 667 !soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table) 668 return; 669 670 soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table(soc); 671 } 672 673 static inline int cdp_peer_update_ast 674 (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac, 675 uint8_t *wds_macaddr, uint32_t flags) 676 { 677 if (!soc || !soc->ops) { 678 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 679 "%s: Invalid Instance:", __func__); 680 QDF_BUG(0); 681 return 0; 682 } 683 684 if (!soc->ops->cmn_drv_ops || 685 !soc->ops->cmn_drv_ops->txrx_peer_update_ast) 686 return 0; 687 688 689 return soc->ops->cmn_drv_ops->txrx_peer_update_ast(soc, 690 vdev_id, 691 peer_mac, 692 wds_macaddr, 693 flags); 694 } 695 696 static inline void cdp_peer_teardown 697 (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac) 698 { 699 if (!soc || !soc->ops) { 700 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 701 "%s: Invalid Instance:", __func__); 702 QDF_BUG(0); 703 return; 704 } 705 706 if (!soc->ops->cmn_drv_ops || 707 !soc->ops->cmn_drv_ops->txrx_peer_teardown) 708 return; 709 710 soc->ops->cmn_drv_ops->txrx_peer_teardown(soc, vdev_id, peer_mac); 711 } 712 713 static inline void 714 cdp_peer_delete(ol_txrx_soc_handle soc, uint8_t vdev_id, 715 uint8_t *peer_mac, uint32_t bitmap) 716 { 717 if (!soc || !soc->ops) { 718 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 719 "%s: Invalid Instance:", __func__); 720 QDF_BUG(0); 721 return; 722 } 723 724 if (!soc->ops->cmn_drv_ops || 725 !soc->ops->cmn_drv_ops->txrx_peer_delete) 726 return; 727 728 soc->ops->cmn_drv_ops->txrx_peer_delete(soc, vdev_id, peer_mac, bitmap); 729 } 730 731 /** 732 * cdp_peer_detach_sync() - peer detach sync callback 733 * @soc: datapath soc handle 734 * @vdev_id: virtual device/interface id 735 * @peer_mac: peer mac address 736 * @peer_unmap_sync: peer unmap sync cb. 737 * @bitmap: bitmap indicating special handling of request. 738 * 739 * Return: None 740 */ 741 static inline void 742 cdp_peer_delete_sync(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac, 743 QDF_STATUS(*delete_cb)( 744 uint8_t vdev_id, 745 uint32_t peerid_cnt, 746 uint16_t *peerid_list), 747 uint32_t bitmap) 748 { 749 if (!soc || !soc->ops) { 750 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 751 "%s: Invalid Instance:", __func__); 752 QDF_BUG(0); 753 return; 754 } 755 756 if (!soc->ops->cmn_drv_ops || 757 !soc->ops->cmn_drv_ops->txrx_peer_delete_sync) 758 return; 759 760 soc->ops->cmn_drv_ops->txrx_peer_delete_sync(soc, vdev_id, peer_mac, 761 delete_cb, 762 bitmap); 763 } 764 765 static inline int 766 cdp_set_monitor_mode(ol_txrx_soc_handle soc, uint8_t vdev_id, 767 uint8_t smart_monitor) 768 { 769 if (!soc || !soc->ops) { 770 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 771 "%s: Invalid Instance:", __func__); 772 QDF_BUG(0); 773 return 0; 774 } 775 776 if (!soc->ops->cmn_drv_ops || 777 !soc->ops->cmn_drv_ops->txrx_set_monitor_mode) 778 return 0; 779 780 return soc->ops->cmn_drv_ops->txrx_set_monitor_mode(soc, vdev_id, 781 smart_monitor); 782 } 783 784 static inline QDF_STATUS 785 cdp_set_curchan(ol_txrx_soc_handle soc, 786 uint8_t pdev_id, 787 uint32_t chan_mhz) 788 { 789 if (!soc || !soc->ops) { 790 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 791 "%s: Invalid Instance:", __func__); 792 QDF_BUG(0); 793 return QDF_STATUS_E_FAILURE; 794 } 795 796 if (!soc->ops->cmn_drv_ops || 797 !soc->ops->cmn_drv_ops->txrx_set_curchan) 798 return QDF_STATUS_E_FAILURE; 799 800 return soc->ops->cmn_drv_ops->txrx_set_curchan(soc, pdev_id, chan_mhz); 801 } 802 803 static inline QDF_STATUS 804 cdp_set_privacy_filters(ol_txrx_soc_handle soc, uint8_t vdev_id, 805 void *filter, uint32_t num) 806 { 807 if (!soc || !soc->ops) { 808 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 809 "%s: Invalid Instance:", __func__); 810 QDF_BUG(0); 811 return QDF_STATUS_E_FAILURE; 812 } 813 814 if (!soc->ops->cmn_drv_ops || 815 !soc->ops->cmn_drv_ops->txrx_set_privacy_filters) 816 return QDF_STATUS_E_FAILURE; 817 818 return soc->ops->cmn_drv_ops->txrx_set_privacy_filters(soc, vdev_id, 819 filter, num); 820 } 821 822 static inline int 823 cdp_set_monitor_filter(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, 824 struct cdp_monitor_filter *filter_val) 825 { 826 if (soc->ops->mon_ops->txrx_set_advance_monitor_filter) 827 return soc->ops->mon_ops->txrx_set_advance_monitor_filter(pdev, 828 filter_val); 829 return 0; 830 } 831 832 833 /****************************************************************************** 834 * Data Interface (B Interface) 835 *****************************************************************************/ 836 static inline void 837 cdp_vdev_register(ol_txrx_soc_handle soc, uint8_t vdev_id, 838 ol_osif_vdev_handle osif_vdev, 839 struct ol_txrx_ops *txrx_ops) 840 { 841 if (!soc || !soc->ops) { 842 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 843 "%s: Invalid Instance:", __func__); 844 QDF_BUG(0); 845 return; 846 } 847 848 if (!soc->ops->cmn_drv_ops || 849 !soc->ops->cmn_drv_ops->txrx_vdev_register) 850 return; 851 852 soc->ops->cmn_drv_ops->txrx_vdev_register(soc, vdev_id, 853 osif_vdev, txrx_ops); 854 } 855 856 static inline int 857 cdp_mgmt_send(ol_txrx_soc_handle soc, uint8_t vdev_id, 858 qdf_nbuf_t tx_mgmt_frm, uint8_t type) 859 { 860 if (!soc || !soc->ops) { 861 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 862 "%s: Invalid Instance:", __func__); 863 QDF_BUG(0); 864 return 0; 865 } 866 867 if (!soc->ops->cmn_drv_ops || 868 !soc->ops->cmn_drv_ops->txrx_mgmt_send) 869 return 0; 870 871 return soc->ops->cmn_drv_ops->txrx_mgmt_send(soc, vdev_id, 872 tx_mgmt_frm, type); 873 } 874 875 static inline int 876 cdp_mgmt_send_ext(ol_txrx_soc_handle soc, uint8_t vdev_id, 877 qdf_nbuf_t tx_mgmt_frm, uint8_t type, 878 uint8_t use_6mbps, uint16_t chanfreq) 879 { 880 if (!soc || !soc->ops) { 881 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 882 "%s: Invalid Instance:", __func__); 883 QDF_BUG(0); 884 return 0; 885 } 886 887 if (!soc->ops->cmn_drv_ops || 888 !soc->ops->cmn_drv_ops->txrx_mgmt_send_ext) 889 return 0; 890 891 return soc->ops->cmn_drv_ops->txrx_mgmt_send_ext 892 (soc, vdev_id, tx_mgmt_frm, type, use_6mbps, chanfreq); 893 } 894 895 896 static inline QDF_STATUS 897 cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc, uint8_t pdev_id, 898 uint8_t type, ol_txrx_mgmt_tx_cb download_cb, 899 ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt) 900 { 901 if (!soc || !soc->ops) { 902 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 903 "%s: Invalid Instance:", __func__); 904 QDF_BUG(0); 905 return QDF_STATUS_E_FAILURE; 906 } 907 908 if (!soc->ops->cmn_drv_ops || 909 !soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set) 910 return QDF_STATUS_E_FAILURE; 911 912 return soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set 913 (soc, pdev_id, type, download_cb, ota_ack_cb, ctxt); 914 } 915 916 /** 917 * cdp_peer_unmap_sync_cb_set() - set peer unmap sync callback 918 * @soc: datapath soc handle 919 * @pdev_id: physical device instance id 920 * @peer_unmap_sync: peer unmap sync callback 921 * 922 * Return: None 923 */ 924 static inline void 925 cdp_peer_unmap_sync_cb_set(ol_txrx_soc_handle soc, 926 uint8_t pdev_id, 927 QDF_STATUS(*unmap_resp_cb)( 928 uint8_t vdev_id, 929 uint32_t peerid_cnt, 930 uint16_t *peerid_list)) 931 { 932 if (!soc || !soc->ops) { 933 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 934 "%s: Invalid Instance:", __func__); 935 QDF_BUG(0); 936 return; 937 } 938 939 if (!soc->ops->cmn_drv_ops || 940 !soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set) 941 return; 942 943 soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set(soc, pdev_id, 944 unmap_resp_cb); 945 } 946 947 static inline int cdp_get_tx_pending(ol_txrx_soc_handle soc, 948 struct cdp_pdev *pdev) 949 { 950 if (!soc || !soc->ops) { 951 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 952 "%s: Invalid Instance:", __func__); 953 QDF_BUG(0); 954 return 0; 955 } 956 957 if (!soc->ops->cmn_drv_ops || 958 !soc->ops->cmn_drv_ops->txrx_get_tx_pending) 959 return 0; 960 961 962 return soc->ops->cmn_drv_ops->txrx_get_tx_pending(pdev); 963 } 964 965 /* 966 * cdp_data_tx_cb_set(): set the callback for non standard tx 967 * @soc - datapath soc handle 968 * @vdev_id - virtual device/interface id 969 * @callback - callback function 970 * @ctxt: callback context 971 * 972 */ 973 static inline void 974 cdp_data_tx_cb_set(ol_txrx_soc_handle soc, uint8_t vdev_id, 975 ol_txrx_data_tx_cb callback, void *ctxt) 976 { 977 if (!soc || !soc->ops) { 978 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 979 "%s: Invalid Instance:", __func__); 980 QDF_BUG(0); 981 return; 982 } 983 984 if (!soc->ops->cmn_drv_ops || 985 !soc->ops->cmn_drv_ops->txrx_data_tx_cb_set) 986 return; 987 988 soc->ops->cmn_drv_ops->txrx_data_tx_cb_set(soc, vdev_id, 989 callback, ctxt); 990 } 991 992 /****************************************************************************** 993 * Statistics and Debugging Interface (C Interface) 994 *****************************************************************************/ 995 /** 996 * External Device physical address types 997 * 998 * Currently, both MAC and IPA uController use the same size addresses 999 * and descriptors are exchanged between these two depending on the mode. 1000 * 1001 * Rationale: qdf_dma_addr_t is the type used internally on the host for DMA 1002 * operations. However, external device physical address sizes 1003 * may be different from host-specific physical address sizes. 1004 * This calls for the following definitions for target devices 1005 * (MAC, IPA uc). 1006 */ 1007 #if HTT_PADDR64 1008 typedef uint64_t target_paddr_t; 1009 #else 1010 typedef uint32_t target_paddr_t; 1011 #endif /*HTT_PADDR64 */ 1012 1013 static inline int 1014 cdp_aggr_cfg(ol_txrx_soc_handle soc, uint8_t vdev_id, 1015 int max_subfrms_ampdu, 1016 int max_subfrms_amsdu) 1017 { 1018 if (!soc || !soc->ops) { 1019 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1020 "%s: Invalid Instance:", __func__); 1021 QDF_BUG(0); 1022 return 0; 1023 } 1024 1025 if (!soc->ops->cmn_drv_ops || 1026 !soc->ops->cmn_drv_ops->txrx_aggr_cfg) 1027 return 0; 1028 1029 return soc->ops->cmn_drv_ops->txrx_aggr_cfg(soc, vdev_id, 1030 max_subfrms_ampdu, max_subfrms_amsdu); 1031 } 1032 1033 static inline int 1034 cdp_fw_stats_get(ol_txrx_soc_handle soc, uint8_t vdev_id, 1035 struct ol_txrx_stats_req *req, bool per_vdev, 1036 bool response_expected) 1037 { 1038 if (!soc || !soc->ops) { 1039 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1040 "%s: Invalid Instance:", __func__); 1041 QDF_BUG(0); 1042 return 0; 1043 } 1044 1045 if (!soc->ops->cmn_drv_ops || 1046 !soc->ops->cmn_drv_ops->txrx_fw_stats_get) 1047 return 0; 1048 1049 return soc->ops->cmn_drv_ops->txrx_fw_stats_get(soc, vdev_id, req, 1050 per_vdev, response_expected); 1051 } 1052 1053 static inline int 1054 cdp_debug(ol_txrx_soc_handle soc, uint8_t vdev_id, int debug_specs) 1055 { 1056 if (!soc || !soc->ops) { 1057 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1058 "%s: Invalid Instance:", __func__); 1059 QDF_BUG(0); 1060 return 0; 1061 } 1062 1063 if (!soc->ops->cmn_drv_ops || 1064 !soc->ops->cmn_drv_ops->txrx_debug) 1065 return 0; 1066 1067 return soc->ops->cmn_drv_ops->txrx_debug(soc, vdev_id, debug_specs); 1068 } 1069 1070 static inline QDF_STATUS 1071 cdp_fw_stats_cfg(ol_txrx_soc_handle soc, 1072 uint8_t vdev_id, uint8_t cfg_stats_type, uint32_t cfg_val) 1073 { 1074 if (!soc || !soc->ops) { 1075 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1076 "%s: Invalid Instance:", __func__); 1077 QDF_BUG(0); 1078 return QDF_STATUS_E_FAILURE; 1079 } 1080 1081 if (!soc->ops->cmn_drv_ops || 1082 !soc->ops->cmn_drv_ops->txrx_fw_stats_cfg) 1083 return QDF_STATUS_E_FAILURE; 1084 1085 return soc->ops->cmn_drv_ops->txrx_fw_stats_cfg(soc, vdev_id, 1086 cfg_stats_type, cfg_val); 1087 } 1088 1089 static inline void cdp_print_level_set(ol_txrx_soc_handle soc, unsigned level) 1090 { 1091 if (!soc || !soc->ops) { 1092 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1093 "%s: Invalid Instance:", __func__); 1094 QDF_BUG(0); 1095 return; 1096 } 1097 1098 if (!soc->ops->cmn_drv_ops || 1099 !soc->ops->cmn_drv_ops->txrx_print_level_set) 1100 return; 1101 1102 soc->ops->cmn_drv_ops->txrx_print_level_set(level); 1103 } 1104 1105 /* 1106 * cdp_get_vdev_mac_addr() – Detach txrx peer 1107 * @soc_hdl: Datapath soc handle 1108 * @vdev_id: virtual device/interface id 1109 * 1110 * Return: MAC address on success, NULL on failure. 1111 * 1112 */ 1113 static inline uint8_t * 1114 cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc, uint8_t vdev_id) 1115 { 1116 if (!soc || !soc->ops) { 1117 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1118 "%s: Invalid Instance:", __func__); 1119 QDF_BUG(0); 1120 return NULL; 1121 } 1122 1123 if (!soc->ops->cmn_drv_ops || 1124 !soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr) 1125 return NULL; 1126 1127 return soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr(soc, vdev_id); 1128 1129 } 1130 1131 /** 1132 * cdp_get_os_rx_handles_from_vdev() - Return os rx handles for a vdev 1133 * @soc: ol_txrx_soc_handle handle 1134 * @vdev_id: vdev id for which os rx handles are needed 1135 * @stack_fn_p: pointer to stack function pointer 1136 * @osif_handle_p: pointer to ol_osif_vdev_handle 1137 * 1138 * Return: void 1139 */ 1140 static inline 1141 void cdp_get_os_rx_handles_from_vdev(ol_txrx_soc_handle soc, 1142 uint8_t vdev_id, 1143 ol_txrx_rx_fp *stack_fn_p, 1144 ol_osif_vdev_handle *osif_handle_p) 1145 { 1146 if (!soc || !soc->ops) { 1147 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1148 "%s: Invalid Instance:", __func__); 1149 QDF_BUG(0); 1150 return; 1151 } 1152 1153 if (!soc->ops->cmn_drv_ops || 1154 !soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev) 1155 return; 1156 1157 soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev(soc, vdev_id, 1158 stack_fn_p, 1159 osif_handle_p); 1160 } 1161 1162 /** 1163 * cdp_get_ctrl_pdev_from_vdev() - Return control pdev of vdev 1164 * @soc: datapath soc handle 1165 * @vdev_id: virtual device/interface id 1166 * 1167 * Return: Handle to control pdev 1168 */ 1169 static inline struct cdp_cfg * 1170 cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc, uint8_t vdev_id) 1171 { 1172 if (!soc || !soc->ops) { 1173 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1174 "%s: Invalid Instance:", __func__); 1175 QDF_BUG(0); 1176 return NULL; 1177 } 1178 1179 if (!soc->ops->cmn_drv_ops || 1180 !soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev) 1181 return NULL; 1182 1183 return soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev(soc, 1184 vdev_id); 1185 } 1186 1187 /* 1188 * cdp_get_mon_vdev_from_pdev() - Get vdev handle of monitor mode 1189 * @soc: datapath soc handle 1190 * @pdev_id: physical device instance id 1191 * 1192 * Return: virtual interface id 1193 */ 1194 static inline uint8_t 1195 cdp_get_mon_vdev_from_pdev(ol_txrx_soc_handle soc, uint8_t pdev_id) 1196 { 1197 if (!soc || !soc->ops) { 1198 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1199 "%s: Invalid Instance:", __func__); 1200 QDF_BUG(0); 1201 return -EINVAL; 1202 } 1203 1204 if (!soc->ops->cmn_drv_ops || 1205 !soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev) 1206 return -EINVAL; 1207 1208 return soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev(soc, pdev_id); 1209 } 1210 1211 static inline void 1212 cdp_soc_detach(ol_txrx_soc_handle soc) 1213 { 1214 if (!soc || !soc->ops) { 1215 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1216 "%s: Invalid Instance:", __func__); 1217 QDF_BUG(0); 1218 return; 1219 } 1220 1221 if (!soc->ops->cmn_drv_ops || 1222 !soc->ops->cmn_drv_ops->txrx_soc_detach) 1223 return; 1224 1225 soc->ops->cmn_drv_ops->txrx_soc_detach(soc); 1226 } 1227 1228 /** 1229 * cdp_soc_init() - Initialize txrx SOC 1230 * @soc: ol_txrx_soc_handle handle 1231 * @devid: Device ID 1232 * @hif_handle: Opaque HIF handle 1233 * @psoc: Opaque Objmgr handle 1234 * @htc_handle: Opaque HTC handle 1235 * @qdf_dev: QDF device 1236 * @dp_ol_if_ops: Offload Operations 1237 * 1238 * Return: DP SOC handle on success, NULL on failure 1239 */ 1240 static inline ol_txrx_soc_handle 1241 cdp_soc_init(ol_txrx_soc_handle soc, u_int16_t devid, 1242 void *hif_handle, 1243 struct cdp_ctrl_objmgr_psoc *psoc, 1244 HTC_HANDLE htc_handle, qdf_device_t qdf_dev, 1245 struct ol_if_ops *dp_ol_if_ops) 1246 { 1247 if (!soc || !soc->ops) { 1248 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1249 "%s: Invalid Instance:", __func__); 1250 QDF_BUG(0); 1251 return NULL; 1252 } 1253 1254 if (!soc->ops->cmn_drv_ops || 1255 !soc->ops->cmn_drv_ops->txrx_soc_init) 1256 return NULL; 1257 1258 return soc->ops->cmn_drv_ops->txrx_soc_init(soc, psoc, 1259 hif_handle, 1260 htc_handle, qdf_dev, 1261 dp_ol_if_ops, devid); 1262 } 1263 1264 /** 1265 * cdp_soc_deinit() - Deinitialize txrx SOC 1266 * @soc: Opaque DP SOC handle 1267 * 1268 * Return: None 1269 */ 1270 static inline void 1271 cdp_soc_deinit(ol_txrx_soc_handle soc) 1272 { 1273 if (!soc || !soc->ops) { 1274 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1275 "%s: Invalid Instance:", __func__); 1276 QDF_BUG(0); 1277 return; 1278 } 1279 1280 if (!soc->ops->cmn_drv_ops || 1281 !soc->ops->cmn_drv_ops->txrx_soc_deinit) 1282 return; 1283 1284 soc->ops->cmn_drv_ops->txrx_soc_deinit(soc); 1285 } 1286 1287 /** 1288 * cdp_tso_soc_attach() - TSO attach function 1289 * @soc: ol_txrx_soc_handle handle 1290 * 1291 * Reserve TSO descriptor buffers 1292 * 1293 * Return: QDF_STATUS_SUCCESS on Success or 1294 * QDF_STATUS_E_FAILURE on failure 1295 */ 1296 static inline QDF_STATUS 1297 cdp_tso_soc_attach(ol_txrx_soc_handle soc) 1298 { 1299 if (!soc || !soc->ops) { 1300 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1301 "%s: Invalid Instance:", __func__); 1302 QDF_BUG(0); 1303 return 0; 1304 } 1305 1306 if (!soc->ops->cmn_drv_ops || 1307 !soc->ops->cmn_drv_ops->txrx_tso_soc_attach) 1308 return 0; 1309 1310 return soc->ops->cmn_drv_ops->txrx_tso_soc_attach(soc); 1311 } 1312 1313 /** 1314 * cdp_tso_soc_detach() - TSO detach function 1315 * @soc: ol_txrx_soc_handle handle 1316 * 1317 * Release TSO descriptor buffers 1318 * 1319 * Return: QDF_STATUS_SUCCESS on Success or 1320 * QDF_STATUS_E_FAILURE on failure 1321 */ 1322 static inline QDF_STATUS 1323 cdp_tso_soc_detach(ol_txrx_soc_handle soc) 1324 { 1325 if (!soc || !soc->ops) { 1326 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1327 "%s: Invalid Instance:", __func__); 1328 QDF_BUG(0); 1329 return 0; 1330 } 1331 1332 if (!soc->ops->cmn_drv_ops || 1333 !soc->ops->cmn_drv_ops->txrx_tso_soc_detach) 1334 return 0; 1335 1336 return soc->ops->cmn_drv_ops->txrx_tso_soc_detach(soc); 1337 } 1338 1339 /** 1340 * cdp_addba_resp_tx_completion() - Indicate addba response tx 1341 * completion to dp to change tid state. 1342 * @soc: soc handle 1343 * @peer_mac: mac address of peer handle 1344 * @vdev_id: id of vdev handle 1345 * @tid: tid 1346 * @status: Tx completion status 1347 * 1348 * Return: success/failure of tid update 1349 */ 1350 static inline int cdp_addba_resp_tx_completion(ol_txrx_soc_handle soc, 1351 uint8_t *peer_mac, 1352 uint16_t vdev_id, 1353 uint8_t tid, int status) 1354 { 1355 if (!soc || !soc->ops) { 1356 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1357 "%s: Invalid Instance:", __func__); 1358 QDF_BUG(0); 1359 return 0; 1360 } 1361 1362 if (!soc->ops->cmn_drv_ops || 1363 !soc->ops->cmn_drv_ops->addba_resp_tx_completion) 1364 return 0; 1365 1366 return soc->ops->cmn_drv_ops->addba_resp_tx_completion(soc, peer_mac, 1367 vdev_id, tid, status); 1368 } 1369 1370 static inline int cdp_addba_requestprocess(ol_txrx_soc_handle soc, 1371 uint8_t *peer_mac, uint16_t vdev_id, uint8_t dialogtoken, uint16_t tid, 1372 uint16_t batimeout, uint16_t buffersize, uint16_t startseqnum) 1373 { 1374 if (!soc || !soc->ops) { 1375 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1376 "%s: Invalid Instance:", __func__); 1377 QDF_BUG(0); 1378 return 0; 1379 } 1380 1381 if (!soc->ops->cmn_drv_ops || 1382 !soc->ops->cmn_drv_ops->addba_requestprocess) 1383 return 0; 1384 1385 return soc->ops->cmn_drv_ops->addba_requestprocess(soc, peer_mac, 1386 vdev_id, dialogtoken, tid, batimeout, buffersize, 1387 startseqnum); 1388 } 1389 1390 static inline QDF_STATUS 1391 cdp_addba_responsesetup(ol_txrx_soc_handle soc, 1392 uint8_t *peer_mac, uint16_t vdev_id, 1393 uint8_t tid, uint8_t *dialogtoken, 1394 uint16_t *statuscode, uint16_t *buffersize, 1395 uint16_t *batimeout) 1396 { 1397 if (!soc || !soc->ops) { 1398 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1399 "%s: Invalid Instance:", __func__); 1400 QDF_BUG(0); 1401 return QDF_STATUS_E_FAILURE; 1402 } 1403 1404 if (!soc->ops->cmn_drv_ops || 1405 !soc->ops->cmn_drv_ops->addba_responsesetup) 1406 return QDF_STATUS_E_FAILURE; 1407 1408 return soc->ops->cmn_drv_ops->addba_responsesetup(soc, peer_mac, 1409 vdev_id, tid, dialogtoken, statuscode, buffersize, 1410 batimeout); 1411 } 1412 1413 static inline int cdp_delba_process(ol_txrx_soc_handle soc, uint8_t *peer_mac, 1414 uint16_t vdev_id, int tid, 1415 uint16_t reasoncode) 1416 { 1417 if (!soc || !soc->ops) { 1418 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1419 "%s: Invalid Instance:", __func__); 1420 QDF_BUG(0); 1421 return 0; 1422 } 1423 1424 if (!soc->ops->cmn_drv_ops || 1425 !soc->ops->cmn_drv_ops->delba_process) 1426 return 0; 1427 1428 return soc->ops->cmn_drv_ops->delba_process(soc, peer_mac, 1429 vdev_id, tid, reasoncode); 1430 } 1431 1432 /** 1433 * cdp_delba_tx_completion() - Handle delba tx completion 1434 * to update stats and retry transmission if failed. 1435 * @soc: soc handle 1436 * @peer_mac: peer mac address 1437 * @vdev_id: id of vdev handle 1438 * @tid: Tid number 1439 * @status: Tx completion status 1440 * 1441 * Return: 0 on Success, 1 on failure 1442 */ 1443 1444 static inline int cdp_delba_tx_completion(ol_txrx_soc_handle soc, 1445 uint8_t *peer_mac, 1446 uint16_t vdev_id, 1447 uint8_t tid, int status) 1448 { 1449 if (!soc || !soc->ops) { 1450 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1451 "%s: Invalid Instance:", __func__); 1452 QDF_BUG(0); 1453 return 0; 1454 } 1455 1456 if (!soc->ops->cmn_drv_ops || 1457 !soc->ops->cmn_drv_ops->delba_tx_completion) 1458 return 0; 1459 1460 return soc->ops->cmn_drv_ops->delba_tx_completion(soc, peer_mac, 1461 vdev_id, 1462 tid, status); 1463 } 1464 1465 static inline QDF_STATUS 1466 cdp_set_addbaresponse(ol_txrx_soc_handle soc, 1467 uint8_t *peer_mac, uint16_t vdev_id, int tid, 1468 uint16_t statuscode) 1469 { 1470 if (!soc || !soc->ops) { 1471 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1472 "%s: Invalid Instance:", __func__); 1473 QDF_BUG(0); 1474 return QDF_STATUS_E_FAILURE; 1475 } 1476 1477 if (!soc->ops->cmn_drv_ops || 1478 !soc->ops->cmn_drv_ops->set_addba_response) 1479 return QDF_STATUS_E_FAILURE; 1480 1481 return soc->ops->cmn_drv_ops->set_addba_response(soc, peer_mac, vdev_id, 1482 tid, statuscode); 1483 } 1484 1485 /** 1486 * cdp_set_vdev_dscp_tid_map(): function to set DSCP-tid map in the vap 1487 * @soc : soc handle 1488 * @vdev_id: id of vdev handle 1489 * @map_id: id of the tid map 1490 * 1491 * Return: QDF_STATUS 1492 */ 1493 static inline QDF_STATUS 1494 cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc, 1495 uint8_t vdev_id, uint8_t map_id) 1496 { 1497 if (!soc || !soc->ops) { 1498 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1499 "%s: Invalid Instance:", __func__); 1500 QDF_BUG(0); 1501 return QDF_STATUS_E_FAILURE; 1502 } 1503 1504 if (!soc->ops->cmn_drv_ops || 1505 !soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map) 1506 return QDF_STATUS_E_FAILURE; 1507 1508 return soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map(soc, vdev_id, 1509 map_id); 1510 } 1511 1512 #ifdef QCA_MULTIPASS_SUPPORT 1513 /** 1514 * cdp_set_vlan_groupkey(): function to set vlan ID - group key map in the vap 1515 * @soc : soc handle 1516 * @vdev_id: id of vdev handle 1517 * @vlan_id: vlan id 1518 * @group_key: corresponding group key to vlan ID 1519 * 1520 * Return: void 1521 */ 1522 static inline 1523 QDF_STATUS cdp_set_vlan_groupkey(ol_txrx_soc_handle soc, uint8_t vdev_id, 1524 uint16_t vlan_id, uint16_t group_key) 1525 { 1526 if (!soc || !soc->ops) { 1527 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1528 "%s: Invalid Instance:", __func__); 1529 QDF_BUG(0); 1530 return 0; 1531 } 1532 1533 if (!soc->ops->cmn_drv_ops || 1534 !soc->ops->cmn_drv_ops->set_vlan_groupkey) 1535 return 0; 1536 1537 return soc->ops->cmn_drv_ops->set_vlan_groupkey(soc, vdev_id, vlan_id, 1538 group_key); 1539 } 1540 #endif 1541 1542 /** 1543 * cdp_ath_get_total_per(): function to get hw retries 1544 * @soc : soc handle 1545 * @pdev_id: id of pdev handle 1546 * 1547 * Return: get hw retries 1548 */ 1549 static inline 1550 int cdp_ath_get_total_per(ol_txrx_soc_handle soc, uint8_t pdev_id) 1551 { 1552 if (!soc || !soc->ops) { 1553 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1554 "%s: Invalid Instance:", __func__); 1555 QDF_BUG(0); 1556 return 0; 1557 } 1558 1559 if (!soc->ops->cmn_drv_ops || 1560 !soc->ops->cmn_drv_ops->txrx_get_total_per) 1561 return 0; 1562 1563 return soc->ops->cmn_drv_ops->txrx_get_total_per(soc, pdev_id); 1564 } 1565 1566 /** 1567 * cdp_set_pdev_dscp_tid_map(): function to change tid values in DSCP-tid map 1568 * @pdev_id: id of pdev handle 1569 * @map_id: id of the tid map 1570 * @tos: index value in map that needs to be changed 1571 * @tid: tid value passed by user 1572 * 1573 * Return: void 1574 */ 1575 static inline void cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc, 1576 uint8_t pdev_id, uint8_t map_id, uint8_t tos, uint8_t tid) 1577 { 1578 if (!soc || !soc->ops) { 1579 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1580 "%s: Invalid Instance:", __func__); 1581 QDF_BUG(0); 1582 return; 1583 } 1584 1585 if (!soc->ops->cmn_drv_ops || 1586 !soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map) 1587 return; 1588 1589 soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map(soc, pdev_id, 1590 map_id, tos, tid); 1591 } 1592 1593 /** 1594 * cdp_hmmc_tid_override_en(): Function to enable hmmc tid override. 1595 * @soc : soc handle 1596 * @pdev: pdev handle 1597 * @val: hmmc-dscp flag value 1598 * 1599 * Return: void 1600 */ 1601 static inline void cdp_hmmc_tid_override_en(ol_txrx_soc_handle soc, 1602 struct cdp_pdev *pdev, bool val) 1603 { 1604 if (!soc || !soc->ops) { 1605 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1606 "%s: Invalid Instance:", __func__); 1607 QDF_BUG(0); 1608 return; 1609 } 1610 1611 if (!soc->ops->cmn_drv_ops || 1612 !soc->ops->cmn_drv_ops->hmmc_tid_override_en) 1613 return; 1614 1615 soc->ops->cmn_drv_ops->hmmc_tid_override_en(pdev, val); 1616 } 1617 1618 /** 1619 * cdp_set_hmmc_tid_val(): Function to set hmmc tid value. 1620 * @soc : soc handle 1621 * @pdev: pdev handle 1622 * @tid: tid value 1623 * 1624 * Return: void 1625 */ 1626 static inline void cdp_set_hmmc_tid_val(ol_txrx_soc_handle soc, 1627 struct cdp_pdev *pdev, uint8_t tid) 1628 { 1629 if (!soc || !soc->ops) { 1630 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1631 "%s: Invalid Instance:", __func__); 1632 QDF_BUG(0); 1633 return; 1634 } 1635 1636 if (!soc->ops->cmn_drv_ops || 1637 !soc->ops->cmn_drv_ops->set_hmmc_tid_val) 1638 return; 1639 1640 soc->ops->cmn_drv_ops->set_hmmc_tid_val(pdev, tid); 1641 } 1642 1643 /** 1644 * cdp_flush_cache_rx_queue() - flush cache rx queue frame 1645 * 1646 * Return: None 1647 */ 1648 static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc) 1649 { 1650 if (!soc || !soc->ops) { 1651 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1652 "%s: Invalid Instance:", __func__); 1653 QDF_BUG(0); 1654 return; 1655 } 1656 1657 if (!soc->ops->cmn_drv_ops || 1658 !soc->ops->cmn_drv_ops->flush_cache_rx_queue) 1659 return; 1660 soc->ops->cmn_drv_ops->flush_cache_rx_queue(); 1661 } 1662 1663 /** 1664 * cdp_txrx_stats_request(): function to map to host and firmware statistics 1665 * @soc: soc handle 1666 * @vdev_id: virtual device ID 1667 * @req: stats request container 1668 * 1669 * return: status 1670 */ 1671 static inline 1672 int cdp_txrx_stats_request(ol_txrx_soc_handle soc, uint8_t vdev_id, 1673 struct cdp_txrx_stats_req *req) 1674 { 1675 if (!soc || !soc->ops || !soc->ops->cmn_drv_ops || !req) { 1676 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1677 "%s: Invalid Instance:", __func__); 1678 QDF_ASSERT(0); 1679 return 0; 1680 } 1681 1682 if (soc->ops->cmn_drv_ops->txrx_stats_request) 1683 return soc->ops->cmn_drv_ops->txrx_stats_request(soc, vdev_id, 1684 req); 1685 1686 return 0; 1687 } 1688 1689 /** 1690 * cdp_txrx_intr_attach(): function to attach and configure interrupt 1691 * @soc: soc handle 1692 */ 1693 static inline QDF_STATUS cdp_txrx_intr_attach(ol_txrx_soc_handle soc) 1694 { 1695 if (!soc || !soc->ops) { 1696 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1697 "%s: Invalid Instance:", __func__); 1698 QDF_BUG(0); 1699 return 0; 1700 } 1701 1702 if (!soc->ops->cmn_drv_ops || 1703 !soc->ops->cmn_drv_ops->txrx_intr_attach) 1704 return 0; 1705 1706 return soc->ops->cmn_drv_ops->txrx_intr_attach(soc); 1707 } 1708 1709 /** 1710 * cdp_txrx_intr_detach(): function to detach interrupt 1711 * @soc: soc handle 1712 */ 1713 static inline void cdp_txrx_intr_detach(ol_txrx_soc_handle soc) 1714 { 1715 if (!soc || !soc->ops) { 1716 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1717 "%s: Invalid Instance:", __func__); 1718 QDF_BUG(0); 1719 return; 1720 } 1721 1722 if (!soc->ops->cmn_drv_ops || 1723 !soc->ops->cmn_drv_ops->txrx_intr_detach) 1724 return; 1725 1726 soc->ops->cmn_drv_ops->txrx_intr_detach(soc); 1727 } 1728 1729 /** 1730 * cdp_display_stats(): function to map to dump stats 1731 * @soc: soc handle 1732 * @value: statistics option 1733 */ 1734 static inline QDF_STATUS 1735 cdp_display_stats(ol_txrx_soc_handle soc, uint16_t value, 1736 enum qdf_stats_verbosity_level level) 1737 { 1738 if (!soc || !soc->ops) { 1739 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1740 "%s: Invalid Instance:", __func__); 1741 QDF_BUG(0); 1742 return 0; 1743 } 1744 1745 if (!soc->ops->cmn_drv_ops || 1746 !soc->ops->cmn_drv_ops->display_stats) 1747 return 0; 1748 1749 return soc->ops->cmn_drv_ops->display_stats(soc, value, level); 1750 } 1751 1752 1753 /** 1754 * cdp_set_pn_check(): function to set pn check 1755 * @soc: soc handle 1756 * @vdev_id: id of virtual device 1757 * @peer_mac: mac address of peer 1758 * @sec_type: security type 1759 * @rx_pn: receive pn 1760 */ 1761 static inline int cdp_set_pn_check(ol_txrx_soc_handle soc, 1762 uint8_t vdev_id, uint8_t *peer_mac, 1763 enum cdp_sec_type sec_type, uint32_t *rx_pn) 1764 { 1765 if (!soc || !soc->ops) { 1766 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1767 "%s: Invalid Instance:", __func__); 1768 QDF_BUG(0); 1769 return 0; 1770 } 1771 1772 if (!soc->ops->cmn_drv_ops || 1773 !soc->ops->cmn_drv_ops->set_pn_check) 1774 return 0; 1775 1776 soc->ops->cmn_drv_ops->set_pn_check(soc, vdev_id, peer_mac, 1777 sec_type, rx_pn); 1778 return 0; 1779 } 1780 1781 static inline int cdp_set_key(ol_txrx_soc_handle soc, 1782 struct cdp_peer *peer_handle, 1783 bool is_unicast, uint32_t *key) 1784 { 1785 if (!soc || !soc->ops) { 1786 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1787 "%s: Invalid Instance:", __func__); 1788 QDF_BUG(0); 1789 return 0; 1790 } 1791 1792 if (!soc->ops->ctrl_ops || 1793 !soc->ops->ctrl_ops->set_key) 1794 return 0; 1795 1796 soc->ops->ctrl_ops->set_key(peer_handle, 1797 is_unicast, key); 1798 return 0; 1799 } 1800 1801 /** 1802 * cdp_update_config_parameters(): function to propagate configuration 1803 * parameters to datapath 1804 * @soc: opaque soc handle 1805 * @cfg: configuration handle 1806 * 1807 * Return: status: 0 - Success, non-zero: Failure 1808 */ 1809 static inline 1810 QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc, 1811 struct cdp_config_params *cfg) 1812 { 1813 struct cdp_soc *psoc = (struct cdp_soc *)soc; 1814 1815 if (!soc || !soc->ops) { 1816 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1817 "%s: Invalid Instance:", __func__); 1818 QDF_BUG(0); 1819 return 0; 1820 } 1821 1822 if (!soc->ops->cmn_drv_ops || 1823 !soc->ops->cmn_drv_ops->update_config_parameters) 1824 return QDF_STATUS_SUCCESS; 1825 1826 return soc->ops->cmn_drv_ops->update_config_parameters(psoc, 1827 cfg); 1828 } 1829 1830 /** 1831 * cdp_pdev_get_dp_txrx_handle() - get advanced dp handle from pdev 1832 * @soc: opaque soc handle 1833 * @pdev_id: id of data path pdev handle 1834 * 1835 * Return: opaque dp handle 1836 */ 1837 static inline void * 1838 cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id) 1839 { 1840 if (!soc || !soc->ops) { 1841 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1842 "%s: Invalid Instance:", __func__); 1843 QDF_BUG(0); 1844 return 0; 1845 } 1846 1847 if (soc->ops->cmn_drv_ops->get_dp_txrx_handle) 1848 return soc->ops->cmn_drv_ops->get_dp_txrx_handle(soc, pdev_id); 1849 1850 return 0; 1851 } 1852 1853 /** 1854 * cdp_pdev_set_dp_txrx_handle() - set advanced dp handle in pdev 1855 * @soc: opaque soc handle 1856 * @pdev_id: id of data path pdev handle 1857 * @dp_hdl: opaque pointer for dp_txrx_handle 1858 * 1859 * Return: void 1860 */ 1861 static inline void 1862 cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id, 1863 void *dp_hdl) 1864 { 1865 if (!soc || !soc->ops) { 1866 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1867 "%s: Invalid Instance:", __func__); 1868 QDF_BUG(0); 1869 return; 1870 } 1871 1872 if (!soc->ops->cmn_drv_ops || 1873 !soc->ops->cmn_drv_ops->set_dp_txrx_handle) 1874 return; 1875 1876 soc->ops->cmn_drv_ops->set_dp_txrx_handle(soc, pdev_id, dp_hdl); 1877 } 1878 1879 /* 1880 * cdp_soc_get_dp_txrx_handle() - get extended dp handle from soc 1881 * @soc: opaque soc handle 1882 * 1883 * Return: opaque extended dp handle 1884 */ 1885 static inline void * 1886 cdp_soc_get_dp_txrx_handle(ol_txrx_soc_handle soc) 1887 { 1888 if (!soc || !soc->ops) { 1889 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1890 "%s: Invalid Instance:", __func__); 1891 QDF_BUG(0); 1892 return NULL; 1893 } 1894 1895 if (soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle) 1896 return soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle( 1897 (struct cdp_soc *) soc); 1898 1899 return NULL; 1900 } 1901 1902 /** 1903 * cdp_soc_set_dp_txrx_handle() - set advanced dp handle in soc 1904 * @soc: opaque soc handle 1905 * @dp_hdl: opaque pointer for dp_txrx_handle 1906 * 1907 * Return: void 1908 */ 1909 static inline void 1910 cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *dp_handle) 1911 { 1912 if (!soc || !soc->ops) { 1913 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1914 "%s: Invalid Instance:", __func__); 1915 QDF_BUG(0); 1916 return; 1917 } 1918 1919 if (!soc->ops->cmn_drv_ops || 1920 !soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle) 1921 return; 1922 1923 soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle((struct cdp_soc *)soc, 1924 dp_handle); 1925 } 1926 1927 /** 1928 * cdp_soc_map_pdev_to_lmac() - Save pdev_id to lmac_id mapping 1929 * @soc: opaque soc handle 1930 * @pdev_id: id of data path pdev handle 1931 * @lmac_id: lmac id 1932 * 1933 * Return: QDF_STATUS 1934 */ 1935 static inline QDF_STATUS 1936 cdp_soc_map_pdev_to_lmac(ol_txrx_soc_handle soc, uint8_t pdev_id, 1937 uint32_t lmac_id) 1938 { 1939 if (!soc || !soc->ops) { 1940 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1941 "%s: Invalid Instance:", __func__); 1942 QDF_BUG(0); 1943 return QDF_STATUS_E_FAILURE; 1944 } 1945 1946 if (!soc->ops->cmn_drv_ops || 1947 !soc->ops->cmn_drv_ops->map_pdev_to_lmac) 1948 return QDF_STATUS_E_FAILURE; 1949 1950 return soc->ops->cmn_drv_ops->map_pdev_to_lmac(soc, pdev_id, 1951 lmac_id); 1952 } 1953 1954 /** 1955 * cdp_txrx_set_pdev_status_down() - set pdev down/up status 1956 * @soc: soc opaque handle 1957 * @pdev_id: id of data path pdev handle 1958 * @is_pdev_down: pdev down/up status 1959 * 1960 * return: QDF_STATUS 1961 */ 1962 static inline QDF_STATUS 1963 cdp_txrx_set_pdev_status_down(ol_txrx_soc_handle soc, 1964 uint8_t pdev_id, 1965 bool is_pdev_down) 1966 { 1967 if (!soc || !soc->ops) { 1968 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1969 "%s: Invalid Instance:", __func__); 1970 QDF_BUG(0); 1971 return QDF_STATUS_E_FAILURE; 1972 } 1973 1974 if (!soc->ops->cmn_drv_ops || 1975 !soc->ops->cmn_drv_ops->set_pdev_status_down) 1976 return QDF_STATUS_E_FAILURE; 1977 1978 return soc->ops->cmn_drv_ops->set_pdev_status_down(soc, pdev_id, 1979 is_pdev_down); 1980 } 1981 1982 /** 1983 * cdp_tx_send() - enqueue frame for transmission 1984 * @soc: soc opaque handle 1985 * @vdev_id: id of VAP device 1986 * @nbuf: nbuf to be enqueued 1987 * 1988 * This API is used by Extended Datapath modules to enqueue frame for 1989 * transmission 1990 * 1991 * Return: void 1992 */ 1993 static inline void 1994 cdp_tx_send(ol_txrx_soc_handle soc, uint8_t vdev_id, qdf_nbuf_t nbuf) 1995 { 1996 if (!soc || !soc->ops) { 1997 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 1998 "%s: Invalid Instance:", __func__); 1999 QDF_BUG(0); 2000 return; 2001 } 2002 2003 if (!soc->ops->cmn_drv_ops || 2004 !soc->ops->cmn_drv_ops->tx_send) 2005 return; 2006 2007 soc->ops->cmn_drv_ops->tx_send(soc, vdev_id, nbuf); 2008 } 2009 2010 /* 2011 * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev 2012 * @soc: opaque soc handle 2013 * @pdev: data path pdev handle 2014 * 2015 * Return: pdev_id 2016 */ 2017 static inline 2018 uint8_t cdp_get_pdev_id_frm_pdev(ol_txrx_soc_handle soc, 2019 struct cdp_pdev *pdev) 2020 { 2021 if (soc->ops->cmn_drv_ops->txrx_get_pdev_id_frm_pdev) 2022 return soc->ops->cmn_drv_ops->txrx_get_pdev_id_frm_pdev(pdev); 2023 return 0; 2024 } 2025 2026 /* 2027 * cdp_get_vow_config_frm_pdev() - return carrier_vow_config from pdev 2028 * @soc: opaque soc handle 2029 * @pdev: data path pdev handle 2030 * 2031 * Return: carrier_vow_config 2032 */ 2033 static inline 2034 bool cdp_get_vow_config_frm_pdev(ol_txrx_soc_handle soc, 2035 struct cdp_pdev *pdev) 2036 { 2037 if (soc->ops->cmn_drv_ops->txrx_get_vow_config_frm_pdev) 2038 return soc->ops->cmn_drv_ops->txrx_get_vow_config_frm_pdev( 2039 pdev); 2040 return 0; 2041 } 2042 2043 /** 2044 * cdp_pdev_set_chan_noise_floor() - Set channel noise floor to DP layer 2045 * @soc: opaque soc handle 2046 * @pdev: data path pdev handle 2047 * @chan_noise_floor: Channel Noise Floor (in dbM) obtained from control path 2048 * 2049 * Return: None 2050 */ 2051 static inline 2052 void cdp_pdev_set_chan_noise_floor(ol_txrx_soc_handle soc, 2053 struct cdp_pdev *pdev, 2054 int16_t chan_noise_floor) 2055 { 2056 if (soc->ops->cmn_drv_ops->txrx_pdev_set_chan_noise_floor) 2057 return soc->ops->cmn_drv_ops->txrx_pdev_set_chan_noise_floor( 2058 pdev, chan_noise_floor); 2059 } 2060 2061 /** 2062 * cdp_set_nac() - set nac 2063 * @soc: opaque soc handle 2064 * @vdev_id: id of vdev handle 2065 * @peer_mac: mac of data path peer handle 2066 * 2067 */ 2068 static inline 2069 void cdp_set_nac(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac) 2070 { 2071 if (soc->ops->cmn_drv_ops->txrx_set_nac) 2072 soc->ops->cmn_drv_ops->txrx_set_nac(soc, vdev_id, peer_mac); 2073 } 2074 2075 /** 2076 * cdp_set_pdev_tx_capture() - set pdev tx_capture 2077 * @soc: opaque soc handle 2078 * @pdev: data path pdev handle 2079 * @val: value of pdev_tx_capture 2080 * 2081 * Return: status: 0 - Success, non-zero: Failure 2082 */ 2083 static inline 2084 QDF_STATUS cdp_set_pdev_tx_capture(ol_txrx_soc_handle soc, 2085 struct cdp_pdev *pdev, int val) 2086 { 2087 if (soc->ops->cmn_drv_ops->txrx_set_pdev_tx_capture) 2088 return soc->ops->cmn_drv_ops->txrx_set_pdev_tx_capture(pdev, 2089 val); 2090 return QDF_STATUS_SUCCESS; 2091 } 2092 2093 /** 2094 * cdp_set_pdev_pcp_tid_map() - set pdev pcp-tid-map 2095 * @soc: opaque soc handle 2096 * @pdev_id: id of data path pdev handle 2097 * @pcp: pcp value 2098 * @tid: tid value 2099 * 2100 * This API is used to configure the pcp-to-tid mapping for a pdev. 2101 * 2102 * Return: QDF_STATUS_SUCCESS if value set successfully 2103 * QDF_STATUS_E_INVAL false if error 2104 */ 2105 static inline 2106 QDF_STATUS cdp_set_pdev_pcp_tid_map(ol_txrx_soc_handle soc, 2107 uint8_t pdev_id, 2108 uint32_t pcp, uint32_t tid) 2109 { 2110 if (!soc || !soc->ops) { 2111 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2112 "%s: Invalid Instance", __func__); 2113 return QDF_STATUS_E_INVAL; 2114 } 2115 2116 if (!soc->ops->cmn_drv_ops || 2117 !soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map) 2118 return QDF_STATUS_E_INVAL; 2119 2120 return soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map(soc, pdev_id, 2121 pcp, tid); 2122 } 2123 2124 /** 2125 * cdp_set_pdev_pcp_tidmap_prty() - set pdev tidmap priority 2126 * @soc: opaque soc handle 2127 * @pdev: data path pdev handle 2128 * @val: priority value 2129 * 2130 * This API is used to configure the tidmap priority for a pdev. 2131 * The tidmap priority decides which mapping, namely DSCP-TID, SVLAN_PCP-TID, 2132 * CVLAN_PCP-TID will be used. 2133 * 2134 * Return: QDF_STATUS_SUCCESS if value set successfully 2135 * QDF_STATUS_E_INVAL false if error 2136 */ 2137 static inline 2138 QDF_STATUS cdp_set_pdev_tidmap_prty(ol_txrx_soc_handle soc, 2139 struct cdp_pdev *pdev_handle, 2140 uint32_t val) 2141 { 2142 if (!soc || !soc->ops) { 2143 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2144 "%s: Invalid Instance", __func__); 2145 return QDF_STATUS_E_INVAL; 2146 } 2147 2148 if (!soc->ops->cmn_drv_ops || 2149 !soc->ops->cmn_drv_ops->set_pdev_tidmap_prty) 2150 return QDF_STATUS_E_INVAL; 2151 2152 return soc->ops->cmn_drv_ops->set_pdev_tidmap_prty(pdev_handle, val); 2153 } 2154 2155 /** 2156 * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id 2157 * @soc: opaque soc handle 2158 * @pdev_id: id of data path pdev handle 2159 * @peer_id: data path peer id 2160 * @peer_mac: peer_mac 2161 * 2162 * Return: QDF_STATUS 2163 */ 2164 static inline 2165 QDF_STATUS cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc, 2166 uint32_t peer_id, uint8_t *peer_mac) 2167 { 2168 if (soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id) 2169 return soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id( 2170 soc, peer_id, peer_mac); 2171 2172 return QDF_STATUS_E_INVAL; 2173 } 2174 2175 /** 2176 * cdp_vdev_tx_lock() - acquire lock 2177 * @soc: opaque soc handle 2178 * @vdev: data path vdev handle 2179 * 2180 * Return: void 2181 */ 2182 static inline 2183 void cdp_vdev_tx_lock(ol_txrx_soc_handle soc, 2184 uint8_t vdev_id) 2185 { 2186 if (soc->ops->cmn_drv_ops->txrx_vdev_tx_lock) 2187 soc->ops->cmn_drv_ops->txrx_vdev_tx_lock(soc, vdev_id); 2188 } 2189 2190 /** 2191 * cdp_vdev_tx_unlock() - release lock 2192 * @soc: opaque soc handle 2193 * @vdev_id: id of data path vdev handle 2194 * 2195 * Return: void 2196 */ 2197 static inline 2198 void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc, 2199 uint8_t vdev_id) 2200 { 2201 if (soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock) 2202 soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock(soc, vdev_id); 2203 } 2204 2205 /** 2206 * cdp_ath_getstats() - get updated athstats 2207 * @soc: opaque soc handle 2208 * @id: vdev_id/pdev_id based on type 2209 * @stats: cdp network device stats structure 2210 * @type: device type pdev/vdev 2211 * 2212 * Return: QDF_STATUS 2213 */ 2214 static inline QDF_STATUS 2215 cdp_ath_getstats(ol_txrx_soc_handle soc, 2216 uint8_t id, struct cdp_dev_stats *stats, 2217 uint8_t type) 2218 { 2219 if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats) 2220 return soc->ops->cmn_drv_ops->txrx_ath_getstats(soc, id, 2221 stats, type); 2222 2223 return QDF_STATUS_E_FAILURE; 2224 } 2225 2226 /** 2227 * cdp_set_gid_flag() - set groupid flag 2228 * @soc: opaque soc handle 2229 * @pdev_id: id of data path pdev handle 2230 * @mem_status: member status from grp management frame 2231 * @user_position: user position from grp management frame 2232 * 2233 * Return: QDF_STATUS 2234 */ 2235 static inline QDF_STATUS 2236 cdp_set_gid_flag(ol_txrx_soc_handle soc, 2237 uint8_t pdev_id, u_int8_t *mem_status, 2238 u_int8_t *user_position) 2239 { 2240 if (soc->ops->cmn_drv_ops->txrx_set_gid_flag) 2241 return soc->ops->cmn_drv_ops->txrx_set_gid_flag(soc, pdev_id, 2242 mem_status, 2243 user_position); 2244 return QDF_STATUS_E_FAILURE; 2245 } 2246 2247 /** 2248 * cdp_fw_supported_enh_stats_version() - returns the fw enhanced stats version 2249 * @soc: opaque soc handle 2250 * @pdev_id: id of data path pdev handle 2251 * 2252 */ 2253 static inline 2254 uint32_t cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc, 2255 uint8_t pdev_id) 2256 { 2257 if (soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version) 2258 return soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version(soc, pdev_id); 2259 return 0; 2260 } 2261 2262 /** 2263 * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev 2264 * @soc: opaque soc handle 2265 * @vdev_id: id of vdev device 2266 * @force: number of frame in SW queue 2267 * Return: void 2268 */ 2269 static inline 2270 void cdp_if_mgmt_drain(ol_txrx_soc_handle soc, 2271 uint8_t vdev_id, int force) 2272 { 2273 if (soc->ops->cmn_drv_ops->txrx_if_mgmt_drain) 2274 soc->ops->cmn_drv_ops->txrx_if_mgmt_drain(soc, vdev_id, force); 2275 } 2276 2277 /* cdp_peer_map_attach() - CDP API to allocate PEER map memory 2278 * @soc: opaque soc handle 2279 * @max_peers: number of peers created in FW 2280 * @max_ast_index: max number of AST index supported in FW 2281 * @peer_map_unmap_v2: flag indicates HTT peer map v2 is enabled in FW 2282 * 2283 * 2284 * Return: QDF_STATUS 2285 */ 2286 static inline QDF_STATUS 2287 cdp_peer_map_attach(ol_txrx_soc_handle soc, uint32_t max_peers, 2288 uint32_t max_ast_index, bool peer_map_unmap_v2) 2289 { 2290 if (soc && soc->ops && soc->ops->cmn_drv_ops && 2291 soc->ops->cmn_drv_ops->txrx_peer_map_attach) 2292 return soc->ops->cmn_drv_ops->txrx_peer_map_attach(soc, 2293 max_peers, 2294 max_ast_index, 2295 peer_map_unmap_v2); 2296 2297 return QDF_STATUS_SUCCESS; 2298 } 2299 2300 /* cdp_txrx_classify_and_update() - To classify the packet and update stats 2301 * @soc: opaque soc handle 2302 * @vdev: opaque dp vdev handle 2303 * @skb: data 2304 * @dir: rx or tx packet 2305 * @nbuf_classify: packet classification object 2306 * 2307 * Return: 1 on success else return 0 2308 */ 2309 static inline int 2310 cdp_txrx_classify_and_update(ol_txrx_soc_handle soc, 2311 uint8_t vdev_id, qdf_nbuf_t skb, 2312 enum txrx_direction dir, 2313 struct ol_txrx_nbuf_classify *nbuf_class) 2314 { 2315 if (!soc || !soc->ops) { 2316 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2317 "%s: Invalid Instance", __func__); 2318 QDF_BUG(0); 2319 return 0; 2320 } 2321 2322 if (!soc->ops->cmn_drv_ops || 2323 !soc->ops->cmn_drv_ops->txrx_classify_update) 2324 return 0; 2325 2326 return soc->ops->cmn_drv_ops->txrx_classify_update(soc, vdev_id, 2327 skb, 2328 dir, nbuf_class); 2329 } 2330 2331 /** 2332 * cdp_get_dp_capabilities() - get DP capabilities 2333 * @soc: opaque soc handle 2334 * @dp_cap: enum of DP capabilities 2335 * 2336 * Return: bool 2337 */ 2338 static inline bool 2339 cdp_get_dp_capabilities(struct cdp_soc_t *soc, enum cdp_capabilities dp_caps) 2340 { 2341 if (soc && soc->ops && soc->ops->cmn_drv_ops && 2342 soc->ops->cmn_drv_ops->get_dp_capabilities) 2343 return soc->ops->cmn_drv_ops->get_dp_capabilities(soc, dp_caps); 2344 return false; 2345 } 2346 2347 #ifdef RECEIVE_OFFLOAD 2348 /** 2349 * cdp_register_rx_offld_flush_cb() - register LRO/GRO flush cb function pointer 2350 * @soc - data path soc handle 2351 * @pdev - device instance pointer 2352 * 2353 * register rx offload flush callback function pointer 2354 * 2355 * return none 2356 */ 2357 static inline void cdp_register_rx_offld_flush_cb(ol_txrx_soc_handle soc, 2358 void (rx_ol_flush_cb)(void *)) 2359 { 2360 if (!soc || !soc->ops || !soc->ops->rx_offld_ops) { 2361 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 2362 "%s invalid instance", __func__); 2363 return; 2364 } 2365 2366 if (soc->ops->rx_offld_ops->register_rx_offld_flush_cb) 2367 return soc->ops->rx_offld_ops->register_rx_offld_flush_cb( 2368 rx_ol_flush_cb); 2369 } 2370 2371 /** 2372 * cdp_deregister_rx_offld_flush_cb() - deregister Rx offld flush cb function 2373 * @soc - data path soc handle 2374 * 2375 * deregister rx offload flush callback function pointer 2376 * 2377 * return none 2378 */ 2379 static inline void cdp_deregister_rx_offld_flush_cb(ol_txrx_soc_handle soc) 2380 { 2381 if (!soc || !soc->ops || !soc->ops->rx_offld_ops) { 2382 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 2383 "%s invalid instance", __func__); 2384 return; 2385 } 2386 2387 if (soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb) 2388 return soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb(); 2389 } 2390 #endif /* RECEIVE_OFFLOAD */ 2391 2392 /** 2393 * @cdp_set_ba_timeout() - set ba aging timeout per AC 2394 * 2395 * @soc - pointer to the soc 2396 * @value - timeout value in millisec 2397 * @ac - Access category 2398 * 2399 * @return - void 2400 */ 2401 static inline void cdp_set_ba_timeout(ol_txrx_soc_handle soc, 2402 uint8_t ac, uint32_t value) 2403 { 2404 if (!soc || !soc->ops) { 2405 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2406 "%s: Invalid Instance", __func__); 2407 QDF_BUG(0); 2408 return; 2409 } 2410 2411 if (!soc->ops->cmn_drv_ops || 2412 !soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout) 2413 return; 2414 2415 soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout(soc, ac, value); 2416 } 2417 2418 /** 2419 * @cdp_get_ba_timeout() - return ba aging timeout per AC 2420 * 2421 * @soc - pointer to the soc 2422 * @ac - access category 2423 * @value - timeout value in millisec 2424 * 2425 * @return - void 2426 */ 2427 static inline void cdp_get_ba_timeout(ol_txrx_soc_handle soc, 2428 uint8_t ac, uint32_t *value) 2429 { 2430 if (!soc || !soc->ops) { 2431 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2432 "%s: Invalid Instance", __func__); 2433 QDF_BUG(0); 2434 return; 2435 } 2436 2437 if (!soc->ops->cmn_drv_ops || 2438 !soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout) 2439 return; 2440 2441 soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout(soc, ac, value); 2442 } 2443 2444 /** 2445 * cdp_cfg_get() - get cfg for dp enum 2446 * 2447 * @soc: pointer to the soc 2448 * @cfg: cfg enum 2449 * 2450 * Return - cfg value 2451 */ 2452 static inline uint32_t cdp_cfg_get(ol_txrx_soc_handle soc, enum cdp_dp_cfg cfg) 2453 { 2454 if (!soc || !soc->ops) { 2455 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2456 "%s: Invalid Instance", __func__); 2457 return 0; 2458 } 2459 2460 if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->txrx_get_cfg) 2461 return 0; 2462 2463 return soc->ops->cmn_drv_ops->txrx_get_cfg(soc, cfg); 2464 } 2465 2466 /** 2467 * cdp_soc_set_rate_stats_ctx() - set rate stats context in soc 2468 * @soc: opaque soc handle 2469 * @ctx: rate stats context 2470 * 2471 * Return: void 2472 */ 2473 static inline void 2474 cdp_soc_set_rate_stats_ctx(ol_txrx_soc_handle soc, 2475 void *ctx) 2476 { 2477 if (!soc || !soc->ops) { 2478 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2479 "%s: Invalid Instance:", __func__); 2480 QDF_BUG(0); 2481 return; 2482 } 2483 2484 if (!soc->ops->cmn_drv_ops || 2485 !soc->ops->cmn_drv_ops->set_rate_stats_ctx) 2486 return; 2487 2488 soc->ops->cmn_drv_ops->set_rate_stats_ctx((struct cdp_soc_t *)soc, 2489 ctx); 2490 } 2491 2492 /** 2493 * cdp_soc_get_rate_stats_ctx() - get rate stats context in soc 2494 * @soc: opaque soc handle 2495 * 2496 * Return: void 2497 */ 2498 static inline void* 2499 cdp_soc_get_rate_stats_ctx(ol_txrx_soc_handle soc) 2500 { 2501 if (!soc || !soc->ops) { 2502 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2503 "%s: Invalid Instance:", __func__); 2504 QDF_BUG(0); 2505 return NULL; 2506 } 2507 2508 if (!soc->ops->cmn_drv_ops || 2509 !soc->ops->cmn_drv_ops->get_rate_stats_ctx) 2510 return NULL; 2511 2512 return soc->ops->cmn_drv_ops->get_rate_stats_ctx(soc); 2513 } 2514 2515 /** 2516 * cdp_peer_flush_rate_stats() - flush peer rate statistics 2517 * @soc: opaque soc handle 2518 * @pdev_id: id of pdev handle 2519 * @buf: stats buffer 2520 */ 2521 static inline void 2522 cdp_peer_flush_rate_stats(ol_txrx_soc_handle soc, uint8_t pdev_id, 2523 void *buf) 2524 { 2525 if (!soc || !soc->ops) { 2526 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2527 "%s: Invalid Instance:", __func__); 2528 QDF_BUG(0); 2529 return; 2530 } 2531 2532 if (!soc->ops->cmn_drv_ops || 2533 !soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats) 2534 return; 2535 2536 soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats(soc, pdev_id, buf); 2537 } 2538 2539 /** 2540 * cdp_flush_rate_stats_request() - request flush rate statistics 2541 * @soc: opaque soc handle 2542 * @pdev_id: id of pdev handle 2543 */ 2544 static inline QDF_STATUS 2545 cdp_flush_rate_stats_request(struct cdp_soc_t *soc, uint8_t pdev_id) 2546 { 2547 if (!soc || !soc->ops) { 2548 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2549 "%s: Invalid Instance:", __func__); 2550 QDF_BUG(0); 2551 return QDF_STATUS_E_FAILURE; 2552 } 2553 2554 if (!soc->ops->cmn_drv_ops || 2555 !soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request) 2556 return QDF_STATUS_E_FAILURE; 2557 2558 return soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request(soc, 2559 pdev_id); 2560 } 2561 2562 /** 2563 * cdp_set_vdev_pcp_tid_map() - set vdev pcp-tid-map 2564 * @soc: opaque soc handle 2565 * @vdev: id of data path vdev handle 2566 * @pcp: pcp value 2567 * @tid: tid value 2568 * 2569 * This API is used to configure the pcp-to-tid mapping for a pdev. 2570 * 2571 * Return: QDF_STATUS_SUCCESS if value set successfully 2572 * QDF_STATUS_E_INVAL false if error 2573 */ 2574 static inline 2575 QDF_STATUS cdp_set_vdev_pcp_tid_map(ol_txrx_soc_handle soc, 2576 uint8_t vdev_id, 2577 uint8_t pcp, uint8_t tid) 2578 { 2579 if (!soc || !soc->ops) { 2580 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2581 "%s: Invalid Instance", __func__); 2582 return QDF_STATUS_E_INVAL; 2583 } 2584 2585 if (!soc->ops->cmn_drv_ops || 2586 !soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map) 2587 return QDF_STATUS_E_INVAL; 2588 2589 return soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map(soc, vdev_id, 2590 pcp, tid); 2591 } 2592 2593 /** 2594 * cdp_set_vdev_tidmap_tbl_id() - set vdev tidmap table id 2595 * 2596 * @soc: opaque soc handle 2597 * @vdev: data path vdev handle 2598 * @mapid: value of mapid 2599 * 2600 * This API is used to configure the table-id of the tid-mapping for a vdev. 2601 * Table '0' is for using the pdev's pcp-tid mapping and '1' is for using 2602 * the vdev's pcp-tid mapping. 2603 * 2604 * Return: QDF_STATUS_SUCCESS if value set successfully 2605 * QDF_STATUS_E_INVAL false if error 2606 */ 2607 static inline 2608 QDF_STATUS cdp_set_vdev_tidmap_tbl_id(ol_txrx_soc_handle soc, 2609 struct cdp_vdev *vdev_handle, 2610 uint8_t mapid) 2611 { 2612 if (!soc || !soc->ops) { 2613 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2614 "%s: Invalid Instance", __func__); 2615 return QDF_STATUS_E_INVAL; 2616 } 2617 2618 if (!soc->ops->cmn_drv_ops || 2619 !soc->ops->cmn_drv_ops->set_vdev_tidmap_tbl_id) 2620 return QDF_STATUS_E_INVAL; 2621 2622 return soc->ops->cmn_drv_ops->set_vdev_tidmap_tbl_id(vdev_handle, 2623 mapid); 2624 } 2625 2626 /** 2627 * cdp_set_vdev_tidmap_prty() - set vdev tidmap priority 2628 * @soc: opaque soc handle 2629 * @vdev: data path vdev handle 2630 * @prio: tidmap priority value 2631 * 2632 * This API is used to configure the tidmap priority for a vdev. 2633 * The tidmap priority decides which mapping, namely DSCP-TID, SVLAN_PCP-TID, 2634 * CVLAN_PCP-TID will be used. 2635 * The vdev tidmap priority will be used only when the tidmap_tbl_id is '1'. 2636 * 2637 * Return: QDF_STATUS_SUCCESS if value set successfully 2638 * QDF_STATUS_E_INVAL false if error 2639 */ 2640 static inline 2641 QDF_STATUS cdp_set_vdev_tidmap_prty(ol_txrx_soc_handle soc, 2642 struct cdp_vdev *vdev_handle, uint8_t prio) 2643 { 2644 if (!soc || !soc->ops) { 2645 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 2646 "%s: Invalid Instance", __func__); 2647 return QDF_STATUS_E_INVAL; 2648 } 2649 2650 if (!soc->ops->cmn_drv_ops || 2651 !soc->ops->cmn_drv_ops->set_vdev_tidmap_prty) 2652 return QDF_STATUS_E_INVAL; 2653 2654 return soc->ops->cmn_drv_ops->set_vdev_tidmap_prty(vdev_handle, prio); 2655 } 2656 #endif /* _CDP_TXRX_CMN_H_ */ 2657