blob: 0bf4c13d4f319d00762bc5cd97b15df2cc5b3225 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Anurag Chouhan6d760662016-02-20 16:05:43 +05302 * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
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 htt_fw_stats.c
30 * @brief Provide functions to process FW status retrieved from FW.
31 */
32
33#include <htc_api.h> /* HTC_PACKET */
34#include <htt.h> /* HTT_T2H_MSG_TYPE, etc. */
Nirav Shahcbc6d722016-03-01 16:24:53 +053035#include <qdf_nbuf.h> /* qdf_nbuf_t */
Anurag Chouhan600c3a02016-03-01 10:33:54 +053036#include <qdf_mem.h> /* qdf_mem_set */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080037#include <ol_fw_tx_dbg.h> /* ol_fw_tx_dbg_ppdu_base */
38
39#include <ol_htt_rx_api.h>
40#include <ol_txrx_htt_api.h> /* htt_tx_status */
41
42#include <htt_internal.h>
43
44#include <wlan_defs.h>
45
46#define ROUND_UP_TO_4(val) (((val) + 3) & ~0x3)
47
48
49static char *bw_str_arr[] = {"20MHz", "40MHz", "80MHz", "160MHz"};
50
51/*
52 * Defined the macro tx_rate_stats_print_cmn()
53 * so that this could be used in both
54 * htt_t2h_stats_tx_rate_stats_print() &
55 * htt_t2h_stats_tx_rate_stats_print_v2().
56 * Each of these functions take a different structure as argument,
57 * but with common fields in the structures--so using a macro
58 * to bypass the strong type-checking of a function seems a simple
59 * trick to use to avoid the code duplication.
60 */
61#define tx_rate_stats_print_cmn(_tx_rate_info, _concise) \
62{ \
63 int i; \
64 \
Anurag Chouhan6d760662016-02-20 16:05:43 +053065 qdf_print("TX Rate Info:\n"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080066 \
67 /* MCS */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +053068 qdf_print("MCS counts (0..9): "); \
69 qdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080070 _tx_rate_info->mcs[0], \
71 _tx_rate_info->mcs[1], \
72 _tx_rate_info->mcs[2], \
73 _tx_rate_info->mcs[3], \
74 _tx_rate_info->mcs[4], \
75 _tx_rate_info->mcs[5], \
76 _tx_rate_info->mcs[6], \
77 _tx_rate_info->mcs[7], \
78 _tx_rate_info->mcs[8], \
79 _tx_rate_info->mcs[9]); \
80 \
81 /* SGI */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +053082 qdf_print("SGI counts (0..9): "); \
83 qdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080084 _tx_rate_info->sgi[0], \
85 _tx_rate_info->sgi[1], \
86 _tx_rate_info->sgi[2], \
87 _tx_rate_info->sgi[3], \
88 _tx_rate_info->sgi[4], \
89 _tx_rate_info->sgi[5], \
90 _tx_rate_info->sgi[6], \
91 _tx_rate_info->sgi[7], \
92 _tx_rate_info->sgi[8], \
93 _tx_rate_info->sgi[9]); \
94 \
95 /* NSS */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +053096 qdf_print("NSS counts: "); \
97 qdf_print("1x1 %d, 2x2 %d, 3x3 %d\n", \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080098 _tx_rate_info->nss[0], \
99 _tx_rate_info->nss[1], _tx_rate_info->nss[2]);\
100 \
101 /* BW */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530102 qdf_print("BW counts: "); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800103 \
104 for (i = 0; \
105 i < sizeof(_tx_rate_info->bw) / sizeof(_tx_rate_info->bw[0]);\
106 i++) { \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530107 qdf_print("%s %d ", bw_str_arr[i], _tx_rate_info->bw[i]);\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800108 } \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530109 qdf_print("\n"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800110 \
111 /* Preamble */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530112 qdf_print("Preamble (O C H V) counts: "); \
113 qdf_print("%d, %d, %d, %d\n", \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800114 _tx_rate_info->pream[0], \
115 _tx_rate_info->pream[1], \
116 _tx_rate_info->pream[2], \
117 _tx_rate_info->pream[3]); \
118 \
119 /* STBC rate counts */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530120 qdf_print("STBC rate counts (0..9): "); \
121 qdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122 _tx_rate_info->stbc[0], \
123 _tx_rate_info->stbc[1], \
124 _tx_rate_info->stbc[2], \
125 _tx_rate_info->stbc[3], \
126 _tx_rate_info->stbc[4], \
127 _tx_rate_info->stbc[5], \
128 _tx_rate_info->stbc[6], \
129 _tx_rate_info->stbc[7], \
130 _tx_rate_info->stbc[8], \
131 _tx_rate_info->stbc[9]); \
132 \
133 /* LDPC and TxBF counts */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530134 qdf_print("LDPC Counts: "); \
135 qdf_print("%d\n", _tx_rate_info->ldpc); \
136 qdf_print("RTS Counts: "); \
137 qdf_print("%d\n", _tx_rate_info->rts_cnt); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800138 /* RSSI Values for last ack frames */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530139 qdf_print("Ack RSSI: %d\n", _tx_rate_info->ack_rssi);\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800140}
141
142static void htt_t2h_stats_tx_rate_stats_print(wlan_dbg_tx_rate_info_t *
143 tx_rate_info, int concise)
144{
145 tx_rate_stats_print_cmn(tx_rate_info, concise);
146}
147
148static void htt_t2h_stats_tx_rate_stats_print_v2(wlan_dbg_tx_rate_info_v2_t *
149 tx_rate_info, int concise)
150{
151 tx_rate_stats_print_cmn(tx_rate_info, concise);
152}
153
154/*
155 * Defined the macro rx_rate_stats_print_cmn()
156 * so that this could be used in both
157 * htt_t2h_stats_rx_rate_stats_print() &
158 * htt_t2h_stats_rx_rate_stats_print_v2().
159 * Each of these functions take a different structure as argument,
160 * but with common fields in the structures -- so using a macro
161 * to bypass the strong type-checking of a function seems a simple
162 * trick to use to avoid the code duplication.
163 */
164#define rx_rate_stats_print_cmn(_rx_phy_info, _concise) \
165{ \
166 int i; \
167 \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530168 qdf_print("RX Rate Info:\n"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800169 \
170 /* MCS */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530171 qdf_print("MCS counts (0..9): "); \
172 qdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800173 _rx_phy_info->mcs[0], \
174 _rx_phy_info->mcs[1], \
175 _rx_phy_info->mcs[2], \
176 _rx_phy_info->mcs[3], \
177 _rx_phy_info->mcs[4], \
178 _rx_phy_info->mcs[5], \
179 _rx_phy_info->mcs[6], \
180 _rx_phy_info->mcs[7], \
181 _rx_phy_info->mcs[8], \
182 _rx_phy_info->mcs[9]); \
183 \
184 /* SGI */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530185 qdf_print("SGI counts (0..9): "); \
186 qdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800187 _rx_phy_info->sgi[0], \
188 _rx_phy_info->sgi[1], \
189 _rx_phy_info->sgi[2], \
190 _rx_phy_info->sgi[3], \
191 _rx_phy_info->sgi[4], \
192 _rx_phy_info->sgi[5], \
193 _rx_phy_info->sgi[6], \
194 _rx_phy_info->sgi[7], \
195 _rx_phy_info->sgi[8], \
196 _rx_phy_info->sgi[9]); \
197 \
198 /* NSS */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530199 qdf_print("NSS counts: "); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800200 /* nss[0] just holds the count of non-stbc frames that were sent at 1x1 \
201 * rates and nsts holds the count of frames sent with stbc. \
202 * It was decided to not include PPDUs sent w/ STBC in nss[0]\
203 * since it would be easier to change the value that needs to be\
204 * printed (from "stbc+non-stbc count to only non-stbc count")\
205 * if needed in the future. Hence the addition in the host code\
206 * at this line. */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530207 qdf_print("1x1 %d, 2x2 %d, 3x3 %d, 4x4 %d\n", \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800208 _rx_phy_info->nss[0] + _rx_phy_info->nsts, \
209 _rx_phy_info->nss[1], \
210 _rx_phy_info->nss[2], \
211 _rx_phy_info->nss[3]); \
212 \
213 /* NSTS */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530214 qdf_print("NSTS count: "); \
215 qdf_print("%d\n", _rx_phy_info->nsts); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800216 \
217 /* BW */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530218 qdf_print("BW counts: "); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800219 for (i = 0; \
220 i < sizeof(_rx_phy_info->bw) / sizeof(_rx_phy_info->bw[0]); \
221 i++) { \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530222 qdf_print("%s %d ", bw_str_arr[i], _rx_phy_info->bw[i]);\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800223 } \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530224 qdf_print("\n"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800225 \
226 /* Preamble */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530227 qdf_print("Preamble counts: "); \
228 qdf_print("%d, %d, %d, %d, %d, %d\n", \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800229 _rx_phy_info->pream[0], \
230 _rx_phy_info->pream[1], \
231 _rx_phy_info->pream[2], \
232 _rx_phy_info->pream[3], \
233 _rx_phy_info->pream[4], \
234 _rx_phy_info->pream[5]); \
235 \
236 /* STBC rate counts */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530237 qdf_print("STBC rate counts (0..9): "); \
238 qdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800239 _rx_phy_info->stbc[0], \
240 _rx_phy_info->stbc[1], \
241 _rx_phy_info->stbc[2], \
242 _rx_phy_info->stbc[3], \
243 _rx_phy_info->stbc[4], \
244 _rx_phy_info->stbc[5], \
245 _rx_phy_info->stbc[6], \
246 _rx_phy_info->stbc[7], \
247 _rx_phy_info->stbc[8], \
248 _rx_phy_info->stbc[9]); \
249 \
250 /* LDPC and TxBF counts */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530251 qdf_print("LDPC TXBF Counts: "); \
252 qdf_print("%d, %d\n", _rx_phy_info->ldpc, _rx_phy_info->txbf);\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800253 /* RSSI Values for last received frames */ \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530254 qdf_print("RSSI (data, mgmt): %d, %d\n", _rx_phy_info->data_rssi,\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800255 _rx_phy_info->mgmt_rssi); \
256 \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530257 qdf_print("RSSI Chain 0 (0x%02x 0x%02x 0x%02x 0x%02x)\n",\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800258 ((_rx_phy_info->rssi_chain0 >> 24) & 0xff), \
259 ((_rx_phy_info->rssi_chain0 >> 16) & 0xff), \
260 ((_rx_phy_info->rssi_chain0 >> 8) & 0xff), \
261 ((_rx_phy_info->rssi_chain0 >> 0) & 0xff)); \
262 \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530263 qdf_print("RSSI Chain 1 (0x%02x 0x%02x 0x%02x 0x%02x)\n",\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800264 ((_rx_phy_info->rssi_chain1 >> 24) & 0xff), \
265 ((_rx_phy_info->rssi_chain1 >> 16) & 0xff), \
266 ((_rx_phy_info->rssi_chain1 >> 8) & 0xff), \
267 ((_rx_phy_info->rssi_chain1 >> 0) & 0xff)); \
268 \
Anurag Chouhan6d760662016-02-20 16:05:43 +0530269 qdf_print("RSSI Chain 2 (0x%02x 0x%02x 0x%02x 0x%02x)\n",\
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800270 ((_rx_phy_info->rssi_chain2 >> 24) & 0xff), \
271 ((_rx_phy_info->rssi_chain2 >> 16) & 0xff), \
272 ((_rx_phy_info->rssi_chain2 >> 8) & 0xff), \
273 ((_rx_phy_info->rssi_chain2 >> 0) & 0xff)); \
274}
275
276static void htt_t2h_stats_rx_rate_stats_print(wlan_dbg_rx_rate_info_t *
277 rx_phy_info, int concise)
278{
279 rx_rate_stats_print_cmn(rx_phy_info, concise);
280}
281
282static void htt_t2h_stats_rx_rate_stats_print_v2(wlan_dbg_rx_rate_info_v2_t *
283 rx_phy_info, int concise)
284{
285 rx_rate_stats_print_cmn(rx_phy_info, concise);
286}
287
288static void
289htt_t2h_stats_pdev_stats_print(struct wlan_dbg_stats *wlan_pdev_stats,
290 int concise)
291{
292 struct wlan_dbg_tx_stats *tx = &wlan_pdev_stats->tx;
293 struct wlan_dbg_rx_stats *rx = &wlan_pdev_stats->rx;
294
Anurag Chouhan6d760662016-02-20 16:05:43 +0530295 qdf_print("WAL Pdev stats:\n");
296 qdf_print("\n### Tx ###\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800297
298 /* Num HTT cookies queued to dispatch list */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530299 qdf_print("comp_queued :\t%d\n", tx->comp_queued);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800300 /* Num HTT cookies dispatched */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530301 qdf_print("comp_delivered :\t%d\n", tx->comp_delivered);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800302 /* Num MSDU queued to WAL */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530303 qdf_print("msdu_enqued :\t%d\n", tx->msdu_enqued);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800304 /* Num MPDU queued to WAL */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530305 qdf_print("mpdu_enqued :\t%d\n", tx->mpdu_enqued);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800306 /* Num MSDUs dropped by WMM limit */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530307 qdf_print("wmm_drop :\t%d\n", tx->wmm_drop);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800308 /* Num Local frames queued */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530309 qdf_print("local_enqued :\t%d\n", tx->local_enqued);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800310 /* Num Local frames done */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530311 qdf_print("local_freed :\t%d\n", tx->local_freed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800312 /* Num queued to HW */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530313 qdf_print("hw_queued :\t%d\n", tx->hw_queued);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800314 /* Num PPDU reaped from HW */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530315 qdf_print("hw_reaped :\t%d\n", tx->hw_reaped);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800316 /* Num underruns */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530317 qdf_print("mac underrun :\t%d\n", tx->underrun);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800318 /* Num underruns */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530319 qdf_print("phy underrun :\t%d\n", tx->phy_underrun);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800320 /* Num PPDUs cleaned up in TX abort */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530321 qdf_print("tx_abort :\t%d\n", tx->tx_abort);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800322 /* Num MPDUs requed by SW */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530323 qdf_print("mpdus_requed :\t%d\n", tx->mpdus_requed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800324 /* Excessive retries */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530325 qdf_print("excess retries :\t%d\n", tx->tx_ko);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800326 /* last data rate */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530327 qdf_print("last rc :\t%d\n", tx->data_rc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800328 /* scheduler self triggers */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530329 qdf_print("sched self trig :\t%d\n", tx->self_triggers);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800330 /* SW retry failures */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530331 qdf_print("ampdu retry failed:\t%d\n", tx->sw_retry_failure);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800332 /* ilegal phy rate errirs */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530333 qdf_print("illegal rate errs :\t%d\n", tx->illgl_rate_phy_err);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800334 /* pdev continous excessive retries */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530335 qdf_print("pdev cont xretry :\t%d\n", tx->pdev_cont_xretry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800336 /* pdev continous excessive retries */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530337 qdf_print("pdev tx timeout :\t%d\n", tx->pdev_tx_timeout);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800338 /* pdev resets */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530339 qdf_print("pdev resets :\t%d\n", tx->pdev_resets);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800340 /* PPDU > txop duration */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530341 qdf_print("ppdu txop ovf :\t%d\n", tx->txop_ovf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800342
Anurag Chouhan6d760662016-02-20 16:05:43 +0530343 qdf_print("\n### Rx ###\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800344 /* Cnts any change in ring routing mid-ppdu */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530345 qdf_print("ppdu_route_change :\t%d\n", rx->mid_ppdu_route_change);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800346 /* Total number of statuses processed */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530347 qdf_print("status_rcvd :\t%d\n", rx->status_rcvd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800348 /* Extra frags on rings 0-3 */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530349 qdf_print("r0_frags :\t%d\n", rx->r0_frags);
350 qdf_print("r1_frags :\t%d\n", rx->r1_frags);
351 qdf_print("r2_frags :\t%d\n", rx->r2_frags);
352 qdf_print("r3_frags :\t%d\n", rx->r3_frags);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800353 /* MSDUs / MPDUs delivered to HTT */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530354 qdf_print("htt_msdus :\t%d\n", rx->htt_msdus);
355 qdf_print("htt_mpdus :\t%d\n", rx->htt_mpdus);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800356 /* MSDUs / MPDUs delivered to local stack */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530357 qdf_print("loc_msdus :\t%d\n", rx->loc_msdus);
358 qdf_print("loc_mpdus :\t%d\n", rx->loc_mpdus);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800359 /* AMSDUs that have more MSDUs than the status ring size */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530360 qdf_print("oversize_amsdu :\t%d\n", rx->oversize_amsdu);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800361 /* Number of PHY errors */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530362 qdf_print("phy_errs :\t%d\n", rx->phy_errs);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800363 /* Number of PHY errors dropped */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530364 qdf_print("phy_errs dropped :\t%d\n", rx->phy_err_drop);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800365 /* Number of mpdu errors - FCS, MIC, ENC etc. */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530366 qdf_print("mpdu_errs :\t%d\n", rx->mpdu_errs);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800367
368}
369
370static void
371htt_t2h_stats_rx_reorder_stats_print(struct rx_reorder_stats *stats_ptr,
372 int concise)
373{
Anurag Chouhan6d760662016-02-20 16:05:43 +0530374 qdf_print("Rx reorder statistics:\n");
375 qdf_print(" %u non-QoS frames received\n", stats_ptr->deliver_non_qos);
376 qdf_print(" %u frames received in-order\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800377 stats_ptr->deliver_in_order);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530378 qdf_print(" %u frames flushed due to timeout\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800379 stats_ptr->deliver_flush_timeout);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530380 qdf_print(" %u frames flushed due to moving out of window\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800381 stats_ptr->deliver_flush_oow);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530382 qdf_print(" %u frames flushed due to receiving DELBA\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800383 stats_ptr->deliver_flush_delba);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530384 qdf_print(" %u frames discarded due to FCS error\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800385 stats_ptr->fcs_error);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530386 qdf_print(" %u frames discarded due to invalid peer\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800387 stats_ptr->invalid_peer);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530388 qdf_print
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800389 (" %u frames discarded due to duplication (non aggregation)\n",
390 stats_ptr->dup_non_aggr);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530391 qdf_print(" %u frames discarded due to duplication in reorder queue\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800392 stats_ptr->dup_in_reorder);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530393 qdf_print(" %u frames discarded due to processed before\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800394 stats_ptr->dup_past);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530395 qdf_print(" %u times reorder timeout happened\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800396 stats_ptr->reorder_timeout);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530397 qdf_print(" %u times incorrect bar received\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800398 stats_ptr->invalid_bar_ssn);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530399 qdf_print(" %u times bar ssn reset happened\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800400 stats_ptr->ssn_reset);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530401 qdf_print(" %u times flushed due to peer delete\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800402 stats_ptr->deliver_flush_delpeer);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530403 qdf_print(" %u times flushed due to offload\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800404 stats_ptr->deliver_flush_offload);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530405 qdf_print(" %u times flushed due to ouf of buffer\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800406 stats_ptr->deliver_flush_oob);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530407 qdf_print(" %u MPDU's dropped due to PN check fail\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800408 stats_ptr->pn_fail);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530409 qdf_print(" %u MPDU's dropped due to lack of memory\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800410 stats_ptr->store_fail);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530411 qdf_print(" %u times tid pool alloc succeeded\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800412 stats_ptr->tid_pool_alloc_succ);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530413 qdf_print(" %u times MPDU pool alloc succeeded\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800414 stats_ptr->mpdu_pool_alloc_succ);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530415 qdf_print(" %u times MSDU pool alloc succeeded\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800416 stats_ptr->msdu_pool_alloc_succ);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530417 qdf_print(" %u times tid pool alloc failed\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800418 stats_ptr->tid_pool_alloc_fail);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530419 qdf_print(" %u times MPDU pool alloc failed\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800420 stats_ptr->mpdu_pool_alloc_fail);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530421 qdf_print(" %u times MSDU pool alloc failed\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800422 stats_ptr->msdu_pool_alloc_fail);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530423 qdf_print(" %u times tid pool freed\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800424 stats_ptr->tid_pool_free);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530425 qdf_print(" %u times MPDU pool freed\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800426 stats_ptr->mpdu_pool_free);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530427 qdf_print(" %u times MSDU pool freed\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800428 stats_ptr->msdu_pool_free);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530429 qdf_print(" %u MSDUs undelivered to HTT, queued to Rx MSDU free list\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800430 stats_ptr->msdu_queued);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530431 qdf_print(" %u MSDUs released from Rx MSDU list to MAC ring\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800432 stats_ptr->msdu_recycled);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530433 qdf_print(" %u MPDUs with invalid peer but A2 found in AST\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800434 stats_ptr->invalid_peer_a2_in_ast);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530435 qdf_print(" %u MPDUs with invalid peer but A3 found in AST\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800436 stats_ptr->invalid_peer_a3_in_ast);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530437 qdf_print(" %u MPDUs with invalid peer, Broadcast or Mulitcast frame\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800438 stats_ptr->invalid_peer_bmc_mpdus);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530439 qdf_print(" %u MSDUs with err attention word\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800440 stats_ptr->rxdesc_err_att);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530441 qdf_print(" %u MSDUs with flag of peer_idx_invalid\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800442 stats_ptr->rxdesc_err_peer_idx_inv);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530443 qdf_print(" %u MSDUs with flag of peer_idx_timeout\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800444 stats_ptr->rxdesc_err_peer_idx_to);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530445 qdf_print(" %u MSDUs with flag of overflow\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800446 stats_ptr->rxdesc_err_ov);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530447 qdf_print(" %u MSDUs with flag of msdu_length_err\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800448 stats_ptr->rxdesc_err_msdu_len);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530449 qdf_print(" %u MSDUs with flag of mpdu_length_err\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800450 stats_ptr->rxdesc_err_mpdu_len);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530451 qdf_print(" %u MSDUs with flag of tkip_mic_err\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800452 stats_ptr->rxdesc_err_tkip_mic);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530453 qdf_print(" %u MSDUs with flag of decrypt_err\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800454 stats_ptr->rxdesc_err_decrypt);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530455 qdf_print(" %u MSDUs with flag of fcs_err\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800456 stats_ptr->rxdesc_err_fcs);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530457 qdf_print(" %u Unicast frames with invalid peer handler\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800458 stats_ptr->rxdesc_uc_msdus_inv_peer);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530459 qdf_print(" %u unicast frame directly to DUT with invalid peer handler\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800460 stats_ptr->rxdesc_direct_msdus_inv_peer);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530461 qdf_print(" %u Broadcast/Multicast frames with invalid peer handler\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800462 stats_ptr->rxdesc_bmc_msdus_inv_peer);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530463 qdf_print(" %u MSDUs dropped due to no first MSDU flag\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800464 stats_ptr->rxdesc_no_1st_msdu);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530465 qdf_print(" %u MSDUs dropped due to ring overflow\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800466 stats_ptr->msdu_drop_ring_ov);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530467 qdf_print(" %u MSDUs dropped due to FC mismatch\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800468 stats_ptr->msdu_drop_fc_mismatch);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530469 qdf_print(" %u MSDUs dropped due to mgt frame in Remote ring\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800470 stats_ptr->msdu_drop_mgmt_remote_ring);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530471 qdf_print(" %u MSDUs dropped due to misc non error\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800472 stats_ptr->msdu_drop_misc);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530473 qdf_print(" %u MSDUs go to offload before reorder\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800474 stats_ptr->offload_msdu_wal);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530475 qdf_print(" %u data frame dropped by offload after reorder\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800476 stats_ptr->offload_msdu_reorder);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530477 qdf_print(" %u MPDUs with SN in the past & within BA window\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800478 stats_ptr->dup_past_within_window);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530479 qdf_print(" %u MPDUs with SN in the past & outside BA window\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800480 stats_ptr->dup_past_outside_window);
481}
482
483static void
484htt_t2h_stats_rx_rem_buf_stats_print(
485 struct rx_remote_buffer_mgmt_stats *stats_ptr, int concise)
486{
Anurag Chouhan6d760662016-02-20 16:05:43 +0530487 qdf_print("Rx Remote Buffer Statistics:\n");
488 qdf_print(" %u MSDU's reaped for Rx processing\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800489 stats_ptr->remote_reaped);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530490 qdf_print(" %u MSDU's recycled within firmware\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800491 stats_ptr->remote_recycled);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530492 qdf_print(" %u MSDU's stored by Data Rx\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800493 stats_ptr->data_rx_msdus_stored);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530494 qdf_print(" %u HTT indications from WAL Rx MSDU\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800495 stats_ptr->wal_rx_ind);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530496 qdf_print(" %u HTT indications unconsumed from WAL Rx MSDU\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800497 stats_ptr->wal_rx_ind_unconsumed);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530498 qdf_print(" %u HTT indications from Data Rx MSDU\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800499 stats_ptr->data_rx_ind);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530500 qdf_print(" %u HTT indications unconsumed from Data Rx MSDU\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800501 stats_ptr->data_rx_ind_unconsumed);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530502 qdf_print(" %u HTT indications from ATHBUF\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800503 stats_ptr->athbuf_rx_ind);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530504 qdf_print(" %u Remote buffers requested for refill\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800505 stats_ptr->refill_buf_req);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530506 qdf_print(" %u Remote buffers filled by host\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800507 stats_ptr->refill_buf_rsp);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530508 qdf_print(" %u times MAC has no buffers\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800509 stats_ptr->mac_no_bufs);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530510 qdf_print(" %u times f/w write & read indices on MAC ring are equal\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800511 stats_ptr->fw_indices_equal);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530512 qdf_print(" %u times f/w has no remote buffers to post to MAC\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800513 stats_ptr->host_no_bufs);
514}
515
516static void
517htt_t2h_stats_txbf_info_buf_stats_print(
518 struct wlan_dbg_txbf_data_stats *stats_ptr)
519{
Anurag Chouhan6d760662016-02-20 16:05:43 +0530520 qdf_print("TXBF data Statistics:\n");
521 qdf_print("tx_txbf_vht (0..9): ");
522 qdf_print("%u, %u, %u, %u, %u, %u, %u, %u, %u, %d\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800523 stats_ptr->tx_txbf_vht[0],
524 stats_ptr->tx_txbf_vht[1],
525 stats_ptr->tx_txbf_vht[2],
526 stats_ptr->tx_txbf_vht[3],
527 stats_ptr->tx_txbf_vht[4],
528 stats_ptr->tx_txbf_vht[5],
529 stats_ptr->tx_txbf_vht[6],
530 stats_ptr->tx_txbf_vht[7],
531 stats_ptr->tx_txbf_vht[8],
532 stats_ptr->tx_txbf_vht[9]);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530533 qdf_print("rx_txbf_vht (0..9): ");
534 qdf_print("%u, %u, %u, %u, %u, %u, %u, %u, %u, %u\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800535 stats_ptr->rx_txbf_vht[0],
536 stats_ptr->rx_txbf_vht[1],
537 stats_ptr->rx_txbf_vht[2],
538 stats_ptr->rx_txbf_vht[3],
539 stats_ptr->rx_txbf_vht[4],
540 stats_ptr->rx_txbf_vht[5],
541 stats_ptr->rx_txbf_vht[6],
542 stats_ptr->rx_txbf_vht[7],
543 stats_ptr->rx_txbf_vht[8],
544 stats_ptr->rx_txbf_vht[9]);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530545 qdf_print("tx_txbf_ht (0..7): ");
546 qdf_print("%u, %u, %u, %u, %u, %u, %u, %u\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800547 stats_ptr->tx_txbf_ht[0],
548 stats_ptr->tx_txbf_ht[1],
549 stats_ptr->tx_txbf_ht[2],
550 stats_ptr->tx_txbf_ht[3],
551 stats_ptr->tx_txbf_ht[4],
552 stats_ptr->tx_txbf_ht[5],
553 stats_ptr->tx_txbf_ht[6],
554 stats_ptr->tx_txbf_ht[7]);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530555 qdf_print("tx_txbf_ofdm (0..7): ");
556 qdf_print("%u, %u, %u, %u, %u, %u, %u, %u\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800557 stats_ptr->tx_txbf_ofdm[0],
558 stats_ptr->tx_txbf_ofdm[1],
559 stats_ptr->tx_txbf_ofdm[2],
560 stats_ptr->tx_txbf_ofdm[3],
561 stats_ptr->tx_txbf_ofdm[4],
562 stats_ptr->tx_txbf_ofdm[5],
563 stats_ptr->tx_txbf_ofdm[6],
564 stats_ptr->tx_txbf_ofdm[7]);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530565 qdf_print("tx_txbf_cck (0..6): ");
566 qdf_print("%u, %u, %u, %u, %u, %u, %u\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800567 stats_ptr->tx_txbf_cck[0],
568 stats_ptr->tx_txbf_cck[1],
569 stats_ptr->tx_txbf_cck[2],
570 stats_ptr->tx_txbf_cck[3],
571 stats_ptr->tx_txbf_cck[4],
572 stats_ptr->tx_txbf_cck[5],
573 stats_ptr->tx_txbf_cck[6]);
574}
575
576static void
577htt_t2h_stats_txbf_snd_buf_stats_print(
578 struct wlan_dbg_txbf_snd_stats *stats_ptr)
579{
Anurag Chouhan6d760662016-02-20 16:05:43 +0530580 qdf_print("TXBF snd Buffer Statistics:\n");
581 qdf_print("cbf_20: ");
582 qdf_print("%u, %u, %u, %u\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800583 stats_ptr->cbf_20[0],
584 stats_ptr->cbf_20[1],
585 stats_ptr->cbf_20[2],
586 stats_ptr->cbf_20[3]);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530587 qdf_print("cbf_40: ");
588 qdf_print("%u, %u, %u, %u\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800589 stats_ptr->cbf_40[0],
590 stats_ptr->cbf_40[1],
591 stats_ptr->cbf_40[2],
592 stats_ptr->cbf_40[3]);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530593 qdf_print("cbf_80: ");
594 qdf_print("%u, %u, %u, %u\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800595 stats_ptr->cbf_80[0],
596 stats_ptr->cbf_80[1],
597 stats_ptr->cbf_80[2],
598 stats_ptr->cbf_80[3]);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530599 qdf_print("sounding: ");
600 qdf_print("%u, %u, %u, %u, %u, %u, %u, %u, %u\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800601 stats_ptr->sounding[0],
602 stats_ptr->sounding[1],
603 stats_ptr->sounding[2],
604 stats_ptr->sounding[3],
605 stats_ptr->sounding[4],
606 stats_ptr->sounding[5],
607 stats_ptr->sounding[6],
608 stats_ptr->sounding[7],
609 stats_ptr->sounding[8]);
610}
611
612static void
613htt_t2h_stats_tx_selfgen_buf_stats_print(
614 struct wlan_dbg_tx_selfgen_stats *stats_ptr)
615{
Anurag Chouhan6d760662016-02-20 16:05:43 +0530616 qdf_print("Tx selfgen Buffer Statistics:\n");
617 qdf_print(" %u su_ndpa\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800618 stats_ptr->su_ndpa);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530619 qdf_print(" %u mu_ndp\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800620 stats_ptr->mu_ndp);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530621 qdf_print(" %u mu_ndpa\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800622 stats_ptr->mu_ndpa);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530623 qdf_print(" %u mu_ndp\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800624 stats_ptr->mu_ndp);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530625 qdf_print(" %u mu_brpoll_1\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800626 stats_ptr->mu_brpoll_1);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530627 qdf_print(" %u mu_brpoll_2\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800628 stats_ptr->mu_brpoll_2);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530629 qdf_print(" %u mu_bar_1\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800630 stats_ptr->mu_bar_1);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530631 qdf_print(" %u mu_bar_2\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800632 stats_ptr->mu_bar_2);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530633 qdf_print(" %u cts_burst\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800634 stats_ptr->cts_burst);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530635 qdf_print(" %u su_ndp_err\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800636 stats_ptr->su_ndp_err);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530637 qdf_print(" %u su_ndpa_err\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800638 stats_ptr->su_ndpa_err);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530639 qdf_print(" %u mu_ndp_err\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800640 stats_ptr->mu_ndp_err);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530641 qdf_print(" %u mu_brp1_err\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800642 stats_ptr->mu_brp1_err);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530643 qdf_print(" %u mu_brp2_err\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800644 stats_ptr->mu_brp2_err);
645}
646
647static void
648htt_t2h_stats_wifi2_error_stats_print(
649 struct wlan_dbg_wifi2_error_stats *stats_ptr)
650{
651 int i;
652
Anurag Chouhan6d760662016-02-20 16:05:43 +0530653 qdf_print("Scheduler error Statistics:\n");
654 qdf_print("urrn_stats: ");
655 qdf_print("%d, %d, %d\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800656 stats_ptr->urrn_stats[0],
657 stats_ptr->urrn_stats[1],
658 stats_ptr->urrn_stats[2]);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530659 qdf_print("flush_errs (0..%d): ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800660 WHAL_DBG_FLUSH_REASON_MAXCNT);
661 for (i = 0; i < WHAL_DBG_FLUSH_REASON_MAXCNT; i++)
Anurag Chouhan6d760662016-02-20 16:05:43 +0530662 qdf_print(" %u", stats_ptr->flush_errs[i]);
663 qdf_print("\n");
664 qdf_print("schd_stall_errs (0..3): ");
665 qdf_print("%d, %d, %d, %d\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800666 stats_ptr->schd_stall_errs[0],
667 stats_ptr->schd_stall_errs[1],
668 stats_ptr->schd_stall_errs[2],
669 stats_ptr->schd_stall_errs[3]);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530670 qdf_print("schd_cmd_result (0..%d): ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800671 WHAL_DBG_CMD_RESULT_MAXCNT);
672 for (i = 0; i < WHAL_DBG_CMD_RESULT_MAXCNT; i++)
Anurag Chouhan6d760662016-02-20 16:05:43 +0530673 qdf_print(" %u", stats_ptr->schd_cmd_result[i]);
674 qdf_print("\n");
675 qdf_print("sifs_status (0..%d): ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800676 WHAL_DBG_SIFS_STATUS_MAXCNT);
677 for (i = 0; i < WHAL_DBG_SIFS_STATUS_MAXCNT; i++)
Anurag Chouhan6d760662016-02-20 16:05:43 +0530678 qdf_print(" %u", stats_ptr->sifs_status[i]);
679 qdf_print("\n");
680 qdf_print("phy_errs (0..%d): ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800681 WHAL_DBG_PHY_ERR_MAXCNT);
682 for (i = 0; i < WHAL_DBG_PHY_ERR_MAXCNT; i++)
Anurag Chouhan6d760662016-02-20 16:05:43 +0530683 qdf_print(" %u", stats_ptr->phy_errs[i]);
684 qdf_print("\n");
685 qdf_print(" %u rx_rate_inval\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800686 stats_ptr->rx_rate_inval);
687}
688
689static void
690htt_t2h_rx_musu_ndpa_pkts_stats_print(
691 struct rx_txbf_musu_ndpa_pkts_stats *stats_ptr)
692{
Anurag Chouhan6d760662016-02-20 16:05:43 +0530693 qdf_print("Rx TXBF MU/SU Packets and NDPA Statistics:\n");
694 qdf_print(" %u Number of TXBF MU packets received\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800695 stats_ptr->number_mu_pkts);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530696 qdf_print(" %u Number of TXBF SU packets received\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800697 stats_ptr->number_su_pkts);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530698 qdf_print(" %u Number of TXBF directed NDPA\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800699 stats_ptr->txbf_directed_ndpa_count);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530700 qdf_print(" %u Number of TXBF retried NDPA\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800701 stats_ptr->txbf_ndpa_retry_count);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530702 qdf_print(" %u Total number of TXBF NDPA\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800703 stats_ptr->txbf_total_ndpa_count);
704}
705
706#define HTT_TICK_TO_USEC(ticks, microsec_per_tick) (ticks * microsec_per_tick)
707static inline int htt_rate_flags_to_mhz(uint8_t rate_flags)
708{
709 if (rate_flags & 0x20)
710 return 40; /* WHAL_RC_FLAG_40MHZ */
711 if (rate_flags & 0x40)
712 return 80; /* WHAL_RC_FLAG_80MHZ */
713 if (rate_flags & 0x80)
714 return 160; /* WHAL_RC_FLAG_160MHZ */
715 return 20;
716}
717
718#define HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW 64
719
720static void
721htt_t2h_tx_ppdu_bitmaps_pr(uint32_t *queued_ptr, uint32_t *acked_ptr)
722{
723 char queued_str[HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW + 1];
724 char acked_str[HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW + 1];
725 int i, j, word;
726
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530727 qdf_mem_set(queued_str, HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW, '0');
728 qdf_mem_set(acked_str, HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW, '-');
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800729 i = 0;
730 for (word = 0; word < 2; word++) {
731 uint32_t queued = *(queued_ptr + word);
732 uint32_t acked = *(acked_ptr + word);
733 for (j = 0; j < 32; j++, i++) {
734 if (queued & (1 << j)) {
735 queued_str[i] = '1';
736 acked_str[i] = (acked & (1 << j)) ? 'y' : 'N';
737 }
738 }
739 }
740 queued_str[HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW] = '\0';
741 acked_str[HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW] = '\0';
Anurag Chouhan6d760662016-02-20 16:05:43 +0530742 qdf_print("%s\n", queued_str);
743 qdf_print("%s\n", acked_str);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800744}
745
746static inline uint16_t htt_msg_read16(uint16_t *p16)
747{
748#ifdef BIG_ENDIAN_HOST
749 /*
750 * During upload, the bytes within each uint32_t word were
751 * swapped by the HIF HW. This results in the lower and upper bytes
752 * of each uint16_t to be in the correct big-endian order with
753 * respect to each other, but for each even-index uint16_t to
754 * have its position switched with its successor neighbor uint16_t.
755 * Undo this uint16_t position swapping.
756 */
757 return (((size_t) p16) & 0x2) ? *(p16 - 1) : *(p16 + 1);
758#else
759 return *p16;
760#endif
761}
762
763static inline uint8_t htt_msg_read8(uint8_t *p8)
764{
765#ifdef BIG_ENDIAN_HOST
766 /*
767 * During upload, the bytes within each uint32_t word were
768 * swapped by the HIF HW.
769 * Undo this byte swapping.
770 */
771 switch (((size_t) p8) & 0x3) {
772 case 0:
773 return *(p8 + 3);
774 case 1:
775 return *(p8 + 1);
776 case 2:
777 return *(p8 - 1);
778 default /* 3 */:
779 return *(p8 - 3);
780 }
781#else
782 return *p8;
783#endif
784}
785
786void htt_make_u8_list_str(uint32_t *aligned_data,
787 char *buffer, int space, int max_elems)
788{
789 uint8_t *p8 = (uint8_t *) aligned_data;
790 char *buf_p = buffer;
791 while (max_elems-- > 0) {
792 int bytes;
793 uint8_t val;
794
795 val = htt_msg_read8(p8);
796 if (val == 0)
797 /* not enough data to fill the reserved msg buffer*/
798 break;
799
Anurag Chouhan6d760662016-02-20 16:05:43 +0530800 bytes = qdf_snprint(buf_p, space, "%d,", val);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800801 space -= bytes;
802 if (space > 0)
803 buf_p += bytes;
804 else /* not enough print buffer space for all the data */
805 break;
806 p8++;
807 }
808 if (buf_p == buffer)
809 *buf_p = '\0'; /* nothing was written */
810 else
811 *(buf_p - 1) = '\0'; /* erase the final comma */
812
813}
814
815void htt_make_u16_list_str(uint32_t *aligned_data,
816 char *buffer, int space, int max_elems)
817{
818 uint16_t *p16 = (uint16_t *) aligned_data;
819 char *buf_p = buffer;
820 while (max_elems-- > 0) {
821 int bytes;
822 uint16_t val;
823
824 val = htt_msg_read16(p16);
825 if (val == 0)
826 /* not enough data to fill the reserved msg buffer */
827 break;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530828 bytes = qdf_snprint(buf_p, space, "%d,", val);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800829 space -= bytes;
830 if (space > 0)
831 buf_p += bytes;
832 else /* not enough print buffer space for all the data */
833 break;
834
835 p16++;
836 }
837 if (buf_p == buffer)
838 *buf_p = '\0'; /* nothing was written */
839 else
840 *(buf_p - 1) = '\0'; /* erase the final comma */
841}
842
843void
844htt_t2h_tx_ppdu_log_print(struct ol_fw_tx_dbg_ppdu_msg_hdr *hdr,
845 struct ol_fw_tx_dbg_ppdu_base *record,
846 int length, int concise)
847{
848 int i;
849 int record_size;
850 int num_records;
851
852 record_size =
853 sizeof(*record) +
854 hdr->mpdu_bytes_array_len * sizeof(uint16_t) +
855 hdr->mpdu_msdus_array_len * sizeof(uint8_t) +
856 hdr->msdu_bytes_array_len * sizeof(uint16_t);
857 num_records = (length - sizeof(*hdr)) / record_size;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530858 qdf_print("Tx PPDU log elements:\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800859
860 for (i = 0; i < num_records; i++) {
861 uint16_t start_seq_num;
862 uint16_t start_pn_lsbs;
863 uint8_t num_mpdus;
864 uint16_t peer_id;
865 uint8_t ext_tid;
866 uint8_t rate_code;
867 uint8_t rate_flags;
868 uint8_t tries;
869 uint8_t complete;
870 uint32_t time_enqueue_us;
871 uint32_t time_completion_us;
872 uint32_t *msg_word = (uint32_t *) record;
873
874 /* fields used for both concise and complete printouts */
875 start_seq_num =
876 ((*(msg_word + OL_FW_TX_DBG_PPDU_START_SEQ_NUM_16)) &
877 OL_FW_TX_DBG_PPDU_START_SEQ_NUM_M) >>
878 OL_FW_TX_DBG_PPDU_START_SEQ_NUM_S;
879 complete =
880 ((*(msg_word + OL_FW_TX_DBG_PPDU_COMPLETE_16)) &
881 OL_FW_TX_DBG_PPDU_COMPLETE_M) >>
882 OL_FW_TX_DBG_PPDU_COMPLETE_S;
883
884 /* fields used only for complete printouts */
885 if (!concise) {
886#define BUF_SIZE 80
887 char buf[BUF_SIZE];
888 uint8_t *p8;
889 time_enqueue_us =
890 HTT_TICK_TO_USEC(record->timestamp_enqueue,
891 hdr->microsec_per_tick);
892 time_completion_us =
893 HTT_TICK_TO_USEC(record->timestamp_completion,
894 hdr->microsec_per_tick);
895
896 start_pn_lsbs =
897 ((*
898 (msg_word +
899 OL_FW_TX_DBG_PPDU_START_PN_LSBS_16)) &
900 OL_FW_TX_DBG_PPDU_START_PN_LSBS_M) >>
901 OL_FW_TX_DBG_PPDU_START_PN_LSBS_S;
902 num_mpdus =
903 ((*(msg_word + OL_FW_TX_DBG_PPDU_NUM_MPDUS_16))&
904 OL_FW_TX_DBG_PPDU_NUM_MPDUS_M) >>
905 OL_FW_TX_DBG_PPDU_NUM_MPDUS_S;
906 peer_id =
907 ((*(msg_word + OL_FW_TX_DBG_PPDU_PEER_ID_16)) &
908 OL_FW_TX_DBG_PPDU_PEER_ID_M) >>
909 OL_FW_TX_DBG_PPDU_PEER_ID_S;
910 ext_tid =
911 ((*(msg_word + OL_FW_TX_DBG_PPDU_EXT_TID_16)) &
912 OL_FW_TX_DBG_PPDU_EXT_TID_M) >>
913 OL_FW_TX_DBG_PPDU_EXT_TID_S;
914 rate_code =
915 ((*(msg_word + OL_FW_TX_DBG_PPDU_RATE_CODE_16))&
916 OL_FW_TX_DBG_PPDU_RATE_CODE_M) >>
917 OL_FW_TX_DBG_PPDU_RATE_CODE_S;
918 rate_flags =
919 ((*(msg_word + OL_FW_TX_DBG_PPDU_RATEFLAGS_16))&
920 OL_FW_TX_DBG_PPDU_RATE_FLAGS_M) >>
921 OL_FW_TX_DBG_PPDU_RATE_FLAGS_S;
922 tries =
923 ((*(msg_word + OL_FW_TX_DBG_PPDU_TRIES_16)) &
924 OL_FW_TX_DBG_PPDU_TRIES_M) >>
925 OL_FW_TX_DBG_PPDU_TRIES_S;
926
Anurag Chouhan6d760662016-02-20 16:05:43 +0530927 qdf_print(" - PPDU tx to peer %d, TID %d\n", peer_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800928 ext_tid);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530929 qdf_print
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800930 (" start seq num= %u, start PN LSBs= %#04x\n",
931 start_seq_num, start_pn_lsbs);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530932 qdf_print
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800933 (" PPDU: %d MPDUs, (?) MSDUs, %d bytes\n",
934 num_mpdus,
935 /* num_msdus - not yet computed in target */
936 record->num_bytes);
937 if (complete) {
Anurag Chouhan6d760662016-02-20 16:05:43 +0530938 qdf_print
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800939 (" enqueued: %u, completed: %u usec)\n",
940 time_enqueue_us, time_completion_us);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530941 qdf_print
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800942 (" %d tries, last tx used rate %d ",
943 tries, rate_code);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530944 qdf_print("on %d MHz chan (flags = %#x)\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800945 htt_rate_flags_to_mhz
946 (rate_flags), rate_flags);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530947 qdf_print
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800948 (" enqueued and acked MPDU bitmaps:\n");
949 htt_t2h_tx_ppdu_bitmaps_pr(msg_word +
950 OL_FW_TX_DBG_PPDU_ENQUEUED_LSBS_16,
951 msg_word +
952 OL_FW_TX_DBG_PPDU_BLOCK_ACK_LSBS_16);
953 } else {
Anurag Chouhan6d760662016-02-20 16:05:43 +0530954 qdf_print
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800955 (" enqueued: %d us, not yet completed\n",
956 time_enqueue_us);
957 }
958 /* skip the regular msg fields to reach the tail area */
959 p8 = (uint8_t *) record;
960 p8 += sizeof(struct ol_fw_tx_dbg_ppdu_base);
961 if (hdr->mpdu_bytes_array_len) {
962 htt_make_u16_list_str((uint32_t *) p8, buf,
963 BUF_SIZE,
964 hdr->
965 mpdu_bytes_array_len);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530966 qdf_print(" MPDU bytes: %s\n", buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800967 }
968 p8 += hdr->mpdu_bytes_array_len * sizeof(uint16_t);
969 if (hdr->mpdu_msdus_array_len) {
970 htt_make_u8_list_str((uint32_t *) p8, buf,
971 BUF_SIZE,
972 hdr->mpdu_msdus_array_len);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530973 qdf_print(" MPDU MSDUs: %s\n", buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800974 }
975 p8 += hdr->mpdu_msdus_array_len * sizeof(uint8_t);
976 if (hdr->msdu_bytes_array_len) {
977 htt_make_u16_list_str((uint32_t *) p8, buf,
978 BUF_SIZE,
979 hdr->
980 msdu_bytes_array_len);
Anurag Chouhan6d760662016-02-20 16:05:43 +0530981 qdf_print(" MSDU bytes: %s\n", buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800982 }
983 } else {
984 /* concise */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530985 qdf_print("start seq num = %u ", start_seq_num);
986 qdf_print("enqueued and acked MPDU bitmaps:\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800987 if (complete) {
988 htt_t2h_tx_ppdu_bitmaps_pr(msg_word +
989 OL_FW_TX_DBG_PPDU_ENQUEUED_LSBS_16,
990 msg_word +
991 OL_FW_TX_DBG_PPDU_BLOCK_ACK_LSBS_16);
992 } else {
Anurag Chouhan6d760662016-02-20 16:05:43 +0530993 qdf_print("(not completed)\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800994 }
995 }
996 record = (struct ol_fw_tx_dbg_ppdu_base *)
997 (((uint8_t *) record) + record_size);
998 }
999}
1000
1001void htt_t2h_stats_print(uint8_t *stats_data, int concise)
1002{
1003 uint32_t *msg_word = (uint32_t *) stats_data;
1004 enum htt_dbg_stats_type type;
1005 enum htt_dbg_stats_status status;
1006 int length;
1007
1008 type = HTT_T2H_STATS_CONF_TLV_TYPE_GET(*msg_word);
1009 status = HTT_T2H_STATS_CONF_TLV_STATUS_GET(*msg_word);
1010 length = HTT_T2H_STATS_CONF_TLV_LENGTH_GET(*msg_word);
1011
1012 /* check that we've been given a valid stats type */
1013 if (status == HTT_DBG_STATS_STATUS_SERIES_DONE) {
1014 return;
1015 } else if (status == HTT_DBG_STATS_STATUS_INVALID) {
Anurag Chouhan6d760662016-02-20 16:05:43 +05301016 qdf_print("Target doesn't support stats type %d\n", type);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001017 return;
1018 } else if (status == HTT_DBG_STATS_STATUS_ERROR) {
Anurag Chouhan6d760662016-02-20 16:05:43 +05301019 qdf_print("Target couldn't upload stats type %d (no mem?)\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001020 type);
1021 return;
1022 }
1023 /* got valid (though perhaps partial) stats - process them */
1024 switch (type) {
1025 case HTT_DBG_STATS_WAL_PDEV_TXRX:
1026 {
1027 struct wlan_dbg_stats *wlan_dbg_stats_ptr;
1028
1029 wlan_dbg_stats_ptr =
1030 (struct wlan_dbg_stats *)(msg_word + 1);
1031 htt_t2h_stats_pdev_stats_print(wlan_dbg_stats_ptr,
1032 concise);
1033 break;
1034 }
1035 case HTT_DBG_STATS_RX_REORDER:
1036 {
1037 struct rx_reorder_stats *rx_reorder_stats_ptr;
1038
1039 rx_reorder_stats_ptr =
1040 (struct rx_reorder_stats *)(msg_word + 1);
1041 htt_t2h_stats_rx_reorder_stats_print
1042 (rx_reorder_stats_ptr, concise);
1043 break;
1044 }
1045
1046 case HTT_DBG_STATS_RX_RATE_INFO:
1047 {
1048 wlan_dbg_rx_rate_info_t *rx_phy_info;
1049 rx_phy_info =
1050 (wlan_dbg_rx_rate_info_t *) (msg_word + 1);
1051
1052 htt_t2h_stats_rx_rate_stats_print(rx_phy_info, concise);
1053
1054 break;
1055 }
1056 case HTT_DBG_STATS_RX_RATE_INFO_V2:
1057 {
1058 wlan_dbg_rx_rate_info_v2_t *rx_phy_info;
1059 rx_phy_info =
1060 (wlan_dbg_rx_rate_info_v2_t *) (msg_word + 1);
1061 htt_t2h_stats_rx_rate_stats_print_v2(rx_phy_info, concise);
1062 break;
1063 }
1064 case HTT_DBG_STATS_TX_PPDU_LOG:
1065 {
1066 struct ol_fw_tx_dbg_ppdu_msg_hdr *hdr;
1067 struct ol_fw_tx_dbg_ppdu_base *record;
1068
1069 if (status == HTT_DBG_STATS_STATUS_PARTIAL
1070 && length == 0) {
Anurag Chouhan6d760662016-02-20 16:05:43 +05301071 qdf_print
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001072 ("HTT_DBG_STATS_TX_PPDU_LOG -- length = 0!\n");
1073 break;
1074 }
1075 hdr =
1076 (struct ol_fw_tx_dbg_ppdu_msg_hdr *)(msg_word + 1);
1077 record = (struct ol_fw_tx_dbg_ppdu_base *)(hdr + 1);
1078 htt_t2h_tx_ppdu_log_print(hdr, record, length, concise);
1079 }
1080 break;
1081 case HTT_DBG_STATS_TX_RATE_INFO:
1082 {
1083 wlan_dbg_tx_rate_info_t *tx_rate_info;
1084 tx_rate_info =
1085 (wlan_dbg_tx_rate_info_t *) (msg_word + 1);
1086
1087 htt_t2h_stats_tx_rate_stats_print(tx_rate_info, concise);
1088
1089 break;
1090 }
1091 case HTT_DBG_STATS_TX_RATE_INFO_V2:
1092 {
1093 wlan_dbg_tx_rate_info_v2_t *tx_rate_info;
1094 tx_rate_info =
1095 (wlan_dbg_tx_rate_info_v2_t *) (msg_word + 1);
1096 htt_t2h_stats_tx_rate_stats_print_v2(tx_rate_info, concise);
1097 break;
1098 }
1099 case HTT_DBG_STATS_RX_REMOTE_RING_BUFFER_INFO:
1100 {
1101 struct rx_remote_buffer_mgmt_stats *rx_rem_buf;
1102
1103 rx_rem_buf = (struct rx_remote_buffer_mgmt_stats *)(msg_word + 1);
1104 htt_t2h_stats_rx_rem_buf_stats_print(rx_rem_buf, concise);
1105 break;
1106 }
1107 case HTT_DBG_STATS_TXBF_INFO:
1108 {
1109 struct wlan_dbg_txbf_data_stats *txbf_info_buf;
1110
1111 txbf_info_buf =
1112 (struct wlan_dbg_txbf_data_stats *)(msg_word + 1);
1113 htt_t2h_stats_txbf_info_buf_stats_print(txbf_info_buf);
1114 break;
1115 }
1116 case HTT_DBG_STATS_SND_INFO:
1117 {
1118 struct wlan_dbg_txbf_snd_stats *txbf_snd_buf;
1119
1120 txbf_snd_buf =
1121 (struct wlan_dbg_txbf_snd_stats *)(msg_word + 1);
1122 htt_t2h_stats_txbf_snd_buf_stats_print(txbf_snd_buf);
1123 break;
1124 }
1125 case HTT_DBG_STATS_TX_SELFGEN_INFO:
1126 {
1127 struct wlan_dbg_tx_selfgen_stats *tx_selfgen_buf;
1128
1129 tx_selfgen_buf =
1130 (struct wlan_dbg_tx_selfgen_stats *)(msg_word + 1);
1131 htt_t2h_stats_tx_selfgen_buf_stats_print(tx_selfgen_buf);
1132 break;
1133 }
1134 case HTT_DBG_STATS_ERROR_INFO:
1135 {
1136 struct wlan_dbg_wifi2_error_stats *wifi2_error_buf;
1137
1138 wifi2_error_buf =
1139 (struct wlan_dbg_wifi2_error_stats *)(msg_word + 1);
1140 htt_t2h_stats_wifi2_error_stats_print(wifi2_error_buf);
1141 break;
1142 }
1143 case HTT_DBG_STATS_TXBF_MUSU_NDPA_PKT:
1144 {
1145 struct rx_txbf_musu_ndpa_pkts_stats *rx_musu_ndpa_stats;
1146
1147 rx_musu_ndpa_stats = (struct rx_txbf_musu_ndpa_pkts_stats *)
1148 (msg_word + 1);
1149 htt_t2h_rx_musu_ndpa_pkts_stats_print(rx_musu_ndpa_stats);
1150 break;
1151 }
1152 default:
1153 break;
1154 }
1155}