1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
6 #ifndef ATH11K_HAL_RX_H
7 #define ATH11K_HAL_RX_H
9 struct hal_rx_wbm_rel_info
{
11 enum hal_wbm_rel_src_module err_rel_src
;
12 enum hal_reo_dest_ring_push_reason push_reason
;
18 #define HAL_INVALID_PEERID 0xffff
19 #define VHT_SIG_SU_NSS_MASK 0x7
21 #define HAL_RX_MAX_MCS 12
22 #define HAL_RX_MAX_NSS 8
24 struct hal_rx_mon_status_tlv_hdr
{
29 enum hal_rx_su_mu_coding
{
30 HAL_RX_SU_MU_CODING_BCC
,
31 HAL_RX_SU_MU_CODING_LDPC
,
32 HAL_RX_SU_MU_CODING_MAX
,
51 enum hal_rx_preamble
{
60 enum hal_rx_reception_type
{
61 HAL_RX_RECEPTION_TYPE_SU
,
62 HAL_RX_RECEPTION_TYPE_MU_MIMO
,
63 HAL_RX_RECEPTION_TYPE_MU_OFDMA
,
64 HAL_RX_RECEPTION_TYPE_MU_OFDMA_MIMO
,
65 HAL_RX_RECEPTION_TYPE_MAX
,
68 #define HAL_TLV_STATUS_PPDU_NOT_DONE 0
69 #define HAL_TLV_STATUS_PPDU_DONE 1
70 #define HAL_TLV_STATUS_BUF_DONE 2
71 #define HAL_TLV_STATUS_PPDU_NON_STD_DONE 3
72 #define HAL_RX_FCS_LEN 4
74 enum hal_rx_mon_status
{
75 HAL_RX_MON_STATUS_PPDU_NOT_DONE
,
76 HAL_RX_MON_STATUS_PPDU_DONE
,
77 HAL_RX_MON_STATUS_BUF_DONE
,
80 struct hal_rx_mon_ppdu_info
{
88 u16 tcp_ack_msdu_count
;
106 #define HAL_RX_PPDU_START_INFO0_PPDU_ID GENMASK(15, 0)
108 struct hal_rx_ppdu_start
{
111 __le32 ppdu_start_ts
;
114 #define HAL_RX_PPDU_END_USER_STATS_INFO0_MPDU_CNT_FCS_ERR GENMASK(25, 16)
116 #define HAL_RX_PPDU_END_USER_STATS_INFO1_MPDU_CNT_FCS_OK GENMASK(8, 0)
117 #define HAL_RX_PPDU_END_USER_STATS_INFO1_FC_VALID BIT(9)
118 #define HAL_RX_PPDU_END_USER_STATS_INFO1_QOS_CTRL_VALID BIT(10)
119 #define HAL_RX_PPDU_END_USER_STATS_INFO1_HT_CTRL_VALID BIT(11)
120 #define HAL_RX_PPDU_END_USER_STATS_INFO1_PKT_TYPE GENMASK(23, 20)
122 #define HAL_RX_PPDU_END_USER_STATS_INFO2_AST_INDEX GENMASK(15, 0)
123 #define HAL_RX_PPDU_END_USER_STATS_INFO2_FRAME_CTRL GENMASK(31, 16)
125 #define HAL_RX_PPDU_END_USER_STATS_INFO3_QOS_CTRL GENMASK(31, 16)
127 #define HAL_RX_PPDU_END_USER_STATS_INFO4_UDP_MSDU_CNT GENMASK(15, 0)
128 #define HAL_RX_PPDU_END_USER_STATS_INFO4_TCP_MSDU_CNT GENMASK(31, 16)
130 #define HAL_RX_PPDU_END_USER_STATS_INFO5_OTHER_MSDU_CNT GENMASK(15, 0)
131 #define HAL_RX_PPDU_END_USER_STATS_INFO5_TCP_ACK_MSDU_CNT GENMASK(31, 16)
133 #define HAL_RX_PPDU_END_USER_STATS_INFO6_TID_BITMAP GENMASK(15, 0)
134 #define HAL_RX_PPDU_END_USER_STATS_INFO6_TID_EOSP_BITMAP GENMASK(31, 16)
136 struct hal_rx_ppdu_end_user_stats
{
150 #define HAL_RX_HT_SIG_INFO_INFO0_MCS GENMASK(6, 0)
151 #define HAL_RX_HT_SIG_INFO_INFO0_BW BIT(7)
153 #define HAL_RX_HT_SIG_INFO_INFO1_STBC GENMASK(5, 4)
154 #define HAL_RX_HT_SIG_INFO_INFO1_FEC_CODING BIT(6)
155 #define HAL_RX_HT_SIG_INFO_INFO1_GI BIT(7)
157 struct hal_rx_ht_sig_info
{
162 #define HAL_RX_LSIG_B_INFO_INFO0_RATE GENMASK(3, 0)
163 #define HAL_RX_LSIG_B_INFO_INFO0_LEN GENMASK(15, 4)
165 struct hal_rx_lsig_b_info
{
169 #define HAL_RX_LSIG_A_INFO_INFO0_RATE GENMASK(3, 0)
170 #define HAL_RX_LSIG_A_INFO_INFO0_LEN GENMASK(16, 5)
171 #define HAL_RX_LSIG_A_INFO_INFO0_PKT_TYPE GENMASK(27, 24)
173 struct hal_rx_lsig_a_info
{
177 #define HAL_RX_VHT_SIG_A_INFO_INFO0_BW GENMASK(1, 0)
178 #define HAL_RX_VHT_SIG_A_INFO_INFO0_STBC BIT(3)
179 #define HAL_RX_VHT_SIG_A_INFO_INFO0_GROUP_ID GENMASK(9, 4)
180 #define HAL_RX_VHT_SIG_A_INFO_INFO0_NSTS GENMASK(21, 10)
182 #define HAL_RX_VHT_SIG_A_INFO_INFO1_GI_SETTING GENMASK(1, 0)
183 #define HAL_RX_VHT_SIG_A_INFO_INFO1_SU_MU_CODING BIT(2)
184 #define HAL_RX_VHT_SIG_A_INFO_INFO1_MCS GENMASK(7, 4)
185 #define HAL_RX_VHT_SIG_A_INFO_INFO1_BEAMFORMED BIT(8)
187 struct hal_rx_vht_sig_a_info
{
192 enum hal_rx_vht_sig_a_gi_setting
{
193 HAL_RX_VHT_SIG_A_NORMAL_GI
= 0,
194 HAL_RX_VHT_SIG_A_SHORT_GI
= 1,
195 HAL_RX_VHT_SIG_A_SHORT_GI_AMBIGUITY
= 3,
198 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_MCS GENMASK(6, 3)
199 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_DCM BIT(7)
200 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_BW GENMASK(20, 19)
201 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_CP_LTF_SIZE GENMASK(22, 21)
202 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_NSTS GENMASK(25, 23)
204 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_CODING BIT(7)
205 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_STBC BIT(9)
206 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_TXBF BIT(10)
208 struct hal_rx_he_sig_a_su_info
{
213 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_TRANSMIT_BW GENMASK(17, 15)
214 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_CP_LTF_SIZE GENMASK(24, 23)
216 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_STBC BIT(12)
218 struct hal_rx_he_sig_a_mu_dl_info
{
223 #define HAL_RX_HE_SIG_B1_MU_INFO_INFO0_RU_ALLOCATION GENMASK(7, 0)
225 struct hal_rx_he_sig_b1_mu_info
{
229 #define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_MCS GENMASK(18, 15)
230 #define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_CODING BIT(20)
231 #define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_NSTS GENMASK(31, 29)
233 struct hal_rx_he_sig_b2_mu_info
{
237 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_NSTS GENMASK(13, 11)
238 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_TXBF BIT(19)
239 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_MCS GENMASK(18, 15)
240 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_DCM BIT(19)
241 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_CODING BIT(20)
243 struct hal_rx_he_sig_b2_ofdma_info
{
247 #define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB GENMASK(15, 8)
249 struct hal_rx_phyrx_rssi_legacy_info
{
254 #define HAL_RX_MPDU_INFO_INFO0_PEERID GENMASK(31, 16)
255 struct hal_rx_mpdu_info
{
261 #define HAL_RX_PPDU_END_DURATION GENMASK(23, 0)
262 struct hal_rx_ppdu_end_duration
{
268 struct hal_rx_rxpcu_classification_overview
{
272 struct hal_rx_msdu_desc_info
{
274 u16 msdu_len
; /* 14 bits for length */
277 #define HAL_RX_NUM_MSDU_DESC 6
278 struct hal_rx_msdu_list
{
279 struct hal_rx_msdu_desc_info msdu_info
[HAL_RX_NUM_MSDU_DESC
];
280 u32 sw_cookie
[HAL_RX_NUM_MSDU_DESC
];
281 u8 rbm
[HAL_RX_NUM_MSDU_DESC
];
284 void ath11k_hal_reo_status_queue_stats(struct ath11k_base
*ab
, u32
*reo_desc
,
285 struct hal_reo_status
*status
);
286 void ath11k_hal_reo_flush_queue_status(struct ath11k_base
*ab
, u32
*reo_desc
,
287 struct hal_reo_status
*status
);
288 void ath11k_hal_reo_flush_cache_status(struct ath11k_base
*ab
, u32
*reo_desc
,
289 struct hal_reo_status
*status
);
290 void ath11k_hal_reo_flush_cache_status(struct ath11k_base
*ab
, u32
*reo_desc
,
291 struct hal_reo_status
*status
);
292 void ath11k_hal_reo_unblk_cache_status(struct ath11k_base
*ab
, u32
*reo_desc
,
293 struct hal_reo_status
*status
);
294 void ath11k_hal_reo_flush_timeout_list_status(struct ath11k_base
*ab
,
296 struct hal_reo_status
*status
);
297 void ath11k_hal_reo_desc_thresh_reached_status(struct ath11k_base
*ab
,
299 struct hal_reo_status
*status
);
300 void ath11k_hal_reo_update_rx_reo_queue_status(struct ath11k_base
*ab
,
302 struct hal_reo_status
*status
);
303 int ath11k_hal_reo_process_status(u8
*reo_desc
, u8
*status
);
304 void ath11k_hal_rx_msdu_link_info_get(void *link_desc
, u32
*num_msdus
,
306 enum hal_rx_buf_return_buf_manager
*rbm
);
307 void ath11k_hal_rx_msdu_link_desc_set(struct ath11k_base
*ab
, void *desc
,
309 enum hal_wbm_rel_bm_act action
);
310 void ath11k_hal_rx_buf_addr_info_set(void *desc
, dma_addr_t paddr
,
311 u32 cookie
, u8 manager
);
312 void ath11k_hal_rx_buf_addr_info_get(void *desc
, dma_addr_t
*paddr
,
313 u32
*cookie
, u8
*rbm
);
314 int ath11k_hal_desc_reo_parse_err(struct ath11k_base
*ab
, u32
*rx_desc
,
315 dma_addr_t
*paddr
, u32
*desc_bank
);
316 int ath11k_hal_wbm_desc_parse_err(struct ath11k_base
*ab
, void *desc
,
317 struct hal_rx_wbm_rel_info
*rel_info
);
318 void ath11k_hal_rx_reo_ent_paddr_get(struct ath11k_base
*ab
, void *desc
,
319 dma_addr_t
*paddr
, u32
*desc_bank
);
320 void ath11k_hal_rx_reo_ent_buf_paddr_get(void *rx_desc
,
321 dma_addr_t
*paddr
, u32
*sw_cookie
,
322 void **pp_buf_addr_info
,
324 enum hal_rx_mon_status
325 ath11k_hal_rx_parse_mon_status(struct ath11k_base
*ab
,
326 struct hal_rx_mon_ppdu_info
*ppdu_info
,
327 struct sk_buff
*skb
);
328 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_0 0xDDBEEF
329 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_1 0xADBEEF
330 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_2 0xBDBEEF
331 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_3 0xCDBEEF