| 1 |
/* SPDX-License-Identifier: BSD-3-Clause-Clear */ |
| 2 |
/* |
| 3 |
* Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. |
| 4 |
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. |
| 5 |
*/ |
| 6 |
|
| 7 |
#ifndef ATH12K_DP_MON_H |
| 8 |
#define ATH12K_DP_MON_H |
| 9 |
|
| 10 |
#include "core.h" |
| 11 |
|
| 12 |
#define ATH12K_MON_RX_DOT11_OFFSET 5 |
| 13 |
#define ATH12K_MON_RX_PKT_OFFSET 8 |
| 14 |
|
| 15 |
#define ATH12K_LE32_DEC_ENC(value, dec_bits, enc_bits) \ |
| 16 |
u32_encode_bits(le32_get_bits(value, dec_bits), enc_bits) |
| 17 |
|
| 18 |
#define ATH12K_LE64_DEC_ENC(value, dec_bits, enc_bits) \ |
| 19 |
u32_encode_bits(le64_get_bits(value, dec_bits), enc_bits) |
| 20 |
|
| 21 |
enum dp_monitor_mode { |
| 22 |
ATH12K_DP_TX_MONITOR_MODE, |
| 23 |
ATH12K_DP_RX_MONITOR_MODE |
| 24 |
}; |
| 25 |
|
| 26 |
enum dp_mon_tx_ppdu_info_type { |
| 27 |
DP_MON_TX_PROT_PPDU_INFO, |
| 28 |
DP_MON_TX_DATA_PPDU_INFO |
| 29 |
}; |
| 30 |
|
| 31 |
enum dp_mon_tx_tlv_status { |
| 32 |
DP_MON_TX_FES_SETUP, |
| 33 |
DP_MON_TX_FES_STATUS_END, |
| 34 |
DP_MON_RX_RESPONSE_REQUIRED_INFO, |
| 35 |
DP_MON_RESPONSE_END_STATUS_INFO, |
| 36 |
DP_MON_TX_MPDU_START, |
| 37 |
DP_MON_TX_MSDU_START, |
| 38 |
DP_MON_TX_BUFFER_ADDR, |
| 39 |
DP_MON_TX_DATA, |
| 40 |
DP_MON_TX_STATUS_PPDU_NOT_DONE, |
| 41 |
}; |
| 42 |
|
| 43 |
enum dp_mon_tx_medium_protection_type { |
| 44 |
DP_MON_TX_MEDIUM_NO_PROTECTION, |
| 45 |
DP_MON_TX_MEDIUM_RTS_LEGACY, |
| 46 |
DP_MON_TX_MEDIUM_RTS_11AC_STATIC_BW, |
| 47 |
DP_MON_TX_MEDIUM_RTS_11AC_DYNAMIC_BW, |
| 48 |
DP_MON_TX_MEDIUM_CTS2SELF, |
| 49 |
DP_MON_TX_MEDIUM_QOS_NULL_NO_ACK_3ADDR, |
| 50 |
DP_MON_TX_MEDIUM_QOS_NULL_NO_ACK_4ADDR |
| 51 |
}; |
| 52 |
|
| 53 |
struct dp_mon_qosframe_addr4 { |
| 54 |
__le16 frame_control; |
| 55 |
__le16 duration; |
| 56 |
u8 addr1[ETH_ALEN]; |
| 57 |
u8 addr2[ETH_ALEN]; |
| 58 |
u8 addr3[ETH_ALEN]; |
| 59 |
__le16 seq_ctrl; |
| 60 |
u8 addr4[ETH_ALEN]; |
| 61 |
__le16 qos_ctrl; |
| 62 |
} __packed; |
| 63 |
|
| 64 |
struct dp_mon_frame_min_one { |
| 65 |
__le16 frame_control; |
| 66 |
__le16 duration; |
| 67 |
u8 addr1[ETH_ALEN]; |
| 68 |
} __packed; |
| 69 |
|
| 70 |
struct dp_mon_packet_info { |
| 71 |
u64 cookie; |
| 72 |
u16 dma_length; |
| 73 |
bool msdu_continuation; |
| 74 |
bool truncated; |
| 75 |
}; |
| 76 |
|
| 77 |
struct dp_mon_tx_ppdu_info { |
| 78 |
u32 ppdu_id; |
| 79 |
u8 num_users; |
| 80 |
bool is_used; |
| 81 |
struct hal_rx_mon_ppdu_info rx_status; |
| 82 |
struct list_head dp_tx_mon_mpdu_list; |
| 83 |
struct dp_mon_mpdu *tx_mon_mpdu; |
| 84 |
}; |
| 85 |
|
| 86 |
int ath12k_dp_mon_buf_replenish(struct ath12k_base *ab, |
| 87 |
struct dp_rxdma_mon_ring *buf_ring, |
| 88 |
int req_entries); |
| 89 |
int ath12k_dp_mon_status_bufs_replenish(struct ath12k_base *ab, |
| 90 |
struct dp_rxdma_mon_ring *rx_ring, |
| 91 |
int req_entries); |
| 92 |
void ath12k_dp_mon_rx_process_ulofdma(struct hal_rx_mon_ppdu_info *ppdu_info); |
| 93 |
void |
| 94 |
ath12k_dp_mon_rx_update_peer_mu_stats(struct ath12k_base *ab, |
| 95 |
struct hal_rx_mon_ppdu_info *ppdu_info); |
| 96 |
void ath12k_dp_mon_rx_update_peer_su_stats(struct ath12k_dp_link_peer *peer, |
| 97 |
struct hal_rx_mon_ppdu_info *ppdu_info); |
| 98 |
int ath12k_dp_pkt_set_pktlen(struct sk_buff *skb, u32 len); |
| 99 |
struct sk_buff |
| 100 |
*ath12k_dp_rx_alloc_mon_status_buf(struct ath12k_base *ab, |
| 101 |
struct dp_rxdma_mon_ring *rx_ring, |
| 102 |
int *buf_id); |
| 103 |
u32 ath12k_dp_mon_comp_ppduid(u32 msdu_ppdu_id, u32 *ppdu_id); |
| 104 |
int |
| 105 |
ath12k_dp_mon_parse_status_buf(struct ath12k_pdev_dp *dp_pdev, |
| 106 |
struct ath12k_mon_data *pmon, |
| 107 |
const struct dp_mon_packet_info *packet_info); |
| 108 |
void ath12k_dp_mon_update_radiotap(struct ath12k_pdev_dp *dp_pdev, |
| 109 |
struct hal_rx_mon_ppdu_info *ppduinfo, |
| 110 |
struct sk_buff *mon_skb, |
| 111 |
struct ieee80211_rx_status *rxs); |
| 112 |
void ath12k_dp_mon_rx_deliver_msdu(struct ath12k_pdev_dp *dp_pdev, |
| 113 |
struct napi_struct *napi, |
| 114 |
struct sk_buff *msdu, |
| 115 |
const struct hal_rx_mon_ppdu_info *ppduinfo, |
| 116 |
struct ieee80211_rx_status *status, |
| 117 |
u8 decap); |
| 118 |
struct sk_buff * |
| 119 |
ath12k_dp_mon_rx_merg_msdus(struct ath12k_pdev_dp *dp_pdev, |
| 120 |
struct dp_mon_mpdu *mon_mpdu, |
| 121 |
struct hal_rx_mon_ppdu_info *ppdu_info, |
| 122 |
struct ieee80211_rx_status *rxs); |
| 123 |
#endif |