|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright (c) 2013-2018, 2020 The Linux Foundation. All rights reserved.
|
|
|
+ * Copyright (c) 2013-2018, 2020-2021 The Linux Foundation. All rights reserved.
|
|
|
*
|
|
|
* Permission to use, copy, modify, and/or distribute this software for
|
|
|
* any purpose with or without fee is hereby granted, provided that the
|
|
@@ -30,6 +30,14 @@
|
|
|
#include "wlan_roam_debug.h"
|
|
|
|
|
|
#ifdef FEATURE_ROAM_DEBUG
|
|
|
+static void wlan_roam_rec_print(struct wlan_roam_debug_rec *dbg_rec,
|
|
|
+ uint32_t idx, uint32_t delta,
|
|
|
+ bool to_kernel);
|
|
|
+
|
|
|
+static void wlan_conn_rec_print(struct wlan_roam_debug_rec *dbg_rec,
|
|
|
+ uint32_t idx, uint32_t delta,
|
|
|
+ bool to_kernel);
|
|
|
+
|
|
|
#ifdef WLAN_LOGGING_BUFFERS_DYNAMICALLY
|
|
|
static struct wlan_roam_debug_info *global_wlan_roam_debug_table;
|
|
|
|
|
@@ -40,23 +48,35 @@ static struct wlan_roam_debug_info *global_wlan_roam_debug_table;
|
|
|
*/
|
|
|
void wlan_roam_debug_init(void)
|
|
|
{
|
|
|
+ uint8_t i;
|
|
|
global_wlan_roam_debug_table = vzalloc(
|
|
|
- sizeof(*global_wlan_roam_debug_table));
|
|
|
+ sizeof(struct wlan_roam_debug_info) * REC_MAX);
|
|
|
|
|
|
QDF_BUG(global_wlan_roam_debug_table);
|
|
|
|
|
|
if (global_wlan_roam_debug_table) {
|
|
|
- qdf_atomic_init(&global_wlan_roam_debug_table->index);
|
|
|
- global_wlan_roam_debug_table->num_max_rec =
|
|
|
+ for (i = 0; i < REC_MAX; i++) {
|
|
|
+ qdf_atomic_init(&global_wlan_roam_debug_table[i].index);
|
|
|
+ global_wlan_roam_debug_table[i].num_max_rec =
|
|
|
WLAN_ROAM_DEBUG_MAX_REC;
|
|
|
+ if (i == REC_ROAM)
|
|
|
+ global_wlan_roam_debug_table[i].rec_print =
|
|
|
+ wlan_roam_rec_print;
|
|
|
+ else
|
|
|
+ global_wlan_roam_debug_table[i].rec_print =
|
|
|
+ wlan_conn_rec_print;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
qdf_export_symbol(wlan_roam_debug_init);
|
|
|
|
|
|
-static inline struct wlan_roam_debug_info *wlan_roam_debug_get_table(void)
|
|
|
+static inline struct wlan_roam_debug_info *wlan_roam_debug_get_table(
|
|
|
+ wlan_rec_type type)
|
|
|
{
|
|
|
- return global_wlan_roam_debug_table;
|
|
|
+ if (type >= REC_MAX)
|
|
|
+ return NULL;
|
|
|
+ return &global_wlan_roam_debug_table[type];
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -77,14 +97,21 @@ qdf_export_symbol(wlan_roam_debug_deinit);
|
|
|
* without requiring any psoc or vdev context. It will be accessible in
|
|
|
* the crash dump without having to dereference complex stack traces.
|
|
|
*/
|
|
|
-static struct wlan_roam_debug_info global_wlan_roam_debug_table = {
|
|
|
- { 0 },
|
|
|
- WLAN_ROAM_DEBUG_MAX_REC,
|
|
|
+static struct wlan_roam_debug_info global_wlan_roam_debug_table[REC_MAX] = {
|
|
|
+ [REC_ROAM] = {{ 0 },
|
|
|
+ .num_max_rec = WLAN_ROAM_DEBUG_MAX_REC,
|
|
|
+ .rec_print = wlan_roam_rec_print},
|
|
|
+ [REC_CONN] = {{ 0 },
|
|
|
+ .num_max_rec = WLAN_ROAM_DEBUG_MAX_REC,
|
|
|
+ .rec_print = wlan_conn_rec_print},
|
|
|
};
|
|
|
|
|
|
-static inline struct wlan_roam_debug_info *wlan_roam_debug_get_table(void)
|
|
|
+static inline struct wlan_roam_debug_info *wlan_roam_debug_get_table(
|
|
|
+ wlan_rec_type type)
|
|
|
{
|
|
|
- return &global_wlan_roam_debug_table;
|
|
|
+ if (type >= REC_MAX)
|
|
|
+ return NULL;
|
|
|
+ return &global_wlan_roam_debug_table[type];
|
|
|
}
|
|
|
#endif /* WLAN_LOGGING_BUFFERS_DYNAMICALLY */
|
|
|
|
|
@@ -122,12 +149,22 @@ static int wlan_roam_next_debug_log_index(qdf_atomic_t *index, int size)
|
|
|
void wlan_roam_debug_log(uint8_t vdev_id, uint8_t op,
|
|
|
uint16_t peer_id, void *mac_addr,
|
|
|
void *peer_obj, uint32_t arg1, uint32_t arg2)
|
|
|
+{
|
|
|
+ wlan_rec_debug_log(REC_ROAM, vdev_id, op, peer_id, mac_addr,
|
|
|
+ peer_obj, arg1, arg2);
|
|
|
+}
|
|
|
+
|
|
|
+qdf_export_symbol(wlan_roam_debug_log);
|
|
|
+
|
|
|
+void wlan_rec_debug_log(wlan_rec_type rec_type, uint8_t vdev_id, uint8_t op,
|
|
|
+ uint16_t peer_id, const void *mac_addr,
|
|
|
+ void *peer_obj, uint32_t arg1, uint32_t arg2)
|
|
|
{
|
|
|
uint32_t i;
|
|
|
struct wlan_roam_debug_info *dbg_tbl;
|
|
|
struct wlan_roam_debug_rec *rec;
|
|
|
|
|
|
- dbg_tbl = wlan_roam_debug_get_table();
|
|
|
+ dbg_tbl = wlan_roam_debug_get_table(rec_type);
|
|
|
if (!dbg_tbl)
|
|
|
return;
|
|
|
|
|
@@ -149,7 +186,8 @@ void wlan_roam_debug_log(uint8_t vdev_id, uint8_t op,
|
|
|
rec->arg1 = arg1;
|
|
|
rec->arg2 = arg2;
|
|
|
}
|
|
|
-qdf_export_symbol(wlan_roam_debug_log);
|
|
|
+
|
|
|
+qdf_export_symbol(wlan_rec_debug_log);
|
|
|
|
|
|
/**
|
|
|
* wlan_roam_debug_string() - convert operation value to printable string
|
|
@@ -192,18 +230,72 @@ static char *wlan_roam_debug_string(uint32_t op)
|
|
|
return "host wakeup";
|
|
|
case DEBUG_WOW_REASON:
|
|
|
return "wow wakeup reason";
|
|
|
+ case DEBUG_CONN_CONNECTING:
|
|
|
+ return "conn";
|
|
|
+ case DEBUG_CONN_ASSOCIATION:
|
|
|
+ return "assoc";
|
|
|
+ case DEBUG_CONN_CONNECT_RESULT:
|
|
|
+ return "cnrlt";
|
|
|
+ case DEBUG_CONN_ROAMING:
|
|
|
+ return "roaming";
|
|
|
+ case DEBUG_CONN_ROAMED:
|
|
|
+ return "roamed";
|
|
|
+ case DEBUG_CONN_ROAMED_IND:
|
|
|
+ return "rmind";
|
|
|
+ case DEBUG_CONN_DISCONNECT:
|
|
|
+ return "disc";
|
|
|
+ case DEBUG_CONN_DISCONNECT_HANDLER:
|
|
|
+ return "dishdr";
|
|
|
+ case DEBUG_CONN_DISCONNECT_IND:
|
|
|
+ return "disind";
|
|
|
default:
|
|
|
return "unknown";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void wlan_roam_rec_print(struct wlan_roam_debug_rec *dbg_rec,
|
|
|
+ uint32_t idx, uint32_t delta,
|
|
|
+ bool to_kernel)
|
|
|
+{
|
|
|
+ roam_debug("index = %5d timestamp = 0x%016llx delta ms = %-12u",
|
|
|
+ idx, dbg_rec->time, delta);
|
|
|
+ roam_debug("info = %-24s vdev_id = %-3d mac addr = "QDF_MAC_ADDR_FMT,
|
|
|
+ wlan_roam_debug_string(dbg_rec->operation),
|
|
|
+ (int8_t)dbg_rec->vdev_id,
|
|
|
+ QDF_MAC_ADDR_REF(dbg_rec->mac_addr.bytes));
|
|
|
+ roam_debug("peer obj = 0x%pK peer_id = %-4d", dbg_rec->peer_obj,
|
|
|
+ (int8_t)dbg_rec->peer_id);
|
|
|
+ roam_debug("arg1 = 0x%-8x arg2 = 0x%-8x", dbg_rec->arg1,
|
|
|
+ dbg_rec->arg2);
|
|
|
+}
|
|
|
+
|
|
|
+void wlan_conn_rec_print(struct wlan_roam_debug_rec *dbg_rec,
|
|
|
+ uint32_t idx, uint32_t delta,
|
|
|
+ bool to_kernel)
|
|
|
+{
|
|
|
+ if (to_kernel) {
|
|
|
+ roam_info("i %d ti 0x%08llx ms %u vdv %d %s a1 0x%x a2 0x%x "QDF_MAC_ADDR_FMT,
|
|
|
+ idx, dbg_rec->time, delta, (int8_t)dbg_rec->vdev_id,
|
|
|
+ wlan_roam_debug_string(dbg_rec->operation),
|
|
|
+ dbg_rec->arg1, dbg_rec->arg2,
|
|
|
+ QDF_MAC_ADDR_REF(dbg_rec->mac_addr.bytes));
|
|
|
+ } else {
|
|
|
+ roam_debug("i %d ti 0x%08llx ms %u vdv %d %s a1 0x%x a2 0x%x "QDF_MAC_ADDR_FMT,
|
|
|
+ idx, dbg_rec->time, delta, (int8_t)dbg_rec->vdev_id,
|
|
|
+ wlan_roam_debug_string(dbg_rec->operation),
|
|
|
+ dbg_rec->arg1, dbg_rec->arg2,
|
|
|
+ QDF_MAC_ADDR_REF(dbg_rec->mac_addr.bytes));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
- * wlan_roam_debug_dump_table() - Print the wlan roam debug log records
|
|
|
+ * wlan_rec_debug_dump_table() - Print the wlan roam debug log records
|
|
|
* print all the valid debug records in the order of timestamp
|
|
|
*
|
|
|
* Return: none
|
|
|
*/
|
|
|
-void wlan_roam_debug_dump_table(void)
|
|
|
+void wlan_rec_debug_dump_table(wlan_rec_type rec_type, uint32_t count,
|
|
|
+ bool to_kernel)
|
|
|
{
|
|
|
uint32_t i;
|
|
|
int32_t current_index;
|
|
@@ -213,8 +305,9 @@ void wlan_roam_debug_dump_table(void)
|
|
|
uint32_t delta;
|
|
|
|
|
|
#define DEBUG_CLOCK_TICKS_PER_MSEC 19200
|
|
|
-
|
|
|
- dbg_tbl = wlan_roam_debug_get_table();
|
|
|
+ if (count > WLAN_ROAM_DEBUG_MAX_REC)
|
|
|
+ count = WLAN_ROAM_DEBUG_MAX_REC;
|
|
|
+ dbg_tbl = wlan_roam_debug_get_table(rec_type);
|
|
|
if (!dbg_tbl)
|
|
|
return;
|
|
|
|
|
@@ -223,9 +316,11 @@ void wlan_roam_debug_dump_table(void)
|
|
|
roam_debug("No records to dump");
|
|
|
return;
|
|
|
}
|
|
|
- roam_debug("Dumping all records. current index %d", current_index);
|
|
|
+ roam_debug("dump %d rec type %d idx %d", count, rec_type,
|
|
|
+ current_index);
|
|
|
|
|
|
- i = current_index;
|
|
|
+ i = (current_index + WLAN_ROAM_DEBUG_MAX_REC - count) %
|
|
|
+ WLAN_ROAM_DEBUG_MAX_REC;
|
|
|
do {
|
|
|
/* wrap around */
|
|
|
i = (i + 1) % WLAN_ROAM_DEBUG_MAX_REC;
|
|
@@ -233,9 +328,12 @@ void wlan_roam_debug_dump_table(void)
|
|
|
/* skip unused entry */
|
|
|
if (dbg_rec->time == 0)
|
|
|
continue;
|
|
|
+ if (count == 0)
|
|
|
+ break;
|
|
|
+ count--;
|
|
|
+
|
|
|
if (startt == 0)
|
|
|
startt = dbg_rec->time;
|
|
|
-
|
|
|
/*
|
|
|
* Divide by 19200 == right shift 8 bits, then divide by 75
|
|
|
* 32 bit computation keeps both 32 and 64 bit compilers happy.
|
|
@@ -245,18 +343,23 @@ void wlan_roam_debug_dump_table(void)
|
|
|
0xffffffff);
|
|
|
delta = delta / (DEBUG_CLOCK_TICKS_PER_MSEC >> 8);
|
|
|
|
|
|
- roam_debug("index = %5d timestamp = 0x%016llx delta ms = %-12u",
|
|
|
- i, dbg_rec->time, delta);
|
|
|
- roam_debug("info = %-24s vdev_id = %-3d mac addr = "QDF_MAC_ADDR_FMT,
|
|
|
- wlan_roam_debug_string(dbg_rec->operation),
|
|
|
- (int8_t)dbg_rec->vdev_id,
|
|
|
- QDF_MAC_ADDR_REF(dbg_rec->mac_addr.bytes));
|
|
|
- roam_debug("peer obj = 0x%pK peer_id = %-4d", dbg_rec->peer_obj,
|
|
|
- (int8_t)dbg_rec->peer_id);
|
|
|
- roam_debug("arg1 = 0x%-8x arg2 = 0x%-8x", dbg_rec->arg1,
|
|
|
- dbg_rec->arg2);
|
|
|
+ if (dbg_tbl->rec_print)
|
|
|
+ dbg_tbl->rec_print(dbg_rec, i, delta, to_kernel);
|
|
|
} while (i != current_index);
|
|
|
}
|
|
|
+
|
|
|
+qdf_export_symbol(wlan_rec_debug_dump_table);
|
|
|
+
|
|
|
+/**
|
|
|
+ * wlan_roam_debug_dump_table() - Print the wlan roam debug log records
|
|
|
+ * print all the valid debug records in the order of timestamp
|
|
|
+ *
|
|
|
+ * Return: none
|
|
|
+ */
|
|
|
+void wlan_roam_debug_dump_table(void)
|
|
|
+{
|
|
|
+ wlan_rec_debug_dump_table(REC_ROAM, WLAN_ROAM_DEBUG_MAX_REC, false);
|
|
|
+}
|
|
|
qdf_export_symbol(wlan_roam_debug_dump_table);
|
|
|
|
|
|
#endif /* FEATURE_ROAM_DEBUG */
|