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 DECLARE_EVENT_CLASS(mlx5_esw_bridge_mdb_port_change_template, 114 TP_PROTO(const struct net_device *dev, 115 const struct mlx5_esw_bridge_mdb_entry *mdb), 116 TP_ARGS(dev, mdb), 117 TP_STRUCT__entry( 118 __array(char, dev_name, IFNAMSIZ) 119 __array(unsigned char, addr, ETH_ALEN) 120 __field(u16, vid) 121 __field(int, num_ports) 122 __field(bool, offloaded)), 123 TP_fast_assign( 124 strscpy(__entry->dev_name, netdev_name(dev), IFNAMSIZ); 125 memcpy(__entry->addr, mdb->key.addr, ETH_ALEN); 126 __entry->vid = mdb->key.vid; 127 __entry->num_ports = mdb->num_ports; 128 __entry->offloaded = mdb->egress_handle;), 129 TP_printk("net_device=%s addr=%pM vid=%u num_ports=%d offloaded=%d", 130 __entry->dev_name, 131 __entry->addr, 132 __entry->vid, 133 __entry->num_ports, 134 __entry->offloaded)); 135 136 DEFINE_EVENT(mlx5_esw_bridge_mdb_port_change_template, 137 mlx5_esw_bridge_port_mdb_attach, 138 TP_PROTO(const struct net_device *dev, 139 const struct mlx5_esw_bridge_mdb_entry *mdb), 140 TP_ARGS(dev, mdb)); 141 142 DEFINE_EVENT(mlx5_esw_bridge_mdb_port_change_template, 143 mlx5_esw_bridge_port_mdb_detach, 144 TP_PROTO(const struct net_device *dev, 145 const struct mlx5_esw_bridge_mdb_entry *mdb), 146 TP_ARGS(dev, mdb)); 147 148 #endif 149 150 /* This part must be outside protection */ 151 #undef TRACE_INCLUDE_PATH 152 #define TRACE_INCLUDE_PATH esw/diag 153 #undef TRACE_INCLUDE_FILE 154 #define TRACE_INCLUDE_FILE bridge_tracepoint 155 #include <trace/define_trace.h> 156