162306a36Sopenharmony_ci/* SPDX-License-Identifier: BSD-3-Clause-Clear */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef ATH11K_HAL_RX_H
762306a36Sopenharmony_ci#define ATH11K_HAL_RX_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_cistruct hal_rx_wbm_rel_info {
1062306a36Sopenharmony_ci	u32 cookie;
1162306a36Sopenharmony_ci	enum hal_wbm_rel_src_module err_rel_src;
1262306a36Sopenharmony_ci	enum hal_reo_dest_ring_push_reason push_reason;
1362306a36Sopenharmony_ci	u32 err_code;
1462306a36Sopenharmony_ci	bool first_msdu;
1562306a36Sopenharmony_ci	bool last_msdu;
1662306a36Sopenharmony_ci};
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define HAL_INVALID_PEERID 0xffff
1962306a36Sopenharmony_ci#define VHT_SIG_SU_NSS_MASK 0x7
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define HAL_RX_MAX_MCS 12
2262306a36Sopenharmony_ci#define HAL_RX_MAX_NSS 8
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cistruct hal_rx_mon_status_tlv_hdr {
2562306a36Sopenharmony_ci	u32 hdr;
2662306a36Sopenharmony_ci	u8 value[];
2762306a36Sopenharmony_ci};
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_cienum hal_rx_su_mu_coding {
3062306a36Sopenharmony_ci	HAL_RX_SU_MU_CODING_BCC,
3162306a36Sopenharmony_ci	HAL_RX_SU_MU_CODING_LDPC,
3262306a36Sopenharmony_ci	HAL_RX_SU_MU_CODING_MAX,
3362306a36Sopenharmony_ci};
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_cienum hal_rx_gi {
3662306a36Sopenharmony_ci	HAL_RX_GI_0_8_US,
3762306a36Sopenharmony_ci	HAL_RX_GI_0_4_US,
3862306a36Sopenharmony_ci	HAL_RX_GI_1_6_US,
3962306a36Sopenharmony_ci	HAL_RX_GI_3_2_US,
4062306a36Sopenharmony_ci	HAL_RX_GI_MAX,
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_cienum hal_rx_bw {
4462306a36Sopenharmony_ci	HAL_RX_BW_20MHZ,
4562306a36Sopenharmony_ci	HAL_RX_BW_40MHZ,
4662306a36Sopenharmony_ci	HAL_RX_BW_80MHZ,
4762306a36Sopenharmony_ci	HAL_RX_BW_160MHZ,
4862306a36Sopenharmony_ci	HAL_RX_BW_MAX,
4962306a36Sopenharmony_ci};
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_cienum hal_rx_preamble {
5262306a36Sopenharmony_ci	HAL_RX_PREAMBLE_11A,
5362306a36Sopenharmony_ci	HAL_RX_PREAMBLE_11B,
5462306a36Sopenharmony_ci	HAL_RX_PREAMBLE_11N,
5562306a36Sopenharmony_ci	HAL_RX_PREAMBLE_11AC,
5662306a36Sopenharmony_ci	HAL_RX_PREAMBLE_11AX,
5762306a36Sopenharmony_ci	HAL_RX_PREAMBLE_MAX,
5862306a36Sopenharmony_ci};
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_cienum hal_rx_reception_type {
6162306a36Sopenharmony_ci	HAL_RX_RECEPTION_TYPE_SU,
6262306a36Sopenharmony_ci	HAL_RX_RECEPTION_TYPE_MU_MIMO,
6362306a36Sopenharmony_ci	HAL_RX_RECEPTION_TYPE_MU_OFDMA,
6462306a36Sopenharmony_ci	HAL_RX_RECEPTION_TYPE_MU_OFDMA_MIMO,
6562306a36Sopenharmony_ci	HAL_RX_RECEPTION_TYPE_MAX,
6662306a36Sopenharmony_ci};
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define HAL_RX_FCS_LEN                          4
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_cienum hal_rx_mon_status {
7162306a36Sopenharmony_ci	HAL_RX_MON_STATUS_PPDU_NOT_DONE,
7262306a36Sopenharmony_ci	HAL_RX_MON_STATUS_PPDU_DONE,
7362306a36Sopenharmony_ci	HAL_RX_MON_STATUS_BUF_DONE,
7462306a36Sopenharmony_ci};
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_cistruct hal_rx_user_status {
7762306a36Sopenharmony_ci	u32 mcs:4,
7862306a36Sopenharmony_ci	nss:3,
7962306a36Sopenharmony_ci	ofdma_info_valid:1,
8062306a36Sopenharmony_ci	dl_ofdma_ru_start_index:7,
8162306a36Sopenharmony_ci	dl_ofdma_ru_width:7,
8262306a36Sopenharmony_ci	dl_ofdma_ru_size:8;
8362306a36Sopenharmony_ci	u32 ul_ofdma_user_v0_word0;
8462306a36Sopenharmony_ci	u32 ul_ofdma_user_v0_word1;
8562306a36Sopenharmony_ci	u32 ast_index;
8662306a36Sopenharmony_ci	u32 tid;
8762306a36Sopenharmony_ci	u16 tcp_msdu_count;
8862306a36Sopenharmony_ci	u16 udp_msdu_count;
8962306a36Sopenharmony_ci	u16 other_msdu_count;
9062306a36Sopenharmony_ci	u16 frame_control;
9162306a36Sopenharmony_ci	u8 frame_control_info_valid;
9262306a36Sopenharmony_ci	u8 data_sequence_control_info_valid;
9362306a36Sopenharmony_ci	u16 first_data_seq_ctrl;
9462306a36Sopenharmony_ci	u32 preamble_type;
9562306a36Sopenharmony_ci	u16 ht_flags;
9662306a36Sopenharmony_ci	u16 vht_flags;
9762306a36Sopenharmony_ci	u16 he_flags;
9862306a36Sopenharmony_ci	u8 rs_flags;
9962306a36Sopenharmony_ci	u32 mpdu_cnt_fcs_ok;
10062306a36Sopenharmony_ci	u32 mpdu_cnt_fcs_err;
10162306a36Sopenharmony_ci	u32 mpdu_fcs_ok_bitmap[8];
10262306a36Sopenharmony_ci	u32 mpdu_ok_byte_count;
10362306a36Sopenharmony_ci	u32 mpdu_err_byte_count;
10462306a36Sopenharmony_ci};
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#define HAL_TLV_STATUS_PPDU_NOT_DONE    HAL_RX_MON_STATUS_PPDU_NOT_DONE
10762306a36Sopenharmony_ci#define HAL_TLV_STATUS_PPDU_DONE        HAL_RX_MON_STATUS_PPDU_DONE
10862306a36Sopenharmony_ci#define HAL_TLV_STATUS_BUF_DONE         HAL_RX_MON_STATUS_BUF_DONE
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_cistruct hal_sw_mon_ring_entries {
11162306a36Sopenharmony_ci	dma_addr_t mon_dst_paddr;
11262306a36Sopenharmony_ci	dma_addr_t mon_status_paddr;
11362306a36Sopenharmony_ci	u32 mon_dst_sw_cookie;
11462306a36Sopenharmony_ci	u32 mon_status_sw_cookie;
11562306a36Sopenharmony_ci	void *dst_buf_addr_info;
11662306a36Sopenharmony_ci	void *status_buf_addr_info;
11762306a36Sopenharmony_ci	u16 ppdu_id;
11862306a36Sopenharmony_ci	u8 status_buf_count;
11962306a36Sopenharmony_ci	u8 msdu_cnt;
12062306a36Sopenharmony_ci	bool end_of_ppdu;
12162306a36Sopenharmony_ci	bool drop_ppdu;
12262306a36Sopenharmony_ci};
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_cistruct hal_rx_mon_ppdu_info {
12562306a36Sopenharmony_ci	u32 ppdu_id;
12662306a36Sopenharmony_ci	u32 ppdu_ts;
12762306a36Sopenharmony_ci	u32 num_mpdu_fcs_ok;
12862306a36Sopenharmony_ci	u32 num_mpdu_fcs_err;
12962306a36Sopenharmony_ci	u32 preamble_type;
13062306a36Sopenharmony_ci	u16 chan_num;
13162306a36Sopenharmony_ci	u16 tcp_msdu_count;
13262306a36Sopenharmony_ci	u16 tcp_ack_msdu_count;
13362306a36Sopenharmony_ci	u16 udp_msdu_count;
13462306a36Sopenharmony_ci	u16 other_msdu_count;
13562306a36Sopenharmony_ci	u16 peer_id;
13662306a36Sopenharmony_ci	u8 rate;
13762306a36Sopenharmony_ci	u8 mcs;
13862306a36Sopenharmony_ci	u8 nss;
13962306a36Sopenharmony_ci	u8 bw;
14062306a36Sopenharmony_ci	u8 vht_flag_values1;
14162306a36Sopenharmony_ci	u8 vht_flag_values2;
14262306a36Sopenharmony_ci	u8 vht_flag_values3[4];
14362306a36Sopenharmony_ci	u8 vht_flag_values4;
14462306a36Sopenharmony_ci	u8 vht_flag_values5;
14562306a36Sopenharmony_ci	u16 vht_flag_values6;
14662306a36Sopenharmony_ci	u8 is_stbc;
14762306a36Sopenharmony_ci	u8 gi;
14862306a36Sopenharmony_ci	u8 ldpc;
14962306a36Sopenharmony_ci	u8 beamformed;
15062306a36Sopenharmony_ci	u8 rssi_comb;
15162306a36Sopenharmony_ci	u8 rssi_chain_pri20[HAL_RX_MAX_NSS];
15262306a36Sopenharmony_ci	u8 tid;
15362306a36Sopenharmony_ci	u16 ht_flags;
15462306a36Sopenharmony_ci	u16 vht_flags;
15562306a36Sopenharmony_ci	u16 he_flags;
15662306a36Sopenharmony_ci	u16 he_mu_flags;
15762306a36Sopenharmony_ci	u8 dcm;
15862306a36Sopenharmony_ci	u8 ru_alloc;
15962306a36Sopenharmony_ci	u8 reception_type;
16062306a36Sopenharmony_ci	u64 tsft;
16162306a36Sopenharmony_ci	u64 rx_duration;
16262306a36Sopenharmony_ci	u16 frame_control;
16362306a36Sopenharmony_ci	u32 ast_index;
16462306a36Sopenharmony_ci	u8 rs_fcs_err;
16562306a36Sopenharmony_ci	u8 rs_flags;
16662306a36Sopenharmony_ci	u8 cck_flag;
16762306a36Sopenharmony_ci	u8 ofdm_flag;
16862306a36Sopenharmony_ci	u8 ulofdma_flag;
16962306a36Sopenharmony_ci	u8 frame_control_info_valid;
17062306a36Sopenharmony_ci	u16 he_per_user_1;
17162306a36Sopenharmony_ci	u16 he_per_user_2;
17262306a36Sopenharmony_ci	u8 he_per_user_position;
17362306a36Sopenharmony_ci	u8 he_per_user_known;
17462306a36Sopenharmony_ci	u16 he_flags1;
17562306a36Sopenharmony_ci	u16 he_flags2;
17662306a36Sopenharmony_ci	u8 he_RU[4];
17762306a36Sopenharmony_ci	u16 he_data1;
17862306a36Sopenharmony_ci	u16 he_data2;
17962306a36Sopenharmony_ci	u16 he_data3;
18062306a36Sopenharmony_ci	u16 he_data4;
18162306a36Sopenharmony_ci	u16 he_data5;
18262306a36Sopenharmony_ci	u16 he_data6;
18362306a36Sopenharmony_ci	u32 ppdu_len;
18462306a36Sopenharmony_ci	u32 prev_ppdu_id;
18562306a36Sopenharmony_ci	u32 device_id;
18662306a36Sopenharmony_ci	u16 first_data_seq_ctrl;
18762306a36Sopenharmony_ci	u8 monitor_direct_used;
18862306a36Sopenharmony_ci	u8 data_sequence_control_info_valid;
18962306a36Sopenharmony_ci	u8 ltf_size;
19062306a36Sopenharmony_ci	u8 rxpcu_filter_pass;
19162306a36Sopenharmony_ci	char rssi_chain[8][8];
19262306a36Sopenharmony_ci	struct hal_rx_user_status userstats;
19362306a36Sopenharmony_ci};
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ci#define HAL_RX_PPDU_START_INFO0_PPDU_ID		GENMASK(15, 0)
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_cistruct hal_rx_ppdu_start {
19862306a36Sopenharmony_ci	__le32 info0;
19962306a36Sopenharmony_ci	__le32 chan_num;
20062306a36Sopenharmony_ci	__le32 ppdu_start_ts;
20162306a36Sopenharmony_ci} __packed;
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO0_MPDU_CNT_FCS_ERR	GENMASK(25, 16)
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO1_MPDU_CNT_FCS_OK	GENMASK(8, 0)
20662306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO1_FC_VALID		BIT(9)
20762306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO1_QOS_CTRL_VALID		BIT(10)
20862306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO1_HT_CTRL_VALID		BIT(11)
20962306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO1_PKT_TYPE		GENMASK(23, 20)
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO2_AST_INDEX		GENMASK(15, 0)
21262306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO2_FRAME_CTRL		GENMASK(31, 16)
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO3_QOS_CTRL		GENMASK(31, 16)
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO4_UDP_MSDU_CNT		GENMASK(15, 0)
21762306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO4_TCP_MSDU_CNT		GENMASK(31, 16)
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO5_OTHER_MSDU_CNT		GENMASK(15, 0)
22062306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO5_TCP_ACK_MSDU_CNT	GENMASK(31, 16)
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO6_TID_BITMAP		GENMASK(15, 0)
22362306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_INFO6_TID_EOSP_BITMAP	GENMASK(31, 16)
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_RSVD2_6_MPDU_OK_BYTE_COUNT	GENMASK(24, 0)
22662306a36Sopenharmony_ci#define HAL_RX_PPDU_END_USER_STATS_RSVD2_8_MPDU_ERR_BYTE_COUNT	GENMASK(24, 0)
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_cistruct hal_rx_ppdu_end_user_stats {
22962306a36Sopenharmony_ci	__le32 rsvd0[2];
23062306a36Sopenharmony_ci	__le32 info0;
23162306a36Sopenharmony_ci	__le32 info1;
23262306a36Sopenharmony_ci	__le32 info2;
23362306a36Sopenharmony_ci	__le32 info3;
23462306a36Sopenharmony_ci	__le32 ht_ctrl;
23562306a36Sopenharmony_ci	__le32 rsvd1[2];
23662306a36Sopenharmony_ci	__le32 info4;
23762306a36Sopenharmony_ci	__le32 info5;
23862306a36Sopenharmony_ci	__le32 info6;
23962306a36Sopenharmony_ci	__le32 rsvd2[11];
24062306a36Sopenharmony_ci} __packed;
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_cistruct hal_rx_ppdu_end_user_stats_ext {
24362306a36Sopenharmony_ci	u32 info0;
24462306a36Sopenharmony_ci	u32 info1;
24562306a36Sopenharmony_ci	u32 info2;
24662306a36Sopenharmony_ci	u32 info3;
24762306a36Sopenharmony_ci	u32 info4;
24862306a36Sopenharmony_ci	u32 info5;
24962306a36Sopenharmony_ci	u32 info6;
25062306a36Sopenharmony_ci} __packed;
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci#define HAL_RX_HT_SIG_INFO_INFO0_MCS		GENMASK(6, 0)
25362306a36Sopenharmony_ci#define HAL_RX_HT_SIG_INFO_INFO0_BW		BIT(7)
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ci#define HAL_RX_HT_SIG_INFO_INFO1_STBC		GENMASK(5, 4)
25662306a36Sopenharmony_ci#define HAL_RX_HT_SIG_INFO_INFO1_FEC_CODING	BIT(6)
25762306a36Sopenharmony_ci#define HAL_RX_HT_SIG_INFO_INFO1_GI		BIT(7)
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_cistruct hal_rx_ht_sig_info {
26062306a36Sopenharmony_ci	__le32 info0;
26162306a36Sopenharmony_ci	__le32 info1;
26262306a36Sopenharmony_ci} __packed;
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci#define HAL_RX_LSIG_B_INFO_INFO0_RATE	GENMASK(3, 0)
26562306a36Sopenharmony_ci#define HAL_RX_LSIG_B_INFO_INFO0_LEN	GENMASK(15, 4)
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_cistruct hal_rx_lsig_b_info {
26862306a36Sopenharmony_ci	__le32 info0;
26962306a36Sopenharmony_ci} __packed;
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ci#define HAL_RX_LSIG_A_INFO_INFO0_RATE		GENMASK(3, 0)
27262306a36Sopenharmony_ci#define HAL_RX_LSIG_A_INFO_INFO0_LEN		GENMASK(16, 5)
27362306a36Sopenharmony_ci#define HAL_RX_LSIG_A_INFO_INFO0_PKT_TYPE	GENMASK(27, 24)
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_cistruct hal_rx_lsig_a_info {
27662306a36Sopenharmony_ci	__le32 info0;
27762306a36Sopenharmony_ci} __packed;
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ci#define HAL_RX_VHT_SIG_A_INFO_INFO0_BW		GENMASK(1, 0)
28062306a36Sopenharmony_ci#define HAL_RX_VHT_SIG_A_INFO_INFO0_STBC	BIT(3)
28162306a36Sopenharmony_ci#define HAL_RX_VHT_SIG_A_INFO_INFO0_GROUP_ID	GENMASK(9, 4)
28262306a36Sopenharmony_ci#define HAL_RX_VHT_SIG_A_INFO_INFO0_NSTS	GENMASK(21, 10)
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci#define HAL_RX_VHT_SIG_A_INFO_INFO1_GI_SETTING		GENMASK(1, 0)
28562306a36Sopenharmony_ci#define HAL_RX_VHT_SIG_A_INFO_INFO1_SU_MU_CODING	BIT(2)
28662306a36Sopenharmony_ci#define HAL_RX_VHT_SIG_A_INFO_INFO1_MCS			GENMASK(7, 4)
28762306a36Sopenharmony_ci#define HAL_RX_VHT_SIG_A_INFO_INFO1_BEAMFORMED		BIT(8)
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_cistruct hal_rx_vht_sig_a_info {
29062306a36Sopenharmony_ci	__le32 info0;
29162306a36Sopenharmony_ci	__le32 info1;
29262306a36Sopenharmony_ci} __packed;
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_cienum hal_rx_vht_sig_a_gi_setting {
29562306a36Sopenharmony_ci	HAL_RX_VHT_SIG_A_NORMAL_GI = 0,
29662306a36Sopenharmony_ci	HAL_RX_VHT_SIG_A_SHORT_GI = 1,
29762306a36Sopenharmony_ci	HAL_RX_VHT_SIG_A_SHORT_GI_AMBIGUITY = 3,
29862306a36Sopenharmony_ci};
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci#define HAL_RX_SU_MU_CODING_LDPC 0x01
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci#define HE_GI_0_8 0
30362306a36Sopenharmony_ci#define HE_GI_0_4 1
30462306a36Sopenharmony_ci#define HE_GI_1_6 2
30562306a36Sopenharmony_ci#define HE_GI_3_2 3
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ci#define HE_LTF_1_X 0
30862306a36Sopenharmony_ci#define HE_LTF_2_X 1
30962306a36Sopenharmony_ci#define HE_LTF_4_X 2
31062306a36Sopenharmony_ci#define HE_LTF_UNKNOWN 3
31162306a36Sopenharmony_ci
31262306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_MCS	GENMASK(6, 3)
31362306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_DCM		BIT(7)
31462306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_BW	GENMASK(20, 19)
31562306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_CP_LTF_SIZE	GENMASK(22, 21)
31662306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_NSTS		GENMASK(25, 23)
31762306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_BSS_COLOR		GENMASK(13, 8)
31862306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_SPATIAL_REUSE	GENMASK(18, 15)
31962306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_FORMAT_IND	BIT(0)
32062306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_BEAM_CHANGE	BIT(1)
32162306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_DL_UL_FLAG	BIT(2)
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_TXOP_DURATION	GENMASK(6, 0)
32462306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_CODING		BIT(7)
32562306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_LDPC_EXTRA	BIT(8)
32662306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_STBC		BIT(9)
32762306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_TXBF		BIT(10)
32862306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_PKT_EXT_FACTOR	GENMASK(12, 11)
32962306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_PKT_EXT_PE_DISAM	BIT(13)
33062306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_DOPPLER_IND	BIT(15)
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_cistruct hal_rx_he_sig_a_su_info {
33362306a36Sopenharmony_ci	__le32 info0;
33462306a36Sopenharmony_ci	__le32 info1;
33562306a36Sopenharmony_ci} __packed;
33662306a36Sopenharmony_ci
33762306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_UL_FLAG		BIT(1)
33862306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_MCS_OF_SIGB		GENMASK(3, 1)
33962306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_DCM_OF_SIGB		BIT(4)
34062306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_BSS_COLOR		GENMASK(10, 5)
34162306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_SPATIAL_REUSE	GENMASK(14, 11)
34262306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_TRANSMIT_BW		GENMASK(17, 15)
34362306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_NUM_SIGB_SYMB	GENMASK(21, 18)
34462306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_COMP_MODE_SIGB	BIT(22)
34562306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_CP_LTF_SIZE		GENMASK(24, 23)
34662306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_DOPPLER_INDICATION	BIT(25)
34762306a36Sopenharmony_ci
34862306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_TXOP_DURATION	GENMASK(6, 0)
34962306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_CODING		BIT(7)
35062306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_NUM_LTF_SYMB	GENMASK(10, 8)
35162306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_LDPC_EXTRA		BIT(11)
35262306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_STBC		BIT(12)
35362306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_TXBF		BIT(10)
35462306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_PKT_EXT_FACTOR	GENMASK(14, 13)
35562306a36Sopenharmony_ci#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_PKT_EXT_PE_DISAM	BIT(15)
35662306a36Sopenharmony_ci
35762306a36Sopenharmony_cistruct hal_rx_he_sig_a_mu_dl_info {
35862306a36Sopenharmony_ci	__le32 info0;
35962306a36Sopenharmony_ci	__le32 info1;
36062306a36Sopenharmony_ci} __packed;
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B1_MU_INFO_INFO0_RU_ALLOCATION	GENMASK(7, 0)
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_cistruct hal_rx_he_sig_b1_mu_info {
36562306a36Sopenharmony_ci	__le32 info0;
36662306a36Sopenharmony_ci} __packed;
36762306a36Sopenharmony_ci
36862306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_ID		GENMASK(10, 0)
36962306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_MCS		GENMASK(18, 15)
37062306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_CODING	BIT(20)
37162306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_NSTS		GENMASK(31, 29)
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_cistruct hal_rx_he_sig_b2_mu_info {
37462306a36Sopenharmony_ci	__le32 info0;
37562306a36Sopenharmony_ci} __packed;
37662306a36Sopenharmony_ci
37762306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_ID	GENMASK(10, 0)
37862306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_NSTS	GENMASK(13, 11)
37962306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_TXBF	BIT(19)
38062306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_MCS	GENMASK(18, 15)
38162306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_DCM	BIT(19)
38262306a36Sopenharmony_ci#define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_CODING	BIT(20)
38362306a36Sopenharmony_ci
38462306a36Sopenharmony_cistruct hal_rx_he_sig_b2_ofdma_info {
38562306a36Sopenharmony_ci	__le32 info0;
38662306a36Sopenharmony_ci} __packed;
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_ci#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RSSI_COMB	GENMASK(15, 8)
38962306a36Sopenharmony_ci
39062306a36Sopenharmony_ci#define HAL_RX_PHYRX_RSSI_PREAMBLE_PRI20	GENMASK(7, 0)
39162306a36Sopenharmony_ci
39262306a36Sopenharmony_cistruct hal_rx_phyrx_chain_rssi {
39362306a36Sopenharmony_ci	__le32 rssi_2040;
39462306a36Sopenharmony_ci	__le32 rssi_80;
39562306a36Sopenharmony_ci} __packed;
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_cistruct hal_rx_phyrx_rssi_legacy_info {
39862306a36Sopenharmony_ci	__le32 rsvd[3];
39962306a36Sopenharmony_ci	struct hal_rx_phyrx_chain_rssi pre_rssi[HAL_RX_MAX_NSS];
40062306a36Sopenharmony_ci	struct hal_rx_phyrx_chain_rssi preamble[HAL_RX_MAX_NSS];
40162306a36Sopenharmony_ci	__le32 info0;
40262306a36Sopenharmony_ci} __packed;
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ci#define HAL_RX_MPDU_INFO_INFO0_PEERID	GENMASK(31, 16)
40562306a36Sopenharmony_ci#define HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855	GENMASK(15, 0)
40662306a36Sopenharmony_ci#define HAL_RX_MPDU_INFO_INFO1_MPDU_LEN		GENMASK(13, 0)
40762306a36Sopenharmony_ci
40862306a36Sopenharmony_cistruct hal_rx_mpdu_info_ipq8074 {
40962306a36Sopenharmony_ci	__le32 rsvd0;
41062306a36Sopenharmony_ci	__le32 info0;
41162306a36Sopenharmony_ci	__le32 rsvd1[11];
41262306a36Sopenharmony_ci	__le32 info1;
41362306a36Sopenharmony_ci	__le32 rsvd2[9];
41462306a36Sopenharmony_ci} __packed;
41562306a36Sopenharmony_ci
41662306a36Sopenharmony_cistruct hal_rx_mpdu_info_qcn9074 {
41762306a36Sopenharmony_ci	__le32 rsvd0[10];
41862306a36Sopenharmony_ci	__le32 info0;
41962306a36Sopenharmony_ci	__le32 rsvd1[2];
42062306a36Sopenharmony_ci	__le32 info1;
42162306a36Sopenharmony_ci	__le32 rsvd2[9];
42262306a36Sopenharmony_ci} __packed;
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_cistruct hal_rx_mpdu_info_wcn6855 {
42562306a36Sopenharmony_ci	__le32 rsvd0[8];
42662306a36Sopenharmony_ci	__le32 info0;
42762306a36Sopenharmony_ci	__le32 rsvd1[14];
42862306a36Sopenharmony_ci} __packed;
42962306a36Sopenharmony_ci
43062306a36Sopenharmony_cistruct hal_rx_mpdu_info {
43162306a36Sopenharmony_ci	union {
43262306a36Sopenharmony_ci		struct hal_rx_mpdu_info_ipq8074 ipq8074;
43362306a36Sopenharmony_ci		struct hal_rx_mpdu_info_qcn9074 qcn9074;
43462306a36Sopenharmony_ci		struct hal_rx_mpdu_info_wcn6855 wcn6855;
43562306a36Sopenharmony_ci	} u;
43662306a36Sopenharmony_ci} __packed;
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ci#define HAL_RX_PPDU_END_DURATION	GENMASK(23, 0)
43962306a36Sopenharmony_cistruct hal_rx_ppdu_end_duration {
44062306a36Sopenharmony_ci	__le32 rsvd0[9];
44162306a36Sopenharmony_ci	__le32 info0;
44262306a36Sopenharmony_ci	__le32 rsvd1[4];
44362306a36Sopenharmony_ci} __packed;
44462306a36Sopenharmony_ci
44562306a36Sopenharmony_cistruct hal_rx_rxpcu_classification_overview {
44662306a36Sopenharmony_ci	u32 rsvd0;
44762306a36Sopenharmony_ci} __packed;
44862306a36Sopenharmony_ci
44962306a36Sopenharmony_cistruct hal_rx_msdu_desc_info {
45062306a36Sopenharmony_ci	u32 msdu_flags;
45162306a36Sopenharmony_ci	u16 msdu_len; /* 14 bits for length */
45262306a36Sopenharmony_ci};
45362306a36Sopenharmony_ci
45462306a36Sopenharmony_ci#define HAL_RX_NUM_MSDU_DESC 6
45562306a36Sopenharmony_cistruct hal_rx_msdu_list {
45662306a36Sopenharmony_ci	struct hal_rx_msdu_desc_info msdu_info[HAL_RX_NUM_MSDU_DESC];
45762306a36Sopenharmony_ci	u32 sw_cookie[HAL_RX_NUM_MSDU_DESC];
45862306a36Sopenharmony_ci	u8 rbm[HAL_RX_NUM_MSDU_DESC];
45962306a36Sopenharmony_ci};
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_civoid ath11k_hal_reo_status_queue_stats(struct ath11k_base *ab, u32 *reo_desc,
46262306a36Sopenharmony_ci				       struct hal_reo_status *status);
46362306a36Sopenharmony_civoid ath11k_hal_reo_flush_queue_status(struct ath11k_base *ab, u32 *reo_desc,
46462306a36Sopenharmony_ci				       struct hal_reo_status *status);
46562306a36Sopenharmony_civoid ath11k_hal_reo_flush_cache_status(struct ath11k_base *ab, u32 *reo_desc,
46662306a36Sopenharmony_ci				       struct hal_reo_status *status);
46762306a36Sopenharmony_civoid ath11k_hal_reo_flush_cache_status(struct ath11k_base *ab, u32 *reo_desc,
46862306a36Sopenharmony_ci				       struct hal_reo_status *status);
46962306a36Sopenharmony_civoid ath11k_hal_reo_unblk_cache_status(struct ath11k_base *ab, u32 *reo_desc,
47062306a36Sopenharmony_ci				       struct hal_reo_status *status);
47162306a36Sopenharmony_civoid ath11k_hal_reo_flush_timeout_list_status(struct ath11k_base *ab,
47262306a36Sopenharmony_ci					      u32 *reo_desc,
47362306a36Sopenharmony_ci					      struct hal_reo_status *status);
47462306a36Sopenharmony_civoid ath11k_hal_reo_desc_thresh_reached_status(struct ath11k_base *ab,
47562306a36Sopenharmony_ci					       u32 *reo_desc,
47662306a36Sopenharmony_ci					       struct hal_reo_status *status);
47762306a36Sopenharmony_civoid ath11k_hal_reo_update_rx_reo_queue_status(struct ath11k_base *ab,
47862306a36Sopenharmony_ci					       u32 *reo_desc,
47962306a36Sopenharmony_ci					       struct hal_reo_status *status);
48062306a36Sopenharmony_ciint ath11k_hal_reo_process_status(u8 *reo_desc, u8 *status);
48162306a36Sopenharmony_civoid ath11k_hal_rx_msdu_link_info_get(void *link_desc, u32 *num_msdus,
48262306a36Sopenharmony_ci				      u32 *msdu_cookies,
48362306a36Sopenharmony_ci				      enum hal_rx_buf_return_buf_manager *rbm);
48462306a36Sopenharmony_civoid ath11k_hal_rx_msdu_link_desc_set(struct ath11k_base *ab, void *desc,
48562306a36Sopenharmony_ci				      void *link_desc,
48662306a36Sopenharmony_ci				      enum hal_wbm_rel_bm_act action);
48762306a36Sopenharmony_civoid ath11k_hal_rx_buf_addr_info_set(void *desc, dma_addr_t paddr,
48862306a36Sopenharmony_ci				     u32 cookie, u8 manager);
48962306a36Sopenharmony_civoid ath11k_hal_rx_buf_addr_info_get(void *desc, dma_addr_t *paddr,
49062306a36Sopenharmony_ci				     u32 *cookie, u8 *rbm);
49162306a36Sopenharmony_ciint ath11k_hal_desc_reo_parse_err(struct ath11k_base *ab, u32 *rx_desc,
49262306a36Sopenharmony_ci				  dma_addr_t *paddr, u32 *desc_bank);
49362306a36Sopenharmony_ciint ath11k_hal_wbm_desc_parse_err(struct ath11k_base *ab, void *desc,
49462306a36Sopenharmony_ci				  struct hal_rx_wbm_rel_info *rel_info);
49562306a36Sopenharmony_civoid ath11k_hal_rx_reo_ent_paddr_get(struct ath11k_base *ab, void *desc,
49662306a36Sopenharmony_ci				     dma_addr_t *paddr, u32 *desc_bank);
49762306a36Sopenharmony_civoid ath11k_hal_rx_reo_ent_buf_paddr_get(void *rx_desc,
49862306a36Sopenharmony_ci					 dma_addr_t *paddr, u32 *sw_cookie,
49962306a36Sopenharmony_ci					 void **pp_buf_addr_info, u8 *rbm,
50062306a36Sopenharmony_ci					 u32 *msdu_cnt);
50162306a36Sopenharmony_civoid
50262306a36Sopenharmony_ciath11k_hal_rx_sw_mon_ring_buf_paddr_get(void *rx_desc,
50362306a36Sopenharmony_ci					struct hal_sw_mon_ring_entries *sw_mon_ent);
50462306a36Sopenharmony_cienum hal_rx_mon_status
50562306a36Sopenharmony_ciath11k_hal_rx_parse_mon_status(struct ath11k_base *ab,
50662306a36Sopenharmony_ci			       struct hal_rx_mon_ppdu_info *ppdu_info,
50762306a36Sopenharmony_ci			       struct sk_buff *skb);
50862306a36Sopenharmony_ci
50962306a36Sopenharmony_ci#define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_0 0xDDBEEF
51062306a36Sopenharmony_ci#define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_1 0xADBEEF
51162306a36Sopenharmony_ci#define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_2 0xBDBEEF
51262306a36Sopenharmony_ci#define REO_QUEUE_DESC_MAGIC_DEBUG_PATTERN_3 0xCDBEEF
51362306a36Sopenharmony_ci#endif
514