xref: /freebsd/sys/contrib/dev/athk/ath12k/dp_mon.h (revision 02e9120893770924227138ba49df1edb3896112a)
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
4  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
5  */
6 
7 #ifndef ATH12K_DP_MON_H
8 #define ATH12K_DP_MON_H
9 
10 #include "core.h"
11 
12 enum dp_monitor_mode {
13 	ATH12K_DP_TX_MONITOR_MODE,
14 	ATH12K_DP_RX_MONITOR_MODE
15 };
16 
17 enum dp_mon_tx_ppdu_info_type {
18 	DP_MON_TX_PROT_PPDU_INFO,
19 	DP_MON_TX_DATA_PPDU_INFO
20 };
21 
22 enum dp_mon_tx_tlv_status {
23 	DP_MON_TX_FES_SETUP,
24 	DP_MON_TX_FES_STATUS_END,
25 	DP_MON_RX_RESPONSE_REQUIRED_INFO,
26 	DP_MON_RESPONSE_END_STATUS_INFO,
27 	DP_MON_TX_MPDU_START,
28 	DP_MON_TX_MSDU_START,
29 	DP_MON_TX_BUFFER_ADDR,
30 	DP_MON_TX_DATA,
31 	DP_MON_TX_STATUS_PPDU_NOT_DONE,
32 };
33 
34 enum dp_mon_tx_medium_protection_type {
35 	DP_MON_TX_MEDIUM_NO_PROTECTION,
36 	DP_MON_TX_MEDIUM_RTS_LEGACY,
37 	DP_MON_TX_MEDIUM_RTS_11AC_STATIC_BW,
38 	DP_MON_TX_MEDIUM_RTS_11AC_DYNAMIC_BW,
39 	DP_MON_TX_MEDIUM_CTS2SELF,
40 	DP_MON_TX_MEDIUM_QOS_NULL_NO_ACK_3ADDR,
41 	DP_MON_TX_MEDIUM_QOS_NULL_NO_ACK_4ADDR
42 };
43 
44 struct dp_mon_qosframe_addr4 {
45 	__le16 frame_control;
46 	__le16 duration;
47 	u8 addr1[ETH_ALEN];
48 	u8 addr2[ETH_ALEN];
49 	u8 addr3[ETH_ALEN];
50 	__le16 seq_ctrl;
51 	u8 addr4[ETH_ALEN];
52 	__le16 qos_ctrl;
53 } __packed;
54 
55 struct dp_mon_frame_min_one {
56 	__le16 frame_control;
57 	__le16 duration;
58 	u8 addr1[ETH_ALEN];
59 } __packed;
60 
61 struct dp_mon_packet_info {
62 	u64 cookie;
63 	u16 dma_length;
64 	bool msdu_continuation;
65 	bool truncated;
66 };
67 
68 struct dp_mon_tx_ppdu_info {
69 	u32 ppdu_id;
70 	u8  num_users;
71 	bool is_used;
72 	struct hal_rx_mon_ppdu_info rx_status;
73 	struct list_head dp_tx_mon_mpdu_list;
74 	struct dp_mon_mpdu *tx_mon_mpdu;
75 };
76 
77 enum hal_rx_mon_status
78 ath12k_dp_mon_rx_parse_mon_status(struct ath12k *ar,
79 				  struct ath12k_mon_data *pmon,
80 				  int mac_id, struct sk_buff *skb,
81 				  struct napi_struct *napi);
82 int ath12k_dp_mon_buf_replenish(struct ath12k_base *ab,
83 				struct dp_rxdma_ring *buf_ring,
84 				int req_entries);
85 int ath12k_dp_mon_srng_process(struct ath12k *ar, int mac_id,
86 			       int *budget, enum dp_monitor_mode monitor_mode,
87 			       struct napi_struct *napi);
88 int ath12k_dp_mon_process_ring(struct ath12k_base *ab, int mac_id,
89 			       struct napi_struct *napi, int budget,
90 			       enum dp_monitor_mode monitor_mode);
91 struct sk_buff *ath12k_dp_mon_tx_alloc_skb(void);
92 enum dp_mon_tx_tlv_status
93 ath12k_dp_mon_tx_status_get_num_user(u16 tlv_tag,
94 				     struct hal_tlv_hdr *tx_tlv,
95 				     u8 *num_users);
96 enum hal_rx_mon_status
97 ath12k_dp_mon_tx_parse_mon_status(struct ath12k *ar,
98 				  struct ath12k_mon_data *pmon,
99 				  int mac_id,
100 				  struct sk_buff *skb,
101 				  struct napi_struct *napi,
102 				  u32 ppdu_id);
103 void ath12k_dp_mon_rx_process_ulofdma(struct hal_rx_mon_ppdu_info *ppdu_info);
104 int ath12k_dp_mon_rx_process_stats(struct ath12k *ar, int mac_id,
105 				   struct napi_struct *napi, int *budget);
106 #endif
107