diff options
Diffstat (limited to 'include/trace/events')
-rw-r--r-- | include/trace/events/devlink.h | 129 | ||||
-rw-r--r-- | include/trace/events/mlxsw.h | 119 | ||||
-rw-r--r-- | include/trace/events/neigh.h | 206 | ||||
-rw-r--r-- | include/trace/events/spi.h | 31 |
4 files changed, 481 insertions, 4 deletions
diff --git a/include/trace/events/devlink.h b/include/trace/events/devlink.h index 44acfbca1266..6f60a78d9a7e 100644 --- a/include/trace/events/devlink.h +++ b/include/trace/events/devlink.h @@ -46,6 +46,131 @@ TRACE_EVENT(devlink_hwmsg, (int) __entry->len, __get_dynamic_array(buf), __entry->len) ); +/* + * Tracepoint for devlink hardware error: + */ +TRACE_EVENT(devlink_hwerr, + TP_PROTO(const struct devlink *devlink, int err, const char *msg), + + TP_ARGS(devlink, err, msg), + + TP_STRUCT__entry( + __string(bus_name, devlink->dev->bus->name) + __string(dev_name, dev_name(devlink->dev)) + __string(driver_name, devlink->dev->driver->name) + __field(int, err) + __string(msg, msg) + ), + + TP_fast_assign( + __assign_str(bus_name, devlink->dev->bus->name); + __assign_str(dev_name, dev_name(devlink->dev)); + __assign_str(driver_name, devlink->dev->driver->name); + __entry->err = err; + __assign_str(msg, msg); + ), + + TP_printk("bus_name=%s dev_name=%s driver_name=%s err=%d %s", + __get_str(bus_name), __get_str(dev_name), + __get_str(driver_name), __entry->err, __get_str(msg)) +); + +/* + * Tracepoint for devlink health message: + */ +TRACE_EVENT(devlink_health_report, + TP_PROTO(const struct devlink *devlink, const char *reporter_name, + const char *msg), + + TP_ARGS(devlink, reporter_name, msg), + + TP_STRUCT__entry( + __string(bus_name, devlink->dev->bus->name) + __string(dev_name, dev_name(devlink->dev)) + __string(driver_name, devlink->dev->driver->name) + __string(reporter_name, msg) + __string(msg, msg) + ), + + TP_fast_assign( + __assign_str(bus_name, devlink->dev->bus->name); + __assign_str(dev_name, dev_name(devlink->dev)); + __assign_str(driver_name, devlink->dev->driver->name); + __assign_str(reporter_name, reporter_name); + __assign_str(msg, msg); + ), + + TP_printk("bus_name=%s dev_name=%s driver_name=%s reporter_name=%s: %s", + __get_str(bus_name), __get_str(dev_name), + __get_str(driver_name), __get_str(reporter_name), + __get_str(msg)) +); + +/* + * Tracepoint for devlink health recover aborted message: + */ +TRACE_EVENT(devlink_health_recover_aborted, + TP_PROTO(const struct devlink *devlink, const char *reporter_name, + bool health_state, u64 time_since_last_recover), + + TP_ARGS(devlink, reporter_name, health_state, time_since_last_recover), + + TP_STRUCT__entry( + __string(bus_name, devlink->dev->bus->name) + __string(dev_name, dev_name(devlink->dev)) + __string(driver_name, devlink->dev->driver->name) + __string(reporter_name, reporter_name) + __field(bool, health_state) + __field(u64, time_since_last_recover) + ), + + TP_fast_assign( + __assign_str(bus_name, devlink->dev->bus->name); + __assign_str(dev_name, dev_name(devlink->dev)); + __assign_str(driver_name, devlink->dev->driver->name); + __assign_str(reporter_name, reporter_name); + __entry->health_state = health_state; + __entry->time_since_last_recover = time_since_last_recover; + ), + + TP_printk("bus_name=%s dev_name=%s driver_name=%s reporter_name=%s: health_state=%d time_since_last_recover=%llu recover aborted", + __get_str(bus_name), __get_str(dev_name), + __get_str(driver_name), __get_str(reporter_name), + __entry->health_state, + __entry->time_since_last_recover) +); + +/* + * Tracepoint for devlink health reporter state update: + */ +TRACE_EVENT(devlink_health_reporter_state_update, + TP_PROTO(const struct devlink *devlink, const char *reporter_name, + bool new_state), + + TP_ARGS(devlink, reporter_name, new_state), + + TP_STRUCT__entry( + __string(bus_name, devlink->dev->bus->name) + __string(dev_name, dev_name(devlink->dev)) + __string(driver_name, devlink->dev->driver->name) + __string(reporter_name, reporter_name) + __field(u8, new_state) + ), + + TP_fast_assign( + __assign_str(bus_name, devlink->dev->bus->name); + __assign_str(dev_name, dev_name(devlink->dev)); + __assign_str(driver_name, devlink->dev->driver->name); + __assign_str(reporter_name, reporter_name); + __entry->new_state = new_state; + ), + + TP_printk("bus_name=%s dev_name=%s driver_name=%s reporter_name=%s: new_state=%d", + __get_str(bus_name), __get_str(dev_name), + __get_str(driver_name), __get_str(reporter_name), + __entry->new_state) +); + #endif /* _TRACE_DEVLINK_H */ /* This part must be outside protection */ @@ -64,6 +189,10 @@ static inline void trace_devlink_hwmsg(const struct devlink *devlink, { } +static inline void trace_devlink_hwerr(const struct devlink *devlink, + int err, const char *msg) +{ +} #endif /* _TRACE_DEVLINK_H */ #endif diff --git a/include/trace/events/mlxsw.h b/include/trace/events/mlxsw.h new file mode 100644 index 000000000000..6a4cfaef33a2 --- /dev/null +++ b/include/trace/events/mlxsw.h @@ -0,0 +1,119 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ +/* Copyright (c) 2019 Mellanox Technologies. All rights reserved */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM mlxsw + +#if !defined(_MLXSW_TRACEPOINT_H) || defined(TRACE_HEADER_MULTI_READ) +#define _MLXSW_TRACEPOINT_H + +#include <linux/tracepoint.h> + +struct mlxsw_sp; +struct mlxsw_sp_acl_atcam_region; +struct mlxsw_sp_acl_tcam_vregion; + +TRACE_EVENT(mlxsw_sp_acl_atcam_entry_add_ctcam_spill, + TP_PROTO(const struct mlxsw_sp *mlxsw_sp, + const struct mlxsw_sp_acl_atcam_region *aregion), + + TP_ARGS(mlxsw_sp, aregion), + + TP_STRUCT__entry( + __field(const void *, mlxsw_sp) + __field(const void *, aregion) + ), + + TP_fast_assign( + __entry->mlxsw_sp = mlxsw_sp; + __entry->aregion = aregion; + ), + + TP_printk("mlxsw_sp %p, aregion %p", + __entry->mlxsw_sp, __entry->aregion) +); + +TRACE_EVENT(mlxsw_sp_acl_tcam_vregion_rehash, + TP_PROTO(const struct mlxsw_sp *mlxsw_sp, + const struct mlxsw_sp_acl_tcam_vregion *vregion), + + TP_ARGS(mlxsw_sp, vregion), + + TP_STRUCT__entry( + __field(const void *, mlxsw_sp) + __field(const void *, vregion) + ), + + TP_fast_assign( + __entry->mlxsw_sp = mlxsw_sp; + __entry->vregion = vregion; + ), + + TP_printk("mlxsw_sp %p, vregion %p", + __entry->mlxsw_sp, __entry->vregion) +); + +TRACE_EVENT(mlxsw_sp_acl_tcam_vregion_migrate, + TP_PROTO(const struct mlxsw_sp *mlxsw_sp, + const struct mlxsw_sp_acl_tcam_vregion *vregion), + + TP_ARGS(mlxsw_sp, vregion), + + TP_STRUCT__entry( + __field(const void *, mlxsw_sp) + __field(const void *, vregion) + ), + + TP_fast_assign( + __entry->mlxsw_sp = mlxsw_sp; + __entry->vregion = vregion; + ), + + TP_printk("mlxsw_sp %p, vregion %p", + __entry->mlxsw_sp, __entry->vregion) +); + +TRACE_EVENT(mlxsw_sp_acl_tcam_vregion_migrate_end, + TP_PROTO(const struct mlxsw_sp *mlxsw_sp, + const struct mlxsw_sp_acl_tcam_vregion *vregion), + + TP_ARGS(mlxsw_sp, vregion), + + TP_STRUCT__entry( + __field(const void *, mlxsw_sp) + __field(const void *, vregion) + ), + + TP_fast_assign( + __entry->mlxsw_sp = mlxsw_sp; + __entry->vregion = vregion; + ), + + TP_printk("mlxsw_sp %p, vregion %p", + __entry->mlxsw_sp, __entry->vregion) +); + +TRACE_EVENT(mlxsw_sp_acl_tcam_vregion_rehash_dis, + TP_PROTO(const struct mlxsw_sp *mlxsw_sp, + const struct mlxsw_sp_acl_tcam_vregion *vregion), + + TP_ARGS(mlxsw_sp, vregion), + + TP_STRUCT__entry( + __field(const void *, mlxsw_sp) + __field(const void *, vregion) + ), + + TP_fast_assign( + __entry->mlxsw_sp = mlxsw_sp; + __entry->vregion = vregion; + ), + + TP_printk("mlxsw_sp %p, vregion %p", + __entry->mlxsw_sp, __entry->vregion) +); + +#endif /* _MLXSW_TRACEPOINT_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> diff --git a/include/trace/events/neigh.h b/include/trace/events/neigh.h new file mode 100644 index 000000000000..0bdb08557763 --- /dev/null +++ b/include/trace/events/neigh.h @@ -0,0 +1,206 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM neigh + +#if !defined(_TRACE_NEIGH_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_NEIGH_H + +#include <linux/skbuff.h> +#include <linux/netdevice.h> +#include <linux/tracepoint.h> +#include <net/neighbour.h> + +#define neigh_state_str(state) \ + __print_symbolic(state, \ + { NUD_INCOMPLETE, "incomplete" }, \ + { NUD_REACHABLE, "reachable" }, \ + { NUD_STALE, "stale" }, \ + { NUD_DELAY, "delay" }, \ + { NUD_PROBE, "probe" }, \ + { NUD_FAILED, "failed" }, \ + { NUD_NOARP, "noarp" }, \ + { NUD_PERMANENT, "permanent"}) + +TRACE_EVENT(neigh_update, + + TP_PROTO(struct neighbour *n, const u8 *lladdr, u8 new, + u32 flags, u32 nlmsg_pid), + + TP_ARGS(n, lladdr, new, flags, nlmsg_pid), + + TP_STRUCT__entry( + __field(u32, family) + __string(dev, (n->dev ? n->dev->name : "NULL")) + __array(u8, lladdr, MAX_ADDR_LEN) + __field(u8, lladdr_len) + __field(u8, flags) + __field(u8, nud_state) + __field(u8, type) + __field(u8, dead) + __field(int, refcnt) + __array(__u8, primary_key4, 4) + __array(__u8, primary_key6, 16) + __field(unsigned long, confirmed) + __field(unsigned long, updated) + __field(unsigned long, used) + __array(u8, new_lladdr, MAX_ADDR_LEN) + __field(u8, new_state) + __field(u32, update_flags) + __field(u32, pid) + ), + + TP_fast_assign( + int lladdr_len = (n->dev ? n->dev->addr_len : MAX_ADDR_LEN); + struct in6_addr *pin6; + __be32 *p32; + + __entry->family = n->tbl->family; + __assign_str(dev, (n->dev ? n->dev->name : "NULL")); + __entry->lladdr_len = lladdr_len; + memcpy(__entry->lladdr, n->ha, lladdr_len); + __entry->flags = n->flags; + __entry->nud_state = n->nud_state; + __entry->type = n->type; + __entry->dead = n->dead; + __entry->refcnt = refcount_read(&n->refcnt); + pin6 = (struct in6_addr *)__entry->primary_key6; + p32 = (__be32 *)__entry->primary_key4; + + if (n->tbl->family == AF_INET) + *p32 = *(__be32 *)n->primary_key; + else + *p32 = 0; + +#if IS_ENABLED(CONFIG_IPV6) + if (n->tbl->family == AF_INET6) { + pin6 = (struct in6_addr *)__entry->primary_key6; + *pin6 = *(struct in6_addr *)n->primary_key; + } else +#endif + { + ipv6_addr_set_v4mapped(*p32, pin6); + } + __entry->confirmed = n->confirmed; + __entry->updated = n->updated; + __entry->used = n->used; + if (lladdr) + memcpy(__entry->new_lladdr, lladdr, lladdr_len); + __entry->new_state = new; + __entry->update_flags = flags; + __entry->pid = nlmsg_pid; + ), + + TP_printk("family %d dev %s lladdr %s flags %02x nud_state %s type %02x " + "dead %d refcnt %d primary_key4 %pI4 primary_key6 %pI6c " + "confirmed %lu updated %lu used %lu new_lladdr %s " + "new_state %s update_flags %02x pid %d", + __entry->family, __get_str(dev), + __print_hex_str(__entry->lladdr, __entry->lladdr_len), + __entry->flags, neigh_state_str(__entry->nud_state), + __entry->type, __entry->dead, __entry->refcnt, + __entry->primary_key4, __entry->primary_key6, + __entry->confirmed, __entry->updated, __entry->used, + __print_hex_str(__entry->new_lladdr, __entry->lladdr_len), + neigh_state_str(__entry->new_state), + __entry->update_flags, __entry->pid) +); + +DECLARE_EVENT_CLASS(neigh__update, + TP_PROTO(struct neighbour *n, int err), + TP_ARGS(n, err), + TP_STRUCT__entry( + __field(u32, family) + __string(dev, (n->dev ? n->dev->name : "NULL")) + __array(u8, lladdr, MAX_ADDR_LEN) + __field(u8, lladdr_len) + __field(u8, flags) + __field(u8, nud_state) + __field(u8, type) + __field(u8, dead) + __field(int, refcnt) + __array(__u8, primary_key4, 4) + __array(__u8, primary_key6, 16) + __field(unsigned long, confirmed) + __field(unsigned long, updated) + __field(unsigned long, used) + __field(u32, err) + ), + + TP_fast_assign( + int lladdr_len = (n->dev ? n->dev->addr_len : MAX_ADDR_LEN); + struct in6_addr *pin6; + __be32 *p32; + + __entry->family = n->tbl->family; + __assign_str(dev, (n->dev ? n->dev->name : "NULL")); + __entry->lladdr_len = lladdr_len; + memcpy(__entry->lladdr, n->ha, lladdr_len); + __entry->flags = n->flags; + __entry->nud_state = n->nud_state; + __entry->type = n->type; + __entry->dead = n->dead; + __entry->refcnt = refcount_read(&n->refcnt); + pin6 = (struct in6_addr *)__entry->primary_key6; + p32 = (__be32 *)__entry->primary_key4; + + if (n->tbl->family == AF_INET) + *p32 = *(__be32 *)n->primary_key; + else + *p32 = 0; + +#if IS_ENABLED(CONFIG_IPV6) + if (n->tbl->family == AF_INET6) { + pin6 = (struct in6_addr *)__entry->primary_key6; + *pin6 = *(struct in6_addr *)n->primary_key; + } else +#endif + { + ipv6_addr_set_v4mapped(*p32, pin6); + } + + __entry->confirmed = n->confirmed; + __entry->updated = n->updated; + __entry->used = n->used; + __entry->err = err; + ), + + TP_printk("family %d dev %s lladdr %s flags %02x nud_state %s type %02x " + "dead %d refcnt %d primary_key4 %pI4 primary_key6 %pI6c " + "confirmed %lu updated %lu used %lu err %d", + __entry->family, __get_str(dev), + __print_hex_str(__entry->lladdr, __entry->lladdr_len), + __entry->flags, neigh_state_str(__entry->nud_state), + __entry->type, __entry->dead, __entry->refcnt, + __entry->primary_key4, __entry->primary_key6, + __entry->confirmed, __entry->updated, __entry->used, + __entry->err) +); + +DEFINE_EVENT(neigh__update, neigh_update_done, + TP_PROTO(struct neighbour *neigh, int err), + TP_ARGS(neigh, err) +); + +DEFINE_EVENT(neigh__update, neigh_timer_handler, + TP_PROTO(struct neighbour *neigh, int err), + TP_ARGS(neigh, err) +); + +DEFINE_EVENT(neigh__update, neigh_event_send_done, + TP_PROTO(struct neighbour *neigh, int err), + TP_ARGS(neigh, err) +); + +DEFINE_EVENT(neigh__update, neigh_event_send_dead, + TP_PROTO(struct neighbour *neigh, int err), + TP_ARGS(neigh, err) +); + +DEFINE_EVENT(neigh__update, neigh_cleanup_and_release, + TP_PROTO(struct neighbour *neigh, int rc), + TP_ARGS(neigh, rc) +); + +#endif /* _TRACE_NEIGH_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> diff --git a/include/trace/events/spi.h b/include/trace/events/spi.h index 277bb9d25779..aef6869f563d 100644 --- a/include/trace/events/spi.h +++ b/include/trace/events/spi.h @@ -109,6 +109,16 @@ TRACE_EVENT(spi_message_done, (unsigned)__entry->actual, (unsigned)__entry->frame) ); +/* + * consider a buffer valid if non-NULL and if it doesn't match the dummy buffer + * that only exist to work with controllers that have SPI_CONTROLLER_MUST_TX or + * SPI_CONTROLLER_MUST_RX. + */ +#define spi_valid_txbuf(msg, xfer) \ + (xfer->tx_buf && xfer->tx_buf != msg->spi->controller->dummy_tx) +#define spi_valid_rxbuf(msg, xfer) \ + (xfer->rx_buf && xfer->rx_buf != msg->spi->controller->dummy_rx) + DECLARE_EVENT_CLASS(spi_transfer, TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer), @@ -120,6 +130,10 @@ DECLARE_EVENT_CLASS(spi_transfer, __field( int, chip_select ) __field( struct spi_transfer *, xfer ) __field( int, len ) + __dynamic_array(u8, rx_buf, + spi_valid_rxbuf(msg, xfer) ? xfer->len : 0) + __dynamic_array(u8, tx_buf, + spi_valid_txbuf(msg, xfer) ? xfer->len : 0) ), TP_fast_assign( @@ -127,12 +141,21 @@ DECLARE_EVENT_CLASS(spi_transfer, __entry->chip_select = msg->spi->chip_select; __entry->xfer = xfer; __entry->len = xfer->len; + + if (spi_valid_txbuf(msg, xfer)) + memcpy(__get_dynamic_array(tx_buf), + xfer->tx_buf, xfer->len); + + if (spi_valid_rxbuf(msg, xfer)) + memcpy(__get_dynamic_array(rx_buf), + xfer->rx_buf, xfer->len); ), - TP_printk("spi%d.%d %p len=%d", (int)__entry->bus_num, - (int)__entry->chip_select, - (struct spi_message *)__entry->xfer, - (int)__entry->len) + TP_printk("spi%d.%d %p len=%d tx=[%*phD] rx=[%*phD]", + __entry->bus_num, __entry->chip_select, + __entry->xfer, __entry->len, + __get_dynamic_array_len(tx_buf), __get_dynamic_array(tx_buf), + __get_dynamic_array_len(rx_buf), __get_dynamic_array(rx_buf)) ); DEFINE_EVENT(spi_transfer, spi_transfer_start, |