1 /* 2 * Copyright (c) 2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2023 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_2_0_H_ 19 #define _DP_MON_2_0_H_ 20 21 #if !defined(DISABLE_MON_CONFIG) 22 #include <qdf_lock.h> 23 #include <dp_types.h> 24 #include <dp_mon.h> 25 #include <dp_mon_filter.h> 26 #include <dp_htt.h> 27 #include <dp_mon.h> 28 #ifdef WLAN_PKT_CAPTURE_TX_2_0 29 #include <dp_tx_mon_2.0.h> 30 #endif 31 #define DP_MON_RING_FILL_LEVEL_DEFAULT 2048 32 #define DP_MON_DATA_BUFFER_SIZE 2048 33 #define DP_MON_DESC_MAGIC 0xdeadabcd 34 #define DP_MON_MAX_STATUS_BUF 1200 35 #define DP_MON_QUEUE_DEPTH_MAX 16 36 #define DP_MON_MSDU_LOGGING 0 37 #define DP_MON_MPDU_LOGGING 1 38 #define DP_MON_DESC_ADDR_MASK 0x000000FFFFFFFFFF 39 #define DP_MON_DESC_ADDR_SHIFT 40 40 #define DP_MON_DESC_FIXED_ADDR_MASK 0xFFFFFF 41 #define DP_MON_DESC_FIXED_ADDR ((uint64_t)DP_MON_DESC_FIXED_ADDR_MASK << \ 42 DP_MON_DESC_COOKIE_LSB) 43 #define DP_MON_DESC_COOKIE_MASK 0xFFFFFF0000000000 44 #define DP_MON_DESC_COOKIE_SHIFT 24 45 #define DP_MON_DESC_COOKIE_LSB 40 46 #define DP_MON_GET_COOKIE(mon_desc) \ 47 ((uint32_t)(((unsigned long long)(mon_desc) & DP_MON_DESC_COOKIE_MASK) \ 48 >> DP_MON_DESC_COOKIE_LSB)) 49 50 #ifdef DP_RX_MON_DESC_64_BIT 51 #define DP_MON_GET_DESC(mon_desc) \ 52 ((struct dp_mon_desc *)(uintptr_t)(((unsigned long long)(mon_desc) & \ 53 DP_MON_DESC_ADDR_MASK) | ((unsigned long long)DP_MON_DESC_FIXED_ADDR))) 54 55 #else 56 #define DP_MON_GET_DESC(mon_desc) \ 57 ((struct dp_mon_desc *)(uintptr_t)(((unsigned long)(mon_desc) & \ 58 DP_MON_DESC_ADDR_MASK))) 59 #endif 60 61 #define DP_MON_DECAP_FORMAT_INVALID 0xff 62 #define DP_MON_MIN_FRAGS_FOR_RESTITCH 2 63 64 #ifdef MONITOR_TLV_RECORDING_ENABLE 65 #define MONITOR_TLV_RECORDING_RX 1 66 #define MONITOR_TLV_RECORDING_TX 2 67 #define MONITOR_TLV_RECORDING_RXTX 3 68 69 #define MAX_TLV_LOGGING_SIZE 1024 70 71 #define MAX_PPDU_START_TLV_NUM 38 72 #define MAX_MPDU_TLV_NUM 160 73 #define MAX_PPDU_END_TLV_NUM 57 74 75 #define MAX_NUM_PPDU_RECORD 4 76 #define MAX_TLVS_PER_PPDU 255 77 78 /* 79 * struct dp_mon_tlv_info - recorded information of each TLV 80 * @tlv_tag: tlv tag 81 * @data: union of struct of fields to be recorded for each TLV 82 * 83 * Tag and its corresponding important fields are stored in this struct 84 */ 85 struct dp_mon_tlv_info { 86 uint32_t tlv_tag:10; 87 union { 88 struct hal_ppdu_start_tlv_record ppdu_start; 89 struct hal_ppdu_start_user_info_tlv_record ppdu_start_user_info; 90 struct hal_mpdu_start_tlv_record mpdu_start; 91 struct hal_mpdu_end_tlv_record mpdu_end; 92 struct hal_header_tlv_record header; 93 struct hal_msdu_end_tlv_record msdu_end; 94 struct hal_mon_buffer_addr_tlv_record mon_buffer_addr; 95 struct hal_phy_location_tlv_record phy_location; 96 struct hal_ppdu_end_user_stats_tlv_record ppdu_end_user_stats; 97 struct hal_pcu_ppdu_end_info_tlv_record pcu_ppdu_end_info; 98 struct hal_phy_rx_ht_sig_tlv_record phy_rx_ht_sig; 99 uint32_t data:22; 100 } data; 101 }; 102 103 /* 104 * struct dp_tx_mon_tlv_info - recorded information of each Tx TLV 105 * @tlv_tag: tlv tag 106 * @data: union of struct of fields to be recorded for each TLV 107 * 108 * Tag and its corresponding important fields are stored in this struct 109 */ 110 111 struct dp_tx_mon_tlv_info { 112 uint32_t tlv_tag:10; 113 union { 114 /*struct of Tx TLVs to be added here*/ 115 uint32_t data:22; 116 } data; 117 }; 118 119 /** 120 * struct dp_mon_tlv_logger - contains indexes and other data of the buffer 121 * @buff: buffer in which TLVs are stored 122 * @curr_ppdu_pos: position of the next ppdu to be written 123 * @ppdu_start_idx: starting index form which PPDU start level TLVs are stored for a ppdu 124 * @mpdu_idx: starting index form which MPDU TLVs are stored for a ppdu 125 * @ppdu_end_idx: starting index form which PPDU end level TLVs are stored for a ppdu 126 * @max_ppdu_start_idx: ending index for PPDU start level TLVs for a ppdu 127 * @max_mpdu_idx: ending index for MPDU level TLVs for a ppdu 128 * @max_ppdu_end_idx: ending index for PPDU end level TLVs for a ppdu 129 * @wrap_flag: flag toggle between consecutive PPDU 130 * @tlv_logging_enable: check is tlv logging is enabled 131 * 132 */ 133 struct dp_mon_tlv_logger { 134 void *buff; 135 uint16_t curr_ppdu_pos; 136 uint16_t ppdu_start_idx; 137 uint16_t mpdu_idx; 138 uint16_t ppdu_end_idx; 139 uint16_t max_ppdu_start_idx; 140 uint16_t max_ppdu_end_idx; 141 uint16_t max_mpdu_idx; 142 uint8_t wrap_flag; 143 bool tlv_logging_enable; 144 }; 145 #endif 146 147 /* monitor frame filter modes */ 148 enum dp_mon_frm_filter_mode { 149 /* mode filter pass */ 150 DP_MON_FRM_FILTER_MODE_FP = 0, 151 /* mode monitor direct */ 152 DP_MON_FRM_FILTER_MODE_MD = 1, 153 /* mode monitor other */ 154 DP_MON_FRM_FILTER_MODE_MO = 2, 155 /* mode filter pass monitor other */ 156 DP_MON_FRM_FILTER_MODE_FP_MO = 3, 157 }; 158 159 /* mpdu filter categories */ 160 enum dp_mpdu_filter_category { 161 /* category filter pass */ 162 DP_MPDU_FILTER_CATEGORY_FP = 0, 163 /* category monitor direct */ 164 DP_MPDU_FILTER_CATEGORY_MD = 1, 165 /* category monitor other */ 166 DP_MPDU_FILTER_CATEGORY_MO = 2, 167 /* category filter pass monitor override */ 168 DP_MPDU_FILTER_CATEGORY_FP_MO = 3, 169 }; 170 171 /** 172 * struct dp_mon_filter_be - Monitor TLV filter 173 * @rx_tlv_filter: Rx MON TLV filter 174 * @tx_tlv_filter: Tx MON TLV filter 175 * @tx_valid: enable/disable Tx Mon TLV filter 176 */ 177 struct dp_mon_filter_be { 178 struct dp_mon_filter rx_tlv_filter; 179 #ifdef WLAN_PKT_CAPTURE_TX_2_0 180 struct htt_tx_ring_tlv_filter tx_tlv_filter; 181 #endif 182 bool tx_valid; 183 }; 184 185 /** 186 * struct dp_mon_desc 187 * 188 * @buf_addr: virtual address 189 * @paddr: physical address 190 * @in_use: desc is in use 191 * @unmapped: used to mark desc an unmapped if the corresponding 192 * nbuf is already unmapped 193 * @cookie_2: unique cookie provided as part of 64 bit cookie to HW 194 * @end_offset: offset in status buffer where DMA ended 195 * @cookie: unique desc identifier 196 * @magic: magic number to validate desc data 197 */ 198 struct dp_mon_desc { 199 uint8_t *buf_addr; 200 qdf_dma_addr_t paddr; 201 uint32_t in_use:1, 202 unmapped:1, 203 cookie_2:24; 204 uint16_t end_offset; 205 uint32_t cookie; 206 uint32_t magic; 207 }; 208 209 /** 210 * struct dp_mon_desc_list_elem_t 211 * @next: Next pointer to form free list 212 * @mon_desc: DP mon descriptor 213 */ 214 union dp_mon_desc_list_elem_t { 215 union dp_mon_desc_list_elem_t *next; 216 struct dp_mon_desc mon_desc; 217 }; 218 219 /** 220 * struct dp_mon_desc_pool - monitor desc pool 221 * @pool_size: number of descriptor in the pool 222 * @array: pointer to array of descriptor 223 * @freelist: pointer to free descriptor list 224 * @lock: Protection for the descriptor pool 225 * @owner: owner for nbuf 226 * @buf_size: Buffer size 227 * @buf_alignment: Buffer alignment 228 * @pf_cache: page frag cache 229 */ 230 struct dp_mon_desc_pool { 231 uint32_t pool_size; 232 union dp_mon_desc_list_elem_t *array; 233 union dp_mon_desc_list_elem_t *freelist; 234 qdf_spinlock_t lock; 235 uint8_t owner; 236 uint16_t buf_size; 237 uint8_t buf_alignment; 238 qdf_frag_cache_t pf_cache; 239 }; 240 241 /* 242 * NB: intentionally not using kernel-doc comment because the kernel-doc 243 * script does not handle the TAILQ_HEAD macro 244 * struct dp_mon_pdev_be - BE specific monitor pdev object 245 * @mon_pdev: monitor pdev structure 246 * @filter_be: filters sent to fw 247 * @tx_mon_mode: tx monitor mode 248 * @tx_mon_filter_length: tx monitor filter length 249 * @tx_monitor_be: pointer to tx monitor be structure 250 * @tx_stats: tx monitor drop stats 251 * @rx_mon_wq_lock: Rx mon workqueue lock 252 * @rx_mon_workqueue: Rx mon workqueue 253 * @rx_mon_work: Rx mon work 254 * @rx_mon_queue: RxMON queue 255 * @rx_mon_free_queue: RxMON ppdu info free element queue 256 * @ppdu_info_lock: RxPPDU ppdu info queue lock 257 * @rx_mon_queue_depth: RxMON queue depth 258 * @desc_count: reaped status desc count 259 * @status: reaped status buffer per ppdu 260 * @lite_mon_rx_config: rx litemon config 261 * @lite_mon_tx_config: tx litemon config 262 * @prev_rxmon_desc: prev destination desc 263 * @prev_rxmon_cookie: prev rxmon cookie 264 * @prev_rxmon_pkt_desc: prev packet buff desc 265 * @prev_rxmon_pkt_cookie: prev packet buff desc cookie 266 * @ppdu_info_cache: PPDU info cache 267 * @total_free_elem: total free element in queue 268 * @rx_tlv_logger: Rx TLV logger struct 269 */ 270 struct dp_mon_pdev_be { 271 struct dp_mon_pdev mon_pdev; 272 struct dp_mon_filter_be **filter_be; 273 #ifdef WLAN_PKT_CAPTURE_TX_2_0 274 uint8_t tx_mon_mode; 275 uint8_t tx_mon_filter_length; 276 struct dp_pdev_tx_monitor_be tx_monitor_be; 277 struct dp_tx_monitor_drop_stats tx_stats; 278 #endif 279 qdf_spinlock_t rx_mon_wq_lock; 280 qdf_workqueue_t *rx_mon_workqueue; 281 qdf_work_t rx_mon_work; 282 283 TAILQ_HEAD(, hal_rx_ppdu_info) rx_mon_queue; 284 TAILQ_HEAD(, hal_rx_ppdu_info) rx_mon_free_queue; 285 qdf_spinlock_t ppdu_info_lock; 286 uint16_t rx_mon_queue_depth; 287 uint16_t desc_count; 288 struct dp_mon_desc *status[DP_MON_MAX_STATUS_BUF]; 289 #ifdef QCA_SUPPORT_LITE_MONITOR 290 struct dp_lite_mon_rx_config *lite_mon_rx_config; 291 struct dp_lite_mon_tx_config *lite_mon_tx_config; 292 #endif 293 void *prev_rxmon_desc; 294 uint32_t prev_rxmon_cookie; 295 void *prev_rxmon_pkt_desc; 296 uint32_t prev_rxmon_pkt_cookie; 297 qdf_kmem_cache_t ppdu_info_cache; 298 uint32_t total_free_elem; 299 #ifdef MONITOR_TLV_RECORDING_ENABLE 300 struct dp_mon_tlv_logger *rx_tlv_log; 301 struct dp_mon_tlv_logger *tx_tlv_log; 302 #endif 303 }; 304 305 /** 306 * struct dp_mon_soc_be - BE specific monitor soc 307 * @mon_soc: Monitor soc structure 308 * @tx_mon_buf_ring: TxMon replenish ring 309 * @tx_mon_dst_ring: TxMon Destination ring 310 * @tx_desc_mon: descriptor pool for tx mon src ring 311 * @rx_desc_mon: descriptor pool for rx mon src ring 312 * @rx_mon_ring_fill_level: rx mon ring refill level 313 * @tx_mon_ring_fill_level: tx mon ring refill level 314 * @tx_low_thresh_intrs: number of tx mon low threshold interrupts received 315 * @rx_low_thresh_intrs: number of rx mon low threshold interrupts received 316 * @is_dp_mon_soc_initialized: flag to indicate soc is initialized 317 */ 318 struct dp_mon_soc_be { 319 struct dp_mon_soc mon_soc; 320 /* Source ring for Tx monitor */ 321 struct dp_srng tx_mon_buf_ring; 322 struct dp_srng tx_mon_dst_ring[MAX_NUM_LMAC_HW]; 323 324 /* Sw descriptor pool for tx mon source ring */ 325 struct dp_mon_desc_pool tx_desc_mon; 326 /* Sw descriptor pool for rx mon source ring */ 327 struct dp_mon_desc_pool rx_desc_mon; 328 329 uint16_t rx_mon_ring_fill_level; 330 uint16_t tx_mon_ring_fill_level; 331 uint32_t tx_low_thresh_intrs; 332 uint32_t rx_low_thresh_intrs; 333 334 bool is_dp_mon_soc_initialized; 335 }; 336 #endif 337 338 /** 339 * dp_mon_desc_pool_init() - Monitor descriptor pool init 340 * @mon_desc_pool: mon desc pool 341 * @pool_size: Pool size 342 * 343 * Return: non-zero for failure, zero for success 344 */ 345 QDF_STATUS 346 dp_mon_desc_pool_init(struct dp_mon_desc_pool *mon_desc_pool, 347 uint32_t pool_size); 348 349 /** 350 * dp_mon_desc_pool_deinit()- monitor descriptor pool deinit 351 * @mon_desc_pool: mon desc pool 352 * 353 * Return: None 354 * 355 */ 356 void dp_mon_desc_pool_deinit(struct dp_mon_desc_pool *mon_desc_pool); 357 358 /** 359 * dp_mon_desc_pool_free()- monitor descriptor pool free 360 * @soc: DP soc handle 361 * @mon_desc_pool: mon desc pool 362 * @ctx_type: DP context type 363 * 364 * Return: None 365 * 366 */ 367 void dp_mon_desc_pool_free(struct dp_soc *soc, 368 struct dp_mon_desc_pool *mon_desc_pool, 369 enum dp_ctxt_type ctx_type); 370 371 /** 372 * dp_mon_desc_pool_alloc() - Monitor descriptor pool alloc 373 * @soc: DP soc handle 374 * @ctx_type: DP context type 375 * @pool_size: Pool size 376 * @mon_desc_pool: mon desc pool 377 * 378 * Return: non-zero for failure, zero for success 379 */ 380 QDF_STATUS dp_mon_desc_pool_alloc(struct dp_soc *soc, 381 enum dp_ctxt_type ctx_type, 382 uint32_t pool_size, 383 struct dp_mon_desc_pool *mon_desc_pool); 384 385 /** 386 * dp_mon_pool_frag_unmap_and_free() - free the mon desc frag called during 387 * de-initialization of wifi module. 388 * 389 * @dp_soc: DP soc handle 390 * @mon_desc_pool: monitor descriptor pool pointer 391 * 392 * Return: None 393 */ 394 void dp_mon_pool_frag_unmap_and_free(struct dp_soc *dp_soc, 395 struct dp_mon_desc_pool *mon_desc_pool); 396 397 /** 398 * dp_mon_buffers_replenish() - replenish monitor ring with nbufs 399 * 400 * @dp_soc: core txrx main context 401 * @dp_mon_srng: dp monitor circular ring 402 * @mon_desc_pool: Pointer to free mon descriptor pool 403 * @num_req_buffers: number of buffer to be replenished 404 * @desc_list: list of descs if called from dp_rx_process 405 * or NULL during dp rx initialization or out of buffer 406 * interrupt. 407 * @tail: tail of descs list 408 * @replenish_cnt_ref: pointer to update replenish_cnt 409 * 410 * Return: return success or failure 411 */ 412 QDF_STATUS dp_mon_buffers_replenish(struct dp_soc *dp_soc, 413 struct dp_srng *dp_mon_srng, 414 struct dp_mon_desc_pool *mon_desc_pool, 415 uint32_t num_req_buffers, 416 union dp_mon_desc_list_elem_t **desc_list, 417 union dp_mon_desc_list_elem_t **tail, 418 uint32_t *replenish_cnt_ref); 419 420 /** 421 * dp_mon_filter_show_tx_filter_be() - Show the set filters 422 * @mode: The filter modes 423 * @filter: tlv filter 424 */ 425 void dp_mon_filter_show_tx_filter_be(enum dp_mon_filter_mode mode, 426 struct dp_mon_filter_be *filter); 427 428 /** 429 * dp_mon_filter_show_rx_filter_be() - Show the set filters 430 * @mode: The filter modes 431 * @filter: tlv filter 432 */ 433 void dp_mon_filter_show_rx_filter_be(enum dp_mon_filter_mode mode, 434 struct dp_mon_filter_be *filter); 435 436 /** 437 * dp_vdev_set_monitor_mode_buf_rings_tx_2_0() - Add buffers to tx ring 438 * @pdev: Pointer to dp_pdev object 439 * @num_of_buffers: Number of buffers to allocate 440 * 441 * Return: QDF_STATUS 442 */ 443 QDF_STATUS dp_vdev_set_monitor_mode_buf_rings_tx_2_0(struct dp_pdev *pdev, 444 uint16_t num_of_buffers); 445 446 /** 447 * dp_vdev_set_monitor_mode_buf_rings_rx_2_0() - Add buffers to rx ring 448 * @pdev: Pointer to dp_pdev object 449 * 450 * Return: QDF_STATUS 451 */ 452 QDF_STATUS dp_vdev_set_monitor_mode_buf_rings_rx_2_0(struct dp_pdev *pdev); 453 454 #ifdef QCA_ENHANCED_STATS_SUPPORT 455 /** 456 * dp_mon_get_puncture_type() - Get puncture type 457 * @puncture_pattern: puncture bitmap 458 * @bw: Bandwidth 459 */ 460 enum cdp_punctured_modes 461 dp_mon_get_puncture_type(uint16_t puncture_pattern, uint8_t bw); 462 #endif 463 464 /** 465 * dp_mon_desc_get() - get monitor sw descriptor 466 * 467 * @cookie: cookie 468 * 469 * Return: dp_mon_desc 470 */ 471 static inline 472 struct dp_mon_desc *dp_mon_desc_get(uint64_t *cookie) 473 { 474 return (struct dp_mon_desc *)cookie; 475 } 476 477 /** 478 * __dp_mon_add_to_free_desc_list() - Adds to a local free descriptor list 479 * 480 * @head: pointer to the head of local free list 481 * @tail: pointer to the tail of local free list 482 * @new: new descriptor that is added to the free list 483 * @func_name: caller func name 484 * 485 * Return: void 486 */ 487 static inline 488 void __dp_mon_add_to_free_desc_list(union dp_mon_desc_list_elem_t **head, 489 union dp_mon_desc_list_elem_t **tail, 490 struct dp_mon_desc *new, 491 const char *func_name) 492 { 493 if (!(head && new)) 494 return; 495 496 new->buf_addr = NULL; 497 new->in_use = 0; 498 499 ((union dp_mon_desc_list_elem_t *)new)->next = *head; 500 *head = (union dp_mon_desc_list_elem_t *)new; 501 /* reset tail if head->next is NULL */ 502 if (!*tail || !(*head)->next) 503 *tail = *head; 504 } 505 506 #define dp_mon_add_to_free_desc_list(head, tail, new) \ 507 __dp_mon_add_to_free_desc_list(head, tail, new, __func__) 508 509 /** 510 * dp_mon_add_desc_list_to_free_list() - append unused desc_list back to 511 * freelist. 512 * 513 * @soc: core txrx main context 514 * @local_desc_list: local desc list provided by the caller 515 * @tail: attach the point to last desc of local desc list 516 * @mon_desc_pool: monitor descriptor pool pointer 517 */ 518 519 void 520 dp_mon_add_desc_list_to_free_list(struct dp_soc *soc, 521 union dp_mon_desc_list_elem_t **local_desc_list, 522 union dp_mon_desc_list_elem_t **tail, 523 struct dp_mon_desc_pool *mon_desc_pool); 524 525 /** 526 * dp_rx_mon_add_frag_to_skb() - Add page frag to skb 527 * 528 * @ppdu_info: PPDU status info 529 * @nbuf: SKB to which frag need to be added 530 * @status_frag: Frag to add 531 * 532 * Return: void 533 */ 534 static inline void 535 dp_rx_mon_add_frag_to_skb(struct hal_rx_ppdu_info *ppdu_info, 536 qdf_nbuf_t nbuf, 537 qdf_frag_t status_frag) 538 { 539 uint16_t num_frags; 540 541 num_frags = qdf_nbuf_get_nr_frags(nbuf); 542 if (num_frags < QDF_NBUF_MAX_FRAGS) { 543 qdf_nbuf_add_rx_frag(status_frag, nbuf, 544 ppdu_info->data - (unsigned char *)status_frag, 545 ppdu_info->hdr_len, 546 RX_MONITOR_BUFFER_SIZE, 547 false); 548 } else { 549 dp_mon_err("num_frags exceeding MAX frags"); 550 qdf_assert_always(0); 551 } 552 } 553 554 #if !defined(DISABLE_MON_CONFIG) && (defined(WLAN_PKT_CAPTURE_TX_2_0) || \ 555 defined(WLAN_PKT_CAPTURE_RX_2_0)) 556 /** 557 * dp_mon_get_context_size_be() - get BE specific size for mon pdev/soc 558 * @context_type: context type for which the size is needed 559 * 560 * Return: size in bytes for the context_type 561 */ 562 static inline 563 qdf_size_t dp_mon_get_context_size_be(enum dp_context_type context_type) 564 { 565 switch (context_type) { 566 case DP_CONTEXT_TYPE_MON_SOC: 567 return sizeof(struct dp_mon_soc_be); 568 case DP_CONTEXT_TYPE_MON_PDEV: 569 return sizeof(struct dp_mon_pdev_be); 570 default: 571 return 0; 572 } 573 } 574 #endif 575 576 /** 577 * dp_get_be_mon_soc_from_dp_mon_soc() - get dp_mon_soc_be from dp_mon_soc 578 * @soc: dp_mon_soc pointer 579 * 580 * Return: dp_mon_soc_be pointer 581 */ 582 static inline 583 struct dp_mon_soc_be *dp_get_be_mon_soc_from_dp_mon_soc(struct dp_mon_soc *soc) 584 { 585 return (struct dp_mon_soc_be *)soc; 586 } 587 588 /** 589 * dp_get_be_mon_pdev_from_dp_mon_pdev() - get dp_mon_pdev_be from dp_mon_pdev 590 * @mon_pdev: dp_mon_pdev pointer 591 * 592 * Return: dp_mon_pdev_be pointer 593 */ 594 static inline 595 struct dp_mon_pdev_be *dp_get_be_mon_pdev_from_dp_mon_pdev(struct dp_mon_pdev *mon_pdev) 596 { 597 return (struct dp_mon_pdev_be *)mon_pdev; 598 } 599 600 #ifdef QCA_ENHANCED_STATS_SUPPORT 601 /* 602 * dp_enable_enhanced_stats_2_0() - BE Wrapper to enable stats 603 * @soc: Datapath soc handle 604 * @pdev_id: Pdev Id on which stats will get enable 605 * 606 * Return: status success/failure 607 */ 608 QDF_STATUS 609 dp_enable_enhanced_stats_2_0(struct cdp_soc_t *soc, uint8_t pdev_id); 610 611 /* 612 * dp_disable_enhanced_stats_2_0() - BE Wrapper to disable stats 613 * @soc: Datapath soc handle 614 * @pdev_id: Pdev Id on which stats will get disable 615 * 616 * Return: status success/failure 617 */ 618 QDF_STATUS 619 dp_disable_enhanced_stats_2_0(struct cdp_soc_t *soc, uint8_t pdev_id); 620 #endif /* QCA_ENHANCED_STATS_SUPPORT */ 621 622 #endif /* _DP_MON_2_0_H_ */ 623