1 /* 2 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 #ifndef _DP_MON_H_ 19 #define _DP_MON_H_ 20 21 #include "qdf_trace.h" 22 #include "dp_internal.h" 23 #include "dp_types.h" 24 #include "dp_htt.h" 25 #include "dp_rx_mon.h" 26 27 #include <dp_mon_filter.h> 28 #ifdef WLAN_TX_PKT_CAPTURE_ENH 29 #include "dp_tx_capture.h" 30 #endif 31 32 #ifdef QCA_SUPPORT_LITE_MONITOR 33 #include "dp_lite_mon.h" 34 #endif 35 36 #define DP_INTR_POLL_TIMER_MS 5 37 #define DP_HIST_TRACK_SIZE 50 38 39 #define MON_VDEV_TIMER_INIT 0x1 40 #define MON_VDEV_TIMER_RUNNING 0x2 41 42 /* Budget to reap monitor status ring */ 43 #define DP_MON_REAP_BUDGET 1024 44 #define MON_BUF_MIN_ENTRIES 64 45 46 /* 40MHZ BW 2 20MHZ sub bands */ 47 #define SUB40BW 2 48 /* 80MHZ BW 4 20MHZ sub bands */ 49 #define SUB80BW 4 50 /* 160MHZ BW 8 20MHZ sub bands */ 51 #define SUB160BW 8 52 /* 320MHZ BW 16 20MHZ sub bands */ 53 #define SUB320BW 16 54 55 #define RNG_ERR "SRNG setup failed for" 56 #define dp_mon_info(params...) \ 57 __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_MON, ## params) 58 #define dp_mon_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_MON, params) 59 #define dp_mon_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_MON, params) 60 #define dp_mon_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_MON, params) 61 62 #define dp_mon_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_MON, params) 63 #define dp_mon_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_MON, params) 64 #define dp_mon_info_rl(params...) \ 65 __QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_MON, ## params) 66 67 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE 68 #define IS_LOCAL_PKT_CAPTURE_RUNNING(var, field) ((var)->field) 69 #else 70 #define IS_LOCAL_PKT_CAPTURE_RUNNING(var, field) 0 71 #endif 72 73 #ifdef QCA_ENHANCED_STATS_SUPPORT 74 typedef struct dp_peer_extd_tx_stats dp_mon_peer_tx_stats; 75 typedef struct dp_peer_extd_rx_stats dp_mon_peer_rx_stats; 76 77 #define DP_UPDATE_MON_STATS(_tgtobj, _srcobj) \ 78 DP_UPDATE_EXTD_STATS(_tgtobj, _srcobj) 79 #endif 80 81 #ifndef WLAN_TX_PKT_CAPTURE_ENH 82 struct dp_pdev_tx_capture { 83 }; 84 85 struct dp_peer_tx_capture { 86 }; 87 #endif 88 89 /** 90 * struct ieee80211_ctlframe_addr2 - control frame addr 91 * @i_fc: frame control 92 * @i_aidordur: aid or duration 93 * @i_addr1: address 1 94 * @i_addr2: address 2 95 */ 96 struct ieee80211_ctlframe_addr2 { 97 uint8_t i_fc[2]; 98 uint8_t i_aidordur[2]; 99 uint8_t i_addr1[QDF_NET_MAC_ADDR_MAX_LEN]; 100 uint8_t i_addr2[QDF_NET_MAC_ADDR_MAX_LEN]; 101 } __packed; 102 103 #ifndef WLAN_TX_PKT_CAPTURE_ENH 104 static inline void 105 dp_process_ppdu_stats_update_failed_bitmap(struct dp_pdev *pdev, 106 void *data, 107 uint32_t ppdu_id, 108 uint32_t size) 109 { 110 } 111 #endif 112 113 #ifdef DP_CON_MON_MSI_ENABLED 114 static inline bool dp_is_monitor_mode_using_poll(struct dp_soc *soc) 115 { 116 return false; 117 } 118 #else 119 static inline bool dp_is_monitor_mode_using_poll(struct dp_soc *soc) 120 { 121 return true; 122 } 123 #endif 124 125 /** 126 * dp_mon_soc_attach() - DP monitor soc attach 127 * @soc: Datapath SOC handle 128 * 129 * Return: QDF_STATUS_SUCCESS: Success 130 * QDF_STATUS_E_NOMEM: Error 131 */ 132 QDF_STATUS dp_mon_soc_attach(struct dp_soc *soc); 133 134 /** 135 * dp_mon_soc_detach() - DP monitor soc detach 136 * @soc: Datapath SOC handle 137 * 138 * Return: QDF_STATUS_SUCCESS: Success 139 * QDF_STATUS_E_FAILURE: Error 140 */ 141 QDF_STATUS dp_mon_soc_detach(struct dp_soc *soc); 142 143 /** 144 * dp_mon_soc_cfg_init() - DP monitor soc config init 145 * @soc: Datapath SOC handle 146 * 147 * Return: QDF_STATUS_SUCCESS: Success 148 * QDF_STATUS_E_FAILURE: Error 149 */ 150 QDF_STATUS dp_mon_soc_cfg_init(struct dp_soc *soc); 151 152 /** 153 * dp_mon_pdev_attach() - DP monitor pdev attach 154 * @pdev: Datapath pdev handle 155 * 156 * Return: QDF_STATUS_SUCCESS: Success 157 * QDF_STATUS_E_NOMEM: Error 158 */ 159 QDF_STATUS dp_mon_pdev_attach(struct dp_pdev *pdev); 160 161 /** 162 * dp_mon_pdev_detach() - DP monitor pdev detach 163 * @pdev: Datapath pdev handle 164 * 165 * Return: QDF_STATUS_SUCCESS: Success 166 * QDF_STATUS_E_FAILURE: Error 167 */ 168 QDF_STATUS dp_mon_pdev_detach(struct dp_pdev *pdev); 169 170 /** 171 * dp_mon_pdev_init() - DP monitor pdev init 172 * @pdev: Datapath pdev handle 173 * 174 * Return: QDF_STATUS_SUCCESS: Success 175 * QDF_STATUS_E_FAILURE: Error 176 */ 177 QDF_STATUS dp_mon_pdev_init(struct dp_pdev *pdev); 178 179 /** 180 * dp_mon_pdev_deinit() - DP monitor pdev deinit 181 * @pdev: Datapath pdev handle 182 * 183 * Return: QDF_STATUS_SUCCESS: Success 184 * QDF_STATUS_E_FAILURE: Error 185 */ 186 QDF_STATUS dp_mon_pdev_deinit(struct dp_pdev *pdev); 187 188 /** 189 * dp_mon_vdev_attach() - DP monitor vdev attach 190 * @vdev: Datapath vdev handle 191 * 192 * Return: QDF_STATUS_SUCCESS: Success 193 * QDF_STATUS_E_NOMEM: Error 194 */ 195 QDF_STATUS dp_mon_vdev_attach(struct dp_vdev *vdev); 196 197 /** 198 * dp_mon_vdev_detach() - DP monitor vdev detach 199 * @vdev: Datapath vdev handle 200 * 201 * Return: QDF_STATUS_SUCCESS: Success 202 * QDF_STATUS_E_FAILURE: Error 203 */ 204 QDF_STATUS dp_mon_vdev_detach(struct dp_vdev *vdev); 205 206 /** 207 * dp_mon_peer_attach() - DP monitor peer attach 208 * @peer: Datapath peer handle 209 * 210 * Return: QDF_STATUS_SUCCESS: Success 211 * QDF_STATUS_E_NOMEM: Error 212 */ 213 #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(FEATURE_PERPKT_INFO) 214 QDF_STATUS dp_mon_peer_attach(struct dp_peer *peer); 215 #else 216 static inline 217 QDF_STATUS dp_mon_peer_attach(struct dp_peer *peer) 218 { 219 return QDF_STATUS_SUCCESS; 220 } 221 #endif 222 223 /** 224 * dp_mon_peer_detach() - DP monitor peer detach 225 * @peer: Datapath peer handle 226 * 227 * Return: QDF_STATUS_SUCCESS: Success 228 * QDF_STATUS_E_FAILURE: Error 229 */ 230 QDF_STATUS dp_mon_peer_detach(struct dp_peer *peer); 231 232 /** 233 * dp_mon_peer_get_peerstats_ctx() - Get peer stats context from monitor peer 234 * @peer: Datapath peer handle 235 * 236 * Return: peerstats_ctx 237 */ 238 struct cdp_peer_rate_stats_ctx *dp_mon_peer_get_peerstats_ctx(struct 239 dp_peer *peer); 240 241 #ifdef QCA_ENHANCED_STATS_SUPPORT 242 /** 243 * dp_mon_peer_reset_stats() - Reset monitor peer stats 244 * @peer: Datapath peer handle 245 * 246 * Return: none 247 */ 248 void dp_mon_peer_reset_stats(struct dp_peer *peer); 249 250 /** 251 * dp_mon_peer_get_stats() - Get monitor peer stats 252 * 253 * @peer: Datapath peer handle 254 * @arg: Pointer to stats struct 255 * @type: Update type 256 * 257 * Return: none 258 */ 259 void dp_mon_peer_get_stats(struct dp_peer *peer, void *arg, 260 enum cdp_stat_update_type type); 261 262 /** 263 * dp_mon_invalid_peer_update_pdev_stats() - Update pdev stats from 264 * invalid monitor peer 265 * @pdev: Datapath pdev handle 266 * 267 * Return: none 268 */ 269 void dp_mon_invalid_peer_update_pdev_stats(struct dp_pdev *pdev); 270 271 /** 272 * dp_mon_peer_get_stats_param() - Get stats param value from monitor peer 273 * @peer: Datapath peer handle 274 * @type: Stats type requested 275 * @buf: Pointer to buffer for stats param 276 * 277 * Return: QDF_STATUS 278 */ 279 QDF_STATUS dp_mon_peer_get_stats_param(struct dp_peer *peer, 280 enum cdp_peer_stats_type type, 281 cdp_peer_stats_param_t *buf); 282 #else 283 static inline void dp_mon_peer_reset_stats(struct dp_peer *peer) 284 { 285 } 286 287 static inline 288 void dp_mon_peer_get_stats(struct dp_peer *peer, void *arg, 289 enum cdp_stat_update_type type) 290 { 291 } 292 293 static inline void dp_mon_invalid_peer_update_pdev_stats(struct dp_pdev *pdev) 294 { 295 } 296 297 static inline 298 QDF_STATUS dp_mon_peer_get_stats_param(struct dp_peer *peer, 299 enum cdp_peer_stats_type type, 300 cdp_peer_stats_param_t *buf) 301 { 302 return QDF_STATUS_E_FAILURE; 303 } 304 #endif 305 306 /** 307 * dp_mon_cdp_ops_register() - Register monitor cdp ops 308 * @soc: Datapath soc handle 309 * 310 */ 311 void dp_mon_cdp_ops_register(struct dp_soc *soc); 312 313 /** 314 * dp_mon_cdp_ops_deregister() - deregister monitor cdp ops 315 * @soc: Datapath soc handle 316 * 317 */ 318 void dp_mon_cdp_ops_deregister(struct dp_soc *soc); 319 320 /** 321 * dp_mon_intr_ops_deregister() - deregister monitor interrupt ops 322 * @soc: Datapath soc handle 323 * 324 */ 325 void dp_mon_intr_ops_deregister(struct dp_soc *soc); 326 327 /** 328 * dp_mon_feature_ops_deregister() - deregister monitor feature ops 329 * @soc: Datapath soc handle 330 * 331 */ 332 void dp_mon_feature_ops_deregister(struct dp_soc *soc); 333 334 /** 335 * dp_mon_ops_free() - free monitor ops 336 * @soc: Datapath soc handle 337 * 338 */ 339 void dp_mon_ops_free(struct dp_soc *soc); 340 341 /** 342 * dp_mon_ops_register() - Register monitor ops 343 * @soc: Datapath soc handle 344 * 345 */ 346 void dp_mon_ops_register(struct dp_soc *soc); 347 348 #ifndef DISABLE_MON_CONFIG 349 void dp_mon_register_intr_ops(struct dp_soc *soc); 350 #else 351 static inline void dp_mon_register_intr_ops(struct dp_soc *soc) 352 {} 353 #endif 354 355 /** 356 * dp_mon_htt_srng_setup() - DP mon htt srng setup 357 * @soc: Datapath soc handle 358 * @pdev: Datapath pdev handle 359 * @mac_id: mac id 360 * @mac_for_pdev: mac id mapped pdev 361 * 362 * Return: QDF_STATUS_SUCCESS: Success 363 * QDF_STATUS_E_FAILURE: Error 364 */ 365 QDF_STATUS dp_mon_htt_srng_setup(struct dp_soc *soc, 366 struct dp_pdev *pdev, 367 int mac_id, 368 int mac_for_pdev); 369 370 /** 371 * dp_config_debug_sniffer()- API to enable/disable debug sniffer 372 * @pdev: DP_PDEV handle 373 * @val: user provided value 374 * 375 * Return: 0 for success. nonzero for failure. 376 */ 377 #if defined(QCA_MCOPY_SUPPORT) || defined(QCA_TX_CAPTURE_SUPPORT) 378 QDF_STATUS 379 dp_config_debug_sniffer(struct dp_pdev *pdev, int val); 380 #else 381 static inline QDF_STATUS 382 dp_config_debug_sniffer(struct dp_pdev *pdev, int val) { 383 return QDF_STATUS_E_INVAL; 384 } 385 #endif /* QCA_MCOPY_SUPPORT || QCA_TX_CAPTURE_SUPPORT */ 386 387 /** 388 * dp_mon_config_undecoded_metadata_capture()- API to enable/disable undecoded 389 * metadata capture 390 * @pdev: DP_PDEV handle 391 * @val: user provided value 392 * 393 * Return: 0 for success. nonzero for failure. 394 */ 395 #ifdef QCA_UNDECODED_METADATA_SUPPORT 396 QDF_STATUS 397 dp_mon_config_undecoded_metadata_capture(struct dp_pdev *pdev, int val); 398 #else 399 static inline QDF_STATUS 400 dp_mon_config_undecoded_metadata_capture(struct dp_pdev *pdev, int val) { 401 return QDF_STATUS_E_INVAL; 402 } 403 #endif /* QCA_UNDECODED_METADATA_SUPPORT */ 404 405 /** 406 * dp_htt_ppdu_stats_attach() - attach resources for HTT PPDU stats processing 407 * @pdev: Datapath PDEV handle 408 * 409 * Return: QDF_STATUS_SUCCESS: Success 410 * QDF_STATUS_E_NOMEM: Error 411 */ 412 QDF_STATUS dp_htt_ppdu_stats_attach(struct dp_pdev *pdev); 413 414 /** 415 * dp_htt_ppdu_stats_detach() - detach stats resources 416 * @pdev: Datapath PDEV handle 417 * 418 * Return: void 419 */ 420 void dp_htt_ppdu_stats_detach(struct dp_pdev *pdev); 421 422 /** 423 * dp_set_bpr_enable() - API to enable/disable bpr feature 424 * @pdev: DP_PDEV handle. 425 * @val: Provided value. 426 * 427 * Return: 0 for success. nonzero for failure. 428 */ 429 #ifdef QCA_SUPPORT_BPR 430 QDF_STATUS 431 dp_set_bpr_enable(struct dp_pdev *pdev, int val); 432 #endif 433 434 #ifdef ATH_SUPPORT_NAC 435 int dp_set_filter_neigh_peers(struct dp_pdev *pdev, 436 bool val); 437 #endif /* ATH_SUPPORT_NAC */ 438 439 #ifdef WLAN_ATF_ENABLE 440 void dp_set_atf_stats_enable(struct dp_pdev *pdev, bool value); 441 #endif 442 443 /** 444 * dp_mon_set_bsscolor() - sets bsscolor for tx capture 445 * @pdev: Datapath PDEV handle 446 * @bsscolor: new bsscolor 447 */ 448 void 449 dp_mon_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor); 450 451 /** 452 * dp_pdev_get_filter_ucast_data() - get DP PDEV monitor ucast filter 453 * @pdev_handle: Datapath PDEV handle 454 * 455 * Return: true on ucast filter flag set 456 */ 457 bool dp_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle); 458 459 /** 460 * dp_pdev_get_filter_mcast_data() - get DP PDEV monitor mcast filter 461 * @pdev_handle: Datapath PDEV handle 462 * 463 * Return: true on mcast filter flag set 464 */ 465 bool dp_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle); 466 467 /** 468 * dp_pdev_get_filter_non_data() - get DP PDEV monitor non_data filter 469 * @pdev_handle: Datapath PDEV handle 470 * 471 * Return: true on non data filter flag set 472 */ 473 bool dp_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle); 474 475 /** 476 * dp_set_pktlog_wifi3() - attach txrx vdev 477 * @pdev: Datapath PDEV handle 478 * @event: which event's notifications are being subscribed to 479 * @enable: WDI event subscribe or not. (True or False) 480 * 481 * Return: Success, NULL on failure 482 */ 483 #ifdef WDI_EVENT_ENABLE 484 int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, 485 bool enable); 486 #endif 487 488 /* MCL specific functions */ 489 #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG) 490 /** 491 * dp_pktlogmod_exit() - API to cleanup pktlog info 492 * @pdev: Pdev handle 493 * 494 * Return: none 495 */ 496 void dp_pktlogmod_exit(struct dp_pdev *pdev); 497 #else 498 static inline 499 void dp_pktlogmod_exit(struct dp_pdev *handle) 500 { 501 } 502 #endif 503 504 #ifdef QCA_MONITOR_PKT_SUPPORT 505 /** 506 * dp_vdev_set_monitor_mode_buf_rings() - set monitor mode buf rings 507 * @pdev: DP pdev object 508 * 509 * Allocate SW descriptor pool, buffers, link descriptor memory 510 * Initialize monitor related SRNGs 511 * 512 * Return: QDF_STATUS 513 */ 514 QDF_STATUS dp_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev); 515 516 /** 517 * dp_vdev_set_monitor_mode_rings() - set monitor mode rings 518 * @pdev: DP pdev object 519 * @delayed_replenish: 520 * 521 * Allocate SW descriptor pool, buffers, link descriptor memory 522 * Initialize monitor related SRNGs 523 * 524 * Return: QDF_STATUS 525 */ 526 QDF_STATUS dp_vdev_set_monitor_mode_rings(struct dp_pdev *pdev, 527 uint8_t delayed_replenish); 528 529 #else 530 static inline QDF_STATUS 531 dp_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev) 532 { 533 return QDF_STATUS_SUCCESS; 534 } 535 536 static inline QDF_STATUS 537 dp_vdev_set_monitor_mode_rings(struct dp_pdev *pdev, 538 uint8_t delayed_replenish) 539 { 540 return QDF_STATUS_SUCCESS; 541 } 542 #endif 543 544 #if defined(WDI_EVENT_ENABLE) &&\ 545 (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG) ||\ 546 defined(WLAN_FEATURE_PKT_CAPTURE_V2)) 547 /** 548 * dp_ppdu_stats_ind_handler() - PPDU stats msg handler 549 * @soc: HTT SOC handle 550 * @msg_word: Pointer to payload 551 * @htt_t2h_msg: HTT msg nbuf 552 * 553 * Return: True if buffer should be freed by caller. 554 */ 555 bool dp_ppdu_stats_ind_handler(struct htt_soc *soc, 556 uint32_t *msg_word, 557 qdf_nbuf_t htt_t2h_msg); 558 #endif 559 560 #if defined(QCA_ENHANCED_STATS_SUPPORT) || \ 561 (!defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_PKT_CAPTURE_TX_2_0)) 562 /** 563 * dp_ppdu_desc_deliver(): Function to deliver Tx PPDU status descriptor 564 * to upper layer 565 * @pdev: DP pdev handle 566 * @ppdu_info: per PPDU TLV descriptor 567 * 568 * return: void 569 */ 570 void dp_ppdu_desc_deliver(struct dp_pdev *pdev, struct ppdu_info *ppdu_info); 571 #endif 572 573 #ifdef QCA_RSSI_DB2DBM 574 /** 575 * dp_mon_pdev_params_rssi_dbm_conv() --> to set rssi in dbm conversion 576 * params into monitor pdev. 577 * @cdp_soc: dp soc handle. 578 * @params: cdp_rssi_db2dbm_param_dp structure value. 579 * 580 * Return: QDF_STATUS_SUCCESS if value set successfully 581 * QDF_STATUS_E_INVAL false if error 582 */ 583 QDF_STATUS 584 dp_mon_pdev_params_rssi_dbm_conv(struct cdp_soc_t *cdp_soc, 585 struct cdp_rssi_db2dbm_param_dp *params); 586 #else 587 static inline QDF_STATUS 588 dp_mon_pdev_params_rssi_dbm_conv(struct cdp_soc_t *cdp_soc, 589 struct cdp_rssi_db2dbm_param_dp *params) 590 { 591 return QDF_STATUS_E_INVAL; 592 } 593 #endif /* QCA_RSSI_DB2DBM */ 594 595 #if !defined(DISABLE_MON_CONFIG) 596 typedef QDF_STATUS (*mon_pdev_htt_srng_setup_fp)(struct dp_soc *soc, 597 struct dp_pdev *pdev, 598 int mac_id, 599 int mac_for_pdev); 600 #endif 601 typedef QDF_STATUS (*mon_rings_alloc_fp)(struct dp_pdev *pdev); 602 typedef void (*mon_rings_free_fp)(struct dp_pdev *pdev); 603 typedef QDF_STATUS (*mon_rings_init_fp)(struct dp_pdev *pdev); 604 typedef void (*mon_rings_deinit_fp)(struct dp_pdev *pdev); 605 typedef QDF_STATUS (*mon_soc_attach_fp)(struct dp_soc *soc); 606 typedef QDF_STATUS (*mon_soc_detach_fp)(struct dp_soc *soc); 607 typedef QDF_STATUS (*mon_soc_init_fp)(struct dp_soc *soc); 608 typedef void (*mon_soc_deinit_fp)(struct dp_soc *soc); 609 610 struct dp_mon_ops { 611 QDF_STATUS (*mon_soc_cfg_init)(struct dp_soc *soc); 612 mon_soc_attach_fp mon_soc_attach[2]; 613 mon_soc_detach_fp mon_soc_detach[2]; 614 mon_soc_init_fp mon_soc_init[2]; 615 mon_soc_deinit_fp mon_soc_deinit[2]; 616 QDF_STATUS (*mon_pdev_alloc)(struct dp_pdev *pdev); 617 void (*mon_pdev_free)(struct dp_pdev *pdev); 618 QDF_STATUS (*mon_pdev_attach)(struct dp_pdev *pdev); 619 QDF_STATUS (*mon_pdev_detach)(struct dp_pdev *pdev); 620 QDF_STATUS (*mon_pdev_init)(struct dp_pdev *pdev); 621 QDF_STATUS (*mon_pdev_deinit)(struct dp_pdev *pdev); 622 QDF_STATUS (*mon_vdev_attach)(struct dp_vdev *vdev); 623 QDF_STATUS (*mon_vdev_detach)(struct dp_vdev *vdev); 624 QDF_STATUS (*mon_peer_attach)(struct dp_peer *peer); 625 QDF_STATUS (*mon_peer_detach)(struct dp_peer *peer); 626 struct cdp_peer_rate_stats_ctx *(*mon_peer_get_peerstats_ctx)(struct 627 dp_peer *peer); 628 void (*mon_peer_reset_stats)(struct dp_peer *peer); 629 void (*mon_peer_get_stats)(struct dp_peer *peer, void *arg, 630 enum cdp_stat_update_type type); 631 void (*mon_invalid_peer_update_pdev_stats)(struct dp_pdev *pdev); 632 QDF_STATUS (*mon_peer_get_stats_param)(struct dp_peer *peer, 633 enum cdp_peer_stats_type type, 634 cdp_peer_stats_param_t *buf); 635 QDF_STATUS (*mon_config_debug_sniffer)(struct dp_pdev *pdev, int val); 636 void (*mon_flush_rings)(struct dp_soc *soc); 637 #if !defined(DISABLE_MON_CONFIG) 638 mon_pdev_htt_srng_setup_fp mon_pdev_htt_srng_setup[2]; 639 QDF_STATUS (*mon_soc_htt_srng_setup)(struct dp_soc *soc); 640 #endif 641 #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC) 642 uint32_t (*mon_drop_packets_for_mac)(struct dp_pdev *pdev, 643 uint32_t mac_id, 644 uint32_t quota, 645 bool force_flush); 646 #endif 647 #if defined(DP_CON_MON) 648 void (*mon_service_rings)(struct dp_soc *soc, uint32_t quota); 649 #endif 650 #ifndef DISABLE_MON_CONFIG 651 uint32_t (*mon_rx_process)(struct dp_soc *soc, 652 struct dp_intr *int_ctx, 653 uint32_t mac_id, 654 uint32_t quota); 655 uint32_t (*mon_tx_process)(struct dp_soc *soc, 656 struct dp_intr *int_ctx, 657 uint32_t mac_id, 658 uint32_t quota); 659 void (*print_txmon_ring_stat)(struct dp_pdev *pdev); 660 #endif 661 void (*mon_peer_tx_init)(struct dp_pdev *pdev, struct dp_peer *peer); 662 void (*mon_peer_tx_cleanup)(struct dp_vdev *vdev, 663 struct dp_peer *peer); 664 #ifdef WIFI_MONITOR_SUPPORT 665 void (*mon_peer_tid_peer_id_update)(struct dp_peer *peer, 666 uint16_t peer_id); 667 void (*mon_tx_ppdu_stats_attach)(struct dp_pdev *pdev); 668 void (*mon_tx_ppdu_stats_detach)(struct dp_pdev *pdev); 669 QDF_STATUS (*mon_tx_capture_debugfs_init)(struct dp_pdev *pdev); 670 void (*mon_peer_tx_capture_filter_check)(struct dp_pdev *pdev, 671 struct dp_peer *peer); 672 QDF_STATUS (*mon_tx_add_to_comp_queue)(struct dp_soc *soc, 673 struct dp_tx_desc_s *desc, 674 struct hal_tx_completion_status *ts, 675 uint16_t peer_id); 676 QDF_STATUS (*mon_update_msdu_to_list)(struct dp_soc *soc, 677 struct dp_pdev *pdev, 678 struct dp_peer *peer, 679 struct hal_tx_completion_status *ts, 680 qdf_nbuf_t netbuf); 681 QDF_STATUS 682 (*mon_peer_tx_capture_get_stats)(struct dp_peer *peer, 683 struct cdp_peer_tx_capture_stats *sts); 684 QDF_STATUS 685 (*mon_pdev_tx_capture_get_stats)(struct dp_pdev *pdev, 686 struct cdp_pdev_tx_capture_stats *sts); 687 #endif 688 #if defined(WDI_EVENT_ENABLE) &&\ 689 (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG) ||\ 690 defined(WLAN_FEATURE_PKT_CAPTURE_V2)) 691 bool (*mon_ppdu_stats_ind_handler)(struct htt_soc *soc, 692 uint32_t *msg_word, 693 qdf_nbuf_t htt_t2h_msg); 694 #endif 695 QDF_STATUS (*mon_htt_ppdu_stats_attach)(struct dp_pdev *pdev); 696 void (*mon_htt_ppdu_stats_detach)(struct dp_pdev *pdev); 697 void (*mon_print_pdev_rx_mon_stats)(struct dp_pdev *pdev); 698 699 #ifdef WIFI_MONITOR_SUPPORT 700 void (*mon_print_pdev_tx_capture_stats)(struct dp_pdev *pdev); 701 QDF_STATUS (*mon_config_enh_tx_capture)(struct dp_pdev *pdev, 702 uint8_t val); 703 QDF_STATUS (*mon_tx_peer_filter)(struct dp_pdev *pdev_handle, 704 struct dp_peer *peer_handle, 705 uint8_t is_tx_pkt_cap_enable, 706 uint8_t *peer_mac); 707 #endif 708 #ifdef WLAN_RX_PKT_CAPTURE_ENH 709 QDF_STATUS (*mon_config_enh_rx_capture)(struct dp_pdev *pdev, 710 uint8_t val); 711 #endif 712 #ifdef QCA_SUPPORT_BPR 713 QDF_STATUS (*mon_set_bpr_enable)(struct dp_pdev *pdev, int val); 714 #endif 715 #ifdef ATH_SUPPORT_NAC 716 int (*mon_set_filter_neigh_peers)(struct dp_pdev *pdev, bool val); 717 #endif 718 #ifdef WLAN_ATF_ENABLE 719 void (*mon_set_atf_stats_enable)(struct dp_pdev *pdev, bool value); 720 #endif 721 void (*mon_set_bsscolor)(struct dp_pdev *pdev, uint8_t bsscolor); 722 bool (*mon_pdev_get_filter_ucast_data)(struct cdp_pdev *pdev_handle); 723 bool (*mon_pdev_get_filter_non_data)(struct cdp_pdev *pdev_handle); 724 bool (*mon_pdev_get_filter_mcast_data)(struct cdp_pdev *pdev_handle); 725 #ifdef WDI_EVENT_ENABLE 726 int (*mon_set_pktlog_wifi3)(struct dp_pdev *pdev, uint32_t event, 727 bool enable); 728 #endif 729 #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG) 730 void (*mon_pktlogmod_exit)(struct dp_pdev *pdev); 731 #endif 732 QDF_STATUS (*mon_vdev_set_monitor_mode_buf_rings)(struct dp_pdev *pdev); 733 QDF_STATUS (*mon_vdev_set_monitor_mode_rings)(struct dp_pdev *pdev, 734 uint8_t delayed_replenish); 735 void (*mon_neighbour_peers_detach)(struct dp_pdev *pdev); 736 #ifdef FEATURE_NAC_RSSI 737 QDF_STATUS (*mon_filter_neighbour_peer)(struct dp_pdev *pdev, 738 uint8_t *rx_pkt_hdr); 739 #endif 740 void (*mon_vdev_timer_init)(struct dp_soc *soc); 741 void (*mon_vdev_timer_start)(struct dp_soc *soc); 742 bool (*mon_vdev_timer_stop)(struct dp_soc *soc); 743 void (*mon_vdev_timer_deinit)(struct dp_soc *soc); 744 void (*mon_reap_timer_init)(struct dp_soc *soc); 745 bool (*mon_reap_timer_start)(struct dp_soc *soc, 746 enum cdp_mon_reap_source source); 747 bool (*mon_reap_timer_stop)(struct dp_soc *soc, 748 enum cdp_mon_reap_source source); 749 void (*mon_reap_timer_deinit)(struct dp_soc *soc); 750 #ifdef QCA_MCOPY_SUPPORT 751 QDF_STATUS (*mon_mcopy_check_deliver)(struct dp_pdev *pdev, 752 uint16_t peer_id, 753 uint32_t ppdu_id, 754 uint8_t first_msdu); 755 #endif 756 void (*mon_neighbour_peer_add_ast)(struct dp_pdev *pdev, 757 struct dp_peer *ta_peer, 758 uint8_t *mac_addr, 759 qdf_nbuf_t nbuf, 760 uint32_t flags); 761 #ifdef QCA_ENHANCED_STATS_SUPPORT 762 void (*mon_filter_setup_enhanced_stats)(struct dp_pdev *pdev); 763 void (*mon_filter_reset_enhanced_stats)(struct dp_pdev *pdev); 764 void (*mon_tx_stats_update)(struct dp_mon_peer *mon_peer, 765 struct cdp_tx_completion_ppdu_user *ppdu); 766 void (*mon_tx_enable_enhanced_stats)(struct dp_pdev *pdev); 767 void (*mon_tx_disable_enhanced_stats)(struct dp_pdev *pdev); 768 void (*mon_ppdu_desc_deliver)(struct dp_pdev *pdev, 769 struct ppdu_info *ppdu_info); 770 bool (*mon_ppdu_stats_feat_enable_check)(struct dp_pdev *pdev); 771 void (*mon_ppdu_desc_notify)(struct dp_pdev *pdev, qdf_nbuf_t nbuf); 772 #endif 773 #ifdef QCA_MCOPY_SUPPORT 774 void (*mon_filter_setup_mcopy_mode)(struct dp_pdev *pdev); 775 void (*mon_filter_reset_mcopy_mode)(struct dp_pdev *pdev); 776 #endif 777 #if defined(ATH_SUPPORT_NAC_RSSI) || defined(ATH_SUPPORT_NAC) 778 void (*mon_filter_setup_smart_monitor)(struct dp_pdev *pdev); 779 void (*mon_filter_reset_smart_monitor)(struct dp_pdev *pdev); 780 #endif 781 void (*mon_filter_set_reset_mon_mac_filter)(struct dp_pdev *pdev, 782 bool val); 783 #ifdef WLAN_RX_PKT_CAPTURE_ENH 784 void (*mon_filter_setup_rx_enh_capture)(struct dp_pdev *pdev); 785 void (*mon_filter_reset_rx_enh_capture)(struct dp_pdev *pdev); 786 #endif 787 void (*mon_filter_setup_rx_mon_mode)(struct dp_pdev *pdev); 788 void (*mon_filter_reset_rx_mon_mode)(struct dp_pdev *pdev); 789 void (*mon_filter_setup_tx_mon_mode)(struct dp_pdev *pdev); 790 void (*mon_filter_reset_tx_mon_mode)(struct dp_pdev *pdev); 791 #ifdef WDI_EVENT_ENABLE 792 void (*mon_filter_setup_rx_pkt_log_full)(struct dp_pdev *pdev); 793 void (*mon_filter_reset_rx_pkt_log_full)(struct dp_pdev *pdev); 794 void (*mon_filter_setup_rx_pkt_log_lite)(struct dp_pdev *pdev); 795 void (*mon_filter_reset_rx_pkt_log_lite)(struct dp_pdev *pdev); 796 void (*mon_filter_setup_rx_pkt_log_cbf)(struct dp_pdev *pdev); 797 void (*mon_filter_reset_rx_pkt_log_cbf)(struct dp_pdev *pdev); 798 #ifdef BE_PKTLOG_SUPPORT 799 void (*mon_filter_setup_pktlog_hybrid)(struct dp_pdev *pdev); 800 void (*mon_filter_reset_pktlog_hybrid)(struct dp_pdev *pdev); 801 #endif 802 #endif 803 QDF_STATUS (*rx_mon_filter_update)(struct dp_pdev *pdev); 804 QDF_STATUS (*tx_mon_filter_update)(struct dp_pdev *pdev); 805 QDF_STATUS (*set_mon_mode_buf_rings_tx)(struct dp_pdev *pdev, 806 uint16_t num_buf); 807 808 QDF_STATUS (*tx_mon_filter_alloc)(struct dp_pdev *pdev); 809 void (*tx_mon_filter_dealloc)(struct dp_pdev *pdev); 810 mon_rings_alloc_fp mon_rings_alloc[2]; 811 mon_rings_free_fp mon_rings_free[2]; 812 mon_rings_init_fp mon_rings_init[2]; 813 mon_rings_deinit_fp mon_rings_deinit[2]; 814 815 QDF_STATUS (*rx_mon_buffers_alloc)(struct dp_pdev *pdev); 816 void (*rx_mon_buffers_free)(struct dp_pdev *pdev); 817 void (*rx_mon_desc_pool_init)(struct dp_pdev *pdev); 818 void (*rx_mon_desc_pool_deinit)(struct dp_pdev *pdev); 819 QDF_STATUS (*rx_mon_desc_pool_alloc)(struct dp_pdev *pdev); 820 void (*rx_mon_desc_pool_free)(struct dp_pdev *pdev); 821 void (*tx_mon_desc_pool_init)(struct dp_pdev *pdev); 822 void (*tx_mon_desc_pool_deinit)(struct dp_pdev *pdev); 823 QDF_STATUS (*tx_mon_desc_pool_alloc)(struct dp_pdev *pdev); 824 void (*tx_mon_desc_pool_free)(struct dp_pdev *pdev); 825 void (*rx_mon_enable)(uint32_t *msg_word, 826 struct htt_rx_ring_tlv_filter *tlv_filter); 827 void (*rx_hdr_length_set)(uint32_t *msg_word, 828 struct htt_rx_ring_tlv_filter *tlv_filter); 829 void (*rx_packet_length_set)(uint32_t *msg_word, 830 struct htt_rx_ring_tlv_filter *tlv_filter); 831 void (*rx_wmask_subscribe)(struct dp_soc *soc, 832 uint32_t *msg_word, int pdev_id, 833 struct htt_rx_ring_tlv_filter *tlv_filter); 834 void (*rx_pkt_tlv_offset)(uint32_t *msg_word, 835 struct htt_rx_ring_tlv_filter *tlv_filter); 836 void (*rx_enable_mpdu_logging)(uint32_t *msg_word, 837 struct htt_rx_ring_tlv_filter *tlv_filter); 838 void (*rx_enable_fpmo)(uint32_t *msg_word, 839 struct htt_rx_ring_tlv_filter *tlv_filter); 840 #ifndef DISABLE_MON_CONFIG 841 void (*mon_register_intr_ops)(struct dp_soc *soc); 842 #endif 843 void (*mon_register_feature_ops)(struct dp_soc *soc); 844 #ifdef QCA_ENHANCED_STATS_SUPPORT 845 void (*mon_rx_stats_update)(struct dp_mon_peer *mon_peer, 846 struct cdp_rx_indication_ppdu *ppdu, 847 struct cdp_rx_stats_ppdu_user *ppdu_user); 848 void (*mon_rx_populate_ppdu_usr_info)(struct mon_rx_user_status *rx_user_status, 849 struct cdp_rx_stats_ppdu_user *ppdu_user); 850 void (*mon_rx_populate_ppdu_info)(struct hal_rx_ppdu_info *hal_ppdu_info, 851 struct cdp_rx_indication_ppdu *ppdu); 852 #endif 853 QDF_STATUS (*rx_mon_refill_buf_ring)(struct dp_intr *int_ctx); 854 QDF_STATUS (*tx_mon_refill_buf_ring)(struct dp_intr *int_ctx); 855 #ifdef QCA_UNDECODED_METADATA_SUPPORT 856 QDF_STATUS (*mon_config_undecoded_metadata_capture) 857 (struct dp_pdev *pdev, int val); 858 void (*mon_filter_setup_undecoded_metadata_capture) 859 (struct dp_pdev *pdev); 860 void (*mon_filter_reset_undecoded_metadata_capture) 861 (struct dp_pdev *pdev); 862 #endif 863 QDF_STATUS (*mon_pdev_ext_init)(struct dp_pdev *pdev); 864 QDF_STATUS (*mon_pdev_ext_deinit)(struct dp_pdev *pdev); 865 QDF_STATUS (*mon_rx_pdev_tlv_logger_init)(struct dp_pdev *pdev); 866 QDF_STATUS (*mon_rx_pdev_tlv_logger_deinit)(struct dp_pdev *pdev); 867 QDF_STATUS (*mon_lite_mon_alloc)(struct dp_pdev *pdev); 868 void (*mon_lite_mon_dealloc)(struct dp_pdev *pdev); 869 void (*mon_lite_mon_vdev_delete)(struct dp_pdev *pdev, 870 struct dp_vdev *vdev); 871 void (*mon_lite_mon_disable_rx)(struct dp_pdev *pdev); 872 bool (*mon_lite_mon_is_rx_adv_filter_enable)(struct dp_pdev *pdev); 873 /* Print advanced monitor stats */ 874 void (*mon_rx_print_advanced_stats) 875 (struct dp_soc *soc, struct dp_pdev *pdev); 876 QDF_STATUS (*mon_rx_ppdu_info_cache_create)(struct dp_pdev *pdev); 877 void (*mon_rx_ppdu_info_cache_destroy)(struct dp_pdev *pdev); 878 void (*mon_mac_filter_set)(uint32_t *msg_word, 879 struct htt_rx_ring_tlv_filter *tlv_filter); 880 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE 881 QDF_STATUS (*start_local_pkt_capture)(struct dp_pdev *pdev); 882 QDF_STATUS (*stop_local_pkt_capture)(struct dp_pdev *pdev); 883 bool (*is_local_pkt_capture_running)(struct dp_pdev *pdev); 884 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */ 885 }; 886 887 /** 888 * struct dp_mon_soc_stats - monitor stats 889 * @frag_alloc: Number of frags allocated 890 * @frag_free: Number of frags freed 891 * @empty_queue: Number of frags freed due to empty queue 892 */ 893 struct dp_mon_soc_stats { 894 uint32_t frag_alloc; 895 uint32_t frag_free; 896 uint32_t empty_queue; 897 }; 898 899 struct dp_mon_soc { 900 /* Holds all monitor related fields extracted from dp_soc */ 901 /* Holds pointer to monitor ops */ 902 /* monitor link descriptor pages */ 903 struct qdf_mem_multi_page_t mon_link_desc_pages[MAX_NUM_LMAC_HW]; 904 905 /* total link descriptors for monitor mode for each radio */ 906 uint32_t total_mon_link_descs[MAX_NUM_LMAC_HW]; 907 908 /* Monitor Link descriptor memory banks */ 909 struct link_desc_bank 910 mon_link_desc_banks[MAX_NUM_LMAC_HW][MAX_MON_LINK_DESC_BANKS]; 911 uint32_t num_mon_link_desc_banks[MAX_NUM_LMAC_HW]; 912 /* Smart monitor capability for HKv2 */ 913 uint8_t hw_nac_monitor_support; 914 915 /* Full monitor mode support */ 916 bool full_mon_mode; 917 918 /*interrupt timer*/ 919 qdf_timer_t mon_reap_timer; 920 uint8_t reap_timer_init; 921 922 qdf_spinlock_t reap_timer_lock; 923 924 /* Bitmap to record trigger sources of the reap timer */ 925 qdf_bitmap(mon_reap_src_bitmap, CDP_MON_REAP_SOURCE_NUM); 926 927 qdf_timer_t mon_vdev_timer; 928 uint8_t mon_vdev_timer_state; 929 930 struct dp_mon_ops *mon_ops; 931 bool monitor_mode_v2; 932 #ifndef DISABLE_MON_CONFIG 933 uint32_t (*mon_rx_process)(struct dp_soc *soc, 934 struct dp_intr *int_ctx, 935 uint32_t mac_id, 936 uint32_t quota); 937 #endif 938 939 #ifdef WLAN_TX_PKT_CAPTURE_ENH 940 struct dp_soc_tx_capture dp_soc_tx_capt; 941 #endif 942 /* monitor stats */ 943 struct dp_mon_soc_stats stats; 944 }; 945 946 #ifdef WLAN_CONFIG_TELEMETRY_AGENT 947 struct dp_mon_peer_airtime_consumption { 948 uint32_t consumption; 949 uint16_t avg_consumption_per_sec; 950 }; 951 952 /** 953 * struct dp_mon_peer_airtime_stats - Monitor peer airtime stats 954 * @tx_airtime_consumption: tx artime consumption of peer 955 * @rx_airtime_consumption: rx airtime consumption of peer 956 * @last_update_time: Time when last avergae of airtime is done 957 */ 958 struct dp_mon_peer_airtime_stats { 959 struct dp_mon_peer_airtime_consumption tx_airtime_consumption[WME_AC_MAX]; 960 struct dp_mon_peer_airtime_consumption rx_airtime_consumption[WME_AC_MAX]; 961 uint64_t last_update_time; 962 }; 963 964 /** 965 * struct dp_mon_peer_deterministic - Monitor peer deterministic stats 966 * @deter: Deterministic stats per data tid 967 * @avg_tx_rate: Avg TX rate 968 */ 969 struct dp_mon_peer_deterministic { 970 struct cdp_peer_deter_stats deter[CDP_DATA_TID_MAX]; 971 uint64_t avg_tx_rate; 972 }; 973 #endif 974 975 /** 976 * struct dp_mon_peer_stats - Monitor peer stats 977 * @tx: tx stats 978 * @rx: rx stats 979 * @airtime_stats: mon peer airtime stats 980 * @deter_stats: Deterministic stats 981 */ 982 struct dp_mon_peer_stats { 983 #ifdef QCA_ENHANCED_STATS_SUPPORT 984 dp_mon_peer_tx_stats tx; 985 dp_mon_peer_rx_stats rx; 986 #ifdef WLAN_CONFIG_TELEMETRY_AGENT 987 struct dp_mon_peer_airtime_stats airtime_stats; 988 struct dp_mon_peer_deterministic deter_stats; 989 #endif 990 #endif 991 }; 992 993 struct dp_mon_peer { 994 #ifdef WLAN_TX_PKT_CAPTURE_ENH 995 struct dp_peer_tx_capture tx_capture; 996 #endif 997 #ifdef FEATURE_PERPKT_INFO 998 /* delayed ba ppdu stats handling */ 999 struct cdp_delayed_tx_completion_ppdu_user delayed_ba_ppdu_stats; 1000 /* delayed ba flag */ 1001 bool last_delayed_ba; 1002 /* delayed ba ppdu id */ 1003 uint32_t last_delayed_ba_ppduid; 1004 #endif 1005 uint8_t tx_cap_enabled:1, /* Peer's tx-capture is enabled */ 1006 rx_cap_enabled:1; /* Peer's rx-capture is enabled */ 1007 1008 /* Peer level flag to check peer based pktlog enabled or 1009 * disabled 1010 */ 1011 uint8_t peer_based_pktlog_filter; 1012 1013 /* Monitor peer stats */ 1014 struct dp_mon_peer_stats stats; 1015 1016 /* peer extended statistics context */ 1017 struct cdp_peer_rate_stats_ctx *peerstats_ctx; 1018 }; 1019 1020 struct dp_rx_mon_rssi_offset { 1021 /* Temperature based rssi offset */ 1022 int32_t rssi_temp_offset; 1023 /* Low noise amplifier bypass offset */ 1024 int32_t xlna_bypass_offset; 1025 /* Low noise amplifier bypass threshold */ 1026 int32_t xlna_bypass_threshold; 1027 /* 3 Bytes of xbar_config are used for RF to BB mapping */ 1028 uint32_t xbar_config; 1029 /* min noise floor in active chains per channel */ 1030 int8_t min_nf_dbm; 1031 /* this value is sum of temp_oofset + min_nf*/ 1032 int32_t rssi_offset; 1033 }; 1034 1035 struct dp_ring_ppdu_id_tracker { 1036 uint64_t time_ppdu_id_mon_dest; 1037 uint32_t ppdu_id_mon_dest; 1038 uint64_t time_ppdu_id_mon_status; 1039 uint32_t ppdu_id_mon_status; 1040 uint32_t dest_hp; 1041 uint32_t dest_tp; 1042 int32_t dest_hw_hp; 1043 int32_t dest_hw_tp; 1044 uint32_t status_hp; 1045 uint32_t status_tp; 1046 int32_t status_hw_hp; 1047 int32_t status_hw_tp; 1048 }; 1049 1050 struct dp_mon_pdev { 1051 /* monitor */ 1052 bool monitor_configured; 1053 uint32_t mon_vdev_id; 1054 1055 struct dp_mon_filter **filter; /* Monitor Filter pointer */ 1056 1057 /* advance filter mode and type*/ 1058 uint8_t mon_filter_mode; 1059 uint16_t fp_mgmt_filter; 1060 uint16_t fp_ctrl_filter; 1061 uint16_t fp_data_filter; 1062 uint16_t mo_mgmt_filter; 1063 uint16_t mo_ctrl_filter; 1064 uint16_t mo_data_filter; 1065 uint16_t md_data_filter; 1066 1067 #ifdef WLAN_TX_PKT_CAPTURE_ENH 1068 struct dp_pdev_tx_capture tx_capture; 1069 bool stop_tx_capture_work_q_timer; 1070 #endif 1071 1072 /* tx packet capture enhancement */ 1073 enum cdp_tx_enh_capture_mode tx_capture_enabled; 1074 /* Stuck count on monitor destination ring MPDU process */ 1075 uint32_t mon_dest_ring_stuck_cnt; 1076 /* monitor mode lock */ 1077 qdf_spinlock_t mon_lock; 1078 1079 /* Monitor mode operation channel */ 1080 int mon_chan_num; 1081 1082 /* Monitor mode operation frequency */ 1083 qdf_freq_t mon_chan_freq; 1084 1085 /* Monitor mode band */ 1086 enum reg_wifi_band mon_chan_band; 1087 1088 uint32_t mon_ppdu_status; 1089 /* monitor mode status/destination ring PPDU and MPDU count */ 1090 struct cdp_pdev_mon_stats rx_mon_stats; 1091 /* Monitor mode interface and status storage */ 1092 struct dp_vdev *mvdev; 1093 struct cdp_mon_status rx_mon_recv_status; 1094 /* to track duplicate link descriptor indications by HW for a WAR */ 1095 uint64_t mon_last_linkdesc_paddr; 1096 /* to track duplicate buffer indications by HW for a WAR */ 1097 uint32_t mon_last_buf_cookie; 1098 1099 #ifdef QCA_SUPPORT_FULL_MON 1100 /* List to maintain all MPDUs for a PPDU in monitor mode */ 1101 TAILQ_HEAD(, dp_mon_mpdu) mon_mpdu_q; 1102 1103 /* TODO: define per-user mpdu list 1104 * struct dp_mon_mpdu_list mpdu_list[MAX_MU_USERS]; 1105 */ 1106 struct hal_rx_mon_desc_info *mon_desc; 1107 struct dp_ring_ppdu_id_tracker hist_ppdu_id_mon_d[DP_HIST_TRACK_SIZE]; 1108 struct dp_ring_ppdu_id_tracker hist_ppdu_id_mon_s[DP_HIST_TRACK_SIZE]; 1109 uint8_t hist_mon_dest_idx; 1110 uint8_t hist_mon_status_idx; 1111 #endif 1112 bool set_reset_mon; 1113 bool is_bkpressure; 1114 /* Flag to hold on to monitor destination ring */ 1115 bool hold_mon_dest_ring; 1116 uint64_t reap_status[DP_MON_STATUS_MAX]; 1117 uint64_t prev_status[DP_MON_STATUS_MAX]; 1118 uint64_t status_match[DP_MON_STATUS_MAX]; 1119 1120 /* Flag to indicate monitor rings are initialized */ 1121 uint8_t pdev_mon_init; 1122 #ifndef REMOVE_PKT_LOG 1123 bool pkt_log_init; 1124 struct pktlog_dev_t *pl_dev; /* Pktlog pdev */ 1125 #endif /* #ifndef REMOVE_PKT_LOG */ 1126 1127 /* Smart Mesh */ 1128 bool filter_neighbour_peers; 1129 1130 /*flag to indicate neighbour_peers_list not empty */ 1131 bool neighbour_peers_added; 1132 /* smart mesh mutex */ 1133 qdf_spinlock_t neighbour_peer_mutex; 1134 /* Neighnour peer list */ 1135 TAILQ_HEAD(, dp_neighbour_peer) neighbour_peers_list; 1136 /* Enhanced Stats is enabled */ 1137 uint8_t enhanced_stats_en; 1138 qdf_nbuf_queue_t rx_status_q; 1139 1140 /* 128 bytes mpdu header queue per user for ppdu */ 1141 qdf_nbuf_queue_t mpdu_q[MAX_MU_USERS]; 1142 1143 /* is this a mpdu header TLV and not msdu header TLV */ 1144 bool is_mpdu_hdr[MAX_MU_USERS]; 1145 1146 /* per user 128 bytes msdu header list for MPDU */ 1147 struct msdu_list msdu_list[MAX_MU_USERS]; 1148 1149 /* RX enhanced capture mode */ 1150 uint8_t rx_enh_capture_mode; 1151 /* Rx per peer enhanced capture mode */ 1152 bool rx_enh_capture_peer; 1153 struct dp_vdev *rx_enh_monitor_vdev; 1154 /* RX enhanced capture trailer enable/disable flag */ 1155 bool is_rx_enh_capture_trailer_enabled; 1156 #ifdef WLAN_RX_PKT_CAPTURE_ENH 1157 /* RX per MPDU/PPDU information */ 1158 struct cdp_rx_indication_mpdu mpdu_ind; 1159 #endif 1160 1161 /* Packet log mode */ 1162 uint8_t rx_pktlog_mode; 1163 /* Enable pktlog logging cbf */ 1164 bool rx_pktlog_cbf; 1165 1166 #ifdef BE_PKTLOG_SUPPORT 1167 /* Enable pktlog logging hybrid */ 1168 bool pktlog_hybrid_mode; 1169 #endif 1170 bool tx_sniffer_enable; 1171 /* mirror copy mode */ 1172 enum m_copy_mode mcopy_mode; 1173 bool bpr_enable; 1174 /* Pdev level flag to check peer based pktlog enabled or 1175 * disabled 1176 */ 1177 uint8_t dp_peer_based_pktlog; 1178 1179 #ifdef WLAN_ATF_ENABLE 1180 /* ATF stats enable */ 1181 bool dp_atf_stats_enable; 1182 #endif 1183 1184 /* Maintains first status buffer's paddr of a PPDU */ 1185 uint64_t status_buf_addr; 1186 struct hal_rx_ppdu_info ppdu_info; 1187 1188 /* ppdu_id of last received HTT TX stats */ 1189 uint32_t last_ppdu_id; 1190 struct { 1191 uint8_t last_user; 1192 qdf_nbuf_t buf; 1193 } tx_ppdu_info; 1194 1195 struct { 1196 uint32_t tx_ppdu_id; 1197 uint16_t tx_peer_id; 1198 uint32_t rx_ppdu_id; 1199 } m_copy_id; 1200 1201 /* To check if PPDU Tx stats are enabled for Pktlog */ 1202 bool pktlog_ppdu_stats; 1203 1204 #ifdef ATH_SUPPORT_NAC_RSSI 1205 bool nac_rssi_filtering; 1206 #endif 1207 1208 /* ppdu_stats lock for queue concurrency between cores*/ 1209 qdf_spinlock_t ppdu_stats_lock; 1210 1211 /* list of ppdu tlvs */ 1212 TAILQ_HEAD(, ppdu_info) ppdu_info_list; 1213 TAILQ_HEAD(, ppdu_info) sched_comp_ppdu_list; 1214 1215 uint32_t sched_comp_list_depth; 1216 uint16_t delivered_sched_cmdid; 1217 uint16_t last_sched_cmdid; 1218 uint32_t tlv_count; 1219 uint32_t list_depth; 1220 1221 struct { 1222 qdf_nbuf_t last_nbuf; /*Ptr to mgmt last buf */ 1223 uint8_t *mgmt_buf; /* Ptr to mgmt. payload in HTT ppdu stats */ 1224 uint32_t mgmt_buf_len; /* Len of mgmt. payload in ppdu stats */ 1225 uint32_t ppdu_id; 1226 } mgmtctrl_frm_info; 1227 /* Context of cal client timer */ 1228 struct cdp_cal_client *cal_client_ctx; 1229 uint32_t *ppdu_tlv_buf; /* Buffer to hold HTT ppdu stats TLVs*/ 1230 1231 qdf_nbuf_t mcopy_status_nbuf; 1232 bool is_dp_mon_pdev_initialized; 1233 /* indicates if spcl vap is configured */ 1234 bool scan_spcl_vap_configured; 1235 bool undecoded_metadata_capture; 1236 #ifdef QCA_UNDECODED_METADATA_SUPPORT 1237 uint32_t phyrx_error_mask; 1238 uint32_t phyrx_error_mask_cont; 1239 #endif 1240 #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS 1241 /* enable spcl vap stats reset on ch change */ 1242 bool reset_scan_spcl_vap_stats_enable; 1243 #endif 1244 bool is_tlv_hdr_64_bit; 1245 /* TLV header size*/ 1246 uint8_t tlv_hdr_size; 1247 1248 /* Invalid monitor peer to account for stats in mcopy mode */ 1249 struct dp_mon_peer *invalid_mon_peer; 1250 1251 bool rssi_dbm_conv_support; 1252 struct dp_rx_mon_rssi_offset rssi_offsets; 1253 uint8_t phy_ppdu_id_size; 1254 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE 1255 bool is_local_pkt_capture_running; 1256 #endif 1257 }; 1258 1259 struct dp_mon_vdev { 1260 /* callback to hand rx monitor 802.11 MPDU to the OS shim */ 1261 ol_txrx_rx_mon_fp osif_rx_mon; 1262 #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS 1263 struct cdp_scan_spcl_vap_stats *scan_spcl_vap_stats; 1264 #endif 1265 }; 1266 1267 #if defined(QCA_TX_CAPTURE_SUPPORT) || defined(QCA_ENHANCED_STATS_SUPPORT) 1268 void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf); 1269 #else 1270 static inline 1271 void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf) 1272 { 1273 } 1274 #endif 1275 1276 #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\ 1277 defined(WLAN_SUPPORT_RX_FLOW_TAG) 1278 /** 1279 * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor 1280 * mode and then tags appropriate packets 1281 * @soc: core txrx main context 1282 * @dp_pdev: pdev on which packet is received 1283 * @msdu: QDF packet buffer on which the protocol tag should be set 1284 * @rx_desc: base address where the RX TLVs start 1285 * 1286 * Return: void 1287 */ 1288 void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc, 1289 struct dp_pdev *dp_pdev, 1290 qdf_nbuf_t msdu, void *rx_desc); 1291 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */ 1292 1293 #if !defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) &&\ 1294 !defined(WLAN_SUPPORT_RX_FLOW_TAG) 1295 /** 1296 * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor 1297 * mode and then tags appropriate packets 1298 * @soc: core txrx main context 1299 * @dp_pdev: pdev on which packet is received 1300 * @msdu: QDF packet buffer on which the protocol tag should be set 1301 * @rx_desc: base address where the RX TLVs start 1302 * 1303 * Return: void 1304 */ 1305 static inline 1306 void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc, 1307 struct dp_pdev *dp_pdev, 1308 qdf_nbuf_t msdu, void *rx_desc) 1309 { 1310 } 1311 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */ 1312 1313 #ifndef WLAN_TX_PKT_CAPTURE_ENH 1314 /** 1315 * dp_peer_tid_queue_init() - Initialize ppdu stats queue per TID 1316 * @peer: Datapath peer 1317 * 1318 */ 1319 static inline void dp_peer_tid_queue_init(struct dp_peer *peer) 1320 { 1321 } 1322 1323 /** 1324 * dp_peer_tid_queue_cleanup() - remove ppdu stats queue per TID 1325 * @peer: Datapath peer 1326 * 1327 */ 1328 static inline void dp_peer_tid_queue_cleanup(struct dp_peer *peer) 1329 { 1330 } 1331 1332 /** 1333 * dp_peer_update_80211_hdr() - dp peer update 80211 hdr 1334 * @vdev: Datapath vdev 1335 * @peer: Datapath peer 1336 * 1337 */ 1338 static inline void 1339 dp_peer_update_80211_hdr(struct dp_vdev *vdev, struct dp_peer *peer) 1340 { 1341 } 1342 1343 /** 1344 * dp_get_peer_tx_capture_stats() - to get peer tx capture stats 1345 * @peer: DP PEER handle 1346 * @stats: pointor to peer tx capture stats 1347 * 1348 * return: QDF_STATUS 1349 */ 1350 static inline QDF_STATUS 1351 dp_get_peer_tx_capture_stats(struct dp_peer *peer, 1352 struct cdp_peer_tx_capture_stats *stats) 1353 { 1354 return QDF_STATUS_E_FAILURE; 1355 } 1356 1357 /** 1358 * dp_get_pdev_tx_capture_stats() - to get pdev tx capture stats 1359 * @pdev: DP PDEV handle 1360 * @stats: pointor to pdev tx capture stats 1361 * 1362 * return: QDF_STATUS 1363 */ 1364 static inline QDF_STATUS 1365 dp_get_pdev_tx_capture_stats(struct dp_pdev *pdev, 1366 struct cdp_pdev_tx_capture_stats *stats) 1367 { 1368 return QDF_STATUS_E_FAILURE; 1369 } 1370 #endif 1371 1372 #ifdef WLAN_TX_PKT_CAPTURE_ENH 1373 extern uint8_t 1374 dp_cpu_ring_map[DP_NSS_CPU_RING_MAP_MAX][WLAN_CFG_INT_NUM_CONTEXTS_MAX]; 1375 #endif 1376 1377 /** 1378 * dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap() - Get ppdu stats tlv 1379 * bitmap for sniffer mode 1380 * @bitmap: received bitmap 1381 * 1382 * Return: expected bitmap value, returns zero if doesn't match with 1383 * either 64-bit Tx window or 256-bit window tlv bitmap 1384 */ 1385 int 1386 dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap(uint32_t bitmap); 1387 1388 #if (defined(DP_CON_MON) || defined(WDI_EVENT_ENABLE)) &&\ 1389 (!defined(REMOVE_PKT_LOG)) 1390 /** 1391 * dp_pkt_log_init() - API to initialize packet log 1392 * @soc_hdl: Datapath soc handle 1393 * @pdev_id: id of data path pdev handle 1394 * @scn: HIF context 1395 * 1396 * Return: none 1397 */ 1398 void dp_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn); 1399 #else 1400 static inline void 1401 dp_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn) 1402 { 1403 } 1404 #endif 1405 1406 #if defined(WDI_EVENT_ENABLE) && defined(QCA_ENHANCED_STATS_SUPPORT) 1407 QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev, struct dp_peer *peer); 1408 #else 1409 static inline QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev, 1410 struct dp_peer *peer) 1411 { 1412 return QDF_STATUS_SUCCESS; 1413 } 1414 #endif 1415 1416 #if defined(FEATURE_PERPKT_INFO) && defined(WDI_EVENT_ENABLE) 1417 void dp_send_stats_event(struct dp_pdev *pdev, struct dp_peer *peer, 1418 uint16_t peer_id); 1419 #else 1420 static inline 1421 void dp_send_stats_event(struct dp_pdev *pdev, struct dp_peer *peer, 1422 uint16_t peer_id) 1423 { 1424 } 1425 #endif 1426 1427 #ifndef WLAN_TX_PKT_CAPTURE_ENH 1428 /** 1429 * dp_tx_ppdu_stats_process - Deferred PPDU stats handler 1430 * @context: Opaque work context (PDEV) 1431 * 1432 * Return: none 1433 */ 1434 static inline void dp_tx_ppdu_stats_process(void *context) 1435 { 1436 } 1437 1438 /** 1439 * dp_tx_capture_htt_frame_counter: increment counter for htt_frame_type 1440 * @pdev: DP pdev handle 1441 * @htt_frame_type: htt frame type received from fw 1442 * 1443 * return: void 1444 */ 1445 static inline 1446 void dp_tx_capture_htt_frame_counter(struct dp_pdev *pdev, 1447 uint32_t htt_frame_type) 1448 { 1449 } 1450 1451 #endif 1452 1453 /** 1454 * dp_rx_cookie_2_mon_link_desc_va() - Converts cookie to a virtual address of 1455 * the MSDU Link Descriptor 1456 * @pdev: core txrx pdev context 1457 * @buf_info: buf_info includes cookie that used to lookup virtual address of 1458 * link descriptor. Normally this is just an index into a per pdev array. 1459 * @mac_id: mac id 1460 * 1461 * This is the VA of the link descriptor in monitor mode destination ring, 1462 * that HAL layer later uses to retrieve the list of MSDU's for a given MPDU. 1463 * 1464 * Return: void *: Virtual Address of the Rx descriptor 1465 */ 1466 static inline 1467 void *dp_rx_cookie_2_mon_link_desc_va(struct dp_pdev *pdev, 1468 struct hal_buf_info *buf_info, 1469 int mac_id) 1470 { 1471 void *link_desc_va; 1472 struct qdf_mem_multi_page_t *pages; 1473 uint16_t page_id = LINK_DESC_COOKIE_PAGE_ID(buf_info->sw_cookie); 1474 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 1475 1476 if (!mon_soc) 1477 return NULL; 1478 1479 pages = &mon_soc->mon_link_desc_pages[mac_id]; 1480 if (!pages) 1481 return NULL; 1482 1483 if (qdf_unlikely(page_id >= pages->num_pages)) 1484 return NULL; 1485 1486 link_desc_va = pages->dma_pages[page_id].page_v_addr_start + 1487 (buf_info->paddr - pages->dma_pages[page_id].page_p_addr); 1488 1489 return link_desc_va; 1490 } 1491 1492 /** 1493 * dp_soc_is_full_mon_enable() - Return if full monitor mode is enabled 1494 * @pdev: point to dp pdev 1495 * 1496 * Return: Full monitor mode status 1497 */ 1498 static inline bool dp_soc_is_full_mon_enable(struct dp_pdev *pdev) 1499 { 1500 return (pdev->soc->monitor_soc->full_mon_mode && 1501 pdev->monitor_pdev->monitor_configured) ? true : false; 1502 } 1503 1504 /** 1505 * dp_monitor_is_enable_mcopy_mode() - check if mcopy mode is enabled 1506 * @pdev: point to dp pdev 1507 * 1508 * Return: true if mcopy mode is enabled 1509 */ 1510 static inline bool dp_monitor_is_enable_mcopy_mode(struct dp_pdev *pdev) 1511 { 1512 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1513 return false; 1514 1515 return pdev->monitor_pdev->mcopy_mode; 1516 } 1517 1518 /** 1519 * dp_monitor_is_enable_tx_sniffer() - check if tx sniffer is enabled 1520 * @pdev: point to dp pdev 1521 * 1522 * Return: true if tx sniffer is enabled 1523 */ 1524 static inline bool dp_monitor_is_enable_tx_sniffer(struct dp_pdev *pdev) 1525 { 1526 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1527 return false; 1528 1529 return pdev->monitor_pdev->tx_sniffer_enable; 1530 } 1531 1532 /** 1533 * dp_monitor_is_configured() - check if monitor configured is set 1534 * @pdev: point to dp pdev 1535 * 1536 * Return: true if monitor configured is set 1537 */ 1538 static inline bool dp_monitor_is_configured(struct dp_pdev *pdev) 1539 { 1540 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1541 return false; 1542 1543 return pdev->monitor_pdev->monitor_configured; 1544 } 1545 1546 /** 1547 * dp_monitor_check_com_info_ppdu_id() - check if msdu ppdu_id matches with 1548 * com info ppdu_id 1549 * @pdev: point to dp pdev 1550 * @rx_desc: point to rx_desc 1551 * 1552 * Return: success if ppdu_id matches 1553 */ 1554 static inline QDF_STATUS dp_monitor_check_com_info_ppdu_id(struct dp_pdev *pdev, 1555 void *rx_desc) 1556 { 1557 struct cdp_mon_status *rs; 1558 struct dp_mon_pdev *mon_pdev; 1559 uint32_t msdu_ppdu_id = 0; 1560 1561 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1562 return QDF_STATUS_E_FAILURE; 1563 1564 mon_pdev = pdev->monitor_pdev; 1565 if (qdf_likely(1 != mon_pdev->ppdu_info.rx_status.rxpcu_filter_pass)) 1566 return QDF_STATUS_E_FAILURE; 1567 1568 rs = &pdev->monitor_pdev->rx_mon_recv_status; 1569 if (!rs || rs->cdp_rs_rxdma_err) 1570 return QDF_STATUS_E_FAILURE; 1571 1572 msdu_ppdu_id = hal_rx_get_ppdu_id(pdev->soc->hal_soc, rx_desc); 1573 if (msdu_ppdu_id != mon_pdev->ppdu_info.com_info.ppdu_id) { 1574 QDF_TRACE(QDF_MODULE_ID_DP, 1575 QDF_TRACE_LEVEL_ERROR, 1576 "msdu_ppdu_id=%x,com_info.ppdu_id=%x", 1577 msdu_ppdu_id, 1578 mon_pdev->ppdu_info.com_info.ppdu_id); 1579 return QDF_STATUS_E_FAILURE; 1580 } 1581 1582 return QDF_STATUS_SUCCESS; 1583 } 1584 1585 /** 1586 * dp_monitor_get_rx_status() - get rx status 1587 * @pdev: point to dp pdev 1588 * 1589 * Return: return rx status pointer 1590 */ 1591 static inline struct mon_rx_status* 1592 dp_monitor_get_rx_status(struct dp_pdev *pdev) 1593 { 1594 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1595 return NULL; 1596 1597 return &pdev->monitor_pdev->ppdu_info.rx_status; 1598 } 1599 1600 /** 1601 * dp_monitor_is_chan_band_known() - check if monitor chan band known 1602 * @pdev: point to dp pdev 1603 * 1604 * Return: true if chan band known 1605 */ 1606 static inline bool dp_monitor_is_chan_band_known(struct dp_pdev *pdev) 1607 { 1608 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1609 return false; 1610 1611 if (pdev->monitor_pdev->mon_chan_band != REG_BAND_UNKNOWN) 1612 return true; 1613 1614 return false; 1615 } 1616 1617 /** 1618 * dp_monitor_get_chan_band() - get chan band 1619 * @pdev: point to dp pdev 1620 * 1621 * Return: wifi channel band 1622 */ 1623 static inline enum reg_wifi_band 1624 dp_monitor_get_chan_band(struct dp_pdev *pdev) 1625 { 1626 return pdev->monitor_pdev->mon_chan_band; 1627 } 1628 1629 /** 1630 * dp_monitor_print_tx_stats() - print tx stats from monitor pdev 1631 * @pdev: point to dp pdev 1632 * 1633 */ 1634 static inline void dp_monitor_print_tx_stats(struct dp_pdev *pdev) 1635 { 1636 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1637 return; 1638 1639 DP_PRINT_STATS("ppdu info schedule completion list depth: %d", 1640 pdev->monitor_pdev->sched_comp_list_depth); 1641 DP_PRINT_STATS("delivered sched cmdid: %d", 1642 pdev->monitor_pdev->delivered_sched_cmdid); 1643 DP_PRINT_STATS("cur sched cmdid: %d", 1644 pdev->monitor_pdev->last_sched_cmdid); 1645 DP_PRINT_STATS("ppdu info list depth: %d", 1646 pdev->monitor_pdev->list_depth); 1647 } 1648 1649 /** 1650 * dp_monitor_set_chan_num() - set channel number 1651 * @pdev: point to dp pdev 1652 * @chan_num: channel number 1653 * 1654 */ 1655 static inline void dp_monitor_set_chan_num(struct dp_pdev *pdev, int chan_num) 1656 { 1657 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1658 return; 1659 1660 pdev->monitor_pdev->mon_chan_num = chan_num; 1661 } 1662 1663 /** 1664 * dp_monitor_get_chan_num() - get channel number 1665 * @pdev: DP pdev handle 1666 * 1667 * Return: channel number 1668 */ 1669 static inline int dp_monitor_get_chan_num(struct dp_pdev *pdev) 1670 { 1671 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1672 return 0; 1673 1674 return pdev->monitor_pdev->mon_chan_num; 1675 } 1676 1677 /** 1678 * dp_monitor_set_chan_freq() - set channel frequency 1679 * @pdev: point to dp pdev 1680 * @chan_freq: channel frequency 1681 * 1682 */ 1683 static inline void 1684 dp_monitor_set_chan_freq(struct dp_pdev *pdev, qdf_freq_t chan_freq) 1685 { 1686 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1687 return; 1688 1689 pdev->monitor_pdev->mon_chan_freq = chan_freq; 1690 } 1691 1692 /** 1693 * dp_monitor_get_chan_freq() - get channel frequency 1694 * @pdev: DP pdev handle 1695 * 1696 * Return: channel frequency 1697 */ 1698 static inline qdf_freq_t 1699 dp_monitor_get_chan_freq(struct dp_pdev *pdev) 1700 { 1701 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1702 return 0; 1703 1704 return pdev->monitor_pdev->mon_chan_freq; 1705 } 1706 1707 /** 1708 * dp_monitor_set_chan_band() - set channel band 1709 * @pdev: point to dp pdev 1710 * @chan_band: channel band 1711 * 1712 */ 1713 static inline void 1714 dp_monitor_set_chan_band(struct dp_pdev *pdev, enum reg_wifi_band chan_band) 1715 { 1716 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1717 return; 1718 1719 pdev->monitor_pdev->mon_chan_band = chan_band; 1720 } 1721 1722 /** 1723 * dp_monitor_get_mpdu_status() - get mpdu status 1724 * @pdev: point to dp pdev 1725 * @soc: point to dp soc 1726 * @rx_tlv_hdr: point to rx tlv header 1727 * 1728 */ 1729 static inline void dp_monitor_get_mpdu_status(struct dp_pdev *pdev, 1730 struct dp_soc *soc, 1731 uint8_t *rx_tlv_hdr) 1732 { 1733 struct dp_mon_pdev *mon_pdev; 1734 1735 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 1736 return; 1737 1738 mon_pdev = pdev->monitor_pdev; 1739 hal_rx_mon_hw_desc_get_mpdu_status(soc->hal_soc, rx_tlv_hdr, 1740 &mon_pdev->ppdu_info.rx_status); 1741 } 1742 1743 #ifdef FEATURE_NAC_RSSI 1744 /** 1745 * dp_monitor_drop_inv_peer_pkts() - drop invalid peer pkts 1746 * @vdev: point to dp vdev 1747 * 1748 * Return: success if sta mode and filter for neighbour peers enabled 1749 */ 1750 static inline QDF_STATUS dp_monitor_drop_inv_peer_pkts(struct dp_vdev *vdev) 1751 { 1752 struct dp_pdev *pdev = vdev->pdev; 1753 struct dp_soc *soc = pdev->soc; 1754 1755 if (!soc->monitor_soc) 1756 return QDF_STATUS_E_FAILURE; 1757 1758 if (!soc->monitor_soc->hw_nac_monitor_support && 1759 pdev->monitor_pdev->filter_neighbour_peers && 1760 vdev->opmode == wlan_op_mode_sta) 1761 return QDF_STATUS_SUCCESS; 1762 1763 return QDF_STATUS_E_FAILURE; 1764 } 1765 #else 1766 static inline QDF_STATUS dp_monitor_drop_inv_peer_pkts(struct dp_vdev *vdev) 1767 { 1768 return QDF_STATUS_E_FAILURE; 1769 } 1770 #endif 1771 1772 /** 1773 * dp_peer_ppdu_delayed_ba_init() - Initialize ppdu in peer 1774 * @peer: Datapath peer 1775 * 1776 * return: void 1777 */ 1778 #ifdef FEATURE_PERPKT_INFO 1779 static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer) 1780 { 1781 struct dp_mon_peer *mon_peer = peer->monitor_peer; 1782 1783 if (!mon_peer) 1784 return; 1785 1786 qdf_mem_zero(&mon_peer->delayed_ba_ppdu_stats, 1787 sizeof(struct cdp_delayed_tx_completion_ppdu_user)); 1788 mon_peer->last_delayed_ba = false; 1789 mon_peer->last_delayed_ba_ppduid = 0; 1790 } 1791 #else 1792 static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer) 1793 { 1794 } 1795 #endif 1796 1797 /** 1798 * dp_monitor_vdev_register_osif() - Register osif rx mon 1799 * @vdev: point to vdev 1800 * @txrx_ops: point to ol txrx ops 1801 * 1802 * Return: void 1803 */ 1804 static inline void dp_monitor_vdev_register_osif(struct dp_vdev *vdev, 1805 struct ol_txrx_ops *txrx_ops) 1806 { 1807 if (!vdev->monitor_vdev) 1808 return; 1809 1810 vdev->monitor_vdev->osif_rx_mon = txrx_ops->rx.mon; 1811 } 1812 1813 /** 1814 * dp_monitor_get_monitor_vdev_from_pdev() - Get monitor vdev 1815 * @pdev: point to pdev 1816 * 1817 * Return: pointer to vdev 1818 */ 1819 static inline struct dp_vdev* 1820 dp_monitor_get_monitor_vdev_from_pdev(struct dp_pdev *pdev) 1821 { 1822 if (!pdev || !pdev->monitor_pdev || !pdev->monitor_pdev->mvdev) 1823 return NULL; 1824 1825 return pdev->monitor_pdev->mvdev; 1826 } 1827 1828 /** 1829 * dp_monitor_is_vdev_timer_running() - Get vdev timer status 1830 * @soc: point to soc 1831 * 1832 * Return: true if timer running 1833 */ 1834 static inline bool dp_monitor_is_vdev_timer_running(struct dp_soc *soc) 1835 { 1836 if (qdf_unlikely(!soc || !soc->monitor_soc)) 1837 return false; 1838 1839 return !!(soc->monitor_soc->mon_vdev_timer_state & 1840 MON_VDEV_TIMER_RUNNING); 1841 } 1842 1843 /** 1844 * dp_monitor_get_link_desc_pages() - Get link desc pages 1845 * @soc: point to soc 1846 * @mac_id: mac id 1847 * 1848 * Return: return point to link desc pages 1849 */ 1850 static inline struct qdf_mem_multi_page_t* 1851 dp_monitor_get_link_desc_pages(struct dp_soc *soc, uint32_t mac_id) 1852 { 1853 if (qdf_unlikely(!soc || !soc->monitor_soc)) 1854 return NULL; 1855 1856 return &soc->monitor_soc->mon_link_desc_pages[mac_id]; 1857 } 1858 1859 #ifndef WLAN_SOFTUMAC_SUPPORT 1860 /* 1861 * dp_monitor_get_link_desc_ring() - Get link desc ring 1862 * @soc: point to soc 1863 * @mac_id: mac id 1864 * 1865 * Return: return point to link desc ring 1866 */ 1867 static inline hal_ring_handle_t 1868 dp_monitor_get_link_desc_ring(struct dp_soc *soc, uint32_t mac_id) 1869 { 1870 return soc->rxdma_mon_desc_ring[mac_id].hal_srng; 1871 } 1872 1873 static inline uint32_t 1874 dp_monitor_get_num_link_desc_ring_entries(struct dp_soc *soc, uint32_t mac_id) 1875 { 1876 struct dp_srng *ring; 1877 1878 ring = &soc->rxdma_mon_desc_ring[mac_id]; 1879 1880 return ring->alloc_size / hal_srng_get_entrysize(soc->hal_soc, 1881 RXDMA_MONITOR_DESC); 1882 } 1883 #else 1884 static inline hal_ring_handle_t 1885 dp_monitor_get_link_desc_ring(struct dp_soc *soc, uint32_t mac_id) 1886 { 1887 return soc->sw2rxdma_link_ring[mac_id].hal_srng; 1888 } 1889 1890 static inline uint32_t 1891 dp_monitor_get_num_link_desc_ring_entries(struct dp_soc *soc, uint32_t mac_id) 1892 { 1893 struct dp_srng *ring; 1894 1895 ring = &soc->sw2rxdma_link_ring[mac_id]; 1896 1897 return ring->alloc_size / hal_srng_get_entrysize(soc->hal_soc, 1898 SW2RXDMA_LINK_RELEASE); 1899 } 1900 #endif 1901 1902 /** 1903 * dp_monitor_get_total_link_descs() - Get total link descs 1904 * @soc: point to soc 1905 * @mac_id: mac id 1906 * 1907 * Return: return point total link descs 1908 */ 1909 static inline uint32_t * 1910 dp_monitor_get_total_link_descs(struct dp_soc *soc, uint32_t mac_id) 1911 { 1912 return &soc->monitor_soc->total_mon_link_descs[mac_id]; 1913 } 1914 1915 /** 1916 * dp_monitor_pdev_attach() - Monitor pdev attach 1917 * @pdev: point to pdev 1918 * 1919 * Return: return QDF_STATUS 1920 */ 1921 static inline QDF_STATUS dp_monitor_pdev_attach(struct dp_pdev *pdev) 1922 { 1923 struct dp_mon_ops *monitor_ops; 1924 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 1925 1926 /* 1927 * mon_soc uninitialized modular support enabled 1928 * monitor related attach/detach/init/deinit 1929 * will be done while monitor insmod 1930 */ 1931 if (!mon_soc) 1932 return QDF_STATUS_SUCCESS; 1933 1934 monitor_ops = mon_soc->mon_ops; 1935 if (!monitor_ops || !monitor_ops->mon_pdev_attach) { 1936 dp_mon_debug("callback not registered"); 1937 return QDF_STATUS_E_FAILURE; 1938 } 1939 1940 return monitor_ops->mon_pdev_attach(pdev); 1941 } 1942 1943 /** 1944 * dp_monitor_pdev_detach() - Monitor pdev detach 1945 * @pdev: point to pdev 1946 * 1947 * Return: return QDF_STATUS 1948 */ 1949 static inline QDF_STATUS dp_monitor_pdev_detach(struct dp_pdev *pdev) 1950 { 1951 struct dp_mon_ops *monitor_ops; 1952 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 1953 1954 /* 1955 * mon_soc uninitialized modular support enabled 1956 * monitor related attach/detach/init/deinit 1957 * will be done while monitor insmod 1958 */ 1959 if (!mon_soc) 1960 return QDF_STATUS_SUCCESS; 1961 1962 monitor_ops = mon_soc->mon_ops; 1963 if (!monitor_ops || !monitor_ops->mon_pdev_detach) { 1964 dp_mon_debug("callback not registered"); 1965 return QDF_STATUS_E_FAILURE; 1966 } 1967 1968 return monitor_ops->mon_pdev_detach(pdev); 1969 } 1970 1971 /** 1972 * dp_monitor_vdev_attach() - Monitor vdev attach 1973 * @vdev: point to vdev 1974 * 1975 * Return: return QDF_STATUS 1976 */ 1977 static inline QDF_STATUS dp_monitor_vdev_attach(struct dp_vdev *vdev) 1978 { 1979 struct dp_mon_ops *monitor_ops; 1980 struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc; 1981 1982 if (!mon_soc) 1983 return QDF_STATUS_E_FAILURE; 1984 1985 monitor_ops = mon_soc->mon_ops; 1986 if (!monitor_ops || !monitor_ops->mon_vdev_attach) { 1987 dp_mon_debug("callback not registered"); 1988 return QDF_STATUS_E_FAILURE; 1989 } 1990 1991 return monitor_ops->mon_vdev_attach(vdev); 1992 } 1993 1994 /** 1995 * dp_monitor_vdev_detach() - Monitor vdev detach 1996 * @vdev: point to vdev 1997 * 1998 * Return: return QDF_STATUS 1999 */ 2000 static inline QDF_STATUS dp_monitor_vdev_detach(struct dp_vdev *vdev) 2001 { 2002 struct dp_mon_ops *monitor_ops; 2003 struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc; 2004 2005 if (!mon_soc) 2006 return QDF_STATUS_E_FAILURE; 2007 2008 monitor_ops = mon_soc->mon_ops; 2009 if (!monitor_ops || !monitor_ops->mon_vdev_detach) { 2010 dp_mon_debug("callback not registered"); 2011 return QDF_STATUS_E_FAILURE; 2012 } 2013 2014 return monitor_ops->mon_vdev_detach(vdev); 2015 } 2016 2017 /** 2018 * dp_monitor_peer_attach() - Monitor peer attach 2019 * @soc: point to soc 2020 * @peer: point to peer 2021 * 2022 * Return: return QDF_STATUS 2023 */ 2024 static inline QDF_STATUS dp_monitor_peer_attach(struct dp_soc *soc, 2025 struct dp_peer *peer) 2026 { 2027 struct dp_mon_ops *monitor_ops; 2028 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2029 2030 if (!mon_soc) 2031 return QDF_STATUS_E_FAILURE; 2032 2033 monitor_ops = mon_soc->mon_ops; 2034 if (!monitor_ops || !monitor_ops->mon_peer_attach) { 2035 dp_mon_debug("callback not registered"); 2036 return QDF_STATUS_E_FAILURE; 2037 } 2038 2039 return monitor_ops->mon_peer_attach(peer); 2040 } 2041 2042 /** 2043 * dp_monitor_peer_detach() - Monitor peer detach 2044 * @soc: point to soc 2045 * @peer: point to peer 2046 * 2047 * Return: return QDF_STATUS 2048 */ 2049 static inline QDF_STATUS dp_monitor_peer_detach(struct dp_soc *soc, 2050 struct dp_peer *peer) 2051 { 2052 struct dp_mon_ops *monitor_ops; 2053 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2054 2055 if (!mon_soc) 2056 return QDF_STATUS_E_FAILURE; 2057 2058 monitor_ops = mon_soc->mon_ops; 2059 if (!monitor_ops || !monitor_ops->mon_peer_detach) { 2060 dp_mon_debug("callback not registered"); 2061 return QDF_STATUS_E_FAILURE; 2062 } 2063 2064 return monitor_ops->mon_peer_detach(peer); 2065 } 2066 2067 /** 2068 * dp_monitor_peer_get_peerstats_ctx() - Get peerstats context from monitor peer 2069 * @soc: Datapath soc handle 2070 * @peer: Datapath peer handle 2071 * 2072 * Return: peer stats context 2073 */ 2074 static inline struct cdp_peer_rate_stats_ctx* 2075 dp_monitor_peer_get_peerstats_ctx(struct dp_soc *soc, struct dp_peer *peer) 2076 { 2077 struct dp_mon_ops *monitor_ops; 2078 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2079 2080 if (!mon_soc) 2081 return NULL; 2082 2083 monitor_ops = mon_soc->mon_ops; 2084 if (!monitor_ops || !monitor_ops->mon_peer_get_peerstats_ctx) { 2085 dp_mon_debug("callback not registered"); 2086 return NULL; 2087 } 2088 2089 return monitor_ops->mon_peer_get_peerstats_ctx(peer); 2090 } 2091 2092 /** 2093 * dp_monitor_peer_reset_stats() - Reset monitor peer stats 2094 * @soc: Datapath soc handle 2095 * @peer: Datapath peer handle 2096 * 2097 * Return: none 2098 */ 2099 static inline void dp_monitor_peer_reset_stats(struct dp_soc *soc, 2100 struct dp_peer *peer) 2101 { 2102 struct dp_mon_ops *monitor_ops; 2103 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2104 2105 if (!mon_soc) 2106 return; 2107 2108 monitor_ops = mon_soc->mon_ops; 2109 if (!monitor_ops || !monitor_ops->mon_peer_reset_stats) { 2110 dp_mon_debug("callback not registered"); 2111 return; 2112 } 2113 2114 monitor_ops->mon_peer_reset_stats(peer); 2115 } 2116 2117 /** 2118 * dp_monitor_peer_get_stats() - Get monitor peer stats 2119 * @soc: Datapath soc handle 2120 * @peer: Datapath peer handle 2121 * @arg: Pointer to stats struct 2122 * @type: Update type 2123 * 2124 * Return: none 2125 */ 2126 static inline 2127 void dp_monitor_peer_get_stats(struct dp_soc *soc, struct dp_peer *peer, 2128 void *arg, enum cdp_stat_update_type type) 2129 { 2130 struct dp_mon_ops *monitor_ops; 2131 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2132 2133 if (!mon_soc) 2134 return; 2135 2136 monitor_ops = mon_soc->mon_ops; 2137 if (!monitor_ops || !monitor_ops->mon_peer_get_stats) { 2138 dp_mon_debug("callback not registered"); 2139 return; 2140 } 2141 2142 monitor_ops->mon_peer_get_stats(peer, arg, type); 2143 } 2144 2145 /** 2146 * dp_monitor_invalid_peer_update_pdev_stats() - Update pdev stats from 2147 * invalid monitor peer 2148 * @soc: Datapath soc handle 2149 * @pdev: Datapath pdev handle 2150 * 2151 * Return: none 2152 */ 2153 static inline 2154 void dp_monitor_invalid_peer_update_pdev_stats(struct dp_soc *soc, 2155 struct dp_pdev *pdev) 2156 { 2157 struct dp_mon_ops *monitor_ops; 2158 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2159 2160 if (!mon_soc) 2161 return; 2162 2163 monitor_ops = mon_soc->mon_ops; 2164 if (!monitor_ops || !monitor_ops->mon_invalid_peer_update_pdev_stats) { 2165 dp_mon_debug("callback not registered"); 2166 return; 2167 } 2168 2169 monitor_ops->mon_invalid_peer_update_pdev_stats(pdev); 2170 } 2171 2172 /** 2173 * dp_monitor_peer_get_stats_param() - Get stats param value from monitor peer 2174 * @soc: Datapath soc handle 2175 * @peer: Datapath peer handle 2176 * @type: Stats type requested 2177 * @buf: Pointer to buffer for stats param 2178 * 2179 * Return: QDF_STATUS 2180 */ 2181 static inline QDF_STATUS 2182 dp_monitor_peer_get_stats_param(struct dp_soc *soc, struct dp_peer *peer, 2183 enum cdp_peer_stats_type type, 2184 cdp_peer_stats_param_t *buf) 2185 { 2186 struct dp_mon_ops *monitor_ops; 2187 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2188 2189 if (!mon_soc) 2190 return QDF_STATUS_E_FAILURE; 2191 2192 monitor_ops = mon_soc->mon_ops; 2193 if (!monitor_ops || !monitor_ops->mon_peer_get_stats_param) { 2194 dp_mon_debug("callback not registered"); 2195 return QDF_STATUS_E_FAILURE; 2196 } 2197 2198 return monitor_ops->mon_peer_get_stats_param(peer, type, buf); 2199 } 2200 2201 /** 2202 * dp_monitor_pdev_init() - Monitor pdev init 2203 * @pdev: point to pdev 2204 * 2205 * Return: return QDF_STATUS 2206 */ 2207 static inline QDF_STATUS dp_monitor_pdev_init(struct dp_pdev *pdev) 2208 { 2209 struct dp_mon_ops *monitor_ops; 2210 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2211 2212 /* 2213 * mon_soc uninitialized when modular support enabled 2214 * monitor related attach/detach/init/deinit 2215 * will be done while monitor insmod 2216 */ 2217 if (!mon_soc) 2218 return QDF_STATUS_SUCCESS; 2219 2220 monitor_ops = mon_soc->mon_ops; 2221 if (!monitor_ops || !monitor_ops->mon_pdev_init) { 2222 dp_mon_debug("callback not registered"); 2223 return QDF_STATUS_E_FAILURE; 2224 } 2225 2226 return monitor_ops->mon_pdev_init(pdev); 2227 } 2228 2229 /** 2230 * dp_monitor_pdev_deinit() - Monitor pdev deinit 2231 * @pdev: point to pdev 2232 * 2233 * Return: return QDF_STATUS 2234 */ 2235 static inline QDF_STATUS dp_monitor_pdev_deinit(struct dp_pdev *pdev) 2236 { 2237 struct dp_mon_ops *monitor_ops; 2238 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2239 2240 /* 2241 * mon_soc uninitialized modular when support enabled 2242 * monitor related attach/detach/init/deinit 2243 * will be done while monitor insmod 2244 */ 2245 if (!mon_soc) 2246 return QDF_STATUS_SUCCESS; 2247 2248 monitor_ops = mon_soc->mon_ops; 2249 if (!monitor_ops || !monitor_ops->mon_pdev_deinit) { 2250 dp_mon_debug("callback not registered"); 2251 return QDF_STATUS_E_FAILURE; 2252 } 2253 2254 return monitor_ops->mon_pdev_deinit(pdev); 2255 } 2256 2257 /** 2258 * dp_monitor_soc_cfg_init() - Monitor sco cfg init 2259 * @soc: point to soc 2260 * 2261 * Return: return QDF_STATUS 2262 */ 2263 static inline QDF_STATUS dp_monitor_soc_cfg_init(struct dp_soc *soc) 2264 { 2265 struct dp_mon_ops *monitor_ops; 2266 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2267 2268 /* 2269 * this API is getting call from dp_soc_init, 2270 * mon_soc will be uninitialized when monitor support enabled 2271 * So returning QDF_STATUS_SUCCESS. 2272 * soc cfg init will be done while monitor insmod. 2273 */ 2274 if (!mon_soc) 2275 return QDF_STATUS_SUCCESS; 2276 2277 monitor_ops = mon_soc->mon_ops; 2278 if (!monitor_ops || !monitor_ops->mon_soc_cfg_init) { 2279 dp_mon_debug("callback not registered"); 2280 return QDF_STATUS_E_FAILURE; 2281 } 2282 2283 return monitor_ops->mon_soc_cfg_init(soc); 2284 } 2285 2286 /** 2287 * dp_monitor_config_debug_sniffer() - Monitor config debug sniffer 2288 * @pdev: point to pdev 2289 * @val: val 2290 * 2291 * Return: return QDF_STATUS 2292 */ 2293 static inline QDF_STATUS dp_monitor_config_debug_sniffer(struct dp_pdev *pdev, 2294 int val) 2295 { 2296 struct dp_mon_ops *monitor_ops; 2297 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2298 2299 if (!mon_soc) 2300 return QDF_STATUS_E_FAILURE; 2301 2302 monitor_ops = mon_soc->mon_ops; 2303 if (!monitor_ops || !monitor_ops->mon_config_debug_sniffer) { 2304 dp_mon_debug("callback not registered"); 2305 return QDF_STATUS_E_FAILURE; 2306 } 2307 2308 return monitor_ops->mon_config_debug_sniffer(pdev, val); 2309 } 2310 2311 /** 2312 * dp_monitor_flush_rings() - Flush monitor rings 2313 * @soc: point to soc 2314 * 2315 * Return: None 2316 */ 2317 static inline void dp_monitor_flush_rings(struct dp_soc *soc) 2318 { 2319 struct dp_mon_ops *monitor_ops; 2320 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2321 2322 if (!mon_soc) { 2323 dp_mon_debug("monitor soc is NULL"); 2324 return; 2325 } 2326 2327 monitor_ops = mon_soc->mon_ops; 2328 if (!monitor_ops || !monitor_ops->mon_flush_rings) { 2329 dp_mon_debug("callback not registered"); 2330 return; 2331 } 2332 2333 return monitor_ops->mon_flush_rings(soc); 2334 } 2335 2336 /** 2337 * dp_monitor_config_undecoded_metadata_capture() - Monitor config 2338 * undecoded metadata capture 2339 * @pdev: point to pdev 2340 * @val: val 2341 * 2342 * Return: return QDF_STATUS 2343 */ 2344 #ifdef QCA_UNDECODED_METADATA_SUPPORT 2345 static inline 2346 QDF_STATUS dp_monitor_config_undecoded_metadata_capture(struct dp_pdev *pdev, 2347 int val) 2348 { 2349 struct dp_mon_ops *monitor_ops; 2350 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2351 2352 if (!mon_soc) 2353 return QDF_STATUS_E_FAILURE; 2354 2355 monitor_ops = mon_soc->mon_ops; 2356 if (!monitor_ops || 2357 !monitor_ops->mon_config_undecoded_metadata_capture) { 2358 dp_mon_debug("callback not registered"); 2359 return QDF_STATUS_E_FAILURE; 2360 } 2361 2362 return monitor_ops->mon_config_undecoded_metadata_capture(pdev, val); 2363 } 2364 2365 static inline QDF_STATUS 2366 dp_monitor_config_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev, 2367 int mask, int mask_cont) 2368 { 2369 struct dp_mon_ops *monitor_ops; 2370 struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev; 2371 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2372 2373 if (!mon_soc) 2374 return QDF_STATUS_E_FAILURE; 2375 2376 if (!mon_pdev) 2377 return QDF_STATUS_E_FAILURE; 2378 2379 monitor_ops = mon_soc->mon_ops; 2380 if (!monitor_ops || 2381 !monitor_ops->mon_config_undecoded_metadata_capture) { 2382 dp_mon_debug("callback not registered"); 2383 return QDF_STATUS_E_FAILURE; 2384 } 2385 2386 if (!mon_pdev->undecoded_metadata_capture) { 2387 qdf_info("mask:0x%x mask_cont:0x%x", mask, mask_cont); 2388 return QDF_STATUS_SUCCESS; 2389 } 2390 2391 mon_pdev->phyrx_error_mask = mask; 2392 mon_pdev->phyrx_error_mask_cont = mask_cont; 2393 2394 return monitor_ops->mon_config_undecoded_metadata_capture(pdev, 1); 2395 } 2396 2397 static inline QDF_STATUS 2398 dp_monitor_get_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev, 2399 int *mask, int *mask_cont) 2400 { 2401 struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev; 2402 2403 if (!mon_pdev) 2404 return QDF_STATUS_E_FAILURE; 2405 2406 *mask = mon_pdev->phyrx_error_mask; 2407 *mask_cont = mon_pdev->phyrx_error_mask_cont; 2408 2409 return QDF_STATUS_SUCCESS; 2410 } 2411 #else 2412 static inline 2413 QDF_STATUS dp_monitor_config_undecoded_metadata_capture(struct dp_pdev *pdev, 2414 int val) 2415 { 2416 return QDF_STATUS_SUCCESS; 2417 } 2418 2419 static inline QDF_STATUS 2420 dp_monitor_config_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev, 2421 int mask1, int mask2) 2422 { 2423 return QDF_STATUS_SUCCESS; 2424 } 2425 2426 static inline QDF_STATUS 2427 dp_monitor_get_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev, 2428 int *mask, int *mask_cont) 2429 { 2430 return QDF_STATUS_SUCCESS; 2431 } 2432 #endif /* QCA_UNDECODED_METADATA_SUPPORT */ 2433 2434 /** 2435 * dp_monitor_htt_srng_setup() - Setup htt srng 2436 * @soc: point to soc 2437 * @pdev: point to pdev 2438 * @mac_id: lmac id 2439 * @mac_for_pdev: pdev id 2440 * 2441 * Return: QDF_STATUS 2442 */ 2443 #if !defined(DISABLE_MON_CONFIG) 2444 static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc, 2445 struct dp_pdev *pdev, 2446 int mac_id, 2447 int mac_for_pdev) 2448 { 2449 struct dp_mon_ops *monitor_ops; 2450 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2451 QDF_STATUS status = QDF_STATUS_SUCCESS; 2452 2453 if (!mon_soc) { 2454 dp_mon_debug("monitor soc is NULL"); 2455 return QDF_STATUS_SUCCESS; 2456 } 2457 2458 monitor_ops = mon_soc->mon_ops; 2459 if (!monitor_ops) { 2460 dp_mon_err("monitor_ops is NULL"); 2461 return QDF_STATUS_E_FAILURE; 2462 } 2463 2464 if (monitor_ops->mon_pdev_htt_srng_setup[0]) { 2465 status = monitor_ops->mon_pdev_htt_srng_setup[0](soc, pdev, 2466 mac_id, mac_for_pdev); 2467 if (QDF_IS_STATUS_ERROR(status)) { 2468 dp_mon_err("error: %d", status); 2469 goto error; 2470 } 2471 } 2472 2473 if (monitor_ops->mon_pdev_htt_srng_setup[1]) { 2474 status = monitor_ops->mon_pdev_htt_srng_setup[1](soc, pdev, 2475 mac_id, mac_for_pdev); 2476 if (QDF_IS_STATUS_ERROR(status)) { 2477 dp_mon_err("error: %d", status); 2478 goto error; 2479 } 2480 } 2481 2482 error: 2483 return status; 2484 } 2485 2486 static inline QDF_STATUS dp_monitor_soc_htt_srng_setup(struct dp_soc *soc) 2487 { 2488 struct dp_mon_ops *monitor_ops; 2489 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2490 2491 if (!mon_soc) { 2492 dp_mon_debug("monitor soc is NULL"); 2493 return QDF_STATUS_SUCCESS; 2494 } 2495 2496 monitor_ops = mon_soc->mon_ops; 2497 if (!monitor_ops || !monitor_ops->mon_soc_htt_srng_setup) { 2498 dp_mon_debug("callback not registered"); 2499 return QDF_STATUS_E_FAILURE; 2500 } 2501 2502 return monitor_ops->mon_soc_htt_srng_setup(soc); 2503 } 2504 #else 2505 static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc, 2506 struct dp_pdev *pdev, 2507 int mac_id, 2508 int mac_for_pdev) 2509 { 2510 return QDF_STATUS_SUCCESS; 2511 } 2512 #endif 2513 2514 /** 2515 * dp_monitor_service_mon_rings() - service monitor rings 2516 * @soc: point to soc 2517 * @quota: reap budget 2518 * 2519 * Return: None 2520 */ 2521 #if defined(DP_CON_MON) 2522 static inline 2523 void dp_monitor_service_mon_rings(struct dp_soc *soc, uint32_t quota) 2524 { 2525 struct dp_mon_ops *monitor_ops; 2526 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2527 2528 if (!mon_soc) { 2529 dp_mon_debug("monitor soc is NULL"); 2530 return; 2531 } 2532 2533 monitor_ops = mon_soc->mon_ops; 2534 if (!monitor_ops || !monitor_ops->mon_service_rings) { 2535 dp_mon_debug("callback not registered"); 2536 return; 2537 } 2538 2539 return monitor_ops->mon_service_rings(soc, quota); 2540 } 2541 #endif 2542 2543 /** 2544 * dp_monitor_process() - Process monitor 2545 * @soc: point to soc 2546 * @int_ctx: interrupt ctx 2547 * @mac_id: lma 2548 * @quota: 2549 * 2550 * Return: None 2551 */ 2552 #ifndef DISABLE_MON_CONFIG 2553 static inline 2554 uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx, 2555 uint32_t mac_id, uint32_t quota) 2556 { 2557 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2558 2559 if (!mon_soc) { 2560 dp_mon_debug("monitor soc is NULL"); 2561 return 0; 2562 } 2563 2564 if (!mon_soc->mon_rx_process) { 2565 dp_mon_debug("callback not registered"); 2566 return 0; 2567 } 2568 2569 return mon_soc->mon_rx_process(soc, int_ctx, mac_id, quota); 2570 } 2571 2572 static inline 2573 uint32_t dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx, 2574 uint32_t mac_id, uint32_t quota) 2575 { 2576 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2577 struct dp_mon_ops *monitor_ops; 2578 2579 if (!mon_soc) { 2580 dp_mon_debug("monitor soc is NULL"); 2581 return 0; 2582 } 2583 2584 monitor_ops = mon_soc->mon_ops; 2585 if (!monitor_ops || !monitor_ops->mon_tx_process) { 2586 dp_mon_debug("callback not registered"); 2587 return 0; 2588 } 2589 2590 return monitor_ops->mon_tx_process(soc, int_ctx, mac_id, quota); 2591 } 2592 2593 static inline 2594 uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx) 2595 { 2596 struct dp_soc *soc = int_ctx->soc; 2597 struct dp_mon_ops *monitor_ops; 2598 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2599 2600 if (!mon_soc) { 2601 dp_mon_debug("monitor soc is NULL"); 2602 return 0; 2603 } 2604 2605 monitor_ops = mon_soc->mon_ops; 2606 if (!monitor_ops || !monitor_ops->tx_mon_refill_buf_ring) { 2607 dp_mon_debug("callback not registered"); 2608 return 0; 2609 } 2610 2611 return monitor_ops->tx_mon_refill_buf_ring(int_ctx); 2612 } 2613 2614 static inline 2615 uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx) 2616 { 2617 struct dp_soc *soc = int_ctx->soc; 2618 struct dp_mon_ops *monitor_ops; 2619 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2620 2621 if (!mon_soc) { 2622 dp_mon_debug("monitor soc is NULL"); 2623 return 0; 2624 } 2625 2626 monitor_ops = mon_soc->mon_ops; 2627 if (!monitor_ops || !monitor_ops->rx_mon_refill_buf_ring) { 2628 dp_mon_debug("callback not registered"); 2629 return 0; 2630 } 2631 2632 return monitor_ops->rx_mon_refill_buf_ring(int_ctx); 2633 } 2634 2635 static inline 2636 void dp_print_txmon_ring_stat_from_hal(struct dp_pdev *pdev) 2637 { 2638 struct dp_soc *soc = pdev->soc; 2639 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2640 struct dp_mon_ops *monitor_ops; 2641 2642 if (!mon_soc) { 2643 dp_mon_debug("monitor soc is NULL"); 2644 return; 2645 } 2646 2647 monitor_ops = mon_soc->mon_ops; 2648 if (!monitor_ops || !monitor_ops->print_txmon_ring_stat) { 2649 dp_mon_debug("callback not registered"); 2650 return; 2651 } 2652 2653 monitor_ops->print_txmon_ring_stat(pdev); 2654 } 2655 2656 #else 2657 static inline 2658 uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx, 2659 uint32_t mac_id, uint32_t quota) 2660 { 2661 return 0; 2662 } 2663 2664 static inline uint32_t 2665 dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx, 2666 uint32_t mac_id, uint32_t quota) 2667 { 2668 return 0; 2669 } 2670 2671 static inline 2672 uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx) 2673 { 2674 return 0; 2675 } 2676 2677 static inline 2678 uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx) 2679 { 2680 return 0; 2681 } 2682 2683 static inline 2684 void dp_print_txmon_ring_stat_from_hal(struct dp_pdev *pdev) 2685 { 2686 } 2687 #endif 2688 2689 /** 2690 * dp_monitor_drop_packets_for_mac() - monitor_drop_packets_for_mac 2691 * @pdev: point to pdev 2692 * @mac_id: 2693 * @quota: 2694 * 2695 * Return: 2696 */ 2697 #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC) 2698 static inline 2699 uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev, 2700 uint32_t mac_id, uint32_t quota) 2701 { 2702 struct dp_mon_ops *monitor_ops; 2703 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2704 2705 if (!mon_soc) { 2706 dp_mon_debug("monitor soc is NULL"); 2707 return 0; 2708 } 2709 2710 monitor_ops = mon_soc->mon_ops; 2711 if (!monitor_ops || !monitor_ops->mon_drop_packets_for_mac) { 2712 dp_mon_debug("callback not registered"); 2713 return 0; 2714 } 2715 2716 return monitor_ops->mon_drop_packets_for_mac(pdev, 2717 mac_id, quota, false); 2718 } 2719 #else 2720 static inline 2721 uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev, 2722 uint32_t mac_id, uint32_t quota) 2723 { 2724 return 0; 2725 } 2726 #endif 2727 2728 /** 2729 * dp_monitor_peer_tx_init() - peer tx init 2730 * @pdev: point to pdev 2731 * @peer: point to peer 2732 * 2733 * Return: None 2734 */ 2735 static inline void dp_monitor_peer_tx_init(struct dp_pdev *pdev, 2736 struct dp_peer *peer) 2737 { 2738 struct dp_mon_ops *monitor_ops; 2739 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2740 2741 if (!mon_soc) { 2742 dp_mon_debug("monitor soc is NULL"); 2743 return; 2744 } 2745 2746 monitor_ops = mon_soc->mon_ops; 2747 if (!monitor_ops || !monitor_ops->mon_peer_tx_init) { 2748 dp_mon_debug("callback not registered"); 2749 return; 2750 } 2751 2752 return monitor_ops->mon_peer_tx_init(pdev, peer); 2753 } 2754 2755 /** 2756 * dp_monitor_peer_tx_cleanup() - peer tx cleanup 2757 * @vdev: point to vdev 2758 * @peer: point to peer 2759 * 2760 * Return: None 2761 */ 2762 static inline void dp_monitor_peer_tx_cleanup(struct dp_vdev *vdev, 2763 struct dp_peer *peer) 2764 { 2765 struct dp_mon_ops *monitor_ops; 2766 struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc; 2767 2768 if (!mon_soc) { 2769 dp_mon_debug("monitor soc is NULL"); 2770 return; 2771 } 2772 2773 monitor_ops = mon_soc->mon_ops; 2774 if (!monitor_ops || !monitor_ops->mon_peer_tx_cleanup) { 2775 dp_mon_debug("callback not registered"); 2776 return; 2777 } 2778 2779 return monitor_ops->mon_peer_tx_cleanup(vdev, peer); 2780 } 2781 2782 #ifdef WIFI_MONITOR_SUPPORT 2783 /** 2784 * dp_monitor_peer_tid_peer_id_update() - peer tid update 2785 * @soc: point to soc 2786 * @peer: point to peer 2787 * @peer_id: peer id 2788 * 2789 * Return: None 2790 */ 2791 static inline 2792 void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc, 2793 struct dp_peer *peer, 2794 uint16_t peer_id) 2795 { 2796 struct dp_mon_ops *monitor_ops; 2797 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2798 2799 if (!mon_soc) { 2800 dp_mon_debug("monitor soc is NULL"); 2801 return; 2802 } 2803 2804 monitor_ops = mon_soc->mon_ops; 2805 if (!monitor_ops || !monitor_ops->mon_peer_tid_peer_id_update) { 2806 dp_mon_debug("callback not registered"); 2807 return; 2808 } 2809 2810 return monitor_ops->mon_peer_tid_peer_id_update(peer, peer_id); 2811 } 2812 2813 /** 2814 * dp_monitor_tx_ppdu_stats_attach() - Attach tx ppdu stats 2815 * @pdev: point to pdev 2816 * 2817 * Return: None 2818 */ 2819 static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev) 2820 { 2821 struct dp_mon_ops *monitor_ops; 2822 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2823 2824 if (!mon_soc) { 2825 dp_mon_debug("monitor soc is NULL"); 2826 return; 2827 } 2828 2829 monitor_ops = mon_soc->mon_ops; 2830 if (!monitor_ops || !monitor_ops->mon_tx_ppdu_stats_attach) { 2831 dp_mon_debug("callback not registered"); 2832 return; 2833 } 2834 2835 return monitor_ops->mon_tx_ppdu_stats_attach(pdev); 2836 } 2837 2838 /** 2839 * dp_monitor_tx_ppdu_stats_detach() - Detach tx ppdu stats 2840 * @pdev: point to pdev 2841 * 2842 * Return: None 2843 */ 2844 static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev) 2845 { 2846 struct dp_mon_ops *monitor_ops; 2847 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2848 2849 if (!mon_soc) { 2850 dp_mon_debug("monitor soc is NULL"); 2851 return; 2852 } 2853 2854 monitor_ops = mon_soc->mon_ops; 2855 if (!monitor_ops || !monitor_ops->mon_tx_ppdu_stats_detach) { 2856 dp_mon_debug("callback not registered"); 2857 return; 2858 } 2859 2860 return monitor_ops->mon_tx_ppdu_stats_detach(pdev); 2861 } 2862 2863 /** 2864 * dp_monitor_tx_capture_debugfs_init() - Init tx capture debugfs 2865 * @pdev: point to pdev 2866 * 2867 * Return: QDF_STATUS_SUCCESS 2868 */ 2869 static inline 2870 QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev) 2871 { 2872 struct dp_mon_ops *monitor_ops; 2873 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2874 2875 if (!mon_soc) { 2876 dp_mon_debug("monitor soc is NULL"); 2877 return QDF_STATUS_E_FAILURE; 2878 } 2879 2880 monitor_ops = mon_soc->mon_ops; 2881 if (!monitor_ops || !monitor_ops->mon_tx_capture_debugfs_init) { 2882 dp_mon_debug("callback not registered"); 2883 return QDF_STATUS_E_FAILURE; 2884 } 2885 2886 return monitor_ops->mon_tx_capture_debugfs_init(pdev); 2887 } 2888 2889 /** 2890 * dp_monitor_peer_tx_capture_filter_check() - Check tx capture filter 2891 * @pdev: point to pdev 2892 * @peer: point to peer 2893 * 2894 * Return: None 2895 */ 2896 static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev, 2897 struct dp_peer *peer) 2898 { 2899 struct dp_mon_ops *monitor_ops; 2900 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 2901 2902 if (!mon_soc) { 2903 dp_mon_debug("monitor soc is NULL"); 2904 return; 2905 } 2906 2907 monitor_ops = mon_soc->mon_ops; 2908 if (!monitor_ops || !monitor_ops->mon_peer_tx_capture_filter_check) { 2909 dp_mon_debug("callback not registered"); 2910 return; 2911 } 2912 2913 return monitor_ops->mon_peer_tx_capture_filter_check(pdev, peer); 2914 } 2915 2916 /** 2917 * dp_monitor_tx_add_to_comp_queue() - add completion msdu to queue 2918 * 2919 * This API returns QDF_STATUS_SUCCESS in case where buffer is added 2920 * to txmonitor queue successfully caller will not free the buffer in 2921 * this case. In other cases this API return QDF_STATUS_E_FAILURE and 2922 * caller frees the buffer 2923 * 2924 * @soc: point to soc 2925 * @desc: point to tx desc 2926 * @ts: Tx completion status from HAL/HTT descriptor 2927 * @peer_id: DP peer id 2928 * 2929 * Return: QDF_STATUS 2930 * 2931 */ 2932 static inline 2933 QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc, 2934 struct dp_tx_desc_s *desc, 2935 struct hal_tx_completion_status *ts, 2936 uint16_t peer_id) 2937 { 2938 struct dp_mon_ops *monitor_ops; 2939 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2940 2941 if (!mon_soc) { 2942 dp_mon_debug("monitor soc is NULL"); 2943 return QDF_STATUS_E_FAILURE; 2944 } 2945 2946 monitor_ops = mon_soc->mon_ops; 2947 if (!monitor_ops || !monitor_ops->mon_tx_add_to_comp_queue) { 2948 dp_mon_debug("callback not registered"); 2949 return QDF_STATUS_E_FAILURE; 2950 } 2951 2952 return monitor_ops->mon_tx_add_to_comp_queue(soc, desc, ts, peer_id); 2953 } 2954 2955 static inline 2956 QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc, 2957 struct dp_pdev *pdev, 2958 struct dp_peer *peer, 2959 struct hal_tx_completion_status *ts, 2960 qdf_nbuf_t netbuf) 2961 { 2962 struct dp_mon_ops *monitor_ops; 2963 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2964 2965 if (!mon_soc) { 2966 dp_mon_debug("monitor soc is NULL"); 2967 return QDF_STATUS_SUCCESS; 2968 } 2969 2970 monitor_ops = mon_soc->mon_ops; 2971 if (!monitor_ops || !monitor_ops->mon_update_msdu_to_list) { 2972 dp_mon_debug("callback not registered"); 2973 return QDF_STATUS_E_FAILURE; 2974 } 2975 2976 return monitor_ops->mon_update_msdu_to_list(soc, pdev, 2977 peer, ts, netbuf); 2978 } 2979 2980 /** 2981 * dp_monitor_peer_tx_capture_get_stats - to get Peer Tx Capture stats 2982 * @soc: DP SOC handle 2983 * @peer: DP PEER handle 2984 * @stats: Pointer Peer tx capture stats 2985 * 2986 * Return: QDF_STATUS_E_FAILURE or QDF_STATUS_SUCCESS 2987 */ 2988 static inline QDF_STATUS 2989 dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer, 2990 struct cdp_peer_tx_capture_stats *stats) 2991 { 2992 struct dp_mon_ops *monitor_ops; 2993 struct dp_mon_soc *mon_soc = soc->monitor_soc; 2994 2995 if (!mon_soc) { 2996 dp_mon_debug("monitor soc is NULL"); 2997 return QDF_STATUS_E_FAILURE; 2998 } 2999 3000 monitor_ops = mon_soc->mon_ops; 3001 if (!monitor_ops || !monitor_ops->mon_peer_tx_capture_get_stats) { 3002 dp_mon_debug("callback not registered"); 3003 return QDF_STATUS_E_FAILURE; 3004 } 3005 3006 return monitor_ops->mon_peer_tx_capture_get_stats(peer, stats); 3007 } 3008 3009 /** 3010 * dp_monitor_pdev_tx_capture_get_stats - to get pdev tx capture stats 3011 * @soc: DP SOC handle 3012 * @pdev: DP PDEV handle 3013 * @stats: Pointer to pdev tx capture stats 3014 * 3015 * Return: QDF_STATUS_E_FAILURE or QDF_STATUS_SUCCESS 3016 */ 3017 static inline QDF_STATUS 3018 dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev, 3019 struct cdp_pdev_tx_capture_stats *stats) 3020 { 3021 struct dp_mon_ops *monitor_ops; 3022 struct dp_mon_soc *mon_soc = soc->monitor_soc; 3023 3024 if (!mon_soc) { 3025 dp_mon_debug("monitor soc is NULL"); 3026 return QDF_STATUS_E_FAILURE; 3027 } 3028 3029 monitor_ops = mon_soc->mon_ops; 3030 if (!monitor_ops || !monitor_ops->mon_pdev_tx_capture_get_stats) { 3031 dp_mon_debug("callback not registered"); 3032 return QDF_STATUS_E_FAILURE; 3033 } 3034 3035 return monitor_ops->mon_pdev_tx_capture_get_stats(pdev, stats); 3036 } 3037 #else 3038 static inline 3039 void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc, 3040 struct dp_peer *peer, 3041 uint16_t peer_id) 3042 { 3043 } 3044 3045 static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev) 3046 { 3047 } 3048 3049 static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev) 3050 { 3051 } 3052 3053 static inline 3054 QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev) 3055 { 3056 return QDF_STATUS_E_FAILURE; 3057 } 3058 3059 static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev, 3060 struct dp_peer *peer) 3061 { 3062 } 3063 3064 static inline 3065 QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc, 3066 struct dp_tx_desc_s *desc, 3067 struct hal_tx_completion_status *ts, 3068 uint16_t peer_id) 3069 { 3070 return QDF_STATUS_E_FAILURE; 3071 } 3072 3073 static inline 3074 QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc, 3075 struct dp_pdev *pdev, 3076 struct dp_peer *peer, 3077 struct hal_tx_completion_status *ts, 3078 qdf_nbuf_t netbuf) 3079 { 3080 return QDF_STATUS_E_FAILURE; 3081 } 3082 3083 static inline QDF_STATUS 3084 dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer, 3085 struct cdp_peer_tx_capture_stats *stats) 3086 { 3087 return QDF_STATUS_E_FAILURE; 3088 } 3089 3090 static inline QDF_STATUS 3091 dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev, 3092 struct cdp_pdev_tx_capture_stats *stats) 3093 { 3094 return QDF_STATUS_E_FAILURE; 3095 } 3096 #endif 3097 3098 /** 3099 * dp_monitor_ppdu_stats_ind_handler() - PPDU stats msg handler 3100 * @soc: HTT SOC handle 3101 * @msg_word: Pointer to payload 3102 * @htt_t2h_msg: HTT msg nbuf 3103 * 3104 * Return: True if buffer should be freed by caller. 3105 */ 3106 #if defined(WDI_EVENT_ENABLE) &&\ 3107 (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG) ||\ 3108 defined(WLAN_FEATURE_PKT_CAPTURE_V2)) 3109 static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc, 3110 uint32_t *msg_word, 3111 qdf_nbuf_t htt_t2h_msg) 3112 { 3113 struct dp_mon_ops *monitor_ops; 3114 struct dp_mon_soc *mon_soc = soc->dp_soc->monitor_soc; 3115 3116 if (!mon_soc) { 3117 dp_mon_debug("monitor soc is NULL"); 3118 return true; 3119 } 3120 3121 monitor_ops = mon_soc->mon_ops; 3122 if (!monitor_ops || !monitor_ops->mon_ppdu_stats_ind_handler) { 3123 dp_mon_debug("callback not registered"); 3124 return true; 3125 } 3126 3127 return monitor_ops->mon_ppdu_stats_ind_handler(soc, msg_word, 3128 htt_t2h_msg); 3129 } 3130 #else 3131 static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc, 3132 uint32_t *msg_word, 3133 qdf_nbuf_t htt_t2h_msg) 3134 { 3135 return true; 3136 } 3137 #endif 3138 3139 /** 3140 * dp_monitor_htt_ppdu_stats_attach() - attach resources for HTT PPDU 3141 * stats processing 3142 * @pdev: Datapath PDEV handle 3143 * 3144 * Return: QDF_STATUS 3145 */ 3146 static inline QDF_STATUS dp_monitor_htt_ppdu_stats_attach(struct dp_pdev *pdev) 3147 { 3148 struct dp_mon_ops *monitor_ops; 3149 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3150 3151 if (!mon_soc) { 3152 dp_mon_debug("monitor soc is NULL"); 3153 return QDF_STATUS_SUCCESS; 3154 } 3155 3156 monitor_ops = mon_soc->mon_ops; 3157 if (!monitor_ops || !monitor_ops->mon_htt_ppdu_stats_attach) { 3158 dp_mon_debug("callback not registered"); 3159 return QDF_STATUS_E_FAILURE; 3160 } 3161 3162 return monitor_ops->mon_htt_ppdu_stats_attach(pdev); 3163 } 3164 3165 /** 3166 * dp_monitor_htt_ppdu_stats_detach() - detach stats resources 3167 * @pdev: Datapath PDEV handle 3168 * 3169 * Return: void 3170 */ 3171 static inline void dp_monitor_htt_ppdu_stats_detach(struct dp_pdev *pdev) 3172 { 3173 struct dp_mon_ops *monitor_ops; 3174 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3175 3176 if (!mon_soc) { 3177 dp_mon_debug("monitor soc is NULL"); 3178 return; 3179 } 3180 3181 monitor_ops = mon_soc->mon_ops; 3182 if (!monitor_ops || !monitor_ops->mon_htt_ppdu_stats_detach) { 3183 dp_mon_debug("callback not registered"); 3184 return; 3185 } 3186 3187 return monitor_ops->mon_htt_ppdu_stats_detach(pdev); 3188 } 3189 3190 /** 3191 * dp_monitor_print_pdev_rx_mon_stats() - print rx mon stats 3192 * @pdev: Datapath PDEV handle 3193 * 3194 * Return: void 3195 */ 3196 static inline void dp_monitor_print_pdev_rx_mon_stats(struct dp_pdev *pdev) 3197 { 3198 struct dp_mon_ops *monitor_ops; 3199 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3200 3201 if (!mon_soc) { 3202 dp_mon_debug("monitor soc is NULL"); 3203 return; 3204 } 3205 3206 monitor_ops = mon_soc->mon_ops; 3207 if (!monitor_ops || !monitor_ops->mon_print_pdev_rx_mon_stats) { 3208 dp_mon_debug("callback not registered"); 3209 return; 3210 } 3211 3212 return monitor_ops->mon_print_pdev_rx_mon_stats(pdev); 3213 } 3214 3215 #ifdef WIFI_MONITOR_SUPPORT 3216 /** 3217 * dp_monitor_print_pdev_tx_capture_stats() - print tx capture stats 3218 * @pdev: Datapath PDEV handle 3219 * 3220 * Return: void 3221 */ 3222 static inline void dp_monitor_print_pdev_tx_capture_stats(struct dp_pdev *pdev) 3223 { 3224 struct dp_mon_ops *monitor_ops; 3225 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3226 3227 if (!mon_soc) { 3228 dp_mon_debug("monitor soc is NULL"); 3229 return; 3230 } 3231 3232 monitor_ops = mon_soc->mon_ops; 3233 if (!monitor_ops || !monitor_ops->mon_print_pdev_tx_capture_stats) { 3234 dp_mon_debug("callback not registered"); 3235 return; 3236 } 3237 3238 return monitor_ops->mon_print_pdev_tx_capture_stats(pdev); 3239 } 3240 3241 /** 3242 * dp_monitor_config_enh_tx_capture() - configure tx capture 3243 * @pdev: Datapath PDEV handle 3244 * @val: mode 3245 * 3246 * Return: status 3247 */ 3248 static inline QDF_STATUS dp_monitor_config_enh_tx_capture(struct dp_pdev *pdev, 3249 uint32_t val) 3250 { 3251 struct dp_mon_ops *monitor_ops; 3252 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3253 3254 if (!mon_soc) { 3255 dp_mon_debug("monitor soc is NULL"); 3256 return QDF_STATUS_E_FAILURE; 3257 } 3258 3259 monitor_ops = mon_soc->mon_ops; 3260 if (!monitor_ops || !monitor_ops->mon_config_enh_tx_capture) { 3261 dp_mon_debug("callback not registered"); 3262 return QDF_STATUS_E_FAILURE; 3263 } 3264 3265 return monitor_ops->mon_config_enh_tx_capture(pdev, val); 3266 } 3267 3268 /** 3269 * dp_monitor_tx_peer_filter() - add tx monitor peer filter 3270 * @pdev: Datapath PDEV handle 3271 * @peer: Datapath PEER handle 3272 * @is_tx_pkt_cap_enable: flag for tx capture enable/disable 3273 * @peer_mac: peer mac address 3274 * 3275 * Return: status 3276 */ 3277 static inline QDF_STATUS dp_monitor_tx_peer_filter(struct dp_pdev *pdev, 3278 struct dp_peer *peer, 3279 uint8_t is_tx_pkt_cap_enable, 3280 uint8_t *peer_mac) 3281 { 3282 struct dp_mon_ops *monitor_ops; 3283 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3284 3285 if (!mon_soc) { 3286 qdf_err("monitor soc is NULL"); 3287 return QDF_STATUS_E_FAILURE; 3288 } 3289 3290 monitor_ops = mon_soc->mon_ops; 3291 if (!monitor_ops || !monitor_ops->mon_tx_peer_filter) { 3292 qdf_err("callback not registered"); 3293 return QDF_STATUS_E_FAILURE; 3294 } 3295 3296 return monitor_ops->mon_tx_peer_filter(pdev, peer, is_tx_pkt_cap_enable, 3297 peer_mac); 3298 } 3299 #endif 3300 3301 #ifdef WLAN_RX_PKT_CAPTURE_ENH 3302 static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev, 3303 uint32_t val) 3304 { 3305 struct dp_mon_ops *monitor_ops; 3306 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3307 3308 if (!mon_soc) { 3309 dp_mon_debug("monitor soc is NULL"); 3310 return QDF_STATUS_E_FAILURE; 3311 } 3312 3313 monitor_ops = mon_soc->mon_ops; 3314 if (!monitor_ops || !monitor_ops->mon_config_enh_rx_capture) { 3315 dp_mon_debug("callback not registered"); 3316 return QDF_STATUS_E_FAILURE; 3317 } 3318 3319 return monitor_ops->mon_config_enh_rx_capture(pdev, val); 3320 } 3321 #else 3322 static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev, 3323 uint32_t val) 3324 { 3325 return QDF_STATUS_E_INVAL; 3326 } 3327 #endif 3328 3329 #ifdef QCA_SUPPORT_BPR 3330 static inline QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev, 3331 uint32_t val) 3332 { 3333 struct dp_mon_ops *monitor_ops; 3334 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3335 3336 if (!mon_soc) { 3337 dp_mon_debug("monitor soc is NULL"); 3338 return QDF_STATUS_E_FAILURE; 3339 } 3340 3341 monitor_ops = mon_soc->mon_ops; 3342 if (!monitor_ops || !monitor_ops->mon_set_bpr_enable) { 3343 dp_mon_debug("callback not registered"); 3344 return QDF_STATUS_E_FAILURE; 3345 } 3346 3347 return monitor_ops->mon_set_bpr_enable(pdev, val); 3348 } 3349 #else 3350 static inline QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev, 3351 uint32_t val) 3352 { 3353 return QDF_STATUS_E_FAILURE; 3354 } 3355 #endif 3356 3357 #ifdef ATH_SUPPORT_NAC 3358 static inline 3359 int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val) 3360 { 3361 struct dp_mon_ops *monitor_ops; 3362 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3363 3364 if (!mon_soc) { 3365 dp_mon_debug("monitor soc is NULL"); 3366 return 0; 3367 } 3368 3369 monitor_ops = mon_soc->mon_ops; 3370 if (!monitor_ops || !monitor_ops->mon_set_filter_neigh_peers) { 3371 dp_mon_debug("callback not registered"); 3372 return 0; 3373 } 3374 3375 return monitor_ops->mon_set_filter_neigh_peers(pdev, val); 3376 } 3377 #else 3378 static inline 3379 int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val) 3380 { 3381 return 0; 3382 } 3383 #endif 3384 3385 #ifdef WLAN_ATF_ENABLE 3386 static inline 3387 void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value) 3388 { 3389 struct dp_mon_ops *monitor_ops; 3390 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3391 3392 if (!mon_soc) { 3393 dp_mon_debug("monitor soc is NULL"); 3394 return; 3395 } 3396 3397 monitor_ops = mon_soc->mon_ops; 3398 if (!monitor_ops || !monitor_ops->mon_set_atf_stats_enable) { 3399 dp_mon_debug("callback not registered"); 3400 return; 3401 } 3402 3403 return monitor_ops->mon_set_atf_stats_enable(pdev, value); 3404 } 3405 #else 3406 static inline 3407 void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value) 3408 { 3409 } 3410 #endif 3411 3412 static inline 3413 void dp_monitor_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor) 3414 { 3415 struct dp_mon_ops *monitor_ops; 3416 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3417 3418 if (!mon_soc) { 3419 dp_mon_debug("monitor soc is NULL"); 3420 return; 3421 } 3422 3423 monitor_ops = mon_soc->mon_ops; 3424 if (!monitor_ops || !monitor_ops->mon_set_bsscolor) { 3425 dp_mon_debug("callback not registered"); 3426 return; 3427 } 3428 3429 return monitor_ops->mon_set_bsscolor(pdev, bsscolor); 3430 } 3431 3432 static inline 3433 bool dp_monitor_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle) 3434 { 3435 struct dp_mon_ops *monitor_ops; 3436 struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; 3437 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3438 3439 if (!mon_soc) { 3440 dp_mon_debug("monitor soc is NULL"); 3441 return false; 3442 } 3443 3444 monitor_ops = mon_soc->mon_ops; 3445 if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_mcast_data) { 3446 dp_mon_debug("callback not registered"); 3447 return false; 3448 } 3449 3450 return monitor_ops->mon_pdev_get_filter_mcast_data(pdev_handle); 3451 } 3452 3453 static inline 3454 bool dp_monitor_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle) 3455 { 3456 struct dp_mon_ops *monitor_ops; 3457 struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; 3458 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3459 3460 if (!mon_soc) { 3461 dp_mon_debug("monitor soc is NULL"); 3462 return false; 3463 } 3464 3465 monitor_ops = mon_soc->mon_ops; 3466 if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_non_data) { 3467 dp_mon_debug("callback not registered"); 3468 return false; 3469 } 3470 3471 return monitor_ops->mon_pdev_get_filter_non_data(pdev_handle); 3472 } 3473 3474 static inline 3475 bool dp_monitor_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle) 3476 { 3477 struct dp_mon_ops *monitor_ops; 3478 struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; 3479 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3480 3481 if (!mon_soc) { 3482 dp_mon_debug("monitor soc is NULL"); 3483 return false; 3484 } 3485 3486 monitor_ops = mon_soc->mon_ops; 3487 if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_ucast_data) { 3488 dp_mon_debug("callback not registered"); 3489 return false; 3490 } 3491 3492 return monitor_ops->mon_pdev_get_filter_ucast_data(pdev_handle); 3493 } 3494 3495 #ifdef WDI_EVENT_ENABLE 3496 static inline 3497 int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, 3498 bool enable) 3499 { 3500 struct dp_mon_ops *monitor_ops; 3501 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3502 3503 if (!mon_soc) { 3504 dp_mon_debug("monitor soc is NULL"); 3505 return 0; 3506 } 3507 3508 monitor_ops = mon_soc->mon_ops; 3509 if (!monitor_ops || !monitor_ops->mon_set_pktlog_wifi3) { 3510 dp_mon_debug("callback not registered"); 3511 return 0; 3512 } 3513 3514 return monitor_ops->mon_set_pktlog_wifi3(pdev, event, enable); 3515 } 3516 #else 3517 static inline 3518 int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, 3519 bool enable) 3520 { 3521 return 0; 3522 } 3523 #endif 3524 3525 #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG) 3526 static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev) 3527 { 3528 struct dp_mon_ops *monitor_ops; 3529 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3530 3531 if (!mon_soc) { 3532 dp_mon_debug("monitor soc is NULL"); 3533 return; 3534 } 3535 3536 monitor_ops = mon_soc->mon_ops; 3537 if (!monitor_ops || !monitor_ops->mon_pktlogmod_exit) { 3538 dp_mon_debug("callback not registered"); 3539 return; 3540 } 3541 3542 return monitor_ops->mon_pktlogmod_exit(pdev); 3543 } 3544 #else 3545 static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev) {} 3546 #endif 3547 3548 static inline 3549 QDF_STATUS dp_monitor_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev) 3550 { 3551 struct dp_mon_ops *monitor_ops; 3552 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3553 3554 if (!mon_soc) { 3555 dp_mon_debug("monitor soc is NULL"); 3556 return QDF_STATUS_E_FAILURE; 3557 } 3558 3559 monitor_ops = mon_soc->mon_ops; 3560 if (!monitor_ops || !monitor_ops->mon_vdev_set_monitor_mode_buf_rings) { 3561 dp_mon_debug("callback not registered"); 3562 return QDF_STATUS_E_FAILURE; 3563 } 3564 3565 return monitor_ops->mon_vdev_set_monitor_mode_buf_rings(pdev); 3566 } 3567 3568 static inline 3569 void dp_monitor_neighbour_peers_detach(struct dp_pdev *pdev) 3570 { 3571 struct dp_mon_ops *monitor_ops; 3572 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3573 3574 if (!mon_soc) { 3575 dp_mon_debug("monitor soc is NULL"); 3576 return; 3577 } 3578 3579 monitor_ops = mon_soc->mon_ops; 3580 if (!monitor_ops || !monitor_ops->mon_neighbour_peers_detach) { 3581 dp_mon_debug("callback not registered"); 3582 return; 3583 } 3584 3585 return monitor_ops->mon_neighbour_peers_detach(pdev); 3586 } 3587 3588 #ifdef FEATURE_NAC_RSSI 3589 static inline QDF_STATUS dp_monitor_filter_neighbour_peer(struct dp_pdev *pdev, 3590 uint8_t *rx_pkt_hdr) 3591 { 3592 struct dp_mon_ops *monitor_ops; 3593 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3594 3595 if (!mon_soc) { 3596 dp_mon_debug("monitor soc is NULL"); 3597 return QDF_STATUS_E_FAILURE; 3598 } 3599 3600 monitor_ops = mon_soc->mon_ops; 3601 if (!monitor_ops || !monitor_ops->mon_filter_neighbour_peer) { 3602 dp_mon_debug("callback not registered"); 3603 return QDF_STATUS_E_FAILURE; 3604 } 3605 3606 return monitor_ops->mon_filter_neighbour_peer(pdev, rx_pkt_hdr); 3607 } 3608 #else 3609 static inline QDF_STATUS dp_monitor_filter_neighbour_peer(struct dp_pdev *pdev, 3610 uint8_t *rx_pkt_hdr) 3611 { 3612 return QDF_STATUS_E_FAILURE; 3613 } 3614 #endif 3615 3616 static inline 3617 void dp_monitor_reap_timer_init(struct dp_soc *soc) 3618 { 3619 struct dp_mon_ops *monitor_ops; 3620 struct dp_mon_soc *mon_soc = soc->monitor_soc; 3621 3622 if (!mon_soc) { 3623 dp_mon_debug("monitor soc is NULL"); 3624 return; 3625 } 3626 3627 monitor_ops = mon_soc->mon_ops; 3628 if (!monitor_ops || !monitor_ops->mon_reap_timer_init) { 3629 dp_mon_debug("callback not registered"); 3630 return; 3631 } 3632 3633 monitor_ops->mon_reap_timer_init(soc); 3634 } 3635 3636 static inline 3637 void dp_monitor_reap_timer_deinit(struct dp_soc *soc) 3638 { 3639 struct dp_mon_ops *monitor_ops; 3640 struct dp_mon_soc *mon_soc = soc->monitor_soc; 3641 3642 if (!mon_soc) { 3643 dp_mon_debug("monitor soc is NULL"); 3644 return; 3645 } 3646 3647 monitor_ops = mon_soc->mon_ops; 3648 if (!monitor_ops || !monitor_ops->mon_reap_timer_deinit) { 3649 dp_mon_debug("callback not registered"); 3650 return; 3651 } 3652 3653 monitor_ops->mon_reap_timer_deinit(soc); 3654 } 3655 3656 /** 3657 * dp_monitor_reap_timer_start() - start reap timer of monitor status ring 3658 * @soc: point to soc 3659 * @source: trigger source 3660 * 3661 * Return: true if timer-start is performed, false otherwise. 3662 */ 3663 static inline bool 3664 dp_monitor_reap_timer_start(struct dp_soc *soc, 3665 enum cdp_mon_reap_source source) 3666 { 3667 struct dp_mon_ops *monitor_ops; 3668 struct dp_mon_soc *mon_soc = soc->monitor_soc; 3669 3670 if (!mon_soc) { 3671 dp_mon_debug("monitor soc is NULL"); 3672 return false; 3673 } 3674 3675 monitor_ops = mon_soc->mon_ops; 3676 if (!monitor_ops || !monitor_ops->mon_reap_timer_start) { 3677 dp_mon_debug("callback not registered"); 3678 return false; 3679 } 3680 3681 return monitor_ops->mon_reap_timer_start(soc, source); 3682 } 3683 3684 /** 3685 * dp_monitor_reap_timer_stop() - stop reap timer of monitor status ring 3686 * @soc: point to soc 3687 * @source: trigger source 3688 * 3689 * Return: true if timer-stop is performed, false otherwise. 3690 */ 3691 static inline bool 3692 dp_monitor_reap_timer_stop(struct dp_soc *soc, 3693 enum cdp_mon_reap_source source) 3694 { 3695 struct dp_mon_ops *monitor_ops; 3696 struct dp_mon_soc *mon_soc = soc->monitor_soc; 3697 3698 if (!mon_soc) { 3699 dp_mon_debug("monitor soc is NULL"); 3700 return false; 3701 } 3702 3703 monitor_ops = mon_soc->mon_ops; 3704 if (!monitor_ops || !monitor_ops->mon_reap_timer_stop) { 3705 dp_mon_debug("callback not registered"); 3706 return false; 3707 } 3708 3709 return monitor_ops->mon_reap_timer_stop(soc, source); 3710 } 3711 3712 static inline 3713 void dp_monitor_vdev_timer_init(struct dp_soc *soc) 3714 { 3715 struct dp_mon_ops *monitor_ops; 3716 struct dp_mon_soc *mon_soc = soc->monitor_soc; 3717 3718 if (!mon_soc) { 3719 dp_mon_debug("monitor soc is NULL"); 3720 return; 3721 } 3722 3723 monitor_ops = mon_soc->mon_ops; 3724 if (!monitor_ops || !monitor_ops->mon_vdev_timer_init) { 3725 dp_mon_debug("callback not registered"); 3726 return; 3727 } 3728 3729 monitor_ops->mon_vdev_timer_init(soc); 3730 } 3731 3732 static inline 3733 void dp_monitor_vdev_timer_deinit(struct dp_soc *soc) 3734 { 3735 struct dp_mon_ops *monitor_ops; 3736 struct dp_mon_soc *mon_soc = soc->monitor_soc; 3737 3738 if (!mon_soc) { 3739 dp_mon_debug("monitor soc is NULL"); 3740 return; 3741 } 3742 3743 monitor_ops = mon_soc->mon_ops; 3744 if (!monitor_ops || !monitor_ops->mon_vdev_timer_deinit) { 3745 dp_mon_debug("callback not registered"); 3746 return; 3747 } 3748 3749 monitor_ops->mon_vdev_timer_deinit(soc); 3750 } 3751 3752 static inline 3753 void dp_monitor_vdev_timer_start(struct dp_soc *soc) 3754 { 3755 struct dp_mon_ops *monitor_ops; 3756 struct dp_mon_soc *mon_soc = soc->monitor_soc; 3757 3758 if (!mon_soc) { 3759 dp_mon_debug("monitor soc is NULL"); 3760 return; 3761 } 3762 3763 monitor_ops = mon_soc->mon_ops; 3764 if (!monitor_ops || !monitor_ops->mon_vdev_timer_start) { 3765 dp_mon_debug("callback not registered"); 3766 return; 3767 } 3768 3769 monitor_ops->mon_vdev_timer_start(soc); 3770 } 3771 3772 static inline 3773 bool dp_monitor_vdev_timer_stop(struct dp_soc *soc) 3774 { 3775 struct dp_mon_ops *monitor_ops; 3776 struct dp_mon_soc *mon_soc = soc->monitor_soc; 3777 3778 if (!mon_soc) { 3779 dp_mon_debug("monitor soc is NULL"); 3780 return false; 3781 } 3782 3783 monitor_ops = mon_soc->mon_ops; 3784 if (!monitor_ops || !monitor_ops->mon_vdev_timer_stop) { 3785 dp_mon_debug("callback not registered"); 3786 return false; 3787 } 3788 3789 return monitor_ops->mon_vdev_timer_stop(soc); 3790 } 3791 3792 #ifdef QCA_MCOPY_SUPPORT 3793 static inline 3794 QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev, 3795 uint16_t peer_id, uint32_t ppdu_id, 3796 uint8_t first_msdu) 3797 { 3798 struct dp_mon_ops *monitor_ops; 3799 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3800 3801 if (!mon_soc) { 3802 dp_mon_debug("monitor soc is NULL"); 3803 return QDF_STATUS_E_FAILURE; 3804 } 3805 3806 monitor_ops = mon_soc->mon_ops; 3807 if (!monitor_ops || !monitor_ops->mon_mcopy_check_deliver) { 3808 dp_mon_debug("callback not registered"); 3809 return QDF_STATUS_E_FAILURE; 3810 } 3811 3812 return monitor_ops->mon_mcopy_check_deliver(pdev, peer_id, 3813 ppdu_id, first_msdu); 3814 } 3815 #else 3816 static inline 3817 QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev, 3818 uint16_t peer_id, uint32_t ppdu_id, 3819 uint8_t first_msdu) 3820 { 3821 return QDF_STATUS_SUCCESS; 3822 } 3823 #endif 3824 3825 /** 3826 * dp_monitor_neighbour_peer_add_ast() - Add ast entry 3827 * @pdev: point to dp pdev 3828 * @ta_peer: point to peer 3829 * @mac_addr: mac address 3830 * @nbuf: point to nbuf 3831 * @flags: flags 3832 * 3833 * Return: void 3834 */ 3835 static inline void 3836 dp_monitor_neighbour_peer_add_ast(struct dp_pdev *pdev, 3837 struct dp_peer *ta_peer, 3838 uint8_t *mac_addr, 3839 qdf_nbuf_t nbuf, 3840 uint32_t flags) 3841 { 3842 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 3843 struct dp_mon_ops *monitor_ops; 3844 3845 if (!mon_soc) { 3846 dp_mon_debug("monitor soc is NULL"); 3847 return; 3848 } 3849 3850 monitor_ops = mon_soc->mon_ops; 3851 if (!monitor_ops || !monitor_ops->mon_neighbour_peer_add_ast) { 3852 dp_mon_debug("callback not registered"); 3853 return; 3854 } 3855 3856 return monitor_ops->mon_neighbour_peer_add_ast(pdev, ta_peer, mac_addr, 3857 nbuf, flags); 3858 } 3859 3860 /** 3861 * dp_monitor_vdev_delete() - delete monitor vdev 3862 * @soc: point to dp soc 3863 * @vdev: point to dp vdev 3864 * 3865 * Return: void 3866 */ 3867 static inline void dp_monitor_vdev_delete(struct dp_soc *soc, 3868 struct dp_vdev *vdev) 3869 { 3870 if (soc->intr_mode == DP_INTR_POLL) { 3871 qdf_timer_sync_cancel(&soc->int_timer); 3872 dp_monitor_flush_rings(soc); 3873 } else if (soc->intr_mode == DP_INTR_MSI) { 3874 dp_monitor_vdev_timer_stop(soc); 3875 dp_monitor_flush_rings(soc); 3876 } 3877 3878 dp_monitor_vdev_detach(vdev); 3879 } 3880 3881 #ifdef DP_POWER_SAVE 3882 /** 3883 * dp_monitor_reap_timer_suspend() - Stop monitor reap timer 3884 * and reap any pending frames in ring 3885 * @soc: DP soc context 3886 * 3887 * Return: void 3888 */ 3889 static inline void 3890 dp_monitor_reap_timer_suspend(struct dp_soc *soc) 3891 { 3892 if (dp_monitor_reap_timer_stop(soc, CDP_MON_REAP_SOURCE_ANY)) 3893 dp_monitor_service_mon_rings(soc, DP_MON_REAP_BUDGET); 3894 } 3895 3896 #endif 3897 3898 /** 3899 * dp_monitor_neighbour_peer_list_remove() - remove neighbour peer list 3900 * @pdev: point to dp pdev 3901 * @vdev: point to dp vdev 3902 * @peer: point to dp_neighbour_peer 3903 * 3904 * Return: void 3905 */ 3906 static inline 3907 void dp_monitor_neighbour_peer_list_remove(struct dp_pdev *pdev, 3908 struct dp_vdev *vdev, 3909 struct dp_neighbour_peer *peer) 3910 { 3911 struct dp_mon_pdev *mon_pdev; 3912 struct dp_neighbour_peer *temp_peer = NULL; 3913 3914 if (qdf_unlikely(!pdev || !pdev->monitor_pdev)) 3915 return; 3916 3917 mon_pdev = pdev->monitor_pdev; 3918 qdf_spin_lock_bh(&mon_pdev->neighbour_peer_mutex); 3919 if (!pdev->soc->monitor_soc->hw_nac_monitor_support) { 3920 TAILQ_FOREACH(peer, &mon_pdev->neighbour_peers_list, 3921 neighbour_peer_list_elem) { 3922 QDF_ASSERT(peer->vdev != vdev); 3923 } 3924 } else { 3925 TAILQ_FOREACH_SAFE(peer, &mon_pdev->neighbour_peers_list, 3926 neighbour_peer_list_elem, temp_peer) { 3927 if (peer->vdev == vdev) { 3928 TAILQ_REMOVE(&mon_pdev->neighbour_peers_list, 3929 peer, 3930 neighbour_peer_list_elem); 3931 qdf_mem_free(peer); 3932 } 3933 } 3934 } 3935 qdf_spin_unlock_bh(&mon_pdev->neighbour_peer_mutex); 3936 } 3937 3938 static inline 3939 void dp_monitor_pdev_set_mon_vdev(struct dp_vdev *vdev) 3940 { 3941 if (!vdev->pdev->monitor_pdev) 3942 return; 3943 3944 vdev->pdev->monitor_pdev->mvdev = vdev; 3945 } 3946 3947 static inline 3948 void dp_monitor_pdev_config_scan_spcl_vap(struct dp_pdev *pdev, bool val) 3949 { 3950 if (!pdev || !pdev->monitor_pdev) 3951 return; 3952 3953 pdev->monitor_pdev->scan_spcl_vap_configured = val; 3954 } 3955 3956 #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS 3957 static inline 3958 void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev, 3959 bool val) 3960 { 3961 if (!pdev || !pdev->monitor_pdev) 3962 return; 3963 3964 pdev->monitor_pdev->reset_scan_spcl_vap_stats_enable = val; 3965 } 3966 #else 3967 static inline 3968 void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev, 3969 bool val) 3970 { 3971 } 3972 #endif 3973 3974 #if defined(CONFIG_MON_WORD_BASED_TLV) 3975 static inline void 3976 dp_mon_rx_wmask_subscribe(struct dp_soc *soc, 3977 uint32_t *msg_word, int pdev_id, 3978 struct htt_rx_ring_tlv_filter *tlv_filter) 3979 { 3980 struct dp_mon_soc *mon_soc = soc->monitor_soc; 3981 struct dp_mon_ops *monitor_ops; 3982 3983 if (!mon_soc) { 3984 dp_mon_debug("mon soc is NULL"); 3985 return; 3986 3987 } 3988 3989 monitor_ops = mon_soc->mon_ops; 3990 if (!monitor_ops || !monitor_ops->rx_wmask_subscribe) { 3991 dp_mon_debug("callback not registered"); 3992 return; 3993 } 3994 3995 monitor_ops->rx_wmask_subscribe(soc, msg_word, pdev_id, tlv_filter); 3996 } 3997 #else 3998 static inline void 3999 dp_mon_rx_wmask_subscribe(struct dp_soc *soc, 4000 uint32_t *msg_word, int pdev_id, 4001 struct htt_rx_ring_tlv_filter *tlv_filter) 4002 { 4003 } 4004 #endif 4005 4006 static inline void 4007 dp_mon_rx_enable_pkt_tlv_offset(struct dp_soc *soc, uint32_t *msg_word, 4008 struct htt_rx_ring_tlv_filter *tlv_filter) 4009 { 4010 struct dp_mon_soc *mon_soc = soc->monitor_soc; 4011 struct dp_mon_ops *monitor_ops; 4012 4013 if (!mon_soc) { 4014 dp_mon_debug("mon soc is NULL"); 4015 return; 4016 } 4017 4018 monitor_ops = mon_soc->mon_ops; 4019 if (!monitor_ops || !monitor_ops->rx_pkt_tlv_offset) { 4020 dp_mon_debug("callback not registered"); 4021 return; 4022 } 4023 4024 monitor_ops->rx_pkt_tlv_offset(msg_word, tlv_filter); 4025 } 4026 4027 static inline void 4028 dp_mon_rx_enable_mpdu_logging(struct dp_soc *soc, uint32_t *msg_word, 4029 struct htt_rx_ring_tlv_filter *tlv_filter) 4030 { 4031 struct dp_mon_soc *mon_soc = soc->monitor_soc; 4032 struct dp_mon_ops *monitor_ops; 4033 4034 if (!mon_soc) { 4035 dp_mon_debug("mon soc is NULL"); 4036 return; 4037 4038 } 4039 4040 monitor_ops = mon_soc->mon_ops; 4041 if (!monitor_ops || !monitor_ops->rx_enable_mpdu_logging) { 4042 dp_mon_debug("callback not registered"); 4043 return; 4044 } 4045 4046 monitor_ops->rx_enable_mpdu_logging(msg_word, tlv_filter); 4047 } 4048 4049 /** 4050 * dp_mon_rx_enable_fpmo() - set fpmo filters 4051 * @soc: dp soc handle 4052 * @msg_word: msg word 4053 * @tlv_filter: rx fing filter config 4054 * 4055 * Return: void 4056 */ 4057 static inline void 4058 dp_mon_rx_enable_fpmo(struct dp_soc *soc, uint32_t *msg_word, 4059 struct htt_rx_ring_tlv_filter *tlv_filter) 4060 { 4061 struct dp_mon_soc *mon_soc = soc->monitor_soc; 4062 struct dp_mon_ops *monitor_ops; 4063 4064 if (!mon_soc) { 4065 dp_mon_debug("mon soc is NULL"); 4066 return; 4067 } 4068 4069 monitor_ops = mon_soc->mon_ops; 4070 if (!monitor_ops || !monitor_ops->rx_enable_fpmo) { 4071 dp_mon_debug("callback not registered"); 4072 return; 4073 } 4074 4075 monitor_ops->rx_enable_fpmo(msg_word, tlv_filter); 4076 } 4077 4078 /** 4079 * dp_mon_rx_hdr_length_set() - set rx hdr tlv length 4080 * @soc: dp soc handle 4081 * @msg_word: msg word 4082 * @tlv_filter: rx fing filter config 4083 * 4084 * Return: void 4085 */ 4086 static inline void 4087 dp_mon_rx_hdr_length_set(struct dp_soc *soc, uint32_t *msg_word, 4088 struct htt_rx_ring_tlv_filter *tlv_filter) 4089 { 4090 struct dp_mon_soc *mon_soc = soc->monitor_soc; 4091 struct dp_mon_ops *monitor_ops; 4092 4093 if (!mon_soc) { 4094 dp_mon_debug("mon soc is NULL"); 4095 return; 4096 } 4097 4098 monitor_ops = mon_soc->mon_ops; 4099 if (!monitor_ops || !monitor_ops->rx_hdr_length_set) { 4100 dp_mon_debug("callback not registered"); 4101 return; 4102 } 4103 4104 monitor_ops->rx_hdr_length_set(msg_word, tlv_filter); 4105 } 4106 4107 static inline void 4108 dp_mon_rx_packet_length_set(struct dp_soc *soc, uint32_t *msg_word, 4109 struct htt_rx_ring_tlv_filter *tlv_filter) 4110 { 4111 struct dp_mon_soc *mon_soc = soc->monitor_soc; 4112 struct dp_mon_ops *monitor_ops; 4113 4114 if (!mon_soc) { 4115 dp_mon_debug("mon soc is NULL"); 4116 return; 4117 4118 } 4119 4120 monitor_ops = mon_soc->mon_ops; 4121 if (!monitor_ops || !monitor_ops->rx_packet_length_set) { 4122 dp_mon_debug("callback not registered"); 4123 return; 4124 } 4125 4126 monitor_ops->rx_packet_length_set(msg_word, tlv_filter); 4127 } 4128 4129 static inline void 4130 dp_rx_mon_enable(struct dp_soc *soc, uint32_t *msg_word, 4131 struct htt_rx_ring_tlv_filter *tlv_filter) 4132 { 4133 struct dp_mon_soc *mon_soc = soc->monitor_soc; 4134 struct dp_mon_ops *monitor_ops; 4135 4136 if (!mon_soc) { 4137 dp_mon_debug("mon soc is NULL"); 4138 return; 4139 } 4140 4141 monitor_ops = mon_soc->mon_ops; 4142 if (!monitor_ops || !monitor_ops->rx_mon_enable) { 4143 dp_mon_debug("callback not registered"); 4144 return; 4145 } 4146 4147 monitor_ops->rx_mon_enable(msg_word, tlv_filter); 4148 } 4149 4150 static inline void 4151 dp_mon_rx_mac_filter_set(struct dp_soc *soc, uint32_t *msg_word, 4152 struct htt_rx_ring_tlv_filter *tlv_filter) 4153 { 4154 struct dp_mon_soc *mon_soc = soc->monitor_soc; 4155 struct dp_mon_ops *monitor_ops; 4156 4157 if (!mon_soc) { 4158 dp_mon_debug("mon soc is NULL"); 4159 return; 4160 } 4161 4162 monitor_ops = mon_soc->mon_ops; 4163 if (!monitor_ops || !monitor_ops->mon_mac_filter_set) { 4164 dp_mon_debug("callback not registered"); 4165 return; 4166 } 4167 4168 monitor_ops->mon_mac_filter_set(msg_word, tlv_filter); 4169 } 4170 4171 #ifdef QCA_ENHANCED_STATS_SUPPORT 4172 QDF_STATUS dp_peer_qos_stats_notify(struct dp_pdev *dp_pdev, 4173 struct cdp_rx_stats_ppdu_user *ppdu_user); 4174 #endif 4175 4176 /** 4177 * dp_print_pdev_rx_mon_stats() - print rx mon stats 4178 * @pdev: device object 4179 * 4180 * Return: void 4181 */ 4182 void 4183 dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev); 4184 4185 /** 4186 * dp_mcopy_check_deliver() - mcopy check deliver 4187 * @pdev: DP pdev handle 4188 * @peer_id: peer id 4189 * @ppdu_id: ppdu 4190 * @first_msdu: flag to indicate first msdu of ppdu 4191 * Return: 0 on success, not 0 on failure 4192 */ 4193 QDF_STATUS dp_mcopy_check_deliver(struct dp_pdev *pdev, 4194 uint16_t peer_id, 4195 uint32_t ppdu_id, 4196 uint8_t first_msdu); 4197 4198 /** 4199 * dp_pdev_set_advance_monitor_filter() - Set DP PDEV monitor filter 4200 * @soc_hdl: soc handle 4201 * @pdev_id: id of Datapath PDEV handle 4202 * @filter_val: Flag to select Filter for monitor mode 4203 * 4204 * Return: 0 on success, not 0 on failure 4205 */ 4206 #ifdef QCA_ADVANCE_MON_FILTER_SUPPORT 4207 QDF_STATUS 4208 dp_pdev_set_advance_monitor_filter(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, 4209 struct cdp_monitor_filter *filter_val); 4210 #else 4211 static inline QDF_STATUS 4212 dp_pdev_set_advance_monitor_filter(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, 4213 struct cdp_monitor_filter *filter_val) 4214 { 4215 return QDF_STATUS_E_INVAL; 4216 } 4217 #endif /* QCA_ADVANCE_MON_FILTER_SUPPORT */ 4218 4219 /** 4220 * dp_deliver_tx_mgmt() - Deliver mgmt frame for tx capture 4221 * @cdp_soc : data path soc handle 4222 * @pdev_id : pdev_id 4223 * @nbuf: Management frame buffer 4224 * 4225 * Return: QDF_STATUS_SUCCESS on success 4226 * QDF_STATUS_E_FAILURE on failure 4227 */ 4228 QDF_STATUS 4229 dp_deliver_tx_mgmt(struct cdp_soc_t *cdp_soc, uint8_t pdev_id, qdf_nbuf_t nbuf); 4230 4231 /** 4232 * dp_filter_neighbour_peer() - API to filter neighbour peer 4233 * @pdev : DP pdev handle 4234 * @rx_pkt_hdr : packet header 4235 * 4236 * Return: QDF_STATUS_SUCCESS on success 4237 * QDF_STATUS_E_FAILURE on failure 4238 */ 4239 #ifdef FEATURE_NAC_RSSI 4240 QDF_STATUS dp_filter_neighbour_peer(struct dp_pdev *pdev, 4241 uint8_t *rx_pkt_hdr); 4242 #else 4243 static inline 4244 QDF_STATUS dp_filter_neighbour_peer(struct dp_pdev *pdev, 4245 uint8_t *rx_pkt_hdr) 4246 { 4247 return QDF_STATUS_SUCCESS; 4248 } 4249 #endif /* FEATURE_NAC_RSSI */ 4250 4251 /** 4252 * dp_neighbour_peers_detach() - Detach neighbour peers(nac clients) 4253 * @pdev: device object 4254 * 4255 * Return: void 4256 */ 4257 void dp_neighbour_peers_detach(struct dp_pdev *pdev); 4258 4259 /** 4260 * dp_reset_monitor_mode() - Disable monitor mode 4261 * @soc_hdl: Datapath soc handle 4262 * @pdev_id: id of datapath PDEV handle 4263 * @smart_monitor: smart monitor flag 4264 * 4265 * Return: QDF_STATUS 4266 */ 4267 QDF_STATUS dp_reset_monitor_mode(struct cdp_soc_t *soc_hdl, 4268 uint8_t pdev_id, 4269 uint8_t smart_monitor); 4270 4271 /** 4272 * dp_reset_monitor_mode_unlock() - Disable monitor mode with no locks 4273 * @soc_hdl: Datapath soc handle 4274 * @pdev_id: id of datapath PDEV handle 4275 * @smart_monitor: smart monitor flag 4276 * 4277 * Return: QDF_STATUS 4278 */ 4279 #ifdef WIFI_MONITOR_SUPPORT 4280 QDF_STATUS dp_reset_monitor_mode_unlock(struct cdp_soc_t *soc_hdl, 4281 uint8_t pdev_id, 4282 uint8_t smart_monitor); 4283 #else 4284 QDF_STATUS dp_reset_monitor_mode_unlock(struct cdp_soc_t *soc_hdl, 4285 uint8_t pdev_id, 4286 uint8_t smart_monitor) 4287 { 4288 return QDF_STATUS_SUCCESS; 4289 } 4290 #endif 4291 4292 static inline 4293 struct dp_mon_ops *dp_mon_ops_get(struct dp_soc *soc) 4294 { 4295 if (soc && soc->monitor_soc) 4296 return soc->monitor_soc->mon_ops; 4297 4298 return NULL; 4299 } 4300 4301 static inline 4302 struct cdp_mon_ops *dp_mon_cdp_ops_get(struct dp_soc *soc) 4303 { 4304 struct cdp_ops *ops = soc->cdp_soc.ops; 4305 4306 return ops->mon_ops; 4307 } 4308 4309 /** 4310 * dp_monitor_soc_attach() - Monitor SOC attach 4311 * @soc: DP soc handle 4312 * 4313 * Return: void 4314 */ 4315 static inline void dp_monitor_soc_attach(struct dp_soc *soc) 4316 { 4317 struct dp_mon_ops *mon_ops; 4318 4319 mon_ops = dp_mon_ops_get(soc); 4320 4321 if (mon_ops && mon_ops->mon_soc_attach[0]) 4322 mon_ops->mon_soc_attach[0](soc); 4323 4324 if (mon_ops && mon_ops->mon_soc_attach[1]) 4325 mon_ops->mon_soc_attach[1](soc); 4326 } 4327 4328 /** 4329 * dp_monitor_soc_detach() - Monitor SOC detach 4330 * @soc: DP soc handle 4331 * 4332 * Return: void 4333 */ 4334 static inline void dp_monitor_soc_detach(struct dp_soc *soc) 4335 { 4336 struct dp_mon_ops *mon_ops; 4337 4338 mon_ops = dp_mon_ops_get(soc); 4339 4340 if (mon_ops && mon_ops->mon_soc_detach[0]) 4341 mon_ops->mon_soc_detach[0](soc); 4342 4343 if (mon_ops && mon_ops->mon_soc_detach[1]) 4344 mon_ops->mon_soc_detach[1](soc); 4345 } 4346 4347 /** 4348 * dp_monitor_soc_init() - Monitor SOC init 4349 * @soc: DP soc handle 4350 * 4351 * Return: void 4352 */ 4353 static inline void dp_monitor_soc_init(struct dp_soc *soc) 4354 { 4355 struct dp_mon_ops *mon_ops; 4356 4357 mon_ops = dp_mon_ops_get(soc); 4358 4359 if (mon_ops && mon_ops->mon_soc_init[0]) 4360 mon_ops->mon_soc_init[0](soc); 4361 4362 if (mon_ops && mon_ops->mon_soc_init[1]) 4363 mon_ops->mon_soc_init[1](soc); 4364 } 4365 4366 /** 4367 * dp_monitor_soc_deinit() - Monitor SOC deinit 4368 * @soc: DP soc handle 4369 * 4370 * Return: void 4371 */ 4372 static inline void dp_monitor_soc_deinit(struct dp_soc *soc) 4373 { 4374 struct dp_mon_ops *mon_ops; 4375 4376 mon_ops = dp_mon_ops_get(soc); 4377 4378 if (mon_ops && mon_ops->mon_soc_deinit[0]) 4379 mon_ops->mon_soc_deinit[0](soc); 4380 4381 if (mon_ops && mon_ops->mon_soc_deinit[1]) 4382 mon_ops->mon_soc_deinit[1](soc); 4383 } 4384 4385 /** 4386 * dp_ppdu_desc_user_stats_update(): Function to update TX user stats 4387 * @pdev: DP pdev handle 4388 * @ppdu_info: per PPDU TLV descriptor 4389 * 4390 * Return: void 4391 */ 4392 #ifdef QCA_ENHANCED_STATS_SUPPORT 4393 void 4394 dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev, 4395 struct ppdu_info *ppdu_info); 4396 #else 4397 static inline void 4398 dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev, 4399 struct ppdu_info *ppdu_info) 4400 { 4401 } 4402 #endif /* QCA_ENHANCED_STATS_SUPPORT */ 4403 4404 /** 4405 * dp_mon_ops_register_1_0(): register legacy monitor ops 4406 * @mon_soc: monitor soc handle 4407 * 4408 * return: void 4409 */ 4410 void dp_mon_ops_register_1_0(struct dp_mon_soc *mon_soc); 4411 4412 /** 4413 * dp_mon_cdp_ops_register_1_0(): register legacy monitor cdp ops 4414 * @ops: cdp ops handle 4415 * 4416 * return: void 4417 */ 4418 void dp_mon_cdp_ops_register_1_0(struct cdp_ops *ops); 4419 4420 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE) 4421 /** 4422 * dp_cfr_filter_register_1_0(): register cfr filter setting API 4423 * @ops: cdp ops handle 4424 * 4425 * return: void 4426 */ 4427 void dp_cfr_filter_register_1_0(struct cdp_ops *ops); 4428 #endif 4429 4430 QDF_STATUS dp_mon_pdev_htt_srng_setup_2_0(struct dp_soc *soc, 4431 struct dp_pdev *pdev, 4432 int mac_id, 4433 int mac_for_pdev); 4434 QDF_STATUS dp_mon_soc_htt_srng_setup_2_0(struct dp_soc *soc); 4435 QDF_STATUS dp_mon_soc_attach_2_0(struct dp_soc *soc); 4436 QDF_STATUS dp_mon_soc_init_2_0(struct dp_soc *soc); 4437 void dp_mon_soc_deinit_2_0(struct dp_soc *soc); 4438 QDF_STATUS dp_mon_soc_detach_2_0(struct dp_soc *soc); 4439 void dp_pdev_mon_rings_deinit_2_0(struct dp_pdev *pdev); 4440 QDF_STATUS dp_pdev_mon_rings_init_2_0(struct dp_pdev *pdev); 4441 void dp_pdev_mon_rings_free_2_0(struct dp_pdev *pdev); 4442 QDF_STATUS dp_pdev_mon_rings_alloc_2_0(struct dp_pdev *pdev); 4443 4444 #ifdef WLAN_PKT_CAPTURE_TX_2_0 4445 /** 4446 * dp_mon_ops_register_tx_2_0(): register monitor tx ops 2.0 4447 * @mon_soc: monitor soc handle 4448 * 4449 * return: void 4450 */ 4451 void dp_mon_ops_register_tx_2_0(struct dp_mon_soc *mon_soc); 4452 #else 4453 static inline 4454 void dp_mon_ops_register_tx_2_0(struct dp_mon_soc *mon_soc) 4455 { 4456 } 4457 #endif /* WLAN_PKT_CAPTURE_TX_2_0 */ 4458 4459 #if defined(WLAN_PKT_CAPTURE_TX_2_0) || \ 4460 defined(WLAN_PKT_CAPTURE_RX_2_0) 4461 /** 4462 * dp_mon_ops_register_2_0(): register monitor ops 4463 * @mon_soc: monitor soc handle 4464 * 4465 * return: void 4466 */ 4467 void dp_mon_ops_register_2_0(struct dp_mon_soc *mon_soc); 4468 4469 /** 4470 * dp_mon_cdp_ops_register_2_0(): register monitor cdp ops 4471 * @ops: cdp ops handle 4472 * 4473 * return: void 4474 */ 4475 void dp_mon_cdp_ops_register_2_0(struct cdp_ops *ops); 4476 4477 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE) 4478 /** 4479 * dp_cfr_filter_register_2_0(): register cfr filter setting API 4480 * @ops: cdp ops handle 4481 * 4482 * return: void 4483 */ 4484 void dp_cfr_filter_register_2_0(struct cdp_ops *ops); 4485 #endif 4486 void dp_mon_ops_register_cmn_2_0(struct dp_mon_soc *mon_soc); 4487 #else 4488 static inline void 4489 dp_mon_ops_register_2_0(struct dp_mon_soc *mon_soc) 4490 { 4491 } 4492 4493 static inline void 4494 dp_mon_cdp_ops_register_2_0(struct cdp_ops *ops) 4495 { 4496 } 4497 4498 static inline void 4499 dp_mon_ops_register_cmn_2_0(struct dp_mon_soc *mon_soc) 4500 { 4501 } 4502 #endif /* WLAN_PKT_CAPTURE_TX_2_0 OR WLAN_PKT_CAPTURE_RX_2_0 */ 4503 4504 #ifdef WLAN_PKT_CAPTURE_RX_2_0 4505 /** 4506 * dp_mon_ops_register_rx_2_0(): register monitor rx ops 2.0 4507 * @mon_soc: monitor soc handle 4508 * 4509 * return: void 4510 */ 4511 void dp_mon_ops_register_rx_2_0(struct dp_mon_soc *mon_soc); 4512 #else 4513 static inline 4514 void dp_mon_ops_register_rx_2_0(struct dp_mon_soc *mon_soc) 4515 { 4516 } 4517 #endif 4518 4519 /** 4520 * dp_mon_register_feature_ops(): Register mon feature ops 4521 * @soc: Datapath soc context 4522 * 4523 * return: void 4524 */ 4525 static inline 4526 void dp_mon_register_feature_ops(struct dp_soc *soc) 4527 { 4528 struct dp_mon_ops *mon_ops = NULL; 4529 4530 mon_ops = dp_mon_ops_get(soc); 4531 if (!mon_ops) { 4532 dp_mon_err("Monitor ops is NULL"); 4533 return; 4534 } 4535 if (mon_ops->mon_register_feature_ops) 4536 mon_ops->mon_register_feature_ops(soc); 4537 } 4538 4539 /** 4540 * dp_pdev_get_rx_mon_stats(): Get pdev Rx monitor stats 4541 * @soc_hdl: soc handle 4542 * @pdev_id: id of pdev handle 4543 * @stats: User allocated stats buffer 4544 * 4545 * return: status success/failure 4546 */ 4547 QDF_STATUS dp_pdev_get_rx_mon_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, 4548 struct cdp_pdev_mon_stats *stats); 4549 4550 /** 4551 * dp_enable_mon_reap_timer() - enable/disable reap timer 4552 * @soc_hdl: Datapath soc handle 4553 * @source: trigger source of the timer 4554 * @enable: Enable/Disable reap timer of monitor status ring 4555 * 4556 * Return: true if a timer-start/stop is performed, false otherwise. 4557 */ 4558 bool dp_enable_mon_reap_timer(struct cdp_soc_t *soc_hdl, 4559 enum cdp_mon_reap_source source, bool enable); 4560 4561 QDF_STATUS dp_vdev_set_monitor_mode(struct cdp_soc_t *dp_soc, 4562 uint8_t vdev_id, 4563 uint8_t special_monitor); 4564 4565 #ifdef QCA_ENHANCED_STATS_SUPPORT 4566 /** 4567 * dp_enable_enhanced_stats() - enable enhanced and MLD Link Peer stats 4568 * @soc: Datapath soc handle 4569 * @pdev_id: Pdev Id on which stats will get enable 4570 * 4571 * Return: status success/failure 4572 */ 4573 QDF_STATUS 4574 dp_enable_enhanced_stats(struct cdp_soc_t *soc, uint8_t pdev_id); 4575 4576 /** 4577 * dp_disable_enhanced_stats() - disable enhanced and MLD Link Peer stats 4578 * @soc: Datapath soc handle 4579 * @pdev_id: Pdev Id on which stats will get disable 4580 * 4581 * Return: status success/failure 4582 */ 4583 QDF_STATUS 4584 dp_disable_enhanced_stats(struct cdp_soc_t *soc, uint8_t pdev_id); 4585 #endif /* QCA_ENHANCED_STATS_SUPPORT */ 4586 4587 /* 4588 * dp_monitor_lite_mon_disable_rx() - disables rx lite mon 4589 * @pdev: dp pdev 4590 * 4591 * Return: void 4592 */ 4593 static inline void 4594 dp_monitor_lite_mon_disable_rx(struct dp_pdev *pdev) 4595 { 4596 struct dp_mon_ops *monitor_ops; 4597 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 4598 4599 if (!mon_soc) { 4600 dp_mon_debug("monitor soc is NULL"); 4601 return; 4602 } 4603 4604 monitor_ops = mon_soc->mon_ops; 4605 if (!monitor_ops || 4606 !monitor_ops->mon_lite_mon_disable_rx) { 4607 dp_mon_debug("callback not registered"); 4608 return; 4609 } 4610 4611 return monitor_ops->mon_lite_mon_disable_rx(pdev); 4612 } 4613 4614 /* 4615 * dp_monitor_lite_mon_is_rx_adv_filter_enable() 4616 * - check if advance mon filter is already applied 4617 * @pdev: dp pdev 4618 * 4619 * Return: bool 4620 */ 4621 static inline bool 4622 dp_monitor_lite_mon_is_rx_adv_filter_enable(struct dp_pdev *pdev) 4623 { 4624 struct dp_mon_ops *monitor_ops; 4625 struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; 4626 4627 if (!mon_soc) { 4628 dp_mon_debug("monitor soc is NULL"); 4629 return false; 4630 } 4631 4632 monitor_ops = mon_soc->mon_ops; 4633 if (!monitor_ops || 4634 !monitor_ops->mon_lite_mon_disable_rx) { 4635 dp_mon_debug("callback not registered"); 4636 return false; 4637 } 4638 4639 return monitor_ops->mon_lite_mon_is_rx_adv_filter_enable(pdev); 4640 } 4641 4642 #ifndef QCA_SUPPORT_LITE_MONITOR 4643 static inline void 4644 dp_lite_mon_disable_rx(struct dp_pdev *pdev) 4645 { 4646 } 4647 4648 static inline void 4649 dp_lite_mon_disable_tx(struct dp_pdev *pdev) 4650 { 4651 } 4652 4653 static inline bool 4654 dp_lite_mon_is_rx_adv_filter_enable(struct dp_pdev *pdev) 4655 { 4656 return false; 4657 } 4658 4659 static inline bool 4660 dp_lite_mon_get_filter_ucast_data(struct cdp_pdev *pdev_handle) 4661 { 4662 return false; 4663 } 4664 4665 static inline bool 4666 dp_lite_mon_get_filter_mcast_data(struct cdp_pdev *pdev_handle) 4667 { 4668 return false; 4669 } 4670 4671 static inline bool 4672 dp_lite_mon_get_filter_non_data(struct cdp_pdev *pdev_handle) 4673 { 4674 return false; 4675 } 4676 4677 static inline int 4678 dp_lite_mon_is_level_msdu(struct dp_mon_pdev *mon_pdev) 4679 { 4680 return 0; 4681 } 4682 4683 static inline int 4684 dp_lite_mon_is_rx_enabled(struct dp_mon_pdev *mon_pdev) 4685 { 4686 return 0; 4687 } 4688 4689 static inline int 4690 dp_lite_mon_is_tx_enabled(struct dp_mon_pdev *mon_pdev) 4691 { 4692 return 0; 4693 } 4694 4695 static inline QDF_STATUS 4696 dp_lite_mon_alloc(struct dp_pdev *pdev) 4697 { 4698 return QDF_STATUS_SUCCESS; 4699 } 4700 4701 static inline void 4702 dp_lite_mon_dealloc(struct dp_pdev *pdev) 4703 { 4704 } 4705 4706 static inline void 4707 dp_lite_mon_vdev_delete(struct dp_pdev *pdev, struct dp_vdev *vdev) 4708 { 4709 } 4710 4711 static inline int 4712 dp_lite_mon_config_nac_peer(struct cdp_soc_t *soc_hdl, 4713 uint8_t vdev_id, 4714 uint32_t cmd, uint8_t *macaddr) 4715 { 4716 return 0; 4717 } 4718 4719 static inline QDF_STATUS 4720 dp_lite_mon_config_nac_rssi_peer(struct cdp_soc_t *soc_hdl, 4721 uint8_t vdev_id, 4722 enum cdp_nac_param_cmd cmd, 4723 char *bssid, char *macaddr, 4724 uint8_t chan_num) 4725 { 4726 return QDF_STATUS_E_FAILURE; 4727 } 4728 4729 static inline QDF_STATUS 4730 dp_lite_mon_get_nac_peer_rssi(struct cdp_soc_t *soc_hdl, 4731 uint8_t vdev_id, char *macaddr, 4732 uint8_t *rssi) 4733 { 4734 return QDF_STATUS_E_FAILURE; 4735 } 4736 4737 static inline QDF_STATUS 4738 dp_lite_mon_rx_mpdu_process(struct dp_pdev *pdev, 4739 struct hal_rx_ppdu_info *ppdu_info, 4740 qdf_nbuf_t mon_mpdu, uint16_t mpdu_id, 4741 uint8_t user) 4742 { 4743 return QDF_STATUS_E_FAILURE; 4744 } 4745 4746 static inline int 4747 dp_lite_mon_get_legacy_feature_enabled(struct cdp_soc_t *soc, 4748 uint8_t pdev_id, 4749 uint8_t direction) 4750 { 4751 return 0; 4752 } 4753 #endif 4754 4755 #ifdef WLAN_CONFIG_TELEMETRY_AGENT 4756 static inline 4757 void dp_monitor_peer_telemetry_stats(struct dp_peer *peer, 4758 struct cdp_peer_telemetry_stats *stats) 4759 { 4760 struct dp_mon_peer_stats *mon_peer_stats = NULL; 4761 uint8_t ac; 4762 4763 if (qdf_unlikely(!peer->monitor_peer)) 4764 return; 4765 4766 mon_peer_stats = &peer->monitor_peer->stats; 4767 for (ac = 0; ac < WME_AC_MAX; ac++) { 4768 stats->tx_airtime_consumption[ac] = 4769 mon_peer_stats->airtime_stats.tx_airtime_consumption[ac].avg_consumption_per_sec; 4770 stats->rx_airtime_consumption[ac] = 4771 mon_peer_stats->airtime_stats.rx_airtime_consumption[ac].avg_consumption_per_sec; 4772 } 4773 stats->tx_mpdu_retried = mon_peer_stats->tx.retries; 4774 stats->tx_mpdu_total = mon_peer_stats->tx.tx_mpdus_tried; 4775 stats->rx_mpdu_retried = mon_peer_stats->rx.mpdu_retry_cnt; 4776 stats->rx_mpdu_total = mon_peer_stats->rx.rx_mpdus; 4777 stats->snr = CDP_SNR_OUT(mon_peer_stats->rx.avg_snr); 4778 } 4779 4780 static inline 4781 void dp_monitor_peer_deter_stats(struct dp_peer *peer, 4782 struct cdp_peer_deter_stats *stats) 4783 { 4784 struct dp_mon_peer_stats *mon_peer_stats = NULL; 4785 struct cdp_peer_deter_stats *deter_stats; 4786 4787 if (qdf_unlikely(!peer->monitor_peer)) 4788 return; 4789 4790 mon_peer_stats = &peer->monitor_peer->stats; 4791 deter_stats = &mon_peer_stats->deter_stats.deter[0]; 4792 qdf_mem_copy(stats, deter_stats, sizeof(*stats) * CDP_DATA_TID_MAX); 4793 } 4794 #endif 4795 4796 /** 4797 * dp_monitor_is_tx_cap_enabled() - get tx-cature enabled/disabled 4798 * @peer: DP peer handle 4799 * 4800 * Return: true if tx-capture is enabled 4801 */ 4802 static inline bool dp_monitor_is_tx_cap_enabled(struct dp_peer *peer) 4803 { 4804 return peer->monitor_peer ? peer->monitor_peer->tx_cap_enabled : 0; 4805 } 4806 4807 /** 4808 * dp_monitor_is_rx_cap_enabled() - get rx-cature enabled/disabled 4809 * @peer: DP peer handle 4810 * 4811 * Return: true if rx-capture is enabled 4812 */ 4813 static inline bool dp_monitor_is_rx_cap_enabled(struct dp_peer *peer) 4814 { 4815 return peer->monitor_peer ? peer->monitor_peer->rx_cap_enabled : 0; 4816 } 4817 4818 #if !(!defined(DISABLE_MON_CONFIG) && (defined(WLAN_PKT_CAPTURE_TX_2_0) || \ 4819 defined(WLAN_PKT_CAPTURE_RX_2_0))) 4820 /** 4821 * dp_mon_get_context_size_be() - get BE specific size for mon pdev/soc 4822 * @context_type: context type for which the size is needed 4823 * 4824 * Return: size in bytes for the context_type 4825 */ 4826 static inline 4827 qdf_size_t dp_mon_get_context_size_be(enum dp_context_type context_type) 4828 { 4829 switch (context_type) { 4830 case DP_CONTEXT_TYPE_MON_SOC: 4831 return sizeof(struct dp_mon_soc); 4832 case DP_CONTEXT_TYPE_MON_PDEV: 4833 return sizeof(struct dp_mon_pdev); 4834 default: 4835 return 0; 4836 } 4837 } 4838 #endif 4839 4840 /** 4841 * dp_mon_rx_print_advanced_stats() - print advanced monitor stats 4842 * @soc: DP soc handle 4843 * @pdev: DP pdev handle 4844 * 4845 * Return: void 4846 */ 4847 static inline void 4848 dp_mon_rx_print_advanced_stats(struct dp_soc *soc, 4849 struct dp_pdev *pdev) 4850 { 4851 struct dp_mon_soc *mon_soc = soc->monitor_soc; 4852 struct dp_mon_ops *monitor_ops; 4853 4854 if (!mon_soc) { 4855 dp_mon_debug("mon soc is NULL"); 4856 return; 4857 } 4858 4859 monitor_ops = mon_soc->mon_ops; 4860 if (!monitor_ops || 4861 !monitor_ops->mon_rx_print_advanced_stats) { 4862 dp_mon_debug("callback not registered"); 4863 return; 4864 } 4865 return monitor_ops->mon_rx_print_advanced_stats(soc, pdev); 4866 } 4867 4868 #ifdef WLAN_CONFIG_TELEMETRY_AGENT 4869 /* 4870 * dp_update_pdev_mon_telemetry_airtime_stats() - update telemetry airtime 4871 * stats in monitor pdev 4872 * 4873 *@soc: dp soc handle 4874 *@pdev_id: pdev id 4875 * 4876 * This API is used to update telemetry airtime stats in monitor pdev 4877 * 4878 * Return: Success if stats are updated, else failure 4879 */ 4880 4881 QDF_STATUS dp_pdev_update_telemetry_airtime_stats(struct cdp_soc_t *soc, 4882 uint8_t pdev_id); 4883 #endif 4884 4885 /* 4886 * dp_mon_register_lpc_ops_1_0() - set local packet capture 1_0 mon ops 4887 * @mon_ops: monitor ops 4888 * 4889 * This function initializes the mon_ops callbacks. 4890 * index [0] is for Monitor 1.0 and index [1] is for Monitor 2.0 4891 * based on the @WLAN_FEATURE_LOCAL_PKT_CAPTURE macro, it sets the 4892 * appropriate callbacks 4893 * 4894 * Return: None 4895 */ 4896 void dp_mon_register_lpc_ops_1_0(struct dp_mon_ops *mon_ops); 4897 4898 /* 4899 * dp_mon_register_tx_pkt_enh_ops_1_0() - set tx pkt enh mon ops 4900 * @mon_ops: monitor ops 4901 * 4902 * Return: None 4903 */ 4904 void dp_mon_register_tx_pkt_enh_ops_1_0(struct dp_mon_ops *mon_ops); 4905 4906 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE 4907 /* 4908 * dp_local_pkt_capture_tx_config() - local packet capture tx config 4909 * @pdev: physical device handle 4910 * 4911 * Return: QDF_STATUS 4912 */ 4913 QDF_STATUS dp_local_pkt_capture_tx_config(struct dp_pdev *pdev); 4914 4915 /* 4916 * dp_mon_mode_local_pkt_capture() - Check if in LPC mode 4917 * @soc: DP SOC handle 4918 * 4919 * Return: True in case of LPC mode else false 4920 * 4921 */ 4922 static inline bool 4923 dp_mon_mode_local_pkt_capture(struct dp_soc *soc) 4924 { 4925 /* Currently there is no way to distinguish between 4926 * Local Packet Capture and STA+Mon mode as both mode 4927 * uses same monitor interface. So to distinguish between 4928 * two mode in local_packet_capture enable case use 4929 * mon_flags which can be passed during monitor interface 4930 * add time. If "flags otherbss" is passed during 4931 * monitor interface add driver will consider current mode 4932 * as STA+MON mode, LPC otherwise. 4933 */ 4934 if (wlan_cfg_get_local_pkt_capture(soc->wlan_cfg_ctx) && 4935 !(soc->mon_flags & QDF_MONITOR_FLAG_OTHER_BSS)) 4936 return true; 4937 4938 return false; 4939 } 4940 #else 4941 static inline 4942 QDF_STATUS dp_local_pkt_capture_tx_config(struct dp_pdev *pdev) 4943 { 4944 return QDF_STATUS_SUCCESS; 4945 } 4946 4947 static inline bool 4948 dp_mon_mode_local_pkt_capture(struct dp_soc *soc) 4949 { 4950 return false; 4951 } 4952 #endif 4953 4954 #ifdef WIFI_MONITOR_SUPPORT 4955 void 4956 dp_check_and_dump_full_mon_info(struct dp_soc *soc, struct dp_pdev *pdev, 4957 int mac_id, int war); 4958 4959 /** 4960 * dp_mon_rx_ppdu_status_reset() - reset and clear ppdu rx status 4961 * @mon_pdev: monitor pdev 4962 * 4963 * Return: none 4964 */ 4965 static inline void 4966 dp_mon_rx_ppdu_status_reset(struct dp_mon_pdev *mon_pdev) 4967 { 4968 mon_pdev->mon_ppdu_status = DP_PPDU_STATUS_START; 4969 mon_pdev->ppdu_info.com_info.num_users = 0; 4970 qdf_mem_zero(&mon_pdev->ppdu_info.rx_status, 4971 sizeof(mon_pdev->ppdu_info.rx_status)); 4972 } 4973 #else 4974 void 4975 dp_check_and_dump_full_mon_info(struct dp_soc *soc, struct dp_pdev *pdev, 4976 int mac_id, int war); 4977 4978 { 4979 } 4980 4981 static inline void 4982 dp_mon_rx_ppdu_status_reset(struct dp_mon_pdev *mon_pdev) 4983 { 4984 } 4985 #endif 4986 4987 static inline void 4988 dp_mon_pdev_filter_init(struct dp_mon_pdev *mon_pdev) 4989 { 4990 if (!mon_pdev) 4991 return; 4992 4993 mon_pdev->mon_filter_mode = MON_FILTER_ALL; 4994 mon_pdev->fp_mgmt_filter = FILTER_MGMT_ALL; 4995 mon_pdev->fp_ctrl_filter = FILTER_CTRL_ALL; 4996 mon_pdev->fp_data_filter = FILTER_DATA_ALL; 4997 mon_pdev->mo_mgmt_filter = FILTER_MGMT_ALL; 4998 mon_pdev->mo_ctrl_filter = FILTER_CTRL_ALL; 4999 mon_pdev->mo_data_filter = FILTER_DATA_ALL; 5000 } 5001 #endif /* _DP_MON_H_ */ 5002