xref: /linux/drivers/net/wireless/ath/ath11k/hal_tx.h (revision 02680c23d7b3febe45ea3d4f9818c2b2dc89020a)
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4  */
5 
6 #ifndef ATH11K_HAL_TX_H
7 #define ATH11K_HAL_TX_H
8 
9 #include "hal_desc.h"
10 #include "core.h"
11 
12 #define HAL_TX_ADDRX_EN			1
13 #define HAL_TX_ADDRY_EN			2
14 
15 #define HAL_TX_ADDR_SEARCH_DEFAULT	0
16 #define HAL_TX_ADDR_SEARCH_INDEX	1
17 
18 struct hal_tx_info {
19 	u16 meta_data_flags; /* %HAL_TCL_DATA_CMD_INFO0_META_ */
20 	u8 ring_id;
21 	u32 desc_id;
22 	enum hal_tcl_desc_type type;
23 	enum hal_tcl_encap_type encap_type;
24 	dma_addr_t paddr;
25 	u32 data_len;
26 	u32 pkt_offset;
27 	enum hal_encrypt_type encrypt_type;
28 	u32 flags0; /* %HAL_TCL_DATA_CMD_INFO1_ */
29 	u32 flags1; /* %HAL_TCL_DATA_CMD_INFO2_ */
30 	u16 addr_search_flags; /* %HAL_TCL_DATA_CMD_INFO0_ADDR(X/Y)_ */
31 	u16 bss_ast_hash;
32 	u16 bss_ast_idx;
33 	u8 tid;
34 	u8 search_type; /* %HAL_TX_ADDR_SEARCH_ */
35 	u8 lmac_id;
36 	u8 dscp_tid_tbl_idx;
37 	bool enable_mesh;
38 };
39 
40 /* TODO: Check if the actual desc macros can be used instead */
41 #define HAL_TX_STATUS_FLAGS_FIRST_MSDU		BIT(0)
42 #define HAL_TX_STATUS_FLAGS_LAST_MSDU		BIT(1)
43 #define HAL_TX_STATUS_FLAGS_MSDU_IN_AMSDU	BIT(2)
44 #define HAL_TX_STATUS_FLAGS_RATE_STATS_VALID	BIT(3)
45 #define HAL_TX_STATUS_FLAGS_RATE_LDPC		BIT(4)
46 #define HAL_TX_STATUS_FLAGS_RATE_STBC		BIT(5)
47 #define HAL_TX_STATUS_FLAGS_OFDMA		BIT(6)
48 
49 #define HAL_TX_STATUS_DESC_LEN		sizeof(struct hal_wbm_release_ring)
50 
51 /* Tx status parsed from srng desc */
52 struct hal_tx_status {
53 	enum hal_wbm_rel_src_module buf_rel_source;
54 	enum hal_wbm_tqm_rel_reason status;
55 	u8 ack_rssi;
56 	u32 flags; /* %HAL_TX_STATUS_FLAGS_ */
57 	u32 ppdu_id;
58 	u8 try_cnt;
59 	u8 tid;
60 	u16 peer_id;
61 	u32 rate_stats;
62 };
63 
64 void ath11k_hal_tx_cmd_desc_setup(struct ath11k_base *ab, void *cmd,
65 				  struct hal_tx_info *ti);
66 void ath11k_hal_tx_set_dscp_tid_map(struct ath11k_base *ab, int id);
67 int ath11k_hal_reo_cmd_send(struct ath11k_base *ab, struct hal_srng *srng,
68 			    enum hal_reo_cmd_type type,
69 			    struct ath11k_hal_reo_cmd *cmd);
70 void ath11k_hal_tx_init_data_ring(struct ath11k_base *ab,
71 				  struct hal_srng *srng);
72 #endif
73