Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
David Ahern | f6d3c19 | 2015-08-28 08:42:09 -0700 | [diff] [blame] | 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM fib |
| 4 | |
| 5 | #if !defined(_TRACE_FIB_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define _TRACE_FIB_H |
| 7 | |
| 8 | #include <linux/skbuff.h> |
| 9 | #include <linux/netdevice.h> |
| 10 | #include <net/ip_fib.h> |
| 11 | #include <linux/tracepoint.h> |
| 12 | |
| 13 | TRACE_EVENT(fib_table_lookup, |
| 14 | |
David Ahern | 9b8ff51 | 2015-09-01 14:26:35 -0600 | [diff] [blame] | 15 | TP_PROTO(u32 tb_id, const struct flowi4 *flp), |
David Ahern | f6d3c19 | 2015-08-28 08:42:09 -0700 | [diff] [blame] | 16 | |
| 17 | TP_ARGS(tb_id, flp), |
| 18 | |
| 19 | TP_STRUCT__entry( |
David Ahern | 9b8ff51 | 2015-09-01 14:26:35 -0600 | [diff] [blame] | 20 | __field( u32, tb_id ) |
David Ahern | f6d3c19 | 2015-08-28 08:42:09 -0700 | [diff] [blame] | 21 | __field( int, oif ) |
| 22 | __field( int, iif ) |
| 23 | __field( __u8, tos ) |
| 24 | __field( __u8, scope ) |
| 25 | __field( __u8, flags ) |
| 26 | __array( __u8, src, 4 ) |
| 27 | __array( __u8, dst, 4 ) |
| 28 | ), |
| 29 | |
| 30 | TP_fast_assign( |
| 31 | __be32 *p32; |
| 32 | |
| 33 | __entry->tb_id = tb_id; |
| 34 | __entry->oif = flp->flowi4_oif; |
| 35 | __entry->iif = flp->flowi4_iif; |
| 36 | __entry->tos = flp->flowi4_tos; |
| 37 | __entry->scope = flp->flowi4_scope; |
| 38 | __entry->flags = flp->flowi4_flags; |
| 39 | |
| 40 | p32 = (__be32 *) __entry->src; |
| 41 | *p32 = flp->saddr; |
| 42 | |
| 43 | p32 = (__be32 *) __entry->dst; |
| 44 | *p32 = flp->daddr; |
| 45 | ), |
| 46 | |
David Ahern | 9b8ff51 | 2015-09-01 14:26:35 -0600 | [diff] [blame] | 47 | TP_printk("table %u oif %d iif %d src %pI4 dst %pI4 tos %d scope %d flags %x", |
David Ahern | f6d3c19 | 2015-08-28 08:42:09 -0700 | [diff] [blame] | 48 | __entry->tb_id, __entry->oif, __entry->iif, |
| 49 | __entry->src, __entry->dst, __entry->tos, __entry->scope, |
| 50 | __entry->flags) |
| 51 | ); |
| 52 | |
| 53 | TRACE_EVENT(fib_table_lookup_nh, |
| 54 | |
| 55 | TP_PROTO(const struct fib_nh *nh), |
| 56 | |
| 57 | TP_ARGS(nh), |
| 58 | |
| 59 | TP_STRUCT__entry( |
| 60 | __string( name, nh->nh_dev->name) |
| 61 | __field( int, oif ) |
| 62 | __array( __u8, src, 4 ) |
| 63 | ), |
| 64 | |
| 65 | TP_fast_assign( |
| 66 | __be32 *p32 = (__be32 *) __entry->src; |
| 67 | |
| 68 | __assign_str(name, nh->nh_dev ? nh->nh_dev->name : "not set"); |
| 69 | __entry->oif = nh->nh_oif; |
| 70 | *p32 = nh->nh_saddr; |
| 71 | ), |
| 72 | |
| 73 | TP_printk("nexthop dev %s oif %d src %pI4", |
| 74 | __get_str(name), __entry->oif, __entry->src) |
| 75 | ); |
| 76 | |
| 77 | TRACE_EVENT(fib_validate_source, |
| 78 | |
| 79 | TP_PROTO(const struct net_device *dev, const struct flowi4 *flp), |
| 80 | |
| 81 | TP_ARGS(dev, flp), |
| 82 | |
| 83 | TP_STRUCT__entry( |
| 84 | __string( name, dev->name ) |
| 85 | __field( int, oif ) |
| 86 | __field( int, iif ) |
David Ahern | f0fa6e5 | 2015-08-31 09:57:12 -0600 | [diff] [blame] | 87 | __field( __u8, tos ) |
David Ahern | f6d3c19 | 2015-08-28 08:42:09 -0700 | [diff] [blame] | 88 | __array( __u8, src, 4 ) |
| 89 | __array( __u8, dst, 4 ) |
| 90 | ), |
| 91 | |
| 92 | TP_fast_assign( |
| 93 | __be32 *p32; |
| 94 | |
| 95 | __assign_str(name, dev ? dev->name : "not set"); |
| 96 | __entry->oif = flp->flowi4_oif; |
| 97 | __entry->iif = flp->flowi4_iif; |
David Ahern | f0fa6e5 | 2015-08-31 09:57:12 -0600 | [diff] [blame] | 98 | __entry->tos = flp->flowi4_tos; |
David Ahern | f6d3c19 | 2015-08-28 08:42:09 -0700 | [diff] [blame] | 99 | |
| 100 | p32 = (__be32 *) __entry->src; |
| 101 | *p32 = flp->saddr; |
| 102 | |
| 103 | p32 = (__be32 *) __entry->dst; |
| 104 | *p32 = flp->daddr; |
| 105 | ), |
| 106 | |
David Ahern | f0fa6e5 | 2015-08-31 09:57:12 -0600 | [diff] [blame] | 107 | TP_printk("dev %s oif %d iif %d tos %d src %pI4 dst %pI4", |
| 108 | __get_str(name), __entry->oif, __entry->iif, __entry->tos, |
David Ahern | f6d3c19 | 2015-08-28 08:42:09 -0700 | [diff] [blame] | 109 | __entry->src, __entry->dst) |
| 110 | ); |
| 111 | #endif /* _TRACE_FIB_H */ |
| 112 | |
| 113 | /* This part must be outside protection */ |
| 114 | #include <trace/define_trace.h> |