1 /*
2 * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /* Host Debug log implementation */
21
22 #include "athdefs.h"
23 #include "a_types.h"
24 #include "dbglog_host.h"
25 #include "wmi.h"
26 #include "wmi_unified_api.h"
27 #include "wma.h"
28 #include "ol_defines.h"
29 #include <wlan_nlink_srv.h>
30 #include "host_diag_core_event.h"
31 #include "qwlan_version.h"
32 #include <net/sock.h>
33 #include <linux/netlink.h>
34 #include <linux/vmalloc.h>
35
36 #ifdef WLAN_DBGLOG_DEBUGFS
37 #include <linux/debugfs.h>
38 #endif /* WLAN_DBGLOG_DEBUGFS */
39 #include "wmi_unified_priv.h"
40
41 #ifdef CNSS_GENL
42 #ifdef CONFIG_CNSS_OUT_OF_TREE
43 #include "cnss_nl.h"
44 #else
45 #include <net/cnss_nl.h>
46 #endif
47 #include "wlan_cfg80211.h"
48 #endif
49
50 #ifdef MULTI_IF_NAME
51 #define CLD_DEBUGFS_DIR "cld" MULTI_IF_NAME
52 #else
53
54 #define CLD_DEBUGFS_DIR "cld"
55 #endif
56 #define DEBUGFS_BLOCK_NAME "dbglog_block"
57 #define DEBUGFS_BLOCK_PERM QDF_FILE_USR_READ
58
59 #define ATH_MODULE_NAME fwlog
60 #include <a_debug.h>
61 #define FWLOG_DEBUG ATH_DEBUG_MAKE_MODULE_MASK(0)
62
63 static int get_version;
64 static int gprint_limiter;
65 static bool tgt_assert_enable;
66 #ifdef WLAN_DEBUG
67 static ATH_DEBUG_MASK_DESCRIPTION g_fwlog_debug_description[] = {
68 {FWLOG_DEBUG, "fwlog"},
69 };
70
71 ATH_DEBUG_INSTANTIATE_MODULE_VAR(fwlog,
72 "fwlog",
73 "Firmware Debug Log",
74 ATH_DEBUG_MASK_DEFAULTS | ATH_DEBUG_INFO |
75 ATH_DEBUG_ERR,
76 ATH_DEBUG_DESCRIPTION_COUNT
77 (g_fwlog_debug_description),
78 g_fwlog_debug_description);
79 #endif
80
81 module_dbg_print mod_print[WLAN_MODULE_ID_MAX];
82
83 uint32_t dbglog_process_type = DBGLOG_PROCESS_NET_RAW;
84
dbglog_get_module_str(uint32_t module_id)85 static const char *dbglog_get_module_str(uint32_t module_id)
86 {
87 switch (module_id) {
88 case WLAN_MODULE_INF:
89 return "INF";
90 case WLAN_MODULE_WMI:
91 return "WMI";
92 case WLAN_MODULE_STA_PWRSAVE:
93 return "STA PS";
94 case WLAN_MODULE_WHAL:
95 return "WHAL";
96 case WLAN_MODULE_COEX:
97 return "COEX";
98 case WLAN_MODULE_ROAM:
99 return "ROAM";
100 case WLAN_MODULE_RESMGR_CHAN_MANAGER:
101 return "CHANMGR";
102 case WLAN_MODULE_RESMGR:
103 return "RESMGR";
104 case WLAN_MODULE_VDEV_MGR:
105 return "VDEV";
106 case WLAN_MODULE_SCAN:
107 return "SCAN";
108 case WLAN_MODULE_RATECTRL:
109 return "RC";
110 case WLAN_MODULE_AP_PWRSAVE:
111 return "AP PS";
112 case WLAN_MODULE_BLOCKACK:
113 return "BA";
114 case WLAN_MODULE_MGMT_TXRX:
115 return "MGMT";
116 case WLAN_MODULE_DATA_TXRX:
117 return "DATA";
118 case WLAN_MODULE_HTT:
119 return "HTT";
120 case WLAN_MODULE_HOST:
121 return "HOST";
122 case WLAN_MODULE_BEACON:
123 return "BEACON";
124 case WLAN_MODULE_OFFLOAD:
125 return "OFFLOAD";
126 case WLAN_MODULE_WAL:
127 return "WAL";
128 case WAL_MODULE_DE:
129 return "DE";
130 case WLAN_MODULE_PCIELP:
131 return "PCIELP";
132 case WLAN_MODULE_RTT:
133 return "RTT";
134 case WLAN_MODULE_DCS:
135 return "DCS";
136 case WLAN_MODULE_CACHEMGR:
137 return "CACHEMGR";
138 case WLAN_MODULE_ANI:
139 return "ANI";
140 case WLAN_MODULE_TEST:
141 return "TESTPOINT";
142 case WLAN_MODULE_STA_SMPS:
143 return "STA_SMPS";
144 case WLAN_MODULE_TDLS:
145 return "TDLS";
146 case WLAN_MODULE_P2P:
147 return "P2P";
148 case WLAN_MODULE_WOW:
149 return "WoW";
150 case WLAN_MODULE_IBSS_PWRSAVE:
151 return "IBSS PS";
152 case WLAN_MODULE_EXTSCAN:
153 return "ExtScan";
154 case WLAN_MODULE_UNIT_TEST:
155 return "UNIT_TEST";
156 case WLAN_MODULE_MLME:
157 return "MLME";
158 case WLAN_MODULE_SUPPL:
159 return "SUPPLICANT";
160 default:
161 return "UNKNOWN";
162 }
163 }
164
165 char *DBG_MSG_ARR[WLAN_MODULE_ID_MAX][MAX_DBG_MSGS] = {
166 {
167 "INF_MSG_START",
168 "INF_ASSERTION_FAILED",
169 "INF_TARGET_ID",
170 "INF_MSG_END"
171 },
172 {
173 "WMI_DBGID_DEFINITION_START",
174 "WMI_CMD_RX_XTND_PKT_TOO_SHORT",
175 "WMI_EXTENDED_CMD_NOT_HANDLED",
176 "WMI_CMD_RX_PKT_TOO_SHORT",
177 "WMI_CALLING_WMI_EXTENSION_FN",
178 "WMI_CMD_NOT_HANDLED",
179 "WMI_IN_SYNC",
180 "WMI_TARGET_WMI_SYNC_CMD",
181 "WMI_SET_SNR_THRESHOLD_PARAMS",
182 "WMI_SET_RSSI_THRESHOLD_PARAMS",
183 "WMI_SET_LQ_THRESHOLD_PARAMS",
184 "WMI_TARGET_CREATE_PSTREAM_CMD",
185 "WMI_WI_DTM_INUSE",
186 "WMI_TARGET_DELETE_PSTREAM_CMD",
187 "WMI_TARGET_IMPLICIT_DELETE_PSTREAM_CMD",
188 "WMI_TARGET_GET_BIT_RATE_CMD",
189 "WMI_GET_RATE_MASK_CMD_FIX_RATE_MASK_IS",
190 "WMI_TARGET_GET_AVAILABLE_CHANNELS_CMD",
191 "WMI_TARGET_GET_TX_PWR_CMD",
192 "WMI_FREE_EVBUF_WMIBUF",
193 "WMI_FREE_EVBUF_DATABUF",
194 "WMI_FREE_EVBUF_BADFLAG",
195 "WMI_HTC_RX_ERROR_DATA_PACKET",
196 "WMI_HTC_RX_SYNC_PAUSING_FOR_MBOX",
197 "WMI_INCORRECT_WMI_DATA_HDR_DROPPING_PKT",
198 "WMI_SENDING_READY_EVENT",
199 "WMI_SETPOWER_MDOE_TO_MAXPERF",
200 "WMI_SETPOWER_MDOE_TO_REC",
201 "WMI_BSSINFO_EVENT_FROM",
202 "WMI_TARGET_GET_STATS_CMD",
203 "WMI_SENDING_SCAN_COMPLETE_EVENT",
204 "WMI_SENDING_RSSI_INDB_THRESHOLD_EVENT ",
205 "WMI_SENDING_RSSI_INDBM_THRESHOLD_EVENT",
206 "WMI_SENDING_LINK_QUALITY_THRESHOLD_EVENT",
207 "WMI_SENDING_ERROR_REPORT_EVENT",
208 "WMI_SENDING_CAC_EVENT",
209 "WMI_TARGET_GET_ROAM_TABLE_CMD",
210 "WMI_TARGET_GET_ROAM_DATA_CMD",
211 "WMI_SENDING_GPIO_INTR_EVENT",
212 "WMI_SENDING_GPIO_ACK_EVENT",
213 "WMI_SENDING_GPIO_DATA_EVENT",
214 "WMI_CMD_RX",
215 "WMI_CMD_RX_XTND",
216 "WMI_EVENT_SEND",
217 "WMI_EVENT_SEND_XTND",
218 "WMI_CMD_PARAMS_DUMP_START",
219 "WMI_CMD_PARAMS_DUMP_END",
220 "WMI_CMD_PARAMS",
221 "WMI_EVENT_ALLOC_FAILURE",
222 "WMI_DBGID_DCS_PARAM_CMD",
223 "WMI_SEND_EVENT_WRONG_TLV",
224 "WMI_SEND_EVENT_NO_TLV_DEF",
225 "WMI_DBGID_DEFNITION_END",
226 },
227 {
228 "PS_STA_DEFINITION_START",
229 "PS_STA_PM_ARB_REQUEST",
230 "PS_STA_DELIVER_EVENT",
231 "PS_STA_PSPOLL_SEQ_DONE",
232 "PS_STA_COEX_MODE",
233 "PS_STA_PSPOLL_ALLOW",
234 "PS_STA_SET_PARAM",
235 "PS_STA_SPECPOLL_TIMER_STARTED",
236 "PS_STA_SPECPOLL_TIMER_STOPPED",
237 },
238 {
239 "WHAL_DBGID_DEFINITION_START",
240 "WHAL_ERROR_ANI_CONTROL",
241 "WHAL_ERROR_CHIP_TEST1",
242 "WHAL_ERROR_CHIP_TEST2",
243 "WHAL_ERROR_EEPROM_CHECKSUM",
244 "WHAL_ERROR_EEPROM_MACADDR",
245 "WHAL_ERROR_INTERRUPT_HIU",
246 "WHAL_ERROR_KEYCACHE_RESET",
247 "WHAL_ERROR_KEYCACHE_SET",
248 "WHAL_ERROR_KEYCACHE_TYPE",
249 "WHAL_ERROR_KEYCACHE_TKIPENTRY",
250 "WHAL_ERROR_KEYCACHE_WEPLENGTH",
251 "WHAL_ERROR_PHY_INVALID_CHANNEL",
252 "WHAL_ERROR_POWER_AWAKE",
253 "WHAL_ERROR_POWER_SET",
254 "WHAL_ERROR_RECV_STOPDMA",
255 "WHAL_ERROR_RECV_STOPPCU",
256 "WHAL_ERROR_RESET_CHANNF1",
257 "WHAL_ERROR_RESET_CHANNF2",
258 "WHAL_ERROR_RESET_PM",
259 "WHAL_ERROR_RESET_OFFSETCAL",
260 "WHAL_ERROR_RESET_RFGRANT",
261 "WHAL_ERROR_RESET_RXFRAME",
262 "WHAL_ERROR_RESET_STOPDMA",
263 "WHAL_ERROR_RESET_ERRID",
264 "WHAL_ERROR_RESET_ADCDCCAL1",
265 "WHAL_ERROR_RESET_ADCDCCAL2",
266 "WHAL_ERROR_RESET_TXIQCAL",
267 "WHAL_ERROR_RESET_RXIQCAL",
268 "WHAL_ERROR_RESET_CARRIERLEAK",
269 "WHAL_ERROR_XMIT_COMPUTE",
270 "WHAL_ERROR_XMIT_NOQUEUE",
271 "WHAL_ERROR_XMIT_ACTIVEQUEUE",
272 "WHAL_ERROR_XMIT_BADTYPE",
273 "WHAL_ERROR_XMIT_STOPDMA",
274 "WHAL_ERROR_INTERRUPT_BB_PANIC",
275 "WHAL_ERROR_PAPRD_MAXGAIN_ABOVE_WINDOW",
276 "WHAL_ERROR_QCU_HW_PAUSE_MISMATCH",
277 "WHAL_DBGID_DEFINITION_END",
278 },
279 {
280 "COEX_DEBUGID_START",
281 "BTCOEX_DBG_MCI_1",
282 "BTCOEX_DBG_MCI_2",
283 "BTCOEX_DBG_MCI_3",
284 "BTCOEX_DBG_MCI_4",
285 "BTCOEX_DBG_MCI_5",
286 "BTCOEX_DBG_MCI_6",
287 "BTCOEX_DBG_MCI_7",
288 "BTCOEX_DBG_MCI_8",
289 "BTCOEX_DBG_MCI_9",
290 "BTCOEX_DBG_MCI_10",
291 "COEX_WAL_BTCOEX_INIT",
292 "COEX_WAL_PAUSE",
293 "COEX_WAL_RESUME",
294 "COEX_UPDATE_AFH",
295 "COEX_HWQ_EMPTY_CB",
296 "COEX_MCI_TIMER_HANDLER",
297 "COEX_MCI_RECOVER",
298 "ERROR_COEX_MCI_ISR",
299 "ERROR_COEX_MCI_GPM",
300 "COEX_ProfileType",
301 "COEX_LinkID",
302 "COEX_LinkState",
303 "COEX_LinkRole",
304 "COEX_LinkRate",
305 "COEX_VoiceType",
306 "COEX_TInterval",
307 "COEX_WRetrx",
308 "COEX_Attempts",
309 "COEX_PerformanceState",
310 "COEX_LinkType",
311 "COEX_RX_MCI_GPM_VERSION_QUERY",
312 "COEX_RX_MCI_GPM_VERSION_RESPONSE",
313 "COEX_RX_MCI_GPM_STATUS_QUERY",
314 "COEX_STATE_WLAN_VDEV_DOWN",
315 "COEX_STATE_WLAN_VDEV_START",
316 "COEX_STATE_WLAN_VDEV_CONNECTED",
317 "COEX_STATE_WLAN_VDEV_SCAN_STARTED",
318 "COEX_STATE_WLAN_VDEV_SCAN_END",
319 "COEX_STATE_WLAN_DEFAULT",
320 "COEX_CHANNEL_CHANGE",
321 "COEX_POWER_CHANGE",
322 "COEX_CONFIG_MGR",
323 "COEX_TX_MCI_GPM_BT_CAL_REQ",
324 "COEX_TX_MCI_GPM_BT_CAL_GRANT",
325 "COEX_TX_MCI_GPM_BT_CAL_DONE",
326 "COEX_TX_MCI_GPM_WLAN_CAL_REQ",
327 "COEX_TX_MCI_GPM_WLAN_CAL_GRANT",
328 "COEX_TX_MCI_GPM_WLAN_CAL_DONE",
329 "COEX_TX_MCI_GPM_BT_DEBUG",
330 "COEX_TX_MCI_GPM_VERSION_QUERY",
331 "COEX_TX_MCI_GPM_VERSION_RESPONSE",
332 "COEX_TX_MCI_GPM_STATUS_QUERY",
333 "COEX_TX_MCI_GPM_HALT_BT_GPM",
334 "COEX_TX_MCI_GPM_WLAN_CHANNELS",
335 "COEX_TX_MCI_GPM_BT_PROFILE_INFO",
336 "COEX_TX_MCI_GPM_BT_STATUS_UPDATE",
337 "COEX_TX_MCI_GPM_BT_UPDATE_FLAGS",
338 "COEX_TX_MCI_GPM_UNKNOWN",
339 "COEX_TX_MCI_SYS_WAKING",
340 "COEX_TX_MCI_LNA_TAKE",
341 "COEX_TX_MCI_LNA_TRANS",
342 "COEX_TX_MCI_SYS_SLEEPING",
343 "COEX_TX_MCI_REQ_WAKE",
344 "COEX_TX_MCI_REMOTE_RESET",
345 "COEX_TX_MCI_TYPE_UNKNOWN",
346 "COEX_WHAL_MCI_RESET",
347 "COEX_POLL_BT_CAL_DONE_TIMEOUT",
348 "COEX_WHAL_PAUSE",
349 "COEX_RX_MCI_GPM_BT_CAL_REQ",
350 "COEX_RX_MCI_GPM_BT_CAL_DONE",
351 "COEX_RX_MCI_GPM_BT_CAL_GRANT",
352 "COEX_WLAN_CAL_START",
353 "COEX_WLAN_CAL_RESULT",
354 "COEX_BtMciState",
355 "COEX_BtCalState",
356 "COEX_WlanCalState",
357 "COEX_RxReqWakeCount",
358 "COEX_RxRemoteResetCount",
359 "COEX_RESTART_CAL",
360 "COEX_SENDMSG_QUEUE",
361 "COEX_RESETSEQ_LNAINFO_TIMEOUT",
362 "COEX_MCI_ISR_IntRaw",
363 "COEX_MCI_ISR_Int1Raw",
364 "COEX_MCI_ISR_RxMsgRaw",
365 "COEX_WHAL_COEX_RESET",
366 "COEX_WAL_COEX_INIT",
367 "COEX_TXRX_CNT_LIMIT_ISR",
368 "COEX_CH_BUSY",
369 "COEX_REASSESS_WLAN_STATE",
370 "COEX_BTCOEX_WLAN_STATE_UPDATE",
371 "COEX_BT_NUM_OF_PROFILES",
372 "COEX_BT_NUM_OF_HID_PROFILES",
373 "COEX_BT_NUM_OF_ACL_PROFILES",
374 "COEX_BT_NUM_OF_HI_ACL_PROFILES",
375 "COEX_BT_NUM_OF_VOICE_PROFILES",
376 "COEX_WLAN_AGGR_LIMIT",
377 "COEX_BT_LOW_PRIO_BUDGET",
378 "COEX_BT_HI_PRIO_BUDGET",
379 "COEX_BT_IDLE_TIME",
380 "COEX_SET_COEX_WEIGHT",
381 "COEX_WLAN_WEIGHT_GROUP",
382 "COEX_BT_WEIGHT_GROUP",
383 "COEX_BT_INTERVAL_ALLOC",
384 "COEX_BT_SCHEME",
385 "COEX_BT_MGR",
386 "COEX_BT_SM_ERROR",
387 "COEX_SYSTEM_UPDATE",
388 "COEX_LOW_PRIO_LIMIT",
389 "COEX_HI_PRIO_LIMIT",
390 "COEX_BT_INTERVAL_START",
391 "COEX_WLAN_INTERVAL_START",
392 "COEX_NON_LINK_BUDGET",
393 "COEX_CONTENTION_MSG",
394 "COEX_SET_NSS",
395 "COEX_SELF_GEN_MASK",
396 "COEX_PROFILE_ERROR",
397 "COEX_WLAN_INIT",
398 "COEX_BEACON_MISS",
399 "COEX_BEACON_OK",
400 "COEX_BTCOEX_SCAN_ACTIVITY",
401 "COEX_SCAN_ACTIVITY",
402 "COEX_FORCE_QUIETTIME",
403 "COEX_BT_MGR_QUIETTIME",
404 "COEX_BT_INACTIVITY_TRIGGER",
405 "COEX_BT_INACTIVITY_REPORTED",
406 "COEX_TX_MCI_GPM_WLAN_PRIO",
407 "COEX_TX_MCI_GPM_BT_PAUSE_PROFILE",
408 "COEX_TX_MCI_GPM_WLAN_SET_ACL_INACTIVITY",
409 "COEX_RX_MCI_GPM_BT_ACL_INACTIVITY_REPORT",
410 "COEX_GENERIC_ERROR",
411 "COEX_RX_RATE_THRESHOLD",
412 "COEX_RSSI",
413 "COEX_WLAN_VDEV_NOTIF_START", /* 133 */
414 "COEX_WLAN_VDEV_NOTIF_UP", /* 134 */
415 "COEX_WLAN_VDEV_NOTIF_DOWN", /* 135 */
416 "COEX_WLAN_VDEV_NOTIF_STOP", /* 136 */
417 "COEX_WLAN_VDEV_NOTIF_ADD_PEER", /* 137 */
418 "COEX_WLAN_VDEV_NOTIF_DELETE_PEER", /* 138 */
419 "COEX_WLAN_VDEV_NOTIF_CONNECTED_PEER", /* 139 */
420 "COEX_WLAN_VDEV_NOTIF_PAUSE", /* 140 */
421 "COEX_WLAN_VDEV_NOTIF_UNPAUSED", /* 141 */
422 "COEX_STATE_WLAN_VDEV_PEER_ADD", /* 142 */
423 "COEX_STATE_WLAN_VDEV_CONNECTED_PEER", /* 143 */
424 "COEX_STATE_WLAN_VDEV_DELETE_PEER", /* 144 */
425 "COEX_STATE_WLAN_VDEV_PAUSE", /* 145 */
426 "COEX_STATE_WLAN_VDEV_UNPAUSED", /* 146 */
427 "COEX_SCAN_CALLBACK", /* 147 */
428 "COEX_RC_SET_CHAINMASK", /* 148 */
429 "COEX_TX_MCI_GPM_WLAN_SET_BT_RXSS_THRES", /* 149 */
430 "COEX_TX_MCI_GPM_BT_RXSS_THRES_QUERY", /* 150 */
431 "COEX_BT_RXSS_THRES", /* 151 */
432 "COEX_BT_PROFILE_ADD_RMV", /* 152 */
433 "COEX_BT_SCHED_INFO", /* 153 */
434 "COEX_TRF_MGMT", /* 154 */
435 "COEX_SCHED_START", /* 155 */
436 "COEX_SCHED_RESULT", /* 156 */
437 "COEX_SCHED_ERROR", /* 157 */
438 "COEX_SCHED_PRE_OP", /* 158 */
439 "COEX_SCHED_POST_OP", /* 159 */
440 "COEX_RX_RATE", /* 160 */
441 "COEX_ACK_PRIORITY", /* 161 */
442 "COEX_STATE_WLAN_VDEV_UP", /* 162 */
443 "COEX_STATE_WLAN_VDEV_PEER_UPDATE", /* 163 */
444 "COEX_STATE_WLAN_VDEV_STOP", /* 164 */
445 "COEX_WLAN_PAUSE_PEER", /* 165 */
446 "COEX_WLAN_UNPAUSE_PEER", /* 166 */
447 "COEX_WLAN_PAUSE_INTERVAL_START", /* 167 */
448 "COEX_WLAN_POSTPAUSE_INTERVAL_START", /* 168 */
449 "COEX_TRF_FREERUN", /* 169 */
450 "COEX_TRF_SHAPE_PM", /* 170 */
451 "COEX_TRF_SHAPE_PSP", /* 171 */
452 "COEX_TRF_SHAPE_S_CTS", /* 172 */
453 "COEX_CHAIN_CONFIG", /* 173 */
454 "COEX_SYSTEM_MONITOR", /* 174 */
455 "COEX_SINGLECHAIN_INIT", /* 175 */
456 "COEX_MULTICHAIN_INIT", /* 176 */
457 "COEX_SINGLECHAIN_DBG_1", /* 177 */
458 "COEX_SINGLECHAIN_DBG_2", /* 178 */
459 "COEX_SINGLECHAIN_DBG_3", /* 179 */
460 "COEX_MULTICHAIN_DBG_1", /* 180 */
461 "COEX_MULTICHAIN_DBG_2", /* 181 */
462 "COEX_MULTICHAIN_DBG_3", /* 182 */
463 "COEX_PSP_TX_CB", /* 183 */
464 "COEX_PSP_RX_CB", /* 184 */
465 "COEX_PSP_STAT_1", /* 185 */
466 "COEX_PSP_SPEC_POLL", /* 186 */
467 "COEX_PSP_READY_STATE", /* 187 */
468 "COEX_PSP_TX_STATUS_STATE", /* 188 */
469 "COEX_PSP_RX_STATUS_STATE_1", /* 189 */
470 "COEX_PSP_NOT_READY_STATE", /* 190 */
471 "COEX_PSP_DISABLED_STATE", /* 191 */
472 "COEX_PSP_ENABLED_STATE", /* 192 */
473 "COEX_PSP_SEND_PSPOLL", /* 193 */
474 "COEX_PSP_MGR_ENTER", /* 194 */
475 "COEX_PSP_MGR_RESULT", /* 195 */
476 "COEX_PSP_NONWLAN_INTERVAL", /* 196 */
477 "COEX_PSP_STAT_2", /* 197 */
478 "COEX_PSP_RX_STATUS_STATE_2", /* 198 */
479 "COEX_PSP_ERROR", /* 199 */
480 "COEX_T2BT", /* 200 */
481 "COEX_BT_DURATION", /* 201 */
482 "COEX_TX_MCI_GPM_WLAN_SCHED_INFO_TRIG", /* 202 */
483 "COEX_TX_MCI_GPM_WLAN_SCHED_INFO_TRIG_RSP", /* 203 */
484 "COEX_TX_MCI_GPM_SCAN_OP", /* 204 */
485 "COEX_TX_MCI_GPM_BT_PAUSE_GPM_TX", /* 205 */
486 "COEX_CTS2S_SEND", /* 206 */
487 "COEX_CTS2S_RESULT", /* 207 */
488 "COEX_ENTER_OCS", /* 208 */
489 "COEX_EXIT_OCS", /* 209 */
490 "COEX_UPDATE_OCS", /* 210 */
491 "COEX_STATUS_OCS", /* 211 */
492 "COEX_STATS_BT", /* 212 */
493 "COEX_MWS_WLAN_INIT",
494 "COEX_MWS_WBTMR_SYNC",
495 "COEX_MWS_TYPE2_RX",
496 "COEX_MWS_TYPE2_TX",
497 "COEX_MWS_WLAN_CHAVD",
498 "COEX_MWS_WLAN_CHAVD_INSERT",
499 "COEX_MWS_WLAN_CHAVD_MERGE",
500 "COEX_MWS_WLAN_CHAVD_RPT",
501 "COEX_MWS_CP_MSG_SEND",
502 "COEX_MWS_CP_ESCAPE",
503 "COEX_MWS_CP_UNFRAME",
504 "COEX_MWS_CP_SYNC_UPDATE",
505 "COEX_MWS_CP_SYNC",
506 "COEX_MWS_CP_WLAN_STATE_IND",
507 "COEX_MWS_CP_SYNCRESP_TIMEOUT",
508 "COEX_MWS_SCHEME_UPDATE",
509 "COEX_MWS_WLAN_EVENT",
510 "COEX_MWS_UART_UNESCAPE",
511 "COEX_MWS_UART_ENCODE_SEND",
512 "COEX_MWS_UART_RECV_DECODE",
513 "COEX_MWS_UL_HDL",
514 "COEX_MWS_REMOTE_EVENT",
515 "COEX_MWS_OTHER",
516 "COEX_MWS_ERROR",
517 "COEX_MWS_ANT_DIVERSITY", /* 237 */
518 "COEX_P2P_GO",
519 "COEX_P2P_CLIENT",
520 "COEX_SCC_1",
521 "COEX_SCC_2",
522 "COEX_MCC_1",
523 "COEX_MCC_2",
524 "COEX_TRF_SHAPE_NOA",
525 "COEX_NOA_ONESHOT",
526 "COEX_NOA_PERIODIC",
527 "COEX_LE_1",
528 "COEX_LE_2",
529 "COEX_ANT_1",
530 "COEX_ANT_2",
531 "COEX_ENTER_NOA",
532 "COEX_EXIT_NOA",
533 "COEX_BT_SCAN_PROTECT", /* 253 */
534 "COEX_DEBUG_ID_END" /* 254 */
535 },
536 {
537 "ROAM_DBGID_DEFINITION_START",
538 "ROAM_MODULE_INIT",
539 "ROAM_DEV_START",
540 "ROAM_CONFIG_RSSI_THRESH",
541 "ROAM_CONFIG_SCAN_PERIOD",
542 "ROAM_CONFIG_AP_PROFILE",
543 "ROAM_CONFIG_CHAN_LIST",
544 "ROAM_CONFIG_SCAN_PARAMS",
545 "ROAM_CONFIG_RSSI_CHANGE",
546 "ROAM_SCAN_TIMER_START",
547 "ROAM_SCAN_TIMER_EXPIRE",
548 "ROAM_SCAN_TIMER_STOP",
549 "ROAM_SCAN_STARTED",
550 "ROAM_SCAN_COMPLETE",
551 "ROAM_SCAN_CANCELLED",
552 "ROAM_CANDIDATE_FOUND",
553 "ROAM_RSSI_ACTIVE_SCAN",
554 "ROAM_RSSI_ACTIVE_ROAM",
555 "ROAM_RSSI_GOOD",
556 "ROAM_BMISS_FIRST_RECV",
557 "ROAM_DEV_STOP",
558 "ROAM_FW_OFFLOAD_ENABLE",
559 "ROAM_CANDIDATE_SSID_MATCH",
560 "ROAM_CANDIDATE_SECURITY_MATCH",
561 "ROAM_LOW_RSSI_INTERRUPT",
562 "ROAM_HIGH_RSSI_INTERRUPT",
563 "ROAM_SCAN_REQUESTED",
564 "ROAM_BETTER_CANDIDATE_FOUND",
565 "ROAM_BETTER_AP_EVENT",
566 "ROAM_CANCEL_LOW_PRIO_SCAN",
567 "ROAM_FINAL_BMISS_RECVD",
568 "ROAM_CONFIG_SCAN_MODE",
569 "ROAM_BMISS_FINAL_SCAN_ENABLE",
570 "ROAM_SUITABLE_AP_EVENT",
571 "ROAM_RSN_IE_PARSE_ERROR",
572 "ROAM_WPA_IE_PARSE_ERROR",
573 "ROAM_SCAN_CMD_FROM_HOST",
574 "ROAM_HO_SORT_CANDIDATE",
575 "ROAM_HO_SAVE_CANDIDATE",
576 "ROAM_HO_GET_CANDIDATE",
577 "ROAM_HO_OFFLOAD_SET_PARAM",
578 "ROAM_HO_SM",
579 "ROAM_HO_HTT_SAVED",
580 "ROAM_HO_SYNC_START",
581 "ROAM_HO_START",
582 "ROAM_HO_COMPLETE",
583 "ROAM_HO_STOP",
584 "ROAM_HO_HTT_FORWARD",
585 "ROAM_DBGID_DEFINITION_END"
586 },
587 {
588 "RESMGR_CHMGR_DEFINITION_START",
589 "RESMGR_CHMGR_PAUSE_COMPLETE",
590 "RESMGR_CHMGR_CHANNEL_CHANGE",
591 "RESMGR_CHMGR_RESUME_COMPLETE",
592 "RESMGR_CHMGR_VDEV_PAUSE",
593 "RESMGR_CHMGR_VDEV_UNPAUSE",
594 "RESMGR_CHMGR_CTS2S_TX_COMP",
595 "RESMGR_CHMGR_CFEND_TX_COMP",
596 "RESMGR_CHMGR_DEFINITION_END"
597 },
598 {
599 "RESMGR_DEFINITION_START",
600 "RESMGR_OCS_ALLOCRAM_SIZE",
601 "RESMGR_OCS_RESOURCES",
602 "RESMGR_LINK_CREATE",
603 "RESMGR_LINK_DELETE",
604 "RESMGR_OCS_CHREQ_CREATE",
605 "RESMGR_OCS_CHREQ_DELETE",
606 "RESMGR_OCS_CHREQ_START",
607 "RESMGR_OCS_CHREQ_STOP",
608 "RESMGR_OCS_SCHEDULER_INVOKED",
609 "RESMGR_OCS_CHREQ_GRANT",
610 "RESMGR_OCS_CHREQ_COMPLETE",
611 "RESMGR_OCS_NEXT_TSFTIME",
612 "RESMGR_OCS_TSF_TIMEOUT_US",
613 "RESMGR_OCS_CURR_CAT_WINDOW",
614 "RESMGR_OCS_CURR_CAT_WINDOW_REQ",
615 "RESMGR_OCS_CURR_CAT_WINDOW_TIMESLOT",
616 "RESMGR_OCS_CHREQ_RESTART",
617 "RESMGR_OCS_CLEANUP_CH_ALLOCATORS",
618 "RESMGR_OCS_PURGE_CHREQ",
619 "RESMGR_OCS_CH_ALLOCATOR_FREE",
620 "RESMGR_OCS_RECOMPUTE_SCHEDULE",
621 "RESMGR_OCS_NEW_CAT_WINDOW_REQ",
622 "RESMGR_OCS_NEW_CAT_WINDOW_TIMESLOT",
623 "RESMGR_OCS_CUR_CH_ALLOC",
624 "RESMGR_OCS_WIN_CH_ALLOC",
625 "RESMGR_OCS_SCHED_CH_CHANGE",
626 "RESMGR_OCS_CONSTRUCT_CAT_WIN",
627 "RESMGR_OCS_CHREQ_PREEMPTED",
628 "RESMGR_OCS_CH_SWITCH_REQ",
629 "RESMGR_OCS_CHANNEL_SWITCHED",
630 "RESMGR_OCS_CLEANUP_STALE_REQS",
631 "RESMGR_OCS_CHREQ_UPDATE",
632 "RESMGR_OCS_REG_NOA_NOTIF",
633 "RESMGR_OCS_DEREG_NOA_NOTIF",
634 "RESMGR_OCS_GEN_PERIODIC_NOA",
635 "RESMGR_OCS_RECAL_QUOTAS",
636 "RESMGR_OCS_GRANTED_QUOTA_STATS",
637 "RESMGR_OCS_ALLOCATED_QUOTA_STATS",
638 "RESMGR_OCS_REQ_QUOTA_STATS",
639 "RESMGR_OCS_TRACKING_TIME_FIRED",
640 "RESMGR_VC_ARBITRATE_ATTRIBUTES",
641 "RESMGR_OCS_LATENCY_STRICT_TIME_SLOT",
642 "RESMGR_OCS_CURR_TSF",
643 "RESMGR_OCS_QUOTA_REM",
644 "RESMGR_OCS_LATENCY_CASE_NO",
645 "RESMGR_OCS_WIN_CAT_DUR",
646 "RESMGR_VC_UPDATE_CUR_VC",
647 "RESMGR_VC_REG_UNREG_LINK",
648 "RESMGR_VC_PRINT_LINK",
649 "RESMGR_OCS_MISS_TOLERANCE",
650 "RESMGR_DYN_SCH_ALLOCRAM_SIZE",
651 "RESMGR_DYN_SCH_ENABLE",
652 "RESMGR_DYN_SCH_ACTIVE",
653 "RESMGR_DYN_SCH_CH_STATS_START",
654 "RESMGR_DYN_SCH_CH_SX_STATS",
655 "RESMGR_DYN_SCH_TOT_UTIL_PER",
656 "RESMGR_DYN_SCH_HOME_CH_QUOTA",
657 "RESMGR_OCS_REG_RECAL_QUOTA_NOTIF",
658 "RESMGR_OCS_DEREG_RECAL_QUOTA_NOTIF",
659 "RESMGR_DEFINITION_END"
660 },
661 {
662 "VDEV_MGR_DEBID_DEFINITION_START", /* vdev Mgr */
663 "VDEV_MGR_FIRST_BEACON_MISS_DETECTED",
664 "VDEV_MGR_FINAL_BEACON_MISS_DETECTED",
665 "VDEV_MGR_BEACON_IN_SYNC",
666 "VDEV_MGR_AP_KEEPALIVE_IDLE",
667 "VDEV_MGR_AP_KEEPALIVE_INACTIVE",
668 "VDEV_MGR_AP_KEEPALIVE_UNRESPONSIVE",
669 "VDEV_MGR_AP_TBTT_CONFIG",
670 "VDEV_MGR_FIRST_BCN_RECEIVED",
671 "VDEV_MGR_VDEV_START",
672 "VDEV_MGR_VDEV_UP",
673 "VDEV_MGR_PEER_AUTHORIZED",
674 "VDEV_MGR_OCS_HP_LP_REQ_POSTED",
675 "VDEV_MGR_VDEV_START_OCS_HP_REQ_COMPLETE",
676 "VDEV_MGR_VDEV_START_OCS_HP_REQ_STOP",
677 "VDEV_MGR_HP_START_TIME",
678 "VDEV_MGR_VDEV_PAUSE_DELAY_UPDATE",
679 "VDEV_MGR_VDEV_PAUSE_FAIL",
680 "VDEV_MGR_GEN_PERIODIC_NOA",
681 "VDEV_MGR_OFF_CHAN_GO_CH_REQ_SETUP",
682 "VDEV_MGR_DEFINITION_END",
683 },
684 {
685 "SCAN_START_COMMAND_FAILED", /* scan */
686 "SCAN_STOP_COMMAND_FAILED",
687 "SCAN_EVENT_SEND_FAILED",
688 "SCAN_ENGINE_START",
689 "SCAN_ENGINE_CANCEL_COMMAND",
690 "SCAN_ENGINE_STOP_DUE_TO_TIMEOUT",
691 "SCAN_EVENT_SEND_TO_HOST",
692 "SCAN_FWLOG_EVENT_ADD",
693 "SCAN_FWLOG_EVENT_REM",
694 "SCAN_FWLOG_EVENT_PREEMPTED",
695 "SCAN_FWLOG_EVENT_RESTARTED",
696 "SCAN_FWLOG_EVENT_COMPLETED",
697 },
698 {
699 "RATECTRL_DBGID_DEFINITION_START", /* Rate ctrl */
700 "RATECTRL_DBGID_ASSOC",
701 "RATECTRL_DBGID_NSS_CHANGE",
702 "RATECTRL_DBGID_CHAINMASK_ERR",
703 "RATECTRL_DBGID_UNEXPECTED_FRAME",
704 "RATECTRL_DBGID_WAL_RCQUERY",
705 "RATECTRL_DBGID_WAL_RCUPDATE",
706 "RATECTRL_DBGID_GTX_UPDATE",
707 "RATECTRL_DBGID_DEFINITION_END"
708 },
709 {
710 "AP_PS_DBGID_DEFINITION_START",
711 "AP_PS_DBGID_UPDATE_TIM",
712 "AP_PS_DBGID_PEER_STATE_CHANGE",
713 "AP_PS_DBGID_PSPOLL",
714 "AP_PS_DBGID_PEER_CREATE",
715 "AP_PS_DBGID_PEER_DELETE",
716 "AP_PS_DBGID_VDEV_CREATE",
717 "AP_PS_DBGID_VDEV_DELETE",
718 "AP_PS_DBGID_SYNC_TIM",
719 "AP_PS_DBGID_NEXT_RESPONSE",
720 "AP_PS_DBGID_START_SP",
721 "AP_PS_DBGID_COMPLETED_EOSP",
722 "AP_PS_DBGID_TRIGGER",
723 "AP_PS_DBGID_DUPLICATE_TRIGGER",
724 "AP_PS_DBGID_UAPSD_RESPONSE",
725 "AP_PS_DBGID_SEND_COMPLETE",
726 "AP_PS_DBGID_SEND_N_COMPLETE",
727 "AP_PS_DBGID_DETECT_OUT_OF_SYNC_STA",
728 "AP_PS_DBGID_DELIVER_CAB",
729 },
730 {
731 "" /* Block Ack */
732 },
733 /* Mgmt TxRx */
734 {
735 "MGMT_TXRX_DBGID_DEFINITION_START",
736 "MGMT_TXRX_FORWARD_TO_HOST",
737 "MGMT_TXRX_DBGID_DEFINITION_END",
738 },
739 { /* Data TxRx */
740 "DATA_TXRX_DBGID_DEFINITION_START",
741 "DATA_TXRX_DBGID_RX_DATA_SEQ_LEN_INFO",
742 "DATA_TXRX_DBGID_DEFINITION_END",
743 },
744 {"" /* HTT */
745 },
746 {"" /* HOST */
747 },
748 {"" /* BEACON */
749 "BEACON_EVENT_SWBA_SEND_FAILED",
750 "BEACON_EVENT_EARLY_RX_BMISS_STATUS",
751 "BEACON_EVENT_EARLY_RX_SLEEP_SLOP",
752 "BEACON_EVENT_EARLY_RX_CONT_BMISS_TIMEOUT",
753 "BEACON_EVENT_EARLY_RX_PAUSE_SKIP_BCN_NUM",
754 "BEACON_EVENT_EARLY_RX_CLK_DRIFT",
755 "BEACON_EVENT_EARLY_RX_AP_DRIFT",
756 "BEACON_EVENT_EARLY_RX_BCN_TYPE",},
757 { /* Offload Mgr */
758 "OFFLOAD_MGR_DBGID_DEFINITION_START",
759 "OFFLOADMGR_REGISTER_OFFLOAD",
760 "OFFLOADMGR_DEREGISTER_OFFLOAD",
761 "OFFLOADMGR_NO_REG_DATA_HANDLERS",
762 "OFFLOADMGR_NO_REG_EVENT_HANDLERS",
763 "OFFLOADMGR_REG_OFFLOAD_FAILED",
764 "OFFLOADMGR_DBGID_DEFINITION_END",
765 },
766 {
767 "WAL_DBGID_DEFINITION_START",
768 "WAL_DBGID_FAST_WAKE_REQUEST",
769 "WAL_DBGID_FAST_WAKE_RELEASE",
770 "WAL_DBGID_SET_POWER_STATE",
771 "WAL_DBGID_MISSING",
772 "WAL_DBGID_CHANNEL_CHANGE_FORCE_RESET",
773 "WAL_DBGID_CHANNEL_CHANGE",
774 "WAL_DBGID_VDEV_START",
775 "WAL_DBGID_VDEV_STOP",
776 "WAL_DBGID_VDEV_UP",
777 "WAL_DBGID_VDEV_DOWN",
778 "WAL_DBGID_SW_WDOG_RESET",
779 "WAL_DBGID_TX_SCH_REGISTER_TIDQ",
780 "WAL_DBGID_TX_SCH_UNREGISTER_TIDQ",
781 "WAL_DBGID_TX_SCH_TICKLE_TIDQ",
782 "WAL_DBGID_XCESS_FAILURES",
783 "WAL_DBGID_AST_ADD_WDS_ENTRY",
784 "WAL_DBGID_AST_DEL_WDS_ENTRY",
785 "WAL_DBGID_AST_WDS_ENTRY_PEER_CHG",
786 "WAL_DBGID_AST_WDS_SRC_LEARN_FAIL",
787 "WAL_DBGID_STA_KICKOUT",
788 "WAL_DBGID_BAR_TX_FAIL",
789 "WAL_DBGID_BAR_ALLOC_FAIL",
790 "WAL_DBGID_LOCAL_DATA_TX_FAIL",
791 "WAL_DBGID_SECURITY_PM4_QUEUED",
792 "WAL_DBGID_SECURITY_GM1_QUEUED",
793 "WAL_DBGID_SECURITY_PM4_SENT",
794 "WAL_DBGID_SECURITY_ALLOW_DATA",
795 "WAL_DBGID_SECURITY_UCAST_KEY_SET",
796 "WAL_DBGID_SECURITY_MCAST_KEY_SET",
797 "WAL_DBGID_SECURITY_ENCR_EN",
798 "WAL_DBGID_BB_WDOG_TRIGGERED",
799 "WAL_DBGID_RX_LOCAL_BUFS_LWM",
800 "WAL_DBGID_RX_LOCAL_DROP_LARGE_MGMT",
801 "WAL_DBGID_VHT_ILLEGAL_RATE_PHY_ERR_DETECTED",
802 "WAL_DBGID_DEV_RESET",
803 "WAL_DBGID_TX_BA_SETUP",
804 "WAL_DBGID_RX_BA_SETUP",
805 "WAL_DBGID_DEV_TX_TIMEOUT",
806 "WAL_DBGID_DEV_RX_TIMEOUT",
807 "WAL_DBGID_STA_VDEV_XRETRY",
808 "WAL_DBGID_DCS",
809 "WAL_DBGID_MGMT_TX_FAIL",
810 "WAL_DBGID_SET_M4_SENT_MANUALLY",
811 "WAL_DBGID_PROCESS_4_WAY_HANDSHAKE",
812 "WAL_DBGID_WAL_CHANNEL_CHANGE_START",
813 "WAL_DBGID_WAL_CHANNEL_CHANGE_COMPLETE",
814 "WAL_DBGID_WHAL_CHANNEL_CHANGE_START",
815 "WAL_DBGID_WHAL_CHANNEL_CHANGE_COMPLETE",
816 "WAL_DBGID_TX_MGMT_DESCID_SEQ_TYPE_LEN",
817 "WAL_DBGID_TX_DATA_MSDUID_SEQ_TYPE_LEN",
818 "WAL_DBGID_TX_DISCARD",
819 "WAL_DBGID_TX_MGMT_COMP_DESCID_STATUS",
820 "WAL_DBGID_TX_DATA_COMP_MSDUID_STATUS",
821 "WAL_DBGID_RESET_PCU_CYCLE_CNT",
822 "WAL_DBGID_SETUP_RSSI_INTERRUPTS",
823 "WAL_DBGID_BRSSI_CONFIG",
824 "WAL_DBGID_CURRENT_BRSSI_AVE",
825 "WAL_DBGID_BCN_TX_COMP",
826 "WAL_DBGID_SET_HW_CHAINMASK",
827 "WAL_DBGID_SET_HW_CHAINMASK_TXRX_STOP_FAIL",
828 "WAL_DBGID_GET_HW_CHAINMASK",
829 "WAL_DBGID_SMPS_DISABLE",
830 "WAL_DBGID_SMPS_ENABLE_HW_CNTRL",
831 "WAL_DBGID_SMPS_SWSEL_CHAINMASK",
832 "WAL_DBGID_DEFINITION_END",
833 },
834 {
835 "" /* DE */
836 },
837 {
838 "" /* pcie lp */
839 },
840 {
841 /* RTT */
842 "RTT_CALL_FLOW",
843 "RTT_REQ_SUB_TYPE",
844 "RTT_MEAS_REQ_HEAD",
845 "RTT_MEAS_REQ_BODY",
846 "",
847 "",
848 "RTT_INIT_GLOBAL_STATE",
849 "",
850 "RTT_REPORT",
851 "",
852 "RTT_ERROR_REPORT",
853 "RTT_TIMER_STOP",
854 "RTT_SEND_TM_FRAME",
855 "RTT_V3_RESP_CNT",
856 "RTT_V3_RESP_FINISH",
857 "RTT_CHANNEL_SWITCH_REQ",
858 "RTT_CHANNEL_SWITCH_GRANT",
859 "RTT_CHANNEL_SWITCH_COMPLETE",
860 "RTT_CHANNEL_SWITCH_PREEMPT",
861 "RTT_CHANNEL_SWITCH_STOP",
862 "RTT_TIMER_START",
863 },
864 { /* RESOURCE */
865 "RESOURCE_DBGID_DEFINITION_START",
866 "RESOURCE_PEER_ALLOC",
867 "RESOURCE_PEER_FREE",
868 "RESOURCE_PEER_ALLOC_WAL_PEER",
869 "RESOURCE_PEER_NBRHOOD_MGMT_ALLOC",
870 "RESOURCE_PEER_NBRHOOD_MGMT_INFO,RESOURCE_DBGID_DEFINITION_END",
871 },
872 { /* DCS */
873 "WLAN_DCS_DBGID_INIT",
874 "WLAN_DCS_DBGID_WMI_CWINT",
875 "WLAN_DCS_DBGID_TIMER",
876 "WLAN_DCS_DBGID_CMDG",
877 "WLAN_DCS_DBGID_CMDS",
878 "WLAN_DCS_DBGID_DINIT"
879 },
880 { /* CACHEMGR */
881 ""
882 },
883 { /* ANI */
884 "ANI_DBGID_POLL",
885 "ANI_DBGID_CONTROL",
886 "ANI_DBGID_OFDM_PARAMS",
887 "ANI_DBGID_CCK_PARAMS",
888 "ANI_DBGID_RESET",
889 "ANI_DBGID_RESTART",
890 "ANI_DBGID_OFDM_LEVEL",
891 "ANI_DBGID_CCK_LEVEL",
892 "ANI_DBGID_FIRSTEP",
893 "ANI_DBGID_CYCPWR",
894 "ANI_DBGID_MRC_CCK",
895 "ANI_DBGID_SELF_CORR_LOW",
896 "ANI_DBGID_ENABLE",
897 "ANI_DBGID_CURRENT_LEVEL",
898 "ANI_DBGID_POLL_PERIOD",
899 "ANI_DBGID_LISTEN_PERIOD",
900 "ANI_DBGID_OFDM_LEVEL_CFG",
901 "ANI_DBGID_CCK_LEVEL_CFG"
902 },
903 {
904 "P2P_DBGID_DEFINITION_START",
905 "P2P_DEV_REGISTER",
906 "P2P_HANDLE_NOA",
907 "P2P_UPDATE_SCHEDULE_OPPS",
908 "P2P_UPDATE_SCHEDULE",
909 "P2P_UPDATE_START_TIME",
910 "P2P_UPDATE_START_TIME_DIFF_TSF32",
911 "P2P_UPDATE_START_TIME_FINAL",
912 "P2P_SETUP_SCHEDULE_TIMER",
913 "P2P_PROCESS_SCHEDULE_AFTER_CALC",
914 "P2P_PROCESS_SCHEDULE_STARTED_TIMER",
915 "P2P_CALC_SCHEDULES_FIRST_CALL_ALL_NEXT_EVENT",
916 "P2P_CALC_SCHEDULES_FIRST_VALUE",
917 "P2P_CALC_SCHEDULES_EARLIEST_NEXT_EVENT",
918 "P2P_CALC_SCHEDULES_SANITY_COUNT",
919 "P2P_CALC_SCHEDULES_CALL_ALL_NEXT_EVENT_FROM_WHILE_LOOP",
920 "P2P_CALC_SCHEDULES_TIMEOUT_1",
921 "P2P_CALC_SCHEDULES_TIMEOUT_2",
922 "P2P_FIND_ALL_NEXT_EVENTS_REQ_EXPIRED",
923 "P2P_FIND_ALL_NEXT_EVENTS_REQ_ACTIVE",
924 "P2P_FIND_NEXT_EVENT_REQ_NOT_STARTED",
925 "P2P_FIND_NEXT_EVENT_REQ_COMPLETE_NON_PERIODIC",
926 "P2P_FIND_NEXT_EVENT_IN_MID_OF_NOA",
927 "P2P_FIND_NEXT_EVENT_REQ_COMPLETE",
928 "P2P_SCHEDULE_TIMEOUT",
929 "P2P_CALC_SCHEDULES_ENTER",
930 "P2P_PROCESS_SCHEDULE_ENTER",
931 "P2P_FIND_ALL_NEXT_EVENTS_INDIVIDUAL_REQ_AFTER_CHANGE",
932 "P2P_FIND_ALL_NEXT_EVENTS_INDIVIDUAL_REQ_BEFORE_CHANGE",
933 "P2P_FIND_ALL_NEXT_EVENTS_ENTER",
934 "P2P_FIND_NEXT_EVENT_ENTER",
935 "P2P_NOA_GO_PRESENT",
936 "P2P_NOA_GO_ABSENT",
937 "P2P_GO_NOA_NOTIF",
938 "P2P_GO_TBTT_OFFSET",
939 "P2P_GO_GET_NOA_INFO",
940 "P2P_GO_ADD_ONE_SHOT_NOA",
941 "P2P_GO_GET_NOA_IE",
942 "P2P_GO_BCN_TX_COMP",
943 "P2P_DBGID_DEFINITION_END",
944 },
945 {
946 "CSA_DBGID_DEFINITION_START",
947 "CSA_OFFLOAD_POOL_INIT",
948 "CSA_OFFLOAD_REGISTER_VDEV",
949 "CSA_OFFLOAD_DEREGISTER_VDEV",
950 "CSA_DEREGISTER_VDEV_ERROR",
951 "CSA_OFFLOAD_BEACON_RECEIVED",
952 "CSA_OFFLOAD_BEACON_CSA_RECV",
953 "CSA_OFFLOAD_CSA_RECV_ERROR_IE",
954 "CSA_OFFLOAD_CSA_TIMER_ERROR",
955 "CSA_OFFLOAD_CSA_TIMER_EXP",
956 "CSA_OFFLOAD_WMI_EVENT_ERROR",
957 "CSA_OFFLOAD_WMI_EVENT_SENT",
958 "CSA_OFFLOAD_WMI_CHANSWITCH_RECV",
959 "CSA_DBGID_DEFINITION_END",
960 },
961 { /* NLO offload */
962 ""
963 },
964 {
965 "WLAN_CHATTER_DBGID_DEFINITION_START",
966 "WLAN_CHATTER_ENTER",
967 "WLAN_CHATTER_EXIT",
968 "WLAN_CHATTER_FILTER_HIT",
969 "WLAN_CHATTER_FILTER_MISS",
970 "WLAN_CHATTER_FILTER_FULL",
971 "WLAN_CHATTER_FILTER_TM_ADJ",
972 "WLAN_CHATTER_BUFFER_FULL",
973 "WLAN_CHATTER_TIMEOUT",
974 "WLAN_CHATTER_DBGID_DEFINITION_END",
975 },
976 {
977 "WOW_DBGID_DEFINITION_START",
978 "WOW_ENABLE_CMDID",
979 "WOW_RECV_DATA_PKT",
980 "WOW_WAKE_HOST_DATA",
981 "WOW_RECV_MGMT",
982 "WOW_WAKE_HOST_MGMT",
983 "WOW_RECV_EVENT",
984 "WOW_WAKE_HOST_EVENT",
985 "WOW_INIT",
986 "WOW_RECV_MAGIC_PKT",
987 "WOW_RECV_BITMAP_PATTERN",
988 "WOW_AP_VDEV_DISALLOW",
989 "WOW_STA_VDEV_DISALLOW",
990 "WOW_P2PGO_VDEV_DISALLOW",
991 "WOW_NS_OFLD_ENABLE",
992 "WOW_ARP_OFLD_ENABLE",
993 "WOW_NS_ARP_OFLD_DISABLE",
994 "WOW_NS_RECEIVED",
995 "WOW_NS_REPLIED",
996 "WOW_ARP_RECEIVED",
997 "WOW_ARP_REPLIED",
998 "WOW_DBGID_DEFINITION_END",
999 },
1000 { /* WAL VDEV */
1001 ""
1002 },
1003 { /* WAL PDEV */
1004 ""
1005 },
1006 { /* TEST */
1007 "TP_CHANGE_CHANNEL",
1008 "TP_LOCAL_SEND",
1009 },
1010 { /* STA SMPS */
1011 "STA_SMPS_DBGID_DEFINITION_START",
1012 "STA_SMPS_DBGID_CREATE_PDEV_INSTANCE",
1013 "STA_SMPS_DBGID_CREATE_VIRTUAL_CHAN_INSTANCE",
1014 "STA_SMPS_DBGID_DELETE_VIRTUAL_CHAN_INSTANCE",
1015 "STA_SMPS_DBGID_CREATE_STA_INSTANCE",
1016 "STA_SMPS_DBGID_DELETE_STA_INSTANCE",
1017 "STA_SMPS_DBGID_VIRTUAL_CHAN_SMPS_START",
1018 "STA_SMPS_DBGID_VIRTUAL_CHAN_SMPS_STOP",
1019 "STA_SMPS_DBGID_SEND_SMPS_ACTION_FRAME",
1020 "STA_SMPS_DBGID_HOST_FORCED_MODE",
1021 "STA_SMPS_DBGID_FW_FORCED_MODE",
1022 "STA_SMPS_DBGID_RSSI_THRESHOLD_CROSSED",
1023 "STA_SMPS_DBGID_SMPS_ACTION_FRAME_COMPLETION",
1024 "STA_SMPS_DBGID_DTIM_EBT_EVENT_CHMASK_UPDATE",
1025 "STA_SMPS_DBGID_DTIM_CHMASK_UPDATE",
1026 "STA_SMPS_DBGID_DTIM_BEACON_EVENT_CHMASK_UPDATE",
1027 "STA_SMPS_DBGID_DTIM_POWER_STATE_CHANGE",
1028 "STA_SMPS_DBGID_DTIM_CHMASK_UPDATE_SLEEP",
1029 "STA_SMPS_DBGID_DTIM_CHMASK_UPDATE_AWAKE",
1030 "SMPS_DBGID_DEFINITION_END",
1031 },
1032 { /* SWBMISS */
1033 "SWBMISS_DBGID_DEFINITION_START",
1034 "SWBMISS_ENABLED",
1035 "SWBMISS_DISABLED",
1036 "SWBMISS_DBGID_DEFINITION_END",
1037 },
1038 { /* WMMAC */
1039 ""
1040 },
1041 { /* TDLS */
1042 "TDLS_DBGID_DEFINITION_START",
1043 "TDLS_DBGID_VDEV_CREATE",
1044 "TDLS_DBGID_VDEV_DELETE",
1045 "TDLS_DBGID_ENABLED_PASSIVE",
1046 "TDLS_DBGID_ENABLED_ACTIVE",
1047 "TDLS_DBGID_DISABLED",
1048 "TDLS_DBGID_CONNTRACK_TIMER",
1049 "TDLS_DBGID_WAL_SET",
1050 "TDLS_DBGID_WAL_GET",
1051 "TDLS_DBGID_WAL_PEER_UPDATE_SET",
1052 "TDLS_DBGID_WAL_PEER_UPDATE_EVT",
1053 "TDLS_DBGID_WAL_VDEV_CREATE",
1054 "TDLS_DBGID_WAL_VDEV_DELETE",
1055 "TDLS_DBGID_WLAN_EVENT",
1056 "TDLS_DBGID_WLAN_PEER_UPDATE_SET",
1057 "TDLS_DBGID_PEER_EVT_DRP_THRESH",
1058 "TDLS_DBGID_PEER_EVT_DRP_RATE",
1059 "TDLS_DBGID_PEER_EVT_DRP_RSSI",
1060 "TDLS_DBGID_PEER_EVT_DISCOVER",
1061 "TDLS_DBGID_PEER_EVT_DELETE",
1062 "TDLS_DBGID_PEER_CAP_UPDATE",
1063 "TDLS_DBGID_UAPSD_SEND_PTI_FRAME",
1064 "TDLS_DBGID_UAPSD_SEND_PTI_FRAME2PEER",
1065 "TDLS_DBGID_UAPSD_START_PTR_TIMER",
1066 "TDLS_DBGID_UAPSD_CANCEL_PTR_TIMER",
1067 "TDLS_DBGID_UAPSD_PTR_TIMER_TIMEOUT",
1068 "TDLS_DBGID_UAPSD_STA_PS_EVENT_HANDLER",
1069 "TDLS_DBGID_UAPSD_PEER_EVENT_HANDLER",
1070 "TDLS_DBGID_UAPSD_PS_DEFAULT_SETTINGS",
1071 "TDLS_DBGID_UAPSD_GENERIC",
1072 },
1073 { /* HB */
1074 "WLAN_HB_DBGID_DEFINITION_START",
1075 "WLAN_HB_DBGID_INIT",
1076 "WLAN_HB_DBGID_TCP_GET_TXBUF_FAIL",
1077 "WLAN_HB_DBGID_TCP_SEND_FAIL",
1078 "WLAN_HB_DBGID_BSS_PEER_NULL",
1079 "WLAN_HB_DBGID_UDP_GET_TXBUF_FAIL",
1080 "WLAN_HB_DBGID_UDP_SEND_FAIL",
1081 "WLAN_HB_DBGID_WMI_CMD_INVALID_PARAM",
1082 "WLAN_HB_DBGID_WMI_CMD_INVALID_OP",
1083 "WLAN_HB_DBGID_WOW_NOT_ENTERED",
1084 "WLAN_HB_DBGID_ALLOC_SESS_FAIL",
1085 "WLAN_HB_DBGID_CTX_NULL",
1086 "WLAN_HB_DBGID_CHKSUM_ERR",
1087 "WLAN_HB_DBGID_UDP_TX",
1088 "WLAN_HB_DBGID_TCP_TX",
1089 "WLAN_HB_DBGID_DEFINITION_END",
1090 },
1091 { /* TXBF */
1092 "TXBFEE_DBGID_START",
1093 "TXBFEE_DBGID_NDPA_RECEIVED",
1094 "TXBFEE_DBGID_HOST_CONFIG_TXBFEE_TYPE",
1095 "TXBFER_DBGID_SEND_NDPA",
1096 "TXBFER_DBGID_GET_NDPA_BUF_FAIL",
1097 "TXBFER_DBGID_SEND_NDPA_FAIL",
1098 "TXBFER_DBGID_GET_NDP_BUF_FAIL",
1099 "TXBFER_DBGID_SEND_NDP_FAIL",
1100 "TXBFER_DBGID_GET_BRPOLL_BUF_FAIL",
1101 "TXBFER_DBGID_SEND_BRPOLL_FAIL",
1102 "TXBFER_DBGID_HOST_CONFIG_CMDID",
1103 "TXBFEE_DBGID_HOST_CONFIG_CMDID",
1104 "TXBFEE_DBGID_ENABLED_ENABLED_UPLOAD_H",
1105 "TXBFEE_DBGID_UPLOADH_CV_TAG",
1106 "TXBFEE_DBGID_UPLOADH_H_TAG",
1107 "TXBFEE_DBGID_CAPTUREH_RECEIVED",
1108 "TXBFEE_DBGID_PACKET_IS_STEERED",
1109 "TXBFEE_UPLOADH_EVENT_ALLOC_MEM_FAIL",
1110 "TXBFEE_DBGID_END",
1111 },
1112 { /*BATCH SCAN */
1113 },
1114 { /*THERMAL MGR */
1115 "THERMAL_MGR_DBGID_DEFINITION_START",
1116 "THERMAL_MGR_NEW_THRESH",
1117 "THERMAL_MGR_THRESH_CROSSED",
1118 "THERMAL_MGR_DBGID_DEFINITION END",
1119 },
1120 { /* WLAN_MODULE_PHYERR_DFS */
1121 ""
1122 },
1123 {
1124 /* WLAN_MODULE_RMC */
1125 "RMC_DBGID_DEFINITION_START",
1126 "RMC_CREATE_INSTANCE",
1127 "RMC_DELETE_INSTANCE",
1128 "RMC_LDR_SEL",
1129 "RMC_NO_LDR",
1130 "RMC_LDR_NOT_SEL",
1131 "RMC_LDR_INF_SENT",
1132 "RMC_PEER_ADD",
1133 "RMC_PEER_DELETE",
1134 "RMC_PEER_UNKNOWN",
1135 "RMC_SET_MODE",
1136 "RMC_SET_ACTION_PERIOD",
1137 "RMC_ACRION_FRAME_RX",
1138 "RMC_DBGID_DEFINITION_END",
1139 },
1140 {
1141 /* WLAN_MODULE_STATS */
1142 "WLAN_STATS_DBGID_DEFINITION_START",
1143 "WLAN_STATS_DBGID_EST_LINKSPEED_VDEV_EN_DIS",
1144 "WLAN_STATS_DBGID_EST_LINKSPEED_CHAN_TIME_START",
1145 "WLAN_STATS_DBGID_EST_LINKSPEED_CHAN_TIME_END",
1146 "WLAN_STATS_DBGID_EST_LINKSPEED_CALC",
1147 "WLAN_STATS_DBGID_EST_LINKSPEED_UPDATE_HOME_CHAN",
1148 "WLAN_STATS_DBGID_DEFINITION_END",
1149 },
1150 {
1151 /* WLAN_MODULE_NAN */
1152 },
1153 {
1154 /* WLAN_MODULE_IBSS_PWRSAVE */
1155 "IBSS_PS_DBGID_DEFINITION_START",
1156 "IBSS_PS_DBGID_PEER_CREATE",
1157 "IBSS_PS_DBGID_PEER_DELETE",
1158 "IBSS_PS_DBGID_VDEV_CREATE",
1159 "IBSS_PS_DBGID_VDEV_DELETE",
1160 "IBSS_PS_DBGID_VDEV_EVENT",
1161 "IBSS_PS_DBGID_PEER_EVENT",
1162 "IBSS_PS_DBGID_DELIVER_CAB",
1163 "IBSS_PS_DBGID_DELIVER_UC_DATA",
1164 "IBSS_PS_DBGID_DELIVER_UC_DATA_ERROR",
1165 "IBSS_PS_DBGID_UC_INACTIVITY_TMR_RESTART",
1166 "IBSS_PS_DBGID_MC_INACTIVITY_TMR_RESTART",
1167 "IBSS_PS_DBGID_NULL_TX_COMPLETION",
1168 "IBSS_PS_DBGID_ATIM_TIMER_START",
1169 "IBSS_PS_DBGID_UC_ATIM_SEND",
1170 "IBSS_PS_DBGID_BC_ATIM_SEND",
1171 "IBSS_PS_DBGID_UC_TIMEOUT",
1172 "IBSS_PS_DBGID_PWR_COLLAPSE_ALLOWED",
1173 "IBSS_PS_DBGID_PWR_COLLAPSE_NOT_ALLOWED",
1174 "IBSS_PS_DBGID_SET_PARAM",
1175 "IBSS_PS_DBGID_HOST_TX_PAUSE",
1176 "IBSS_PS_DBGID_HOST_TX_UNPAUSE",
1177 "IBSS_PS_DBGID_PS_DESC_BIN_HWM",
1178 "IBSS_PS_DBGID_PS_DESC_BIN_LWM",
1179 "IBSS_PS_DBGID_PS_KICKOUT_PEER",
1180 "IBSS_PS_DBGID_SET_PEER_PARAM",
1181 "IBSS_PS_DBGID_BCN_ATIM_WIN_MISMATCH",
1182 "IBSS_PS_DBGID_RX_CHAINMASK_CHANGE",
1183 },
1184 {
1185 /* HIF UART Interface DBGIDs */
1186 "HIF_UART_DBGID_START",
1187 "HIF_UART_DBGID_POWER_STATE",
1188 "HIF_UART_DBGID_TXRX_FLOW",
1189 "HIF_UART_DBGID_TXRX_CTRL_CHAR",
1190 "HIF_UART_DBGID_TXRX_BUF_DUMP",
1191 },
1192 {
1193 /* LPI */
1194 ""
1195 },
1196 {
1197 /* EXTSCAN DBGIDs */
1198 "EXTSCAN_START",
1199 "EXTSCAN_STOP",
1200 "EXTSCAN_CLEAR_ENTRY_CONTENT",
1201 "EXTSCAN_GET_FREE_ENTRY_SUCCESS",
1202 "EXTSCAN_GET_FREE_ENTRY_INCONSISTENT",
1203 "EXTSCAN_GET_FREE_ENTRY_NO_MORE_ENTRIES",
1204 "EXTSCAN_CREATE_ENTRY_SUCCESS",
1205 "EXTSCAN_CREATE_ENTRY_ERROR",
1206 "EXTSCAN_SEARCH_SCAN_ENTRY_QUEUE",
1207 "EXTSCAN_SEARCH_SCAN_ENTRY_KEY_FOUND",
1208 "EXTSCAN_SEARCH_SCAN_ENTRY_KEY_NOT_FOUND",
1209 "EXTSCAN_ADD_ENTRY",
1210 "EXTSCAN_BUCKET_SEND_OPERATION_EVENT",
1211 "EXTSCAN_BUCKET_SEND_OPERATION_EVENT_FAILED",
1212 "EXTSCAN_BUCKET_START_SCAN_CYCLE",
1213 "EXTSCAN_BUCKET_PERIODIC_TIMER",
1214 "EXTSCAN_SEND_START_STOP_EVENT",
1215 "EXTSCAN_NOTIFY_WLAN_CHANGE",
1216 "EXTSCAN_NOTIFY_WLAN_HOTLIST_MATCH",
1217 "EXTSCAN_MAIN_RECEIVED_FRAME",
1218 "EXTSCAN_MAIN_NO_SSID_IE",
1219 "EXTSCAN_MAIN_MALFORMED_FRAME",
1220 "EXTSCAN_FIND_BSSID_BY_REFERENCE",
1221 "EXTSCAN_FIND_BSSID_BY_REFERENCE_ERROR",
1222 "EXTSCAN_NOTIFY_TABLE_USAGE",
1223 "EXTSCAN_FOUND_RSSI_ENTRY",
1224 "EXTSCAN_BSSID_FOUND_RSSI_SAMPLE",
1225 "EXTSCAN_BSSID_ADDED_RSSI_SAMPLE",
1226 "EXTSCAN_BSSID_REPLACED_RSSI_SAMPLE",
1227 "EXTSCAN_BSSID_TRANSFER_CURRENT_SAMPLES",
1228 "EXTSCAN_BUCKET_PROCESS_SCAN_EVENT",
1229 "EXTSCAN_BUCKET_CANNOT_FIND_BUCKET",
1230 "EXTSCAN_START_SCAN_REQUEST_FAILED",
1231 "EXTSCAN_BUCKET_STOP_CURRENT_SCANS",
1232 "EXTSCAN_BUCKET_SCAN_STOP_REQUEST",
1233 "EXTSCAN_BUCKET_PERIODIC_TIMER_ERROR",
1234 "EXTSCAN_BUCKET_START_OPERATION",
1235 "EXTSCAN_START_INTERNAL_ERROR",
1236 "EXTSCAN_NOTIFY_HOTLIST_MATCH",
1237 "EXTSCAN_CONFIG_HOTLIST_TABLE",
1238 "EXTSCAN_CONFIG_WLAN_CHANGE_TABLE",
1239 },
1240 { /* UNIT_TEST */
1241 "UNIT_TEST_GEN",
1242 },
1243 { /* MLME */
1244 "MLME_DEBUG_CMN",
1245 "MLME_IF",
1246 "MLME_AUTH",
1247 "MLME_REASSOC",
1248 "MLME_DEAUTH",
1249 "MLME_DISASSOC",
1250 "MLME_ROAM",
1251 "MLME_RETRY",
1252 "MLME_TIMER",
1253 "MLME_FRMPARSE",
1254 },
1255 { /*SUPPLICANT */
1256 "SUPPL_INIT",
1257 "SUPPL_RECV_EAPOL",
1258 "SUPPL_RECV_EAPOL_TIMEOUT",
1259 "SUPPL_SEND_EAPOL",
1260 "SUPPL_MIC_MISMATCH",
1261 "SUPPL_FINISH",
1262 },
1263 };
1264
dbglog_module_log_enable(wmi_unified_t wmi_handle,uint32_t mod_id,bool isenable)1265 int dbglog_module_log_enable(wmi_unified_t wmi_handle, uint32_t mod_id,
1266 bool isenable)
1267 {
1268 uint32_t val = 0;
1269
1270 if (mod_id > WLAN_MODULE_ID_MAX) {
1271 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1272 ("dbglog_module_log_enable: Invalid module id %d\n",
1273 mod_id));
1274 return -EINVAL;
1275 }
1276
1277 WMI_DBGLOG_SET_MODULE_ID(val, mod_id);
1278 if (isenable) {
1279 /* set it to global module level */
1280 WMI_DBGLOG_SET_LOG_LEVEL(val, DBGLOG_INFO);
1281 } else {
1282 /* set it to ERROR level */
1283 WMI_DBGLOG_SET_LOG_LEVEL(val, DBGLOG_ERR);
1284 }
1285 wma_config_debug_module_cmd(wmi_handle, WMI_DEBUG_LOG_PARAM_LOG_LEVEL,
1286 val, NULL, 0);
1287
1288 return 0;
1289 }
1290
dbglog_vap_log_enable(wmi_unified_t wmi_handle,uint16_t vap_id,bool isenable)1291 int dbglog_vap_log_enable(wmi_unified_t wmi_handle, uint16_t vap_id,
1292 bool isenable)
1293 {
1294 if (vap_id > DBGLOG_MAX_VDEVID) {
1295 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1296 ("dbglog_vap_log_enable:Invalid vap_id %d\n",
1297 vap_id));
1298 return -EINVAL;
1299 }
1300
1301 wma_config_debug_module_cmd(wmi_handle,
1302 isenable ? WMI_DEBUG_LOG_PARAM_VDEV_ENABLE :
1303 WMI_DEBUG_LOG_PARAM_VDEV_DISABLE, vap_id,
1304 NULL, 0);
1305
1306 return 0;
1307 }
1308
dbglog_set_log_lvl(wmi_unified_t wmi_handle,DBGLOG_LOG_LVL log_lvl)1309 int dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl)
1310 {
1311 uint32_t val = 0;
1312
1313 if (log_lvl > DBGLOG_LVL_MAX) {
1314 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1315 ("dbglog_set_log_lvl:Invalid log level %d\n",
1316 log_lvl));
1317 return -EINVAL;
1318 }
1319
1320 WMI_DBGLOG_SET_MODULE_ID(val, WMI_DEBUG_LOG_MODULE_ALL);
1321 WMI_DBGLOG_SET_LOG_LEVEL(val, log_lvl);
1322 wma_config_debug_module_cmd(wmi_handle, WMI_DEBUG_LOG_PARAM_LOG_LEVEL,
1323 val, NULL, 0);
1324
1325 return 0;
1326 }
1327
dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle,uint32_t mod_log_lvl)1328 int dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_log_lvl)
1329 {
1330 /* set the global module level to log_lvl */
1331 wma_config_debug_module_cmd(wmi_handle, WMI_DEBUG_LOG_PARAM_LOG_LEVEL,
1332 mod_log_lvl, NULL, 0);
1333
1334 return 0;
1335 }
1336
dbglog_set_mod_wow_log_lvl(wmi_unified_t wmi_handle,uint32_t mod_log_lvl)1337 int dbglog_set_mod_wow_log_lvl(wmi_unified_t wmi_handle, uint32_t mod_log_lvl)
1338 {
1339 /* set the global module level to log_lvl */
1340 wma_config_debug_module_cmd(wmi_handle,
1341 WMI_DEBUG_LOG_PARAM_WOW_MOD_ENABLE_BITMAP,
1342 mod_log_lvl, NULL, 0);
1343
1344 return 0;
1345 }
1346
1347 void
dbglog_set_vap_enable_bitmap(wmi_unified_t wmi_handle,uint32_t vap_enable_bitmap)1348 dbglog_set_vap_enable_bitmap(wmi_unified_t wmi_handle,
1349 uint32_t vap_enable_bitmap)
1350 {
1351 wma_config_debug_module_cmd(wmi_handle,
1352 WMI_DEBUG_LOG_PARAM_VDEV_ENABLE_BITMAP,
1353 vap_enable_bitmap, NULL, 0);
1354 }
1355
1356 void
dbglog_set_mod_enable_bitmap(wmi_unified_t wmi_handle,uint32_t log_level,uint32_t * mod_enable_bitmap,uint32_t bitmap_len)1357 dbglog_set_mod_enable_bitmap(wmi_unified_t wmi_handle, uint32_t log_level,
1358 uint32_t *mod_enable_bitmap, uint32_t bitmap_len)
1359 {
1360 wma_config_debug_module_cmd(wmi_handle,
1361 WMI_DEBUG_LOG_PARAM_MOD_ENABLE_BITMAP,
1362 log_level, mod_enable_bitmap, bitmap_len);
1363 }
1364
dbglog_report_enable(wmi_unified_t wmi_handle,bool isenable)1365 int dbglog_report_enable(wmi_unified_t wmi_handle, bool isenable)
1366 {
1367 int bitmap[2] = { 0 };
1368
1369 if (isenable) {
1370 /* set the vap enable bitmap */
1371 dbglog_set_vap_enable_bitmap(wmi_handle, 0xFFFF);
1372 bitmap[0] = 0xFFFFFFFF;
1373 bitmap[1] = 0x1F;
1374 /* set the module level bitmap */
1375 dbglog_set_mod_enable_bitmap(wmi_handle, 0x0, bitmap, 2);
1376 } else {
1377 dbglog_set_vap_enable_bitmap(wmi_handle, bitmap[0]);
1378 dbglog_set_mod_enable_bitmap(wmi_handle, DBGLOG_LVL_MAX, bitmap,
1379 2);
1380 }
1381 return 0;
1382 }
1383
dbglog_get_msg(uint32_t moduleid,uint32_t debugid)1384 static char *dbglog_get_msg(uint32_t moduleid, uint32_t debugid)
1385 {
1386 static char unknown_str[64];
1387
1388 if (moduleid < WLAN_MODULE_ID_MAX && debugid < MAX_DBG_MSGS) {
1389 char *str = DBG_MSG_ARR[moduleid][debugid];
1390 if (str && str[0] != '\0')
1391 return str;
1392 }
1393
1394 snprintf(unknown_str, sizeof(unknown_str),
1395 "UNKNOWN %u:%u", moduleid, debugid);
1396
1397 return unknown_str;
1398 }
1399
1400 static
dbglog_printf(uint32_t timestamp,uint16_t vap_id,const char * fmt,...)1401 void dbglog_printf(uint32_t timestamp, uint16_t vap_id, const char *fmt, ...)
1402 {
1403 char buf[128];
1404 va_list ap;
1405
1406 if (vap_id < DBGLOG_MAX_VDEVID) {
1407 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1408 (DBGLOG_PRINT_PREFIX "[%u] vap-%u ", timestamp,
1409 vap_id));
1410 } else {
1411 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1412 (DBGLOG_PRINT_PREFIX "[%u] ", timestamp));
1413 }
1414
1415 va_start(ap, fmt);
1416 vsnprintf(buf, sizeof(buf), fmt, ap);
1417 va_end(ap);
1418
1419 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s\n", buf));
1420 }
1421
1422 static void
dbglog_printf_no_line_break(uint32_t timestamp,uint16_t vap_id,const char * fmt,...)1423 dbglog_printf_no_line_break(uint32_t timestamp,
1424 uint16_t vap_id, const char *fmt, ...)
1425 {
1426 char buf[128];
1427 va_list ap;
1428
1429 if (vap_id < DBGLOG_MAX_VDEVID) {
1430 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1431 (DBGLOG_PRINT_PREFIX "[%u] vap-%u ", timestamp,
1432 vap_id));
1433 } else {
1434 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1435 (DBGLOG_PRINT_PREFIX "[%u] ", timestamp));
1436 }
1437
1438 va_start(ap, fmt);
1439 vsnprintf(buf, sizeof(buf), fmt, ap);
1440 va_end(ap);
1441
1442 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s", buf));
1443 }
1444
1445 #define USE_NUMERIC 0
1446
1447 static A_BOOL
dbglog_default_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)1448 dbglog_default_print_handler(uint32_t mod_id, uint16_t vap_id, uint32_t dbg_id,
1449 uint32_t timestamp, uint16_t numargs,
1450 uint32_t *args)
1451 {
1452 int i;
1453
1454 if (vap_id < DBGLOG_MAX_VDEVID) {
1455 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1456 (DBGLOG_PRINT_PREFIX "[%u] vap-%u %s ( ",
1457 timestamp, vap_id, dbglog_get_msg(mod_id,
1458 dbg_id)));
1459 } else {
1460 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1461 (DBGLOG_PRINT_PREFIX "[%u] %s ( ", timestamp,
1462 dbglog_get_msg(mod_id, dbg_id)));
1463 }
1464
1465 for (i = 0; i < numargs; i++) {
1466 #if USE_NUMERIC
1467 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%u", args[i]));
1468 #else
1469 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%#x", args[i]));
1470 #endif
1471 if ((i + 1) < numargs) {
1472 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, (", "));
1473 }
1474 }
1475 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, (" )\n"));
1476
1477 return true;
1478 }
1479
1480 #define DBGLOG_PARSE_ARGS_STRING_LENGTH (DBGLOG_NUM_ARGS_MAX * 11 + 10)
dbglog_print_raw_data(uint32_t * buffer,uint32_t length)1481 static int dbglog_print_raw_data(uint32_t *buffer, uint32_t length)
1482 {
1483 uint32_t timestamp;
1484 uint32_t debugid;
1485 uint32_t moduleid;
1486 uint16_t numargs, curArgs;
1487 uint32_t count = 0, totalWriteLen, writeLen;
1488 char parseArgsString[DBGLOG_PARSE_ARGS_STRING_LENGTH];
1489 char *dbgidString;
1490
1491 while ((count + 1) < length) {
1492
1493 debugid = DBGLOG_GET_DBGID(buffer[count + 1]);
1494 moduleid = DBGLOG_GET_MODULEID(buffer[count + 1]);
1495 numargs = DBGLOG_GET_NUMARGS(buffer[count + 1]);
1496 timestamp = DBGLOG_GET_TIME_STAMP(buffer[count]);
1497
1498 if (moduleid < WLAN_MODULE_ID_MAX && debugid < MAX_DBG_MSGS
1499 && numargs <= DBGLOG_NUM_ARGS_MAX) {
1500
1501 OS_MEMZERO(parseArgsString, sizeof(parseArgsString));
1502 totalWriteLen = 0;
1503
1504 if (!numargs || (count + numargs + 2 > length))
1505 goto skip_args_processing;
1506
1507 for (curArgs = 0; curArgs < numargs; curArgs++) {
1508 /*
1509 * Using sprintf_s instead of sprintf,
1510 * to avoid length overflow
1511 */
1512 writeLen =
1513 snprintf(parseArgsString + totalWriteLen,
1514 DBGLOG_PARSE_ARGS_STRING_LENGTH -
1515 totalWriteLen, "%x ",
1516 buffer[count + 2 + curArgs]);
1517 totalWriteLen += writeLen;
1518 }
1519 skip_args_processing:
1520 if (debugid < MAX_DBG_MSGS) {
1521 dbgidString = DBG_MSG_ARR[moduleid][debugid];
1522 if (dbgidString) {
1523 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1524 ("fw:%s(%x %x):%s\n",
1525 dbgidString, timestamp,
1526 buffer[count + 1],
1527 parseArgsString));
1528 } else {
1529 /* host need sync with FW id */
1530 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1531 ("fw:%s:m:%x,id:%x(%x %x):%s\n",
1532 "UNKNOWN", moduleid,
1533 debugid, timestamp,
1534 buffer[count + 1],
1535 parseArgsString));
1536 }
1537 } else if (debugid ==
1538 DBGLOG_DBGID_SM_FRAMEWORK_PROXY_DBGLOG_MSG) {
1539 /* specific debugid */
1540 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1541 ("fw:%s:m:%x,id:%x(%x %x):%s\n",
1542 "DBGLOG_SM_MSG", moduleid,
1543 debugid, timestamp,
1544 buffer[count + 1],
1545 parseArgsString));
1546 } else {
1547 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1548 ("fw:%s:m:%x,id:%x(%x %x):%s\n",
1549 "UNKNOWN", moduleid, debugid,
1550 timestamp, buffer[count + 1],
1551 parseArgsString));
1552 }
1553 }
1554
1555 /* 32 bit Time stamp + 32 bit Dbg header */
1556 count += numargs + 2;
1557 }
1558
1559 return 0;
1560
1561 }
1562
1563 #ifdef WLAN_DBGLOG_DEBUGFS
1564 static int
dbglog_debugfs_raw_data(wmi_unified_t wmi_handle,const uint8_t * buf,uint32_t length,uint32_t dropped)1565 dbglog_debugfs_raw_data(wmi_unified_t wmi_handle, const uint8_t *buf,
1566 uint32_t length, uint32_t dropped)
1567 {
1568 struct fwdebug *fwlog = (struct fwdebug *)&wmi_handle->dbglog;
1569 struct dbglog_slot *slot;
1570 struct sk_buff *skb;
1571 size_t slot_len;
1572
1573 if (WARN_ON(length > ATH6KL_FWLOG_PAYLOAD_SIZE))
1574 return -ENODEV;
1575
1576 slot_len = sizeof(*slot) + ATH6KL_FWLOG_PAYLOAD_SIZE;
1577
1578 skb = alloc_skb(slot_len, GFP_KERNEL);
1579 if (!skb)
1580 return -ENOMEM;
1581
1582 slot = (struct dbglog_slot *)skb_put(skb, slot_len);
1583 slot->diag_type = (uint32_t) DIAG_TYPE_FW_DEBUG_MSG;
1584 slot->timestamp = cpu_to_le32(jiffies);
1585 slot->length = cpu_to_le32(length);
1586 slot->dropped = cpu_to_le32(dropped);
1587 memcpy(slot->payload, buf, length);
1588
1589 /* Need to pad each record to fixed length ATH6KL_FWLOG_PAYLOAD_SIZE */
1590 memset(slot->payload + length, 0, ATH6KL_FWLOG_PAYLOAD_SIZE - length);
1591
1592 spin_lock(&fwlog->fwlog_queue.lock);
1593
1594 __skb_queue_tail(&fwlog->fwlog_queue, skb);
1595
1596 complete(&fwlog->fwlog_completion);
1597
1598 /* drop oldest entries */
1599 while (skb_queue_len(&fwlog->fwlog_queue) > ATH6KL_FWLOG_MAX_ENTRIES) {
1600 skb = __skb_dequeue(&fwlog->fwlog_queue);
1601 if (skb)
1602 kfree_skb(skb);
1603 }
1604
1605 spin_unlock(&fwlog->fwlog_queue.lock);
1606
1607 return true;
1608 }
1609 #endif /* WLAN_DBGLOG_DEBUGFS */
1610
1611 /**
1612 * nl_srv_bcast_fw_logs() - Wrapper func to send bcast msgs to FW logs mcast grp
1613 * @skb: sk buffer pointer
1614 *
1615 * Sends the bcast message to FW logs multicast group with generic nl socket
1616 * if CNSS_GENL is enabled. Else, use the legacy netlink socket to send.
1617 *
1618 * Return: zero on success, error code otherwise
1619 */
nl_srv_bcast_fw_logs(struct sk_buff * skb)1620 static int nl_srv_bcast_fw_logs(struct sk_buff *skb)
1621 {
1622 #ifdef CNSS_GENL
1623 return nl_srv_bcast(skb, CLD80211_MCGRP_FW_LOGS, WLAN_NL_MSG_CNSS_DIAG);
1624 #else
1625 return nl_srv_bcast(skb);
1626 #endif
1627 }
1628
1629 /**
1630 * send_fw_diag_nl_data() - pack the data from fw diag event handler
1631 * @buffer: buffer of diag event
1632 * @len: length of the diag event
1633 * @event_type: the event type
1634 *
1635 * return: 0 if sent successfully, otherwise error code
1636 */
send_fw_diag_nl_data(const uint8_t * buffer,uint32_t len,uint32_t event_type)1637 static int send_fw_diag_nl_data(const uint8_t *buffer, uint32_t len,
1638 uint32_t event_type)
1639 {
1640 struct sk_buff *skb_out;
1641 struct nlmsghdr *nlh;
1642 int res = 0;
1643 tAniNlHdr *wnl;
1644 int radio;
1645 int msg_len;
1646
1647 if (WARN_ON(len > ATH6KL_FWLOG_PAYLOAD_SIZE))
1648 return -ENODEV;
1649
1650 if (nl_srv_is_initialized() != 0)
1651 return -EIO;
1652
1653 radio = cds_get_radio_index();
1654 if (radio == -EINVAL)
1655 return -EIO;
1656
1657 if (cds_is_multicast_logging()) {
1658 msg_len = len + sizeof(radio);
1659 skb_out = nlmsg_new(msg_len, GFP_KERNEL);
1660 if (!skb_out) {
1661 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1662 ("Failed to allocate new skb\n"));
1663 return -ENOMEM;
1664 }
1665 nlh = nlmsg_put(skb_out, 0, 0, WLAN_NL_MSG_CNSS_DIAG, msg_len,
1666 0);
1667 if (!nlh) {
1668 kfree_skb(skb_out);
1669 return -EMSGSIZE;
1670 }
1671 wnl = (tAniNlHdr *)nlh;
1672 wnl->radio = radio;
1673
1674 /* data buffer offset from nlmsg_hdr + sizeof(int) radio */
1675 memcpy(nlmsg_data(nlh) + sizeof(radio), buffer, len);
1676
1677 res = nl_srv_bcast_fw_logs(skb_out);
1678 if ((res < 0) && (res != -ESRCH)) {
1679 AR_DEBUG_PRINTF(ATH_DEBUG_RSVD1,
1680 ("%s: nl_srv_bcast_fw_logs failed 0x%x\n",
1681 __func__, res));
1682 return res;
1683 }
1684 }
1685 return res;
1686 }
1687
1688 /**
1689 * process_fw_diag_event_data() - process diag events and fw messages
1690 * @datap: data to be processed
1691 * @num_data: number of data chunks
1692 *
1693 * return: success
1694 */
1695 static int
process_fw_diag_event_data(uint8_t * datap,uint32_t num_data)1696 process_fw_diag_event_data(uint8_t *datap, uint32_t num_data)
1697 {
1698 uint32_t diag_type;
1699 uint32_t nl_data_len; /* diag hdr + payload */
1700 uint32_t diag_data_len; /* each fw diag payload */
1701 struct wlan_diag_data *diag_data;
1702
1703 while (num_data >= sizeof(struct wlan_diag_data)) {
1704 diag_data = (struct wlan_diag_data *)datap;
1705 diag_type = WLAN_DIAG_0_TYPE_GET(diag_data->word0);
1706 diag_data_len = WLAN_DIAG_0_LEN_GET(diag_data->word0);
1707 /* Length of diag struct and len of payload */
1708 nl_data_len = sizeof(struct wlan_diag_data) + diag_data_len;
1709 if (nl_data_len > num_data) {
1710 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
1711 ("processed all the messages\n"));
1712 return 0;
1713 }
1714
1715 switch (diag_type) {
1716 case DIAG_TYPE_FW_EVENT:
1717 return send_fw_diag_nl_data(datap, nl_data_len,
1718 diag_type);
1719 break;
1720 case DIAG_TYPE_FW_LOG:
1721 return send_fw_diag_nl_data(datap, nl_data_len,
1722 diag_type);
1723 break;
1724 }
1725 /* Move to the next event and send to cnss-diag */
1726 datap += nl_data_len;
1727 num_data -= nl_data_len;
1728 }
1729
1730 return 0;
1731 }
1732
1733 static int
send_diag_netlink_data(const uint8_t * buffer,uint32_t len,uint32_t cmd)1734 send_diag_netlink_data(const uint8_t *buffer, uint32_t len, uint32_t cmd)
1735 {
1736 struct sk_buff *skb_out;
1737 struct nlmsghdr *nlh;
1738 int res = 0;
1739 struct dbglog_slot *slot;
1740 size_t slot_len;
1741 tAniNlHdr *wnl;
1742 int radio;
1743
1744 if (WARN_ON(len > ATH6KL_FWLOG_PAYLOAD_SIZE))
1745 return -ENODEV;
1746
1747 if (nl_srv_is_initialized() != 0)
1748 return -EIO;
1749
1750 radio = cds_get_radio_index();
1751 if (radio == -EINVAL)
1752 return -EIO;
1753
1754 if (cds_is_multicast_logging()) {
1755 slot_len = sizeof(*slot) + ATH6KL_FWLOG_PAYLOAD_SIZE +
1756 sizeof(radio);
1757
1758 skb_out = nlmsg_new(slot_len, GFP_ATOMIC);
1759 if (!skb_out) {
1760 diag_err_rl("Failed to allocate new skb");
1761 return A_ERROR;
1762 }
1763
1764 nlh = nlmsg_put(skb_out, 0, 0, WLAN_NL_MSG_CNSS_DIAG,
1765 slot_len, 0);
1766 if (!nlh) {
1767 kfree_skb(skb_out);
1768 return -EMSGSIZE;
1769 }
1770 wnl = (tAniNlHdr *)nlh;
1771 wnl->radio = radio;
1772 /* data buffer offset from: nlmsg_hdr + sizeof(int) radio */
1773 slot = (struct dbglog_slot *) (nlmsg_data(nlh) + sizeof(radio));
1774 slot->diag_type = cmd;
1775 slot->timestamp = cpu_to_le32(jiffies);
1776 slot->length = cpu_to_le32(len);
1777 /* Version mapped to get_version here */
1778 slot->dropped = get_version;
1779 memcpy(slot->payload, buffer, len);
1780
1781 /*
1782 * Need to pad each record to fixed length
1783 * ATH6KL_FWLOG_PAYLOAD_SIZE
1784 */
1785 memset(slot->payload + len, 0, ATH6KL_FWLOG_PAYLOAD_SIZE - len);
1786
1787 res = nl_srv_bcast_fw_logs(skb_out);
1788 if ((res < 0) && (res != -ESRCH)) {
1789 AR_DEBUG_PRINTF(ATH_DEBUG_RSVD1,
1790 ("%s: nl_srv_bcast_fw_logs failed 0x%x\n",
1791 __func__, res));
1792 return res;
1793 }
1794 }
1795 return res;
1796 }
1797
1798 static int
dbglog_process_netlink_data(wmi_unified_t wmi_handle,const uint8_t * buffer,uint32_t len,uint32_t dropped)1799 dbglog_process_netlink_data(wmi_unified_t wmi_handle, const uint8_t *buffer,
1800 uint32_t len, uint32_t dropped)
1801 {
1802 struct sk_buff *skb_out;
1803 struct nlmsghdr *nlh;
1804 int res = 0;
1805 struct dbglog_slot *slot;
1806 size_t slot_len;
1807 tAniNlHdr *wnl;
1808 int radio;
1809
1810 if (WARN_ON(len > ATH6KL_FWLOG_PAYLOAD_SIZE))
1811 return -ENODEV;
1812
1813 if (nl_srv_is_initialized() != 0)
1814 return -EIO;
1815
1816 radio = cds_get_radio_index();
1817 if (radio == -EINVAL)
1818 return -EIO;
1819
1820 if (cds_is_multicast_logging()) {
1821 slot_len = sizeof(*slot) + ATH6KL_FWLOG_PAYLOAD_SIZE +
1822 sizeof(radio);
1823
1824 skb_out = nlmsg_new(slot_len, GFP_KERNEL);
1825 if (!skb_out) {
1826 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1827 ("Failed to allocate new skb\n"));
1828 return A_ERROR;
1829 }
1830
1831 nlh = nlmsg_put(skb_out, 0, 0, WLAN_NL_MSG_CNSS_DIAG,
1832 slot_len, 0);
1833 if (!nlh) {
1834 kfree_skb(skb_out);
1835 return -EMSGSIZE;
1836 }
1837 wnl = (tAniNlHdr *)nlh;
1838 wnl->radio = radio;
1839 /* data buffer offset from: nlmsg_hdr + sizeof(int) radio */
1840 slot = (struct dbglog_slot *) (nlmsg_data(nlh) + sizeof(radio));
1841 slot->diag_type = (uint32_t) DIAG_TYPE_FW_DEBUG_MSG;
1842 slot->timestamp = cpu_to_le32(jiffies);
1843 slot->length = cpu_to_le32(len);
1844 slot->dropped = cpu_to_le32(dropped);
1845 memcpy(slot->payload, buffer, len);
1846
1847 /*
1848 * Need to pad each record to fixed length
1849 * ATH6KL_FWLOG_PAYLOAD_SIZE
1850 */
1851 memset(slot->payload + len, 0, ATH6KL_FWLOG_PAYLOAD_SIZE - len);
1852
1853 res = nl_srv_bcast_fw_logs(skb_out);
1854 if ((res < 0) && (res != -ESRCH)) {
1855 AR_DEBUG_PRINTF(ATH_DEBUG_RSVD1,
1856 ("%s: nl_srv_bcast_fw_logs failed 0x%x\n",
1857 __func__, res));
1858 return res;
1859 }
1860 }
1861 return res;
1862 }
1863
1864 /*
1865 * WMI diag data event handler, this function invoked as a CB
1866 * when there DIAG_EVENT, DIAG_MSG, DIAG_DBG to be
1867 * forwarded from the FW. This is the new implementation for
1868 * replacement of fw_dbg and dbg messages
1869 */
1870
diag_fw_handler(ol_scn_t scn,uint8_t * data,uint32_t datalen)1871 static int diag_fw_handler(ol_scn_t scn, uint8_t *data, uint32_t datalen)
1872 {
1873
1874 tp_wma_handle wma = (tp_wma_handle) scn;
1875 WMI_DIAG_EVENTID_param_tlvs *param_buf;
1876 uint8_t *datap;
1877 uint32_t len = 0;
1878 uint32_t *buffer;
1879
1880 if (!wma) {
1881 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("NULL Pointer assigned\n"));
1882 return A_ERROR;
1883 }
1884 /* when fw assert occurs,host can't use TLV format. */
1885 if (wma->is_fw_assert) {
1886 datap = data;
1887 len = datalen;
1888 wma->is_fw_assert = 0;
1889 } else {
1890 param_buf = (WMI_DIAG_EVENTID_param_tlvs *) data;
1891 if (!param_buf) {
1892 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1893 ("Get NULL point message from FW\n"));
1894 return A_ERROR;
1895 }
1896
1897 datap = param_buf->bufp;
1898 len = param_buf->num_bufp;
1899
1900 if (!get_version) {
1901 if (len < 2*(sizeof(uint32_t))) {
1902 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1903 ("len is less than expected\n"));
1904 return A_ERROR;
1905 }
1906 buffer = (uint32_t *) datap;
1907 buffer++; /* skip offset */
1908 if (WLAN_DIAG_TYPE_CONFIG == DIAG_GET_TYPE(*buffer)) {
1909 if (len < 3*(sizeof(uint32_t))) {
1910 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1911 ("len is less than expected\n"));
1912 return A_ERROR;
1913 }
1914 buffer++; /* skip */
1915 if (DIAG_VERSION_INFO == DIAG_GET_ID(*buffer)) {
1916 if (len < 4*(sizeof(uint32_t))) {
1917 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1918 ("len is less than expected\n"));
1919 return A_ERROR;
1920 }
1921 buffer++; /* skip */
1922 /* get payload */
1923 get_version = *buffer;
1924 }
1925 }
1926 }
1927 }
1928 if (dbglog_process_type == DBGLOG_PROCESS_PRINT_RAW) {
1929 if (!gprint_limiter) {
1930 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1931 ("NOT Supported only supports net link socket\n"));
1932 gprint_limiter = true;
1933 }
1934 return 0;
1935 }
1936
1937 if (dbglog_process_type == DBGLOG_PROCESS_NET_RAW) {
1938 return send_diag_netlink_data((uint8_t *) datap,
1939 len, DIAG_TYPE_FW_MSG);
1940 }
1941 #ifdef WLAN_DBGLOG_DEBUGFS
1942 if (dbglog_process_type == DBGLOG_PROCESS_POOL_RAW) {
1943 if (!gprint_limiter) {
1944 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1945 ("NOT Supported only supports net link socket\n"));
1946 gprint_limiter = true;
1947 }
1948 return 0;
1949 }
1950 #endif /* WLAN_DBGLOG_DEBUGFS */
1951 if (!gprint_limiter) {
1952 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1953 ("NOT Supported only supports net link socket\n"));
1954 gprint_limiter = true;
1955 }
1956 /* Always returns zero */
1957 return 0;
1958 }
1959
1960 /*
1961 * WMI diag data event handler, this function invoked as a CB
1962 * when there DIAG_DATA to be forwarded from the FW.
1963 */
1964 static int
fw_diag_data_event_handler(ol_scn_t scn,uint8_t * data,uint32_t datalen)1965 fw_diag_data_event_handler(ol_scn_t scn, uint8_t *data, uint32_t datalen)
1966 {
1967
1968 WMI_DIAG_DATA_CONTAINER_EVENTID_param_tlvs *param_buf;
1969 uint8_t *datap;
1970 uint32_t num_data; /* Total events */
1971
1972 param_buf = (WMI_DIAG_DATA_CONTAINER_EVENTID_param_tlvs *) data;
1973 if (!param_buf) {
1974 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
1975 ("Got NULL point message from FW\n"));
1976 return A_ERROR;
1977 }
1978
1979 num_data = param_buf->num_bufp;
1980
1981 datap = (uint8_t *) param_buf->bufp;
1982
1983 return process_fw_diag_event_data(datap, num_data);
1984 }
1985
dbglog_parse_debug_logs(ol_scn_t scn,uint8_t * data,uint32_t datalen)1986 int dbglog_parse_debug_logs(ol_scn_t scn, uint8_t *data, uint32_t datalen)
1987 {
1988 tp_wma_handle wma = (tp_wma_handle) scn;
1989 uint32_t count;
1990 uint32_t *buffer;
1991 uint32_t timestamp;
1992 uint32_t debugid;
1993 uint32_t moduleid;
1994 uint16_t vapid;
1995 uint16_t numargs;
1996 qdf_size_t length;
1997 uint32_t dropped;
1998 WMI_DEBUG_MESG_EVENTID_param_tlvs *param_buf;
1999 uint8_t *datap;
2000 uint32_t len;
2001
2002 if (!wma) {
2003 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("NULL Pointer assigned\n"));
2004 return A_ERROR;
2005 }
2006 /*when fw assert occurs,host can't use TLV format. */
2007 if (wma->is_fw_assert) {
2008 datap = data;
2009 len = datalen;
2010 wma->is_fw_assert = 0;
2011 } else {
2012 param_buf = (WMI_DEBUG_MESG_EVENTID_param_tlvs *) data;
2013 if (!param_buf) {
2014 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
2015 ("Get NULL point message from FW\n"));
2016 return A_ERROR;
2017 }
2018
2019 datap = param_buf->bufp;
2020 len = param_buf->num_bufp;
2021 }
2022
2023 if (len < sizeof(dropped)) {
2024 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Invalid length\n"));
2025 return A_ERROR;
2026 }
2027
2028 dropped = *((uint32_t *) datap);
2029 if (dropped > 0) {
2030 AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
2031 ("%d log buffers are dropped\n", dropped));
2032 }
2033 datap += sizeof(dropped);
2034 len -= sizeof(dropped);
2035
2036 count = 0;
2037 buffer = (uint32_t *) datap;
2038 length = (len >> 2);
2039
2040 if (dbglog_process_type == DBGLOG_PROCESS_PRINT_RAW)
2041 return dbglog_print_raw_data(buffer, length);
2042
2043 if (dbglog_process_type == DBGLOG_PROCESS_NET_RAW) {
2044 return dbglog_process_netlink_data((wmi_unified_t) wma->
2045 wmi_handle,
2046 (uint8_t *) buffer,
2047 len, dropped);
2048 }
2049 #ifdef WLAN_DBGLOG_DEBUGFS
2050 if (dbglog_process_type == DBGLOG_PROCESS_POOL_RAW) {
2051 return dbglog_debugfs_raw_data((wmi_unified_t) wma->wmi_handle,
2052 (uint8_t *) buffer, len,
2053 dropped);
2054 }
2055 #endif /* WLAN_DBGLOG_DEBUGFS */
2056
2057 while ((count + 2) < length) {
2058 timestamp = DBGLOG_GET_TIME_STAMP(buffer[count]);
2059 debugid = DBGLOG_GET_DBGID(buffer[count + 1]);
2060 moduleid = DBGLOG_GET_MODULEID(buffer[count + 1]);
2061 vapid = DBGLOG_GET_VDEVID(buffer[count + 1]);
2062 numargs = DBGLOG_GET_NUMARGS(buffer[count + 1]);
2063
2064 if ((count + 2 + numargs) > length)
2065 return A_OK;
2066
2067 if (moduleid >= WLAN_MODULE_ID_MAX)
2068 return A_OK;
2069
2070 if (!mod_print[moduleid]) {
2071 /*
2072 * No module specific log registered
2073 * use the default handler
2074 */
2075 dbglog_default_print_handler(moduleid, vapid, debugid,
2076 timestamp, numargs,
2077 (((uint32_t *) buffer) +
2078 2 + count));
2079 } else {
2080 if (!(mod_print[moduleid](moduleid, vapid, debugid,
2081 timestamp, numargs,
2082 (((uint32_t *) buffer) +
2083 2 + count)))) {
2084 /*
2085 * The message is not handled
2086 * by the module specific handler
2087 */
2088 dbglog_default_print_handler(moduleid, vapid,
2089 debugid, timestamp,
2090 numargs,
2091 (((uint32_t *)
2092 buffer) + 2 +
2093 count));
2094
2095 }
2096 }
2097
2098 /* 32 bit Time stamp + 32 bit Dbg header */
2099 count += numargs + 2;
2100 }
2101 /* Always returns zero */
2102 return A_OK;
2103 }
2104
dbglog_reg_modprint(uint32_t mod_id,module_dbg_print printfn)2105 void dbglog_reg_modprint(uint32_t mod_id, module_dbg_print printfn)
2106 {
2107 if (!mod_print[mod_id]) {
2108 mod_print[mod_id] = printfn;
2109 } else {
2110 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
2111 ("module print is already registered for this module %d\n",
2112 mod_id));
2113 }
2114 }
2115
2116 static void
dbglog_sm_print(uint32_t timestamp,uint16_t vap_id,uint16_t numargs,uint32_t * args,const char * module_prefix,const char * const states[],uint32_t num_states,const char * const events[],uint32_t num_events)2117 dbglog_sm_print(uint32_t timestamp,
2118 uint16_t vap_id,
2119 uint16_t numargs,
2120 uint32_t *args,
2121 const char *module_prefix,
2122 const char *const states[], uint32_t num_states,
2123 const char *const events[], uint32_t num_events)
2124 {
2125 uint8_t type, arg1, arg2, arg3;
2126 uint32_t extra, extra2, extra3;
2127
2128 if (numargs != 4)
2129 return;
2130
2131 type = (args[0] >> 24) & 0xff;
2132 arg1 = (args[0] >> 16) & 0xff;
2133 arg2 = (args[0] >> 8) & 0xff;
2134 arg3 = (args[0] >> 0) & 0xff;
2135
2136 extra = args[1];
2137 extra2 = args[2];
2138 extra3 = args[3];
2139
2140 switch (type) {
2141 case 0: /* state transition */
2142 if (arg1 < num_states && arg2 < num_states) {
2143 dbglog_printf(timestamp, vap_id,
2144 "%s: %s => %s (%#x, %#x, %#x)",
2145 module_prefix, states[arg1], states[arg2],
2146 extra, extra2, extra3);
2147 } else {
2148 dbglog_printf(timestamp, vap_id,
2149 "%s: %u => %u (%#x, %#x, %#x)",
2150 module_prefix, arg1, arg2, extra, extra2,
2151 extra3);
2152 }
2153 break;
2154 case 1: /* dispatch event */
2155 if (arg1 < num_states && arg2 < num_events) {
2156 dbglog_printf(timestamp, vap_id,
2157 "%s: %s < %s (%#x, %#x, %#x)",
2158 module_prefix, states[arg1], events[arg2],
2159 extra, extra2, extra3);
2160 } else {
2161 dbglog_printf(timestamp, vap_id,
2162 "%s: %u < %u (%#x, %#x, %#x)",
2163 module_prefix, arg1, arg2, extra, extra2,
2164 extra3);
2165 }
2166 break;
2167 case 2: /* warning */
2168 switch (arg1) {
2169 case 0: /* unhandled event */
2170 if (arg2 < num_states && arg3 < num_events) {
2171 dbglog_printf(timestamp, vap_id,
2172 "%s: unhandled event %s in state %s (%#x, %#x, %#x)",
2173 module_prefix, events[arg3],
2174 states[arg2], extra, extra2,
2175 extra3);
2176 } else {
2177 dbglog_printf(timestamp, vap_id,
2178 "%s: unhandled event %u in state %u (%#x, %#x, %#x)",
2179 module_prefix, arg3, arg2, extra,
2180 extra2, extra3);
2181 }
2182 break;
2183 default:
2184 break;
2185
2186 }
2187 break;
2188 }
2189 }
2190
2191 static A_BOOL
dbglog_sta_powersave_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)2192 dbglog_sta_powersave_print_handler(uint32_t mod_id,
2193 uint16_t vap_id,
2194 uint32_t dbg_id,
2195 uint32_t timestamp,
2196 uint16_t numargs, uint32_t *args)
2197 {
2198 static const char *const states[] = {
2199 "IDLE",
2200 "ACTIVE",
2201 "SLEEP_TXQ_FLUSH",
2202 "SLEEP_TX_SENT",
2203 "PAUSE",
2204 "SLEEP_DOZE",
2205 "SLEEP_AWAKE",
2206 "ACTIVE_TXQ_FLUSH",
2207 "ACTIVE_TX_SENT",
2208 "PAUSE_TXQ_FLUSH",
2209 "PAUSE_TX_SENT",
2210 "IDLE_TXQ_FLUSH",
2211 "IDLE_TX_SENT",
2212 };
2213
2214 static const char *const events[] = {
2215 "START",
2216 "STOP",
2217 "PAUSE",
2218 "UNPAUSE",
2219 "TIM",
2220 "DTIM",
2221 "SEND_COMPLETE",
2222 "PRE_SEND",
2223 "RX",
2224 "HWQ_EMPTY",
2225 "PAUSE_TIMEOUT",
2226 "TXRX_INACTIVITY_TIMEOUT",
2227 "PSPOLL_TIMEOUT",
2228 "UAPSD_TIMEOUT",
2229 "DELAYED_SLEEP_TIMEOUT",
2230 "SEND_N_COMPLETE",
2231 "TIDQ_PAUSE_COMPLETE",
2232 "SEND_PSPOLL",
2233 "SEND_SPEC_PSPOLL",
2234 };
2235
2236 switch (dbg_id) {
2237 case DBGLOG_DBGID_SM_FRAMEWORK_PROXY_DBGLOG_MSG:
2238 dbglog_sm_print(timestamp, vap_id, numargs, args, "STA PS",
2239 states, QDF_ARRAY_SIZE(states), events,
2240 QDF_ARRAY_SIZE(events));
2241 break;
2242 case PS_STA_PM_ARB_REQUEST:
2243 if (numargs == 4) {
2244 dbglog_printf(timestamp, vap_id,
2245 "PM ARB request flags=%x, last_time=%x %s: %s",
2246 args[1], args[2],
2247 dbglog_get_module_str(args[0]),
2248 args[3] ? "SLEEP" : "WAKE");
2249 }
2250 break;
2251 case PS_STA_DELIVER_EVENT:
2252 if (numargs == 2) {
2253 dbglog_printf(timestamp, vap_id, "STA PS: %s %s",
2254 (args[0] == 0 ? "PAUSE_COMPLETE" :
2255 (args[0] == 1 ? "UNPAUSE_COMPLETE" :
2256 (args[0] == 2 ? "SLEEP" :
2257 (args[0] ==
2258 3 ? "AWAKE" : "UNKNOWN")))),
2259 (args[1] ==
2260 0 ? "SUCCESS" : (args[1] ==
2261 1 ? "TXQ_FLUSH_TIMEOUT"
2262 : (args[1] ==
2263 2 ? "NO_ACK"
2264 : (args[1] ==
2265 3 ?
2266 "RX_LEAK_TIMEOUT"
2267 : (args[1] ==
2268 4 ?
2269 "PSPOLL_UAPSD_BUSY_TIMEOUT"
2270 :
2271 "UNKNOWN"))))));
2272 }
2273 break;
2274 case PS_STA_PSPOLL_SEQ_DONE:
2275 if (numargs == 5) {
2276 dbglog_printf(timestamp, vap_id,
2277 "STA PS poll: queue=%u comp=%u rsp=%u rsp_dur=%u fc=%x qos=%x %s",
2278 args[0], args[1], args[2], args[3],
2279 (args[4] >> 16) & 0xffff,
2280 (args[4] >> 8) & 0xff,
2281 (args[4] & 0xff) ==
2282 0 ? "SUCCESS" : (args[4] & 0xff) ==
2283 1 ? "NO_ACK" : (args[4] & 0xff) ==
2284 2 ? "DROPPED" : (args[4] & 0xff) ==
2285 3 ? "FILTERED" : (args[4] & 0xff) ==
2286 4 ? "RSP_TIMEOUT" : "UNKNOWN");
2287 }
2288 break;
2289 case PS_STA_COEX_MODE:
2290 if (numargs == 1) {
2291 dbglog_printf(timestamp, vap_id, "STA PS COEX MODE %s",
2292 args[0] ? "ENABLED" : "DISABLED");
2293 }
2294 break;
2295 case PS_STA_PSPOLL_ALLOW:
2296 if (numargs == 3) {
2297 dbglog_printf(timestamp, vap_id,
2298 "STA PS-Poll %s flags=%x time=%u",
2299 args[0] ? "ALLOW" : "DISALLOW", args[1],
2300 args[2]);
2301 }
2302 break;
2303 case PS_STA_SET_PARAM:
2304 if (numargs == 2) {
2305 struct {
2306 char *name;
2307 int is_time_param;
2308 } params[] = {
2309 {
2310 "MAX_SLEEP_ATTEMPTS", 0
2311 }, {
2312 "DELAYED_SLEEP", 1
2313 }, {
2314 "TXRX_INACTIVITY", 1
2315 }, {
2316 "MAX_TX_BEFORE_WAKE", 0
2317 }, {
2318 "UAPSD_TIMEOUT", 1
2319 }, {
2320 "UAPSD_CONFIG", 0
2321 }, {
2322 "PSPOLL_RESPONSE_TIMEOUT", 1
2323 }, {
2324 "MAX_PSPOLL_BEFORE_WAKE", 0
2325 }, {
2326 "RX_WAKE_POLICY", 0
2327 }, {
2328 "DELAYED_PAUSE_RX_LEAK", 1
2329 }, {
2330 "TXRX_INACTIVITY_BLOCKED_RETRY", 1
2331 }, {
2332 "SPEC_WAKE_INTERVAL", 1
2333 }, {
2334 "MAX_SPEC_NODATA_PSPOLL", 0
2335 }, {
2336 "ESTIMATED_PSPOLL_RESP_TIME", 1
2337 }, {
2338 "QPOWER_MAX_PSPOLL_BEFORE_WAKE", 0
2339 }, {
2340 "QPOWER_ENABLE", 0
2341 },
2342 };
2343 uint32_t param = args[0];
2344 uint32_t value = args[1];
2345
2346 if (param < QDF_ARRAY_SIZE(params)) {
2347 if (params[param].is_time_param) {
2348 dbglog_printf(timestamp, vap_id,
2349 "STA PS SET_PARAM %s => %u (us)",
2350 params[param].name,
2351 value);
2352 } else {
2353 dbglog_printf(timestamp, vap_id,
2354 "STA PS SET_PARAM %s => %#x",
2355 params[param].name,
2356 value);
2357 }
2358 } else {
2359 dbglog_printf(timestamp, vap_id,
2360 "STA PS SET_PARAM %x => %#x",
2361 param, value);
2362 }
2363 }
2364 break;
2365 case PS_STA_SPECPOLL_TIMER_STARTED:
2366 dbglog_printf(timestamp, vap_id,
2367 "SPEC Poll Timer Started: Beacon time Remaining:%d wakeup interval:%d",
2368 args[0], args[1]);
2369 break;
2370 case PS_STA_SPECPOLL_TIMER_STOPPED:
2371 dbglog_printf(timestamp, vap_id, "SPEC Poll Timer Stopped");
2372 break;
2373 default:
2374 return false;
2375 }
2376
2377 return true;
2378 }
2379
2380 /* IBSS PS sub modules */
2381 enum wlan_ibss_ps_sub_module {
2382 WLAN_IBSS_PS_SUB_MODULE_IBSS_NW_SM = 0,
2383 WLAN_IBSS_PS_SUB_MODULE_IBSS_SELF_PS = 1,
2384 WLAN_IBSS_PS_SUB_MODULE_IBSS_PEER_PS = 2,
2385 WLAN_IBSS_PS_SUB_MODULE_MAX = 3,
2386 };
2387
2388 #define WLAN_IBSS_PS_SUB_MODULE_OFFSET 0x1E
2389
2390 static A_BOOL
dbglog_ibss_powersave_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)2391 dbglog_ibss_powersave_print_handler(uint32_t mod_id,
2392 uint16_t vap_id,
2393 uint32_t dbg_id,
2394 uint32_t timestamp,
2395 uint16_t numargs, uint32_t *args)
2396 {
2397 static const char *const nw_states[] = {
2398 "WAIT_FOR_TBTT",
2399 "ATIM_WINDOW_PRE_BCN",
2400 "ATIM_WINDOW_POST_BCN",
2401 "OUT_OF_ATIM_WINDOW",
2402 "PAUSE_PENDING",
2403 "PAUSED",
2404 };
2405
2406 static const char *const ps_states[] = {
2407 "ACTIVE",
2408 "SLEEP_TX_SEND",
2409 "SLEEP_DOZE_PAUSE_PENDING",
2410 "SLEEP_DOZE",
2411 "SLEEP_AWAKE",
2412 "ACTIVE_TX_SEND",
2413 "PAUSE_TX_SEND",
2414 "PAUSED",
2415 };
2416
2417 static const char *const peer_ps_states[] = {
2418 "ACTIVE",
2419 "SLEEP_AWAKE",
2420 "SLEEP_DOZE",
2421 "PS_UNKNOWN",
2422 };
2423
2424 static const char *const events[] = {
2425 "START",
2426 "STOP",
2427 "SWBA",
2428 "TBTT",
2429 "TX_BCN_CMP",
2430 "SEND_COMPLETE",
2431 "SEND_N_COMPLETE",
2432 "PRE_SEND",
2433 "RX",
2434 "UC_INACTIVITY_TIMEOUT",
2435 "BC_INACTIVITY_TIMEOUT",
2436 "ATIM_WINDOW_BEGIN",
2437 "ATIM_WINDOW_END",
2438 "HWQ_EMPTY",
2439 "UC_ATIM_RCVD",
2440 "TRAFFIC_EXCHANGE_DONE",
2441 "POWER_SAVE_STATE_CHANGE",
2442 "NEW_PEER_JOIN",
2443 "IBSS_VDEV_PAUSE_REQUEST",
2444 "IBSS_VDEV_PAUSE_RESPONSE",
2445 "IBSS_VDEV_PAUSE_TIMEOUT",
2446 "IBSS_VDEV_UNPAUSE_REQUEST",
2447 "PS_STATE_CHANGE",
2448 };
2449
2450 enum wlan_ibss_ps_sub_module sub_module;
2451
2452 switch (dbg_id) {
2453 case DBGLOG_DBGID_SM_FRAMEWORK_PROXY_DBGLOG_MSG:
2454 sub_module = (args[1] >> WLAN_IBSS_PS_SUB_MODULE_OFFSET) & 0x3;
2455 switch (sub_module) {
2456 case WLAN_IBSS_PS_SUB_MODULE_IBSS_NW_SM:
2457 dbglog_sm_print(timestamp, vap_id, numargs, args,
2458 "IBSS PS NW", nw_states,
2459 QDF_ARRAY_SIZE(nw_states), events,
2460 QDF_ARRAY_SIZE(events));
2461 break;
2462 case WLAN_IBSS_PS_SUB_MODULE_IBSS_SELF_PS:
2463 dbglog_sm_print(timestamp, vap_id, numargs, args,
2464 "IBSS PS Self", ps_states,
2465 QDF_ARRAY_SIZE(ps_states), events,
2466 QDF_ARRAY_SIZE(events));
2467 break;
2468 case WLAN_IBSS_PS_SUB_MODULE_IBSS_PEER_PS:
2469 dbglog_sm_print(timestamp, vap_id, numargs, args,
2470 "IBSS PS Peer", peer_ps_states,
2471 QDF_ARRAY_SIZE(peer_ps_states), events,
2472 QDF_ARRAY_SIZE(events));
2473 break;
2474 default:
2475 break;
2476 }
2477 break;
2478 case IBSS_PS_DBGID_PEER_CREATE:
2479 if (numargs == 2) {
2480 dbglog_printf(timestamp, vap_id,
2481 "IBSS PS: peer alloc failed for peer ID:%u",
2482 args[0]);
2483 } else if (numargs == 1) {
2484 dbglog_printf(timestamp, vap_id,
2485 "IBSS PS: create peer ID=%u", args[0]);
2486 }
2487 break;
2488 case IBSS_PS_DBGID_PEER_DELETE:
2489 if (numargs == 4) {
2490 dbglog_printf(timestamp, vap_id,
2491 "IBSS PS: delete peer ID=%u num_peers:%d num_sleeping_peers:%d ps_enabled_for_this_peer:%d",
2492 args[0], args[1], args[2], args[3]);
2493 }
2494 break;
2495 case IBSS_PS_DBGID_VDEV_CREATE:
2496 if (numargs == 1) {
2497 dbglog_printf(timestamp, vap_id,
2498 "IBSS PS: vdev alloc failed", args[0]);
2499 } else if (numargs == 0) {
2500 dbglog_printf(timestamp, vap_id,
2501 "IBSS PS: vdev created");
2502 }
2503 break;
2504 case IBSS_PS_DBGID_VDEV_DELETE:
2505 dbglog_printf(timestamp, vap_id, "IBSS PS: vdev deleted");
2506 break;
2507
2508 case IBSS_PS_DBGID_VDEV_EVENT:
2509 if (numargs == 1) {
2510 if (args[0] == 5) {
2511 dbglog_printf(timestamp, vap_id,
2512 "IBSS PS: vdev event for peer add");
2513 } else if (args[0] == 7) {
2514 dbglog_printf(timestamp, vap_id,
2515 "IBSS PS: vdev event for peer delete");
2516 } else {
2517 dbglog_printf(timestamp, vap_id,
2518 "IBSS PS: vdev event %u",
2519 args[0]);
2520 }
2521 }
2522 break;
2523
2524 case IBSS_PS_DBGID_PEER_EVENT:
2525 if (numargs == 4) {
2526 if (args[0] == 0xFFFF) {
2527 dbglog_printf(timestamp, vap_id,
2528 "IBSS PS: pre_send for peer:%u peer_type:%u sm_event_mask:%0x",
2529 args[1], args[3], args[2]);
2530 } else if (args[0] == 0x20000) {
2531 dbglog_printf(timestamp, vap_id,
2532 "IBSS PS: send_complete for peer:%u peer_type:%u sm_event_mask:%0x",
2533 args[1], args[3], args[2]);
2534 } else if (args[0] == 0x10) {
2535 dbglog_printf(timestamp, vap_id,
2536 "IBSS PS: send_n_complete for peer:%u peer_type:%u sm_event_mask:%0x",
2537 args[1], args[3], args[2]);
2538 } else if (args[0] == 0x40) {
2539 dbglog_printf(timestamp, vap_id,
2540 "IBSS PS: rx event for peer:%u peer_type:%u sm_event_mask:%0x",
2541 args[1], args[3], args[2]);
2542 } else if (args[0] == 0x4) {
2543 dbglog_printf(timestamp, vap_id,
2544 "IBSS PS: hw_q_empty for peer:%u peer_type:%u sm_event_mask:%0x",
2545 args[1], args[3], args[2]);
2546 }
2547 }
2548 break;
2549
2550 case IBSS_PS_DBGID_DELIVER_CAB:
2551 if (numargs == 4) {
2552 dbglog_printf(timestamp, vap_id,
2553 "IBSS PS: Deliver CAB n_mpdu:%d send_flags:%0x tid_cur:%d q_depth_for_other_tid:%d",
2554 args[0], args[1], args[2], args[3]);
2555 }
2556 break;
2557
2558 case IBSS_PS_DBGID_DELIVER_UC_DATA:
2559 if (numargs == 4) {
2560 dbglog_printf(timestamp, vap_id,
2561 "IBSS PS: Deliver UC data peer:%d tid:%d n_mpdu:%d send_flags:%0x",
2562 args[0], args[1], args[2], args[3]);
2563 }
2564 break;
2565
2566 case IBSS_PS_DBGID_DELIVER_UC_DATA_ERROR:
2567 if (numargs == 4) {
2568 dbglog_printf(timestamp, vap_id,
2569 "IBSS PS: Deliver UC data error peer:%d tid:%d allowed_tidmask:%0x, pending_tidmap:%0x",
2570 args[0], args[1], args[2], args[3]);
2571 }
2572 break;
2573
2574 case IBSS_PS_DBGID_UC_INACTIVITY_TMR_RESTART:
2575 if (numargs == 2) {
2576 dbglog_printf(timestamp, vap_id,
2577 "IBSS PS: UC timer restart peer:%d timer_val:%0x",
2578 args[0], args[1]);
2579 }
2580 break;
2581
2582 case IBSS_PS_DBGID_MC_INACTIVITY_TMR_RESTART:
2583 if (numargs == 1) {
2584 dbglog_printf(timestamp, vap_id,
2585 "IBSS PS: MC timer restart timer_val:%0x",
2586 args[0]);
2587 }
2588 break;
2589
2590 case IBSS_PS_DBGID_NULL_TX_COMPLETION:
2591 if (numargs == 3) {
2592 dbglog_printf(timestamp, vap_id,
2593 "IBSS PS: null tx completion peer:%d tx_completion_status:%d flags:%0x",
2594 args[0], args[1], args[2]);
2595 }
2596 break;
2597
2598 case IBSS_PS_DBGID_ATIM_TIMER_START:
2599 if (numargs == 4) {
2600 dbglog_printf(timestamp, vap_id,
2601 "IBSS PS: ATIM timer start tsf:%0x %0x tbtt:%0x %0x",
2602 args[0], args[1], args[2], args[3]);
2603 }
2604 break;
2605
2606 case IBSS_PS_DBGID_UC_ATIM_SEND:
2607 if (numargs == 2) {
2608 dbglog_printf(timestamp, vap_id,
2609 "IBSS PS: Send ATIM to peer:%d", args[1]);
2610 } else if (numargs == 1) {
2611 dbglog_printf(timestamp, vap_id,
2612 "IBSS PS: no peers to send UC ATIM",
2613 args[1]);
2614 }
2615 break;
2616
2617 case IBSS_PS_DBGID_BC_ATIM_SEND:
2618 if (numargs == 2) {
2619 dbglog_printf(timestamp, vap_id,
2620 "IBSS PS: MC Data, num_of_peers:%d bc_atim_sent:%d",
2621 args[1], args[0]);
2622 }
2623 break;
2624
2625 case IBSS_PS_DBGID_UC_TIMEOUT:
2626 if (numargs == 2) {
2627 dbglog_printf(timestamp, vap_id,
2628 "IBSS PS: UC timeout for peer:%d send_null:%d",
2629 args[0], args[1]);
2630 }
2631 break;
2632
2633 case IBSS_PS_DBGID_PWR_COLLAPSE_ALLOWED:
2634 dbglog_printf(timestamp, vap_id,
2635 "IBSS PS: allow power collapse");
2636 break;
2637
2638 case IBSS_PS_DBGID_PWR_COLLAPSE_NOT_ALLOWED:
2639 if (numargs == 0) {
2640 dbglog_printf(timestamp, vap_id,
2641 "IBSS PS: power collapse not allowed by INI");
2642 } else if (numargs == 1) {
2643 dbglog_printf(timestamp, vap_id,
2644 "IBSS PS: power collapse not allowed since peer id:%d is not PS capable",
2645 args[0]);
2646 } else if (numargs == 2) {
2647 dbglog_printf(timestamp, vap_id,
2648 "IBSS PS: power collapse not allowed - no peers in NW");
2649 } else if (numargs == 3) {
2650 if (args[0] == 2) {
2651 dbglog_printf(timestamp, vap_id,
2652 "IBSS PS: power collapse not allowed, non-zero qdepth %d %d",
2653 args[1], args[2]);
2654 } else if (args[0] == 3) {
2655 dbglog_printf(timestamp, vap_id,
2656 "IBSS PS: power collapse not allowed by peer:%d peer_flags:%0x",
2657 args[1], args[2]);
2658 }
2659 } else if (numargs == 5) {
2660 dbglog_printf(timestamp, vap_id,
2661 "IBSS PS: power collapse not allowed by state m/c nw_cur_state:%d nw_next_state:%d ps_cur_state:%d flags:%0x",
2662 args[1], args[2], args[3], args[4]);
2663 }
2664 break;
2665
2666 case IBSS_PS_DBGID_SET_PARAM:
2667 if (numargs == 2) {
2668 dbglog_printf(timestamp, vap_id,
2669 "IBSS PS: Set Param ID:%0x Value:%0x",
2670 args[0], args[1]);
2671 }
2672 break;
2673
2674 case IBSS_PS_DBGID_HOST_TX_PAUSE:
2675 if (numargs == 1) {
2676 dbglog_printf(timestamp, vap_id,
2677 "IBSS PS: Pausing host, vdev_map:%0x",
2678 args[0]);
2679 }
2680 break;
2681
2682 case IBSS_PS_DBGID_HOST_TX_UNPAUSE:
2683 if (numargs == 1) {
2684 dbglog_printf(timestamp, vap_id,
2685 "IBSS PS: Unpausing host, vdev_map:%0x",
2686 args[0]);
2687 }
2688 break;
2689 case IBSS_PS_DBGID_PS_DESC_BIN_LWM:
2690 if (numargs == 1) {
2691 dbglog_printf(timestamp, vap_id,
2692 "IBSS PS: LWM, vdev_map:%0x", args[0]);
2693 }
2694 break;
2695
2696 case IBSS_PS_DBGID_PS_DESC_BIN_HWM:
2697 if (numargs == 1) {
2698 dbglog_printf(timestamp, vap_id,
2699 "IBSS PS: HWM, vdev_map:%0x", args[0]);
2700 }
2701 break;
2702
2703 case IBSS_PS_DBGID_PS_KICKOUT_PEER:
2704 if (numargs == 3) {
2705 dbglog_printf(timestamp, vap_id,
2706 "IBSS PS: Kickout peer id:%d atim_fail_cnt:%d status:%d",
2707 args[0], args[1], args[2]);
2708 }
2709 break;
2710
2711 case IBSS_PS_DBGID_SET_PEER_PARAM:
2712 if (numargs == 3) {
2713 dbglog_printf(timestamp, vap_id,
2714 "IBSS PS: Set Peer Id:%d Param ID:%0x Value:%0x",
2715 args[0], args[1], args[2]);
2716 }
2717 break;
2718
2719 case IBSS_PS_DBGID_BCN_ATIM_WIN_MISMATCH:
2720 if (numargs == 4) {
2721 if (args[0] == 0xDEAD) {
2722 dbglog_printf(timestamp, vap_id,
2723 "IBSS PS: ATIM window length mismatch, our's:%d, peer id:%d, peer's:%d",
2724 args[1], args[2], args[3]);
2725 } else if (args[0] == 0xBEEF) {
2726 dbglog_printf(timestamp, vap_id,
2727 "IBSS PS: Peer ATIM window length changed, peer id:%d, peer recorded atim window:%d new atim window:%d",
2728 args[1], args[2], args[3]);
2729 }
2730 }
2731 break;
2732
2733 case IBSS_PS_DBGID_RX_CHAINMASK_CHANGE:
2734 if (numargs == 2) {
2735 if (args[1] == 0x1) {
2736 dbglog_printf(timestamp, vap_id,
2737 "IBSS PS: Voting for low power chainmask from :%d",
2738 args[0]);
2739 } else {
2740 dbglog_printf(timestamp, vap_id,
2741 "IBSS PS: Voting for high power chainmask from :%d",
2742 args[0]);
2743 }
2744 }
2745 break;
2746
2747 default:
2748 return false;
2749 }
2750
2751 return true;
2752 }
2753
2754 static
dbglog_ratectrl_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)2755 A_BOOL dbglog_ratectrl_print_handler(uint32_t mod_id,
2756 uint16_t vap_id,
2757 uint32_t dbg_id,
2758 uint32_t timestamp,
2759 uint16_t numargs, uint32_t *args)
2760 {
2761 switch (dbg_id) {
2762 case RATECTRL_DBGID_ASSOC:
2763 dbglog_printf(timestamp, vap_id,
2764 "RATE: ChainMask %d, phymode %d, ni_flags 0x%08x, vht_mcs_set 0x%04x, ht_mcs_set 0x%04x",
2765 args[0], args[1], args[2], args[3], args[4]);
2766 break;
2767 case RATECTRL_DBGID_NSS_CHANGE:
2768 dbglog_printf(timestamp, vap_id, "RATE: NEW NSS %d\n", args[0]);
2769 break;
2770 case RATECTRL_DBGID_CHAINMASK_ERR:
2771 dbglog_printf(timestamp, vap_id,
2772 "RATE: Chainmask ERR %d %d %d\n", args[0],
2773 args[1], args[2]);
2774 break;
2775 case RATECTRL_DBGID_UNEXPECTED_FRAME:
2776 dbglog_printf(timestamp, vap_id,
2777 "RATE: WARN1: rate %d flags 0x%08x\n", args[0],
2778 args[1]);
2779 break;
2780 case RATECTRL_DBGID_WAL_RCQUERY:
2781 dbglog_printf(timestamp, vap_id,
2782 "ratectrl_dbgid_wal_rcquery [rix1 %d rix2 %d rix3 %d proberix %d ppduflag 0x%x] ",
2783 args[0], args[1], args[2], args[3], args[4]);
2784 break;
2785 case RATECTRL_DBGID_WAL_RCUPDATE:
2786 dbglog_printf(timestamp, vap_id,
2787 "ratectrl_dbgid_wal_rcupdate [numelems %d ppduflag 0x%x] ",
2788 args[0], args[1]);
2789 break;
2790 case RATECTRL_DBGID_GTX_UPDATE:
2791 {
2792 switch (args[0]) {
2793 case 255:
2794 dbglog_printf(timestamp, vap_id,
2795 "GtxInitPwrCfg [bw[last %d|cur %d] rtcode 0x%x tpc %d tpc_init_pwr_cfg %d] ",
2796 args[1] >> 8, args[1] & 0xff,
2797 args[2], args[3], args[4]);
2798 break;
2799 case 254:
2800 dbglog_printf(timestamp, vap_id,
2801 "gtx_cfg_addr [RTMask0@0x%x PERThreshold@0x%x gtxTPCMin@0x%x userGtxMask@0x%x] ",
2802 args[1], args[2], args[3],
2803 args[4]);
2804 break;
2805 default:
2806 dbglog_printf(timestamp, vap_id,
2807 "gtx_update [act %d bw %d rix 0x%x tpc %d per %d lastrssi %d] ",
2808 args[0], args[1], args[2],
2809 args[3], args[4], args[5]);
2810 }
2811 }
2812 break;
2813 }
2814 return true;
2815 }
2816
2817 static
dbglog_ani_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)2818 A_BOOL dbglog_ani_print_handler(uint32_t mod_id,
2819 uint16_t vap_id,
2820 uint32_t dbg_id,
2821 uint32_t timestamp,
2822 uint16_t numargs, uint32_t *args)
2823 {
2824 switch (dbg_id) {
2825 case ANI_DBGID_ENABLE:
2826 dbglog_printf(timestamp, vap_id, "ANI Enable: %d", args[0]);
2827 break;
2828 case ANI_DBGID_POLL:
2829 dbglog_printf(timestamp, vap_id,
2830 "ANI POLLING: AccumListenTime %d ListenTime %d ofdmphyerr %d cckphyerr %d",
2831 args[0], args[1], args[2], args[3]);
2832 break;
2833 case ANI_DBGID_RESTART:
2834 dbglog_printf(timestamp, vap_id, "ANI Restart");
2835 break;
2836 case ANI_DBGID_CURRENT_LEVEL:
2837 dbglog_printf(timestamp, vap_id,
2838 "ANI CURRENT LEVEL ofdm level %d cck level %d",
2839 args[0], args[1]);
2840 break;
2841 case ANI_DBGID_OFDM_LEVEL:
2842 dbglog_printf(timestamp, vap_id,
2843 "ANI UPDATE ofdm level %d firstep %d firstep_low %d cycpwr_thr %d self_corr_low %d",
2844 args[0], args[1], args[2], args[3], args[4]);
2845 break;
2846 case ANI_DBGID_CCK_LEVEL:
2847 dbglog_printf(timestamp, vap_id,
2848 "ANI UPDATE cck level %d firstep %d firstep_low %d mrc_cck %d",
2849 args[0], args[1], args[2], args[3]);
2850 break;
2851 case ANI_DBGID_CONTROL:
2852 dbglog_printf(timestamp, vap_id,
2853 "ANI CONTROL ofdmlevel %d ccklevel %d\n",
2854 args[0]);
2855
2856 break;
2857 case ANI_DBGID_OFDM_PARAMS:
2858 dbglog_printf(timestamp, vap_id,
2859 "ANI ofdm_control firstep %d cycpwr %d\n",
2860 args[0], args[1]);
2861 break;
2862 case ANI_DBGID_CCK_PARAMS:
2863 dbglog_printf(timestamp, vap_id,
2864 "ANI cck_control mrc_cck %d barker_threshold %d\n",
2865 args[0], args[1]);
2866 break;
2867 case ANI_DBGID_RESET:
2868 dbglog_printf(timestamp, vap_id,
2869 "ANI resetting resetflag %d resetCause %8x channel index %d",
2870 args[0], args[1], args[2]);
2871 break;
2872 case ANI_DBGID_SELF_CORR_LOW:
2873 dbglog_printf(timestamp, vap_id, "ANI self_corr_low %d",
2874 args[0]);
2875 break;
2876 case ANI_DBGID_FIRSTEP:
2877 dbglog_printf(timestamp, vap_id,
2878 "ANI firstep %d firstep_low %d", args[0],
2879 args[1]);
2880 break;
2881 case ANI_DBGID_MRC_CCK:
2882 dbglog_printf(timestamp, vap_id, "ANI mrc_cck %d", args[0]);
2883 break;
2884 case ANI_DBGID_CYCPWR:
2885 dbglog_printf(timestamp, vap_id, "ANI cypwr_thresh %d",
2886 args[0]);
2887 break;
2888 case ANI_DBGID_POLL_PERIOD:
2889 dbglog_printf(timestamp, vap_id,
2890 "ANI Configure poll period to %d", args[0]);
2891 break;
2892 case ANI_DBGID_LISTEN_PERIOD:
2893 dbglog_printf(timestamp, vap_id,
2894 "ANI Configure listen period to %d", args[0]);
2895 break;
2896 case ANI_DBGID_OFDM_LEVEL_CFG:
2897 dbglog_printf(timestamp, vap_id,
2898 "ANI Configure ofdm level to %d", args[0]);
2899 break;
2900 case ANI_DBGID_CCK_LEVEL_CFG:
2901 dbglog_printf(timestamp, vap_id,
2902 "ANI Configure cck level to %d", args[0]);
2903 break;
2904 default:
2905 dbglog_printf(timestamp, vap_id, "ANI arg1 %d arg2 %d arg3 %d",
2906 args[0], args[1], args[2]);
2907 break;
2908 }
2909 return true;
2910 }
2911
2912 static A_BOOL
dbglog_ap_powersave_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)2913 dbglog_ap_powersave_print_handler(uint32_t mod_id,
2914 uint16_t vap_id,
2915 uint32_t dbg_id,
2916 uint32_t timestamp,
2917 uint16_t numargs, uint32_t *args)
2918 {
2919 switch (dbg_id) {
2920 case AP_PS_DBGID_UPDATE_TIM:
2921 if (numargs == 2) {
2922 dbglog_printf(timestamp, vap_id,
2923 "AP PS: TIM update AID=%u %s",
2924 args[0], args[1] ? "set" : "clear");
2925 }
2926 break;
2927 case AP_PS_DBGID_PEER_STATE_CHANGE:
2928 if (numargs == 2) {
2929 dbglog_printf(timestamp, vap_id,
2930 "AP PS: AID=%u power save %s",
2931 args[0],
2932 args[1] ? "enabled" : "disabled");
2933 }
2934 break;
2935 case AP_PS_DBGID_PSPOLL:
2936 if (numargs == 3) {
2937 dbglog_printf(timestamp, vap_id,
2938 "AP PS: AID=%u pspoll response tid=%u flags=%x",
2939 args[0], args[1], args[2]);
2940 }
2941 break;
2942 case AP_PS_DBGID_PEER_CREATE:
2943 if (numargs == 1) {
2944 dbglog_printf(timestamp, vap_id,
2945 "AP PS: create peer AID=%u", args[0]);
2946 }
2947 break;
2948 case AP_PS_DBGID_PEER_DELETE:
2949 if (numargs == 1) {
2950 dbglog_printf(timestamp, vap_id,
2951 "AP PS: delete peer AID=%u", args[0]);
2952 }
2953 break;
2954 case AP_PS_DBGID_VDEV_CREATE:
2955 dbglog_printf(timestamp, vap_id, "AP PS: vdev create");
2956 break;
2957 case AP_PS_DBGID_VDEV_DELETE:
2958 dbglog_printf(timestamp, vap_id, "AP PS: vdev delete");
2959 break;
2960 case AP_PS_DBGID_SYNC_TIM:
2961 if (numargs == 3) {
2962 dbglog_printf(timestamp, vap_id,
2963 "AP PS: AID=%u advertised=%#x buffered=%#x",
2964 args[0], args[1], args[2]);
2965 }
2966 break;
2967 case AP_PS_DBGID_NEXT_RESPONSE:
2968 if (numargs == 4) {
2969 dbglog_printf(timestamp, vap_id,
2970 "AP PS: AID=%u select next response %s%s%s",
2971 args[0], args[1] ? "(usp active) " : "",
2972 args[2] ? "(pending usp) " : "",
2973 args[3] ? "(pending poll response)" : "");
2974 }
2975 break;
2976 case AP_PS_DBGID_START_SP:
2977 if (numargs == 3) {
2978 dbglog_printf(timestamp, vap_id,
2979 "AP PS: AID=%u START SP tsf=%#x (%u)",
2980 args[0], args[1], args[2]);
2981 }
2982 break;
2983 case AP_PS_DBGID_COMPLETED_EOSP:
2984 if (numargs == 3) {
2985 dbglog_printf(timestamp, vap_id,
2986 "AP PS: AID=%u EOSP eosp_tsf=%#x trigger_tsf=%#x",
2987 args[0], args[1], args[2]);
2988 }
2989 break;
2990 case AP_PS_DBGID_TRIGGER:
2991 if (numargs == 4) {
2992 dbglog_printf(timestamp, vap_id,
2993 "AP PS: AID=%u TRIGGER tsf=%#x %s%s",
2994 args[0], args[1],
2995 args[2] ? "(usp active) " : "",
2996 args[3] ? "(send_n in progress)" : "");
2997 }
2998 break;
2999 case AP_PS_DBGID_DUPLICATE_TRIGGER:
3000 if (numargs == 4) {
3001 dbglog_printf(timestamp, vap_id,
3002 "AP PS: AID=%u DUP TRIGGER tsf=%#x seq=%u ac=%u",
3003 args[0], args[1], args[2], args[3]);
3004 }
3005 break;
3006 case AP_PS_DBGID_UAPSD_RESPONSE:
3007 if (numargs == 5) {
3008 dbglog_printf(timestamp, vap_id,
3009 "AP PS: AID=%u UAPSD response tid=%u, n_mpdu=%u flags=%#x max_sp=%u current_sp=%u",
3010 args[0], args[1], args[2], args[3],
3011 (args[4] >> 16) & 0xffff,
3012 args[4] & 0xffff);
3013 }
3014 break;
3015 case AP_PS_DBGID_SEND_COMPLETE:
3016 if (numargs == 5) {
3017 dbglog_printf(timestamp, vap_id,
3018 "AP PS: AID=%u SEND_COMPLETE fc=%#x qos=%#x %s%s",
3019 args[0], args[1], args[2],
3020 args[3] ? "(usp active) " : "",
3021 args[4] ? "(pending poll response)" : "");
3022 }
3023 break;
3024 case AP_PS_DBGID_SEND_N_COMPLETE:
3025 if (numargs == 3) {
3026 dbglog_printf(timestamp, vap_id,
3027 "AP PS: AID=%u SEND_N_COMPLETE %s%s",
3028 args[0],
3029 args[1] ? "(usp active) " : "",
3030 args[2] ? "(pending poll response)" : "");
3031 }
3032 break;
3033 case AP_PS_DBGID_DETECT_OUT_OF_SYNC_STA:
3034 if (numargs == 4) {
3035 dbglog_printf(timestamp, vap_id,
3036 "AP PS: AID=%u detected out-of-sync now=%u tx_waiting=%u txq_depth=%u",
3037 args[0], args[1], args[2], args[3]);
3038 }
3039 break;
3040 case AP_PS_DBGID_DELIVER_CAB:
3041 if (numargs == 4) {
3042 dbglog_printf(timestamp, vap_id,
3043 "AP PS: CAB %s n_mpdus=%u, flags=%x, extra=%u",
3044 (args[0] == 17) ? "MGMT" : "DATA",
3045 args[1], args[2], args[3]);
3046 }
3047 break;
3048 default:
3049 return false;
3050 }
3051
3052 return true;
3053 }
3054
3055 static A_BOOL
dbglog_wal_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)3056 dbglog_wal_print_handler(uint32_t mod_id,
3057 uint16_t vap_id,
3058 uint32_t dbg_id,
3059 uint32_t timestamp, uint16_t numargs, uint32_t *args)
3060 {
3061 static const char *const states[] = {
3062 "ACTIVE",
3063 "WAIT",
3064 "WAIT_FILTER",
3065 "PAUSE",
3066 "PAUSE_SEND_N",
3067 "BLOCK",
3068 };
3069
3070 static const char *const events[] = {
3071 "PAUSE",
3072 "PAUSE_FILTER",
3073 "UNPAUSE",
3074
3075 "BLOCK",
3076 "BLOCK_FILTER",
3077 "UNBLOCK",
3078
3079 "HWQ_EMPTY",
3080 "ALLOW_N",
3081 };
3082
3083 #define WAL_VDEV_TYPE(type) \
3084 (type == 0 ? "AP" : \
3085 (type == 1 ? "STA" : \
3086 (type == 2 ? "IBSS" : \
3087 (type == 2 ? "MONITOR" : \
3088 "UNKNOWN"))))
3089
3090 #define WAL_SLEEP_STATE(state) \
3091 (state == 1 ? "NETWORK SLEEP" : \
3092 (state == 2 ? "AWAKE" : \
3093 (state == 3 ? "SYSTEM SLEEP" : \
3094 "UNKNOWN")))
3095
3096 switch (dbg_id) {
3097 case DBGLOG_DBGID_SM_FRAMEWORK_PROXY_DBGLOG_MSG:
3098 dbglog_sm_print(timestamp, vap_id, numargs, args, "TID PAUSE",
3099 states, QDF_ARRAY_SIZE(states), events,
3100 QDF_ARRAY_SIZE(events));
3101 break;
3102 case WAL_DBGID_SET_POWER_STATE:
3103 if (numargs == 3) {
3104 dbglog_printf(timestamp, vap_id,
3105 "WAL %s => %s, req_count=%u",
3106 WAL_SLEEP_STATE(args[0]),
3107 WAL_SLEEP_STATE(args[1]), args[2]);
3108 }
3109 break;
3110 case WAL_DBGID_CHANNEL_CHANGE_FORCE_RESET:
3111 if (numargs == 4) {
3112 dbglog_printf(timestamp, vap_id,
3113 "WAL channel change (force reset) freq=%u, flags=%u mode=%u rx_ok=%u tx_ok=%u",
3114 args[0] & 0x0000ffff,
3115 (args[0] & 0xffff0000) >> 16, args[1],
3116 args[2], args[3]);
3117 }
3118 break;
3119 case WAL_DBGID_CHANNEL_CHANGE:
3120 if (numargs == 2) {
3121 dbglog_printf(timestamp, vap_id,
3122 "WAL channel change freq=%u, mode=%u flags=%u rx_ok=1 tx_ok=1",
3123 args[0] & 0x0000ffff,
3124 (args[0] & 0xffff0000) >> 16, args[1]);
3125 }
3126 break;
3127 case WAL_DBGID_VDEV_START:
3128 if (numargs == 1) {
3129 dbglog_printf(timestamp, vap_id, "WAL %s vdev started",
3130 WAL_VDEV_TYPE(args[0]));
3131 }
3132 break;
3133 case WAL_DBGID_VDEV_STOP:
3134 dbglog_printf(timestamp, vap_id, "WAL %s vdev stopped",
3135 WAL_VDEV_TYPE(args[0]));
3136 break;
3137 case WAL_DBGID_VDEV_UP:
3138 dbglog_printf(timestamp, vap_id, "WAL %s vdev up, count=%u",
3139 WAL_VDEV_TYPE(args[0]), args[1]);
3140 break;
3141 case WAL_DBGID_VDEV_DOWN:
3142 dbglog_printf(timestamp, vap_id, "WAL %s vdev down, count=%u",
3143 WAL_VDEV_TYPE(args[0]), args[1]);
3144 break;
3145 case WAL_DBGID_TX_MGMT_DESCID_SEQ_TYPE_LEN:
3146 dbglog_printf(timestamp, vap_id,
3147 "WAL Tx Mgmt frame desc_id=0x%x, seq=0x%x, type=0x%x, len=0x%x islocal=0x%x",
3148 args[0], args[1], args[2],
3149 (args[3] & 0xffff0000) >> 16,
3150 args[3] & 0x0000ffff);
3151 break;
3152 case WAL_DBGID_TX_MGMT_COMP_DESCID_STATUS:
3153 dbglog_printf(timestamp, vap_id,
3154 "WAL Tx Mgmt frame completion desc_id=0x%x, status=0x%x, islocal=0x%x",
3155 args[0], args[1], args[2]);
3156 break;
3157 case WAL_DBGID_TX_DATA_MSDUID_SEQ_TYPE_LEN:
3158 dbglog_printf(timestamp, vap_id,
3159 "WAL Tx Data frame msdu_id=0x%x, seq=0x%x, type=0x%x, len=0x%x",
3160 args[0], args[1], args[2], args[3]);
3161 break;
3162 case WAL_DBGID_TX_DATA_COMP_MSDUID_STATUS:
3163 dbglog_printf(timestamp, vap_id,
3164 "WAL Tx Data frame completion desc_id=0x%x, status=0x%x, seq=0x%x",
3165 args[0], args[1], args[2]);
3166 break;
3167 case WAL_DBGID_RESET_PCU_CYCLE_CNT:
3168 dbglog_printf(timestamp, vap_id,
3169 "WAL PCU cycle counter value at reset:%x",
3170 args[0]);
3171 break;
3172 case WAL_DBGID_TX_DISCARD:
3173 dbglog_printf(timestamp, vap_id,
3174 "WAL Tx enqueue discard msdu_id=0x%x", args[0]);
3175 break;
3176 case WAL_DBGID_SET_HW_CHAINMASK:
3177 dbglog_printf(timestamp, vap_id,
3178 "WAL_DBGID_SET_HW_CHAINMASK pdev=%d, txchain=0x%x, rxchain=0x%x",
3179 args[0], args[1], args[2]);
3180 break;
3181 case WAL_DBGID_SET_HW_CHAINMASK_TXRX_STOP_FAIL:
3182 dbglog_printf(timestamp, vap_id,
3183 "WAL_DBGID_SET_HW_CHAINMASK_TXRX_STOP_FAIL rxstop=%d, txstop=%d",
3184 args[0], args[1]);
3185 break;
3186 case WAL_DBGID_GET_HW_CHAINMASK:
3187 dbglog_printf(timestamp, vap_id, "WAL_DBGID_GET_HW_CHAINMASK "
3188 "txchain=0x%x, rxchain=0x%x", args[0], args[1]);
3189 break;
3190 case WAL_DBGID_SMPS_DISABLE:
3191 dbglog_printf(timestamp, vap_id, "WAL_DBGID_SMPS_DISABLE");
3192 break;
3193 case WAL_DBGID_SMPS_ENABLE_HW_CNTRL:
3194 dbglog_printf(timestamp, vap_id,
3195 "WAL_DBGID_SMPS_ENABLE_HW_CNTRL low_pwr_mask=0x%x, high_pwr_mask=0x%x",
3196 args[0], args[1]);
3197 break;
3198 case WAL_DBGID_SMPS_SWSEL_CHAINMASK:
3199 dbglog_printf(timestamp, vap_id,
3200 "WAL_DBGID_SMPS_SWSEL_CHAINMASK low_pwr=0x%x, chain_mask=0x%x",
3201 args[0], args[1]);
3202 break;
3203 default:
3204 return false;
3205 }
3206
3207 return true;
3208 }
3209
3210 static A_BOOL
dbglog_scan_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)3211 dbglog_scan_print_handler(uint32_t mod_id,
3212 uint16_t vap_id,
3213 uint32_t dbg_id,
3214 uint32_t timestamp, uint16_t numargs, uint32_t *args)
3215 {
3216 static const char *const states[] = {
3217 "IDLE",
3218 "BSSCHAN",
3219 "WAIT_FOREIGN_CHAN",
3220 "FOREIGN_CHANNEL",
3221 "TERMINATING"
3222 };
3223
3224 static const char *const events[] = {
3225 "REQ",
3226 "STOP",
3227 "BSSCHAN",
3228 "FOREIGN_CHAN",
3229 "CHECK_ACTIVITY",
3230 "REST_TIME_EXPIRE",
3231 "DWELL_TIME_EXPIRE",
3232 "PROBE_TIME_EXPIRE",
3233 };
3234
3235 switch (dbg_id) {
3236 case DBGLOG_DBGID_SM_FRAMEWORK_PROXY_DBGLOG_MSG:
3237 dbglog_sm_print(timestamp, vap_id, numargs, args, "SCAN",
3238 states, QDF_ARRAY_SIZE(states), events,
3239 QDF_ARRAY_SIZE(events));
3240 break;
3241 default:
3242 return false;
3243 }
3244
3245 return true;
3246 }
3247
3248 static
dbglog_coex_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)3249 A_BOOL dbglog_coex_print_handler(uint32_t mod_id,
3250 uint16_t vap_id,
3251 uint32_t dbg_id,
3252 uint32_t timestamp,
3253 uint16_t numargs, uint32_t *args)
3254 {
3255 uint8_t i;
3256 char *dbg_id_str;
3257
3258 static const char *const wlan_rx_xput_status[] = {
3259 "WLAN_XPUT_NORMAL",
3260 "WLAN_XPUT_UNDER_THRESH",
3261 "WLAN_XPUT_CRITICAL",
3262 "WLAN_XPUT_RECOVERY_TIMEOUT",
3263 };
3264
3265 static const char *const coex_sched_req[] = {
3266 "SCHED_REQ_NEXT",
3267 "SCHED_REQ_BT",
3268 "SCHED_REQ_WLAN",
3269 "SCHED_REQ_POSTPAUSE",
3270 "SCHED_REQ_UNPAUSE",
3271 };
3272
3273 static const char *const coex_sched_type[] = {
3274 "SCHED_NONE",
3275 "SCHED_WLAN",
3276 "SCHED_BT",
3277 "SCHED_WLAN_PAUSE",
3278 "SCHED_WLAN_POSTPAUSE",
3279 "SCHED_WLAN_UNPAUSE",
3280 "COEX_SCHED_MWS",
3281 };
3282
3283 static const char *const coex_trf_mgmt_type[] = {
3284 "TRF_MGMT_FREERUN",
3285 "TRF_MGMT_SHAPE_PM",
3286 "TRF_MGMT_SHAPE_PSP",
3287 "TRF_MGMT_SHAPE_S_CTS",
3288 "TRF_MGMT_SHAPE_OCS",
3289 "TRF_MGMT_SHAPE_FIXED_TIME",
3290 "TRF_MGMT_SHAPE_NOA",
3291 "TRF_MGMT_SHAPE_OCS_CRITICAL",
3292 "TRF_MGMT_NONE",
3293 };
3294
3295 static const char *const coex_system_status[] = {
3296 "ALL_OFF",
3297 "BTCOEX_NOT_REQD",
3298 "WLAN_IS_IDLE",
3299 "EXECUTE_SCHEME",
3300 "BT_FULL_CONCURRENCY",
3301 "WLAN_SLEEPING",
3302 "WLAN_IS_PAUSED",
3303 "WAIT_FOR_NEXT_ACTION",
3304 "SOC_WAKE",
3305 };
3306
3307 static const char *const wlan_rssi_type[] = {
3308 "LOW_RSSI",
3309 "MID_RSSI",
3310 "HI_RSSI",
3311 "INVALID_RSSI",
3312 };
3313
3314 static const char *const coex_bt_scheme[] = {
3315 "IDLE_CTRL",
3316 "ACTIVE_ASYNC_CTRL",
3317 "PASSIVE_SYNC_CTRL",
3318 "ACTIVE_SYNC_CTRL",
3319 "DEFAULT_CTRL",
3320 "CONCURRENCY_CTRL",
3321 };
3322
3323 static const char *const wal_peer_rx_rate_stats_event_sent[] = {
3324 "PR_RX_EVT_SENT_NONE",
3325 "PR_RX_EVT_SENT_LOWER",
3326 "PR_RX_EVT_SENT_UPPER",
3327 };
3328
3329 static const char *const wlan_psp_stimulus[] = {
3330 "ENTRY",
3331 "EXIT",
3332 "PS_READY",
3333 "PS_NOT_READY",
3334 "RX_MORE_DATA_RCVD",
3335 "RX_NO_MORE_DATA_RCVD",
3336 "TX_DATA_COMPLT",
3337 "TX_COMPLT",
3338 "TIM_SET",
3339 "REQ",
3340 "DONE_SUCCESS",
3341 "DONE_NO_PS_POLL_ACK",
3342 "DONE_RESPONSE_TMO",
3343 "DONE_DROPPED",
3344 "DONE_FILTERED",
3345 "WLAN_START",
3346 "NONWLAN_START",
3347 "NONWLAN_INTVL_UPDATE",
3348 "NULL_TX",
3349 "NULL_TX_COMPLT",
3350 "BMISS_FIRST",
3351 "NULL_TX_FAIL",
3352 "RX_NO_MORE_DATA_DATAFRM",
3353 };
3354
3355 static const char *const coex_pspoll_state[] = {
3356 "STATE_DISABLED",
3357 "STATE_NOT_READY",
3358 "STATE_ENABLED",
3359 "STATE_READY",
3360 "STATE_TX_STATUS",
3361 "STATE_RX_STATUS",
3362 };
3363
3364 static const char *const coex_scheduler_interval[] = {
3365 "COEX_SCHED_NONWLAN_INT",
3366 "COEX_SCHED_WLAN_INT",
3367 };
3368
3369 static const char *const wlan_weight[] = {
3370 "BT_COEX_BASE",
3371 "BT_COEX_LOW",
3372 "BT_COEX_MID",
3373 "BT_COEX_MID_NONSYNC",
3374 "BT_COEX_HI_NONVOICE",
3375 "BT_COEX_HI",
3376 "BT_COEX_CRITICAL",
3377 };
3378
3379 static const char *const wlan_power_state[] = {
3380 "SLEEP",
3381 "AWAKE",
3382 "FULL_SLEEP",
3383 };
3384
3385 static const char *const coex_psp_error_type[] = {
3386 "DISABLED_STATE",
3387 "VDEV_NULL",
3388 "COEX_PSP_ENTRY",
3389 "ZERO_INTERVAL",
3390 "COEX_PSP_EXIT",
3391 "READY_DISABLED",
3392 "READY_NOT_DISABLED",
3393 "POLL_PKT_DROPPED",
3394 "SET_TIMER_PARAM",
3395 };
3396
3397 static const char *const wlan_phymode[] = {
3398 "A",
3399 "G",
3400 "B",
3401 "G_ONLY",
3402 "NA_HT20",
3403 "NG_HT20",
3404 "NA_HT40",
3405 "NG_HT40",
3406 "AC_VHT20",
3407 "AC_VHT40",
3408 "AC_VHT80",
3409 "AC_VHT20_2G",
3410 "AC_VHT40_2G",
3411 "AC_VHT80_2G",
3412 "UNKNOWN",
3413 };
3414
3415 static const char *const wlan_curr_band[] = {
3416 "2G",
3417 "5G",
3418 };
3419
3420 dbg_id_str = dbglog_get_msg(mod_id, dbg_id);
3421
3422 switch (dbg_id) {
3423 case COEX_SYSTEM_UPDATE:
3424 if (numargs == 1 && args[0] < 9) {
3425 dbglog_printf(timestamp, vap_id, "%s: %s", dbg_id_str,
3426 coex_system_status[args[0]]);
3427 } else if (numargs >= 5 && args[0] < 9 && args[2] < 9) {
3428 dbglog_printf(timestamp, vap_id,
3429 "%s: %s, WlanSysState(0x%x), %s, NumChains(%u), AggrLimit(%u)",
3430 dbg_id_str, coex_system_status[args[0]],
3431 args[1], coex_trf_mgmt_type[args[2]],
3432 args[3], args[4]);
3433 } else {
3434 return false;
3435 }
3436 break;
3437 case COEX_SCHED_START:
3438 if (numargs >= 5 && args[0] < 5 && args[2] < 9 && args[3] < 4
3439 && args[4] < 4) {
3440 if (args[1] == 0xffffffff) {
3441 dbglog_printf(timestamp, vap_id,
3442 "%s: %s, DETERMINE_DURATION, %s, %s, %s",
3443 dbg_id_str,
3444 coex_sched_req[args[0]],
3445 coex_trf_mgmt_type[args[2]],
3446 wlan_rx_xput_status[args[3]],
3447 wlan_rssi_type[args[4]]);
3448 } else {
3449 dbglog_printf(timestamp, vap_id,
3450 "%s: %s, IntvlDur(%u), %s, %s, %s",
3451 dbg_id_str,
3452 coex_sched_req[args[0]], args[1],
3453 coex_trf_mgmt_type[args[2]],
3454 wlan_rx_xput_status[args[3]],
3455 wlan_rssi_type[args[4]]);
3456 }
3457 } else {
3458 return false;
3459 }
3460 break;
3461 case COEX_SCHED_RESULT:
3462 if (numargs >= 5 && args[0] < 5 && args[1] < 9 && args[2] < 9) {
3463 dbglog_printf(timestamp, vap_id,
3464 "%s: %s, %s, %s, CoexMgrPolicy(%u), IdleOverride(%u)",
3465 dbg_id_str, coex_sched_req[args[0]],
3466 coex_trf_mgmt_type[args[1]],
3467 coex_trf_mgmt_type[args[2]], args[3],
3468 args[4]);
3469 } else {
3470 return false;
3471 }
3472 break;
3473 case COEX_BT_SCHEME:
3474 if (numargs >= 1 && args[0] < 6) {
3475 dbglog_printf(timestamp, vap_id, "%s: %s", dbg_id_str,
3476 coex_bt_scheme[args[0]]);
3477 } else {
3478 return false;
3479 }
3480 break;
3481 case COEX_TRF_FREERUN:
3482 if (numargs >= 5 && args[0] < 7) {
3483 dbglog_printf(timestamp, vap_id,
3484 "%s: %s, AllocatedBtIntvls(%u), BtIntvlCnt(%u), AllocatedWlanIntvls(%u), WlanIntvlCnt(%u)",
3485 dbg_id_str, coex_sched_type[args[0]],
3486 args[1], args[2], args[3], args[4]);
3487 } else {
3488 return false;
3489 }
3490 break;
3491 case COEX_TRF_SHAPE_PM: /* used by ocs now */
3492 if (numargs >= 3) {
3493 dbglog_printf(timestamp, vap_id,
3494 "%s: IntvlLength(%u), BtDuration(%u), WlanDuration(%u)",
3495 dbg_id_str, args[0], args[1], args[2]);
3496 } else {
3497 return false;
3498 }
3499 break;
3500 case COEX_SYSTEM_MONITOR:
3501 if (numargs >= 5 && args[1] < 4 && args[4] < 4) {
3502 dbglog_printf(timestamp, vap_id,
3503 "%s: WlanRxCritical(%u), %s, MinDirectRxRate(%u), MonitorActiveNum(%u), %s",
3504 dbg_id_str, args[0],
3505 wlan_rx_xput_status[args[1]], args[2],
3506 args[3], wlan_rssi_type[args[4]]);
3507 } else {
3508 return false;
3509 }
3510 break;
3511 case COEX_RX_RATE:
3512 if (numargs >= 5 && args[4] < 3) {
3513 dbglog_printf(timestamp, vap_id,
3514 "%s: NumUnderThreshPeers(%u), MinDirectRate(%u), LastRateSample(%u), DeltaT(%u), %s",
3515 dbg_id_str, args[0], args[1], args[2],
3516 args[3],
3517 wal_peer_rx_rate_stats_event_sent[args
3518 [4]]);
3519 } else {
3520 return false;
3521 }
3522 break;
3523 case COEX_WLAN_INTERVAL_START:
3524 if (numargs >= 5) {
3525 dbglog_printf(timestamp, vap_id,
3526 "%s: WlanIntvlCnt(%u), Duration(%u), Weight(%u), BaseIdleOverride(%u), WeightMat[0](0x%x)",
3527 dbg_id_str, args[0], args[1], args[2],
3528 args[3], args[4]);
3529 } else {
3530 return false;
3531 }
3532 break;
3533 case COEX_WLAN_POSTPAUSE_INTERVAL_START:
3534 if (numargs >= 4) {
3535 dbglog_printf(timestamp, vap_id,
3536 "%s: WlanPostPauseIntvlCnt(%u), XputMonitorActiveNum(%u), Duration(%u), Weight(%u)",
3537 dbg_id_str, args[0], args[1], args[2],
3538 args[3]);
3539 } else {
3540 return false;
3541 }
3542 break;
3543 case COEX_BT_INTERVAL_START:
3544 if (numargs >= 5) {
3545 dbglog_printf(timestamp, vap_id,
3546 "%s: BtIntvlCnt(%u), Duration(%u), Weight(%u), BaseIdleOverride(%u), WeightMat[0](0x%x), ",
3547 dbg_id_str, args[0], args[1], args[2],
3548 args[3], args[4]);
3549 } else {
3550 return false;
3551 }
3552 break;
3553 case COEX_POWER_CHANGE:
3554 if (numargs >= 3 && args[1] < 3 && args[2] < 3) {
3555 dbglog_printf(timestamp, vap_id,
3556 "%s: Event(0x%x) %s->%s", dbg_id_str,
3557 args[0], wlan_power_state[args[1]],
3558 wlan_power_state[args[2]]);
3559 } else {
3560 return false;
3561 }
3562 break;
3563 case COEX_CHANNEL_CHANGE:
3564 if (numargs >= 5 && args[3] < 2 && args[4] < 15) {
3565 dbglog_printf(timestamp, vap_id,
3566 "%s: %uMhz->%uMhz, WlanSysState(0x%x), CurrBand(%s), PhyMode(%s)",
3567 dbg_id_str, args[0], args[1], args[2],
3568 wlan_curr_band[args[3]],
3569 wlan_phymode[args[4]]);
3570 } else {
3571 return false;
3572 }
3573 break;
3574 case COEX_PSP_MGR_ENTER:
3575 if (numargs >= 5 && args[0] < 23 &&
3576 args[1] < 6 && args[3] < 2) {
3577 dbglog_printf(timestamp, vap_id,
3578 "%s: %s, %s, PsPollAvg(%u), %s, CurrT(%u)",
3579 dbg_id_str, wlan_psp_stimulus[args[0]],
3580 coex_pspoll_state[args[1]], args[2],
3581 coex_scheduler_interval[args[3]],
3582 args[4]);
3583 } else {
3584 return false;
3585 }
3586 break;
3587 /* Translate following into decimal */
3588 case COEX_SINGLECHAIN_DBG_1:
3589 case COEX_SINGLECHAIN_DBG_2:
3590 case COEX_SINGLECHAIN_DBG_3:
3591 case COEX_MULTICHAIN_DBG_1:
3592 case COEX_MULTICHAIN_DBG_2:
3593 case COEX_MULTICHAIN_DBG_3:
3594 case BTCOEX_DBG_MCI_1:
3595 case BTCOEX_DBG_MCI_2:
3596 case BTCOEX_DBG_MCI_3:
3597 case BTCOEX_DBG_MCI_4:
3598 case BTCOEX_DBG_MCI_5:
3599 case BTCOEX_DBG_MCI_6:
3600 case BTCOEX_DBG_MCI_7:
3601 case BTCOEX_DBG_MCI_8:
3602 case BTCOEX_DBG_MCI_9:
3603 case BTCOEX_DBG_MCI_10:
3604
3605 if (numargs > 0) {
3606 dbglog_printf_no_line_break(timestamp, vap_id, "%s: %u",
3607 dbg_id_str, args[0]);
3608 for (i = 1; i < numargs; i++)
3609 dbglog_printf_no_line_break(timestamp, vap_id,
3610 "%u", args[i]);
3611 dbglog_printf_no_line_break(timestamp, vap_id, "\n");
3612 } else {
3613 return false;
3614 }
3615 break;
3616 case COEX_LinkID:
3617 if (numargs >= 4) {
3618 if (args[0]) { /* Add profile */
3619 dbglog_printf(timestamp, vap_id,
3620 "%s Alloc: LocalID(%u), RemoteID(%u), MinFreeLocalID(%u)",
3621 dbg_id_str, args[1], args[2],
3622 args[3]);
3623 } else { /* Remove profile */
3624 dbglog_printf(timestamp, vap_id,
3625 "%s Dealloc: LocalID(%u), RemoteID(%u), MinFreeLocalID(%u)",
3626 dbg_id_str, args[1], args[2],
3627 args[3]);
3628 }
3629 } else {
3630 return false;
3631 }
3632 break;
3633 case COEX_PSP_MGR_RESULT:
3634 if (numargs >= 5 && args[0] < 6) {
3635 dbglog_printf(timestamp, vap_id,
3636 "%s: %s, PsPollAvg(%u), EstimationOverrun(%u), EstimationUnderun(%u), NotReadyErr(%u)",
3637 dbg_id_str, coex_pspoll_state[args[0]],
3638 args[1], args[2], args[3], args[4]);
3639 } else {
3640 return false;
3641 }
3642 break;
3643 case COEX_TRF_SHAPE_PSP:
3644 if (numargs >= 5 && args[0] < 7 && args[1] < 7) {
3645 dbglog_printf(timestamp, vap_id,
3646 "%s: %s, %s, Dur(%u), BtTriggerRecvd(%u), PspWlanCritical(%u)",
3647 dbg_id_str, coex_sched_type[args[0]],
3648 wlan_weight[args[1]], args[2], args[3],
3649 args[4]);
3650 } else {
3651 return false;
3652 }
3653 break;
3654 case COEX_PSP_SPEC_POLL:
3655 if (numargs >= 5) {
3656 dbglog_printf(timestamp, vap_id,
3657 "%s: PsPollSpecEna(%u), Count(%u), NextTS(%u), AllowSpecPsPollTx(%u), Intvl(%u)",
3658 dbg_id_str, args[0], args[1], args[2],
3659 args[3], args[4]);
3660 } else {
3661 return false;
3662 }
3663 break;
3664 case COEX_PSP_READY_STATE:
3665 if (numargs >= 5) {
3666 dbglog_printf(timestamp, vap_id,
3667 "%s: T2NonWlan(%u), CoexSchedulerEndTS(%u), MoreData(%u), PSPRespExpectedTS(%u), NonWlanIdleT(%u)",
3668 dbg_id_str, args[0], args[1], args[2],
3669 args[3], args[4]);
3670 } else {
3671 return false;
3672 }
3673 break;
3674 case COEX_PSP_NONWLAN_INTERVAL:
3675 if (numargs >= 4) {
3676 dbglog_printf(timestamp, vap_id,
3677 "%s: NonWlanBaseIntvl(%u), NonWlanIdleT(%u), PSPSpecIntvl(%u), ApRespTimeout(%u)",
3678 dbg_id_str, args[0], args[1], args[2],
3679 args[3]);
3680 } else {
3681 return false;
3682 }
3683 break;
3684 case COEX_PSP_ERROR:
3685 if (numargs >= 1 && args[0] < 9) {
3686 dbglog_printf_no_line_break(timestamp, vap_id, "%s: %s",
3687 dbg_id_str,
3688 coex_psp_error_type[args
3689 [0]]);
3690 for (i = 1; i < numargs; i++) {
3691 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
3692 (", %u", args[i]));
3693 }
3694 AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("\n"));
3695 } else {
3696 return false;
3697 }
3698 break;
3699 case COEX_PSP_STAT_1:
3700 if (numargs >= 5) {
3701 dbglog_printf(timestamp, vap_id,
3702 "%s: ApResp0(%u), ApResp1(%u), ApResp2(%u), ApResp3(%u), ApResp4(%u)",
3703 dbg_id_str, args[0], args[1], args[2],
3704 args[3], args[4]);
3705 } else {
3706 return false;
3707 }
3708 break;
3709 case COEX_PSP_STAT_2:
3710 if (numargs >= 5) {
3711 dbglog_printf(timestamp, vap_id,
3712 "%s: DataPt(%u), Max(%u), NextApRespIndex(%u), NumOfValidDataPts(%u), PsPollAvg(%u)",
3713 dbg_id_str, args[0], args[1], args[2],
3714 args[3], args[4]);
3715 } else {
3716 return false;
3717 }
3718 break;
3719 case COEX_PSP_RX_STATUS_STATE_1:
3720 if (numargs >= 5) {
3721 if (args[2]) {
3722 dbglog_printf(timestamp, vap_id,
3723 "%s: RsExpectedTS(%u), RespActualTS(%u), Overrun, RsOverrunT(%u), RsRxDur(%u)",
3724 dbg_id_str, args[0], args[1],
3725 args[3], args[4]);
3726 } else {
3727 dbglog_printf(timestamp, vap_id,
3728 "%s: RsExpectedTS(%u), RespActualTS(%u), Underrun, RsUnderrunT(%u), RsRxDur(%u)",
3729 dbg_id_str, args[0], args[1],
3730 args[3], args[4]);
3731 }
3732 } else {
3733 return false;
3734 }
3735 break;
3736 default:
3737 return false;
3738 }
3739
3740 return true;
3741 }
3742
3743 static A_BOOL
dbglog_beacon_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)3744 dbglog_beacon_print_handler(uint32_t mod_id,
3745 uint16_t vap_id,
3746 uint32_t dbg_id,
3747 uint32_t timestamp,
3748 uint16_t numargs, uint32_t *args)
3749 {
3750 static const char *const states[] = {
3751 "INIT",
3752 "ADJUST_START",
3753 "ADJUSTING",
3754 "ADJUST_HOLD",
3755 };
3756
3757 static const char *const events[] = {
3758 "ADJUST_START",
3759 "ADJUST_RESTART",
3760 "ADJUST_STOP",
3761 "ADJUST_PAUSE",
3762 "ADJUST_UNPAUSE",
3763 "ADJUST_INC_SLOP_STEP",
3764 "ADJUST_HOLD",
3765 "ADJUST_HOLD_TIME_OUT",
3766 };
3767
3768 switch (dbg_id) {
3769 case DBGLOG_DBGID_SM_FRAMEWORK_PROXY_DBGLOG_MSG:
3770 dbglog_sm_print(timestamp, vap_id, numargs, args, "EARLY_RX",
3771 states, QDF_ARRAY_SIZE(states), events,
3772 QDF_ARRAY_SIZE(events));
3773 break;
3774 case BEACON_EVENT_EARLY_RX_BMISS_STATUS:
3775 if (numargs == 3) {
3776 dbglog_printf(timestamp, vap_id,
3777 "early_rx bmiss status:rcv=%d total=%d miss=%d",
3778 args[0], args[1], args[2]);
3779 }
3780 break;
3781 case BEACON_EVENT_EARLY_RX_SLEEP_SLOP:
3782 if (numargs == 1) {
3783 dbglog_printf(timestamp, vap_id,
3784 "early_rx update sleep_slop:%d", args[0]);
3785 }
3786 break;
3787 case BEACON_EVENT_EARLY_RX_CONT_BMISS_TIMEOUT:
3788 if (numargs == 1) {
3789 dbglog_printf(timestamp, vap_id,
3790 "early_rx cont bmiss timeout,update sleep_slop:%d",
3791 args[0]);
3792 }
3793 break;
3794 case BEACON_EVENT_EARLY_RX_PAUSE_SKIP_BCN_NUM:
3795 if (numargs == 1) {
3796 dbglog_printf(timestamp, vap_id,
3797 "early_rx skip bcn num:%d", args[0]);
3798 }
3799 break;
3800 case BEACON_EVENT_EARLY_RX_CLK_DRIFT:
3801 if (numargs == 1) {
3802 dbglog_printf(timestamp, vap_id,
3803 "early_rx clk drift:%d", args[0]);
3804 }
3805 break;
3806 case BEACON_EVENT_EARLY_RX_AP_DRIFT:
3807 if (numargs == 1) {
3808 dbglog_printf(timestamp, vap_id,
3809 "early_rx ap drift:%d", args[0]);
3810 }
3811 break;
3812 case BEACON_EVENT_EARLY_RX_BCN_TYPE:
3813 if (numargs == 1) {
3814 dbglog_printf(timestamp, vap_id,
3815 "early_rx bcn type:%d", args[0]);
3816 }
3817 break;
3818 default:
3819 return false;
3820 }
3821
3822 return true;
3823 }
3824
3825 static A_BOOL
dbglog_data_txrx_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)3826 dbglog_data_txrx_print_handler(uint32_t mod_id,
3827 uint16_t vap_id,
3828 uint32_t dbg_id,
3829 uint32_t timestamp,
3830 uint16_t numargs, uint32_t *args)
3831 {
3832 switch (dbg_id) {
3833 case DATA_TXRX_DBGID_RX_DATA_SEQ_LEN_INFO:
3834 dbglog_printf(timestamp, vap_id,
3835 "DATA RX seq=0x%x, len=0x%x, stored=0x%x, duperr=0x%x",
3836 args[0], args[1], (args[2] & 0xffff0000) >> 16,
3837 args[2] & 0x0000ffff);
3838 break;
3839 default:
3840 return false;
3841 }
3842
3843 return true;
3844 }
3845
3846 static
dbglog_smps_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)3847 A_BOOL dbglog_smps_print_handler(uint32_t mod_id,
3848 uint16_t vap_id,
3849 uint32_t dbg_id,
3850 uint32_t timestamp,
3851 uint16_t numargs, uint32_t *args)
3852 {
3853 static const char *const states[] = {
3854 "S_INACTIVE",
3855 "S_STATIC",
3856 "S_DYNAMIC",
3857 "S_STALLED",
3858 "S_INACTIVE_WAIT",
3859 "S_STATIC_WAIT",
3860 "S_DYNAMIC_WAIT",
3861 };
3862
3863 static const char *const events[] = {
3864 "E_STOP",
3865 "E_STOP_COMPL",
3866 "E_START",
3867 "E_STATIC",
3868 "E_STATIC_COMPL",
3869 "E_DYNAMIC",
3870 "E_DYNAMIC_COMPL",
3871 "E_STALL",
3872 "E_RSSI_ABOVE_THRESH",
3873 "E_RSSI_BELOW_THRESH",
3874 "E_FORCED_NONE",
3875 };
3876 switch (dbg_id) {
3877 case DBGLOG_DBGID_SM_FRAMEWORK_PROXY_DBGLOG_MSG:
3878 dbglog_sm_print(timestamp, vap_id, numargs, args, "STA_SMPS SM",
3879 states, QDF_ARRAY_SIZE(states), events,
3880 QDF_ARRAY_SIZE(events));
3881 break;
3882 case STA_SMPS_DBGID_CREATE_PDEV_INSTANCE:
3883 dbglog_printf(timestamp, vap_id, "STA_SMPS Create PDEV ctx %#x",
3884 args[0]);
3885 break;
3886 case STA_SMPS_DBGID_CREATE_VIRTUAL_CHAN_INSTANCE:
3887 dbglog_printf(timestamp, vap_id,
3888 "STA_SMPS Create Virtual Chan ctx %#x", args[0]);
3889 break;
3890 case STA_SMPS_DBGID_DELETE_VIRTUAL_CHAN_INSTANCE:
3891 dbglog_printf(timestamp, vap_id,
3892 "STA_SMPS Delete Virtual Chan ctx %#x", args[0]);
3893 break;
3894 case STA_SMPS_DBGID_CREATE_STA_INSTANCE:
3895 dbglog_printf(timestamp, vap_id, "STA_SMPS Create STA ctx %#x",
3896 args[0]);
3897 break;
3898 case STA_SMPS_DBGID_DELETE_STA_INSTANCE:
3899 dbglog_printf(timestamp, vap_id, "STA_SMPS Delete STA ctx %#x",
3900 args[0]);
3901 break;
3902 case STA_SMPS_DBGID_VIRTUAL_CHAN_SMPS_START:
3903 break;
3904 case STA_SMPS_DBGID_VIRTUAL_CHAN_SMPS_STOP:
3905 break;
3906 case STA_SMPS_DBGID_SEND_SMPS_ACTION_FRAME:
3907 dbglog_printf(timestamp, vap_id,
3908 "STA_SMPS STA %#x Signal SMPS mode as %s; cb_flags %#x",
3909 args[0],
3910 (args[1] ==
3911 0 ? "DISABLED" : (args[1] ==
3912 0x1 ? "STATIC" : (args[1] ==
3913 0x3 ?
3914 "DYNAMIC" :
3915 "UNKNOWN"))),
3916 args[2]);
3917 break;
3918 case STA_SMPS_DBGID_DTIM_EBT_EVENT_CHMASK_UPDATE:
3919 dbglog_printf(timestamp, vap_id,
3920 "STA_SMPS_DBGID_DTIM_EBT_EVENT_CHMASK_UPDATE");
3921 break;
3922 case STA_SMPS_DBGID_DTIM_CHMASK_UPDATE:
3923 dbglog_printf(timestamp, vap_id,
3924 "STA_SMPS_DBGID_DTIM_CHMASK_UPDATE tx_mask %#x rx_mask %#x arb_dtim_mask %#x",
3925 args[0], args[1], args[2]);
3926 break;
3927 case STA_SMPS_DBGID_DTIM_BEACON_EVENT_CHMASK_UPDATE:
3928 dbglog_printf(timestamp, vap_id,
3929 "STA_SMPS_DBGID_DTIM_BEACON_EVENT_CHMASK_UPDATE");
3930 break;
3931 case STA_SMPS_DBGID_DTIM_POWER_STATE_CHANGE:
3932 dbglog_printf(timestamp, vap_id,
3933 "STA_SMPS_DBGID_DTIM_POWER_STATE_CHANGE cur_pwr_state %s new_pwr_state %s",
3934 (args[0] ==
3935 0x1 ? "SLEEP" : (args[0] ==
3936 0x2 ? "AWAKE" : (args[0] ==
3937 0x3 ?
3938 "FULL_SLEEP" :
3939 "UNKNOWN"))),
3940 (args[1] ==
3941 0x1 ? "SLEEP" : (args[1] ==
3942 0x2 ? "AWAKE" : (args[1] ==
3943 0x3 ?
3944 "FULL_SLEEP" :
3945 "UNKNOWN"))));
3946 break;
3947 case STA_SMPS_DBGID_DTIM_CHMASK_UPDATE_SLEEP:
3948 dbglog_printf(timestamp, vap_id,
3949 "STA_SMPS_DBGID_DTIM_CHMASK_UPDATE_SLEEP tx_mask %#x rx_mask %#x orig_rx %#x dtim_rx %#x",
3950 args[0], args[1], args[2], args[3]);
3951 break;
3952 case STA_SMPS_DBGID_DTIM_CHMASK_UPDATE_AWAKE:
3953 dbglog_printf(timestamp, vap_id,
3954 "STA_SMPS_DBGID_DTIM_CHMASK_UPDATE_AWAKE tx_mask %#x rx_mask %#x orig_rx %#x",
3955 args[0], args[1], args[2]);
3956 break;
3957 default:
3958 dbglog_printf(timestamp, vap_id, "STA_SMPS: UNKNOWN DBGID!");
3959 return false;
3960 }
3961
3962 return true;
3963 }
3964
3965 static A_BOOL
dbglog_p2p_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)3966 dbglog_p2p_print_handler(uint32_t mod_id,
3967 uint16_t vap_id,
3968 uint32_t dbg_id,
3969 uint32_t timestamp, uint16_t numargs, uint32_t *args)
3970 {
3971 static const char *const states[] = {
3972 "ACTIVE",
3973 "DOZE",
3974 "TX_BCN",
3975 "CTWIN",
3976 "OPPPS",
3977 };
3978
3979 static const char *const events[] = {
3980 "ONESHOT_NOA",
3981 "CTWINDOW",
3982 "PERIODIC_NOA",
3983 "IDLE",
3984 "NOA_CHANGED",
3985 "TBTT",
3986 "TX_BCN_CMP",
3987 "OPPPS_OK",
3988 "OPPPS_CHANGED",
3989 };
3990
3991 switch (dbg_id) {
3992 case DBGLOG_DBGID_SM_FRAMEWORK_PROXY_DBGLOG_MSG:
3993 dbglog_sm_print(timestamp, vap_id, numargs, args, "P2P GO PS",
3994 states, QDF_ARRAY_SIZE(states), events,
3995 QDF_ARRAY_SIZE(events));
3996 break;
3997 default:
3998 return false;
3999 }
4000
4001 return true;
4002 }
4003
4004 static A_BOOL
dbglog_pcielp_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)4005 dbglog_pcielp_print_handler(uint32_t mod_id,
4006 uint16_t vap_id,
4007 uint32_t dbg_id,
4008 uint32_t timestamp,
4009 uint16_t numargs, uint32_t *args)
4010 {
4011 static const char *const states[] = {
4012 "STOP",
4013 "TX",
4014 "RX",
4015 "SLEEP",
4016 "SUSPEND",
4017 };
4018
4019 static const char *const events[] = {
4020 "VDEV_UP",
4021 "ALL_VDEV_DOWN",
4022 "AWAKE",
4023 "SLEEP",
4024 "TX_ACTIVITY",
4025 "TX_INACTIVITY",
4026 "TX_AC_CHANGE",
4027 "SUSPEND",
4028 "RESUME",
4029 };
4030
4031 switch (dbg_id) {
4032 case DBGLOG_DBGID_SM_FRAMEWORK_PROXY_DBGLOG_MSG:
4033 dbglog_sm_print(timestamp, vap_id, numargs, args, "PCIELP",
4034 states, QDF_ARRAY_SIZE(states), events,
4035 QDF_ARRAY_SIZE(events));
4036 break;
4037 default:
4038 return false;
4039 }
4040
4041 return true;
4042 }
4043
4044 #ifdef WLAN_DBGLOG_DEBUGFS
dbglog_block_open(struct inode * inode,struct file * file)4045 static int dbglog_block_open(struct inode *inode, struct file *file)
4046 {
4047 struct fwdebug *fwlog = inode->i_private;
4048
4049 if (fwlog->fwlog_open)
4050 return -EBUSY;
4051
4052 fwlog->fwlog_open = true;
4053
4054 file->private_data = inode->i_private;
4055 return 0;
4056 }
4057
dbglog_block_release(struct inode * inode,struct file * file)4058 static int dbglog_block_release(struct inode *inode, struct file *file)
4059 {
4060 struct fwdebug *fwlog = inode->i_private;
4061
4062 fwlog->fwlog_open = false;
4063
4064 return 0;
4065 }
4066
dbglog_block_read(struct file * file,char __user * user_buf,size_t count,loff_t * ppos)4067 static ssize_t dbglog_block_read(struct file *file,
4068 char __user *user_buf,
4069 size_t count, loff_t *ppos)
4070 {
4071 struct fwdebug *fwlog = file->private_data;
4072 struct sk_buff *skb;
4073 ssize_t ret_cnt;
4074 size_t len = 0, not_copied;
4075 char *buf;
4076 int ret;
4077
4078 buf = qdf_mem_valloc(count);
4079 if (!buf)
4080 return -ENOMEM;
4081
4082 spin_lock_bh(&fwlog->fwlog_queue.lock);
4083
4084 if (skb_queue_len(&fwlog->fwlog_queue) == 0) {
4085 /* we must init under queue lock */
4086 init_completion(&fwlog->fwlog_completion);
4087
4088 spin_unlock_bh(&fwlog->fwlog_queue.lock);
4089
4090 ret =
4091 wait_for_completion_interruptible(&fwlog->fwlog_completion);
4092 if (ret == -ERESTARTSYS) {
4093 qdf_mem_vfree(buf);
4094 return ret;
4095 }
4096
4097 spin_lock_bh(&fwlog->fwlog_queue.lock);
4098 }
4099
4100 while ((skb = __skb_dequeue(&fwlog->fwlog_queue))) {
4101 if (skb->len > count - len) {
4102 /* not enough space, put skb back and leave */
4103 __skb_queue_head(&fwlog->fwlog_queue, skb);
4104 break;
4105 }
4106
4107 memcpy(buf + len, skb->data, skb->len);
4108 len += skb->len;
4109
4110 kfree_skb(skb);
4111 }
4112
4113 spin_unlock_bh(&fwlog->fwlog_queue.lock);
4114
4115 /* FIXME: what to do if len == 0? */
4116 not_copied = copy_to_user(user_buf, buf, len);
4117 if (not_copied != 0) {
4118 ret_cnt = -EFAULT;
4119 goto out;
4120 }
4121
4122 *ppos = *ppos + len;
4123
4124 ret_cnt = len;
4125
4126 out:
4127 qdf_mem_vfree(buf);
4128
4129 return ret_cnt;
4130 }
4131
4132 static const struct file_operations fops_dbglog_block = {
4133 .open = dbglog_block_open,
4134 .release = dbglog_block_release,
4135 .read = dbglog_block_read,
4136 .owner = THIS_MODULE,
4137 .llseek = default_llseek,
4138 };
4139
dbglog_debugfs_init(wmi_unified_t wmi_handle)4140 static void dbglog_debugfs_init(wmi_unified_t wmi_handle)
4141 {
4142
4143 /* Initialize the fw debug log queue */
4144 skb_queue_head_init(&wmi_handle->dbglog.fwlog_queue);
4145 init_completion(&wmi_handle->dbglog.fwlog_completion);
4146
4147 wmi_handle->debugfs_phy = qdf_debugfs_create_dir(CLD_DEBUGFS_DIR, NULL);
4148 if (!wmi_handle->debugfs_phy) {
4149 qdf_print("Failed to create WMI debug fs");
4150 return;
4151 }
4152
4153 qdf_debugfs_create_entry(DEBUGFS_BLOCK_NAME, DEBUGFS_BLOCK_PERM,
4154 wmi_handle->debugfs_phy, &wmi_handle->dbglog,
4155 &fops_dbglog_block);
4156
4157 return;
4158 }
4159
dbglog_debugfs_remove(wmi_unified_t wmi_handle)4160 static void dbglog_debugfs_remove(wmi_unified_t wmi_handle)
4161 {
4162 /* DeInitialize the fw debug log queue */
4163 skb_queue_purge(&wmi_handle->dbglog.fwlog_queue);
4164 complete(&wmi_handle->dbglog.fwlog_completion);
4165
4166 qdf_debugfs_remove_dir_recursive(wmi_handle->debugfs_phy);
4167 }
4168
4169 #else
4170
dbglog_debugfs_init(wmi_unified_t wmi_handle)4171 static void dbglog_debugfs_init(wmi_unified_t wmi_handle)
4172 {
4173 }
4174
dbglog_debugfs_remove(wmi_unified_t wmi_handle)4175 static void dbglog_debugfs_remove(wmi_unified_t wmi_handle)
4176 {
4177 }
4178
4179 #endif /* WLAN_DBGLOG_DEBUGFS */
4180
4181 /**
4182 * cnss_diag_handle_crash_inject() - API to handle crash inject command
4183 * @slot: pointer to struct dbglog_slot
4184 *
4185 * API to handle CNSS diag crash inject command
4186 *
4187 * Return: None
4188 */
cnss_diag_handle_crash_inject(struct dbglog_slot * slot)4189 static void cnss_diag_handle_crash_inject(struct dbglog_slot *slot)
4190 {
4191 switch (slot->diag_type) {
4192 case DIAG_TYPE_CRASH_INJECT:
4193 if (slot->length != 2) {
4194 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
4195 ("crash_inject cmd error\n"));
4196 return;
4197 }
4198
4199 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
4200 ("%s : DIAG_TYPE_CRASH_INJECT: %d %d\n",
4201 __func__, slot->payload[0],
4202 slot->payload[1]));
4203 if (!tgt_assert_enable) {
4204 AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
4205 ("%s: tgt Assert Disabled\n",
4206 __func__));
4207 return;
4208 }
4209 wma_cli_set2_command(0, (int)GEN_PARAM_CRASH_INJECT,
4210 slot->payload[0],
4211 slot->payload[1], GEN_CMD);
4212 break;
4213 default:
4214 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown cmd[%d] error\n",
4215 slot->diag_type));
4216 break;
4217 }
4218 }
4219
4220 #ifdef CNSS_GENL
4221 /**
4222 * cnss_diag_cmd_handler() - API to handle CNSS diag command
4223 * @data: Data received
4224 * @data_len: length of the data received
4225 * @ctx: Pointer to stored context
4226 * @pid: Process ID
4227 *
4228 * API to handle CNSS diag commands from user space
4229 *
4230 * Return: None
4231 */
cnss_diag_cmd_handler(const void * data,int data_len,void * ctx,int pid)4232 static void cnss_diag_cmd_handler(const void *data, int data_len,
4233 void *ctx, int pid)
4234 {
4235 struct dbglog_slot *slot = NULL;
4236 struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1];
4237 int len;
4238
4239 /*
4240 * audit note: it is ok to pass a NULL policy here since a
4241 * length check on the data is added later already
4242 */
4243 if (wlan_cfg80211_nla_parse(tb, CLD80211_ATTR_MAX,
4244 data, data_len, NULL)) {
4245 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: nla parse fails\n",
4246 __func__));
4247 return;
4248 }
4249
4250 if (!tb[CLD80211_ATTR_DATA]) {
4251 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: attr VENDOR_DATA fails\n",
4252 __func__));
4253 return;
4254 }
4255
4256 len = nla_len(tb[CLD80211_ATTR_DATA]);
4257 if (len < sizeof(struct dbglog_slot)) {
4258 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: attr length less than sizeof(struct dbglog_slot)\n",
4259 __func__));
4260 return;
4261 }
4262
4263 slot = (struct dbglog_slot *)nla_data(tb[CLD80211_ATTR_DATA]);
4264 if (len != (sizeof(struct dbglog_slot) + (uint64_t) slot->length)) {
4265 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: attr length check fails\n",
4266 __func__));
4267 return;
4268 }
4269
4270 cnss_diag_handle_crash_inject(slot);
4271 return;
4272 }
4273
cnss_diag_activate_service(void)4274 int cnss_diag_activate_service(void)
4275 {
4276 register_cld_cmd_cb(WLAN_NL_MSG_CNSS_DIAG, cnss_diag_cmd_handler, NULL);
4277 return 0;
4278 }
4279
cnss_diag_deactivate_service(void)4280 int cnss_diag_deactivate_service(void)
4281 {
4282 deregister_cld_cmd_cb(WLAN_NL_MSG_CNSS_DIAG);
4283 return 0;
4284 }
4285
4286 #else
4287
4288 /**
4289 * cnss_diag_msg_callback() - Call back invoked by netlink service
4290 * @skb: skb with netlink message
4291 *
4292 * This function gets invoked by netlink service when a message is received
4293 * from the cnss-diag application in user-space.
4294 *
4295 * Return: 0 for success, non zero for failure
4296 */
cnss_diag_msg_callback(struct sk_buff * skb)4297 static int cnss_diag_msg_callback(struct sk_buff *skb)
4298 {
4299 struct nlmsghdr *nlh;
4300 uint8_t *msg;
4301
4302 nlh = (struct nlmsghdr *)skb->data;
4303 if (!nlh) {
4304 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
4305 ("%s: Netlink header null\n", __func__));
4306 return A_ERROR;
4307 }
4308
4309 msg = NLMSG_DATA(nlh);
4310 cnss_diag_handle_crash_inject((struct dbglog_slot *)msg);
4311
4312 return 0;
4313 }
4314
cnss_diag_activate_service(void)4315 int cnss_diag_activate_service(void)
4316 {
4317 int ret;
4318
4319 /* Register the msg handler for msgs addressed to WLAN_NL_MSG_OEM */
4320 ret = nl_srv_register(WLAN_NL_MSG_CNSS_DIAG, cnss_diag_msg_callback);
4321 if (ret)
4322 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
4323 ("CNSS-DIAG Registration failed"));
4324
4325 return ret;
4326 }
4327
cnss_diag_deactivate_service(void)4328 int cnss_diag_deactivate_service(void)
4329 {
4330 int ret;
4331
4332 /*
4333 * Deregister the msg handler for msgs addressed to
4334 * WLAN_NL_MSG_CNSS_DIAG
4335 */
4336 ret = nl_srv_unregister(WLAN_NL_MSG_CNSS_DIAG, cnss_diag_msg_callback);
4337 if (ret)
4338 AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
4339 ("CNSS-DIAG Registration failed"));
4340
4341 return ret;
4342 }
4343 #endif
4344
4345 static A_BOOL
dbglog_wow_print_handler(uint32_t mod_id,uint16_t vap_id,uint32_t dbg_id,uint32_t timestamp,uint16_t numargs,uint32_t * args)4346 dbglog_wow_print_handler(uint32_t mod_id,
4347 uint16_t vap_id,
4348 uint32_t dbg_id,
4349 uint32_t timestamp, uint16_t numargs, uint32_t *args)
4350 {
4351
4352 switch (dbg_id) {
4353 case WOW_NS_OFLD_ENABLE:
4354 if (4 == numargs) {
4355 dbglog_printf(timestamp, vap_id,
4356 "Enable NS offload, for sender %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
4357 *(uint8_t *) &args[0],
4358 *((uint8_t *) &args[0] + 1),
4359 *((uint8_t *) &args[0] + 2),
4360 *((uint8_t *) &args[0] + 3),
4361 *(uint8_t *) &args[1],
4362 *((uint8_t *) &args[1] + 1),
4363 *((uint8_t *) &args[1] + 2),
4364 *((uint8_t *) &args[1] + 3),
4365 *(uint8_t *) &args[2],
4366 *((uint8_t *) &args[2] + 1),
4367 *((uint8_t *) &args[2] + 2),
4368 *((uint8_t *) &args[2] + 3),
4369 *(uint8_t *) &args[3],
4370 *((uint8_t *) &args[3] + 1),
4371 *((uint8_t *) &args[3] + 2),
4372 *((uint8_t *) &args[3] + 3));
4373 } else {
4374 return false;
4375 }
4376 break;
4377 case WOW_ARP_OFLD_ENABLE:
4378 if (1 == numargs) {
4379 dbglog_printf(timestamp, vap_id,
4380 "Enable ARP offload, for sender %d.%d.%d.%d",
4381 *(uint8_t *) args,
4382 *((uint8_t *) args + 1),
4383 *((uint8_t *) args + 2),
4384 *((uint8_t *) args + 3));
4385 } else {
4386 return false;
4387 }
4388 break;
4389 case WOW_NS_ARP_OFLD_DISABLE:
4390 if (0 == numargs) {
4391 dbglog_printf(timestamp, vap_id,
4392 "disable NS/ARP offload");
4393 } else {
4394 return false;
4395 }
4396 break;
4397 case WOW_NS_RECEIVED:
4398 if (4 == numargs) {
4399 dbglog_printf(timestamp, vap_id,
4400 "NS requested from %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
4401 *(uint8_t *) &args[0],
4402 *((uint8_t *) &args[0] + 1),
4403 *((uint8_t *) &args[0] + 2),
4404 *((uint8_t *) &args[0] + 3),
4405 *(uint8_t *) &args[1],
4406 *((uint8_t *) &args[1] + 1),
4407 *((uint8_t *) &args[1] + 2),
4408 *((uint8_t *) &args[1] + 3),
4409 *(uint8_t *) &args[2],
4410 *((uint8_t *) &args[2] + 1),
4411 *((uint8_t *) &args[2] + 2),
4412 *((uint8_t *) &args[2] + 3),
4413 *(uint8_t *) &args[3],
4414 *((uint8_t *) &args[3] + 1),
4415 *((uint8_t *) &args[3] + 2),
4416 *((uint8_t *) &args[3] + 3));
4417 } else {
4418 return false;
4419 }
4420 break;
4421 case WOW_NS_REPLIED:
4422 if (4 == numargs) {
4423 dbglog_printf(timestamp, vap_id,
4424 "NS replied to %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
4425 *(uint8_t *) &args[0],
4426 *((uint8_t *) &args[0] + 1),
4427 *((uint8_t *) &args[0] + 2),
4428 *((uint8_t *) &args[0] + 3),
4429 *(uint8_t *) &args[1],
4430 *((uint8_t *) &args[1] + 1),
4431 *((uint8_t *) &args[1] + 2),
4432 *((uint8_t *) &args[1] + 3),
4433 *(uint8_t *) &args[2],
4434 *((uint8_t *) &args[2] + 1),
4435 *((uint8_t *) &args[2] + 2),
4436 *((uint8_t *) &args[2] + 3),
4437 *(uint8_t *) &args[3],
4438 *((uint8_t *) &args[3] + 1),
4439 *((uint8_t *) &args[3] + 2),
4440 *((uint8_t *) &args[3] + 3));
4441 } else {
4442 return false;
4443 }
4444 break;
4445 case WOW_ARP_RECEIVED:
4446 if (1 == numargs) {
4447 dbglog_printf(timestamp, vap_id,
4448 "ARP requested from %d.%d.%d.%d",
4449 *(uint8_t *) args,
4450 *((uint8_t *) args + 1),
4451 *((uint8_t *) args + 2),
4452 *((uint8_t *) args + 3));
4453 } else {
4454 return false;
4455 }
4456 break;
4457 break;
4458 case WOW_ARP_REPLIED:
4459 if (1 == numargs) {
4460 dbglog_printf(timestamp, vap_id,
4461 "ARP replied to %d.%d.%d.%d",
4462 *(uint8_t *) args,
4463 *((uint8_t *) args + 1),
4464 *((uint8_t *) args + 2),
4465 *((uint8_t *) args + 3));
4466 } else {
4467 return false;
4468 }
4469 break;
4470 default:
4471 return false;
4472 }
4473
4474 return true;
4475 }
4476
dbglog_parser_type_init(wmi_unified_t wmi_handle,int type)4477 int dbglog_parser_type_init(wmi_unified_t wmi_handle, int type)
4478 {
4479 if (type >= DBGLOG_PROCESS_MAX)
4480 return A_ERROR;
4481
4482 dbglog_process_type = type;
4483 gprint_limiter = false;
4484
4485 return A_OK;
4486 }
4487
dbglog_init(wmi_unified_t wmi_handle)4488 int dbglog_init(wmi_unified_t wmi_handle)
4489 {
4490 QDF_STATUS res;
4491
4492 OS_MEMSET(mod_print, 0, sizeof(mod_print));
4493
4494 dbglog_reg_modprint(WLAN_MODULE_STA_PWRSAVE,
4495 dbglog_sta_powersave_print_handler);
4496 dbglog_reg_modprint(WLAN_MODULE_AP_PWRSAVE,
4497 dbglog_ap_powersave_print_handler);
4498 dbglog_reg_modprint(WLAN_MODULE_WAL, dbglog_wal_print_handler);
4499 dbglog_reg_modprint(WLAN_MODULE_SCAN, dbglog_scan_print_handler);
4500 dbglog_reg_modprint(WLAN_MODULE_RATECTRL,
4501 dbglog_ratectrl_print_handler);
4502 dbglog_reg_modprint(WLAN_MODULE_ANI, dbglog_ani_print_handler);
4503 dbglog_reg_modprint(WLAN_MODULE_COEX, dbglog_coex_print_handler);
4504 dbglog_reg_modprint(WLAN_MODULE_BEACON, dbglog_beacon_print_handler);
4505 dbglog_reg_modprint(WLAN_MODULE_WOW, dbglog_wow_print_handler);
4506 dbglog_reg_modprint(WLAN_MODULE_DATA_TXRX,
4507 dbglog_data_txrx_print_handler);
4508 dbglog_reg_modprint(WLAN_MODULE_STA_SMPS, dbglog_smps_print_handler);
4509 dbglog_reg_modprint(WLAN_MODULE_P2P, dbglog_p2p_print_handler);
4510 dbglog_reg_modprint(WLAN_MODULE_PCIELP, dbglog_pcielp_print_handler);
4511 dbglog_reg_modprint(WLAN_MODULE_IBSS_PWRSAVE,
4512 dbglog_ibss_powersave_print_handler);
4513 tgt_assert_enable = wmi_handle->tgt_force_assert_enable;
4514
4515 /* Register handler for F3 or debug messages */
4516 res =
4517 wmi_unified_register_event_handler(wmi_handle,
4518 wmi_dbg_msg_event_id,
4519 dbglog_parse_debug_logs,
4520 WMI_RX_DIAG_WORK_CTX);
4521 if (QDF_IS_STATUS_ERROR(res))
4522 return A_ERROR;
4523
4524 /* Register handler for FW diag events */
4525 res = wmi_unified_register_event_handler(wmi_handle,
4526 wmi_diag_container_event_id,
4527 fw_diag_data_event_handler,
4528 WMI_RX_DIAG_WORK_CTX);
4529 if (QDF_IS_STATUS_ERROR(res))
4530 return A_ERROR;
4531
4532 /* Register handler for new FW diag Event, LOG, MSG combined */
4533 res = wmi_unified_register_event_handler(wmi_handle, wmi_diag_event_id,
4534 diag_fw_handler,
4535 WMI_RX_DIAG_WORK_CTX);
4536 if (QDF_IS_STATUS_ERROR(res))
4537 return A_ERROR;
4538
4539 /* Initialize debugfs */
4540 dbglog_debugfs_init(wmi_handle);
4541
4542 return A_OK;
4543 }
4544
dbglog_deinit(wmi_unified_t wmi_handle)4545 int dbglog_deinit(wmi_unified_t wmi_handle)
4546 {
4547 QDF_STATUS res;
4548
4549 /* Deinitialize the debugfs */
4550 dbglog_debugfs_remove(wmi_handle);
4551
4552 tgt_assert_enable = 0;
4553 res =
4554 wmi_unified_unregister_event_handler(wmi_handle,
4555 wmi_dbg_msg_event_id);
4556 if (QDF_IS_STATUS_ERROR(res))
4557 return A_ERROR;
4558
4559 return A_OK;
4560 }
4561