1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2 /* Copyright (c) 2021 Mellanox Technologies. */ 3 4 #undef TRACE_SYSTEM 5 #define TRACE_SYSTEM mlx5 6 7 #if !defined(_MLX5_ESW_BRIDGE_TRACEPOINT_) || defined(TRACE_HEADER_MULTI_READ) 8 #define _MLX5_ESW_BRIDGE_TRACEPOINT_ 9 10 #include <linux/tracepoint.h> 11 #include "../bridge_priv.h" 12 13 DECLARE_EVENT_CLASS(mlx5_esw_bridge_fdb_template, 14 TP_PROTO(const struct mlx5_esw_bridge_fdb_entry *fdb), 15 TP_ARGS(fdb), 16 TP_STRUCT__entry( 17 __array(char, dev_name, IFNAMSIZ) 18 __array(unsigned char, addr, ETH_ALEN) 19 __field(u16, vid) 20 __field(u16, flags) 21 __field(unsigned int, used) 22 ), 23 TP_fast_assign( 24 strscpy(__entry->dev_name, 25 netdev_name(fdb->dev), 26 IFNAMSIZ); 27 memcpy(__entry->addr, fdb->key.addr, ETH_ALEN); 28 __entry->vid = fdb->key.vid; 29 __entry->flags = fdb->flags; 30 __entry->used = jiffies_to_msecs(jiffies - fdb->lastuse) 31 ), 32 TP_printk("net_device=%s addr=%pM vid=%hu flags=%hx used=%u", 33 __entry->dev_name, 34 __entry->addr, 35 __entry->vid, 36 __entry->flags, 37 __entry->used / 1000) 38 ); 39 40 DEFINE_EVENT(mlx5_esw_bridge_fdb_template, 41 mlx5_esw_bridge_fdb_entry_init, 42 TP_PROTO(const struct mlx5_esw_bridge_fdb_entry *fdb), 43 TP_ARGS(fdb) 44 ); 45 DEFINE_EVENT(mlx5_esw_bridge_fdb_template, 46 mlx5_esw_bridge_fdb_entry_refresh, 47 TP_PROTO(const struct mlx5_esw_bridge_fdb_entry *fdb), 48 TP_ARGS(fdb) 49 ); 50 DEFINE_EVENT(mlx5_esw_bridge_fdb_template, 51 mlx5_esw_bridge_fdb_entry_cleanup, 52 TP_PROTO(const struct mlx5_esw_bridge_fdb_entry *fdb), 53 TP_ARGS(fdb) 54 ); 55 56 DECLARE_EVENT_CLASS(mlx5_esw_bridge_vlan_template, 57 TP_PROTO(const struct mlx5_esw_bridge_vlan *vlan), 58 TP_ARGS(vlan), 59 TP_STRUCT__entry( 60 __field(u16, vid) 61 __field(u16, flags) 62 ), 63 TP_fast_assign( 64 __entry->vid = vlan->vid; 65 __entry->flags = vlan->flags; 66 ), 67 TP_printk("vid=%hu flags=%hx", 68 __entry->vid, 69 __entry->flags) 70 ); 71 72 DEFINE_EVENT(mlx5_esw_bridge_vlan_template, 73 mlx5_esw_bridge_vlan_create, 74 TP_PROTO(const struct mlx5_esw_bridge_vlan *vlan), 75 TP_ARGS(vlan) 76 ); 77 DEFINE_EVENT(mlx5_esw_bridge_vlan_template, 78 mlx5_esw_bridge_vlan_cleanup, 79 TP_PROTO(const struct mlx5_esw_bridge_vlan *vlan), 80 TP_ARGS(vlan) 81 ); 82 83 DECLARE_EVENT_CLASS(mlx5_esw_bridge_port_template, 84 TP_PROTO(const struct mlx5_esw_bridge_port *port), 85 TP_ARGS(port), 86 TP_STRUCT__entry( 87 __field(u16, vport_num) 88 __field(u16, esw_owner_vhca_id) 89 __field(u16, flags) 90 ), 91 TP_fast_assign( 92 __entry->vport_num = port->vport_num; 93 __entry->esw_owner_vhca_id = port->esw_owner_vhca_id; 94 __entry->flags = port->flags; 95 ), 96 TP_printk("vport_num=%hu esw_owner_vhca_id=%hu flags=%hx", 97 __entry->vport_num, 98 __entry->esw_owner_vhca_id, 99 __entry->flags) 100 ); 101 102 DEFINE_EVENT(mlx5_esw_bridge_port_template, 103 mlx5_esw_bridge_vport_init, 104 TP_PROTO(const struct mlx5_esw_bridge_port *port), 105 TP_ARGS(port) 106 ); 107 DEFINE_EVENT(mlx5_esw_bridge_port_template, 108 mlx5_esw_bridge_vport_cleanup, 109 TP_PROTO(const struct mlx5_esw_bridge_port *port), 110 TP_ARGS(port) 111 ); 112 113 #endif 114 115 /* This part must be outside protection */ 116 #undef TRACE_INCLUDE_PATH 117 #define TRACE_INCLUDE_PATH esw/diag 118 #undef TRACE_INCLUDE_FILE 119 #define TRACE_INCLUDE_FILE bridge_tracepoint 120 #include <trace/define_trace.h> 121