summaryrefslogtreecommitdiff
path: root/net/dsa/trace.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2023-04-12 10:36:07 +0300
committerDavid S. Miller <davem@davemloft.net>2023-04-12 10:36:07 +0300
commitbbda0f0d151cc05b830bb41ed65c4dc2b616c21e (patch)
tree358b258ee28e847e70171711b2d7d31004815160 /net/dsa/trace.c
parent18bb56ab4477b966e2974b96a5e3bf9ba052aac5 (diff)
parent02020bd70fa6abcb1c2a8525ce7c1500dd4f44a8 (diff)
downloadlinux-bbda0f0d151cc05b830bb41ed65c4dc2b616c21e.tar.xz
Merge branch 'dsa-trace-events'
Vladimir Oltean says: ==================== DSA trace events This series introduces the "dsa" trace event class, with the following events: $ trace-cmd list | grep dsa dsa dsa:dsa_fdb_add_hw dsa:dsa_mdb_add_hw dsa:dsa_fdb_del_hw dsa:dsa_mdb_del_hw dsa:dsa_fdb_add_bump dsa:dsa_mdb_add_bump dsa:dsa_fdb_del_drop dsa:dsa_mdb_del_drop dsa:dsa_fdb_del_not_found dsa:dsa_mdb_del_not_found dsa:dsa_lag_fdb_add_hw dsa:dsa_lag_fdb_add_bump dsa:dsa_lag_fdb_del_hw dsa:dsa_lag_fdb_del_drop dsa:dsa_lag_fdb_del_not_found dsa:dsa_vlan_add_hw dsa:dsa_vlan_del_hw dsa:dsa_vlan_add_bump dsa:dsa_vlan_del_drop dsa:dsa_vlan_del_not_found These are useful to debug refcounting issues on CPU and DSA ports, where entries may remain lingering, or may be removed too soon, depending on bugs in higher layers of the network stack. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/trace.c')
-rw-r--r--net/dsa/trace.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/net/dsa/trace.c b/net/dsa/trace.c
new file mode 100644
index 000000000000..1b107165d331
--- /dev/null
+++ b/net/dsa/trace.c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright 2022-2023 NXP
+ */
+
+#define CREATE_TRACE_POINTS
+#include "trace.h"
+
+void dsa_db_print(const struct dsa_db *db, char buf[DSA_DB_BUFSIZ])
+{
+ switch (db->type) {
+ case DSA_DB_PORT:
+ sprintf(buf, "port %s", db->dp->name);
+ break;
+ case DSA_DB_LAG:
+ sprintf(buf, "lag %s id %d", db->lag.dev->name, db->lag.id);
+ break;
+ case DSA_DB_BRIDGE:
+ sprintf(buf, "bridge %s num %d", db->bridge.dev->name,
+ db->bridge.num);
+ break;
+ default:
+ sprintf(buf, "unknown");
+ break;
+ }
+}
+
+const char *dsa_port_kind(const struct dsa_port *dp)
+{
+ switch (dp->type) {
+ case DSA_PORT_TYPE_USER:
+ return "user";
+ case DSA_PORT_TYPE_CPU:
+ return "cpu";
+ case DSA_PORT_TYPE_DSA:
+ return "dsa";
+ default:
+ return "unused";
+ }
+}