1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 #ifndef _DP_RX_MON_H_ 21 #define _DP_RX_MON_H_ 22 23 #define dp_rx_mon_status_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_RX_MON_STATUS, params) 24 #define dp_rx_mon_status_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_RX_MON_STATUS, params) 25 #define dp_rx_mon_status_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_RX_MON_STATUS, params) 26 #define dp_rx_mon_status_info(params...) \ 27 __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_RX_MON_STATUS, ## params) 28 #define dp_rx_mon_status_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_RX_MON_STATUS, params) 29 30 #define dp_rx_mon_dest_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_RX_MON_DEST, params) 31 #define dp_rx_mon_dest_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_RX_MON_DEST, params) 32 #define dp_rx_mon_dest_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_RX_MON_DEST, params) 33 #define dp_rx_mon_dest_info(params...) \ 34 __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_RX_MON_DEST, ## params) 35 #define dp_rx_mon_dest_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_RX_MON_DEST, params) 36 37 /* The maximum buffer length allocated for radiotap for monitor status buffer */ 38 #define MAX_MONITOR_HEADER (512) 39 40 /* l2 header pad byte in case of Raw frame is Zero and 2 in non raw */ 41 #define DP_RX_MON_RAW_L2_HDR_PAD_BYTE (0) 42 #define DP_RX_MON_NONRAW_L2_HDR_PAD_BYTE (2) 43 44 /* 45 * The maximum headroom reserved for monitor destination buffer to 46 * accommodate radiotap header and protocol flow tag 47 */ 48 #ifdef DP_RX_MON_MEM_FRAG 49 /* 50 * ------------------------------------------------- 51 * | Protocol & Flow TAG | Radiotap header| 52 * | | Length(128 B) | 53 * | ((4* QDF_NBUF_MAX_FRAGS) * 2) | | 54 * ------------------------------------------------- 55 */ 56 #define DP_RX_MON_MAX_RADIO_TAP_HDR (128) 57 #define DP_RX_MON_PF_TAG_LEN_PER_FRAG (4) 58 #define DP_RX_MON_TOT_PF_TAG_LEN \ 59 ((DP_RX_MON_PF_TAG_LEN_PER_FRAG) * (QDF_NBUF_MAX_FRAGS)) 60 #define DP_RX_MON_MAX_MONITOR_HEADER \ 61 ((DP_RX_MON_TOT_PF_TAG_LEN * 2) + (DP_RX_MON_MAX_RADIO_TAP_HDR)) 62 #endif 63 64 #define DP_RX_MON_LLC_SIZE 4 65 #define DP_RX_MON_SNAP_SIZE 4 66 #define DP_RX_MON_DECAP_HDR_SIZE 14 67 68 69 /** 70 * enum dp_mon_reap_status - monitor status ring ppdu status 71 * 72 * @DP_MON_STATUS_NO_DMA: DMA not done for status ring entry 73 * @DP_MON_STATUS_MATCH: status and dest ppdu id matches 74 * @DP_MON_STATUS_LAG: status ppdu id is lagging 75 * @DP_MON_STATUS_LEAD: status ppdu id is leading 76 * @DP_MON_STATUS_REPLENISH: status ring entry is NULL 77 */ 78 enum dp_mon_reap_status { 79 DP_MON_STATUS_NO_DMA, 80 DP_MON_STATUS_MATCH, 81 DP_MON_STATUS_LAG, 82 DP_MON_STATUS_LEAD, 83 DP_MON_STATUS_REPLENISH 84 }; 85 86 /** 87 * dp_rx_mon_status_process() - Process monitor status ring and 88 * TLV in status ring. 89 * 90 * @soc: core txrx main context 91 * @int_ctx: interrupt context 92 * @mac_id: mac_id which is one of 3 mac_ids 93 * @quota: No. of ring entry that can be serviced in one shot. 94 * 95 * Return: uint32_t: No. of ring entry that is processed. 96 */ 97 uint32_t 98 dp_rx_mon_status_process(struct dp_soc *soc, struct dp_intr *int_ctx, 99 uint32_t mac_id, uint32_t quota); 100 101 /** 102 * dp_rx_populate_cbf_hdr - Send CBF frame with htt header 103 * @soc: Datapath soc handle 104 * @mac_id: Datapath mac id 105 * @event: WDI event 106 * @data: mpdu buffer 107 * @msdu_timestamp: time stamp 108 * 109 * Return: QDF_STATUS 110 */ 111 QDF_STATUS dp_rx_populate_cbf_hdr(struct dp_soc *soc, 112 uint32_t mac_id, uint32_t event, 113 qdf_nbuf_t data, uint32_t msdu_timestamp); 114 115 /** 116 * dp_rx_mon_handle_status_buf_done() - Handle DMA not done case for 117 * monitor status ring 118 * 119 * @pdev: DP pdev handle 120 * @mon_status_srng: Monitor status SRNG 121 * 122 * Return: enum dp_mon_reap_status 123 */ 124 enum dp_mon_reap_status 125 dp_rx_mon_handle_status_buf_done(struct dp_pdev *pdev, 126 void *mon_status_srng); 127 128 #ifdef QCA_SUPPORT_FULL_MON 129 130 /** 131 * dp_full_mon_attach() - Full monitor mode attach 132 * This API initializes full monitor mode resources 133 * 134 * @pdev: dp pdev object 135 * 136 * Return: void 137 * 138 */ 139 void dp_full_mon_attach(struct dp_pdev *pdev); 140 141 /** 142 * dp_full_mon_detach() - Full monitor mode attach 143 * This API deinitilises full monitor mode resources 144 * 145 * @pdev: dp pdev object 146 * 147 * Return: void 148 * 149 */ 150 void dp_full_mon_detach(struct dp_pdev *pdev); 151 152 /** 153 * dp_rx_mon_process()- API to process monitor destination ring for 154 * full monitor mode 155 * 156 * @soc: dp soc handle 157 * @int_ctx: interrupt context 158 * @mac_id: lmac id 159 * @quota: No. of ring entry that can be serviced in one shot. 160 */ 161 162 uint32_t dp_rx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx, 163 uint32_t mac_id, uint32_t quota); 164 165 #else 166 /** 167 * dp_full_mon_attach() - attach full monitor mode resources 168 * @pdev: Datapath PDEV handle 169 * 170 * Return: void 171 */ 172 static inline void dp_full_mon_attach(struct dp_pdev *pdev) 173 { 174 } 175 176 /** 177 * dp_full_mon_detach() - detach full monitor mode resources 178 * @pdev: Datapath PDEV handle 179 * 180 * Return: void 181 * 182 */ 183 static inline void dp_full_mon_detach(struct dp_pdev *pdev) 184 { 185 } 186 #endif 187 188 /** 189 * dp_mon_link_free() - free monitor link desc pool 190 * @pdev: core txrx pdev context 191 * 192 * This function will release DP link desc pool for monitor mode from 193 * main device context. 194 * 195 * Return: QDF_STATUS_SUCCESS: success 196 * QDF_STATUS_E_RESOURCES: Error return 197 */ 198 QDF_STATUS dp_mon_link_free(struct dp_pdev *pdev); 199 200 201 /** 202 * dp_mon_process() - Main monitor mode processing roution. 203 * @soc: core txrx main context 204 * @int_ctx: interrupt context 205 * @mac_id: mac_id which is one of 3 mac_ids 206 * @quota: No. of status ring entry that can be serviced in one shot. 207 * 208 * This call monitor status ring process then monitor 209 * destination ring process. 210 * Called from the bottom half (tasklet/NET_RX_SOFTIRQ) 211 * 212 * Return: uint32_t: No. of ring entry that is processed. 213 */ 214 uint32_t dp_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx, 215 uint32_t mac_id, uint32_t quota); 216 217 QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id, 218 qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu); 219 220 /** 221 * dp_rx_mon_deliver_non_std() - deliver frames for non standard path 222 * @soc: core txrx main context 223 * @mac_id: MAC ID 224 * 225 * This function delivers the radio tap and dummy MSDU 226 * into user layer application for preamble only PPDU. 227 * 228 * Return: Operation status 229 */ 230 QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, uint32_t mac_id); 231 232 #ifndef REMOVE_MON_DBG_STATS 233 /** 234 * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count 235 * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV 236 * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count 237 * 238 * Update status ring PPDU start and end count. Keep track TLV state on 239 * PPDU start and end to find out if start and end is matching. Keep 240 * track missing PPDU start and end count. Keep track matching PPDU 241 * start and end count. 242 * 243 * Return: None 244 */ 245 static inline void 246 dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 247 struct cdp_pdev_mon_stats *rx_mon_stats) 248 { 249 if (ppdu_info->rx_state == 250 HAL_RX_MON_PPDU_START) { 251 rx_mon_stats->status_ppdu_start++; 252 if (rx_mon_stats->status_ppdu_state 253 != CDP_MON_PPDU_END) 254 rx_mon_stats->status_ppdu_end_mis++; 255 rx_mon_stats->status_ppdu_state 256 = CDP_MON_PPDU_START; 257 ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET; 258 } else if (ppdu_info->rx_state == 259 HAL_RX_MON_PPDU_END) { 260 rx_mon_stats->status_ppdu_end++; 261 if (rx_mon_stats->status_ppdu_state 262 != CDP_MON_PPDU_START) 263 rx_mon_stats->status_ppdu_start_mis++; 264 else 265 rx_mon_stats->status_ppdu_compl++; 266 rx_mon_stats->status_ppdu_state 267 = CDP_MON_PPDU_END; 268 ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET; 269 } 270 } 271 272 /** 273 * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats 274 * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV 275 * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count 276 * 277 * Return: None 278 */ 279 static inline void 280 dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 281 struct cdp_pdev_mon_stats *rx_mon_stats) 282 { 283 ppdu_info->rx_state = HAL_RX_MON_PPDU_END; 284 rx_mon_stats->status_ppdu_state 285 = CDP_MON_PPDU_END; 286 } 287 288 #else 289 static inline void 290 dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 291 struct cdp_pdev_mon_stats *rx_mon_stats) 292 { 293 } 294 295 static inline void 296 dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 297 struct cdp_pdev_mon_stats *rx_mon_stats) 298 { 299 } 300 301 #endif 302 303 #ifdef QCA_ENHANCED_STATS_SUPPORT 304 void 305 dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info, 306 struct cdp_rx_indication_ppdu *cdp_rx_ppdu, 307 struct dp_pdev *pdev); 308 309 /** 310 * dp_rx_populate_su_evm_details() - Populate su evm info 311 * @ppdu_info: ppdu info structure from ppdu ring 312 * @cdp_rx_ppdu: rx ppdu indication structure 313 */ 314 void 315 dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info, 316 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 317 318 /** 319 * dp_rx_handle_ppdu_stats() - Allocate and deliver ppdu stats to cdp layer 320 * @soc: core txrx main context 321 * @pdev: pdev structure 322 * @ppdu_info: structure for rx ppdu ring 323 * 324 * Return: none 325 */ 326 void 327 dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev, 328 struct hal_rx_ppdu_info *ppdu_info); 329 #else 330 static inline void 331 dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info, 332 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 333 { 334 } 335 336 static inline void 337 dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info, 338 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 339 { 340 } 341 342 static inline void 343 dp_rx_populate_cdp_indication_ppdu_user(struct dp_pdev *pdev, 344 struct hal_rx_ppdu_info *ppdu_info, 345 struct cdp_rx_indication_ppdu 346 *cdp_rx_ppdu) 347 { 348 } 349 350 static inline void 351 dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev, 352 struct hal_rx_ppdu_info *ppdu_info, 353 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 354 { 355 } 356 357 static inline void dp_rx_rate_stats_update(struct dp_peer *peer, 358 struct cdp_rx_indication_ppdu *ppdu, 359 uint32_t user) 360 { 361 } 362 363 static inline void 364 dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev, 365 struct hal_rx_ppdu_info *ppdu_info) 366 { 367 } 368 #endif /* QCA_ENHANCED_STATS_SUPPORT */ 369 370 #ifdef WLAN_SUPPORT_CTRL_FRAME_STATS 371 /** 372 * dp_rx_mon_update_user_ctrl_frame_stats() - Function to update Rx control 373 * frame stats per user. 374 * @pdev: DP Pdev Pointer 375 * @ppdu_info: HAL Rx PPDU info Pointer 376 * 377 * Return: None 378 */ 379 void dp_rx_mon_update_user_ctrl_frame_stats(struct dp_pdev *pdev, 380 struct hal_rx_ppdu_info *ppdu_info); 381 #else 382 static inline void 383 dp_rx_mon_update_user_ctrl_frame_stats(struct dp_pdev *pdev, 384 struct hal_rx_ppdu_info *ppdu_info) 385 { 386 } 387 #endif /* WLAN_SUPPORT_CTRL_FRAME_STATS */ 388 389 #ifdef QCA_UNDECODED_METADATA_SUPPORT 390 /** 391 * dp_rx_handle_ppdu_undecoded_metadata() - Allocate and deliver ppdu info 392 * undecoded metadata to cdp layer 393 * @soc: core txrx main context 394 * @pdev: pdev structure 395 * @ppdu_info: structure for rx ppdu ring 396 * 397 * Return: none 398 */ 399 void 400 dp_rx_handle_ppdu_undecoded_metadata(struct dp_soc *soc, struct dp_pdev *pdev, 401 struct hal_rx_ppdu_info *ppdu_info); 402 403 #else 404 static inline void 405 dp_rx_handle_ppdu_undecoded_metadata(struct dp_soc *soc, struct dp_pdev *pdev, 406 struct hal_rx_ppdu_info *ppdu_info) 407 { 408 } 409 #endif /* QCA_UNDECODED_METADATA_SUPPORT */ 410 411 #ifdef QCA_MCOPY_SUPPORT 412 /** 413 * dp_rx_handle_mcopy_mode() - Allocate and deliver first MSDU payload 414 * @soc: core txrx main context 415 * @pdev: pdev structure 416 * @ppdu_info: structure for rx ppdu ring 417 * @nbuf: QDF nbuf 418 * @fcs_ok_mpdu_cnt: fcs passsed mpdu index 419 * @deliver_frame: flag to deliver wdi event 420 * 421 * Return: QDF_STATUS_SUCCESS - If nbuf to be freed by caller 422 * QDF_STATUS_E_ALREADY - If nbuf not to be freed by caller 423 */ 424 QDF_STATUS 425 dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 426 struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf, 427 uint8_t fcs_ok_mpdu_cnt, bool deliver_frame); 428 429 /** 430 * dp_rx_mcopy_handle_last_mpdu() - cache and delive last MPDU header in a 431 * status buffer if MPDU end tlv is received in different buffer 432 * @soc: core txrx main context 433 * @pdev: pdev structure 434 * @ppdu_info: structure for rx ppdu ring 435 * @status_nbuf: QDF nbuf 436 * 437 * Return: void 438 */ 439 void 440 dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev, 441 struct hal_rx_ppdu_info *ppdu_info, 442 qdf_nbuf_t status_nbuf); 443 444 /** 445 * dp_rx_mcopy_process_ppdu_info() - update mcopy ppdu info 446 * @pdev: pdev structure 447 * @ppdu_info: structure for rx ppdu ring 448 * @tlv_status: processed TLV status 449 * 450 * Return: void 451 */ 452 void 453 dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev, 454 struct hal_rx_ppdu_info *ppdu_info, 455 uint32_t tlv_status); 456 457 void 458 dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 459 struct hal_rx_ppdu_info *ppdu_info, 460 uint32_t tlv_status, 461 qdf_nbuf_t status_nbuf); 462 #else 463 static inline QDF_STATUS 464 dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 465 struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf, 466 uint8_t fcs_ok_cnt, bool deliver_frame) 467 { 468 return QDF_STATUS_SUCCESS; 469 } 470 471 static inline void 472 dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev, 473 struct hal_rx_ppdu_info *ppdu_info, 474 qdf_nbuf_t status_nbuf) 475 { 476 } 477 478 static inline void 479 dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev, 480 struct hal_rx_ppdu_info *ppdu_info, 481 uint32_t tlv_status) 482 { 483 } 484 485 static inline void 486 dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 487 struct hal_rx_ppdu_info *ppdu_info, 488 uint32_t tlv_status, 489 qdf_nbuf_t status_nbuf) 490 { 491 } 492 #endif /* QCA_MCOPY_SUPPORT */ 493 494 /** 495 * dp_rx_handle_smart_mesh_mode() - Deliver header for smart mesh 496 * @soc: Datapath SOC handle 497 * @pdev: Datapath PDEV handle 498 * @ppdu_info: Structure for rx ppdu info 499 * @nbuf: Qdf nbuf abstraction for linux skb 500 * 501 * Return: 0 on success, 1 on failure 502 */ 503 int 504 dp_rx_handle_smart_mesh_mode(struct dp_soc *soc, struct dp_pdev *pdev, 505 struct hal_rx_ppdu_info *ppdu_info, 506 qdf_nbuf_t nbuf); 507 508 /** 509 * dp_rx_nbuf_prepare() - prepare RX nbuf 510 * @soc: core txrx main context 511 * @pdev: core txrx pdev context 512 * 513 * This function alloc & map nbuf for RX dma usage, retry it if failed 514 * until retry times reaches max threshold or succeeded. 515 * 516 * Return: qdf_nbuf_t pointer if succeeded, NULL if failed. 517 */ 518 qdf_nbuf_t 519 dp_rx_nbuf_prepare(struct dp_soc *soc, struct dp_pdev *pdev); 520 521 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE) 522 523 /** 524 * dp_rx_mon_handle_cfr_mu_info() - Gather macaddr and ast_index of peer(s) in 525 * the PPDU received, this will be used for correlation of CFR data captured 526 * for an UL-MU-PPDU 527 * @pdev: pdev ctx 528 * @ppdu_info: pointer to ppdu info structure populated from ppdu status TLVs 529 * @cdp_rx_ppdu: Rx PPDU indication structure 530 * 531 * Return: none 532 */ 533 void 534 dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev, 535 struct hal_rx_ppdu_info *ppdu_info, 536 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 537 538 /** 539 * dp_rx_mon_populate_cfr_ppdu_info() - Populate cdp ppdu info from hal ppdu 540 * info 541 * @pdev: pdev ctx 542 * @ppdu_info: ppdu info structure from ppdu ring 543 * @cdp_rx_ppdu : Rx PPDU indication structure 544 * 545 * Return: none 546 */ 547 void 548 dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev, 549 struct hal_rx_ppdu_info *ppdu_info, 550 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 551 552 /** 553 * dp_cfr_rcc_mode_status() - Return status of cfr rcc mode 554 * @pdev: pdev ctx 555 * 556 * Return: True or False 557 */ 558 bool 559 dp_cfr_rcc_mode_status(struct dp_pdev *pdev); 560 561 /** 562 * dp_rx_mon_populate_cfr_info() - Populate cdp ppdu info from hal cfr info 563 * @pdev: pdev ctx 564 * @ppdu_info: ppdu info structure from ppdu ring 565 * @cdp_rx_ppdu: Rx PPDU indication structure 566 * 567 * Return: none 568 */ 569 void 570 dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev, 571 struct hal_rx_ppdu_info *ppdu_info, 572 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 573 574 /** 575 * dp_update_cfr_dbg_stats() - Increment RCC debug statistics 576 * @pdev: pdev structure 577 * @ppdu_info: structure for rx ppdu ring 578 * 579 * Return: none 580 */ 581 void 582 dp_update_cfr_dbg_stats(struct dp_pdev *pdev, 583 struct hal_rx_ppdu_info *ppdu_info); 584 585 /** 586 * dp_rx_handle_cfr() - Gather cfr info from hal ppdu info 587 * @soc: core txrx main context 588 * @pdev: pdev ctx 589 * @ppdu_info: ppdu info structure from ppdu ring 590 * 591 * Return: none 592 */ 593 void 594 dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev, 595 struct hal_rx_ppdu_info *ppdu_info); 596 597 /** 598 * dp_rx_populate_cfr_non_assoc_sta() - Populate cfr ppdu info for PPDUs from 599 * non-associated stations 600 * @pdev: pdev ctx 601 * @ppdu_info: ppdu info structure from ppdu ring 602 * @cdp_rx_ppdu: Rx PPDU indication structure 603 * 604 * Return: none 605 */ 606 void 607 dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev, 608 struct hal_rx_ppdu_info *ppdu_info, 609 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 610 611 #else 612 static inline void 613 dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev, 614 struct hal_rx_ppdu_info *ppdu_info, 615 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 616 { 617 } 618 619 static inline void 620 dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev, 621 struct hal_rx_ppdu_info *ppdu_info, 622 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 623 { 624 } 625 626 static inline void 627 dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev, 628 struct hal_rx_ppdu_info *ppdu_info, 629 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 630 { 631 } 632 633 static inline void 634 dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev, 635 struct hal_rx_ppdu_info *ppdu_info) 636 { 637 } 638 639 static inline void 640 dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev, 641 struct hal_rx_ppdu_info *ppdu_info, 642 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 643 { 644 } 645 646 static inline void 647 dp_update_cfr_dbg_stats(struct dp_pdev *pdev, 648 struct hal_rx_ppdu_info *ppdu_info) 649 { 650 } 651 652 static inline bool 653 dp_cfr_rcc_mode_status(struct dp_pdev *pdev) 654 { 655 return false; 656 } 657 #endif /* WLAN_CFR_ENABLE && WLAN_ENH_CFR_ENABLE */ 658 659 /** 660 * dp_rx_mon_deliver(): function to deliver packets to stack 661 * @soc: DP soc 662 * @mac_id: MAC ID 663 * @head_msdu: head of msdu list 664 * @tail_msdu: tail of msdu list 665 * 666 * Return: status: 0 - Success, non-zero: Failure 667 */ 668 QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, 669 uint32_t mac_id, 670 qdf_nbuf_t head_msdu, 671 qdf_nbuf_t tail_msdu); 672 673 /** 674 * dp_rx_mon_deliver_non_std() 675 * @soc: core txrx main context 676 * @mac_id: MAC ID 677 * 678 * This function delivers the radio tap and dummy MSDU 679 * into user layer application for preamble only PPDU. 680 * 681 * Return: QDF_STATUS 682 */ 683 QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, 684 uint32_t mac_id); 685 686 #ifdef DP_RX_MON_MEM_FRAG 687 #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\ 688 defined(WLAN_SUPPORT_RX_FLOW_TAG) 689 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc, 690 qdf_nbuf_t nbuf); 691 #else 692 static inline 693 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc, 694 qdf_nbuf_t nbuf) 695 { 696 } 697 #endif 698 #else 699 static inline 700 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc, 701 qdf_nbuf_t nbuf) 702 { 703 } 704 #endif 705 706 qdf_nbuf_t dp_rx_mon_restitch_mpdu(struct dp_soc *soc, uint32_t mac_id, 707 qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu, 708 struct cdp_mon_status *rs); 709 710 #ifdef DP_RX_MON_MEM_FRAG 711 /** 712 * dp_rx_mon_get_nbuf_80211_hdr() - Get 80211 hdr from nbuf 713 * @nbuf: qdf_nbuf_t 714 * 715 * This function must be called after moving radiotap header. 716 * 717 * Return: Ptr pointing to 80211 header or NULL. 718 */ 719 static inline 720 qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf) 721 { 722 /* Return NULL if nr_frag is Zero */ 723 if (!qdf_nbuf_get_nr_frags(nbuf)) 724 return NULL; 725 726 return qdf_nbuf_get_frag_addr(nbuf, 0); 727 } 728 #else 729 static inline 730 qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf) 731 { 732 return qdf_nbuf_data(nbuf); 733 } 734 #endif 735 736 /** 737 * dp_rx_mon_process_dest_pktlog(): function to log packet contents to 738 * pktlog buffer and send to pktlog module 739 * @soc: DP soc 740 * @mac_id: MAC ID 741 * @mpdu: MPDU buf 742 * Return: status: 0 - Success, non-zero: Failure 743 */ 744 QDF_STATUS dp_rx_mon_process_dest_pktlog(struct dp_soc *soc, 745 uint32_t mac_id, 746 qdf_nbuf_t mpdu); 747 748 #ifdef WLAN_TX_PKT_CAPTURE_ENH 749 void 750 dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev, 751 qdf_nbuf_t mon_mpdu); 752 #else 753 static inline void 754 dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev, 755 qdf_nbuf_t mon_mpdu) 756 { 757 } 758 #endif 759 760 /** 761 * dp_rx_get_mon_desc_pool() - Return monitor descriptor pool 762 * based on target 763 * @soc: soc handle 764 * @mac_id: mac id number 765 * @pdev_id: pdev id number 766 * 767 * Return: descriptor pool address 768 */ 769 static inline 770 struct rx_desc_pool *dp_rx_get_mon_desc_pool(struct dp_soc *soc, 771 uint8_t mac_id, 772 uint8_t pdev_id) 773 { 774 if (soc->wlan_cfg_ctx->rxdma1_enable) 775 return &soc->rx_desc_mon[mac_id]; 776 777 return &soc->rx_desc_buf[pdev_id]; 778 } 779 780 /** 781 * dp_rx_process_peer_based_pktlog() - Process Rx pktlog if peer based 782 * filtering enabled 783 * @soc: core txrx main context 784 * @ppdu_info: Structure for rx ppdu info 785 * @status_nbuf: Qdf nbuf abstraction for linux skb 786 * @pdev_id: mac_id/pdev_id correspondinggly for MCL and WIN 787 * 788 * Return: none 789 */ 790 void 791 dp_rx_process_peer_based_pktlog(struct dp_soc *soc, 792 struct hal_rx_ppdu_info *ppdu_info, 793 qdf_nbuf_t status_nbuf, uint32_t pdev_id); 794 795 uint32_t dp_mon_rx_add_tlv(uint8_t id, uint16_t len, void *value, 796 qdf_nbuf_t mpdu_nbuf); 797 798 /** 799 * dp_mon_rx_stats_update_rssi_dbm_params() - update rssi calibration 800 * parameters in rx stats 801 * @mon_pdev: monitor pdev 802 * @ppdu_info: Structure for rx ppdu info 803 * 804 * Return: none 805 */ 806 void 807 dp_mon_rx_stats_update_rssi_dbm_params(struct dp_mon_pdev *mon_pdev, 808 struct hal_rx_ppdu_info *ppdu_info); 809 #endif /* _DP_RX_MON_H_ */ 810