xref: /wlan-driver/fw-api/fw/ol_fw_tx_dbg.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file was originally distributed by Qualcomm Atheros, Inc.
24  * under proprietary terms before Copyright ownership was assigned
25  * to the Linux Foundation.
26  */
27 
28 /**
29  * @file ol_fw_tx_dbg.h
30  *
31  * @details data structs used for uploading summary info about the FW's tx
32  */
33 
34 #ifndef _OL_FW_TX_DBG__H_
35 #define _OL_FW_TX_DBG__H_
36 
37 /*
38  * Undef ATH_SUPPORT_FW_TX_DBG to remove the FW tx debug feature.
39  * Removing the FW tx debug feature saves a modest amount of program memory.
40  * The data memory allocation for the FW tx debug feature is controlled
41  * by the host --> target resource configuration parameters; even if
42  * ATH_SUPPORT_FW_TX_DBG is defined, no data memory will be allocated for
43  * the FW tx debug log unless the host --> target resource configuration
44  * specifies it.
45  */
46 #define ATH_SUPPORT_FW_TX_DBG 1 /* enabled */
47 //#undef ATH_SUPPORT_FW_TX_DBG /* disabled */
48 
49 
50 #if defined(ATH_TARGET)
51 #include <osapi.h>      /* A_UINT32 */
52 #else
53 #include <a_types.h>    /* A_UINT32 */
54 #include <a_osapi.h>    /* PREPACK, POSTPACK */
55 #endif
56 
57 enum ol_fw_tx_dbg_log_mode {
58    ol_fw_tx_dbg_log_mode_wraparound, /* overwrite old data with new */
59    ol_fw_tx_dbg_log_mode_single,     /* fill log once, then stop */
60 };
61 
62 /*
63  * tx PPDU stats upload message header
64  */
65 struct ol_fw_tx_dbg_ppdu_msg_hdr {
66     /* word 0 */
67     #define OL_FW_TX_DBG_PPDU_HDR_NUM_MPDU_BYTES_WORD  0
68     #define OL_FW_TX_DBG_PPDU_HDR_NUM_MPDU_BYTES_S     0
69     #define OL_FW_TX_DBG_PPDU_HDR_NUM_MPDU_BYTES_M     0x000000ff
70     A_UINT8  mpdu_bytes_array_len; /* length of array of per-MPDU byte counts */
71 
72     #define OL_FW_TX_DBG_PPDU_HDR_NUM_MSDU_BYTES_WORD  0
73     #define OL_FW_TX_DBG_PPDU_HDR_NUM_MSDU_BYTES_S     8
74     #define OL_FW_TX_DBG_PPDU_HDR_NUM_MSDU_BYTES_M     0x0000ff00
75     A_UINT8  msdu_bytes_array_len; /* length of array of per-MSDU byte counts */
76 
77     #define OL_FW_TX_DBG_PPDU_HDR_NUM_MPDU_MSDUS_WORD  0
78     #define OL_FW_TX_DBG_PPDU_HDR_NUM_MPDU_MSDUS_S     16
79     #define OL_FW_TX_DBG_PPDU_HDR_NUM_MPDU_MSDUS_M     0x00ff0000
80     A_UINT8  mpdu_msdus_array_len; /* length of array of per-MPDU MSDU counts */
81 
82     A_UINT8 reserved;
83 
84     /* word 1 */
85     #define OL_FW_TX_DBG_PPDU_HDR_MICROSEC_PER_TICK_WORD  1
86     #define OL_FW_TX_DBG_PPDU_HDR_MICROSEC_PER_TICK_S     0
87     #define OL_FW_TX_DBG_PPDU_HDR_MICROSEC_PER_TICK_M     0xffffffff
88     A_UINT32 microsec_per_tick; /* conversion for timestamp entries */
89 };
90 
91 /*
92  * tx PPDU log element / stats upload message element
93  */
94 struct ol_fw_tx_dbg_ppdu_base {
95     /* word 0 - filled in during tx enqueue */
96     #define OL_FW_TX_DBG_PPDU_START_SEQ_NUM_WORD  0
97     #define OL_FW_TX_DBG_PPDU_START_SEQ_NUM_S     0
98     #define OL_FW_TX_DBG_PPDU_START_SEQ_NUM_M     0x0000ffff
99     A_UINT16 start_seq_num;
100     #define OL_FW_TX_DBG_PPDU_START_PN_LSBS_WORD  0
101     #define OL_FW_TX_DBG_PPDU_START_PN_LSBS_S     16
102     #define OL_FW_TX_DBG_PPDU_START_PN_LSBS_M     0xffff0000
103     A_UINT16 start_pn_lsbs;
104 
105     /* word 1 - filled in during tx enqueue */
106     #define OL_FW_TX_DBG_PPDU_NUM_BYTES_WORD      1
107     #define OL_FW_TX_DBG_PPDU_NUM_BYTES_S         0
108     #define OL_FW_TX_DBG_PPDU_NUM_BYTES_M         0xffffffff
109     A_UINT32 num_bytes;
110 
111     /* word 2 - filled in during tx enqueue */
112     #define OL_FW_TX_DBG_PPDU_NUM_MSDUS_WORD      2
113     #define OL_FW_TX_DBG_PPDU_NUM_MSDUS_S         0
114     #define OL_FW_TX_DBG_PPDU_NUM_MSDUS_M         0x000000ff
115     A_UINT8  num_msdus;
116     #define OL_FW_TX_DBG_PPDU_NUM_MPDUS_WORD      2
117     #define OL_FW_TX_DBG_PPDU_NUM_MPDUS_S         8
118     #define OL_FW_TX_DBG_PPDU_NUM_MPDUS_M         0x0000ff00
119     A_UINT8  num_mpdus;
120     A_UINT16
121     #define OL_FW_TX_DBG_PPDU_EXT_TID_WORD        2
122     #define OL_FW_TX_DBG_PPDU_EXT_TID_S           16
123     #define OL_FW_TX_DBG_PPDU_EXT_TID_M           0x001f0000
124         ext_tid :  5,
125     #define OL_FW_TX_DBG_PPDU_PEER_ID_WORD        2
126     #define OL_FW_TX_DBG_PPDU_PEER_ID_S           21
127     #define OL_FW_TX_DBG_PPDU_PEER_ID_M           0xffe00000
128         peer_id : 11;
129 
130     /* word 3 - filled in during tx enqueue */
131     #define OL_FW_TX_DBG_PPDU_TIME_ENQUEUE_WORD   3
132     #define OL_FW_TX_DBG_PPDU_TIME_ENQUEUE_S      0
133     #define OL_FW_TX_DBG_PPDU_TIME_ENQUEUE_M      0xffffffff
134     A_UINT32 timestamp_enqueue;
135 
136     /* word 4 - filled in during tx completion */
137     #define OL_FW_TX_DBG_PPDU_TIME_COMPL_WORD     4
138     #define OL_FW_TX_DBG_PPDU_TIME_COMPL_S        0
139     #define OL_FW_TX_DBG_PPDU_TIME_COMPL_M        0xffffffff
140     A_UINT32 timestamp_completion;
141 
142     /* word 5 - filled in during tx completion */
143     #define OL_FW_TX_DBG_PPDU_BLOCK_ACK_LSBS_WORD 5
144     #define OL_FW_TX_DBG_PPDU_BLOCK_ACK_LSBS_S    0
145     #define OL_FW_TX_DBG_PPDU_BLOCK_ACK_LSBS_M    0xffffffff
146     A_UINT32 block_ack_bitmap_lsbs;
147 
148     /* word 6 - filled in during tx completion */
149     #define OL_FW_TX_DBG_PPDU_BLOCK_ACK_MSBS_WORD 6
150     #define OL_FW_TX_DBG_PPDU_BLOCK_ACK_MSBS_S    0
151     #define OL_FW_TX_DBG_PPDU_BLOCK_ACK_MSBS_M    0xffffffff
152     A_UINT32 block_ack_bitmap_msbs;
153 
154     /* word 7 - filled in during tx completion (enqueue would work too) */
155     #define OL_FW_TX_DBG_PPDU_ENQUEUED_LSBS_WORD  7
156     #define OL_FW_TX_DBG_PPDU_ENQUEUED_LSBS_S     0
157     #define OL_FW_TX_DBG_PPDU_ENQUEUED_LSBS_M     0xffffffff
158     A_UINT32 enqueued_bitmap_lsbs;
159 
160     /* word 8 - filled in during tx completion (enqueue would work too) */
161     #define OL_FW_TX_DBG_PPDU_ENQUEUED_MSBS_WORD  8
162     #define OL_FW_TX_DBG_PPDU_ENQUEUED_MSBS_S     0
163     #define OL_FW_TX_DBG_PPDU_ENQUEUED_MSBS_M     0xffffffff
164     A_UINT32 enqueued_bitmap_msbs;
165 
166     /* word 9 - filled in during tx completion */
167     #define OL_FW_TX_DBG_PPDU_RATE_CODE_WORD      9
168     #define OL_FW_TX_DBG_PPDU_RATE_CODE_S         0
169     #define OL_FW_TX_DBG_PPDU_RATE_CODE_M         0x000000ff
170     A_UINT8 rate_code;
171     #define OL_FW_TX_DBG_PPDU_RATE_FLAGS_WORD     9
172     #define OL_FW_TX_DBG_PPDU_RATE_FLAGS_S        8
173     #define OL_FW_TX_DBG_PPDU_RATE_FLAGS_M        0x0000ff00
174     A_UINT8 rate_flags; /* includes dynamic bandwidth info */
175     #define OL_FW_TX_DBG_PPDU_TRIES_WORD          9
176     #define OL_FW_TX_DBG_PPDU_TRIES_S             16
177     #define OL_FW_TX_DBG_PPDU_TRIES_M             0x00ff0000
178     A_UINT8 tries;
179     #define OL_FW_TX_DBG_PPDU_COMPLETE_WORD       9
180     #define OL_FW_TX_DBG_PPDU_COMPLETE_S          24
181     #define OL_FW_TX_DBG_PPDU_COMPLETE_M          0xff000000
182     A_UINT8 complete;
183 };
184 
185 
186 #endif /* _OL_FW_TX_DBG__H_ */
187