1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022-2024 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 /* 49 * ------------------------------------------------- 50 * | Protocol & Flow TAG | Radiotap header| 51 * | | Length(128 B) | 52 * | ((4* QDF_NBUF_MAX_FRAGS) * 2) | | 53 * ------------------------------------------------- 54 */ 55 #define DP_RX_MON_MAX_RADIO_TAP_HDR (128) 56 #define DP_RX_MON_PF_TAG_LEN_PER_FRAG (4) 57 #define DP_RX_MON_TOT_PF_TAG_LEN \ 58 ((DP_RX_MON_PF_TAG_LEN_PER_FRAG) * (QDF_NBUF_MAX_FRAGS)) 59 #define DP_RX_MON_MAX_MONITOR_HEADER \ 60 ((DP_RX_MON_TOT_PF_TAG_LEN * 2) + (DP_RX_MON_MAX_RADIO_TAP_HDR)) 61 62 #define DP_RX_MON_LLC_SIZE 4 63 #define DP_RX_MON_SNAP_SIZE 4 64 #define DP_RX_MON_DECAP_HDR_SIZE 14 65 66 67 /** 68 * enum dp_mon_reap_status - monitor status ring ppdu status 69 * 70 * @DP_MON_STATUS_NO_DMA: DMA not done for status ring entry 71 * @DP_MON_STATUS_MATCH: status and dest ppdu id matches 72 * @DP_MON_STATUS_LAG: status ppdu id is lagging 73 * @DP_MON_STATUS_LEAD: status ppdu id is leading 74 * @DP_MON_STATUS_REPLENISH: status ring entry is NULL 75 * @DP_MON_STATUS_MAX: max num of different status 76 */ 77 enum dp_mon_reap_status { 78 DP_MON_STATUS_NO_DMA, 79 DP_MON_STATUS_MATCH, 80 DP_MON_STATUS_LAG, 81 DP_MON_STATUS_LEAD, 82 DP_MON_STATUS_REPLENISH, 83 DP_MON_STATUS_MAX 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_full_mon_partial_detach() - Full monitor mode detach with no locks 154 * This API deinitilises full monitor mode resources but mon_desc not free 155 * 156 * @pdev: dp pdev object 157 * 158 * Return: void 159 * 160 */ 161 void dp_full_mon_partial_detach(struct dp_pdev *pdev); 162 163 /** 164 * dp_rx_mon_process()- API to process monitor destination ring for 165 * full monitor mode 166 * 167 * @soc: dp soc handle 168 * @int_ctx: interrupt context 169 * @mac_id: lmac id 170 * @quota: No. of ring entry that can be serviced in one shot. 171 */ 172 173 uint32_t dp_rx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx, 174 uint32_t mac_id, uint32_t quota); 175 176 #else 177 /** 178 * dp_full_mon_attach() - attach full monitor mode resources 179 * @pdev: Datapath PDEV handle 180 * 181 * Return: void 182 */ 183 static inline void dp_full_mon_attach(struct dp_pdev *pdev) 184 { 185 } 186 187 /** 188 * dp_full_mon_detach() - detach full monitor mode resources 189 * @pdev: Datapath PDEV handle 190 * 191 * Return: void 192 * 193 */ 194 static inline void dp_full_mon_detach(struct dp_pdev *pdev) 195 { 196 } 197 #endif 198 199 /** 200 * dp_mon_link_free() - free monitor link desc pool 201 * @pdev: core txrx pdev context 202 * 203 * This function will release DP link desc pool for monitor mode from 204 * main device context. 205 * 206 * Return: QDF_STATUS_SUCCESS: success 207 * QDF_STATUS_E_RESOURCES: Error return 208 */ 209 QDF_STATUS dp_mon_link_free(struct dp_pdev *pdev); 210 211 212 /** 213 * dp_mon_process() - Main monitor mode processing roution. 214 * @soc: core txrx main context 215 * @int_ctx: interrupt context 216 * @mac_id: mac_id which is one of 3 mac_ids 217 * @quota: No. of status ring entry that can be serviced in one shot. 218 * 219 * This call monitor status ring process then monitor 220 * destination ring process. 221 * Called from the bottom half (tasklet/NET_RX_SOFTIRQ) 222 * 223 * Return: uint32_t: No. of ring entry that is processed. 224 */ 225 uint32_t dp_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx, 226 uint32_t mac_id, uint32_t quota); 227 228 QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id, 229 qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu); 230 231 /** 232 * dp_rx_mon_deliver_non_std() - deliver frames for non standard path 233 * @soc: core txrx main context 234 * @mac_id: MAC ID 235 * 236 * This function delivers the radio tap and dummy MSDU 237 * into user layer application for preamble only PPDU. 238 * 239 * Return: Operation status 240 */ 241 QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, uint32_t mac_id); 242 243 #ifndef REMOVE_MON_DBG_STATS 244 /** 245 * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count 246 * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV 247 * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count 248 * 249 * Update status ring PPDU start and end count. Keep track TLV state on 250 * PPDU start and end to find out if start and end is matching. Keep 251 * track missing PPDU start and end count. Keep track matching PPDU 252 * start and end count. 253 * 254 * Return: None 255 */ 256 static inline void 257 dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 258 struct cdp_pdev_mon_stats *rx_mon_stats) 259 { 260 if (ppdu_info->rx_state == 261 HAL_RX_MON_PPDU_START) { 262 rx_mon_stats->status_ppdu_start++; 263 if (rx_mon_stats->status_ppdu_state 264 != CDP_MON_PPDU_END) 265 rx_mon_stats->status_ppdu_end_mis++; 266 rx_mon_stats->status_ppdu_state 267 = CDP_MON_PPDU_START; 268 ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET; 269 } else if (ppdu_info->rx_state == 270 HAL_RX_MON_PPDU_END) { 271 rx_mon_stats->status_ppdu_end++; 272 if (rx_mon_stats->status_ppdu_state 273 != CDP_MON_PPDU_START) 274 rx_mon_stats->status_ppdu_start_mis++; 275 else 276 rx_mon_stats->status_ppdu_compl++; 277 rx_mon_stats->status_ppdu_state 278 = CDP_MON_PPDU_END; 279 ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET; 280 } 281 } 282 283 /** 284 * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats 285 * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV 286 * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count 287 * 288 * Return: None 289 */ 290 static inline void 291 dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 292 struct cdp_pdev_mon_stats *rx_mon_stats) 293 { 294 ppdu_info->rx_state = HAL_RX_MON_PPDU_END; 295 rx_mon_stats->status_ppdu_state 296 = CDP_MON_PPDU_END; 297 } 298 299 #else 300 static inline void 301 dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 302 struct cdp_pdev_mon_stats *rx_mon_stats) 303 { 304 } 305 306 static inline void 307 dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, 308 struct cdp_pdev_mon_stats *rx_mon_stats) 309 { 310 } 311 312 #endif 313 314 #ifdef QCA_ENHANCED_STATS_SUPPORT 315 void 316 dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info, 317 struct cdp_rx_indication_ppdu *cdp_rx_ppdu, 318 struct dp_pdev *pdev); 319 320 /** 321 * dp_rx_populate_su_evm_details() - Populate su evm info 322 * @ppdu_info: ppdu info structure from ppdu ring 323 * @cdp_rx_ppdu: rx ppdu indication structure 324 */ 325 void 326 dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info, 327 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 328 329 /** 330 * dp_rx_handle_ppdu_stats() - Allocate and deliver ppdu stats to cdp layer 331 * @soc: core txrx main context 332 * @pdev: pdev structure 333 * @ppdu_info: structure for rx ppdu ring 334 * 335 * Return: none 336 */ 337 void 338 dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev, 339 struct hal_rx_ppdu_info *ppdu_info); 340 #else 341 static inline void 342 dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info, 343 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 344 { 345 } 346 347 static inline void 348 dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info, 349 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 350 { 351 } 352 353 static inline void 354 dp_rx_populate_cdp_indication_ppdu_user(struct dp_pdev *pdev, 355 struct hal_rx_ppdu_info *ppdu_info, 356 struct cdp_rx_indication_ppdu 357 *cdp_rx_ppdu) 358 { 359 } 360 361 static inline void 362 dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev, 363 struct hal_rx_ppdu_info *ppdu_info, 364 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 365 { 366 } 367 368 static inline void dp_rx_rate_stats_update(struct dp_peer *peer, 369 struct cdp_rx_indication_ppdu *ppdu, 370 uint32_t user) 371 { 372 } 373 374 static inline void 375 dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev, 376 struct hal_rx_ppdu_info *ppdu_info) 377 { 378 } 379 #endif /* QCA_ENHANCED_STATS_SUPPORT */ 380 381 #ifdef WLAN_SUPPORT_CTRL_FRAME_STATS 382 /** 383 * dp_rx_mon_update_user_ctrl_frame_stats() - Function to update Rx control 384 * frame stats per user. 385 * @pdev: DP Pdev Pointer 386 * @ppdu_info: HAL Rx PPDU info Pointer 387 * 388 * Return: None 389 */ 390 void dp_rx_mon_update_user_ctrl_frame_stats(struct dp_pdev *pdev, 391 struct hal_rx_ppdu_info *ppdu_info); 392 #else 393 static inline void 394 dp_rx_mon_update_user_ctrl_frame_stats(struct dp_pdev *pdev, 395 struct hal_rx_ppdu_info *ppdu_info) 396 { 397 } 398 #endif /* WLAN_SUPPORT_CTRL_FRAME_STATS */ 399 400 #ifdef QCA_UNDECODED_METADATA_SUPPORT 401 /** 402 * dp_rx_handle_ppdu_undecoded_metadata() - Allocate and deliver ppdu info 403 * undecoded metadata to cdp layer 404 * @soc: core txrx main context 405 * @pdev: pdev structure 406 * @ppdu_info: structure for rx ppdu ring 407 * 408 * Return: none 409 */ 410 void 411 dp_rx_handle_ppdu_undecoded_metadata(struct dp_soc *soc, struct dp_pdev *pdev, 412 struct hal_rx_ppdu_info *ppdu_info); 413 414 #else 415 static inline void 416 dp_rx_handle_ppdu_undecoded_metadata(struct dp_soc *soc, struct dp_pdev *pdev, 417 struct hal_rx_ppdu_info *ppdu_info) 418 { 419 } 420 #endif /* QCA_UNDECODED_METADATA_SUPPORT */ 421 422 #ifdef QCA_MCOPY_SUPPORT 423 /** 424 * dp_rx_handle_mcopy_mode() - Allocate and deliver first MSDU payload 425 * @soc: core txrx main context 426 * @pdev: pdev structure 427 * @ppdu_info: structure for rx ppdu ring 428 * @nbuf: QDF nbuf 429 * @fcs_ok_mpdu_cnt: fcs passed mpdu index 430 * @deliver_frame: flag to deliver wdi event 431 * 432 * Return: QDF_STATUS_SUCCESS - If nbuf to be freed by caller 433 * QDF_STATUS_E_ALREADY - If nbuf not to be freed by caller 434 */ 435 QDF_STATUS 436 dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 437 struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf, 438 uint8_t fcs_ok_mpdu_cnt, bool deliver_frame); 439 440 /** 441 * dp_rx_mcopy_handle_last_mpdu() - cache and delive last MPDU header in a 442 * status buffer if MPDU end tlv is received in different buffer 443 * @soc: core txrx main context 444 * @pdev: pdev structure 445 * @ppdu_info: structure for rx ppdu ring 446 * @status_nbuf: QDF nbuf 447 * 448 * Return: void 449 */ 450 void 451 dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev, 452 struct hal_rx_ppdu_info *ppdu_info, 453 qdf_nbuf_t status_nbuf); 454 455 /** 456 * dp_rx_mcopy_process_ppdu_info() - update mcopy ppdu info 457 * @pdev: pdev structure 458 * @ppdu_info: structure for rx ppdu ring 459 * @tlv_status: processed TLV status 460 * 461 * Return: void 462 */ 463 void 464 dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev, 465 struct hal_rx_ppdu_info *ppdu_info, 466 uint32_t tlv_status); 467 468 void 469 dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 470 struct hal_rx_ppdu_info *ppdu_info, 471 uint32_t tlv_status, 472 qdf_nbuf_t status_nbuf); 473 #else 474 static inline QDF_STATUS 475 dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 476 struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf, 477 uint8_t fcs_ok_cnt, bool deliver_frame) 478 { 479 return QDF_STATUS_SUCCESS; 480 } 481 482 static inline void 483 dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev, 484 struct hal_rx_ppdu_info *ppdu_info, 485 qdf_nbuf_t status_nbuf) 486 { 487 } 488 489 static inline void 490 dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev, 491 struct hal_rx_ppdu_info *ppdu_info, 492 uint32_t tlv_status) 493 { 494 } 495 496 static inline void 497 dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev, 498 struct hal_rx_ppdu_info *ppdu_info, 499 uint32_t tlv_status, 500 qdf_nbuf_t status_nbuf) 501 { 502 } 503 #endif /* QCA_MCOPY_SUPPORT */ 504 505 /** 506 * dp_rx_handle_smart_mesh_mode() - Deliver header for smart mesh 507 * @soc: Datapath SOC handle 508 * @pdev: Datapath PDEV handle 509 * @ppdu_info: Structure for rx ppdu info 510 * @nbuf: Qdf nbuf abstraction for linux skb 511 * 512 * Return: 0 on success, 1 on failure 513 */ 514 int 515 dp_rx_handle_smart_mesh_mode(struct dp_soc *soc, struct dp_pdev *pdev, 516 struct hal_rx_ppdu_info *ppdu_info, 517 qdf_nbuf_t nbuf); 518 519 /** 520 * dp_rx_nbuf_prepare() - prepare RX nbuf 521 * @soc: core txrx main context 522 * @pdev: core txrx pdev context 523 * 524 * This function alloc & map nbuf for RX dma usage, retry it if failed 525 * until retry times reaches max threshold or succeeded. 526 * 527 * Return: qdf_nbuf_t pointer if succeeded, NULL if failed. 528 */ 529 qdf_nbuf_t 530 dp_rx_nbuf_prepare(struct dp_soc *soc, struct dp_pdev *pdev); 531 532 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE) 533 534 /** 535 * dp_rx_mon_handle_cfr_mu_info() - Gather macaddr and ast_index of peer(s) in 536 * the PPDU received, this will be used for correlation of CFR data captured 537 * for an UL-MU-PPDU 538 * @pdev: pdev ctx 539 * @ppdu_info: pointer to ppdu info structure populated from ppdu status TLVs 540 * @cdp_rx_ppdu: Rx PPDU indication structure 541 * 542 * Return: none 543 */ 544 void 545 dp_rx_mon_handle_cfr_mu_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_rx_mon_populate_cfr_ppdu_info() - Populate cdp ppdu info from hal ppdu 551 * info 552 * @pdev: pdev ctx 553 * @ppdu_info: ppdu info structure from ppdu ring 554 * @cdp_rx_ppdu : Rx PPDU indication structure 555 * 556 * Return: none 557 */ 558 void 559 dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev, 560 struct hal_rx_ppdu_info *ppdu_info, 561 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 562 563 /** 564 * dp_cfr_rcc_mode_status() - Return status of cfr rcc mode 565 * @pdev: pdev ctx 566 * 567 * Return: True or False 568 */ 569 bool 570 dp_cfr_rcc_mode_status(struct dp_pdev *pdev); 571 572 /** 573 * dp_rx_mon_populate_cfr_info() - Populate cdp ppdu info from hal cfr info 574 * @pdev: pdev ctx 575 * @ppdu_info: ppdu info structure from ppdu ring 576 * @cdp_rx_ppdu: Rx PPDU indication structure 577 * 578 * Return: none 579 */ 580 void 581 dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev, 582 struct hal_rx_ppdu_info *ppdu_info, 583 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 584 585 /** 586 * dp_update_cfr_dbg_stats() - Increment RCC debug statistics 587 * @pdev: pdev structure 588 * @ppdu_info: structure for rx ppdu ring 589 * 590 * Return: none 591 */ 592 void 593 dp_update_cfr_dbg_stats(struct dp_pdev *pdev, 594 struct hal_rx_ppdu_info *ppdu_info); 595 596 /** 597 * dp_rx_handle_cfr() - Gather cfr info from hal ppdu info 598 * @soc: core txrx main context 599 * @pdev: pdev ctx 600 * @ppdu_info: ppdu info structure from ppdu ring 601 * 602 * Return: none 603 */ 604 void 605 dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev, 606 struct hal_rx_ppdu_info *ppdu_info); 607 608 /** 609 * dp_rx_populate_cfr_non_assoc_sta() - Populate cfr ppdu info for PPDUs from 610 * non-associated stations 611 * @pdev: pdev ctx 612 * @ppdu_info: ppdu info structure from ppdu ring 613 * @cdp_rx_ppdu: Rx PPDU indication structure 614 * 615 * Return: none 616 */ 617 void 618 dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev, 619 struct hal_rx_ppdu_info *ppdu_info, 620 struct cdp_rx_indication_ppdu *cdp_rx_ppdu); 621 622 #else 623 static inline void 624 dp_rx_mon_handle_cfr_mu_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_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev, 632 struct hal_rx_ppdu_info *ppdu_info, 633 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 634 { 635 } 636 637 static inline void 638 dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev, 639 struct hal_rx_ppdu_info *ppdu_info, 640 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 641 { 642 } 643 644 static inline void 645 dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev, 646 struct hal_rx_ppdu_info *ppdu_info) 647 { 648 } 649 650 static inline void 651 dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev, 652 struct hal_rx_ppdu_info *ppdu_info, 653 struct cdp_rx_indication_ppdu *cdp_rx_ppdu) 654 { 655 } 656 657 static inline void 658 dp_update_cfr_dbg_stats(struct dp_pdev *pdev, 659 struct hal_rx_ppdu_info *ppdu_info) 660 { 661 } 662 663 static inline bool 664 dp_cfr_rcc_mode_status(struct dp_pdev *pdev) 665 { 666 return false; 667 } 668 #endif /* WLAN_CFR_ENABLE && WLAN_ENH_CFR_ENABLE */ 669 670 /** 671 * dp_rx_mon_deliver(): function to deliver packets to stack 672 * @soc: DP soc 673 * @mac_id: MAC ID 674 * @head_msdu: head of msdu list 675 * @tail_msdu: tail of msdu list 676 * 677 * Return: status: 0 - Success, non-zero: Failure 678 */ 679 QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, 680 uint32_t mac_id, 681 qdf_nbuf_t head_msdu, 682 qdf_nbuf_t tail_msdu); 683 684 /** 685 * dp_rx_mon_deliver_non_std() 686 * @soc: core txrx main context 687 * @mac_id: MAC ID 688 * 689 * This function delivers the radio tap and dummy MSDU 690 * into user layer application for preamble only PPDU. 691 * 692 * Return: QDF_STATUS 693 */ 694 QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, 695 uint32_t mac_id); 696 697 #ifdef DP_RX_MON_MEM_FRAG 698 #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\ 699 defined(WLAN_SUPPORT_RX_FLOW_TAG) 700 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc, 701 qdf_nbuf_t nbuf); 702 #else 703 static inline 704 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc, 705 qdf_nbuf_t nbuf) 706 { 707 } 708 #endif 709 #else 710 static inline 711 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc, 712 qdf_nbuf_t nbuf) 713 { 714 } 715 #endif 716 717 qdf_nbuf_t dp_rx_mon_restitch_mpdu(struct dp_soc *soc, uint32_t mac_id, 718 qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu, 719 struct cdp_mon_status *rs); 720 721 #ifdef DP_RX_MON_MEM_FRAG 722 /** 723 * dp_rx_mon_get_nbuf_80211_hdr() - Get 80211 hdr from nbuf 724 * @nbuf: qdf_nbuf_t 725 * 726 * This function must be called after moving radiotap header. 727 * 728 * Return: Ptr pointing to 80211 header or NULL. 729 */ 730 static inline 731 qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf) 732 { 733 /* Return NULL if nr_frag is Zero */ 734 if (!qdf_nbuf_get_nr_frags(nbuf)) 735 return NULL; 736 737 return qdf_nbuf_get_frag_addr(nbuf, 0); 738 } 739 #else 740 static inline 741 qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf) 742 { 743 return qdf_nbuf_data(nbuf); 744 } 745 #endif 746 747 /** 748 * dp_rx_mon_process_dest_pktlog(): function to log packet contents to 749 * pktlog buffer and send to pktlog module 750 * @soc: DP soc 751 * @mac_id: MAC ID 752 * @mpdu: MPDU buf 753 * Return: status: 0 - Success, non-zero: Failure 754 */ 755 QDF_STATUS dp_rx_mon_process_dest_pktlog(struct dp_soc *soc, 756 uint32_t mac_id, 757 qdf_nbuf_t mpdu); 758 759 #ifdef WLAN_TX_PKT_CAPTURE_ENH 760 void 761 dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev, 762 qdf_nbuf_t mon_mpdu); 763 #else 764 static inline void 765 dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev, 766 qdf_nbuf_t mon_mpdu) 767 { 768 } 769 #endif 770 771 /** 772 * dp_rx_get_mon_desc_pool() - Return monitor descriptor pool 773 * based on target 774 * @soc: soc handle 775 * @mac_id: mac id number 776 * @pdev_id: pdev id number 777 * 778 * Return: descriptor pool address 779 */ 780 static inline 781 struct rx_desc_pool *dp_rx_get_mon_desc_pool(struct dp_soc *soc, 782 uint8_t mac_id, 783 uint8_t pdev_id) 784 { 785 if (soc->wlan_cfg_ctx->rxdma1_enable) 786 return &soc->rx_desc_mon[mac_id]; 787 788 return &soc->rx_desc_buf[pdev_id]; 789 } 790 791 /** 792 * dp_rx_process_peer_based_pktlog() - Process Rx pktlog if peer based 793 * filtering enabled 794 * @soc: core txrx main context 795 * @ppdu_info: Structure for rx ppdu info 796 * @status_nbuf: Qdf nbuf abstraction for linux skb 797 * @pdev_id: mac_id/pdev_id correspondinggly for MCL and WIN 798 * 799 * Return: none 800 */ 801 void 802 dp_rx_process_peer_based_pktlog(struct dp_soc *soc, 803 struct hal_rx_ppdu_info *ppdu_info, 804 qdf_nbuf_t status_nbuf, uint32_t pdev_id); 805 806 uint32_t dp_mon_rx_add_tlv(uint8_t id, uint16_t len, void *value, 807 qdf_nbuf_t mpdu_nbuf); 808 809 /** 810 * dp_mon_rx_stats_update_rssi_dbm_params() - update rssi calibration 811 * parameters in rx stats 812 * @mon_pdev: monitor pdev 813 * @ppdu_info: Structure for rx ppdu info 814 * 815 * Return: none 816 */ 817 void 818 dp_mon_rx_stats_update_rssi_dbm_params(struct dp_mon_pdev *mon_pdev, 819 struct hal_rx_ppdu_info *ppdu_info); 820 821 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE 822 /** 823 * dp_rx_handle_local_pkt_capture() - Rx handle for local packet capture 824 * @pdev: Datapath PDEV handle 825 * @ppdu_info: Structure for rx ppdu info 826 * @nbuf: Qdf nbuf abstraction for linux skb 827 * @tlv_status: TLV status 828 * 829 * Return: 0 on success, 1 on failure 830 */ 831 int 832 dp_rx_handle_local_pkt_capture(struct dp_pdev *pdev, 833 struct hal_rx_ppdu_info *ppdu_info, 834 qdf_nbuf_t nbuf, uint32_t tlv_status); 835 #else 836 static inline int 837 dp_rx_handle_local_pkt_capture(struct dp_pdev *pdev, 838 struct hal_rx_ppdu_info *ppdu_info, 839 qdf_nbuf_t nbuf, uint32_t tlv_status) 840 { 841 return 0; 842 } 843 #endif 844 #endif /* _DP_RX_MON_H_ */ 845