1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022 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 * @mpdu: mpdu buffer 107 * @msdu_timesstamp: 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 * dp_rx_mon_deliver_non_std() - deliver frames for non standard path 221 * @soc: core txrx main context 222 * @mac_id: MAC ID 223 * 224 * This function delivers the radio tap and dummy MSDU 225 * into user layer application for preamble only PPDU. 226 * 227 * Return: Operation status 228 */ 229 QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, uint32_t mac_id); 230 231 #ifndef REMOVE_MON_DBG_STATS 232 /* 233 * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count 234 * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV 235 * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count 236 * 237 * Update status ring PPDU start and end count. Keep track TLV state on 238 * PPDU start and end to find out if start and end is matching. Keep 239 * track missing PPDU start and end count. Keep track matching PPDU 240 * start and end count. 241 * 242 * Return: None 243 */ 244 static inline void 245 dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 246 struct cdp_pdev_mon_stats *rx_mon_stats) 247 { 248 if (ppdu_info->rx_state == 249 HAL_RX_MON_PPDU_START) { 250 rx_mon_stats->status_ppdu_start++; 251 if (rx_mon_stats->status_ppdu_state 252 != CDP_MON_PPDU_END) 253 rx_mon_stats->status_ppdu_end_mis++; 254 rx_mon_stats->status_ppdu_state 255 = CDP_MON_PPDU_START; 256 ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET; 257 } else if (ppdu_info->rx_state == 258 HAL_RX_MON_PPDU_END) { 259 rx_mon_stats->status_ppdu_end++; 260 if (rx_mon_stats->status_ppdu_state 261 != CDP_MON_PPDU_START) 262 rx_mon_stats->status_ppdu_start_mis++; 263 else 264 rx_mon_stats->status_ppdu_compl++; 265 rx_mon_stats->status_ppdu_state 266 = CDP_MON_PPDU_END; 267 ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET; 268 } 269 } 270 271 /* 272 * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats 273 * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV 274 * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count 275 * 276 * Return: None 277 */ 278 static inline void 279 dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 280 struct cdp_pdev_mon_stats *rx_mon_stats) 281 { 282 ppdu_info->rx_state = HAL_RX_MON_PPDU_END; 283 rx_mon_stats->status_ppdu_state 284 = CDP_MON_PPDU_END; 285 } 286 287 #else 288 static inline void 289 dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 290 struct cdp_pdev_mon_stats *rx_mon_stats) 291 { 292 } 293 294 static inline void 295 dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 296 struct cdp_pdev_mon_stats *rx_mon_stats) 297 { 298 } 299 300 #endif 301 302 #ifdef QCA_ENHANCED_STATS_SUPPORT 303 void 304 dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info, 305 struct cdp_rx_indication_ppdu *cdp_rx_ppdu, 306 struct dp_pdev *pdev); 307 308 /* 309 * dp_rx_populate_su_evm_details() - Populate su evm info 310 * @ppdu_info: ppdu info structure from ppdu ring 311 * @cdp_rx_ppdu: rx ppdu indication structure 312 */ 313 void 314 dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info, 315 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 316 317 /** 318 * dp_rx_handle_ppdu_stats() - Allocate and deliver ppdu stats to cdp layer 319 * @soc: core txrx main context 320 * @pdev: pdev structure 321 * @ppdu_info: structure for rx ppdu ring 322 * 323 * Return: none 324 */ 325 void 326 dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev, 327 struct hal_rx_ppdu_info *ppdu_info); 328 #else 329 static inline void 330 dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info, 331 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 332 { 333 } 334 335 static inline void 336 dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info, 337 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 338 { 339 } 340 341 static inline void 342 dp_rx_populate_cdp_indication_ppdu_user(struct dp_pdev *pdev, 343 struct hal_rx_ppdu_info *ppdu_info, 344 struct cdp_rx_indication_ppdu 345 *cdp_rx_ppdu) 346 { 347 } 348 349 static inline void 350 dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev, 351 struct hal_rx_ppdu_info *ppdu_info, 352 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 353 { 354 } 355 356 static inline void dp_rx_rate_stats_update(struct dp_peer *peer, 357 struct cdp_rx_indication_ppdu *ppdu, 358 uint32_t user) 359 { 360 } 361 362 static inline void 363 dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev, 364 struct hal_rx_ppdu_info *ppdu_info) 365 { 366 } 367 #endif /* QCA_ENHANCED_STATS_SUPPORT */ 368 369 #ifdef WLAN_SUPPORT_CTRL_FRAME_STATS 370 /** 371 * dp_rx_mon_update_user_ctrl_frame_stats() - Function to update Rx control 372 * frame stats per user. 373 * @pdev: DP Pdev Pointer 374 * @ppdu_info: HAL Rx PPDU info Pointer 375 * 376 * Return: None 377 */ 378 void dp_rx_mon_update_user_ctrl_frame_stats(struct dp_pdev *pdev, 379 struct hal_rx_ppdu_info *ppdu_info); 380 #else 381 static inline void 382 dp_rx_mon_update_user_ctrl_frame_stats(struct dp_pdev *pdev, 383 struct hal_rx_ppdu_info *ppdu_info) 384 { 385 } 386 #endif /* WLAN_SUPPORT_CTRL_FRAME_STATS */ 387 388 #ifdef QCA_UNDECODED_METADATA_SUPPORT 389 /** 390 * dp_rx_handle_ppdu_undecoded_metadata() - Allocate and deliver ppdu info 391 * undecoded metadata to cdp layer 392 * @soc: core txrx main context 393 * @pdev: pdev structure 394 * @ppdu_info: structure for rx ppdu ring 395 * 396 * Return: none 397 */ 398 void 399 dp_rx_handle_ppdu_undecoded_metadata(struct dp_soc *soc, struct dp_pdev *pdev, 400 struct hal_rx_ppdu_info *ppdu_info); 401 402 #else 403 static inline void 404 dp_rx_handle_ppdu_undecoded_metadata(struct dp_soc *soc, struct dp_pdev *pdev, 405 struct hal_rx_ppdu_info *ppdu_info) 406 { 407 } 408 #endif /* QCA_UNDECODED_METADATA_SUPPORT */ 409 410 #ifdef QCA_MCOPY_SUPPORT 411 /** 412 * dp_rx_handle_mcopy_mode() - Allocate and deliver first MSDU payload 413 * @soc: core txrx main context 414 * @pdev: pdev structure 415 * @ppdu_info: structure for rx ppdu ring 416 * @nbuf: QDF nbuf 417 * @fcs_ok_mpdu_cnt: fcs passsed mpdu index 418 * @deliver_frame: flag to deliver wdi event 419 * 420 * Return: QDF_STATUS_SUCCESS - If nbuf to be freed by caller 421 * QDF_STATUS_E_ALREADY - If nbuf not to be freed by caller 422 */ 423 QDF_STATUS 424 dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 425 struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf, 426 uint8_t fcs_ok_mpdu_cnt, bool deliver_frame); 427 428 /** 429 * dp_rx_mcopy_handle_last_mpdu() - cache and delive last MPDU header in a 430 * status buffer if MPDU end tlv is received in different buffer 431 * @soc: core txrx main context 432 * @pdev: pdev structure 433 * @ppdu_info: structure for rx ppdu ring 434 * @status_nbuf: QDF nbuf 435 * 436 * Return: void 437 */ 438 void 439 dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev, 440 struct hal_rx_ppdu_info *ppdu_info, 441 qdf_nbuf_t status_nbuf); 442 443 /** 444 * dp_rx_mcopy_process_ppdu_info() - update mcopy ppdu info 445 * @ppdu_info: structure for rx ppdu ring 446 * @tlv_status: processed TLV status 447 * 448 * Return: void 449 */ 450 void 451 dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev, 452 struct hal_rx_ppdu_info *ppdu_info, 453 uint32_t tlv_status); 454 455 void 456 dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 457 struct hal_rx_ppdu_info *ppdu_info, 458 uint32_t tlv_status, 459 qdf_nbuf_t status_nbuf); 460 #else 461 static inline QDF_STATUS 462 dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 463 struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf, 464 uint8_t fcs_ok_cnt, bool deliver_frame) 465 { 466 return QDF_STATUS_SUCCESS; 467 } 468 469 static inline void 470 dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev, 471 struct hal_rx_ppdu_info *ppdu_info, 472 qdf_nbuf_t status_nbuf) 473 { 474 } 475 476 static inline void 477 dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev, 478 struct hal_rx_ppdu_info *ppdu_info, 479 uint32_t tlv_status) 480 { 481 } 482 483 static inline void 484 dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 485 struct hal_rx_ppdu_info *ppdu_info, 486 uint32_t tlv_status, 487 qdf_nbuf_t status_nbuf) 488 { 489 } 490 #endif /* QCA_MCOPY_SUPPORT */ 491 492 /** 493 * dp_rx_handle_smart_mesh_mode() - Deliver header for smart mesh 494 * @soc: Datapath SOC handle 495 * @pdev: Datapath PDEV handle 496 * @ppdu_info: Structure for rx ppdu info 497 * @nbuf: Qdf nbuf abstraction for linux skb 498 * 499 * Return: 0 on success, 1 on failure 500 */ 501 int 502 dp_rx_handle_smart_mesh_mode(struct dp_soc *soc, struct dp_pdev *pdev, 503 struct hal_rx_ppdu_info *ppdu_info, 504 qdf_nbuf_t nbuf); 505 /* 506 * dp_rx_nbuf_prepare() - prepare RX nbuf 507 * @soc: core txrx main context 508 * @pdev: core txrx pdev context 509 * 510 * This function alloc & map nbuf for RX dma usage, retry it if failed 511 * until retry times reaches max threshold or succeeded. 512 * 513 * Return: qdf_nbuf_t pointer if succeeded, NULL if failed. 514 */ 515 qdf_nbuf_t 516 dp_rx_nbuf_prepare(struct dp_soc *soc, struct dp_pdev *pdev); 517 518 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE) 519 520 /* 521 * dp_rx_mon_handle_cfr_mu_info() - Gather macaddr and ast_index of peer(s) in 522 * the PPDU received, this will be used for correlation of CFR data captured 523 * for an UL-MU-PPDU 524 * @pdev: pdev ctx 525 * @ppdu_info: pointer to ppdu info structure populated from ppdu status TLVs 526 * @cdp_rx_ppdu: Rx PPDU indication structure 527 * 528 * Return: none 529 */ 530 void 531 dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev, 532 struct hal_rx_ppdu_info *ppdu_info, 533 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 534 535 /* 536 * dp_rx_mon_populate_cfr_ppdu_info() - Populate cdp ppdu info from hal ppdu 537 * info 538 * @pdev: pdev ctx 539 * @ppdu_info: ppdu info structure from ppdu ring 540 * @cdp_rx_ppdu : Rx PPDU indication structure 541 * 542 * Return: none 543 */ 544 void 545 dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev, 546 struct hal_rx_ppdu_info *ppdu_info, 547 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 548 549 /** 550 * dp_cfr_rcc_mode_status() - Return status of cfr rcc mode 551 * @pdev: pdev ctx 552 * 553 * Return: True or False 554 */ 555 bool 556 dp_cfr_rcc_mode_status(struct dp_pdev *pdev); 557 558 /* 559 * dp_rx_mon_populate_cfr_info() - Populate cdp ppdu info from hal cfr info 560 * @pdev: pdev ctx 561 * @ppdu_info: ppdu info structure from ppdu ring 562 * @cdp_rx_ppdu: Rx PPDU indication structure 563 * 564 * Return: none 565 */ 566 void 567 dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev, 568 struct hal_rx_ppdu_info *ppdu_info, 569 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 570 571 /** 572 * dp_update_cfr_dbg_stats() - Increment RCC debug statistics 573 * @pdev: pdev structure 574 * @ppdu_info: structure for rx ppdu ring 575 * 576 * Return: none 577 */ 578 void 579 dp_update_cfr_dbg_stats(struct dp_pdev *pdev, 580 struct hal_rx_ppdu_info *ppdu_info); 581 582 /* 583 * dp_rx_handle_cfr() - Gather cfr info from hal ppdu info 584 * @soc: core txrx main context 585 * @pdev: pdev ctx 586 * @ppdu_info: ppdu info structure from ppdu ring 587 * 588 * Return: none 589 */ 590 void 591 dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev, 592 struct hal_rx_ppdu_info *ppdu_info); 593 594 /** 595 * dp_rx_populate_cfr_non_assoc_sta() - Populate cfr ppdu info for PPDUs from 596 * non-associated stations 597 * @pdev: pdev ctx 598 * @ppdu_info: ppdu info structure from ppdu ring 599 * @cdp_rx_ppdu: Rx PPDU indication structure 600 * 601 * Return: none 602 */ 603 void 604 dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev, 605 struct hal_rx_ppdu_info *ppdu_info, 606 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 607 608 #else 609 static inline void 610 dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev, 611 struct hal_rx_ppdu_info *ppdu_info, 612 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 613 { 614 } 615 616 static inline void 617 dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev, 618 struct hal_rx_ppdu_info *ppdu_info, 619 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 620 { 621 } 622 623 static inline void 624 dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev, 625 struct hal_rx_ppdu_info *ppdu_info, 626 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 627 { 628 } 629 630 static inline void 631 dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev, 632 struct hal_rx_ppdu_info *ppdu_info) 633 { 634 } 635 636 static inline void 637 dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev, 638 struct hal_rx_ppdu_info *ppdu_info, 639 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 640 { 641 } 642 643 static inline void 644 dp_update_cfr_dbg_stats(struct dp_pdev *pdev, 645 struct hal_rx_ppdu_info *ppdu_info) 646 { 647 } 648 649 static inline bool 650 dp_cfr_rcc_mode_status(struct dp_pdev *pdev) 651 { 652 return false; 653 } 654 #endif /* WLAN_CFR_ENABLE && WLAN_ENH_CFR_ENABLE */ 655 656 /* 657 * dp_rx_mon_deliver(): function to deliver packets to stack 658 * @soc: DP soc 659 * @mac_id: MAC ID 660 * @head_msdu: head of msdu list 661 * @tail_msdu: tail of msdu list 662 * 663 * Return: status: 0 - Success, non-zero: Failure 664 */ 665 QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, 666 uint32_t mac_id, 667 qdf_nbuf_t head_msdu, 668 qdf_nbuf_t tail_msdu); 669 670 /** 671 * dp_rx_mon_deliver_non_std() 672 * @soc: core txrx main context 673 * @mac_id: MAC ID 674 * 675 * This function delivers the radio tap and dummy MSDU 676 * into user layer application for preamble only PPDU. 677 * 678 * Return: QDF_STATUS 679 */ 680 QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, 681 uint32_t mac_id); 682 683 #ifdef DP_RX_MON_MEM_FRAG 684 #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\ 685 defined(WLAN_SUPPORT_RX_FLOW_TAG) 686 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc, 687 qdf_nbuf_t nbuf); 688 #else 689 static inline 690 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc, 691 qdf_nbuf_t nbuf) 692 { 693 } 694 #endif 695 #else 696 static inline 697 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc, 698 qdf_nbuf_t nbuf) 699 { 700 } 701 #endif 702 703 qdf_nbuf_t dp_rx_mon_restitch_mpdu(struct dp_soc *soc, uint32_t mac_id, 704 qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu, 705 struct cdp_mon_status *rs); 706 707 #ifdef DP_RX_MON_MEM_FRAG 708 /** 709 * dp_rx_mon_get_nbuf_80211_hdr() - Get 80211 hdr from nbuf 710 * @nbuf: qdf_nbuf_t 711 * 712 * This function must be called after moving radiotap header. 713 * 714 * Return: Ptr pointing to 80211 header or NULL. 715 */ 716 static inline 717 qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf) 718 { 719 /* Return NULL if nr_frag is Zero */ 720 if (!qdf_nbuf_get_nr_frags(nbuf)) 721 return NULL; 722 723 return qdf_nbuf_get_frag_addr(nbuf, 0); 724 } 725 #else 726 static inline 727 qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf) 728 { 729 return qdf_nbuf_data(nbuf); 730 } 731 #endif 732 733 /* 734 * dp_rx_mon_process_dest_pktlog(): function to log packet contents to 735 * pktlog buffer and send to pktlog module 736 * @soc: DP soc 737 * @mac_id: MAC ID 738 * @mpdu: MPDU buf 739 * Return: status: 0 - Success, non-zero: Failure 740 */ 741 QDF_STATUS dp_rx_mon_process_dest_pktlog(struct dp_soc *soc, 742 uint32_t mac_id, 743 qdf_nbuf_t mpdu); 744 745 #ifdef WLAN_TX_PKT_CAPTURE_ENH 746 void 747 dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev, 748 qdf_nbuf_t mon_mpdu); 749 #else 750 static inline void 751 dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev, 752 qdf_nbuf_t mon_mpdu) 753 { 754 } 755 #endif 756 757 /** 758 * dp_rx_get_mon_desc_pool() - Return monitor descriptor pool 759 * based on target 760 * @soc: soc handle 761 * @mac_id: mac id number 762 * @pdev_id: pdev id number 763 * 764 * Return: descriptor pool address 765 */ 766 static inline 767 struct rx_desc_pool *dp_rx_get_mon_desc_pool(struct dp_soc *soc, 768 uint8_t mac_id, 769 uint8_t pdev_id) 770 { 771 if (soc->wlan_cfg_ctx->rxdma1_enable) 772 return &soc->rx_desc_mon[mac_id]; 773 774 return &soc->rx_desc_buf[pdev_id]; 775 } 776 777 /** 778 * dp_rx_process_peer_based_pktlog() - Process Rx pktlog if peer based 779 * filtering enabled 780 * @soc: core txrx main context 781 * @ppdu_info: Structure for rx ppdu info 782 * @status_nbuf: Qdf nbuf abstraction for linux skb 783 * @pdev_id: mac_id/pdev_id correspondinggly for MCL and WIN 784 * 785 * Return: none 786 */ 787 void 788 dp_rx_process_peer_based_pktlog(struct dp_soc *soc, 789 struct hal_rx_ppdu_info *ppdu_info, 790 qdf_nbuf_t status_nbuf, uint32_t pdev_id); 791 792 uint32_t dp_mon_rx_add_tlv(uint8_t id, uint16_t len, void *value, 793 qdf_nbuf_t mpdu_nbuf); 794 795 /** 796 * dp_mon_rx_stats_update_rssi_dbm_params() - update rssi calibration 797 * parameters in rx stats 798 * @mon_pdev: monitor pdev 799 * @ppdu_info: Structure for rx ppdu info 800 * 801 * Return: none 802 */ 803 void 804 dp_mon_rx_stats_update_rssi_dbm_params(struct dp_mon_pdev *mon_pdev, 805 struct hal_rx_ppdu_info *ppdu_info); 806 #endif /* _DP_RX_MON_H_ */ 807