1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
7 #ifndef ATH11K_HAL_RX_H
8 #define ATH11K_HAL_RX_H
10 struct hal_rx_wbm_rel_info
{
12 enum hal_wbm_rel_src_module err_rel_src
;
13 enum hal_reo_dest_ring_push_reason push_reason
;
19 #define HAL_INVALID_PEERID 0xffff
20 #define VHT_SIG_SU_NSS_MASK 0x7
22 #define HAL_RX_MAX_MCS 12
23 #define HAL_RX_MAX_NSS 8
25 struct hal_rx_mon_status_tlv_hdr
{
30 enum hal_rx_su_mu_coding
{
31 HAL_RX_SU_MU_CODING_BCC
,
32 HAL_RX_SU_MU_CODING_LDPC
,
33 HAL_RX_SU_MU_CODING_MAX
,
52 enum hal_rx_preamble
{
61 enum hal_rx_reception_type
{
62 HAL_RX_RECEPTION_TYPE_SU
,
63 HAL_RX_RECEPTION_TYPE_MU_MIMO
,
64 HAL_RX_RECEPTION_TYPE_MU_OFDMA
,
65 HAL_RX_RECEPTION_TYPE_MU_OFDMA_MIMO
,
66 HAL_RX_RECEPTION_TYPE_MAX
,
69 #define HAL_RX_FCS_LEN 4
71 enum hal_rx_mon_status
{
72 HAL_RX_MON_STATUS_PPDU_NOT_DONE
,
73 HAL_RX_MON_STATUS_PPDU_DONE
,
74 HAL_RX_MON_STATUS_BUF_DONE
,
77 struct hal_rx_user_status
{
81 dl_ofdma_ru_start_index
:7,
84 u32 ul_ofdma_user_v0_word0
;
85 u32 ul_ofdma_user_v0_word1
;
92 u8 frame_control_info_valid
;
93 u8 data_sequence_control_info_valid
;
94 u16 first_data_seq_ctrl
;
101 u32 mpdu_cnt_fcs_err
;
102 u32 mpdu_fcs_ok_bitmap
[8];
103 u32 mpdu_ok_byte_count
;
104 u32 mpdu_err_byte_count
;
107 #define HAL_TLV_STATUS_PPDU_NOT_DONE HAL_RX_MON_STATUS_PPDU_NOT_DONE
108 #define HAL_TLV_STATUS_PPDU_DONE HAL_RX_MON_STATUS_PPDU_DONE
109 #define HAL_TLV_STATUS_BUF_DONE HAL_RX_MON_STATUS_BUF_DONE
111 struct hal_sw_mon_ring_entries
{
112 dma_addr_t mon_dst_paddr
;
113 dma_addr_t mon_status_paddr
;
114 u32 mon_dst_sw_cookie
;
115 u32 mon_status_sw_cookie
;
116 void *dst_buf_addr_info
;
117 void *status_buf_addr_info
;
125 struct hal_rx_mon_ppdu_info
{
129 u32 num_mpdu_fcs_err
;
133 u16 tcp_ack_msdu_count
;
135 u16 other_msdu_count
;
143 u8 vht_flag_values3
[4];
146 u16 vht_flag_values6
;
152 u8 rssi_chain_pri20
[HAL_RX_MAX_NSS
];
170 u8 frame_control_info_valid
;
173 u8 he_per_user_position
;
174 u8 he_per_user_known
;
187 u16 first_data_seq_ctrl
;
188 u8 monitor_direct_used
;
189 u8 data_sequence_control_info_valid
;
191 u8 rxpcu_filter_pass
;
192 char rssi_chain
[8][8];
193 struct hal_rx_user_status userstats
;
196 #define HAL_RX_PPDU_START_INFO0_PPDU_ID GENMASK(15, 0)
198 struct hal_rx_ppdu_start
{
201 __le32 ppdu_start_ts
;
204 #define HAL_RX_PPDU_END_USER_STATS_INFO0_MPDU_CNT_FCS_ERR GENMASK(25, 16)
206 #define HAL_RX_PPDU_END_USER_STATS_INFO1_MPDU_CNT_FCS_OK GENMASK(8, 0)
207 #define HAL_RX_PPDU_END_USER_STATS_INFO1_FC_VALID BIT(9)
208 #define HAL_RX_PPDU_END_USER_STATS_INFO1_QOS_CTRL_VALID BIT(10)
209 #define HAL_RX_PPDU_END_USER_STATS_INFO1_HT_CTRL_VALID BIT(11)
210 #define HAL_RX_PPDU_END_USER_STATS_INFO1_PKT_TYPE GENMASK(23, 20)
212 #define HAL_RX_PPDU_END_USER_STATS_INFO2_AST_INDEX GENMASK(15, 0)
213 #define HAL_RX_PPDU_END_USER_STATS_INFO2_FRAME_CTRL GENMASK(31, 16)
215 #define HAL_RX_PPDU_END_USER_STATS_INFO3_QOS_CTRL GENMASK(31, 16)
217 #define HAL_RX_PPDU_END_USER_STATS_INFO4_UDP_MSDU_CNT GENMASK(15, 0)
218 #define HAL_RX_PPDU_END_USER_STATS_INFO4_TCP_MSDU_CNT GENMASK(31, 16)
220 #define HAL_RX_PPDU_END_USER_STATS_INFO5_OTHER_MSDU_CNT GENMASK(15, 0)
221 #define HAL_RX_PPDU_END_USER_STATS_INFO5_TCP_ACK_MSDU_CNT GENMASK(31, 16)
223 #define HAL_RX_PPDU_END_USER_STATS_INFO7_TID_BITMAP GENMASK(15, 0)
224 #define HAL_RX_PPDU_END_USER_STATS_INFO7_TID_EOSP_BITMAP GENMASK(31, 16)
226 #define HAL_RX_PPDU_END_USER_STATS_INFO8_MPDU_OK_BYTE_COUNT GENMASK(24, 0)
227 #define HAL_RX_PPDU_END_USER_STATS_INFO9_MPDU_ERR_BYTE_COUNT GENMASK(24, 0)
229 struct hal_rx_ppdu_end_user_stats
{
249 struct hal_rx_ppdu_end_user_stats_ext
{
259 #define HAL_RX_HT_SIG_INFO_INFO0_MCS GENMASK(6, 0)
260 #define HAL_RX_HT_SIG_INFO_INFO0_BW BIT(7)
262 #define HAL_RX_HT_SIG_INFO_INFO1_STBC GENMASK(5, 4)
263 #define HAL_RX_HT_SIG_INFO_INFO1_FEC_CODING BIT(6)
264 #define HAL_RX_HT_SIG_INFO_INFO1_GI BIT(7)
266 struct hal_rx_ht_sig_info
{
271 #define HAL_RX_LSIG_B_INFO_INFO0_RATE GENMASK(3, 0)
272 #define HAL_RX_LSIG_B_INFO_INFO0_LEN GENMASK(15, 4)
274 struct hal_rx_lsig_b_info
{
278 #define HAL_RX_LSIG_A_INFO_INFO0_RATE GENMASK(3, 0)
279 #define HAL_RX_LSIG_A_INFO_INFO0_LEN GENMASK(16, 5)
280 #define HAL_RX_LSIG_A_INFO_INFO0_PKT_TYPE GENMASK(27, 24)
282 struct hal_rx_lsig_a_info
{
286 #define HAL_RX_VHT_SIG_A_INFO_INFO0_BW GENMASK(1, 0)
287 #define HAL_RX_VHT_SIG_A_INFO_INFO0_STBC BIT(3)
288 #define HAL_RX_VHT_SIG_A_INFO_INFO0_GROUP_ID GENMASK(9, 4)
289 #define HAL_RX_VHT_SIG_A_INFO_INFO0_NSTS GENMASK(21, 10)
291 #define HAL_RX_VHT_SIG_A_INFO_INFO1_GI_SETTING GENMASK(1, 0)
292 #define HAL_RX_VHT_SIG_A_INFO_INFO1_SU_MU_CODING BIT(2)
293 #define HAL_RX_VHT_SIG_A_INFO_INFO1_MCS GENMASK(7, 4)
294 #define HAL_RX_VHT_SIG_A_INFO_INFO1_BEAMFORMED BIT(8)
296 struct hal_rx_vht_sig_a_info
{
301 enum hal_rx_vht_sig_a_gi_setting
{
302 HAL_RX_VHT_SIG_A_NORMAL_GI
= 0,
303 HAL_RX_VHT_SIG_A_SHORT_GI
= 1,
304 HAL_RX_VHT_SIG_A_SHORT_GI_AMBIGUITY
= 3,
307 #define HAL_RX_SU_MU_CODING_LDPC 0x01
317 #define HE_LTF_UNKNOWN 3
319 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_MCS GENMASK(6, 3)
320 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_DCM BIT(7)
321 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_BW GENMASK(20, 19)
322 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_CP_LTF_SIZE GENMASK(22, 21)
323 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_NSTS GENMASK(25, 23)
324 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_BSS_COLOR GENMASK(13, 8)
325 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_SPATIAL_REUSE GENMASK(18, 15)
326 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_FORMAT_IND BIT(0)
327 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_BEAM_CHANGE BIT(1)
328 #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_DL_UL_FLAG BIT(2)
330 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_TXOP_DURATION GENMASK(6, 0)
331 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_CODING BIT(7)
332 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_LDPC_EXTRA BIT(8)
333 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_STBC BIT(9)
334 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_TXBF BIT(10)
335 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_PKT_EXT_FACTOR GENMASK(12, 11)
336 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_PKT_EXT_PE_DISAM BIT(13)
337 #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_DOPPLER_IND BIT(15)
339 struct hal_rx_he_sig_a_su_info
{
344 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_UL_FLAG BIT(1)
345 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_MCS_OF_SIGB GENMASK(3, 1)
346 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_DCM_OF_SIGB BIT(4)
347 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_BSS_COLOR GENMASK(10, 5)
348 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_SPATIAL_REUSE GENMASK(14, 11)
349 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_TRANSMIT_BW GENMASK(17, 15)
350 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_NUM_SIGB_SYMB GENMASK(21, 18)
351 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_COMP_MODE_SIGB BIT(22)
352 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_CP_LTF_SIZE GENMASK(24, 23)
353 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_DOPPLER_INDICATION BIT(25)
355 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_TXOP_DURATION GENMASK(6, 0)
356 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_CODING BIT(7)
357 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_NUM_LTF_SYMB GENMASK(10, 8)
358 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_LDPC_EXTRA BIT(11)
359 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_STBC BIT(12)
360 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_TXBF BIT(10)
361 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_PKT_EXT_FACTOR GENMASK(14, 13)
362 #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_PKT_EXT_PE_DISAM BIT(15)
364 struct hal_rx_he_sig_a_mu_dl_info
{
369 #define HAL_RX_HE_SIG_B1_MU_INFO_INFO0_RU_ALLOCATION GENMASK(7, 0)
371 struct hal_rx_he_sig_b1_mu_info
{
375 #define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_ID GENMASK(10, 0)
376 #define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_MCS GENMASK(18, 15)
377 #define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_CODING BIT(20)
378 #define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_NSTS GENMASK(31, 29)
380 struct hal_rx_he_sig_b2_mu_info
{
384 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_ID GENMASK(10, 0)
385 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_NSTS GENMASK(13, 11)
386 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_TXBF BIT(19)
387 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_MCS GENMASK(18, 15)
388 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_DCM BIT(19)
389 #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_CODING BIT(20)
391 struct hal_rx_he_sig_b2_ofdma_info
{
395 #define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RSSI_COMB GENMASK(15, 8)
397 #define HAL_RX_PHYRX_RSSI_PREAMBLE_PRI20 GENMASK(7, 0)
399 struct hal_rx_phyrx_chain_rssi
{
404 struct hal_rx_phyrx_rssi_legacy_info
{
406 struct hal_rx_phyrx_chain_rssi pre_rssi
[HAL_RX_MAX_NSS
];
407 struct hal_rx_phyrx_chain_rssi preamble
[HAL_RX_MAX_NSS
];
411 #define HAL_RX_MPDU_INFO_INFO0_PEERID GENMASK(31, 16)
412 #define HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855 GENMASK(15, 0)
413 #define HAL_RX_MPDU_INFO_INFO1_MPDU_LEN GENMASK(13, 0)
415 struct hal_rx_mpdu_info_ipq8074
{
423 struct hal_rx_mpdu_info_qcn9074
{
431 struct hal_rx_mpdu_info_wcn6855
{
437 struct hal_rx_mpdu_info
{
439 struct hal_rx_mpdu_info_ipq8074 ipq8074
;
440 struct hal_rx_mpdu_info_qcn9074 qcn9074
;
441 struct hal_rx_mpdu_info_wcn6855 wcn6855
;
445 #define HAL_RX_PPDU_END_DURATION GENMASK(23, 0)
446 struct hal_rx_ppdu_end_duration
{
452 struct hal_rx_rxpcu_classification_overview
{
456 struct hal_rx_msdu_desc_info
{
458 u16 msdu_len
; /* 14 bits for length */
461 #define HAL_RX_NUM_MSDU_DESC 6
462 struct hal_rx_msdu_list
{
463 struct hal_rx_msdu_desc_info msdu_info
[HAL_RX_NUM_MSDU_DESC
];
464 u32 sw_cookie
[HAL_RX_NUM_MSDU_DESC
];
465 u8 rbm
[HAL_RX_NUM_MSDU_DESC
];
468 void ath11k_hal_reo_status_queue_stats(struct ath11k_base
*ab
, u32
*reo_desc
,
469 struct hal_reo_status
*status
);
470 void ath11k_hal_reo_flush_queue_status(struct ath11k_base
*ab
, u32
*reo_desc
,
471 struct hal_reo_status
*status
);
472 void ath11k_hal_reo_flush_cache_status(struct ath11k_base
*ab
, u32
*reo_desc
,
473 struct hal_reo_status
*status
);
474 void ath11k_hal_reo_flush_cache_status(struct ath11k_base
*ab
, u32
*reo_desc
,
475 struct hal_reo_status
*status
);
476 void ath11k_hal_reo_unblk_cache_status(struct ath11k_base
*ab
, u32
*reo_desc
,
477 struct hal_reo_status
*status
);
478 void ath11k_hal_reo_flush_timeout_list_status(struct ath11k_base
*ab
,
480 struct hal_reo_status
*status
);
481 void ath11k_hal_reo_desc_thresh_reached_status(struct ath11k_base
*ab
,
483 struct hal_reo_status
*status
);
484 void ath11k_hal_reo_update_rx_reo_queue_status(struct ath11k_base
*ab
,
486 struct hal_reo_status
*status
);
487 int ath11k_hal_reo_process_status(u8
*reo_desc
, u8
*status
);
488 void ath11k_hal_rx_msdu_link_info_get(void *link_desc
, u32
*num_msdus
,
490 enum hal_rx_buf_return_buf_manager
*rbm
);
491 void ath11k_hal_rx_msdu_link_desc_set(struct ath11k_base
*ab
, void *desc
,
493 enum hal_wbm_rel_bm_act action
);
494 void ath11k_hal_rx_buf_addr_info_set(void *desc
, dma_addr_t paddr
,
495 u32 cookie
, u8 manager
);
496 void ath11k_hal_rx_buf_addr_info_get(void *desc
, dma_addr_t
*paddr
,
497 u32
*cookie
, u8
*rbm
);
498 int ath11k_hal_desc_reo_parse_err(struct ath11k_base
*ab
, u32
*rx_desc
,
499 dma_addr_t
*paddr
, u32
*desc_bank
);
500 int ath11k_hal_wbm_desc_parse_err(struct ath11k_base
*ab
, void *desc
,
501 struct hal_rx_wbm_rel_info
*rel_info
);
502 void ath11k_hal_rx_reo_ent_paddr_get(struct ath11k_base
*ab
, void *desc
,
503 dma_addr_t
*paddr
, u32
*desc_bank
);
504 void ath11k_hal_rx_reo_ent_buf_paddr_get(void *rx_desc
,
505 dma_addr_t
*paddr
, u32
*sw_cookie
,
506 void **pp_buf_addr_info
, u8
*rbm
,
509 ath11k_hal_rx_sw_mon_ring_buf_paddr_get(void *rx_desc
,
510 struct hal_sw_mon_ring_entries
*sw_mon_ent
);
511 enum hal_rx_mon_status
512 ath11k_hal_rx_parse_mon_status(struct ath11k_base
*ab
,
513 struct hal_rx_mon_ppdu_info
*ppdu_info
,
514 struct sk_buff
*skb
);
516 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_0 0xDDBEEF
517 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_1 0xADBEEF
518 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_2 0xBDBEEF
519 #define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_3 0xCDBEEF