History

net: FIB tracepoints

A few useful tracepoints developing VRF driver.

David Ahern committed 11 years ago

Commit f6d3c191 parent 0d5cdef4 files · +120 −0Browse files

Showing the changes to include/trace (1 of 4 files). Show all

Unified · Split

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